diff options
302 files changed, 7717 insertions, 5088 deletions
diff --git a/indra/integration_tests/llui_libtest/llui_libtest.cpp b/indra/integration_tests/llui_libtest/llui_libtest.cpp index 54fc167adf..3d433fdfdc 100644 --- a/indra/integration_tests/llui_libtest/llui_libtest.cpp +++ b/indra/integration_tests/llui_libtest/llui_libtest.cpp @@ -52,6 +52,11 @@ // *TODO: switch to using TUT // *TODO: teach Parabuild about this program, run automatically after full builds +// I believe these must be globals, not stack variables. JC +LLControlGroup gSavedSettings("Global"); // saved at end of session +LLControlGroup gSavedPerAccountSettings("PerAccount"); // saved at end of session +LLControlGroup gWarningSettings("Warnings"); // persists ignored dialogs/warnings + // We can't create LLImageGL objects because we have no window or rendering // context. Provide enough of an LLUIImage to test the LLUI library without // an underlying image. @@ -73,6 +78,7 @@ public: } }; + class LLTexture ; // We need to supply dummy images class TestImageProvider : public LLImageProviderInterface @@ -95,10 +101,16 @@ public: LLPointer<LLUIImage> makeImage() { LLPointer<LLTexture> image_gl; - LLPointer<LLUIImage> image = new LLUIImage( std::string(), image_gl); + LLPointer<LLUIImage> image = new TestUIImage(); //LLUIImage( std::string(), image_gl); + mImageList.push_back(image); return image; } + +public: + // Unclear if we need this, hold on to one copy of each image we make + std::vector<LLPointer<LLUIImage> > mImageList; }; +TestImageProvider gTestImageProvider; static std::string get_xui_dir() { @@ -117,27 +129,22 @@ void init_llui() gDirUtilp->initAppDirs("SecondLife", newview_path); gDirUtilp->setSkinFolder("default"); + // colors are no longer stored in a LLControlGroup file + LLUIColorTable::instance().loadFromSettings(); + std::string config_filename = gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS, "settings.xml"); - LLControlGroup config_group("config"); - config_group.loadFromFile(config_filename); - - std::string color_filename = gDirUtilp->getExpandedFilename( - LL_PATH_DEFAULT_SKIN, "colors.xml"); - LLControlGroup color_group("color"); - color_group.loadFromFile(color_filename); + gSavedSettings.loadFromFile(config_filename); - LLControlGroup floater_group("floater"); - LLControlGroup ignores_group("ignores"); + // See LLAppViewer::init() LLUI::settings_map_t settings; - settings["config"] = &config_group; - settings["color"] = &color_group; - settings["floater"] = &floater_group; - settings["ignores"] = &ignores_group; + settings["config"] = &gSavedSettings; + settings["ignores"] = &gWarningSettings; + settings["floater"] = &gSavedSettings; + settings["account"] = &gSavedPerAccountSettings; // Don't use real images as we don't have a GL context - TestImageProvider image_provider; - LLUI::initClass(settings, &image_provider); + LLUI::initClass(settings, &gTestImageProvider); const bool no_register_widgets = false; LLWidgetReg::initClass( no_register_widgets ); @@ -148,7 +155,7 @@ void init_llui() // (tooltips for buttons) std::set<std::string> default_args; LLTrans::parseStrings("strings.xml", default_args); - + LLTrans::parseLanguageStrings("language_settings.xml"); LLFontManager::initClass(); // Creating widgets apparently requires fonts to be initialized, @@ -183,10 +190,10 @@ void export_test_floaters() llinfos << "Converting " << filename << llendl; // Build a floater and output new attributes LLXMLNodePtr output_node = new LLXMLNode(); - LLFloater* floater = new LLFloater(); + LLFloater* floater = new LLFloater(LLSD()); LLUICtrlFactory::getInstance()->buildFloater(floater, filename, - FALSE, // don't open floater + // FALSE, // don't open floater output_node); std::string out_filename = xui_dir + filename; std::string::size_type extension_pos = out_filename.rfind(".xml"); diff --git a/indra/llcharacter/llmultigesture.cpp b/indra/llcharacter/llmultigesture.cpp index 701d6889ca..05d1bc0cd9 100644 --- a/indra/llcharacter/llmultigesture.cpp +++ b/indra/llcharacter/llmultigesture.cpp @@ -50,6 +50,7 @@ const S32 GESTURE_VERSION = 2; LLMultiGesture::LLMultiGesture() : mKey(), mMask(), + mName(), mTrigger(), mReplaceText(), mSteps(), diff --git a/indra/llcharacter/llmultigesture.h b/indra/llcharacter/llmultigesture.h index fdffb35c31..fdcf32dc67 100644 --- a/indra/llcharacter/llmultigesture.h +++ b/indra/llcharacter/llmultigesture.h @@ -65,11 +65,13 @@ protected: const LLMultiGesture& operator=(const LLMultiGesture& rhs); public: - // name is stored at asset level - // desc is stored at asset level KEY mKey; MASK mMask; + // This name can be empty if the inventory item is not around and + // the gesture manager has not yet set the name + std::string mName; + // String, like "/foo" or "hello" that makes it play std::string mTrigger; diff --git a/indra/llcharacter/llpose.cpp b/indra/llcharacter/llpose.cpp index 93255d702c..dd4880dbb9 100644 --- a/indra/llcharacter/llpose.cpp +++ b/indra/llcharacter/llpose.cpp @@ -516,9 +516,9 @@ BOOL LLPoseBlender::addMotion(LLMotion* motion) void LLPoseBlender::blendAndApply() { for (blender_list_t::iterator iter = mActiveBlenders.begin(); - iter != mActiveBlenders.end(); ++iter) + iter != mActiveBlenders.end(); ) { - LLJointStateBlender* jsbp = *iter; + LLJointStateBlender* jsbp = *iter++; jsbp->blendJointStates(); } diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index dc1457e4f7..2e7d845bf7 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -143,7 +143,14 @@ public: { return *getInstance(); } - + + // Has this singleton been created uet? + // Use this to avoid accessing singletons before the can safely be constructed + static bool instanceExists() + { + return getData().mInitState == INITIALIZED; + } + // Has this singleton already been deleted? // Use this to avoid accessing singletons from a static object's destructor static bool destroyed() diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 91a95cdd25..62534969b7 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -237,7 +237,7 @@ F32 LLFontFreetype::getXAdvance(llwchar wch) const if (mFTFace == NULL) return 0.0; - llassert(!mIsFallback); + //llassert(!mIsFallback); U32 glyph_index; // Return existing info only if it is current @@ -308,7 +308,7 @@ F32 LLFontFreetype::getXKerning(llwchar char_left, llwchar char_right) const if (mFTFace == NULL) return 0.0; - llassert(!mIsFallback); + //llassert(!mIsFallback); LLFontGlyphInfo* left_glyph_info = get_if_there(mCharGlyphInfoMap, char_left, (LLFontGlyphInfo*)NULL); U32 left_glyph = left_glyph_info ? left_glyph_info->mGlyphIndex : 0; // Kern this puppy. diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 51f9d6bd18..f8c6204afb 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -100,7 +100,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) mPrearrangeCallback(p.prearrange_callback()), mTextEntryCallback(p.text_entry_callback()), mSelectionCallback(p.selection_callback()), - mListPosition(p.list_position) + mListPosition(p.list_position), + mLastSelectedIndex(-1) { // Text label button @@ -117,6 +118,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) mArrowImage = button_params.image_unselected; mButton = LLUICtrlFactory::create<LLButton>(button_params); + + if(mAllowTextEntry) { //redo to compensate for button hack that leaves space for a character @@ -430,7 +433,8 @@ void LLComboBox::setButtonVisible(BOOL visible) LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0); if (visible) { - text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth()) + 2 * drop_shadow_button; + S32 arrow_width = mArrowImage ? mArrowImage->getWidth() : 0; + text_entry_rect.mRight -= llmax(8,arrow_width) + 2 * drop_shadow_button; } //mTextEntry->setRect(text_entry_rect); mTextEntry->reshape(text_entry_rect.getWidth(), text_entry_rect.getHeight(), TRUE); @@ -472,14 +476,15 @@ void LLComboBox::createLineEditor(const LLComboBox::Params& p) LLRect rect = getLocalRect(); if (mAllowTextEntry) { + S32 arrow_width = mArrowImage ? mArrowImage->getWidth() : 0; S32 shadow_size = drop_shadow_button; - mButton->setRect(LLRect( getRect().getWidth() - llmax(8,mArrowImage->getWidth()) - 2 * shadow_size, + mButton->setRect(LLRect( getRect().getWidth() - llmax(8,arrow_width) - 2 * shadow_size, rect.mTop, rect.mRight, rect.mBottom)); mButton->setTabStop(FALSE); mButton->setHAlign(LLFontGL::HCENTER); LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0); - text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth()) + 2 * drop_shadow_button; + text_entry_rect.mRight -= llmax(8,arrow_width) + 2 * drop_shadow_button; // clear label on button std::string cur_label = mButton->getLabelSelected(); LLLineEditor::Params params = p.combo_editor; @@ -621,15 +626,15 @@ void LLComboBox::showList() mList->setVisible(TRUE); setUseBoundingRect(TRUE); + + mList->sortItems(); + mLastSelectedIndex = mList->getFirstSelectedIndex(); } void LLComboBox::hideList() { - //*HACK: store the original value explicitly somewhere, not just in label - std::string orig_selection = mAllowTextEntry ? mTextEntry->getText() : mButton->getLabelSelected(); - // assert selection in list - mList->selectItemByLabel(orig_selection, FALSE); + mList->selectNthItem(mLastSelectedIndex); mButton->setToggleState(FALSE); mList->setVisible(FALSE); @@ -687,6 +692,7 @@ void LLComboBox::onItemSelected(const LLSD& data) const std::string name = mList->getSelectedItemLabel(); S32 cur_id = getCurrentIndex(); + mLastSelectedIndex = cur_id; if (cur_id != -1) { setLabel(name); diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 517210f629..db97b0df75 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -232,5 +232,6 @@ private: commit_callback_t mPrearrangeCallback; commit_callback_t mTextEntryCallback; commit_callback_t mSelectionCallback; + S32 mLastSelectedIndex; }; #endif diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index a397278a2b..d420d1141e 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -75,6 +75,19 @@ std::string LLFloater::sButtonActiveImageNames[BUTTON_COUNT] = "Icon_Undock_Foreground" }; +// Empty string means programmatic glow effect, achieved by +// not setting explicit image. +std::string LLFloater::sButtonHoveredImageNames[BUTTON_COUNT] = +{ + "", //BUTTON_CLOSE + "restore_pressed.tga", //BUTTON_RESTORE + "minimize_pressed.tga", //BUTTON_MINIMIZE + "tearoff_pressed.tga", //BUTTON_TEAR_OFF + "close_in_blue.tga", //BUTTON_EDIT + "", //BUTTON_DOCK + "", //BUTTON_UNDOCK +}; + std::string LLFloater::sButtonPressedImageNames[BUTTON_COUNT] = { "Icon_Close_Press", //BUTTON_CLOSE @@ -97,20 +110,19 @@ std::string LLFloater::sButtonNames[BUTTON_COUNT] = "llfloater_undock_btn" }; -std::string LLFloater::sButtonToolTips[BUTTON_COUNT] = {}; - +std::string LLFloater::sButtonToolTips[BUTTON_COUNT]; std::string LLFloater::sButtonToolTipsIndex[BUTTON_COUNT]= { #ifdef LL_DARWIN - "BUTTON_CLOSE_DARWIN",//LLTrans::getString("BUTTON_CLOSE_DARWIN"), //"Close (Cmd-W)", //BUTTON_CLOSE + "BUTTON_CLOSE_DARWIN", //"Close (Cmd-W)", //BUTTON_CLOSE #else - "BUTTON_CLOSE_WIN", //LLTrans::getString("BUTTON_CLOSE_WIN"), //"Close (Ctrl-W)", //BUTTON_CLOSE + "BUTTON_CLOSE_WIN", //"Close (Ctrl-W)", //BUTTON_CLOSE #endif - "BUTTON_RESTORE",//LLTrans::getString("BUTTON_RESTORE"), //"Restore", //BUTTON_RESTORE - "BUTTON_MINIMIZE",//LLTrans::getString("BUTTON_MINIMIZE"), //"Minimize", //BUTTON_MINIMIZE - "BUTTON_TEAR_OFF",//LLTrans::getString("BUTTON_TEAR_OFF"), //"Tear Off", //BUTTON_TEAR_OFF - "BUTTON_EDIT", //LLTrans::getString("BUTTON_EDIT"), // "Edit", //BUTTON_EDIT + "BUTTON_RESTORE", //"Restore", //BUTTON_RESTORE + "BUTTON_MINIMIZE", //"Minimize", //BUTTON_MINIMIZE + "BUTTON_TEAR_OFF", //"Tear Off", //BUTTON_TEAR_OFF + "BUTTON_EDIT", //"Edit", //BUTTON_EDIT "BUTTON_DOCK", "BUTTON_UNDOCK" }; @@ -128,7 +140,7 @@ LLFloater::click_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] = LLMultiFloater* LLFloater::sHostp = NULL; BOOL LLFloater::sEditModeEnabled = FALSE; -BOOL LLFloater::sQuitting = FALSE; // Temporary hack until onClose() behavior becomes data driven +BOOL LLFloater::sQuitting = FALSE; // Flag to prevent storing visibility controls while quitting LLFloater::handle_map_t LLFloater::sFloaterMap; LLFloaterView* gFloaterView = NULL; @@ -219,6 +231,15 @@ const LLFloater::Params& LLFloater::getDefaultParams() return LLUICtrlFactory::getDefaultParams<LLFloater>(); } +//static +void LLFloater::initClass() +{ + // translate tooltips for floater buttons + for (S32 i = 0; i < BUTTON_COUNT; i++) + { + sButtonToolTips[i] = LLTrans::getString( sButtonToolTipsIndex[i] ); + } +} LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) : LLPanel(), @@ -251,22 +272,11 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) static LLUIColor default_background_color = LLUIColorTable::instance().getColor("FloaterDefaultBackgroundColor"); static LLUIColor focus_background_color = LLUIColorTable::instance().getColor("FloaterFocusBackgroundColor"); - for (S32 i = 0; i < BUTTON_COUNT; i++) - { - sButtonToolTips[i] =LLTrans::getString( sButtonToolTipsIndex[i]); - } - mHandle.bind(this); mNotificationContext = new LLFloaterNotificationContext(getHandle()); mBgColorAlpha = default_background_color; mBgColorOpaque = focus_background_color; - for (S32 i = 0; i < 4; i++) - { - mResizeBar[i] = NULL; - mResizeHandle[i] = NULL; - } - // Clicks stop here. setMouseOpaque(TRUE); @@ -431,6 +441,9 @@ void LLFloater::addResizeCtrls() // Resize handles (corners) LLResizeHandle::Params handle_p; + // handles must not be mouse-opaque, otherwise they block hover events + // to other buttons like the close box. JC + handle_p.mouse_opaque(false); handle_p.rect(LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0)); handle_p.min_width(mMinWidth); handle_p.min_height(mMinHeight); @@ -505,7 +518,6 @@ void LLFloater::storeRectControl() void LLFloater::storeVisibilityControl() { - // sQuitting is a temp hack until we standardize onClose() behavior so that it won't call this when quitting if( !sQuitting && mVisibilityControl.size() > 1 ) { LLUI::sSettingGroups["floater"]->setBOOL( mVisibilityControl, getVisible() ); @@ -514,7 +526,7 @@ void LLFloater::storeVisibilityControl() void LLFloater::setVisible( BOOL visible ) { - LLPanel::setVisible(visible); + LLPanel::setVisible(visible); // calls handleVisibilityChange() if( visible && mFirstLook ) { mFirstLook = FALSE; @@ -549,14 +561,14 @@ void LLFloater::setVisible( BOOL visible ) } // virtual -void LLFloater::onVisibilityChange ( BOOL new_visibility ) +void LLFloater::handleVisibilityChange ( BOOL new_visibility ) { if (new_visibility) { if (getHost()) getHost()->setFloaterFlashing(this, FALSE); } - LLPanel::onVisibilityChange ( new_visibility ); + LLPanel::handleVisibilityChange ( new_visibility ); } void LLFloater::openFloater(const LLSD& key) @@ -593,7 +605,7 @@ void LLFloater::openFloater(const LLSD& key) setVisibleAndFrontmost(mAutoFocus); } - mOpenSignal(this, getValue()); + mOpenSignal(this, key); onOpen(key); } @@ -601,7 +613,7 @@ void LLFloater::closeFloater(bool app_quitting) { if (app_quitting) { - LLFloater::sQuitting = true; // Temp hack until we standardize onClose() + LLFloater::sQuitting = true; } // Always unminimize before trying to close. @@ -661,9 +673,27 @@ void LLFloater::closeFloater(bool app_quitting) } } - // Let floater do cleanup. - mCloseSignal(this, getValue(), app_quitting); - onClose(app_quitting); + // Close callback + mCloseSignal(this, LLSD(app_quitting)); + + // Hide or Destroy + if (mSingleInstance) + { + // Hide the instance + if (getHost()) + { + getHost()->setVisible(FALSE); + } + else + { + setVisible(FALSE); + } + } + else + { + setVisible(FALSE); // hide before destroying (so handleVisibilityChange() gets called) + destroy(); + } } } @@ -1771,9 +1801,20 @@ void LLFloater::buildButtons() p.rect(btn_rect); p.label(""); p.image_unselected.name(sButtonActiveImageNames[i]); + // Selected, no matter if hovered or not, is "pressed" p.image_selected.name(sButtonPressedImageNames[i]); p.image_hover_selected.name(sButtonPressedImageNames[i]); - p.image_hover_unselected.name(sButtonPressedImageNames[i]); + // Empty string means programmatic glow effect, achieved by + // not setting explicit image. + if (sButtonHoveredImageNames[i].empty()) + { + // These icons are really small, need glow amount increased + p.hover_glow_amount( 0.22f ); + } + else + { + p.image_hover_unselected.name(sButtonHoveredImageNames[i]); + } p.click_callback.function(boost::bind(sButtonCallbacks[i], this)); p.tab_stop(false); p.follows.flags(FOLLOWS_TOP|FOLLOWS_RIGHT); @@ -1788,72 +1829,6 @@ void LLFloater::buildButtons() updateButtons(); } -void LLFloater::initOpenCallback(const OpenCallbackParam& cb, open_signal_t& sig) -{ - if (cb.function.isProvided()) - { - if (cb.parameter.isProvided()) - sig.connect(boost::bind(cb.function(), _1, cb.parameter)); - else - sig.connect(cb.function()); - } - else - { - std::string function_name = cb.function_name; - open_callback_t* func = (OpenCallbackRegistry::getValue(function_name)); - if (func) - { - if (cb.parameter.isProvided()) - sig.connect(boost::bind((*func), _1, cb.parameter)); - else - sig.connect(*func); - } - else if (!function_name.empty()) - { - llwarns << "No callback found for: '" << function_name << "' in control: " << getName() << llendl; - } - } -} - -void LLFloater::initCloseCallback(const CloseCallbackParam& cb, close_signal_t& sig) -{ - if (cb.function.isProvided()) - { - if (cb.parameter.isProvided()) - sig.connect(boost::bind(cb.function(), _1, cb.parameter, _3)); - else - sig.connect(cb.function()); - } - else - { - std::string function_name = cb.function_name; - close_callback_t* func = (CloseCallbackRegistry::getValue(function_name)); - if (func) - { - if (cb.parameter.isProvided()) - sig.connect(boost::bind((*func), _1, cb.parameter,_3)); - else - sig.connect(*func); - } - else if (!function_name.empty()) - { - llwarns << "No callback found for: '" << function_name << "' in control: " << getName() << llendl; - } - } -} - -namespace LLInitParam -{ - - template<> - bool ParamCompare<LLFloater::close_callback_t>::equals( - const LLFloater::close_callback_t &a, - const LLFloater::close_callback_t &b) - { - return false; - } -} - ///////////////////////////////////////////////////// // LLFloaterView @@ -2612,13 +2587,13 @@ void LLFloater::initFromParams(const LLFloater::Params& p) // open callback if (p.open_callback.isProvided()) - initOpenCallback(p.open_callback, mOpenSignal); + initCommitCallback(p.open_callback, mOpenSignal); // close callback if (p.close_callback.isProvided()) - initCloseCallback(p.close_callback, mCloseSignal); + initCommitCallback(p.close_callback, mCloseSignal); } -void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, BOOL open_floater, LLXMLNodePtr output_node) +void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node) { Params params(LLUICtrlFactory::getDefaultParams<LLFloater>()); LLXUIParser::instance().readXUI(node, params); @@ -2661,38 +2636,6 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, BOOL open_floa applyRectControl(); // If we have a saved rect control, apply it gFloaterView->adjustToFitScreen(this, FALSE); // Floaters loaded from XML should all fit on screen - if (open_floater) - { - this->openFloater(getKey()); - } - moveResizeHandlesToFront(); } -// visibility methods -bool VisibilityPolicy<LLFloater>::visible(LLFloater* instance, const LLSD& key) -{ - if (instance) - { - return !instance->isMinimized() && instance->isInVisibleChain(); - } - return FALSE; -} - -void VisibilityPolicy<LLFloater>::show(LLFloater* instance, const LLSD& key) -{ - if (instance) - { - instance->openFloater(key); - if (instance->getHost()) - { - instance->getHost()->openFloater(key); - } - } -} - -void VisibilityPolicy<LLFloater>::hide(LLFloater* instance, const LLSD& key) -{ - if (instance) instance->closeFloater(); -} - diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index f6c6dcf277..ee066317e0 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -97,7 +97,7 @@ public: enum EFloaterButtons { - BUTTON_CLOSE, + BUTTON_CLOSE = 0, BUTTON_RESTORE, BUTTON_MINIMIZE, BUTTON_TEAR_OFF, @@ -107,22 +107,6 @@ public: BUTTON_COUNT }; - typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param)> open_callback_t; - typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> open_signal_t; - - typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param, bool app_quitting)> close_callback_t; - typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param, bool app_quitting)> close_signal_t; - - struct OpenCallbackParam : public LLInitParam::Block<OpenCallbackParam, CallbackParam > - { - Optional<open_callback_t> function; - }; - - struct CloseCallbackParam : public LLInitParam::Block<CloseCallbackParam, CallbackParam > - { - Optional<close_callback_t> function; - }; - struct Params : public LLInitParam::Block<Params, LLPanel::Params> { @@ -140,8 +124,8 @@ public: save_visibility, can_dock; - Optional<OpenCallbackParam> open_callback; - Optional<CloseCallbackParam> close_callback; + Optional<CommitCallbackParam> open_callback, + close_callback; Params(); }; @@ -149,7 +133,10 @@ public: // use this to avoid creating your own default LLFloater::Param instance static const Params& getDefaultParams(); - LLFloater(const LLSD& key = LLSD(), const Params& params = getDefaultParams()); + // Load translations for tooltips for standard buttons + static void initClass(); + + LLFloater(const LLSD& key, const Params& params = getDefaultParams()); virtual ~LLFloater(); @@ -157,7 +144,7 @@ public: static void setupParamsForExport(Params& p, LLView* parent); void initFromParams(const LLFloater::Params& p); - void initFloaterXML(LLXMLNodePtr node, LLView *parent, BOOL open_floater = TRUE, LLXMLNodePtr output_node = NULL); + void initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL); /*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false); /*virtual*/ BOOL canSnapTo(const LLView* other_view); @@ -171,7 +158,6 @@ public: void openFloater(const LLSD& key = LLSD()); // If allowed, close the floater cleanly, releasing focus. - // app_quitting is passed to onClose() below. void closeFloater(bool app_quitting = false); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); @@ -221,20 +207,16 @@ public: virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask); virtual void draw(); - + + // *TODO: Eliminate this in favor of mOpenSignal virtual void onOpen(const LLSD& key) {} - // Call destroy() to free memory, or setVisible(FALSE) to keep it - // If app_quitting, you might not want to save your visibility. - // Defaults to destroy(). - virtual void onClose(bool app_quitting) { destroy(); } - // This cannot be "const" until all derived floater canClose() // methods are const as well. JC virtual BOOL canClose() { return TRUE; } - virtual void setVisible(BOOL visible); - virtual void onVisibilityChange ( BOOL curVisibilityIn ); + /*virtual*/ void setVisible(BOOL visible); // do not override + /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); // do not override void setFrontmost(BOOL take_focus = TRUE); @@ -250,7 +232,9 @@ public: LLHandle<LLFloater> getHandle() const { return mHandle; } const LLSD& getKey() { return mKey; } BOOL matchesKey(const LLSD& key) { return mSingleInstance || KeyCompare::equate(key, mKey); } - + + const std::string& getInstanceName() { return mInstanceName; } + bool isDockable() const { return mCanDock; } void setCanDock(bool b); @@ -299,10 +283,7 @@ protected: void setAutoFocus(BOOL focus) { mAutoFocus = focus; } // whether to automatically take focus when opened LLDragHandle* getDragHandle() const { return mDragHandle; } - void destroy() { die(); } // Don't call this directly. You probably want to call close(). JC - - void initOpenCallback(const OpenCallbackParam& cb, open_signal_t& sig); - void initCloseCallback(const CloseCallbackParam& cb, close_signal_t& sig); + void destroy() { die(); } // Don't call this directly. You probably want to call closeFloater() private: void setForeground(BOOL b); // called only by floaterview @@ -314,15 +295,11 @@ private: void addResizeCtrls(); void addDragHandle(); -public: - class OpenCallbackRegistry : public CallbackRegistry<open_callback_t, OpenCallbackRegistry> {}; - class CloseCallbackRegistry : public CallbackRegistry<close_callback_t, CloseCallbackRegistry> {}; - protected: std::string mRectControl; std::string mVisibilityControl; - open_signal_t mOpenSignal; - close_signal_t mCloseSignal; + commit_signal_t mOpenSignal; // Called when floater is opened, passes mKey + commit_signal_t mCloseSignal; // Called when floater is closed, passes app_qitting as LLSD() LLSD mKey; // Key used for retrieving instances; set (for now) by LLFLoaterReg LLDragHandle* mDragHandle; @@ -376,6 +353,8 @@ private: static BOOL sEditModeEnabled; static BOOL sQuitting; static std::string sButtonActiveImageNames[BUTTON_COUNT]; + // Images to use when cursor hovered over an enabled button + static std::string sButtonHoveredImageNames[BUTTON_COUNT]; static std::string sButtonPressedImageNames[BUTTON_COUNT]; static std::string sButtonNames[BUTTON_COUNT]; static std::string sButtonToolTips[BUTTON_COUNT]; @@ -465,37 +444,12 @@ private: S32 mSnapOffsetRight; }; -//******************************************************* -//* TO BE DEPRECATED -//******************************************************* -// visibility policy specialized for floaters -template<> -class VisibilityPolicy<LLFloater> -{ -public: - // visibility methods - static bool visible(LLFloater* instance, const LLSD& key); - - static void show(LLFloater* instance, const LLSD& key); - - static void hide(LLFloater* instance, const LLSD& key); -}; - // // Globals // extern LLFloaterView* gFloaterView; -namespace LLInitParam -{ - template<> - bool ParamCompare<LLFloater::close_callback_t>::equals( - const LLFloater::close_callback_t &a, - const LLFloater::close_callback_t &b); -} - - #endif // LL_FLOATER_H diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index d12f600503..a63b1b085c 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -121,8 +121,7 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) res = build_func(key); - const bool DONT_OPEN_FLOATER = false; - LLUICtrlFactory::getInstance()->buildFloater(res, xui_file, DONT_OPEN_FLOATER); + LLUICtrlFactory::getInstance()->buildFloater(res, xui_file, NULL); // Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe res->mKey = key; diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index ad2d8afe45..e355cfda8b 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -89,7 +89,6 @@ const U32 RIGHT_PAD_PIXELS = 2; const U32 RIGHT_WIDTH_PIXELS = 15; const U32 RIGHT_PLAIN_PIXELS = RIGHT_PAD_PIXELS + RIGHT_WIDTH_PIXELS; -const U32 ACCEL_PAD_PIXELS = 10; const U32 PLAIN_PAD_PIXELS = LEFT_PAD_PIXELS + LEFT_WIDTH_PIXELS + RIGHT_PAD_PIXELS + RIGHT_WIDTH_PIXELS; const U32 BRIEF_PAD_PIXELS = 2; @@ -302,7 +301,7 @@ U32 LLMenuItemGL::getNominalHeight( void ) const // Get the parent menu for this item -LLMenuGL* LLMenuItemGL::getMenu() +LLMenuGL* LLMenuItemGL::getMenu() const { return (LLMenuGL*) getParent(); } @@ -326,7 +325,7 @@ U32 LLMenuItemGL::getNominalWidth( void ) const if( KEY_NONE != mAcceleratorKey ) { - width += ACCEL_PAD_PIXELS; + width += getMenu()->getShortcutPad(); std::string temp; appendAcceleratorString( temp ); width += mFont->getWidth( temp ); @@ -515,12 +514,13 @@ BOOL LLMenuItemGL::setLabelArg( const std::string& key, const LLStringExplicit& return TRUE; } -void LLMenuItemGL::onVisibilityChange(BOOL new_visibility) +void LLMenuItemGL::handleVisibilityChange(BOOL new_visibility) { if (getMenu()) { getMenu()->needsArrange(); } + LLView::handleVisibilityChange(new_visibility); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1067,13 +1067,13 @@ void LLMenuItemBranchGL::updateBranchParent(LLView* parentp) } } -void LLMenuItemBranchGL::onVisibilityChange( BOOL new_visibility ) +void LLMenuItemBranchGL::handleVisibilityChange( BOOL new_visibility ) { if (new_visibility == FALSE && getBranch() && !getBranch()->getTornOff()) { getBranch()->setVisible(FALSE); } - LLMenuItemGL::onVisibilityChange(new_visibility); + LLMenuItemGL::handleVisibilityChange(new_visibility); } BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) @@ -1587,7 +1587,8 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mJumpKey(p.jump_key), mCreateJumpKeys(p.create_jump_keys), mParentFloaterHandle(p.parent_floater), - mNeedsArrange(FALSE) + mNeedsArrange(FALSE), + mShortcutPad(p.shortcut_pad) { typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep("_"); @@ -3213,6 +3214,8 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) ///============================================================================ /// Class LLMenuHolderGL ///============================================================================ +LLCoordGL LLMenuHolderGL::sContextMenuSpawnPos(S32_MAX, S32_MAX); + LLMenuHolderGL::LLMenuHolderGL() : LLPanel() { @@ -3273,6 +3276,19 @@ BOOL LLMenuHolderGL::handleRightMouseDown( S32 x, S32 y, MASK mask ) // down, move off the menu, then mouse-up. We want this to close the menu. BOOL LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask ) { + const S32 SLOP = 2; + S32 spawn_dx = (x - sContextMenuSpawnPos.mX); + S32 spawn_dy = (y - sContextMenuSpawnPos.mY); + if (-SLOP <= spawn_dx && spawn_dx <= SLOP + && -SLOP <= spawn_dy && spawn_dy <= SLOP) + { + // we're still inside the slop region from spawning this menu + // so interpret the mouse-up as a single-click to show and leave on + // screen + sContextMenuSpawnPos.set(S32_MAX, S32_MAX); + return TRUE; + } + BOOL handled = LLView::childrenHandleRightMouseUp(x, y, mask) != NULL; if (!handled) { @@ -3344,7 +3360,7 @@ void LLMenuHolderGL::setActivatedItem(LLMenuItemGL* item) /// Class LLTearOffMenu ///============================================================================ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : - LLFloater() + LLFloater(LLSD()) { static LLUICachedControl<S32> floater_header_size ("UIFloaterHeaderSize", 0); @@ -3377,6 +3393,16 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) : mMenu->highlightNextItem(NULL); } +LLTearOffMenu::~LLTearOffMenu() +{ +} + +// virtual +BOOL LLTearOffMenu::postBuild() +{ + mCloseSignal.connect(boost::bind(&LLTearOffMenu::closeTearOff, this)); + return TRUE; +} void LLTearOffMenu::draw() { @@ -3476,7 +3502,7 @@ LLTearOffMenu* LLTearOffMenu::create(LLMenuGL* menup) return tearoffp; } -void LLTearOffMenu::onClose(bool app_quitting) +void LLTearOffMenu::closeTearOff() { removeChild(mMenu); mOldParent->addChild(mMenu); @@ -3486,7 +3512,6 @@ void LLTearOffMenu::onClose(bool app_quitting) mMenu->setVisible(FALSE); mMenu->setTornOff(FALSE); mMenu->setDropShadowed(TRUE); - destroy(); } @@ -3600,9 +3625,7 @@ static MenuRegistry::Register<LLContextMenu> context_menu_register2("context_men LLContextMenu::LLContextMenu(const Params& p) : LLMenuGL(p), mHoveredAnyItem(FALSE), - mHoverItem(NULL), - mSpawnMouseX(S32_MAX), // definitely not inside the window frame - mSpawnMouseY(S32_MAX) + mHoverItem(NULL) { //setBackgroundVisible(TRUE); } @@ -3616,6 +3639,11 @@ void LLContextMenu::setVisible(BOOL visible) // Takes cursor position in screen space? void LLContextMenu::show(S32 x, S32 y) { + // Save click point for detecting cursor moves before mouse-up. + // Must be in local coords to compare with mouseUp events. + // If the mouse doesn't move, the menu will stay open ala the Mac. + LLMenuHolderGL::sContextMenuSpawnPos.set(x,y); + arrangeAndClear(); S32 width = getRect().getWidth(); @@ -3652,15 +3680,11 @@ void LLContextMenu::show(S32 x, S32 y) S32 local_x, local_y; parent_view->screenPointToLocal(x, y, &local_x, &local_y); - // HACK: casting away const. Should use setRect or some helper function instead. - const_cast<LLRect&>(getRect()).setCenterAndSize(local_x + width/2, local_y - height/2, width, height); + LLRect rect; + rect.setLeftTopAndSize(local_x, local_y, width, height); + setRect(rect); arrange(); - // Save click point for detecting cursor moves before mouse-up. - // Must be in local coords to compare with mouseUp events. - // If the mouse doesn't move, the menu will stay open ala the Mac. - screenPointToLocal(x, y, &mSpawnMouseX, &mSpawnMouseY); - LLView::setVisible(TRUE); } @@ -3758,20 +3782,6 @@ BOOL LLContextMenu::handleRightMouseDown(S32 x, S32 y, MASK mask) BOOL LLContextMenu::handleRightMouseUp( S32 x, S32 y, MASK mask ) { - const S32 SLOP = 2; - S32 spawn_dx = (x - mSpawnMouseX); - S32 spawn_dy = (y - mSpawnMouseY); - if (-SLOP <= spawn_dx && spawn_dx <= SLOP - && -SLOP <= spawn_dy && spawn_dy <= SLOP) - { - // we're still inside the slop region from spawning this menu - // so interpret the mouse-up as a single-click to show and leave on - // screen - mSpawnMouseX = S32_MAX; - mSpawnMouseY = S32_MAX; - return TRUE; - } - S32 local_x = x - getRect().mLeft; S32 local_y = y - getRect().mBottom; diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index f786c891d7..828956a217 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -106,7 +106,7 @@ protected: friend class LLUICtrlFactory; public: virtual void setValue(const LLSD& value) { setLabel(value.asString()); } - /*virtual*/ void onVisibilityChange(BOOL new_visibility); + /*virtual*/ void handleVisibilityChange(BOOL new_visibility); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleAcceleratorKey(KEY key, MASK mask); @@ -137,7 +137,7 @@ public: virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); // Get the parent menu for this item - virtual class LLMenuGL* getMenu(); + virtual class LLMenuGL* getMenu() const; // returns the normal width of this control in pixels - this is // used for calculating the widest item, as well as for horizontal @@ -383,6 +383,7 @@ public: keep_fixed_size, scrollable; Optional<LLUIColor> bg_color; + Optional<S32> shortcut_pad; Params() : jump_key("jump_key", KEY_NONE), @@ -392,7 +393,8 @@ public: bg_visible("bg_visible", true), create_jump_keys("create_jump_keys", false), bg_color("bg_color", LLUIColorTable::instance().getColor( "MenuDefaultBgColor" )), - scrollable("scrollable", false) + scrollable("scrollable", false), + shortcut_pad("shortcut_pad") { addSynonym(bg_visible, "opaque"); addSynonym(bg_color, "color"); @@ -513,6 +515,8 @@ public: static void setKeyboardMode(BOOL mode) { sKeyboardMode = mode; } static BOOL getKeyboardMode() { return sKeyboardMode; } + S32 getShortcutPad() { return mShortcutPad; } + void scrollItemsUp(); void scrollItemsDown(); BOOL isScrollable() const { return mScrollable; } @@ -566,6 +570,7 @@ private: LLHandle<LLFloater> mParentFloaterHandle; KEY mJumpKey; BOOL mCreateJumpKeys; + S32 mShortcutPad; }; // end class LLMenuGL @@ -621,7 +626,7 @@ public: virtual void updateBranchParent( LLView* parentp ); // LLView Functionality - virtual void onVisibilityChange( BOOL curVisibilityIn ); + virtual void handleVisibilityChange( BOOL curVisibilityIn ); virtual void draw(); @@ -680,11 +685,6 @@ public: protected: BOOL mHoveredAnyItem; LLMenuItemGL* mHoverItem; - - // Cursor position when the menu was spawned, in menu-local coords - // Used to allow single right-click within a slop region to spawn the menu - S32 mSpawnMouseX; - S32 mSpawnMouseY; }; @@ -764,6 +764,8 @@ public: virtual void draw(); virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); + + // Close context menus on right mouse up not handled by menus. /*virtual*/ BOOL handleRightMouseUp( S32 x, S32 y, MASK mask ); virtual const LLRect getMenuRect() const { return getLocalRect(); } @@ -771,6 +773,10 @@ public: static void setActivatedItem(LLMenuItemGL* item); + // Need to detect if mouse-up after context menu spawn has moved. + // If not, need to keep the menu up. + static LLCoordGL sContextMenuSpawnPos; + private: static LLHandle<LLView> sItemLastSelectedHandle; static LLFrameTimer sItemActivationTimer; @@ -788,8 +794,10 @@ class LLTearOffMenu : public LLFloater { public: static LLTearOffMenu* create(LLMenuGL* menup); - virtual ~LLTearOffMenu() {} - virtual void onClose(bool app_quitting); + virtual ~LLTearOffMenu(); + + virtual BOOL postBuild(); + virtual void draw(void); virtual void onFocusReceived(); virtual void onFocusLost(); @@ -799,7 +807,9 @@ public: private: LLTearOffMenu(LLMenuGL* menup); - + + void closeTearOff(); + LLView* mOldParent; LLMenuGL* mMenu; F32 mTargetHeight; diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp index 7557b87b94..11fa290de1 100644 --- a/indra/llui/llmodaldialog.cpp +++ b/indra/llui/llmodaldialog.cpp @@ -44,12 +44,11 @@ // static std::list<LLModalDialog*> LLModalDialog::sModalStack; -LLModalDialog::LLModalDialog( const std::string& title, S32 width, S32 height, BOOL modal ) - : LLFloater(), +LLModalDialog::LLModalDialog( const LLSD& key, S32 width, S32 height, BOOL modal ) + : LLFloater(key), mModal( modal ) { setRect(LLRect( 0, height, width, 0 )); - setTitle(title); if (modal) { setCanMinimize(FALSE); @@ -59,6 +58,7 @@ LLModalDialog::LLModalDialog( const std::string& title, S32 width, S32 height, B setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); centerOnScreen(); // default position + mCloseSignal.connect(boost::bind(&LLModalDialog::stopModal, this)); } LLModalDialog::~LLModalDialog() @@ -68,6 +68,18 @@ LLModalDialog::~LLModalDialog() { gFocusMgr.unlockFocus(); } + + std::list<LLModalDialog*>::iterator iter = std::find(sModalStack.begin(), sModalStack.end(), this); + if (iter != sModalStack.end()) + { + llerrs << "Attempt to delete dialog while still in sModalStack!" << llendl; + } +} + +// virtual +BOOL LLModalDialog::postBuild() +{ + return LLFloater::postBuild(); } // virtual @@ -235,12 +247,6 @@ BOOL LLModalDialog::handleKeyHere(KEY key, MASK mask ) } } -void LLModalDialog::onClose(bool app_quitting) -{ - stopModal(); - LLFloater::onClose(app_quitting); -} - // virtual void LLModalDialog::draw() { diff --git a/indra/llui/llmodaldialog.h b/indra/llui/llmodaldialog.h index dad92ab82a..4d5073024b 100644 --- a/indra/llui/llmodaldialog.h +++ b/indra/llui/llmodaldialog.h @@ -45,9 +45,11 @@ class LLModalDialog; class LLModalDialog : public LLFloater { public: - LLModalDialog( const std::string& title, S32 width, S32 height, BOOL modal = true ); + LLModalDialog( const LLSD& key, S32 width, S32 height, BOOL modal = true ); /*virtual*/ ~LLModalDialog(); - + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void openFloater(const LLSD& key = LLSD()); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); @@ -63,8 +65,6 @@ public: /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); - /*virtual*/ void onClose(bool app_quitting); - /*virtual*/ void setVisible(BOOL visible); /*virtual*/ void draw(); diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index 22683d7950..9f9e3aecac 100644 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -42,8 +42,8 @@ // LLMultiFloater // -LLMultiFloater::LLMultiFloater(const LLFloater::Params& params) - : LLFloater(), +LLMultiFloater::LLMultiFloater(const LLSD& key, const LLFloater::Params& params) + : LLFloater(key), mTabContainer(NULL), mTabPos(LLTabContainer::TOP), mAutoResize(TRUE), @@ -74,20 +74,12 @@ void LLMultiFloater::buildTabContainer() void LLMultiFloater::onOpen(const LLSD& key) { - if (mTabContainer->getTabCount() <= 0) - { - // for now, don't allow multifloaters - // without any child floaters - closeFloater(); - } -} - -void LLMultiFloater::onClose(bool app_quitting) -{ - if(closeAllFloaters() == TRUE) - { - LLFloater::onClose(app_quitting); - }//else not all tabs could be closed... +// if (mTabContainer->getTabCount() <= 0) +// { +// // for now, don't allow multifloaters +// // without any child floaters +// closeFloater(); +// } } void LLMultiFloater::draw() @@ -124,7 +116,8 @@ BOOL LLMultiFloater::closeAllFloaters() //Tab did not actually close, possibly due to a pending Save Confirmation dialog.. //so try and close the next one in the list... tabToClose++; - }else + } + else { //Tab closed ok. lastTabCount = mTabContainer->getTabCount(); @@ -246,6 +239,9 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, { floaterp->setVisible(FALSE); } + + // Tabs sometimes overlap resize handle + moveResizeHandlesToFront(); } /** @@ -448,6 +444,8 @@ void LLMultiFloater::setCanResize(BOOL can_resize) BOOL LLMultiFloater::postBuild() { + mCloseSignal.connect(boost::bind(&LLMultiFloater::closeAllFloaters, this)); + // remember any original xml minimum size getResizeLimits(&mOrigMinWidth, &mOrigMinHeight); diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h index 7f4c1c040a..bbf2c56fe7 100644 --- a/indra/llui/llmultifloater.h +++ b/indra/llui/llmultifloater.h @@ -44,14 +44,13 @@ class LLMultiFloater : public LLFloater { public: - LLMultiFloater(const LLFloater::Params& params = LLFloater::getDefaultParams()); + LLMultiFloater(const LLSD& key, const Params& params = getDefaultParams()); virtual ~LLMultiFloater() {}; void buildTabContainer(); virtual BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void draw(); /*virtual*/ void setVisible(BOOL visible); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 78a0b9f3fe..0335a265b6 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -100,8 +100,9 @@ // and we need this to manage the notification callbacks #include "llevents.h" #include "llfunctorregistry.h" -#include "llui.h" -#include "llmemory.h" +#include "llpointer.h" +#include "llinitparam.h" +#include "llxmlnode.h" #include "llnotificationslistener.h" class LLNotification; @@ -159,7 +160,8 @@ public: LLNotificationForm(); LLNotificationForm(const LLSD& sd); - LLNotificationForm(const std::string& name, const LLXMLNodePtr xml_node); + LLNotificationForm(const std::string& name, + const LLPointer<LLXMLNode> xml_node); LLSD asLLSD() const; @@ -835,7 +837,7 @@ public: // load notification descriptions from file; // OK to call more than once because it will reload bool loadTemplates(); - LLXMLNodePtr checkForXMLTemplate(LLXMLNodePtr item); + LLPointer<class LLXMLNode> checkForXMLTemplate(LLPointer<class LLXMLNode> item); // Add a simple notification (from XUI) void addFromCallback(const LLSD& name); @@ -918,7 +920,7 @@ private: std::string mFileName; - typedef std::map<std::string, LLXMLNodePtr> XMLTemplateMap; + typedef std::map<std::string, LLPointer<class LLXMLNode> > XMLTemplateMap; XMLTemplateMap mXmlTemplates; LLNotificationMap mUniqueNotifications; diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 9fb38bc316..1a948fdd00 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -74,7 +74,8 @@ LLPanel::Params::Params() min_height("min_height", 100), strings("string"), filename("filename"), - class_name("class") + class_name("class"), + visible_callback("visible_callback") { name = "panel"; addSynonym(background_visible, "bg_visible"); @@ -307,6 +308,12 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) return handled; } +void LLPanel::handleVisibilityChange ( BOOL new_visibility ) +{ + LLUICtrl::handleVisibilityChange ( new_visibility ); + mVisibleSignal(this, LLSD(new_visibility) ); // Pass BOOL as LLSD +} + BOOL LLPanel::checkRequirements() { if (!mRequirementsError.empty()) @@ -426,7 +433,11 @@ void LLPanel::initFromParams(const LLPanel::Params& p) // control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible LLUICtrl::initFromParams(p); - + + // visible callback + if (p.visible_callback.isProvided()) + initCommitCallback(p.visible_callback, mVisibleSignal); + for (LLInitParam::ParamIterator<LocalizedString>::const_iterator it = p.strings().begin(); it != p.strings().end(); ++it) diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 4140e3aa93..552a621a8e 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -88,7 +88,9 @@ public: Optional<std::string> class_name; Multiple<LocalizedString> strings; - + + Optional<CommitCallbackParam> visible_callback; + Params(); }; @@ -111,6 +113,7 @@ public: /*virtual*/ BOOL isPanel() const; /*virtual*/ void draw(); /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); + /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); // Override to set not found list: /*virtual*/ LLView* getChildView(const std::string& name, BOOL recurse = TRUE, BOOL create_if_missing = TRUE) const; @@ -254,6 +257,8 @@ protected: CommitCallbackRegistry::ScopedRegistrar mCommitCallbackRegistrar; EnableCallbackRegistry::ScopedRegistrar mEnableCallbackRegistrar; + commit_signal_t mVisibleSignal; // Called when visibilit changes, passes new visibility as LLSD() + private: // Unified error reporting for the child* functions typedef std::set<std::string> expected_members_list_t; @@ -273,7 +278,7 @@ private: ui_string_map_t mUIStrings; std::string mRequirementsError; - + }; // end class LLPanel #endif diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index 3312064131..bc489592d4 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -56,8 +56,10 @@ LLScrollbar::Params::Params() doc_pos ("doc_pos", 0), page_size ("page_size", 0), step_size ("step_size", 1), - thumb_image("thumb_image"), - track_image("track_image"), + thumb_image_vertical("thumb_image_vertical"), + thumb_image_horizontal("thumb_image_horizontal"), + track_image_vertical("track_image_vertical"), + track_image_horizontal("track_image_horizontal"), track_color("track_color"), thumb_color("thumb_color"), thickness("thickness"), @@ -86,8 +88,10 @@ LLScrollbar::LLScrollbar(const Params & p) mThumbColor ( p.thumb_color() ), mOnScrollEndCallback( NULL ), mOnScrollEndData( NULL ), - mThumbImage(p.thumb_image), - mTrackImage(p.track_image), + mThumbImageV(p.thumb_image_vertical), + mThumbImageH(p.thumb_image_horizontal), + mTrackImageV(p.track_image_vertical), + mTrackImageH(p.track_image_horizontal), mThickness(p.thickness.isProvided() ? p.thickness : LLUI::sSettingGroups["config"]->getS32("UIScrollbarSize")) { updateThumbRect(); @@ -493,7 +497,8 @@ void LLScrollbar::draw() } // Draw background and thumb. - if (mTrackImage.isNull() || mThumbImage.isNull()) + if ( ( mOrientation == VERTICAL&&(mThumbImageV.isNull() || mThumbImageV.isNull()) ) + || (mOrientation == HORIZONTAL&&(mTrackImageH.isNull() || mThumbImageH.isNull()) )) { gl_rect_2d(mOrientation == HORIZONTAL ? mThickness : 0, mOrientation == VERTICAL ? getRect().getHeight() - 2 * mThickness : getRect().getHeight(), @@ -505,30 +510,54 @@ void LLScrollbar::draw() } else { - // Background - mTrackImage->drawSolid(mOrientation == HORIZONTAL ? mThickness : 0, - mOrientation == VERTICAL ? mThickness : 0, - mOrientation == HORIZONTAL ? getRect().getWidth() - 2 * mThickness : getRect().getWidth(), - mOrientation == VERTICAL ? getRect().getHeight() - 2 * mThickness : getRect().getHeight(), - mTrackColor.get()); - // Thumb LLRect outline_rect = mThumbRect; outline_rect.stretch(2); - - if (gFocusMgr.getKeyboardFocus() == this) + S32 rect_fix = 0; + // Background + + if(mOrientation == HORIZONTAL) { - mTrackImage->draw(outline_rect, gFocusMgr.getFocusColor()); + mTrackImageH->drawSolid(mThickness //S32 x + , 0 //S32 y + , getRect().getWidth() - 2 * mThickness //S32 width + , getRect().getHeight()- rect_fix //S32 height + , mTrackColor.get()); //const LLColor4& color + + if (gFocusMgr.getKeyboardFocus() == this) + { + mTrackImageH->draw(outline_rect, gFocusMgr.getFocusColor()); + } + + mThumbImageH->draw(mThumbRect, mThumbColor.get()); + if (mCurGlowStrength > 0.01f) + { + gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); + mThumbImageH->drawSolid(mThumbRect, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength)); + gGL.setSceneBlendType(LLRender::BT_ALPHA); + } + } - - mThumbImage->draw(mThumbRect, mThumbColor.get()); - if (mCurGlowStrength > 0.01f) + else if(mOrientation == VERTICAL) { - gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); - mThumbImage->drawSolid(mThumbRect, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength)); - gGL.setSceneBlendType(LLRender::BT_ALPHA); + mTrackImageV->drawSolid( 0+rect_fix //S32 x + , mThickness //S32 y + , getRect().getWidth() //S32 width + , getRect().getHeight() - 2 * mThickness //S32 height + , mTrackColor.get()); //const LLColor4& color + if (gFocusMgr.getKeyboardFocus() == this) + { + mTrackImageV->draw(outline_rect, gFocusMgr.getFocusColor()); + } + + mThumbImageV->draw(mThumbRect, mThumbColor.get()); + if (mCurGlowStrength > 0.01f) + { + gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); + mThumbImageV->drawSolid(mThumbRect, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength)); + gGL.setSceneBlendType(LLRender::BT_ALPHA); + } } - } BOOL was_scrolled_to_bottom = (getDocPos() == getDocPosMax()); diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index 43604d37b7..5522e5d0fa 100644 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h @@ -61,8 +61,10 @@ public: Optional<S32> step_size; Optional<S32> thickness; - Optional<LLUIImage*> thumb_image, - track_image; + Optional<LLUIImage*> thumb_image_vertical, + thumb_image_horizontal, + track_image_horizontal, + track_image_vertical; Optional<LLUIColor> track_color, thumb_color; @@ -155,8 +157,10 @@ private: LLUIColor mTrackColor; LLUIColor mThumbColor; - LLUIImagePtr mThumbImage; - LLUIImagePtr mTrackImage; + LLUIImagePtr mThumbImageV; + LLUIImagePtr mThumbImageH; + LLUIImagePtr mTrackImageV; + LLUIImagePtr mTrackImageH; S32 mThickness; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index e8627586ea..79f0f9d71b 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -163,7 +163,6 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) mSorted(FALSE), mDirty(FALSE), mOriginalSelection(-1), - mDrewSelected(FALSE), mLastSelected(NULL), mHeadingHeight(p.heading_height), mAllowMultipleSelection(p.multi_select), @@ -1353,8 +1352,6 @@ void LLScrollListCtrl::drawItems() S32 cur_y = y; - mDrewSelected = FALSE; - S32 line = 0; S32 max_columns = 0; @@ -1375,11 +1372,6 @@ void LLScrollListCtrl::drawItems() //llinfos << item_rect.getWidth() << llendl; - if (item->getSelected()) - { - mDrewSelected = TRUE; - } - max_columns = llmax(max_columns, item->getNumColumns()); LLColor4 fg_color; @@ -1444,10 +1436,7 @@ void LLScrollListCtrl::draw() LLLocalClipRect clip(getLocalRect()); // if user specifies sort, make sure it is maintained - if (needsSorting() && !isSorted()) - { - sortItems(); - } + sortItems(); if (mNeedsScroll) { @@ -2208,6 +2197,8 @@ BOOL LLScrollListCtrl::setSort(S32 column_idx, BOOL ascending) sort_column->mSortDirection = ascending ? LLScrollListColumn::ASCENDING : LLScrollListColumn::DESCENDING; sort_column_t new_sort_column(column_idx, ascending); + + setSorted(FALSE); if (mSortColumns.empty()) { @@ -2248,21 +2239,22 @@ void LLScrollListCtrl::sortByColumn(const std::string& name, BOOL ascending) // First column is column 0 void LLScrollListCtrl::sortByColumnIndex(U32 column, BOOL ascending) { - if (setSort(column, ascending)) - { - sortItems(); - } + setSort(column, ascending); + sortItems(); } void LLScrollListCtrl::sortItems() { - // do stable sort to preserve any previous sorts - std::stable_sort( - mItemList.begin(), - mItemList.end(), - SortScrollListItem(mSortColumns)); + if (hasSortOrder() && !isSorted()) + { + // do stable sort to preserve any previous sorts + std::stable_sort( + mItemList.begin(), + mItemList.end(), + SortScrollListItem(mSortColumns)); - setSorted(TRUE); + setSorted(TRUE); + } } // for one-shot sorts, does not save sort column/order @@ -2318,10 +2310,7 @@ void LLScrollListCtrl::scrollToShowSelected() return; } - if (needsSorting() && !isSorted()) - { - sortItems(); - } + sortItems(); S32 index = getFirstSelectedIndex(); if (index < 0) @@ -2562,7 +2551,7 @@ std::string LLScrollListCtrl::getSortColumnName() else return ""; } -BOOL LLScrollListCtrl::needsSorting() +BOOL LLScrollListCtrl::hasSortOrder() { return !mSortColumns.empty(); } diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index c1800419be..e699711bd4 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -329,7 +329,7 @@ public: std::string getSortColumnName(); BOOL getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; } - BOOL needsSorting(); + BOOL hasSortOrder(); S32 selectMultiple( std::vector<LLUUID> ids ); void sortItems(); @@ -374,9 +374,6 @@ private: void commitIfChanged(); BOOL setSort(S32 column, BOOL ascending); - S32 mCurIndex; // For get[First/Next]Data - S32 mCurSelectedIndex; // For get[First/Next]Selected - S32 mLineHeight; // the max height of a single line S32 mScrollLines; // how many lines we've scrolled down S32 mPageLines; // max number of lines is it possible to see on the screen given mRect and mLineHeight @@ -445,11 +442,6 @@ private: typedef std::pair<S32, BOOL> sort_column_t; std::vector<sort_column_t> mSortColumns; - - // HACK: Did we draw one selected item this frame? - BOOL mDrewSelected; - - LLTextBox* mCommentTextBox; }; // end class LLScrollListCtrl #endif // LL_SCROLLLISTCTRL_H diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index 3516712dc9..fbcbb55b85 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -39,20 +39,20 @@ LLSearchEditor::LLSearchEditor(const LLSearchEditor::Params& p) : LLUICtrl(p) { - const S32 fudge = 2; - S32 btn_height = getRect().getHeight() - (fudge * 2); + S32 btn_top = p.search_button.top_pad + p.search_button.rect.height; + S32 btn_right = p.search_button.rect.width + p.search_button.left_pad; + LLRect search_btn_rect(p.search_button.left_pad, btn_top, btn_right, p.search_button.top_pad); LLLineEditor::Params line_editor_params(p); line_editor_params.name("filter edit box"); line_editor_params.rect(getLocalRect()); line_editor_params.follows.flags(FOLLOWS_ALL); - line_editor_params.text_pad_left(btn_height + fudge); + line_editor_params.text_pad_left(p.text_pad_left + search_btn_rect.getWidth()); line_editor_params.commit_callback.function(boost::bind(&LLUICtrl::onCommit, this)); mSearchEditor = LLUICtrlFactory::create<LLLineEditor>(line_editor_params); addChild(mSearchEditor); - LLRect search_btn_rect(fudge, fudge + btn_height, fudge + btn_height, fudge); LLButton::Params button_params(p.search_button); button_params.name(std::string("clear filter")); button_params.rect(search_btn_rect) ; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index adeaf0a279..48816e4b9e 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -286,6 +286,8 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) mReflowNeeded(FALSE), mScrollNeeded(FALSE), mLastSelectionY(-1), + mParseHTML(FALSE), + mParseHighlights(FALSE), mTabsToNextField(p.ignore_tab), mGLFont(p.font) { @@ -335,7 +337,6 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) setHideScrollbarForShortDocs(p.hide_scrollbar); - mParseHTML=FALSE; mHTML.clear(); } @@ -398,6 +399,7 @@ void LLTextEditor::updateLineStartList(S32 startpos) S32 seg_idx = 0; S32 seg_offset = 0; + if (!mLineStartList.empty()) { getSegmentAndOffset(startpos, &seg_idx, &seg_offset); diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 4da91cc1d7..0babd7ba58 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -515,6 +515,7 @@ private: S32 mDesiredXPixel; // X pixel position where the user wants the cursor to be LLRect mTextRect; // The rect in which text is drawn. Excludes borders. // List of offsets and segment index of the start of each line. Always has at least one node (0). + struct pred; struct line_info { line_info(S32 segment, S32 offset) : mSegment(segment), mOffset(offset) {} diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 6906f0befb..fab8f61356 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1860,10 +1860,11 @@ LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname) for (settings_map_t::iterator itor = sSettingGroups.begin(); itor != sSettingGroups.end(); ++itor) { - if(itor->second!= NULL) + LLControlGroup* control_group = itor->second; + if(control_group != NULL) { - if (sSettingGroups[(itor->first)]->controlExists(controlname)) - return *sSettingGroups[(itor->first)]; + if (control_group->controlExists(controlname)) + return *control_group; } } diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 413733a50b..b1943a7b02 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -222,193 +222,6 @@ private: static std::vector<std::string> sXUIPaths; }; -// FactoryPolicy is a static class that controls the creation and lookup of UI elements, -// such as floaters. -// The key parameter is used to provide a unique identifier and/or associated construction -// parameters for a given UI instance -// -// Specialize this traits for different types, or provide a class with an identical interface -// in the place of the traits parameter -// -// For example: -// -// template <> -// class FactoryPolicy<MyClass> /* FactoryPolicy specialized for MyClass */ -// { -// public: -// static MyClass* findInstance(const LLSD& key = LLSD()) -// { -// /* return instance of MyClass associated with key */ -// } -// -// static MyClass* createInstance(const LLSD& key = LLSD()) -// { -// /* create new instance of MyClass using key for construction parameters */ -// } -// } -// -// class MyClass : public LLUIFactory<MyClass> -// { -// /* uses FactoryPolicy<MyClass> by default */ -// } - -template <class T> -class FactoryPolicy -{ -public: - // basic factory methods - static T* findInstance(const LLSD& key); // unimplemented, provide specialiation - static T* createInstance(const LLSD& key); // unimplemented, provide specialiation -}; - -// VisibilityPolicy controls the visibility of UI elements, such as floaters. -// The key parameter is used to store the unique identifier of a given UI instance -// -// Specialize this traits for different types, or duplicate this interface for specific instances -// (see above) - -template <class T> -class VisibilityPolicy -{ -public: - // visibility methods - static bool visible(T* instance, const LLSD& key); // unimplemented, provide specialiation - static void show(T* instance, const LLSD& key); // unimplemented, provide specialiation - static void hide(T* instance, const LLSD& key); // unimplemented, provide specialiation -}; - -// Manages generation of UI elements by LLSD, such that (generally) there is -// a unique instance per distinct LLSD parameter -// Class T is the instance type being managed, and the FACTORY_POLICY and VISIBILITY_POLICY -// classes provide static methods for creating, accessing, showing and hiding the associated -// element T -template <class T, class FACTORY_POLICY = FactoryPolicy<T>, class VISIBILITY_POLICY = VisibilityPolicy<T> > -class LLUIFactory -{ -public: - // give names to the template parameters so derived classes can refer to them - // except this doesn't work in gcc - typedef FACTORY_POLICY factory_policy_t; - typedef VISIBILITY_POLICY visibility_policy_t; - - LLUIFactory() - { - } - - virtual ~LLUIFactory() - { - } - - // default show and hide methods - static T* showInstance(const LLSD& key = LLSD()) - { - T* instance = getInstance(key); - if (instance != NULL) - { - VISIBILITY_POLICY::show(instance, key); - } - return instance; - } - - static void hideInstance(const LLSD& key = LLSD()) - { - T* instance = getInstance(key); - if (instance != NULL) - { - VISIBILITY_POLICY::hide(instance, key); - } - } - - static void toggleInstance(const LLSD& key = LLSD()) - { - if (instanceVisible(key)) - { - hideInstance(key); - } - else - { - showInstance(key); - } - } - - static bool instanceVisible(const LLSD& key = LLSD()) - { - T* instance = FACTORY_POLICY::findInstance(key); - return instance != NULL && VISIBILITY_POLICY::visible(instance, key); - } - - static T* getInstance(const LLSD& key = LLSD()) - { - T* instance = FACTORY_POLICY::findInstance(key); - if (instance == NULL) - { - instance = FACTORY_POLICY::createInstance(key); - } - return instance; - } - -}; - - -// Creates a UI singleton by ignoring the identifying parameter -// and always generating the same instance via the LLUIFactory interface. -// Note that since UI elements can be destroyed by their hierarchy, this singleton -// pattern uses a static pointer to an instance that will be re-created as needed. -// -// Usage Pattern: -// -// class LLFloaterFoo : public LLFloater, public LLUISingleton<LLFloaterFoo> -// { -// friend class LLUISingleton<LLFloaterFoo>; -// private: -// LLFloaterFoo(const LLSD& key); -// }; -// -// Note that LLUISingleton takes an option VisibilityPolicy parameter that defines -// how showInstance(), hideInstance(), etc. work. -// -// https://wiki.lindenlab.com/mediawiki/index.php?title=LLUISingleton&oldid=79352 - -template <class T, class VISIBILITY_POLICY = VisibilityPolicy<T> > -class LLUISingleton: public LLUIFactory<T, LLUISingleton<T, VISIBILITY_POLICY>, VISIBILITY_POLICY> -{ -protected: - - // T must derive from LLUISingleton<T> - LLUISingleton() { sInstance = static_cast<T*>(this); } - ~LLUISingleton() { sInstance = NULL; } - -public: - static T* findInstance(const LLSD& key = LLSD()) - { - return sInstance; - } - - static T* createInstance(const LLSD& key = LLSD()) - { - if (sInstance == NULL) - { - sInstance = new T(key); - } - return sInstance; - } - - static void destroyInstance() - { - delete sInstance; - sInstance = NULL; - } - - static bool instanceExists() { return NULL != sInstance; } - -private: - LLUISingleton(const LLUISingleton&){} - LLUISingleton& operator=(const LLUISingleton&){} -private: - static T* sInstance; -}; - -template <class T, class U> T* LLUISingleton<T,U>::sInstance = NULL; class LLScreenClipRect { diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index aae4a86d87..19d1d4040c 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -125,7 +125,9 @@ LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel) mViewModel(viewmodel), mControlVariable(NULL), mEnabledControlVariable(NULL), - mDisabledControlVariable(NULL) + mDisabledControlVariable(NULL), + mMakeVisibleControlVariable(NULL), + mMakeInvisibleControlVariable(NULL) { mUICtrlHandle.bind(this); } diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 3b2b56d48e..586b988c43 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -196,7 +196,7 @@ static LLFastTimer::DeclareTimer BUILD_FLOATERS("Build Floaters"); //----------------------------------------------------------------------------- // buildFloater() //----------------------------------------------------------------------------- -void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filename, BOOL open_floater, LLXMLNodePtr output_node) +void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filename, LLXMLNodePtr output_node) { LLFastTimer timer(BUILD_FLOATERS); LLXMLNodePtr root; @@ -236,7 +236,7 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen floaterp->getCommitCallbackRegistrar().pushScope(); floaterp->getEnableCallbackRegistrar().pushScope(); - floaterp->initFloaterXML(root, floaterp->getParent(), open_floater, output_node); + floaterp->initFloaterXML(root, floaterp->getParent(), output_node); if (LLUI::sShowXUINames) { @@ -254,13 +254,6 @@ void LLUICtrlFactory::buildFloater(LLFloater* floaterp, const std::string& filen mFileNames.pop_back(); } -LLFloater* LLUICtrlFactory::buildFloaterFromXML(const std::string& filename, BOOL open_floater) -{ - LLFloater* floater = new LLFloater(); - buildFloater(floater, filename, open_floater); - return floater; -} - //----------------------------------------------------------------------------- // saveToXML() //----------------------------------------------------------------------------- diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 6374018ca6..9dbe458bae 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -267,8 +267,7 @@ public: return ParamDefaults<typename T::Params, 0>::instance().get(); } - void buildFloater(LLFloater* floaterp, const std::string &filename, BOOL open_floater = TRUE, LLXMLNodePtr output_node = NULL); - LLFloater* buildFloaterFromXML(const std::string& filename, BOOL open_floater = TRUE); + void buildFloater(LLFloater* floaterp, const std::string &filename, LLXMLNodePtr output_node); BOOL buildPanel(LLPanel* panelp, const std::string &filename, LLXMLNodePtr output_node = NULL); // Does what you want for LLFloaters and LLPanels diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 2f9a6e7d46..d94472a8e5 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -603,14 +603,14 @@ void LLView::setVisible(BOOL visible) if (!getParent() || getParent()->isInVisibleChain()) { // tell all children of this view that the visibility may have changed - onVisibilityChange( visible ); + handleVisibilityChange( visible ); } updateBoundingRect(); } } // virtual -void LLView::onVisibilityChange ( BOOL new_visibility ) +void LLView::handleVisibilityChange ( BOOL new_visibility ) { for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) { @@ -618,7 +618,7 @@ void LLView::onVisibilityChange ( BOOL new_visibility ) // only views that are themselves visible will have their overall visibility affected by their ancestors if (viewp->getVisible()) { - viewp->onVisibilityChange ( new_visibility ); + viewp->handleVisibilityChange ( new_visibility ); } } } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 9138b04258..ee49276139 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -93,7 +93,7 @@ virtual void setEnabled(BOOL enabled) { mEnabled = enabled; } LLCheckBoxCtrl, LLComboBox, LLLineEditor, LLMenuGL, LLRadioGroup, etc virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ) { return FALSE; } LLUICtrl, LLButton, LLCheckBoxCtrl, LLLineEditor, LLMenuGL, LLSliderCtrl -virtual void onVisibilityChange ( BOOL curVisibilityIn ); +virtual void handleVisibilityChange ( BOOL curVisibilityIn ); LLMenuGL virtual LLRect getSnapRect() const { return mRect; } *TODO: Make non virtual LLFloater @@ -349,7 +349,7 @@ public: virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); - virtual void onVisibilityChange ( BOOL curVisibilityIn ); + virtual void handleVisibilityChange ( BOOL new_visibility ); void pushVisible(BOOL visible) { mLastVisible = mVisible; setVisible(visible); } void popVisible() { setVisible(mLastVisible); } diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 2b8e66628e..4a9a715b34 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -89,6 +89,7 @@ set(viewer_SOURCE_FILES llcapabilitylistener.cpp llcaphttpsender.cpp llchannelmanager.cpp + llchatbar.cpp llchatitemscontainerctrl.cpp llchatmsgbox.cpp llchiclet.cpp @@ -130,13 +131,13 @@ set(viewer_SOURCE_FILES llfeaturemanager.cpp llfilepicker.cpp llfirstuse.cpp + llfirsttimetipmanager.cpp llflexibleobject.cpp llfloaterabout.cpp llfloateractivespeakers.cpp llfloateraddlandmark.cpp llfloateranimpreview.cpp llfloaterauction.cpp - llfloateravatarinfo.cpp llfloateravatarpicker.cpp llfloateravatartextures.cpp llfloaterbeacons.cpp @@ -151,13 +152,12 @@ set(viewer_SOURCE_FILES llfloatercamera.cpp llfloaterchat.cpp llfloaterchatterbox.cpp - llfloaterclassified.cpp llfloatercolorpicker.cpp llfloatercustomize.cpp llfloaterdaycycle.cpp llfloaterdirectory.cpp llfloaterenvsettings.cpp - llfloaterevent.cpp + llfloaterfirsttimetip.cpp llfloaterfriends.cpp llfloaterfonttest.cpp llfloatergesture.cpp @@ -185,7 +185,6 @@ set(viewer_SOURCE_FILES llfloatermute.cpp llfloaternamedesc.cpp llfloaternotificationsconsole.cpp - llfloaterobjectiminfo.cpp llfloateropenobject.cpp llfloaterparcel.cpp llfloaterperms.cpp @@ -283,7 +282,9 @@ set(viewer_SOURCE_FILES lloverlaybar.cpp llpanelavatar.cpp llpanelavatarrow.cpp + llpanelavatartag.cpp llpanelclassified.cpp + llsidetraypanelcontainer.cpp llpanelcontents.cpp llpaneldirbrowser.cpp llpaneldirclassified.cpp @@ -309,6 +310,7 @@ set(viewer_SOURCE_FILES llpanellogin.cpp llpanelmedia.cpp llpanelmeprofile.cpp + llpanelmovetip.cpp llpanelobject.cpp llpanelpeople.cpp llpanelpermissions.cpp @@ -347,6 +349,7 @@ set(viewer_SOURCE_FILES llsky.cpp llslurl.cpp llspatialpartition.cpp + llsplitbutton.cpp llsprite.cpp llstartup.cpp llstatusbar.cpp @@ -532,6 +535,7 @@ set(viewer_HEADER_FILES llcapabilityprovider.h llcaphttpsender.h llchannelmanager.h + llchatbar.h llchatitemscontainerctrl.h llchatmsgbox.h llchiclet.h @@ -574,13 +578,13 @@ set(viewer_HEADER_FILES llfeaturemanager.h llfilepicker.h llfirstuse.h + llfirsttimetipmanager.h llflexibleobject.h llfloaterabout.h llfloateractivespeakers.h llfloateraddlandmark.h llfloateranimpreview.h llfloaterauction.h - llfloateravatarinfo.h llfloateravatarpicker.h llfloateravatartextures.h llfloaterbeacons.h @@ -595,13 +599,12 @@ set(viewer_HEADER_FILES llfloatercamera.h llfloaterchat.h llfloaterchatterbox.h - llfloaterclassified.h llfloatercolorpicker.h llfloatercustomize.h llfloaterdaycycle.h llfloaterdirectory.h llfloaterenvsettings.h - llfloaterevent.h + llfloaterfirsttimetip.h llfloaterfonttest.h llfloaterfriends.h llfloatergesture.h @@ -629,7 +632,6 @@ set(viewer_HEADER_FILES llfloatermute.h llfloaternamedesc.h llfloaternotificationsconsole.h - llfloaterobjectiminfo.h llfloateropenobject.h llfloaterparcel.h llfloaterpostcard.h @@ -726,7 +728,9 @@ set(viewer_HEADER_FILES lloverlaybar.h llpanelavatar.h llpanelavatarrow.h + llpanelavatartag.h llpanelclassified.h + llsidetraypanelcontainer.h llpanelcontents.h llpaneldirbrowser.h llpaneldirclassified.h @@ -752,6 +756,7 @@ set(viewer_HEADER_FILES llpanellogin.h llpanelmedia.h llpanelmeprofile.h + llpanelmovetip.h llpanelobject.h llpanelpeople.h llpanelpermissions.h @@ -792,6 +797,7 @@ set(viewer_HEADER_FILES llsky.h llslurl.h llspatialpartition.h + llsplitbutton.h llsprite.h llstartup.h llstatusbar.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 667090d0ab..1432365d38 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -584,17 +584,6 @@ <key>Value</key> <integer>40</integer> </map> - <key>BeaconAlwaysOn</key> - <map> - <key>Comment</key> - <string>Beacons / highlighting always on</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> <key>BottomPanelNew</key> <map> <key>Comment</key> @@ -4593,7 +4582,7 @@ <key>Type</key> <string>Boolean</string> <key>Value</key> - <integer>1</integer> + <integer>0</integer> </map> <key>NearMeRange</key> <map> @@ -4760,6 +4749,17 @@ <key>Value</key> <integer>5</integer> </map> + <key>ToastOpaqueTime</key> + <map> + <key>Comment</key> + <string>Width of notification messages</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>4</integer> + </map> <key>StartUpToastTime</key> <map> <key>Comment</key> @@ -4769,7 +4769,7 @@ <key>Type</key> <string>S32</string> <key>Value</key> - <integer>10</integer> + <integer>5</integer> </map> <key>ToastMargin</key> <map> @@ -6776,6 +6776,17 @@ <key>ShowCrosshairs</key> <map> <key>Comment</key> + <string>Show Coordinates in Location Input Field</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>ShowCoordinatesOption</key> + <map> + <key>Comment</key> <string>Display crosshairs when in mouselook mode</string> <key>Persist</key> <integer>1</integer> @@ -7192,7 +7203,7 @@ <key>Type</key> <string>Boolean</string> <key>Value</key> - <integer>0</integer> + <integer>1</integer> </map> <key>ShowTangentBasis</key> <map> @@ -8278,7 +8289,7 @@ <key>Type</key> <string>S32</string> <key>Value</key> - <real>16</real> + <real>15</real> </map> <key>UISliderctrlHeight</key> <map> @@ -9634,5 +9645,16 @@ <key>Value</key> <integer>0</integer> </map> + <key>GroupTeleportMembersLimit</key> + <map> + <key>Comment</key> + <string>Max number of members of group to offer teleport</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>100</integer> + </map> </map> </llsd> diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index e4db98faf2..e3d3d66d87 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -43,7 +43,6 @@ #include "llfirstuse.h" #include "llfloaterreg.h" #include "llfloateractivespeakers.h" -#include "llfloateravatarinfo.h" #include "llfloatercamera.h" #include "llfloatercustomize.h" #include "llfloaterdirectory.h" @@ -503,12 +502,16 @@ void LLAgent::resetView(BOOL reset_camera, BOOL change_camera) LLViewerJoystick::getInstance()->moveAvatar(true); } - LLFloaterReg::hideInstance("build"); + //Camera Tool is needed for Free Camera Control Mode + if (!LLFloaterCamera::inFreeCameraMode()) + { + LLFloaterReg::hideInstance("build"); + + // Switch back to basic toolset + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + } gViewerWindow->showCursor(); - - // Switch back to basic toolset - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); } @@ -759,7 +762,7 @@ void LLAgent::setFlying(BOOL fly) } // don't allow taking off while sitting - if (fly && mAvatarObject->mIsSitting) + if (fly && mAvatarObject->isSitting()) { return; } @@ -788,6 +791,11 @@ void LLAgent::setFlying(BOOL fly) clearControlFlags(AGENT_CONTROL_FLY); gSavedSettings.setBOOL("FlyBtnState", FALSE); } + + + // Update Movement Controls according to Fly mode + LLFloaterMove::setFlyingMode(fly); + mbFlagsDirty = TRUE; } @@ -811,11 +819,16 @@ bool LLAgent::enableFlying() BOOL sitting = FALSE; if (gAgent.getAvatarObject()) { - sitting = gAgent.getAvatarObject()->mIsSitting; + sitting = gAgent.getAvatarObject()->isSitting(); } return !sitting; } +void LLAgent::standUp() +{ + setControlFlags(AGENT_CONTROL_STAND_UP); +} + //----------------------------------------------------------------------------- // setRegion() @@ -1246,7 +1259,7 @@ F32 LLAgent::clampPitchToLimits(F32 angle) F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward ); - if (mAvatarObject.notNull() && mAvatarObject->mIsSitting) + if (mAvatarObject.notNull() && mAvatarObject->isSitting()) { look_down_limit = 130.f * DEG_TO_RAD; } @@ -2492,13 +2505,11 @@ void LLAgent::autoPilot(F32 *delta_yaw) void LLAgent::propagate(const F32 dt) { // Update UI based on agent motion - LLFloaterMove *floater_move = LLFloaterReg::getTypedInstance<LLFloaterMove>("moveview"); + LLFloaterMove *floater_move = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview"); if (floater_move) { floater_move->mForwardButton ->setToggleState( mAtKey > 0 || mWalkKey > 0 ); floater_move->mBackwardButton ->setToggleState( mAtKey < 0 || mWalkKey < 0 ); - floater_move->mSlideLeftButton ->setToggleState( mLeftKey > 0 ); - floater_move->mSlideRightButton->setToggleState( mLeftKey < 0 ); floater_move->mTurnLeftButton ->setToggleState( mYawKey > 0.f ); floater_move->mTurnRightButton ->setToggleState( mYawKey < 0.f ); floater_move->mMoveUpButton ->setToggleState( mUpKey > 0 ); @@ -2583,7 +2594,7 @@ void LLAgent::updateLookAt(const S32 mouse_x, const S32 mouse_y) else { // *FIX: rotate mframeagent by sit object's rotation? - LLQuaternion look_rotation = mAvatarObject->mIsSitting ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion(); // use camera's current rotation + LLQuaternion look_rotation = mAvatarObject->isSitting() ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion(); // use camera's current rotation LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot; setLookAt(LOOKAT_TARGET_IDLE, mAvatarObject, look_offset); } @@ -2819,6 +2830,8 @@ void LLAgent::endAnimationUpdateUI() LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + LLFloaterCamera::toPrevModeIfInAvatarViewMode(); + // Only pop if we have pushed... if (TRUE == mViewsPushed) { @@ -2913,6 +2926,10 @@ void LLAgent::endAnimationUpdateUI() // JC - Added for always chat in third person option gFocusMgr.setKeyboardFocus(NULL); + //Making sure Camera Controls floater is in the right state + //when entering Mouse Look using wheel scrolling + LLFloaterCamera::updateIfNotInAvatarViewMode(); + LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset); mViewsPushed = TRUE; @@ -3023,7 +3040,7 @@ void LLAgent::updateCamera() validateFocusObject(); if (mAvatarObject.notNull() && - mAvatarObject->mIsSitting && + mAvatarObject->isSitting() && camera_mode == CAMERA_MODE_MOUSELOOK) { //Ventrella @@ -3054,24 +3071,24 @@ void LLAgent::updateCamera() } // Update UI with our camera inputs - LLFloaterCamera* camera_instance = LLFloaterReg::getTypedInstance<LLFloaterCamera>("camera"); - if(camera_instance) + LLFloaterCamera* camera_floater = LLFloaterReg::findTypedInstance<LLFloaterCamera>("camera"); + if (camera_floater) { - camera_instance->mRotate->setToggleState( - mOrbitRightKey > 0.f, // left - mOrbitUpKey > 0.f, // top - mOrbitLeftKey > 0.f, // right - mOrbitDownKey > 0.f); // bottom + camera_floater->mRotate->setToggleState( + mOrbitRightKey > 0.f, // left + mOrbitUpKey > 0.f, // top + mOrbitLeftKey > 0.f, // right + mOrbitDownKey > 0.f); // bottom - camera_instance->mZoom->setToggleState( - mOrbitInKey > 0.f, // top - mOrbitOutKey > 0.f); // bottom + camera_floater->mZoom->setToggleState( + mOrbitInKey > 0.f, // top + mOrbitOutKey > 0.f); // bottom - camera_instance->mTrack->setToggleState( - mPanLeftKey > 0.f, // left - mPanUpKey > 0.f, // top - mPanRightKey > 0.f, // right - mPanDownKey > 0.f); // bottom + camera_floater->mTrack->setToggleState( + mPanLeftKey > 0.f, // left + mPanUpKey > 0.f, // top + mPanRightKey > 0.f, // right + mPanDownKey > 0.f); // bottom } // Handle camera movement based on keyboard. @@ -3148,7 +3165,7 @@ void LLAgent::updateCamera() // (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent. //-------------------------------------------------------------------------------- // *TODO: use combined rotation of frameagent and sit object - LLQuaternion avatarRotationForFollowCam = mAvatarObject->mIsSitting ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion(); + LLQuaternion avatarRotationForFollowCam = mAvatarObject->isSitting() ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion(); LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams(); if (current_cam) @@ -3328,7 +3345,7 @@ void LLAgent::updateCamera() } mLastPositionGlobal = global_pos; - if (LLVOAvatar::sVisibleInFirstPerson && mAvatarObject.notNull() && !mAvatarObject->mIsSitting && cameraMouselook()) + if (LLVOAvatar::sVisibleInFirstPerson && mAvatarObject.notNull() && !mAvatarObject->isSitting() && cameraMouselook()) { LLVector3 head_pos = mAvatarObject->mHeadp->getWorldPosition() + LLVector3(0.08f, 0.f, 0.05f) * mAvatarObject->mHeadp->getWorldRotation() + @@ -3508,7 +3525,7 @@ LLVector3d LLAgent::calcFocusPositionTargetGlobal() } return mFocusTargetGlobal; } - else if (mSitCameraEnabled && mAvatarObject.notNull() && mAvatarObject->mIsSitting && mSitCameraReferenceObject.notNull()) + else if (mSitCameraEnabled && mAvatarObject.notNull() && mAvatarObject->isSitting() && mSitCameraReferenceObject.notNull()) { // sit camera LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); @@ -3632,7 +3649,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) return LLVector3d::zero; } head_offset.clearVec(); - if (mAvatarObject->mIsSitting && mAvatarObject->getParent()) + if (mAvatarObject->isSitting() && mAvatarObject->getParent()) { mAvatarObject->updateHeadOffset(); head_offset.mdV[VX] = mAvatarObject->mHeadOffset.mV[VX]; @@ -3646,7 +3663,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) else { head_offset.mdV[VZ] = mAvatarObject->mHeadOffset.mV[VZ]; - if (mAvatarObject->mIsSitting) + if (mAvatarObject->isSitting()) { head_offset.mdV[VZ] += 0.1; } @@ -3662,7 +3679,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) if (mSitCameraEnabled && mAvatarObject.notNull() - && mAvatarObject->mIsSitting + && mAvatarObject->isSitting() && mSitCameraReferenceObject.notNull()) { // sit camera @@ -3694,7 +3711,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) local_camera_offset = mFrameAgent.rotateToAbsolute( local_camera_offset ); } - if (!mCameraCollidePlane.isExactlyZero() && (mAvatarObject.isNull() || !mAvatarObject->mIsSitting)) + if (!mCameraCollidePlane.isExactlyZero() && (mAvatarObject.isNull() || !mAvatarObject->isSitting())) { LLVector3 plane_normal; plane_normal.setVec(mCameraCollidePlane.mV); @@ -4120,7 +4137,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate) if (mAvatarObject.notNull()) { - if (!mAvatarObject->mIsSitting) + if (!mAvatarObject->isSitting()) { mAvatarObject->mPelvisp->setPosition(LLVector3::zero); } @@ -4202,7 +4219,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_ani return; } - setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up + standUp(); // force stand up gViewerWindow->getWindow()->resetBusyCount(); if (gFaceEditToolset) @@ -5482,13 +5499,8 @@ void update_group_floaters(const LLUUID& group_id) { LLFloaterGroupInfo::refreshGroup(group_id); - //*TODO Implement group update for Profile View - // update avatar info -// LLFloaterAvatarInfo* fa = LLFloaterReg::findTypedInstance<LLFloaterAvatarInfo>("preview_avatar", LLSD(gAgent.getID())); -// if(fa) -// { -// fa->resetGroupList(); -// } + //*TODO Implement group update for Profile View + // still actual as of July 31, 2009 (DZ) if (gIMMgr) { diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 290c413079..35ebc41909 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -378,6 +378,12 @@ private: bool mbRunning; // Is the avatar trying to run right now? //-------------------------------------------------------------------- + // Sit and stand + //-------------------------------------------------------------------- +public: + void standUp(); + + //-------------------------------------------------------------------- // Busy //-------------------------------------------------------------------- public: diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 87354121a0..92db908059 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -682,13 +682,15 @@ bool LLAppViewer::init() // Setup paths and LLTrans after LLUI::initClass has been called LLUI::setupPaths(); LLTrans::parseStrings("strings.xml", default_trans_args); - + LLTrans::parseLanguageStrings("language_settings.xml"); LLWeb::initClass(); // do this after LLUI LLTextEditor::setURLCallbacks(&LLWeb::loadURL, &LLURLDispatcher::dispatchFromTextEditor, &LLURLDispatcher::dispatchFromTextEditor); - + + // Load translations for tooltips + LLFloater::initClass(); ///////////////////////////////////////////////// @@ -1762,7 +1764,7 @@ bool LLAppViewer::initConfiguration() LLUI::setupPaths(); // setup paths for LLTrans based on settings files only LLTrans::parseStrings("strings.xml", default_trans_args); - + LLTrans::parseLanguageStrings("language_settings.xml"); // - set procedural settings // Note: can't use LL_PATH_PER_SL_ACCOUNT for any of these since we haven't logged in yet gSavedSettings.setString("ClientSettingsFile", @@ -1817,6 +1819,7 @@ bool LLAppViewer::initConfiguration() LLControlGroupCLP clp; std::string cmd_line_config = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "cmd_line.xml"); + clp.configure(cmd_line_config, &gSavedSettings); if(!initParseCommandLine(clp)) @@ -3458,7 +3461,7 @@ void LLAppViewer::idle() { // Handle pending gesture processing - gGestureManager.update(); + LLGestureManager::instance().update(); gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY); } @@ -4031,8 +4034,6 @@ void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) void LLAppViewer::handleLoginComplete() { - gViewerWindow->handleLoginComplete(); - initMainloopTimeout("Mainloop Init"); // Store some data to DebugInfo in case of a freeze. diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 802c90f531..bb3b9087a1 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -465,10 +465,10 @@ void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content) { // If this gesture is active, then we need to update the in-memory // active map with the new pointer. - if (gGestureManager.isGestureActive(item_id)) + if (LLGestureManager::instance().isGestureActive(item_id)) { LLUUID asset_id = new_item->getAssetUUID(); - gGestureManager.replaceGesture(item_id, asset_id); + LLGestureManager::instance().replaceGesture(item_id, asset_id); gInventory.notifyObservers(); } diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index a85f8710c7..40dd20dfa4 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -117,6 +117,24 @@ void LLAvatarList::draw() } } +//virtual +BOOL LLAvatarList::handleMouseDown(S32 x, S32 y, MASK mask) +{ + LLScrollListItem* hit_item = hitItem(x, y); + if (NULL == hit_item) + { + std::vector<LLScrollListItem*> selectedItems = getAllSelected(); + std::vector<LLScrollListItem*>::const_iterator it = selectedItems.begin(); + + for (; it != selectedItems.end(); ++it) + { + (*it)->setSelected(FALSE); + } + return TRUE; + } + return LLScrollListCtrl::handleMouseDown(x, y, mask); +} + std::vector<LLUUID> LLAvatarList::getSelectedIDs() { LLUUID selected_id; diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index 8b419dbb57..991e9fa145 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -59,6 +59,14 @@ public: virtual ~LLAvatarList() {} /*virtual*/ void draw(); + /** + * Overrides base-class behavior of Mouse Down Event. + * + * LLScrollListCtrl::handleMouseDown version calls setFocus which select the first item if nothing selected. + * We need to deselect all items if perform click not over the any item. Otherwise calls base method. + * See EXT-246 + */ + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); BOOL update(const std::vector<LLUUID>& all_buddies, const std::string& name_filter = LLStringUtil::null); diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 1781e6b3f1..9eb8369c4c 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -38,18 +38,16 @@ #include "llfloaterreg.h" #include "llflyoutbutton.h" #include "llnearbychatbar.h" - -//FIXME: temporary, for stand up proto -#include "llselectmgr.h" -#include "llvoavatarself.h" +#include "llsplitbutton.h" +#include "llfloatercamera.h" +#include "llimpanel.h" LLBottomTray::LLBottomTray(const LLSD&) - : mChicletPanel(NULL) - , mIMWell(NULL) - , mSysWell(NULL) - , mTalkBtn(NULL) - , mStandUpBtn(NULL) ////FIXME: temporary, for stand up proto - , mNearbyChatBar(NULL) +: mChicletPanel(NULL), + mIMWell(NULL), + mSysWell(NULL), + mTalkBtn(NULL), + mNearbyChatBar(NULL) { mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); @@ -61,13 +59,9 @@ LLBottomTray::LLBottomTray(const LLSD&) mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); - ////FIXME: temporary, for stand up proto - mStandUpBtn = getChild<LLButton> ("stand", TRUE, FALSE); - if (mStandUpBtn) - { - mStandUpBtn->setCommitCallback(boost::bind(&LLBottomTray::onCommitStandUp, this, _1)); - } - + LLSplitButton* presets = getChild<LLSplitButton>("presets", TRUE, FALSE); + if (presets) presets->setSelectionCallback(LLFloaterCamera::onClickCameraPresets); + LLIMMgr::getInstance()->addSessionObserver(this); //this is to fix a crash that occurs because LLBottomTray is a singleton @@ -79,6 +73,13 @@ LLBottomTray::LLBottomTray(const LLSD&) setFocusRoot(TRUE); } +BOOL LLBottomTray::postBuild() +{ + mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar"); + + return TRUE; +} + LLBottomTray::~LLBottomTray() { if (!LLSingleton<LLIMMgr>::destroyed()) @@ -94,54 +95,18 @@ void LLBottomTray::onChicletClick(LLUICtrl* ctrl) { // Until you can type into an IM Window and have a conversation, // still show the old communicate window - LLFloaterReg::showInstance("communicate", chiclet->getSessionId()); - // DISABLED IN VIEWER-2 BRANCH UNTIL FEATURE IS DONE -- James - //// Show after comm window so it is frontmost (and hence will not - //// auto-hide) - //LLIMFloater::show(chiclet->getSessionId()); - } -} - -void* LLBottomTray::createNearbyChatBar(void* userdata) -{ - LLBottomTray *bt = LLBottomTray::getInstance(); - if (!bt) - return NULL; + //LLFloaterReg::showInstance("communicate", chiclet->getSessionId()); - bt->mNearbyChatBar = new LLNearbyChatBar(); - - return bt->mNearbyChatBar; -} - -//virtual -void LLBottomTray::draw() -{ - refreshStandUp(); - LLPanel::draw(); -} - -void LLBottomTray::refreshStandUp() -{ - //FIXME: temporary, for stand up proto - BOOL sitting = FALSE; - if (gAgent.getAvatarObject()) - { - sitting = gAgent.getAvatarObject()->mIsSitting; - } - - if (mStandUpBtn && mStandUpBtn->getVisible() != sitting) - { - mStandUpBtn->setVisible(sitting); - sendChildToFront(mStandUpBtn); - moveChildToBackOfTabGroup(mStandUpBtn); + // Show after comm window so it is frontmost (and hence will not + // auto-hide) + LLIMFloater::show(chiclet->getSessionId()); + chiclet->setCounter(0); } } -//FIXME: temporary, for stand up proto -void LLBottomTray::onCommitStandUp(LLUICtrl* ctrl) +void* LLBottomTray::createNearbyChatBar(void* userdata) { - LLSelectMgr::getInstance()->deselectAllForStandingUp(); - gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); + return new LLNearbyChatBar(); } //virtual diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index e5848f72dc..ffb0f9ae4f 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -43,25 +43,22 @@ class LLTalkButton; class LLNearbyChatBar; class LLBottomTray - : public LLUISingleton<LLBottomTray> + : public LLSingleton<LLBottomTray> , public LLPanel , public LLIMSessionObserver { - friend class LLUISingleton<LLBottomTray>; + friend class LLSingleton<LLBottomTray>; public: ~LLBottomTray(); + BOOL postBuild(); + LLChicletPanel* getChicletPanel() {return mChicletPanel;} LLNotificationChiclet* getIMWell() {return mIMWell;} LLNotificationChiclet* getSysWell() {return mSysWell;} LLNearbyChatBar* getNearbyChatBar() {return mNearbyChatBar;} - /*virtual*/void draw(); - void refreshStandUp(); - void onCommitGesture(LLUICtrl* ctrl); - void onCommitStandUp(LLUICtrl* ctrl); - void refreshGestures(); // LLIMSessionObserver observe triggers virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); @@ -82,7 +79,6 @@ protected: LLNotificationChiclet* mIMWell; LLNotificationChiclet* mSysWell; LLTalkButton* mTalkBtn; - LLButton* mStandUpBtn; LLNearbyChatBar* mNearbyChatBar; }; diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp index 0eb0801a2c..118385ab58 100644 --- a/indra/newview/llchannelmanager.cpp +++ b/indra/newview/llchannelmanager.cpp @@ -45,6 +45,8 @@ using namespace LLNotificationsUI; LLChannelManager::LLChannelManager() { LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLChannelManager::onLoginCompleted, this)); + mChannelList.clear(); + mStartUpChannel = NULL; } //-------------------------------------------------------------------------- @@ -74,7 +76,6 @@ void LLChannelManager::onLoginCompleted() p.id = LLUUID(STARTUP_CHANNEL_ID); p.channel_right_bound = getRootView()->getRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin"); p.channel_width = gSavedSettings.getS32("NotifyBoxWidth"); - mStartUpChannel = NULL; mStartUpChannel = createChannel(p); if(!mStartUpChannel) @@ -90,6 +91,7 @@ void LLChannelManager::enableShowToasts() { LLScreenChannel::setStartUpToastShown(); delete mStartUpChannel; + mStartUpChannel = NULL; } //-------------------------------------------------------------------------- @@ -166,6 +168,10 @@ void LLChannelManager::reshape(S32 width, S32 height, BOOL called_from_parent) //-------------------------------------------------------------------------- +LLScreenChannel* LLChannelManager::getStartUpChannel() +{ + return mStartUpChannel; +} //-------------------------------------------------------------------------- diff --git a/indra/newview/llchannelmanager.h b/indra/newview/llchannelmanager.h index 3914d20ebc..ac8e81d7ef 100644 --- a/indra/newview/llchannelmanager.h +++ b/indra/newview/llchannelmanager.h @@ -112,6 +112,8 @@ public: void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + LLScreenChannel* getStartUpChannel(); + private: LLScreenChannel* mStartUpChannel; diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp new file mode 100644 index 0000000000..46a2179e8d --- /dev/null +++ b/indra/newview/llchatbar.cpp @@ -0,0 +1,694 @@ +/** + * @file llchatbar.cpp + * @brief LLChatBar class implementation + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llchatbar.h" + +#include "imageids.h" +#include "llfontgl.h" +#include "llrect.h" +#include "llerror.h" +#include "llparcel.h" +#include "llstring.h" +#include "message.h" +#include "llfocusmgr.h" + +#include "llagent.h" +#include "llbutton.h" +#include "llcombobox.h" +#include "llcommandhandler.h" // secondlife:///app/chat/ support +#include "llviewercontrol.h" +#include "llfloaterchat.h" +#include "llgesturemgr.h" +#include "llkeyboard.h" +#include "lllineeditor.h" +#include "llstatusbar.h" +#include "lltextbox.h" +#include "lluiconstants.h" +#include "llviewergesture.h" // for triggering gestures +#include "llviewermenu.h" // for deleting object with DEL key +#include "llviewerstats.h" +#include "llviewerwindow.h" +#include "llframetimer.h" +#include "llresmgr.h" +#include "llworld.h" +#include "llinventorymodel.h" +#include "llmultigesture.h" +#include "llui.h" +#include "llviewermenu.h" +#include "lluictrlfactory.h" +#include "llbottomtray.h" + +// +// Globals +// +const F32 AGENT_TYPING_TIMEOUT = 5.f; // seconds + +LLChatBar *gChatBar = NULL; + +class LLChatBarGestureObserver : public LLGestureManagerObserver +{ +public: + LLChatBarGestureObserver(LLChatBar* chat_barp) : mChatBar(chat_barp){} + virtual ~LLChatBarGestureObserver() {} + virtual void changed() { mChatBar->refreshGestures(); } +private: + LLChatBar* mChatBar; +}; + + +extern void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); + +// +// Functions +// + +LLChatBar::LLChatBar() +: LLPanel(), + mInputEditor(NULL), + mGestureLabelTimer(), + mLastSpecialChatChannel(0), + mIsBuilt(FALSE), + mGestureCombo(NULL), + mObserver(NULL) +{ + setIsChrome(TRUE); + +#if !LL_RELEASE_FOR_DOWNLOAD + childDisplayNotFound(); +#endif +} + + +LLChatBar::~LLChatBar() +{ + LLGestureManager::instance().removeObserver(mObserver); + delete mObserver; + mObserver = NULL; + // LLView destructor cleans up children +} + +BOOL LLChatBar::postBuild() +{ + getChild<LLUICtrl>("Say")->setCommitCallback(boost::bind(&LLChatBar::onClickSay, this, _1)); + + // attempt to bind to an existing combo box named gesture + setGestureCombo(getChild<LLComboBox>( "Gesture", TRUE, FALSE)); + + mInputEditor = getChild<LLLineEditor>("Chat Editor"); + mInputEditor->setKeystrokeCallback(&onInputEditorKeystroke, this); + mInputEditor->setFocusLostCallback(&onInputEditorFocusLost, this); + mInputEditor->setFocusReceivedCallback( &onInputEditorGainFocus, this ); + mInputEditor->setCommitOnFocusLost( FALSE ); + mInputEditor->setRevertOnEsc( FALSE ); + mInputEditor->setIgnoreTab(TRUE); + mInputEditor->setPassDelete(TRUE); + mInputEditor->setReplaceNewlinesWithSpaces(FALSE); + + mInputEditor->setMaxTextLength(1023); + mInputEditor->setEnableLineHistory(TRUE); + + mIsBuilt = TRUE; + + return TRUE; +} + +//----------------------------------------------------------------------- +// Overrides +//----------------------------------------------------------------------- + +// virtual +BOOL LLChatBar::handleKeyHere( KEY key, MASK mask ) +{ + BOOL handled = FALSE; + + // ALT-RETURN is reserved for windowed/fullscreen toggle + if( KEY_RETURN == key ) + { + if (mask == MASK_CONTROL) + { + // shout + sendChat(CHAT_TYPE_SHOUT); + handled = TRUE; + } + else if (mask == MASK_NONE) + { + // say + sendChat( CHAT_TYPE_NORMAL ); + handled = TRUE; + } + } + // only do this in main chatbar + else if ( KEY_ESCAPE == key && gChatBar == this) + { + stopChat(); + + handled = TRUE; + } + + return handled; +} + +void LLChatBar::refresh() +{ + // HACK: Leave the name of the gesture in place for a few seconds. + const F32 SHOW_GESTURE_NAME_TIME = 2.f; + if (mGestureLabelTimer.getStarted() && mGestureLabelTimer.getElapsedTimeF32() > SHOW_GESTURE_NAME_TIME) + { + LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL; + if (gestures) gestures->selectFirstItem(); + mGestureLabelTimer.stop(); + } + + if ((gAgent.getTypingTime() > AGENT_TYPING_TIMEOUT) && (gAgent.getRenderState() & AGENT_STATE_TYPING)) + { + gAgent.stopTyping(); + } + + childSetEnabled("Say", mInputEditor->getText().size() > 0); + +} + +void LLChatBar::refreshGestures() +{ + if (mGestureCombo) + { + //store current selection so we can maintain it + std::string cur_gesture = mGestureCombo->getValue().asString(); + mGestureCombo->selectFirstItem(); + std::string label = mGestureCombo->getValue().asString();; + // clear + mGestureCombo->clearRows(); + + // collect list of unique gestures + std::map <std::string, BOOL> unique; + LLGestureManager::item_map_t::iterator it; + for (it = LLGestureManager::instance().mActive.begin(); it != LLGestureManager::instance().mActive.end(); ++it) + { + LLMultiGesture* gesture = (*it).second; + if (gesture) + { + if (!gesture->mTrigger.empty()) + { + unique[gesture->mTrigger] = TRUE; + } + } + } + + // add unique gestures + std::map <std::string, BOOL>::iterator it2; + for (it2 = unique.begin(); it2 != unique.end(); ++it2) + { + mGestureCombo->addSimpleElement((*it2).first); + } + + mGestureCombo->sortByName(); + // Insert label after sorting, at top, with separator below it + mGestureCombo->addSeparator(ADD_TOP); + mGestureCombo->addSimpleElement(getString("gesture_label"), ADD_TOP); + + if (!cur_gesture.empty()) + { + mGestureCombo->selectByValue(LLSD(cur_gesture)); + } + else + { + mGestureCombo->selectFirstItem(); + } + } +} + +// Move the cursor to the correct input field. +void LLChatBar::setKeyboardFocus(BOOL focus) +{ + if (focus) + { + if (mInputEditor) + { + mInputEditor->setFocus(TRUE); + mInputEditor->selectAll(); + } + } + else if (gFocusMgr.childHasKeyboardFocus(this)) + { + if (mInputEditor) + { + mInputEditor->deselect(); + } + setFocus(FALSE); + } +} + + +// Ignore arrow keys in chat bar +void LLChatBar::setIgnoreArrowKeys(BOOL b) +{ + if (mInputEditor) + { + mInputEditor->setIgnoreArrowKeys(b); + } +} + +BOOL LLChatBar::inputEditorHasFocus() +{ + return mInputEditor && mInputEditor->hasFocus(); +} + +std::string LLChatBar::getCurrentChat() +{ + return mInputEditor ? mInputEditor->getText() : LLStringUtil::null; +} + +void LLChatBar::setGestureCombo(LLComboBox* combo) +{ + mGestureCombo = combo; + if (mGestureCombo) + { + mGestureCombo->setCommitCallback(boost::bind(&LLChatBar::onCommitGesture, this, _1)); + + // now register observer since we have a place to put the results + mObserver = new LLChatBarGestureObserver(this); + LLGestureManager::instance().addObserver(mObserver); + + // refresh list from current active gestures + refreshGestures(); + } +} + +//----------------------------------------------------------------------- +// Internal functions +//----------------------------------------------------------------------- + +// If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20. +// Otherwise returns input and channel 0. +LLWString LLChatBar::stripChannelNumber(const LLWString &mesg, S32* channel) +{ + if (mesg[0] == '/' + && mesg[1] == '/') + { + // This is a "repeat channel send" + *channel = mLastSpecialChatChannel; + return mesg.substr(2, mesg.length() - 2); + } + else if (mesg[0] == '/' + && mesg[1] + && LLStringOps::isDigit(mesg[1])) + { + // This a special "/20" speak on a channel + S32 pos = 0; + + // Copy the channel number into a string + LLWString channel_string; + llwchar c; + do + { + c = mesg[pos+1]; + channel_string.push_back(c); + pos++; + } + while(c && pos < 64 && LLStringOps::isDigit(c)); + + // Move the pointer forward to the first non-whitespace char + // Check isspace before looping, so we can handle "/33foo" + // as well as "/33 foo" + while(c && iswspace(c)) + { + c = mesg[pos+1]; + pos++; + } + + mLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10); + *channel = mLastSpecialChatChannel; + return mesg.substr(pos, mesg.length() - pos); + } + else + { + // This is normal chat. + *channel = 0; + return mesg; + } +} + + +void LLChatBar::sendChat( EChatType type ) +{ + if (mInputEditor) + { + LLWString text = mInputEditor->getConvertedText(); + if (!text.empty()) + { + // store sent line in history, duplicates will get filtered + if (mInputEditor) mInputEditor->updateHistory(); + // Check if this is destined for another channel + S32 channel = 0; + stripChannelNumber(text, &channel); + + std::string utf8text = wstring_to_utf8str(text); + // Try to trigger a gesture, if not chat to a script. + std::string utf8_revised_text; + if (0 == channel) + { + // discard returned "found" boolean + LLGestureManager::instance().triggerAndReviseString(utf8text, &utf8_revised_text); + } + else + { + utf8_revised_text = utf8text; + } + + utf8_revised_text = utf8str_trim(utf8_revised_text); + + if (!utf8_revised_text.empty()) + { + // Chat with animation + sendChatFromViewer(utf8_revised_text, type, TRUE); + } + } + } + + childSetValue("Chat Editor", LLStringUtil::null); + + gAgent.stopTyping(); + + // If the user wants to stop chatting on hitting return, lose focus + // and go out of chat mode. + if (gChatBar == this && gSavedSettings.getBOOL("CloseChatOnReturn")) + { + stopChat(); + } +} + + +//----------------------------------------------------------------------- +// Static functions +//----------------------------------------------------------------------- + +// static +void LLChatBar::startChat(const char* line) +{ + //TODO* remove DUMMY chat + //if(gBottomTray && gBottomTray->getChatBox()) + //{ + // gBottomTray->setVisible(TRUE); + // gBottomTray->getChatBox()->setFocus(TRUE); + //} + + // *TODO Vadim: Why was this code commented out? + +// gChatBar->setVisible(TRUE); +// gChatBar->setKeyboardFocus(TRUE); +// gSavedSettings.setBOOL("ChatVisible", TRUE); +// +// if (line && gChatBar->mInputEditor) +// { +// std::string line_string(line); +// gChatBar->mInputEditor->setText(line_string); +// } +// // always move cursor to end so users don't obliterate chat when accidentally hitting WASD +// gChatBar->mInputEditor->setCursorToEnd(); +} + + +// Exit "chat mode" and do the appropriate focus changes +// static +void LLChatBar::stopChat() +{ + //TODO* remove DUMMY chat + //if(gBottomTray && gBottomTray->getChatBox()) + ///{ + // gBottomTray->getChatBox()->setFocus(FALSE); + //} + + // *TODO Vadim: Why was this code commented out? + +// // In simple UI mode, we never release focus from the chat bar +// gChatBar->setKeyboardFocus(FALSE); +// +// // If we typed a movement key and pressed return during the +// // same frame, the keyboard handlers will see the key as having +// // gone down this frame and try to move the avatar. +// gKeyboard->resetKeys(); +// gKeyboard->resetMaskKeys(); +// +// // stop typing animation +// gAgent.stopTyping(); +// +// // hide chat bar so it doesn't grab focus back +// gChatBar->setVisible(FALSE); +// gSavedSettings.setBOOL("ChatVisible", FALSE); +} + +// static +void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) +{ + LLChatBar* self = (LLChatBar *)userdata; + + LLWString raw_text; + if (self->mInputEditor) raw_text = self->mInputEditor->getWText(); + + // Can't trim the end, because that will cause autocompletion + // to eat trailing spaces that might be part of a gesture. + LLWStringUtil::trimHead(raw_text); + + S32 length = raw_text.length(); + + if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences + { + gAgent.startTyping(); + } + else + { + gAgent.stopTyping(); + } + + /* Doesn't work -- can't tell the difference between a backspace + that killed the selection vs. backspace at the end of line. + if (length > 1 + && text[0] == '/' + && key == KEY_BACKSPACE) + { + // the selection will already be deleted, but we need to trim + // off the character before + std::string new_text = raw_text.substr(0, length-1); + self->mInputEditor->setText( new_text ); + self->mInputEditor->setCursorToEnd(); + length = length - 1; + } + */ + + KEY key = gKeyboard->currentKey(); + + // Ignore "special" keys, like backspace, arrows, etc. + if (length > 1 + && raw_text[0] == '/' + && key < KEY_SPECIAL) + { + // we're starting a gesture, attempt to autocomplete + + std::string utf8_trigger = wstring_to_utf8str(raw_text); + std::string utf8_out_str(utf8_trigger); + + if (LLGestureManager::instance().matchPrefix(utf8_trigger, &utf8_out_str)) + { + if (self->mInputEditor) + { + std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); + self->mInputEditor->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part + S32 outlength = self->mInputEditor->getLength(); // in characters + + // Select to end of line, starting from the character + // after the last one the user typed. + self->mInputEditor->setSelection(length, outlength); + } + } + + //llinfos << "GESTUREDEBUG " << trigger + // << " len " << length + // << " outlen " << out_str.getLength() + // << llendl; + } +} + +// static +void LLChatBar::onInputEditorFocusLost( LLFocusableElement* caller, void* userdata) +{ + // stop typing animation + gAgent.stopTyping(); +} + +// static +void LLChatBar::onInputEditorGainFocus( LLFocusableElement* caller, void* userdata ) +{ + LLFloaterChat::setHistoryCursorAndScrollToEnd(); +} + +void LLChatBar::onClickSay( LLUICtrl* ctrl ) +{ + std::string cmd = ctrl->getValue().asString(); + e_chat_type chat_type = CHAT_TYPE_NORMAL; + if (cmd == "shout") + { + chat_type = CHAT_TYPE_SHOUT; + } + else if (cmd == "whisper") + { + chat_type = CHAT_TYPE_WHISPER; + } + sendChat(chat_type); +} + +void LLChatBar::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate) +{ + sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate); +} + +void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) +{ + // Look for "/20 foo" channel chats. + S32 channel = 0; + LLWString out_text = stripChannelNumber(wtext, &channel); + std::string utf8_out_text = wstring_to_utf8str(out_text); + std::string utf8_text = wstring_to_utf8str(wtext); + + utf8_text = utf8str_trim(utf8_text); + if (!utf8_text.empty()) + { + utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1); + } + + // Don't animate for chats people can't hear (chat to scripts) + if (animate && (channel == 0)) + { + if (type == CHAT_TYPE_WHISPER) + { + lldebugs << "You whisper " << utf8_text << llendl; + gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START); + } + else if (type == CHAT_TYPE_NORMAL) + { + lldebugs << "You say " << utf8_text << llendl; + gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START); + } + else if (type == CHAT_TYPE_SHOUT) + { + lldebugs << "You shout " << utf8_text << llendl; + gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START); + } + else + { + llinfos << "send_chat_from_viewer() - invalid volume" << llendl; + return; + } + } + else + { + if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP) + { + lldebugs << "Channel chat: " << utf8_text << llendl; + } + } + + send_chat_from_viewer(utf8_out_text, type, channel); +} +/* +void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) +{ + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ChatFromViewer); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_ChatData); + msg->addStringFast(_PREHASH_Message, utf8_out_text); + msg->addU8Fast(_PREHASH_Type, type); + msg->addS32("Channel", channel); + + gAgent.sendReliableMessage(); + + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT); +} +*/ + +void LLChatBar::onCommitGesture(LLUICtrl* ctrl) +{ + LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL; + if (gestures) + { + S32 index = gestures->getFirstSelectedIndex(); + if (index == 0) + { + return; + } + const std::string& trigger = gestures->getSelectedValue().asString(); + + // pretend the user chatted the trigger string, to invoke + // substitution and logging. + std::string text(trigger); + std::string revised_text; + LLGestureManager::instance().triggerAndReviseString(text, &revised_text); + + revised_text = utf8str_trim(revised_text); + if (!revised_text.empty()) + { + // Don't play nodding animation + sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, FALSE); + } + } + mGestureLabelTimer.start(); + if (mGestureCombo != NULL) + { + // free focus back to chat bar + mGestureCombo->setFocus(FALSE); + } +} + +class LLChatHandler : public LLCommandHandler +{ +public: + // not allowed from outside the app + LLChatHandler() : LLCommandHandler("chat", true) { } + + // Your code here + bool handle(const LLSD& tokens, const LLSD& query_map, + LLWebBrowserCtrl* web) + { + if (tokens.size() < 2) return false; + S32 channel = tokens[0].asInteger(); + std::string mesg = tokens[1].asString(); + send_chat_from_viewer(mesg, CHAT_TYPE_NORMAL, channel); + return true; + } +}; + +// Creating the object registers with the dispatcher. +//LLChatHandler gChatHandler; diff --git a/indra/newview/llchatbar.h b/indra/newview/llchatbar.h new file mode 100644 index 0000000000..a41947218d --- /dev/null +++ b/indra/newview/llchatbar.h @@ -0,0 +1,118 @@ +/** + * @file llchatbar.h + * @brief LLChatBar class definition + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLCHATBAR_H +#define LL_LLCHATBAR_H + +#include "llpanel.h" +#include "llframetimer.h" +#include "llchat.h" + +class LLLineEditor; +class LLMessageSystem; +class LLUICtrl; +class LLUUID; +class LLFrameTimer; +class LLChatBarGestureObserver; +class LLComboBox; + + +class LLChatBar +: public LLPanel +{ +public: + // constructor for inline chat-bars (e.g. hosted in chat history window) + LLChatBar(); + ~LLChatBar(); + virtual BOOL postBuild(); + + virtual BOOL handleKeyHere(KEY key, MASK mask); + + void refresh(); + void refreshGestures(); + + // Move cursor into chat input field. + void setKeyboardFocus(BOOL b); + + // Ignore arrow keys for chat bar + void setIgnoreArrowKeys(BOOL b); + + BOOL inputEditorHasFocus(); + std::string getCurrentChat(); + + // since chat bar logic is reused for chat history + // gesture combo box might not be a direct child + void setGestureCombo(LLComboBox* combo); + + // Send a chat (after stripping /20foo channel chats). + // "Animate" means the nodding animation for regular text. + void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); + void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate); + + // If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20. + // Otherwise returns input and channel 0. + LLWString stripChannelNumber(const LLWString &mesg, S32* channel); + + // callbacks + void onClickSay(LLUICtrl* ctrl); + + static void onTabClick( void* userdata ); + static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata); + static void onInputEditorFocusLost(LLFocusableElement* caller,void* userdata); + static void onInputEditorGainFocus(LLFocusableElement* caller,void* userdata); + + void onCommitGesture(LLUICtrl* ctrl); + + static void startChat(const char* line); + static void stopChat(); + +protected: + void sendChat(EChatType type); + void updateChat(); + +protected: + LLLineEditor* mInputEditor; + + LLFrameTimer mGestureLabelTimer; + + // Which non-zero channel did we last chat on? + S32 mLastSpecialChatChannel; + + BOOL mIsBuilt; + LLComboBox* mGestureCombo; + + LLChatBarGestureObserver* mObserver; +}; + +extern LLChatBar *gChatBar; + +#endif diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index f71ea9f8ad..3b88bcfe20 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -40,6 +40,7 @@ #include "llimpanel.h" // LLFloaterIMPanel #include "llimview.h" #include "llfloatergroupinfo.h" +#include "llfloaterreg.h" #include "llmenugl.h" #include "lloutputmonitorctrl.h" #include "lltextbox.h" @@ -203,7 +204,6 @@ LLIMChiclet::LLIMChiclet(const Params& p) , mSpeakerCtrl(NULL) , mShowSpeaker(p.show_speaker) , mPopupMenu(NULL) -, mDockTongueVisible(false) { LLChicletAvatarIconCtrl::Params avatar_params = p.avatar_icon; mAvatarCtrl = LLUICtrlFactory::create<LLChicletAvatarIconCtrl>(avatar_params); @@ -228,10 +228,6 @@ LLIMChiclet::~LLIMChiclet() } -void LLIMChiclet::setDockTongueVisible(bool visible) -{ - mDockTongueVisible = visible; -} void LLIMChiclet::setCounter(S32 counter) { @@ -326,14 +322,20 @@ void LLIMChiclet::setShowSpeaker(bool show) void LLIMChiclet::draw() { LLUICtrl::draw(); - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.0f,0.0f,0.0f,1.f), FALSE); - if (mDockTongueVisible) + //if we have a docked floater, we want to position it relative to us + LLIMFloater* im_floater = LLFloaterReg::findTypedInstance<LLIMFloater>("impanel", getSessionId()); + + if (im_floater && im_floater->isDocked()) { - LLUIImagePtr flyout_tongue = LLUI::getUIImage("windows/Flyout_Pointer.png"); - // was previously AVATAR_WIDTH-16 and CHICLET_HEIGHT-6 - flyout_tongue->draw( getRect().getWidth()-31, getRect().getHeight()-5); + S32 x, y; + getParent()->localPointToScreen(getRect().getCenterX(), 0, &x, &y); + im_floater->translate(x - im_floater->getRect().getCenterX(), 10 - im_floater->getRect().mBottom); + //set this so the docked floater knows it's been positioned and can now draw + im_floater->setPositioned(true); } + + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.0f,0.0f,0.0f,1.f), FALSE); } BOOL LLIMChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) @@ -890,7 +892,8 @@ LLTalkButton::Params::Params() show_button.image_unselected(LLUI::getUIImage("ComboButton_Off")); monitor.name("monitor"); - monitor.rect(LLRect(0, 10, 16, 0)); + // *TODO: Make this data driven. + monitor.rect(LLRect(0, 18, 18, 0)); } LLTalkButton::LLTalkButton(const Params& p) @@ -953,6 +956,8 @@ void LLTalkButton::draw() // Always provide speaking feedback. User can trigger speaking // with keyboard or middle-mouse shortcut. mOutputMonitor->setPower(gVoiceClient->getCurrentPower(gAgent.getID())); + mOutputMonitor->setIsTalking( gVoiceClient->getUserPTTState() ); + mSpeakBtn->setToggleState( gVoiceClient->getUserPTTState() ); LLUICtrl::draw(); } diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index c20c81e052..a748141a14 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -41,6 +41,7 @@ class LLVoiceControlPanel; class LLMenuGL; +class LLIMFloater; /* * Class for displaying amount of messages/notifications(unread). @@ -267,8 +268,6 @@ public: */ virtual void setShowSpeaker(bool show); - void setDockTongueVisible(bool visible); - /* * Returns voice chat status control visibility. */ @@ -335,7 +334,6 @@ protected: LLMenuGL* mPopupMenu; bool mShowSpeaker; - bool mDockTongueVisible; }; /* diff --git a/indra/newview/lldebugmessagebox.cpp b/indra/newview/lldebugmessagebox.cpp index 9eee3b239c..786473eb9b 100644 --- a/indra/newview/lldebugmessagebox.cpp +++ b/indra/newview/lldebugmessagebox.cpp @@ -50,7 +50,7 @@ std::map<std::string, LLDebugVarMessageBox*> LLDebugVarMessageBox::sInstances; LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarType var_type, void *var) : - LLFloater(), + LLFloater(LLSD()), mVarType(var_type), mVarData(var), mAnimate(FALSE) { setRect(LLRect(10,160,400,10)); @@ -250,11 +250,6 @@ void LLDebugVarMessageBox::onAnimateClicked(const LLSD& data) mAnimateButton->setToggleState(mAnimate); } -void LLDebugVarMessageBox::onClose(bool app_quitting) -{ - setVisible(FALSE); -} - void LLDebugVarMessageBox::draw() { std::string text; diff --git a/indra/newview/lldebugmessagebox.h b/indra/newview/lldebugmessagebox.h index 76e128cfc1..0def0ee7af 100644 --- a/indra/newview/lldebugmessagebox.h +++ b/indra/newview/lldebugmessagebox.h @@ -76,7 +76,6 @@ public: static void show(const std::string& title, LLVector3 *var, LLVector3 max_value = LLVector3(100.f, 100.f, 100.f), LLVector3 increment = LLVector3(0.1f, 0.1f, 0.1f)); //static void show(const std::string& title, LLVector4 *var, LLVector4 max_value = LLVector4(100.f, 100.f, 100.f, 100.f), LLVector4 increment = LLVector4(0.1f, 0.1f, 0.1f, 0.1f)); - virtual void onClose(bool app_quitting); virtual void draw(); protected: diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index f22114d3c8..0aef3123d6 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -80,7 +80,7 @@ static timer_tree_iterator_t end_timer_tree() } LLFastTimerView::LLFastTimerView(const LLRect& rect) -: LLFloater(), +: LLFloater(LLSD()), mHoverTimer(NULL) { setRect(rect); diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 72bfac70fc..3964fbfa74 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -374,7 +374,7 @@ void LLFavoritesBarCtrl::showDropDownMenu() { if (mPopupMenuHandle.isDead()) { - LLMenuGL::Params menu_p; + LLToggleableMenu::Params menu_p; menu_p.name("favorites menu"); menu_p.can_tear_off(false); menu_p.visible(false); diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index 979c5543e7..dec27db74b 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -37,6 +37,7 @@ #include "llbvhloader.h" #include "lldatapacker.h" #include "lldir.h" +#include "lleconomy.h" #include "llvfile.h" #include "llapr.h" #include "llstring.h" @@ -69,8 +70,6 @@ #include "lluictrlfactory.h" #include "lltrans.h" -S32 LLFloaterAnimPreview::sUploadAmount = 10; - const S32 PREVIEW_BORDER_WIDTH = 2; const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH; const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; @@ -197,7 +196,6 @@ BOOL LLFloaterAnimPreview::postBuild() childSetCommitCallback("name_form", onCommitName, this); - childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d",sUploadAmount)); childSetAction("ok_btn", onBtnOK, this); setDefaultBtn(); @@ -733,7 +731,7 @@ void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data) motionp->setName(previewp->childGetValue("name_form").asString()); } - LLFloaterNameDesc::doCommit(ctrl, data); + previewp->doCommit(); } //----------------------------------------------------------------------------- @@ -984,7 +982,7 @@ void LLFloaterAnimPreview::onBtnOK(void* userdata) std::string name = floaterp->childGetValue("name_form").asString(); std::string desc = floaterp->childGetValue("description_form").asString(); LLAssetStorage::LLStoreAssetCallback callback = NULL; - S32 expected_upload_cost = sUploadAmount; + S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); void *userdata = NULL; upload_new_resource(floaterp->mTransactionID, // tid LLAssetType::AT_ANIMATION, diff --git a/indra/newview/llfloateranimpreview.h b/indra/newview/llfloateranimpreview.h index 7031e9a716..f1c4a6b0d0 100644 --- a/indra/newview/llfloateranimpreview.h +++ b/indra/newview/llfloateranimpreview.h @@ -88,7 +88,6 @@ public: static void onBtnPlay(void*); static void onBtnStop(void*); - static void setUploadAmount(S32 amount) { sUploadAmount = amount; } static void onSliderMove(LLUICtrl*, void*); static void onCommitBaseAnim(LLUICtrl*, void*); static void onCommitLoop(LLUICtrl*, void*); @@ -129,8 +128,6 @@ protected: LLAnimPauseRequest mPauseRequest; std::map<std::string, LLUUID> mIDList; - - static S32 sUploadAmount; }; #endif // LL_LLFLOATERANIMPREVIEW_H diff --git a/indra/newview/llfloaterauction.h b/indra/newview/llfloaterauction.h index 86de0ae966..1acc08057c 100644 --- a/indra/newview/llfloaterauction.h +++ b/indra/newview/llfloaterauction.h @@ -51,7 +51,6 @@ class LLFloaterAuction : public LLFloater friend class LLFloaterReg; public: // LLFloater interface - /*virtual*/ void onClose(bool app_quitting) { setVisible(FALSE); } /*virtual*/ void onOpen(const LLSD& key); /*virtual*/ void draw(); diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 92ce44fa42..91b9bcfe72 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -36,6 +36,7 @@ // Viewer includes #include "llagent.h" #include "llfocusmgr.h" +#include "llfloaterreg.h" #include "llfloaterinventory.h" #include "llfoldervieweventlistener.h" #include "llinventorymodel.h" @@ -53,49 +54,33 @@ #include "lluictrlfactory.h" #include "message.h" -// static -LLFloaterAvatarPicker* LLFloaterAvatarPicker::sInstance = NULL; - - LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback, void* userdata, BOOL allow_multiple, BOOL closeOnSelect) { - // TODO: This class should not be a singleton as it's used in multiple places - // and therefore can't be used simultaneously. -MG - if (!sInstance) - { - sInstance = new LLFloaterAvatarPicker(); - sInstance->mCallback = callback; - sInstance->mCallbackUserdata = userdata; - sInstance->mCloseOnSelect = FALSE; - - sInstance->openFloater(); - sInstance->center(); - sInstance->setAllowMultiple(allow_multiple); - } - else - { - sInstance->openFloater(); - sInstance->mCallback = callback; - sInstance->mCallbackUserdata = userdata; - sInstance->setAllowMultiple(allow_multiple); - } + // *TODO: Use a key to allow this not to be an effective singleton + LLFloaterAvatarPicker* floater = LLFloaterReg::showTypedInstance<LLFloaterAvatarPicker>("avatar_picker"); + + floater->mCallback = callback; + floater->mCallbackUserdata = userdata; + floater->setAllowMultiple(allow_multiple); + floater->mNearMeListComplete = FALSE; + floater->mCloseOnSelect = closeOnSelect; - sInstance->mNearMeListComplete = FALSE; - sInstance->mCloseOnSelect = closeOnSelect; - return sInstance; + return floater; } // Default constructor -LLFloaterAvatarPicker::LLFloaterAvatarPicker() - : LLFloater(), +LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key) + : LLFloater(key), mResultsReturned(FALSE), mCallback(NULL), - mCallbackUserdata(NULL) + mCallbackUserdata(NULL), + mNearMeListComplete(FALSE), + mCloseOnSelect(FALSE) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_picker.xml"); +// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_picker.xml"); } BOOL LLFloaterAvatarPicker::postBuild() @@ -143,7 +128,9 @@ BOOL LLFloaterAvatarPicker::postBuild() boost::bind(&LLFloaterAvatarPicker::onTabChanged, this)); setAllowMultiple(FALSE); - + + center(); + return TRUE; } @@ -156,8 +143,6 @@ void LLFloaterAvatarPicker::onTabChanged() LLFloaterAvatarPicker::~LLFloaterAvatarPicker() { gFocusMgr.releaseFocusIfNeeded( this ); - - sInstance = NULL; } void LLFloaterAvatarPicker::onBtnFind(void* userdata) @@ -408,23 +393,21 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* // Not for us if (agent_id != gAgent.getID()) return; - - // Dialog already closed - LLFloaterAvatarPicker *self = sInstance; - if (!self) return; + + LLFloaterAvatarPicker* floater = LLFloaterReg::findTypedInstance<LLFloaterAvatarPicker>("avatar_picker"); // these are not results from our last request - if (query_id != self->mQueryID) + if (query_id != floater->mQueryID) { return; } - LLScrollListCtrl* search_results = self->getChild<LLScrollListCtrl>("SearchResults"); + LLScrollListCtrl* search_results = floater->getChild<LLScrollListCtrl>("SearchResults"); // clear "Searching" label on first results search_results->deleteAllItems(); - self->mResultsReturned = TRUE; + floater->mResultsReturned = TRUE; BOOL found_one = FALSE; S32 num_new_rows = msg->getNumberOfBlocks("Data"); @@ -438,10 +421,10 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* if (avatar_id.isNull()) { LLStringUtil::format_map_t map; - map["[TEXT]"] = self->childGetText("Edit"); - avatar_name = self->getString("not_found", map); + map["[TEXT]"] = floater->childGetText("Edit"); + avatar_name = floater->getString("not_found", map); search_results->setEnabled(FALSE); - self->childDisable("Select"); + floater->childDisable("Select"); } else { @@ -457,9 +440,9 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* if (found_one) { - self->childEnable("Select"); + floater->childEnable("Select"); search_results->selectFirstItem(); - self->onList(search_results, self); + floater->onList(search_results, floater); search_results->setFocus(TRUE); } } diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index 0f28d8250b..63896bef9f 100644 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -48,6 +48,10 @@ public: void* userdata, BOOL allow_multiple = FALSE, BOOL closeOnSelect = FALSE); + + LLFloaterAvatarPicker(const LLSD& key); + virtual ~LLFloaterAvatarPicker(); + virtual BOOL postBuild(); static void processAvatarPickerReply(class LLMessageSystem* msg, void**); @@ -84,13 +88,6 @@ private: void (*mCallback)(const std::vector<std::string>& name, const std::vector<LLUUID>& id, void* userdata); void* mCallbackUserdata; - - static LLFloaterAvatarPicker* sInstance; - -private: - // do not call these directly - LLFloaterAvatarPicker(); - virtual ~LLFloaterAvatarPicker(); }; #endif diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index e2f13088eb..3976e25ba4 100644 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -42,29 +42,15 @@ using namespace LLVOAvatarDefines; -LLFloaterAvatarTextures* LLFloaterAvatarTextures::sInstance = NULL; -LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLUUID& id) - : LLFloater(), - mID(id) +LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLSD& id) + : LLFloater(id), + mID(id.asUUID()) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_textures.xml"); +// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_avatar_textures.xml"); } LLFloaterAvatarTextures::~LLFloaterAvatarTextures() { - sInstance = NULL; -} - -LLFloaterAvatarTextures* LLFloaterAvatarTextures::show(const LLUUID &id) -{ - if (!sInstance) - { - sInstance = new LLFloaterAvatarTextures(id); - gFloaterView->addChild(sInstance); - gFloaterView->adjustToFitScreen(sInstance, FALSE); - } - sInstance->openFloater(); - return sInstance; } BOOL LLFloaterAvatarTextures::postBuild() diff --git a/indra/newview/llfloateravatartextures.h b/indra/newview/llfloateravatartextures.h index 3ec0e7cb03..e27484d26f 100644 --- a/indra/newview/llfloateravatartextures.h +++ b/indra/newview/llfloateravatartextures.h @@ -43,7 +43,7 @@ class LLTextureCtrl; class LLFloaterAvatarTextures : public LLFloater { public: - LLFloaterAvatarTextures(const LLUUID& id); + LLFloaterAvatarTextures(const LLSD& id); virtual ~LLFloaterAvatarTextures(); /*virtual*/ BOOL postBuild(); @@ -51,8 +51,6 @@ public: void refresh(); - static LLFloaterAvatarTextures* show(const LLUUID& id); - private: static void onClickDump(void*); @@ -60,7 +58,6 @@ private: LLUUID mID; std::string mTitle; LLTextureCtrl* mTextures[LLVOAvatarDefines::TEX_NUM_INDICES]; - static LLFloaterAvatarTextures* sInstance; }; #endif diff --git a/indra/newview/llfloaterbeacons.cpp b/indra/newview/llfloaterbeacons.cpp index 1c7ef77718..13a7888f60 100644 --- a/indra/newview/llfloaterbeacons.cpp +++ b/indra/newview/llfloaterbeacons.cpp @@ -64,21 +64,6 @@ BOOL LLFloaterBeacons::postBuild() return TRUE; } -// Needed to make the floater visibility toggle the beacons. -// Too bad we can't just add control_name="BeaconAlwaysOn" to the XML. -void LLFloaterBeacons::onOpen(const LLSD& key) -{ - gSavedSettings.setBOOL( "BeaconAlwaysOn", TRUE); -} -void LLFloaterBeacons::onClose(bool app_quitting) -{ - destroy(); - if(!app_quitting) - { - gSavedSettings.setBOOL( "BeaconAlwaysOn", FALSE); - } -} - // Callback attached to each check box control to both affect their main purpose // and to implement the couple screwy interdependency rules that some have. diff --git a/indra/newview/llfloaterbeacons.h b/indra/newview/llfloaterbeacons.h index 94f853978a..c175cb3ef4 100644 --- a/indra/newview/llfloaterbeacons.h +++ b/indra/newview/llfloaterbeacons.h @@ -46,8 +46,6 @@ public: // Needed to make the floater visibility toggle the beacons. // Too bad we can't just add control_name="BeaconAlwaysOn" to the XML. - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); void onClickUICheck(LLUICtrl *ctrl); private: diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp index 29b91cab95..a73ebf4e06 100644 --- a/indra/newview/llfloaterbulkpermission.cpp +++ b/indra/newview/llfloaterbulkpermission.cpp @@ -165,7 +165,7 @@ void LLFloaterBulkPermission::onApplyBtn() void LLFloaterBulkPermission::onCloseBtn() { - onClose(false); + closeFloater(); } //static diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp index 6cae4b8abc..a7aaf71ef6 100644 --- a/indra/newview/llfloaterbuy.cpp +++ b/indra/newview/llfloaterbuy.cpp @@ -43,6 +43,7 @@ #include "llagent.h" // for agent id #include "llalertdialog.h" #include "llinventorymodel.h" // for gInventory +#include "llfloaterreg.h" #include "llfloaterinventory.h" // for get_item_icon #include "llselectmgr.h" #include "llscrolllistctrl.h" @@ -51,13 +52,10 @@ #include "llviewerwindow.h" #include "lltrans.h" -LLFloaterBuy* LLFloaterBuy::sInstance = NULL; - -LLFloaterBuy::LLFloaterBuy() -: LLFloater() +LLFloaterBuy::LLFloaterBuy(const LLSD& key) +: LLFloater(key) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_object.xml"); - +// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_object.xml"); } BOOL LLFloaterBuy::postBuild() @@ -65,16 +63,23 @@ BOOL LLFloaterBuy::postBuild() childDisable("object_list"); childDisable("item_list"); - childSetAction("cancel_btn", onClickCancel, this); - childSetAction("buy_btn", onClickBuy, this); + getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuy::onClickCancel, this)); + getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuy::onClickBuy, this)); setDefaultBtn("cancel_btn"); // to avoid accidental buy (SL-43130) + + // Always center the dialog. User can change the size, + // but purchases are important and should be center screen. + // This also avoids problems where the user resizes the application window + // mid-session and the saved rect is off-center. + center(); + return TRUE; } LLFloaterBuy::~LLFloaterBuy() { - sInstance = NULL; + mObjectSelection = NULL; } void LLFloaterBuy::reset() @@ -96,47 +101,34 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) LLNotifications::instance().add("BuyOneObjectOnly"); return; } - - // Create a new instance only if one doesn't exist - if (sInstance) - { - // Clean up the lists... - sInstance->reset(); - } - else - { - sInstance = new LLFloaterBuy(); - } - sInstance->openFloater(); - sInstance->setFocus(TRUE); - sInstance->mSaleInfo = sale_info; - sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); - - // Always center the dialog. User can change the size, - // but purchases are important and should be center screen. - // This also avoids problems where the user resizes the application window - // mid-session and the saved rect is off-center. - sInstance->center(); - + LLFloaterBuy* floater = LLFloaterReg::showTypedInstance<LLFloaterBuy>("buy_object"); + if (!floater) + return; + + // Clean up the lists... + floater->reset(); + floater->mSaleInfo = sale_info; + floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); + LLSelectNode* node = selection->getFirstRootNode(); if (!node) return; - + // Set title based on sale type LLUIString title; switch (sale_info.getSaleType()) { case LLSaleInfo::FS_ORIGINAL: - title = sInstance->getString("title_buy_text"); + title = floater->getString("title_buy_text"); break; case LLSaleInfo::FS_COPY: default: - title = sInstance->getString("title_buy_copy_text"); + title = floater->getString("title_buy_copy_text"); break; } title.setArg("[NAME]", node->mName); - sInstance->setTitle(title); + floater->setTitle(title); LLUUID owner_id; std::string owner_name; @@ -147,7 +139,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) return; } - LLCtrlListInterface *object_list = sInstance->childGetListInterface("object_list"); + LLCtrlListInterface *object_list = floater->childGetListInterface("object_list"); if (!object_list) { return; @@ -172,15 +164,15 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) std::string text = node->mName; if (!(next_owner_mask & PERM_COPY)) { - text.append(sInstance->getString("no_copy_text")); + text.append(floater->getString("no_copy_text")); } if (!(next_owner_mask & PERM_MODIFY)) { - text.append(sInstance->getString("no_modify_text")); + text.append(floater->getString("no_modify_text")); } if (!(next_owner_mask & PERM_TRANSFER)) { - text.append(sInstance->getString("no_transfer_text")); + text.append(floater->getString("no_transfer_text")); } row["columns"][1]["column"] = "text"; @@ -190,15 +182,15 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info) // Add after columns added so appropriate heights are correct. object_list->addElement(row); - sInstance->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice())); - sInstance->childSetTextArg("buy_text", "[NAME]", owner_name); + floater->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice())); + floater->childSetTextArg("buy_text", "[NAME]", owner_name); // Must do this after the floater is created, because // sometimes the inventory is already there and // the callback is called immediately. LLViewerObject* obj = selection->getFirstRootObject(); - sInstance->registerVOInventoryListener(obj,NULL); - sInstance->requestVOInventory(); + floater->registerVOInventoryListener(obj,NULL); + floater->requestVOInventory(); } void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, @@ -296,15 +288,8 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, removeVOInventoryListener(); } -// static -void LLFloaterBuy::onClickBuy(void*) +void LLFloaterBuy::onClickBuy() { - if (!sInstance) - { - llinfos << "LLFloaterBuy::onClickBuy no sInstance!" << llendl; - return; - } - // Put the items where we put new folders. LLUUID category_id; category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT); @@ -312,24 +297,13 @@ void LLFloaterBuy::onClickBuy(void*) // *NOTE: doesn't work for multiple object buy, which UI does not // currently support sale info is used for verification only, if // it doesn't match region info then sale is canceled. - LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, sInstance->mSaleInfo ); + LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, mSaleInfo ); - sInstance->closeFloater(); + closeFloater(); } -// static -void LLFloaterBuy::onClickCancel(void*) +void LLFloaterBuy::onClickCancel() { - if (sInstance) - { - sInstance->closeFloater(); - } -} - -void LLFloaterBuy::onClose(bool app_quitting) -{ - // drop reference to current selection so selection goes away - mObjectSelection = NULL; - destroy(); + closeFloater(); } diff --git a/indra/newview/llfloaterbuy.h b/indra/newview/llfloaterbuy.h index ffd3fa30c8..ee54303267 100644 --- a/indra/newview/llfloaterbuy.h +++ b/indra/newview/llfloaterbuy.h @@ -52,13 +52,14 @@ class LLFloaterBuy : public LLFloater, public LLVOInventoryListener { public: + LLFloaterBuy(const LLSD& key); + ~LLFloaterBuy(); + + /*virtual*/ BOOL postBuild(); + static void show(const LLSaleInfo& sale_info); protected: - LLFloaterBuy(); - ~LLFloaterBuy(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onClose(bool app_quitting); void reset(); void requestObjectInventories(); @@ -67,12 +68,10 @@ protected: S32 serial_num, void* data); - static void onClickBuy(void*); - static void onClickCancel(void*); + void onClickBuy(); + void onClickCancel(); private: - static LLFloaterBuy* sInstance; - LLSafeHandle<LLObjectSelection> mObjectSelection; LLSaleInfo mSaleInfo; }; diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index db4547e5bc..3a4171c6be 100644 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -46,6 +46,7 @@ #include "llalertdialog.h" #include "llcheckboxctrl.h" #include "llinventorymodel.h" // for gInventory +#include "llfloaterreg.h" #include "llfloaterinventory.h" // for get_item_icon #include "llselectmgr.h" #include "llscrolllistctrl.h" @@ -54,31 +55,35 @@ #include "lluictrlfactory.h" #include "llviewerwindow.h" -LLFloaterBuyContents* LLFloaterBuyContents::sInstance = NULL; - -LLFloaterBuyContents::LLFloaterBuyContents() -: LLFloater() +LLFloaterBuyContents::LLFloaterBuyContents(const LLSD& key) +: LLFloater(key) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_contents.xml"); - +// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_buy_contents.xml"); } + BOOL LLFloaterBuyContents::postBuild() { - childSetAction("cancel_btn", onClickCancel, this); - childSetAction("buy_btn", onClickBuy, this); + getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyContents::onClickCancel, this)); + getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyContents::onClickBuy, this)); childDisable("item_list"); childDisable("buy_btn"); childDisable("wear_check"); setDefaultBtn("cancel_btn"); // to avoid accidental buy (SL-43130) + + // Always center the dialog. User can change the size, + // but purchases are important and should be center screen. + // This also avoids problems where the user resizes the application window + // mid-session and the saved rect is off-center. + center(); + return TRUE; } LLFloaterBuyContents::~LLFloaterBuyContents() { - sInstance = NULL; } @@ -92,27 +97,16 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) LLNotifications::instance().add("BuyContentsOneOnly"); return; } + + LLFloaterBuyContents* floater = LLFloaterReg::showTypedInstance<LLFloaterBuyContents>("buy_object_contents"); + if (!floater) + return; + + LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("item_list"); + if (list) + list->deleteAllItems(); - // Create a new instance only if needed - if (sInstance) - { - LLScrollListCtrl* list = sInstance->getChild<LLScrollListCtrl>("item_list"); - if (list) list->deleteAllItems(); - } - else - { - sInstance = new LLFloaterBuyContents(); - } - - sInstance->openFloater(); - sInstance->setFocus(TRUE); - sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); - - // Always center the dialog. User can change the size, - // but purchases are important and should be center screen. - // This also avoids problems where the user resizes the application window - // mid-session and the saved rect is off-center. - sInstance->center(); + floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); LLUUID owner_id; std::string owner_name; @@ -123,7 +117,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) return; } - sInstance->mSaleInfo = sale_info; + floater->mSaleInfo = sale_info; // Update the display LLSelectNode* node = selection->getFirstRootNode(); @@ -133,16 +127,16 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info) gCacheName->getGroupName(owner_id, owner_name); } - sInstance->childSetTextArg("contains_text", "[NAME]", node->mName); - sInstance->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice())); - sInstance->childSetTextArg("buy_text", "[NAME]", owner_name); + floater->childSetTextArg("contains_text", "[NAME]", node->mName); + floater->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice())); + floater->childSetTextArg("buy_text", "[NAME]", owner_name); // Must do this after the floater is created, because // sometimes the inventory is already there and // the callback is called immediately. LLViewerObject* obj = selection->getFirstRootObject(); - sInstance->registerVOInventoryListener(obj,NULL); - sInstance->requestVOInventory(); + floater->registerVOInventoryListener(obj,NULL); + floater->requestVOInventory(); } @@ -272,20 +266,19 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, } -// static -void LLFloaterBuyContents::onClickBuy(void*) +void LLFloaterBuyContents::onClickBuy() { // Make sure this wasn't selected through other mechanisms // (ie, being the default button and pressing enter. - if(!sInstance->childIsEnabled("buy_btn")) + if(!childIsEnabled("buy_btn")) { // We shouldn't be enabled. Just close. - sInstance->closeFloater(); + closeFloater(); return; } // We may want to wear this item - if (sInstance->childGetValue("wear_check")) + if (childGetValue("wear_check")) { LLFloaterInventory::sWearNewClothing = TRUE; } @@ -297,14 +290,12 @@ void LLFloaterBuyContents::onClickBuy(void*) // *NOTE: doesn't work for multiple object buy, which UI does not // currently support sale info is used for verification only, if // it doesn't match region info then sale is canceled. - LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, sInstance->mSaleInfo); + LLSelectMgr::getInstance()->sendBuy(gAgent.getID(), category_id, mSaleInfo); - sInstance->closeFloater(); + closeFloater(); } - -// static -void LLFloaterBuyContents::onClickCancel(void*) +void LLFloaterBuyContents::onClickCancel() { - sInstance->closeFloater(); + closeFloater(); } diff --git a/indra/newview/llfloaterbuycontents.h b/indra/newview/llfloaterbuycontents.h index 52114811bf..8045a46c9f 100644 --- a/indra/newview/llfloaterbuycontents.h +++ b/indra/newview/llfloaterbuycontents.h @@ -52,22 +52,21 @@ class LLFloaterBuyContents public: static void show(const LLSaleInfo& sale_info); -protected: - LLFloaterBuyContents(); + LLFloaterBuyContents(const LLSD& key); ~LLFloaterBuyContents(); /*virtual*/ BOOL postBuild(); + +protected: void requestObjectInventories(); /*virtual*/ void inventoryChanged(LLViewerObject* obj, InventoryObjectList* inv, S32 serial_num, void* data); - - static void onClickBuy(void*); - static void onClickCancel(void*); + + void onClickBuy(); + void onClickCancel(); protected: - static LLFloaterBuyContents* sInstance; - LLSafeHandle<LLObjectSelection> mObjectSelection; LLSaleInfo mSaleInfo; }; diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp index 4274650f2c..0107cb6fe2 100644 --- a/indra/newview/llfloaterbuycurrency.cpp +++ b/indra/newview/llfloaterbuycurrency.cpp @@ -37,6 +37,7 @@ // viewer includes #include "llcurrencyuimanager.h" #include "llfloater.h" +#include "llfloaterreg.h" #include "llstatusbar.h" #include "lltextbox.h" #include "llviewchildren.h" @@ -53,12 +54,7 @@ class LLFloaterBuyCurrencyUI : public LLFloater { public: - static LLFloaterBuyCurrencyUI* soleInstance(bool createIfNeeded); - -private: - static LLFloaterBuyCurrencyUI* sInstance; - - LLFloaterBuyCurrencyUI(); + LLFloaterBuyCurrencyUI(const LLSD& key); virtual ~LLFloaterBuyCurrencyUI(); @@ -81,30 +77,17 @@ public: virtual void draw(); virtual BOOL canClose(); - static void onClickBuy(void* data); - static void onClickCancel(void* data); - static void onClickErrorWeb(void* data); + void onClickBuy(); + void onClickCancel(); + void onClickErrorWeb(); }; - -// static -LLFloaterBuyCurrencyUI* LLFloaterBuyCurrencyUI::sInstance = NULL; - -// static -LLFloaterBuyCurrencyUI* LLFloaterBuyCurrencyUI::soleInstance(bool createIfNeeded) +LLFloater* LLFloaterBuyCurrency::buildFloater(const LLSD& key) { - if (!sInstance && createIfNeeded) - { - sInstance = new LLFloaterBuyCurrencyUI(); - - LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_buy_currency.xml"); - sInstance->center(); - } - - return sInstance; + LLFloaterBuyCurrencyUI* floater = new LLFloaterBuyCurrencyUI(key); + return floater; } - #if LL_WINDOWS // passing 'this' during construction generates a warning. The callee // only uses the pointer to hold a reference to 'this' which is @@ -112,8 +95,8 @@ LLFloaterBuyCurrencyUI* LLFloaterBuyCurrencyUI::soleInstance(bool createIfNeeded // warning so that we can compile without generating a warning. #pragma warning(disable : 4355) #endif -LLFloaterBuyCurrencyUI::LLFloaterBuyCurrencyUI() -: LLFloater(), +LLFloaterBuyCurrencyUI::LLFloaterBuyCurrencyUI(const LLSD& key) +: LLFloater(key), mChildren(*this), mManager(*this) { @@ -121,10 +104,6 @@ LLFloaterBuyCurrencyUI::LLFloaterBuyCurrencyUI() LLFloaterBuyCurrencyUI::~LLFloaterBuyCurrencyUI() { - if (sInstance == this) - { - sInstance = NULL; - } } @@ -156,11 +135,14 @@ BOOL LLFloaterBuyCurrencyUI::postBuild() { mManager.prepare(); - childSetAction("buy_btn", onClickBuy, this); - childSetAction("cancel_btn", onClickCancel, this); - childSetAction("error_web", onClickErrorWeb, this); - + getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickBuy, this)); + getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickCancel, this)); + getChild<LLUICtrl>("error_web")->setCommitCallback( boost::bind(&LLFloaterBuyCurrencyUI::onClickErrorWeb, this)); + + center(); + updateUI(); + return TRUE; } @@ -312,57 +294,41 @@ void LLFloaterBuyCurrencyUI::updateUI() } } -// static -void LLFloaterBuyCurrencyUI::onClickBuy(void* data) +void LLFloaterBuyCurrencyUI::onClickBuy() { - LLFloaterBuyCurrencyUI* self = LLFloaterBuyCurrencyUI::soleInstance(false); - if (self) - { - self->mManager.buy(self->getString("buy_currency")); - self->updateUI(); - // JC: updateUI() doesn't get called again until progress is made - // with transaction processing, so the "Purchase" button would be - // left enabled for some time. Pre-emptively disable. - self->childSetEnabled("buy_btn", false); - } + mManager.buy(getString("buy_currency")); + updateUI(); + // JC: updateUI() doesn't get called again until progress is made + // with transaction processing, so the "Purchase" button would be + // left enabled for some time. Pre-emptively disable. + childSetEnabled("buy_btn", false); } -// static -void LLFloaterBuyCurrencyUI::onClickCancel(void* data) +void LLFloaterBuyCurrencyUI::onClickCancel() { - LLFloaterBuyCurrencyUI* self = LLFloaterBuyCurrencyUI::soleInstance(false); - if (self) - { - self->closeFloater(); - } + closeFloater(); } -// static -void LLFloaterBuyCurrencyUI::onClickErrorWeb(void* data) +void LLFloaterBuyCurrencyUI::onClickErrorWeb() { - LLFloaterBuyCurrencyUI* self = LLFloaterBuyCurrencyUI::soleInstance(false); - if (self) - { - LLWeb::loadURLExternal(self->mManager.errorURI()); - self->closeFloater(); - } + LLWeb::loadURLExternal(mManager.errorURI()); + closeFloater(); } // static void LLFloaterBuyCurrency::buyCurrency() { - LLFloaterBuyCurrencyUI* ui = LLFloaterBuyCurrencyUI::soleInstance(true); + LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyCurrencyUI>("buy_currency"); ui->noTarget(); ui->updateUI(); - ui->openFloater(); } +// static void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price) { - LLFloaterBuyCurrencyUI* ui = LLFloaterBuyCurrencyUI::soleInstance(true); + LLFloaterBuyCurrencyUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyCurrencyUI>("buy_currency"); ui->target(name, price); ui->updateUI(); - ui->openFloater(); } diff --git a/indra/newview/llfloaterbuycurrency.h b/indra/newview/llfloaterbuycurrency.h index 756acd2f0c..9b3f9b43d0 100644 --- a/indra/newview/llfloaterbuycurrency.h +++ b/indra/newview/llfloaterbuycurrency.h @@ -35,6 +35,8 @@ #include "stdtypes.h" +class LLFloater; + class LLFloaterBuyCurrency { public: @@ -46,6 +48,8 @@ public: "Uploading costs" a space and the price will be appended */ + + static LLFloater* buildFloater(const LLSD& key); }; diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 3fbee83c7b..3d1b7965a1 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -43,6 +43,7 @@ #include "llconfirmationmanager.h" #include "llcurrencyuimanager.h" #include "llfloater.h" +#include "llfloaterreg.h" #include "llfloatertools.h" #include "llframetimer.h" #include "lliconctrl.h" @@ -75,10 +76,22 @@ const F64 CURRENCY_ESTIMATE_FREQUENCY = 0.5; class LLFloaterBuyLandUI : public LLFloater { -private: - LLFloaterBuyLandUI(); +public: + LLFloaterBuyLandUI(const LLSD& key); virtual ~LLFloaterBuyLandUI(); - + +private: + class SelectionObserver : public LLParcelObserver + { + public: + SelectionObserver(LLFloaterBuyLandUI* floater) : mFloater(floater) {} + virtual void changed(); + private: + LLFloaterBuyLandUI* mFloater; + }; + +private: + SelectionObserver mParcelSelectionObserver; LLViewerRegion* mRegion; LLParcelSelectionHandle mParcel; bool mIsClaim; @@ -144,11 +157,7 @@ private: LLViewerParcelMgr::ParcelBuyInfo* mParcelBuyInfo; - static LLFloaterBuyLandUI* sInstance; - public: - static LLFloaterBuyLandUI* soleInstance(bool createIfNeeded); - void setForGroup(bool is_for_group); void setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel); @@ -156,10 +165,10 @@ public: void updateParcelInfo(); void updateCovenantInfo(); static void onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data); - void updateCovenantText(const std::string& string, const LLUUID &asset_id); - void updateEstateName(const std::string& name); - void updateLastModified(const std::string& text); - void updateEstateOwnerName(const std::string& name); + void updateFloaterCovenantText(const std::string& string, const LLUUID &asset_id); + void updateFloaterEstateName(const std::string& name); + void updateFloaterLastModified(const std::string& text); + void updateFloaterEstateOwnerName(const std::string& name); void updateWebSiteInfo(); void finishWebSiteInfo(); @@ -171,7 +180,7 @@ public: void refreshUI(); - void startTransaction(TransactionType type, LLXMLRPCValue params); + void startTransaction(TransactionType type, const LLXMLRPCValue& params); bool checkTransaction(); void tellUserError(const std::string& message, const std::string& uri); @@ -181,26 +190,21 @@ public: void startBuyPreConfirm(); void startBuyPostConfirm(const std::string& password); - static void onClickBuy(void* data); - static void onClickCancel(void* data); - static void onClickErrorWeb(void* data); + void onClickBuy(); + void onClickCancel(); + void onClickErrorWeb(); virtual void draw(); virtual BOOL canClose(); - /*virtual*/ void setMinimized(BOOL b); + + void onVisibilityChange ( const LLSD& new_visibility ); -private: - class SelectionObserver : public LLParcelObserver - { - public: - virtual void changed(); - }; }; static void cacheNameUpdateRefreshesBuyLand(const LLUUID&, const std::string&, const std::string&, BOOL) { - LLFloaterBuyLandUI* ui = LLFloaterBuyLandUI::soleInstance(false); + LLFloaterBuyLandUI* ui = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land"); if (ui) { ui->updateNames(); @@ -217,101 +221,64 @@ void LLFloaterBuyLand::buyLand( return; } - LLFloaterBuyLandUI* ui = LLFloaterBuyLandUI::soleInstance(true); - ui->setForGroup(is_for_group); - ui->setParcel(region, parcel); - ui->openFloater(); + LLFloaterBuyLandUI* ui = LLFloaterReg::showTypedInstance<LLFloaterBuyLandUI>("buy_land"); + if (ui) + { + ui->setForGroup(is_for_group); + ui->setParcel(region, parcel); + } } // static void LLFloaterBuyLand::updateCovenantText(const std::string& string, const LLUUID &asset_id) { - LLFloaterBuyLandUI* floater = LLFloaterBuyLandUI::soleInstance(FALSE); + LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land"); if (floater) { - floater->updateCovenantText(string, asset_id); + floater->updateFloaterCovenantText(string, asset_id); } } // static void LLFloaterBuyLand::updateEstateName(const std::string& name) { - LLFloaterBuyLandUI* floater = LLFloaterBuyLandUI::soleInstance(FALSE); + LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land"); if (floater) { - floater->updateEstateName(name); + floater->updateFloaterEstateName(name); } } // static void LLFloaterBuyLand::updateLastModified(const std::string& text) { - LLFloaterBuyLandUI* floater = LLFloaterBuyLandUI::soleInstance(FALSE); + LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land"); if (floater) { - floater->updateLastModified(text); + floater->updateFloaterLastModified(text); } } // static void LLFloaterBuyLand::updateEstateOwnerName(const std::string& name) { - LLFloaterBuyLandUI* floater = LLFloaterBuyLandUI::soleInstance(FALSE); + LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land"); if (floater) { - floater->updateEstateOwnerName(name); + floater->updateFloaterEstateOwnerName(name); } } // static -BOOL LLFloaterBuyLand::isOpen() +LLFloater* LLFloaterBuyLand::buildFloater(const LLSD& key) { - LLFloaterBuyLandUI* floater = LLFloaterBuyLandUI::soleInstance(FALSE); - if (floater) - { - return floater->getVisible(); - } - return FALSE; -} - -// static -LLFloaterBuyLandUI* LLFloaterBuyLandUI::sInstance = NULL; - -// static -LLFloaterBuyLandUI* LLFloaterBuyLandUI::soleInstance(bool createIfNeeded) -{ -#if !LL_RELEASE_FOR_DOWNLOAD - if (createIfNeeded) - { - delete sInstance; - sInstance = NULL; - } -#endif - if (!sInstance && createIfNeeded) - { - sInstance = new LLFloaterBuyLandUI(); - - LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_buy_land.xml"); - sInstance->center(); - - static bool observingCacheName = false; - if (!observingCacheName) - { - gCacheName->addObserver(&cacheNameUpdateRefreshesBuyLand); - observingCacheName = true; - } - - static SelectionObserver* parcelSelectionObserver = NULL; - if (!parcelSelectionObserver) - { - parcelSelectionObserver = new SelectionObserver; - LLViewerParcelMgr::getInstance()->addObserver(parcelSelectionObserver); - } - } - - return sInstance; + LLFloaterBuyLandUI* floater = new LLFloaterBuyLandUI(key); + return floater; } +//---------------------------------------------------------------------------- +// LLFloaterBuyLandUI +//---------------------------------------------------------------------------- #if LL_WINDOWS // passing 'this' during construction generates a warning. The callee @@ -320,42 +287,45 @@ LLFloaterBuyLandUI* LLFloaterBuyLandUI::soleInstance(bool createIfNeeded) // warning so that we can compile without generating a warning. #pragma warning(disable : 4355) #endif -LLFloaterBuyLandUI::LLFloaterBuyLandUI() -: LLFloater(), +LLFloaterBuyLandUI::LLFloaterBuyLandUI(const LLSD& key) +: LLFloater(LLSD()), + mParcelSelectionObserver(this), mParcel(0), mBought(false), mParcelValid(false), mSiteValid(false), mChildren(*this), mCurrency(*this), mTransaction(0), mParcelBuyInfo(0) { + static bool observingCacheName = false; + if (!observingCacheName) + { + gCacheName->addObserver(&cacheNameUpdateRefreshesBuyLand); + observingCacheName = true; + } + + LLViewerParcelMgr::getInstance()->addObserver(&mParcelSelectionObserver); + +// LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_buy_land.xml"); } LLFloaterBuyLandUI::~LLFloaterBuyLandUI() { - delete mTransaction; - + LLViewerParcelMgr::getInstance()->removeObserver(&mParcelSelectionObserver); LLViewerParcelMgr::getInstance()->deleteParcelBuy(mParcelBuyInfo); - if (sInstance == this) - { - sInstance = NULL; - } + delete mTransaction; } void LLFloaterBuyLandUI::SelectionObserver::changed() { - LLFloaterBuyLandUI* ui = LLFloaterBuyLandUI::soleInstance(false); - if (ui) + if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { - if (LLViewerParcelMgr::getInstance()->selectionEmpty()) - { - ui->closeFloater(); - } - else { - ui->setParcel( - LLViewerParcelMgr::getInstance()->getSelectionRegion(), - LLViewerParcelMgr::getInstance()->getParcelSelection()); - } + mFloater->closeFloater(); + } + else + { + mFloater->setParcel(LLViewerParcelMgr::getInstance()->getSelectionRegion(), + LLViewerParcelMgr::getInstance()->getParcelSelection()); } } @@ -593,7 +563,7 @@ void LLFloaterBuyLandUI::onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data) } } -void LLFloaterBuyLandUI::updateCovenantText(const std::string &string, const LLUUID& asset_id) +void LLFloaterBuyLandUI::updateFloaterCovenantText(const std::string &string, const LLUUID& asset_id) { LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("covenant_editor"); if (editor) @@ -625,19 +595,19 @@ void LLFloaterBuyLandUI::updateCovenantText(const std::string &string, const LLU } } -void LLFloaterBuyLandUI::updateEstateName(const std::string& name) +void LLFloaterBuyLandUI::updateFloaterEstateName(const std::string& name) { LLTextBox* box = getChild<LLTextBox>("estate_name_text"); if (box) box->setText(name); } -void LLFloaterBuyLandUI::updateLastModified(const std::string& text) +void LLFloaterBuyLandUI::updateFloaterLastModified(const std::string& text) { LLTextBox* editor = getChild<LLTextBox>("covenant_timestamp_text"); if (editor) editor->setText(text); } -void LLFloaterBuyLandUI::updateEstateOwnerName(const std::string& name) +void LLFloaterBuyLandUI::updateFloaterEstateOwnerName(const std::string& name) { LLTextBox* box = getChild<LLTextBox>("estate_owner_text"); if (box) box->setText(name); @@ -834,8 +804,7 @@ void LLFloaterBuyLandUI::updateNames() } -void LLFloaterBuyLandUI::startTransaction(TransactionType type, - LLXMLRPCValue params) +void LLFloaterBuyLandUI::startTransaction(TransactionType type, const LLXMLRPCValue& params) { delete mTransaction; mTransaction = NULL; @@ -916,11 +885,15 @@ void LLFloaterBuyLandUI::tellUserError( // virtual BOOL LLFloaterBuyLandUI::postBuild() { + mVisibleSignal.connect(boost::bind(&LLFloaterBuyLandUI::onVisibilityChange, this, _2)); + mCurrency.prepare(); - childSetAction("buy_btn", onClickBuy, this); - childSetAction("cancel_btn", onClickCancel, this); - childSetAction("error_web", onClickErrorWeb, this); + getChild<LLUICtrl>("buy_btn")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickBuy, this)); + getChild<LLUICtrl>("cancel_btn")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickCancel, this)); + getChild<LLUICtrl>("error_web")->setCommitCallback( boost::bind(&LLFloaterBuyLandUI::onClickErrorWeb, this)); + + center(); return TRUE; } @@ -986,12 +959,9 @@ BOOL LLFloaterBuyLandUI::canClose() return can_close; } -// virtual -void LLFloaterBuyLandUI::setMinimized(BOOL minimize) +void LLFloaterBuyLandUI::onVisibilityChange ( const LLSD& new_visibility ) { - bool restored = (isMinimized() && !minimize); - LLFloater::setMinimized(minimize); - if (restored) + if (new_visibility.asBoolean()) { refreshUI(); } @@ -1346,26 +1316,20 @@ void LLFloaterBuyLandUI::startBuyPostConfirm(const std::string& password) } -// static -void LLFloaterBuyLandUI::onClickBuy(void* data) +void LLFloaterBuyLandUI::onClickBuy() { - LLFloaterBuyLandUI* self = (LLFloaterBuyLandUI*)data; - self->startBuyPreConfirm(); + startBuyPreConfirm(); } -// static -void LLFloaterBuyLandUI::onClickCancel(void* data) +void LLFloaterBuyLandUI::onClickCancel() { - LLFloaterBuyLandUI* self = (LLFloaterBuyLandUI*)data; - self->closeFloater(); + closeFloater(); } -// static -void LLFloaterBuyLandUI::onClickErrorWeb(void* data) +void LLFloaterBuyLandUI::onClickErrorWeb() { - LLFloaterBuyLandUI* self = (LLFloaterBuyLandUI*)data; - LLWeb::loadURLExternal(self->mCannotBuyURI); - self->closeFloater(); + LLWeb::loadURLExternal(mCannotBuyURI); + closeFloater(); } diff --git a/indra/newview/llfloaterbuyland.h b/indra/newview/llfloaterbuyland.h index 82e59a0bcc..7df07f752d 100644 --- a/indra/newview/llfloaterbuyland.h +++ b/indra/newview/llfloaterbuyland.h @@ -33,6 +33,7 @@ #ifndef LL_LLFLOATERBUYLAND_H #define LL_LLFLOATERBUYLAND_H +class LLFloater; class LLViewerRegion; class LLViewerTextEditor; class LLParcelSelection; @@ -47,7 +48,8 @@ public: static void updateEstateName(const std::string& name); static void updateLastModified(const std::string& text); static void updateEstateOwnerName(const std::string& name); - static BOOL isOpen(); + + static LLFloater* buildFloater(const LLSD& key); }; #endif diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index ee3e465832..81f1beb40d 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -35,24 +35,143 @@ #include "llfloatercamera.h" // Library includes -#include "lluictrlfactory.h" +#include "llfloaterreg.h" // Viewer includes #include "lljoystickbutton.h" +#include "llfirsttimetipmanager.h" #include "llviewercontrol.h" +#include "llbottomtray.h" +#include "llagent.h" +#include "lltoolmgr.h" +#include "lltoolfocus.h" // Constants const F32 CAMERA_BUTTON_DELAY = 0.0f; +#define ORBIT "cam_rotate_stick" +#define PAN "cam_track_stick" +#define CONTROLS "controls" + // // Member functions // + +/*static*/ bool LLFloaterCamera::inFreeCameraMode() +{ + LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); + if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA) + { + return true; + } + return false; +} + +bool LLFloaterCamera::inAvatarViewMode() +{ + return mCurrMode == CAMERA_CTRL_MODE_AVATAR_VIEW; +} + +void LLFloaterCamera::resetFreeCameraMode() +{ + if (mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA) + { + /* Camera Tool can be deselected when we are mouse wheel scrolling into Mouse Look + In such case we are unable to determine that we will be into Mouse Look view */ + if (mPrevMode == CAMERA_CTRL_MODE_AVATAR_VIEW) + { + setMode(CAMERA_CTRL_MODE_ORBIT); + } + else + { + setMode(mPrevMode); + } + } +} + +void LLFloaterCamera::update() +{ + ECameraControlMode mode = determineMode(); + if (mode != mCurrMode) setMode(mode); + LLFirstTimeTipsManager::showTipsFor(mMode2TipType[mode], this); +} + + +/*static*/ void LLFloaterCamera::updateIfNotInAvatarViewMode() +{ + LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); + if (floater_camera && !floater_camera->inAvatarViewMode()) + { + floater_camera->update(); + } +} + + +void LLFloaterCamera::toPrevMode() +{ + switchMode(mPrevMode); +} + +/*static*/ void LLFloaterCamera::toPrevModeIfInAvatarViewMode() +{ + LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance(); + if (floater_camera && floater_camera->inAvatarViewMode()) + { + floater_camera->toPrevMode(); + } +} + +LLFloaterCamera* LLFloaterCamera::findInstance() +{ + return LLFloaterReg::findTypedInstance<LLFloaterCamera>("camera"); +} + +/*static*/ +void LLFloaterCamera::onClickCameraPresets(LLUICtrl* ctrl, const LLSD& param) +{ + std::string name = param.asString(); + + if ("rear_view" == name) + { + LLFirstTimeTipsManager::showTipsFor(LLFirstTimeTipsManager::FTT_CAMERA_PRESET_REAR, ctrl); + gAgent.resetView(TRUE, TRUE); + } + else if ("3/4_view" == name) + { + LLFirstTimeTipsManager::showTipsFor(LLFirstTimeTipsManager::FTT_CAMERA_PRESET_GROUP); + //*TODO implement 3/4 view + } + else if ("front_view" == name) + { + LLFirstTimeTipsManager::showTipsFor(LLFirstTimeTipsManager::FTT_CAMERA_PRESET_FRONT); + //*TODO implement front view + } + +} + +void LLFloaterCamera::onOpen(const LLSD& key) +{ + updatePosition(); +} + +void LLFloaterCamera::updatePosition() +{ + LLBottomTray* tray = LLBottomTray::getInstance(); + if (!tray) return; + + LLButton* camera_button = tray->getChild<LLButton>("camera_btn", TRUE, FALSE); + if (!camera_button) return; + + //align centers of a button and a floater + S32 x = camera_button->calcScreenRect().getCenterX() - getRect().getWidth()/2; + setOrigin(x, 0); +} + LLFloaterCamera::LLFloaterCamera(const LLSD& val) -: LLFloater(val) +: LLFloater(val), + mCurrMode(CAMERA_CTRL_MODE_ORBIT), + mPrevMode(CAMERA_CTRL_MODE_ORBIT) { - //// For now, only used for size and tooltip strings - //const BOOL DONT_OPEN = FALSE; - //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_camera.xml", DONT_OPEN); } // virtual @@ -60,10 +179,163 @@ BOOL LLFloaterCamera::postBuild() { setIsChrome(TRUE); - mRotate = getChild<LLJoystickCameraRotate>("cam_rotate_stick"); + mRotate = getChild<LLJoystickCameraRotate>(ORBIT); mZoom = getChild<LLJoystickCameraZoom>("zoom"); - mTrack = getChild<LLJoystickCameraTrack>("cam_track_stick"); + mTrack = getChild<LLJoystickCameraTrack>(PAN); + + initMode2TipTypeMap(); + + assignButton2Mode(CAMERA_CTRL_MODE_ORBIT, "orbit_btn"); + assignButton2Mode(CAMERA_CTRL_MODE_PAN, "pan_btn"); + assignButton2Mode(CAMERA_CTRL_MODE_FREE_CAMERA, "freecamera_btn"); + assignButton2Mode(CAMERA_CTRL_MODE_AVATAR_VIEW, "avatarview_btn"); + + update(); return TRUE; } +ECameraControlMode LLFloaterCamera::determineMode() +{ + LLTool* curr_tool = LLToolMgr::getInstance()->getCurrentTool(); + if (curr_tool == LLToolCamera::getInstance()) + { + return CAMERA_CTRL_MODE_FREE_CAMERA; + } + + if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) + { + return CAMERA_CTRL_MODE_AVATAR_VIEW; + } + + return CAMERA_CTRL_MODE_ORBIT; +} + + +void clear_camera_tool() +{ + LLToolMgr* tool_mgr = LLToolMgr::getInstance(); + if (tool_mgr->usingTransientTool() && + tool_mgr->getCurrentTool() == LLToolCamera::getInstance()) + { + tool_mgr->clearTransientTool(); + } +} + + +void LLFloaterCamera::setMode(ECameraControlMode mode) +{ + if (mode != mCurrMode) + { + mPrevMode = mCurrMode; + mCurrMode = mode; + } + + updateState(); +} + +void LLFloaterCamera::switchMode(ECameraControlMode mode) +{ + setMode(mode); + + switch (mode) + { + case CAMERA_CTRL_MODE_ORBIT: + clear_camera_tool(); + break; + + case CAMERA_CTRL_MODE_PAN: + clear_camera_tool(); + break; + + case CAMERA_CTRL_MODE_FREE_CAMERA: + LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance()); + break; + + case CAMERA_CTRL_MODE_AVATAR_VIEW: + gAgent.changeCameraToMouselook(); + break; + + default: + //normally we won't occur here + llassert_always(FALSE); + } +} + + +void LLFloaterCamera::onClickBtn(ECameraControlMode mode) +{ + // check for a click on active button + if (mCurrMode == mode) mMode2Button[mode]->setToggleState(TRUE); + + switchMode(mode); + + LLFirstTimeTipsManager::showTipsFor(mMode2TipType[mode], mMode2Button[mode]); +} + +void LLFloaterCamera::assignButton2Mode(ECameraControlMode mode, const std::string& button_name) +{ + LLButton* button = getChild<LLButton>(button_name, TRUE, FALSE); + llassert_always(button); + + if (button) + { + button->setClickedCallback(boost::bind(&LLFloaterCamera::onClickBtn, this, mode)); + mMode2Button[mode] = button; + } +} + +void LLFloaterCamera::initMode2TipTypeMap() +{ + mMode2TipType[CAMERA_CTRL_MODE_ORBIT] = LLFirstTimeTipsManager::FTT_CAMERA_ORBIT_MODE; + mMode2TipType[CAMERA_CTRL_MODE_PAN] = LLFirstTimeTipsManager::FTT_CAMERA_PAN_MODE; + mMode2TipType[CAMERA_CTRL_MODE_FREE_CAMERA] = LLFirstTimeTipsManager::FTT_CAMERA_FREE_MODE; + mMode2TipType[CAMERA_CTRL_MODE_AVATAR_VIEW] = LLFirstTimeTipsManager::FTT_AVATAR_FREE_MODE; +} + + +void LLFloaterCamera::updateState() +{ + //updating buttons + std::map<ECameraControlMode, LLButton*>::const_iterator iter = mMode2Button.begin(); + for (; iter != mMode2Button.end(); ++iter) + { + iter->second->setToggleState(iter->first == mCurrMode); + } + + //updating controls + bool isOrbitMode = CAMERA_CTRL_MODE_ORBIT == mCurrMode; + bool isPanMode = CAMERA_CTRL_MODE_PAN == mCurrMode; + + childSetVisible(ORBIT, isOrbitMode); + childSetVisible(PAN, isPanMode); + + //hiding or showing the panel with controls by reshaping the floater + bool showControls = isOrbitMode || isPanMode; + if (showControls == childIsVisible(CONTROLS)) return; + + childSetVisible(CONTROLS, showControls); + + LLRect rect = getRect(); + LLRect controls_rect; + if (childGetRect(CONTROLS, controls_rect)) + { + static S32 height = controls_rect.getHeight(); + S32 newHeight = rect.getHeight(); + + if (showControls) + { + newHeight += height; + } + else + { + newHeight -= height; + } + + rect.setOriginAndSize(rect.mLeft, rect.mBottom, rect.getWidth(), newHeight); + reshape(rect.getWidth(), rect.getHeight()); + setRect(rect); + + } +} + diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index fabe8f577e..04554c6493 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -35,26 +35,94 @@ #include "llfloater.h" +#include "llfirsttimetipmanager.h" + class LLJoystickCameraRotate; class LLJoystickCameraZoom; class LLJoystickCameraTrack; +class LLFloaterReg; + +enum ECameraControlMode +{ + CAMERA_CTRL_MODE_ORBIT, + CAMERA_CTRL_MODE_PAN, + CAMERA_CTRL_MODE_FREE_CAMERA, + CAMERA_CTRL_MODE_AVATAR_VIEW +}; class LLFloaterCamera : public LLFloater { friend class LLFloaterReg; -private: - - LLFloaterCamera(const LLSD& val); - ~LLFloaterCamera() {}; - - /*virtual*/ BOOL postBuild(); public: + + /* whether in free camera mode */ + static bool inFreeCameraMode(); + + static void toPrevModeIfInAvatarViewMode(); + + /* resets free camera mode to the previous mode */ + //*TODO remove, if it won't be used by LLToolCamera::handleDeselect() + void resetFreeCameraMode(); + + /* determines actual mode and updates ui */ + void update(); + static void updateIfNotInAvatarViewMode(); + + static void onClickCameraPresets(LLUICtrl* ctrl, const LLSD& param); + + virtual void onOpen(const LLSD& key); + + // *HACK: due to hard enough to have this control aligned with "Camera" button while resizing + // let update its position in each frame + /*virtual*/ void draw(){updatePosition(); LLFloater::draw();} + LLJoystickCameraRotate* mRotate; LLJoystickCameraZoom* mZoom; LLJoystickCameraTrack* mTrack; + +private: + + LLFloaterCamera(const LLSD& val); + ~LLFloaterCamera() {}; + + /* return instance if it exists - created by LLFloaterReg */ + static LLFloaterCamera* findInstance(); + + /*virtual*/ BOOL postBuild(); + + ECameraControlMode determineMode(); + + /* whether in avatar view (first person) mode */ + bool inAvatarViewMode(); + + /* resets to the previous mode */ + void toPrevMode(); + + /* sets a new mode and performs related actions */ + void switchMode(ECameraControlMode mode); + + /* sets a new mode preserving previous one and updates ui*/ + void setMode(ECameraControlMode mode); + + /* updates the state (UI) according to the current mode */ + void updateState(); + + void onClickBtn(ECameraControlMode mode); + void assignButton2Mode(ECameraControlMode mode, const std::string& button_name); + void initMode2TipTypeMap(); + + /*Updates position of the floater to be center aligned with "Camera" button.*/ + void updatePosition(); + + + ECameraControlMode mPrevMode; + ECameraControlMode mCurrMode; + std::map<ECameraControlMode, LLButton*> mMode2Button; + std::map<ECameraControlMode, LLFirstTimeTipsManager::EFirstTimeTipType> mMode2TipType; + }; #endif diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index 1ecbdd8e16..8fcb7b985f 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -54,6 +54,7 @@ //#include "lllineeditor.h" #include "llmutelist.h" //#include "llresizehandle.h" +#include "llchatbar.h" #include "llrecentpeople.h" #include "llstatusbar.h" #include "llviewertexteditor.h" @@ -98,6 +99,7 @@ LLFloaterChat::LLFloaterChat(const LLSD& seed) : LLFloater(seed), mPanel(NULL) { + mFactoryMap["chat_panel"] = LLCallbackMap(createChatPanel, NULL); mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, NULL); //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this,"floater_chat_history.xml"); @@ -108,23 +110,27 @@ LLFloaterChat::~LLFloaterChat() // Children all cleaned up by default view destructor. } -void LLFloaterChat::setVisible(BOOL visible) -{ - LLFloater::setVisible( visible ); -} - void LLFloaterChat::draw() { // enable say and shout only when text available childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel")); + LLChatBar* chat_barp = findChild<LLChatBar>("chat_panel", TRUE); + if (chat_barp) + { + chat_barp->refresh(); + } + mPanel->refreshSpeakers(); LLFloater::draw(); } BOOL LLFloaterChat::postBuild() { + // Hide the chat overlay when our history is visible. + mVisibleSignal.connect(boost::bind(&LLFloaterChat::updateConsoleVisibility, this)); + mPanel = (LLPanelActiveSpeakers*)getChild<LLPanel>("active_speakers_panel"); childSetCommitCallback("show mutes",onClickToggleShowMute,this); //show mutes @@ -134,34 +140,6 @@ BOOL LLFloaterChat::postBuild() return TRUE; } -// public virtual -void LLFloaterChat::onClose(bool app_quitting) -{ - if (getHost()) - { - getHost()->setVisible(FALSE); - } - else - { - setVisible(FALSE); - } -} - -void LLFloaterChat::onVisibilityChange(BOOL new_visibility) -{ - // Hide the chat overlay when our history is visible. - updateConsoleVisibility(); - - LLFloater::onVisibilityChange(new_visibility); -} - -void LLFloaterChat::setMinimized(BOOL minimized) -{ - LLFloater::setMinimized(minimized); - updateConsoleVisibility(); -} - - void LLFloaterChat::updateConsoleVisibility() { // determine whether we should show console due to not being visible @@ -526,6 +504,13 @@ void* LLFloaterChat::createSpeakersPanel(void* data) return new LLPanelActiveSpeakers(LLLocalSpeakerMgr::getInstance(), TRUE); } +//static +void* LLFloaterChat::createChatPanel(void* data) +{ + LLChatBar* chatp = new LLChatBar(); + return chatp; +} + // static void LLFloaterChat::onClickToggleActiveSpeakers(void* userdata) { diff --git a/indra/newview/llfloaterchat.h b/indra/newview/llfloaterchat.h index b299d1ad10..e8af48d095 100644 --- a/indra/newview/llfloaterchat.h +++ b/indra/newview/llfloaterchat.h @@ -65,12 +65,9 @@ public: LLFloaterChat(const LLSD& seed); ~LLFloaterChat(); - virtual void setVisible( BOOL b ); virtual void draw(); virtual BOOL postBuild(); - virtual void onClose(bool app_quitting); - virtual void onVisibilityChange(BOOL cur_visibility); - virtual void setMinimized(BOOL); + void updateConsoleVisibility(); static void setHistoryCursorAndScrollToEnd(); @@ -90,6 +87,7 @@ public: static void chatFromLogFile(LLLogChat::ELogLineType type,std::string line, void* userdata); static void loadHistory(); static void* createSpeakersPanel(void* data); + static void* createChatPanel(void* data); static LLFloaterChat* getInstance(); // *TODO:Skinning Deprecate diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp index 3389770b2f..05ea800d0e 100644 --- a/indra/newview/llfloaterchatterbox.cpp +++ b/indra/newview/llfloaterchatterbox.cpp @@ -50,7 +50,7 @@ // LLFloaterMyFriends::LLFloaterMyFriends(const LLSD& seed) - : LLFloater() + : LLFloater(seed) { mFactoryMap["friends_panel"] = LLCallbackMap(LLFloaterMyFriends::createFriendsPanel, NULL); mFactoryMap["groups_panel"] = LLCallbackMap(LLFloaterMyFriends::createGroupsPanel, NULL); @@ -78,11 +78,6 @@ void LLFloaterMyFriends::onOpen(const LLSD& key) } } -void LLFloaterMyFriends::onClose(bool app_quitting) -{ - setVisible(FALSE); -} - //static void* LLFloaterMyFriends::createFriendsPanel(void* data) { @@ -105,8 +100,8 @@ LLFloaterMyFriends* LLFloaterMyFriends::getInstance() // LLFloaterChatterBox // LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) - : LLMultiFloater(), - mActiveVoiceFloater(NULL) +: LLMultiFloater(seed), + mActiveVoiceFloater(NULL) { mAutoResize = FALSE; @@ -119,6 +114,8 @@ LLFloaterChatterBox::~LLFloaterChatterBox() BOOL LLFloaterChatterBox::postBuild() { + mVisibleSignal.connect(boost::bind(&LLFloaterChatterBox::onVisibilityChange, this, _2)); + if (gSavedSettings.getBOOL("ContactsTornOff")) { LLFloaterMyFriends* floater_contacts = LLFloaterMyFriends::getInstance(); @@ -245,14 +242,8 @@ void LLFloaterChatterBox::onOpen(const LLSD& key) } } -void LLFloaterChatterBox::onClose(bool app_quitting) +void LLFloaterChatterBox::onVisibilityChange ( const LLSD& new_visibility ) { - setVisible(FALSE); -} - -void LLFloaterChatterBox::setMinimized(BOOL minimized) -{ - LLFloater::setMinimized(minimized); // HACK: potentially need to toggle console LLFloaterChat* instance = LLFloaterChat::getInstance(); if(instance) @@ -332,7 +323,7 @@ void LLFloaterChatterBox::addFloater(LLFloater* floaterp, else { LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point); - openFloater(floaterp->getKey()); + // openFloater(floaterp->getKey()); } // make sure active voice icon shows up for new tab diff --git a/indra/newview/llfloaterchatterbox.h b/indra/newview/llfloaterchatterbox.h index e6a2e30ba6..3929e6e36c 100644 --- a/indra/newview/llfloaterchatterbox.h +++ b/indra/newview/llfloaterchatterbox.h @@ -52,8 +52,6 @@ public: /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ void draw(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); - /*virtual*/ void setMinimized(BOOL minimized); /*virtual*/ void removeFloater(LLFloater* floaterp); /*virtual*/ void addFloater(LLFloater* floaterp, @@ -64,6 +62,8 @@ public: static LLFloater* getCurrentVoiceFloater(); protected: + void onVisibilityChange ( const LLSD& new_visibility ); + LLFloater* mActiveVoiceFloater; }; @@ -76,7 +76,6 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); static LLFloaterMyFriends* getInstance(); // *TODO:Skinning Deprecate diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index c140518759..8e385fca78 100644 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -79,7 +79,7 @@ const F32 CONTEXT_FADE_TIME = 0.08f; ////////////////////////////////////////////////////////////////////////////// LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate ) - : LLFloater(), + : LLFloater(LLSD()), mComponents ( 3 ), mMouseDownInLumRegion ( FALSE ), mMouseDownInHueRegion ( FALSE ), @@ -113,6 +113,9 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show mCanApplyImmediately ( show_apply_immediate ), mContextConeOpacity ( 0.f ) { + // build the majority of the gui using the factory builder + LLUICtrlFactory::getInstance()->buildFloater ( this, "floater_color_picker.xml", NULL ); + // create user interface for this picker createUI (); @@ -133,10 +136,6 @@ LLFloaterColorPicker::~LLFloaterColorPicker() // void LLFloaterColorPicker::createUI () { - // build the majority of the gui using the factory builder - LLUICtrlFactory::getInstance()->buildFloater ( this, "floater_color_picker.xml" ); - setVisible ( FALSE ); - // create RGB type area (not really RGB but it's got R,G & B in it.,.. LLPointer<LLImageRaw> raw = new LLImageRaw ( mRGBViewerImageWidth, mRGBViewerImageHeight, mComponents ); diff --git a/indra/newview/llfloaterdaycycle.cpp b/indra/newview/llfloaterdaycycle.cpp index a448df792e..7f3b988dfe 100644 --- a/indra/newview/llfloaterdaycycle.cpp +++ b/indra/newview/llfloaterdaycycle.cpp @@ -59,14 +59,13 @@ #include "llfloaterwindlight.h" -LLFloaterDayCycle* LLFloaterDayCycle::sDayCycle = NULL; std::map<std::string, LLWLSkyKey> LLFloaterDayCycle::sSliderToKey; const F32 LLFloaterDayCycle::sHoursPerDay = 24.0f; -LLFloaterDayCycle::LLFloaterDayCycle() - : LLFloater() +LLFloaterDayCycle::LLFloaterDayCycle(const LLSD& key) +: LLFloater(key) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_day_cycle_options.xml"); } BOOL LLFloaterDayCycle::postBuild() @@ -95,6 +94,10 @@ BOOL LLFloaterDayCycle::postBuild() // load it up initCallbacks(); + + syncMenu(); + syncSliderTrack(); + return TRUE; } @@ -102,17 +105,14 @@ LLFloaterDayCycle::~LLFloaterDayCycle() { } -void LLFloaterDayCycle::onClickHelp(void* data) +void LLFloaterDayCycle::onClickHelp(std::string xml_alert) { - LLFloaterDayCycle* self = LLFloaterDayCycle::instance(); - - std::string xml_alert = *(std::string *) data; - LLNotifications::instance().add(self->contextualNotification(xml_alert)); + LLNotifications::instance().add(contextualNotification(xml_alert)); } void LLFloaterDayCycle::initHelpBtn(const std::string& name, const std::string& xml_alert) { - childSetAction(name, onClickHelp, new std::string(xml_alert)); + getChild<LLButton>(name)->setClickedCallback(boost::bind(&LLFloaterDayCycle::onClickHelp, this, xml_alert)); } void LLFloaterDayCycle::initCallbacks(void) @@ -120,24 +120,24 @@ void LLFloaterDayCycle::initCallbacks(void) initHelpBtn("WLDayCycleHelp", "HelpDayCycle"); // WL Day Cycle - childSetCommitCallback("WLTimeSlider", onTimeSliderMoved, NULL); - childSetCommitCallback("WLDayCycleKeys", onKeyTimeMoved, NULL); - childSetCommitCallback("WLCurKeyHour", onKeyTimeChanged, NULL); - childSetCommitCallback("WLCurKeyMin", onKeyTimeChanged, NULL); - childSetCommitCallback("WLKeyPresets", onKeyPresetChanged, NULL); - - childSetCommitCallback("WLLengthOfDayHour", onTimeRateChanged, NULL); - childSetCommitCallback("WLLengthOfDayMin", onTimeRateChanged, NULL); - childSetCommitCallback("WLLengthOfDaySec", onTimeRateChanged, NULL); - childSetAction("WLUseLindenTime", onUseLindenTime, NULL); - childSetAction("WLAnimSky", onRunAnimSky, NULL); - childSetAction("WLStopAnimSky", onStopAnimSky, NULL); - - childSetAction("WLLoadDayCycle", onLoadDayCycle, NULL); - childSetAction("WLSaveDayCycle", onSaveDayCycle, NULL); - - childSetAction("WLAddKey", onAddKey, NULL); - childSetAction("WLDeleteKey", onDeleteKey, NULL); + getChild<LLUICtrl>("WLTimeSlider")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeSliderMoved, this, _1)); + getChild<LLUICtrl>("WLDayCycleKeys")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeMoved, this, _1)); + getChild<LLUICtrl>("WLCurKeyHour")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeChanged, this, _1)); + getChild<LLUICtrl>("WLCurKeyMin")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyTimeChanged, this, _1)); + getChild<LLUICtrl>("WLKeyPresets")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onKeyPresetChanged, this, _1)); + + getChild<LLUICtrl>("WLLengthOfDayHour")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1)); + getChild<LLUICtrl>("WLLengthOfDayMin")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1)); + getChild<LLUICtrl>("WLLengthOfDaySec")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onTimeRateChanged, this, _1)); + getChild<LLUICtrl>("WLUseLindenTime")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onUseLindenTime, this, _1)); + getChild<LLUICtrl>("WLAnimSky")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onRunAnimSky, this, _1)); + getChild<LLUICtrl>("WLStopAnimSky")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onStopAnimSky, this, _1)); + + getChild<LLUICtrl>("WLLoadDayCycle")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onLoadDayCycle, this, _1)); + getChild<LLUICtrl>("WLSaveDayCycle")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onSaveDayCycle, this, _1)); + + getChild<LLUICtrl>("WLAddKey")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onAddKey, this, _1)); + getChild<LLUICtrl>("WLDeleteKey")->setCommitCallback(boost::bind(&LLFloaterDayCycle::onDeleteKey, this, _1)); } void LLFloaterDayCycle::syncMenu() @@ -145,12 +145,12 @@ void LLFloaterDayCycle::syncMenu() // std::map<std::string, LLVector4> & currentParams = LLWLParamManager::instance()->mCurParams.mParamValues; // set time - LLMultiSliderCtrl* sldr = LLFloaterDayCycle::sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider"); + LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLTimeSlider"); sldr->setCurSliderValue((F32)LLWLParamManager::instance()->mAnimator.getDayTime() * sHoursPerDay); - LLSpinCtrl* secSpin = sDayCycle->getChild<LLSpinCtrl>("WLLengthOfDaySec"); - LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLLengthOfDayMin"); - LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLLengthOfDayHour"); + LLSpinCtrl* secSpin = getChild<LLSpinCtrl>("WLLengthOfDaySec"); + LLSpinCtrl* minSpin = getChild<LLSpinCtrl>("WLLengthOfDayMin"); + LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>("WLLengthOfDayHour"); F32 curRate; F32 hours, min, sec; @@ -170,18 +170,18 @@ void LLFloaterDayCycle::syncMenu() // turn off Use Estate Time button if it's already being used if( LLWLParamManager::instance()->mAnimator.mUseLindenTime == true) { - LLFloaterDayCycle::sDayCycle->childDisable("WLUseLindenTime"); + childDisable("WLUseLindenTime"); } else { - LLFloaterDayCycle::sDayCycle->childEnable("WLUseLindenTime"); + childEnable("WLUseLindenTime"); } } void LLFloaterDayCycle::syncSliderTrack() { // clear the slider - LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); + LLMultiSliderCtrl* kSldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); kSldr->clear(); sSliderToKey.clear(); @@ -204,12 +204,12 @@ void LLFloaterDayCycle::syncTrack() } LLMultiSliderCtrl* sldr; - sldr = sDayCycle->getChild<LLMultiSliderCtrl>( + sldr = getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); llassert_always(sSliderToKey.size() == sldr->getValue().size()); LLMultiSliderCtrl* tSldr; - tSldr = sDayCycle->getChild<LLMultiSliderCtrl>( + tSldr = getChild<LLMultiSliderCtrl>( "WLTimeSlider"); // create a new animation track @@ -231,50 +231,7 @@ void LLFloaterDayCycle::syncTrack() LLWLParamManager::instance()->mCurParams); } -// static -LLFloaterDayCycle* LLFloaterDayCycle::instance() -{ - if (!sDayCycle) - { - sDayCycle = new LLFloaterDayCycle(); - sDayCycle->openFloater(); - sDayCycle->setFocus(TRUE); - } - return sDayCycle; -} - -bool LLFloaterDayCycle::isOpen() -{ - if (sDayCycle != NULL) - { - return true; - } - return false; -} - -void LLFloaterDayCycle::show() -{ - LLFloaterDayCycle* dayCycle = instance(); - dayCycle->syncMenu(); - syncSliderTrack(); - - // comment in if you want the menu to rebuild each time - //LLUICtrlFactory::getInstance()->buildFloater(dayCycle, "floater_day_cycle_options.xml"); - //dayCycle->initCallbacks(); - - dayCycle->openFloater(); -} - -// virtual -void LLFloaterDayCycle::onClose(bool app_quitting) -{ - if (sDayCycle) - { - sDayCycle->setVisible(FALSE); - } -} - -void LLFloaterDayCycle::onRunAnimSky(void* userData) +void LLFloaterDayCycle::onRunAnimSky(LLUICtrl* ctrl) { // if no keys, do nothing if(sSliderToKey.size() == 0) @@ -283,11 +240,11 @@ void LLFloaterDayCycle::onRunAnimSky(void* userData) } LLMultiSliderCtrl* sldr; - sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); + sldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); llassert_always(sSliderToKey.size() == sldr->getValue().size()); LLMultiSliderCtrl* tSldr; - tSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider"); + tSldr = getChild<LLMultiSliderCtrl>("WLTimeSlider"); // turn off linden time LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; @@ -299,7 +256,7 @@ void LLFloaterDayCycle::onRunAnimSky(void* userData) llassert_always(LLWLParamManager::instance()->mAnimator.mTimeTrack.size() == sldr->getValue().size()); } -void LLFloaterDayCycle::onStopAnimSky(void* userData) +void LLFloaterDayCycle::onStopAnimSky(LLUICtrl* ctrl) { // if no keys, do nothing if(sSliderToKey.size() == 0) { @@ -311,17 +268,16 @@ void LLFloaterDayCycle::onStopAnimSky(void* userData) LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; } -void LLFloaterDayCycle::onUseLindenTime(void* userData) +void LLFloaterDayCycle::onUseLindenTime(LLUICtrl* ctrl) { - LLFloaterWindLight* wl = LLFloaterWindLight::instance(); - LLComboBox* box = wl->getChild<LLComboBox>("WLPresetsCombo"); + LLComboBox* box = getChild<LLComboBox>("WLPresetsCombo"); box->selectByValue(""); LLWLParamManager::instance()->mAnimator.mIsRunning = true; LLWLParamManager::instance()->mAnimator.mUseLindenTime = true; } -void LLFloaterDayCycle::onLoadDayCycle(void* userData) +void LLFloaterDayCycle::onLoadDayCycle(LLUICtrl* ctrl) { LLWLParamManager::instance()->mDay.loadDayCycle("Default.xml"); @@ -331,7 +287,7 @@ void LLFloaterDayCycle::onLoadDayCycle(void* userData) // set the param manager's track to the new one LLMultiSliderCtrl* tSldr; - tSldr = sDayCycle->getChild<LLMultiSliderCtrl>( + tSldr = getChild<LLMultiSliderCtrl>( "WLTimeSlider"); LLWLParamManager::instance()->resetAnimator( tSldr->getCurSliderValue() / sHoursPerDay, false); @@ -341,15 +297,15 @@ void LLFloaterDayCycle::onLoadDayCycle(void* userData) LLWLParamManager::instance()->mCurParams); } -void LLFloaterDayCycle::onSaveDayCycle(void* userData) +void LLFloaterDayCycle::onSaveDayCycle(LLUICtrl* ctrl) { LLWLParamManager::instance()->mDay.saveDayCycle("Default.xml"); } -void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl) { - LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>( + LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>( "WLTimeSlider"); /// get the slider value @@ -365,12 +321,12 @@ void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData) LLWLParamManager::instance()->mCurParams); } -void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl) { - LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>("WLKeyPresets"); - LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); - LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyHour"); - LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyMin"); + LLComboBox* comboBox = getChild<LLComboBox>("WLKeyPresets"); + LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); + LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>("WLCurKeyHour"); + LLSpinCtrl* minSpin = getChild<LLSpinCtrl>("WLCurKeyMin"); if(sldr->getValue().size() == 0) { return; @@ -408,18 +364,18 @@ void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData) } -void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData) +void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl) { // if no keys, skipped if(sSliderToKey.size() == 0) { return; } - LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>( + LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); - LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>( + LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>( "WLCurKeyHour"); - LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>( + LLSpinCtrl* minSpin = getChild<LLSpinCtrl>( "WLCurKeyMin"); F32 hour = hourSpin->get(); @@ -437,12 +393,12 @@ void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData) syncTrack(); } -void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) +void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl) { // get the time - LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>( + LLComboBox* comboBox = getChild<LLComboBox>( "WLKeyPresets"); - LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>( + LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); // do nothing if no sliders @@ -464,16 +420,16 @@ void LLFloaterDayCycle::onKeyPresetChanged(LLUICtrl* ctrl, void* userData) syncTrack(); } -void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl, void* userData) +void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl) { // get the time - LLSpinCtrl* secSpin = sDayCycle->getChild<LLSpinCtrl>( + LLSpinCtrl* secSpin = getChild<LLSpinCtrl>( "WLLengthOfDaySec"); - LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>( + LLSpinCtrl* minSpin = getChild<LLSpinCtrl>( "WLLengthOfDayMin"); - LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>( + LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>( "WLLengthOfDayHour"); F32 hour; @@ -492,13 +448,13 @@ void LLFloaterDayCycle::onTimeRateChanged(LLUICtrl* ctrl, void* userData) syncTrack(); } -void LLFloaterDayCycle::onAddKey(void* userData) +void LLFloaterDayCycle::onAddKey(LLUICtrl* ctrl) { - LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>( + LLComboBox* comboBox = getChild<LLComboBox>( "WLKeyPresets"); - LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>( + LLMultiSliderCtrl* kSldr = getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); - LLMultiSliderCtrl* tSldr = sDayCycle->getChild<LLMultiSliderCtrl>( + LLMultiSliderCtrl* tSldr = getChild<LLMultiSliderCtrl>( "WLTimeSlider"); llassert_always(sSliderToKey.size() == kSldr->getValue().size()); @@ -514,7 +470,7 @@ void LLFloaterDayCycle::onAddKey(void* userData) void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName) { - LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>( + LLMultiSliderCtrl* kSldr = getChild<LLMultiSliderCtrl>( "WLDayCycleKeys"); // make a slider @@ -539,7 +495,7 @@ void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName) void LLFloaterDayCycle::deletePreset(std::string& presetName) { - LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); + LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); /// delete any reference std::map<std::string, LLWLSkyKey>::iterator curr_preset, next_preset; @@ -555,15 +511,15 @@ void LLFloaterDayCycle::deletePreset(std::string& presetName) } } -void LLFloaterDayCycle::onDeleteKey(void* userData) +void LLFloaterDayCycle::onDeleteKey(LLUICtrl* ctrl) { if(sSliderToKey.size() == 0) { return; } - LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>( + LLComboBox* comboBox = getChild<LLComboBox>( "WLKeyPresets"); - LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); + LLMultiSliderCtrl* sldr = getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); // delete from map const std::string& sldrName = sldr->getCurSlider(); @@ -580,8 +536,8 @@ void LLFloaterDayCycle::onDeleteKey(void* userData) comboBox->selectByValue(sSliderToKey[name].presetName); F32 time = sSliderToKey[name].time; - LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyHour"); - LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyMin"); + LLSpinCtrl* hourSpin = getChild<LLSpinCtrl>("WLCurKeyHour"); + LLSpinCtrl* minSpin = getChild<LLSpinCtrl>("WLCurKeyMin"); // now set the spinners F32 hour = (F32)((S32)time); diff --git a/indra/newview/llfloaterdaycycle.h b/indra/newview/llfloaterdaycycle.h index a03a7f749a..43c347d4f2 100644 --- a/indra/newview/llfloaterdaycycle.h +++ b/indra/newview/llfloaterdaycycle.h @@ -56,87 +56,69 @@ class LLFloaterDayCycle : public LLFloater { public: - LLFloaterDayCycle(); + LLFloaterDayCycle(const LLSD& key); virtual ~LLFloaterDayCycle(); /*virtual*/ BOOL postBuild(); /// help button stuff - static void onClickHelp(void* data); + void onClickHelp(std::string xml_alert); void initHelpBtn(const std::string& name, const std::string& xml_alert); /// initialize all void initCallbacks(void); - /// one and one instance only - static LLFloaterDayCycle* instance(); - /// on time slider moved - static void onTimeSliderMoved(LLUICtrl* ctrl, void* userData); + void onTimeSliderMoved(LLUICtrl* ctrl); /// what happens when you move the key frame - static void onKeyTimeMoved(LLUICtrl* ctrl, void* userData); + void onKeyTimeMoved(LLUICtrl* ctrl); /// what happens when you change the key frame's time - static void onKeyTimeChanged(LLUICtrl* ctrl, void* userData); + void onKeyTimeChanged(LLUICtrl* ctrl); /// if you change the combo box, change the frame - static void onKeyPresetChanged(LLUICtrl* ctrl, void* userData); + void onKeyPresetChanged(LLUICtrl* ctrl); /// run this when user says to run the sky animation - static void onRunAnimSky(void* userData); + void onRunAnimSky(LLUICtrl* ctrl); /// run this when user says to stop the sky animation - static void onStopAnimSky(void* userData); + void onStopAnimSky(LLUICtrl* ctrl); /// if you change the combo box, change the frame - static void onTimeRateChanged(LLUICtrl* ctrl, void* userData); + void onTimeRateChanged(LLUICtrl* ctrl); /// add a new key on slider - static void onAddKey(void* userData); + void onAddKey(LLUICtrl* ctrl); /// delete any and all reference to a preset void deletePreset(std::string& presetName); /// delete a key frame - static void onDeleteKey(void* userData); + void onDeleteKey(LLUICtrl* ctrl); /// button to load day - static void onLoadDayCycle(void* userData); + void onLoadDayCycle(LLUICtrl* ctrl); /// button to save day - static void onSaveDayCycle(void* userData); + void onSaveDayCycle(LLUICtrl* ctrl); /// toggle for Linden time - static void onUseLindenTime(void* userData); - - - //// menu management - - /// show off our menu - static void show(); - - /// return if the menu exists or not - static bool isOpen(); - - /// stuff to do on exit - virtual void onClose(bool app_quitting); + void onUseLindenTime(LLUICtrl* ctrl); /// sync up sliders with day cycle structure - static void syncMenu(); + void syncMenu(); // makes sure key slider has what's in day cycle - static void syncSliderTrack(); + void syncSliderTrack(); /// makes sure day cycle data structure has what's in menu - static void syncTrack(); + void syncTrack(); /// add a slider to the track - static void addSliderKey(F32 time, const std::string& presetName); + void addSliderKey(F32 time, const std::string& presetName); private: - // one instance on the inside - static LLFloaterDayCycle* sDayCycle; - // map of sliders to parameters static std::map<std::string, LLWLSkyKey> sSliderToKey; diff --git a/indra/newview/llfloaterenvsettings.cpp b/indra/newview/llfloaterenvsettings.cpp index cfdf49373e..a520df36de 100644 --- a/indra/newview/llfloaterenvsettings.cpp +++ b/indra/newview/llfloaterenvsettings.cpp @@ -34,6 +34,7 @@ #include "llfloaterenvsettings.h" +#include "llfloaterreg.h" #include "llfloaterwindlight.h" #include "llfloaterwater.h" #include "lluictrlfactory.h" @@ -52,12 +53,10 @@ #include <sstream> -LLFloaterEnvSettings* LLFloaterEnvSettings::sEnvSettings = NULL; - -LLFloaterEnvSettings::LLFloaterEnvSettings() - : LLFloater() +LLFloaterEnvSettings::LLFloaterEnvSettings(const LLSD& key) + : LLFloater(key) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_env_settings.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_env_settings.xml"); } // virtual LLFloaterEnvSettings::~LLFloaterEnvSettings() @@ -68,31 +67,29 @@ BOOL LLFloaterEnvSettings::postBuild() { // load it up initCallbacks(); + syncMenu(); return TRUE; } -void LLFloaterEnvSettings::onClickHelp(void* data) +void LLFloaterEnvSettings::onClickHelp() { - LLFloaterEnvSettings* self = (LLFloaterEnvSettings*)data; - LLNotifications::instance().add(self->contextualNotification("EnvSettingsHelpButton")); + LLNotifications::instance().add(contextualNotification("EnvSettingsHelpButton")); } void LLFloaterEnvSettings::initCallbacks(void) { // our three sliders - childSetCommitCallback("EnvTimeSlider", onChangeDayTime, NULL); - childSetCommitCallback("EnvCloudSlider", onChangeCloudCoverage, NULL); - childSetCommitCallback("EnvWaterFogSlider", onChangeWaterFogDensity, - &LLWaterParamManager::instance()->mFogDensity); + getChild<LLUICtrl>("EnvTimeSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeDayTime, this, _1)); + getChild<LLUICtrl>("EnvCloudSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeCloudCoverage, this, _1)); + getChild<LLUICtrl>("EnvWaterFogSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeWaterFogDensity, this, _1, &LLWaterParamManager::instance()->mFogDensity)); // color picker - childSetCommitCallback("EnvWaterColor", onChangeWaterColor, - &LLWaterParamManager::instance()->mFogColor); + getChild<LLUICtrl>("EnvWaterColor")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeWaterColor, this, _1, &LLWaterParamManager::instance()->mFogColor)); // WL Top - childSetAction("EnvAdvancedSkyButton", onOpenAdvancedSky, NULL); - childSetAction("EnvAdvancedWaterButton", onOpenAdvancedWater, NULL); - childSetAction("EnvUseEstateTimeButton", onUseEstateTime, NULL); - childSetAction("EnvSettingsHelpButton", onClickHelp, this); + getChild<LLUICtrl>("EnvAdvancedSkyButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onOpenAdvancedSky, this)); + getChild<LLUICtrl>("EnvAdvancedWaterButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onOpenAdvancedWater, this)); + getChild<LLUICtrl>("EnvUseEstateTimeButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onUseEstateTime, this)); + getChild<LLUICtrl>("EnvSettingsHelpButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onClickHelp, this)); } @@ -101,14 +98,14 @@ void LLFloaterEnvSettings::initCallbacks(void) void LLFloaterEnvSettings::syncMenu() { LLSliderCtrl* sldr; - sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvTimeSlider"); + sldr = getChild<LLSliderCtrl>("EnvTimeSlider"); // sync the clock F32 val = (F32)LLWLParamManager::instance()->mAnimator.getDayTime(); std::string timeStr = timeToString(val); LLTextBox* textBox; - textBox = sEnvSettings->getChild<LLTextBox>("EnvTimeText"); + textBox = getChild<LLTextBox>("EnvTimeText"); textBox->setValue(timeStr); @@ -127,7 +124,7 @@ void LLFloaterEnvSettings::syncMenu() LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); // sync water params LLColor4 col = param_mgr->getFogColor(); - LLColorSwatchCtrl* colCtrl = sEnvSettings->getChild<LLColorSwatchCtrl>("EnvWaterColor"); + LLColorSwatchCtrl* colCtrl = getChild<LLColorSwatchCtrl>("EnvWaterColor"); col.mV[3] = 1.0f; colCtrl->set(col); @@ -171,53 +168,9 @@ void LLFloaterEnvSettings::syncMenu() } } - -// static instance of it -LLFloaterEnvSettings* LLFloaterEnvSettings::instance() -{ - if (!sEnvSettings) - { - sEnvSettings = new LLFloaterEnvSettings(); - sEnvSettings->openFloater(); - sEnvSettings->setFocus(TRUE); - } - return sEnvSettings; -} -void LLFloaterEnvSettings::show() +void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl) { - LLFloaterEnvSettings* envSettings = instance(); - envSettings->syncMenu(); - - // comment in if you want the menu to rebuild each time - //LLUICtrlFactory::getInstance()->buildFloater(envSettings, "floater_env_settings.xml"); - //envSettings->initCallbacks(); - - envSettings->openFloater(); -} - -bool LLFloaterEnvSettings::isOpen() -{ - if (sEnvSettings != NULL) - { - return true; - } - return false; -} - -// virtual -void LLFloaterEnvSettings::onClose(bool app_quitting) -{ - if (sEnvSettings) - { - sEnvSettings->setVisible(FALSE); - } -} - - -void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl, void* userData) -{ - LLSliderCtrl* sldr; - sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvTimeSlider"); + LLSliderCtrl* sldr = static_cast<LLSliderCtrl*>(ctrl); // deactivate animator LLWLParamManager::instance()->mAnimator.mIsRunning = false; @@ -234,10 +187,9 @@ void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl, void* userData) LLWLParamManager::instance()->mCurParams); } -void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl, void* userData) +void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl) { - LLSliderCtrl* sldr; - sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvCloudSlider"); + LLSliderCtrl* sldr = static_cast<LLSliderCtrl*>(ctrl); // deactivate animator //LLWLParamManager::instance()->mAnimator.mIsRunning = false; @@ -247,17 +199,10 @@ void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl, void* userData) LLWLParamManager::instance()->mCurParams.set("cloud_shadow", val); } -void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, void* userData) +void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl) { LLSliderCtrl* sldr; - sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvWaterFogSlider"); - - if(NULL == userData) - { - return; - } - - WaterExpFloatControl * expFloatControl = static_cast<WaterExpFloatControl *>(userData); + sldr = getChild<LLSliderCtrl>("EnvWaterFogSlider"); F32 val = sldr->getValueF32(); expFloatControl->mExp = val; @@ -267,10 +212,9 @@ void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, void* userDat LLWaterParamManager::instance()->propagateParameters(); } -void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, void* userData) +void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, WaterColorControl* colorControl) { LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl); - WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData); *colorControl = swatch->get(); colorControl->update(LLWaterParamManager::instance()->mCurParams); @@ -278,23 +222,22 @@ void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, void* userData) } -void LLFloaterEnvSettings::onOpenAdvancedSky(void* userData) +void LLFloaterEnvSettings::onOpenAdvancedSky() { - LLFloaterWindLight::show(); + LLFloaterReg::showInstance("env_windlight"); } -void LLFloaterEnvSettings::onOpenAdvancedWater(void* userData) +void LLFloaterEnvSettings::onOpenAdvancedWater() { - LLFloaterWater::show(); + LLFloaterReg::showInstance("env_water"); } -void LLFloaterEnvSettings::onUseEstateTime(void* userData) +void LLFloaterEnvSettings::onUseEstateTime() { - if(LLFloaterWindLight::isOpen()) + LLFloaterWindLight* wl = LLFloaterReg::findTypedInstance<LLFloaterWindLight>("env_windlight"); + if(wl) { - // select the blank value in - LLFloaterWindLight* wl = LLFloaterWindLight::instance(); LLComboBox* box = wl->getChild<LLComboBox>("WLPresetsCombo"); box->selectByValue(""); } diff --git a/indra/newview/llfloaterenvsettings.h b/indra/newview/llfloaterenvsettings.h index 725fb9ed45..083e3636d1 100644 --- a/indra/newview/llfloaterenvsettings.h +++ b/indra/newview/llfloaterenvsettings.h @@ -39,59 +39,46 @@ #include "llfloater.h" +struct WaterColorControl; +struct WaterExpFloatControl; /// Menuing system for all of windlight's functionality class LLFloaterEnvSettings : public LLFloater { public: - LLFloaterEnvSettings(); + LLFloaterEnvSettings(const LLSD& key); /*virtual*/ ~LLFloaterEnvSettings(); /*virtual*/ BOOL postBuild(); /// initialize all the callbacks for the menu void initCallbacks(void); - /// one and one instance only - static LLFloaterEnvSettings* instance(); - /// callback for the menus help button - static void onClickHelp(void* data); + void onClickHelp(); /// handle if time of day is changed - static void onChangeDayTime(LLUICtrl* ctrl, void* userData); + void onChangeDayTime(LLUICtrl* ctrl); /// handle if cloud coverage is changed - static void onChangeCloudCoverage(LLUICtrl* ctrl, void* userData); + void onChangeCloudCoverage(LLUICtrl* ctrl); /// handle change in water fog density - static void onChangeWaterFogDensity(LLUICtrl* ctrl, void* userData); - - /// handle change in under water fog density - static void onChangeUnderWaterFogMod(LLUICtrl* ctrl, void* userData); + void onChangeWaterFogDensity(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl); /// handle change in water fog color - static void onChangeWaterColor(LLUICtrl* ctrl, void* userData); + void onChangeWaterColor(LLUICtrl* ctrl, WaterColorControl* colorControl); /// open the advanced sky settings menu - static void onOpenAdvancedSky(void* userData); + void onOpenAdvancedSky(); /// open the advanced water settings menu - static void onOpenAdvancedWater(void* userData); + void onOpenAdvancedWater(); /// sync time with the server - static void onUseEstateTime(void* userData); + void onUseEstateTime(); //// menu management - /// show off our menu - static void show(); - - /// return if the menu exists or not - static bool isOpen(); - - /// stuff to do on exit - virtual void onClose(bool app_quitting); - /// sync up sliders with parameters void syncMenu(); @@ -99,8 +86,6 @@ public: std::string timeToString(F32 curTime); private: - // one instance on the inside - static LLFloaterEnvSettings* sEnvSettings; }; diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp deleted file mode 100644 index 6f84807564..0000000000 --- a/indra/newview/llfloaterevent.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/** - * @file llfloaterevent.cpp - * @brief Event information as shown in a floating window from - * secondlife:// command handler. - * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterevent.h" - -// viewer project includes -#include "llcommandhandler.h" -#include "llpanelevent.h" - -// linden library includes -#include "lluuid.h" -#include "lluictrlfactory.h" - -//////////////////////////////////////////////////////////////////////////// -// LLFloaterEventInfo - -//----------------------------------------------------------------------------- -// Globals -//----------------------------------------------------------------------------- - -LLMap< U32, LLFloaterEventInfo* > gEventInfoInstances; - -class LLEventHandler : public LLCommandHandler -{ -public: - // requires trusted browser to trigger - LLEventHandler() : LLCommandHandler("event", true) { } - bool handle(const LLSD& tokens, const LLSD& query_map, - LLWebBrowserCtrl* web) - { - if (tokens.size() < 2) - { - return false; - } - U32 event_id = tokens[0].asInteger(); - if (tokens[1].asString() == "about") - { - LLFloaterEventInfo::show(event_id); - return true; - } - return false; - } -}; -LLEventHandler gEventHandler; - -LLFloaterEventInfo::LLFloaterEventInfo(const U32 event_id) -: LLFloater(), - mEventID( event_id ) -{ - - mFactoryMap["event_details_panel"] = LLCallbackMap(LLFloaterEventInfo::createEventDetail, this); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_event.xml"); - gEventInfoInstances.addData(event_id, this); -} - -LLFloaterEventInfo::~LLFloaterEventInfo() -{ - // child views automatically deleted - gEventInfoInstances.removeData(mEventID); -} - -void LLFloaterEventInfo::displayEventInfo(const U32 event_id) -{ - mPanelEventp->setEventID(event_id); - this->setFrontmost(true); -} - -// static -void* LLFloaterEventInfo::createEventDetail(void* userdata) -{ - LLFloaterEventInfo *self = (LLFloaterEventInfo*)userdata; - self->mPanelEventp = new LLPanelEvent(); - LLUICtrlFactory::getInstance()->buildPanel(self->mPanelEventp, "panel_event.xml"); - - return self->mPanelEventp; -} - -// static -LLFloaterEventInfo* LLFloaterEventInfo::show(const U32 event_id) -{ - LLFloaterEventInfo *floater; - if (gEventInfoInstances.checkData(event_id)) - { - // ...bring that window to front - floater = gEventInfoInstances.getData(event_id); - floater->openFloater(); - floater->setFrontmost(true); - } - else - { - floater = new LLFloaterEventInfo( event_id ); - floater->center(); - floater->openFloater(); - floater->displayEventInfo(event_id); - floater->setFrontmost(true); - } - - return floater; -} diff --git a/indra/newview/llfloaterevent.h b/indra/newview/llfloaterevent.h deleted file mode 100644 index 563ecc49da..0000000000 --- a/indra/newview/llfloaterevent.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @file llfloaterevent.h - * @brief Event information as shown in a floating window from - * secondlife:// command handler. - * Just a wrapper for LLPanelEvent. - * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_LLFLOATEREVENT_H -#define LL_LLFLOATEREVENT_H - -#include "llfloater.h" - -class LLPanelEvent; - -class LLFloaterEventInfo : public LLFloater -{ -public: - LLFloaterEventInfo( const U32 event_id ); - /*virtual*/ ~LLFloaterEventInfo(); - - void displayEventInfo(const U32 event_id); - - static LLFloaterEventInfo* show(const U32 event_id); - - static void* createEventDetail(void* userdata); - -private: - U32 mEventID; // for which event is this window? - LLPanelEvent* mPanelEventp; - -}; - -#endif // LL_LLFLOATEREVENT_H diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 5a4de579c2..431bc09d86 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -61,10 +61,6 @@ #include "llvoavatar.h" #include "llviewercontrol.h" -// static -LLFloaterGesture* LLFloaterGesture::sInstance = NULL; -LLFloaterGestureObserver* LLFloaterGesture::sObserver = NULL; - BOOL item_name_precedes( LLInventoryItem* a, LLInventoryItem* b ) { return LLStringUtil::precedesDict( a->getName(), b->getName() ); @@ -73,29 +69,31 @@ BOOL item_name_precedes( LLInventoryItem* a, LLInventoryItem* b ) class LLFloaterGestureObserver : public LLGestureManagerObserver { public: - LLFloaterGestureObserver() {} + LLFloaterGestureObserver(LLFloaterGesture* floater) : mFloater(floater) {} virtual ~LLFloaterGestureObserver() {} - virtual void changed() { LLFloaterGesture::refreshAll(); } + virtual void changed() { mFloater->refreshAll(); } + +private: + LLFloaterGesture* mFloater; }; //--------------------------------------------------------------------------- // LLFloaterGesture //--------------------------------------------------------------------------- -LLFloaterGesture::LLFloaterGesture() -: LLFloater() +LLFloaterGesture::LLFloaterGesture(const LLSD& key) + : LLFloater(key) { - sObserver = new LLFloaterGestureObserver; - gGestureManager.addObserver(sObserver); + mObserver = new LLFloaterGestureObserver(this); + LLGestureManager::instance().addObserver(mObserver); + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_gesture.xml"); } // virtual LLFloaterGesture::~LLFloaterGesture() { - gGestureManager.removeObserver(sObserver); - delete sObserver; - sObserver = NULL; - - sInstance = NULL; + LLGestureManager::instance().removeObserver(mObserver); + delete mObserver; + mObserver = NULL; } // virtual @@ -107,45 +105,27 @@ BOOL LLFloaterGesture::postBuild() setTitle(label); - childSetCommitCallback("gesture_list", onCommitList, this); - getChild<LLScrollListCtrl>("gesture_list")->setDoubleClickCallback(onClickPlay, this); + getChild<LLUICtrl>("gesture_list")->setCommitCallback(boost::bind(&LLFloaterGesture::onCommitList, this)); + getChild<LLScrollListCtrl>("gesture_list")->setDoubleClickCallback(boost::bind(&LLFloaterGesture::onClickPlay, this)); - childSetAction("inventory_btn", onClickInventory, this); + getChild<LLUICtrl>("inventory_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickInventory, this)); - childSetAction("edit_btn", onClickEdit, this); + getChild<LLUICtrl>("edit_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickEdit, this)); - childSetAction("play_btn", onClickPlay, this); - childSetAction("stop_btn", onClickPlay, this); + getChild<LLUICtrl>("play_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this)); + getChild<LLUICtrl>("stop_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickPlay, this)); - childSetAction("new_gesture_btn", onClickNew, this); + getChild<LLUICtrl>("new_gesture_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickNew, this)); childSetVisible("play_btn", true); childSetVisible("stop_btn", false); setDefaultBtn("play_btn"); + + buildGestureList(); + + childSetFocus("gesture_list"); - return TRUE; -} - - -// static -void LLFloaterGesture::show() -{ - if (sInstance) - { - sInstance->openFloater(); - return; - } - - sInstance = new LLFloaterGesture(); - - // Builds and adds to gFloaterView - LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_gesture.xml"); - - sInstance->buildGestureList(); - - sInstance->childSetFocus("gesture_list"); - - LLCtrlListInterface *list = sInstance->childGetListInterface("gesture_list"); + LLCtrlListInterface *list = childGetListInterface("gesture_list"); if (list) { const BOOL ascending = TRUE; @@ -153,51 +133,34 @@ void LLFloaterGesture::show() list->selectFirstItem(); } - sInstance->mSelectedID = LLUUID::null; - // Update button labels - onCommitList(NULL, sInstance); - sInstance->openFloater(); + onCommitList(); + + return TRUE; } -// static -void LLFloaterGesture::toggleVisibility() -{ - if(sInstance && sInstance->getVisible()) - { - sInstance->closeFloater(); - } - else - { - show(); - } -} -// static void LLFloaterGesture::refreshAll() { - if (sInstance) - { - sInstance->buildGestureList(); + buildGestureList(); - LLCtrlListInterface *list = sInstance->childGetListInterface("gesture_list"); - if (!list) return; + LLCtrlListInterface *list = childGetListInterface("gesture_list"); + if (!list) return; - if (sInstance->mSelectedID.isNull()) + if (mSelectedID.isNull()) + { + list->selectFirstItem(); + } + else + { + if (! list->setCurrentByID(mSelectedID)) { list->selectFirstItem(); } - else - { - if (! list->setCurrentByID(sInstance->mSelectedID)) - { - list->selectFirstItem(); - } - } - - // Update button labels - onCommitList(NULL, sInstance); } + + // Update button labels + onCommitList(); } void LLFloaterGesture::buildGestureList() @@ -214,7 +177,7 @@ void LLFloaterGesture::buildGestureList() list->operateOnAll(LLCtrlListInterface::OP_DELETE); LLGestureManager::item_map_t::iterator it; - for (it = gGestureManager.mActive.begin(); it != gGestureManager.mActive.end(); ++it) + for (it = LLGestureManager::instance().mActive.begin(); it != LLGestureManager::instance().mActive.end(); ++it) { const LLUUID& item_id = (*it).first; LLMultiGesture* gesture = (*it).second; @@ -313,12 +276,9 @@ void LLFloaterGesture::buildGestureList() scroll->setScrollPos(current_scroll_pos); } -// static -void LLFloaterGesture::onClickInventory(void* data) +void LLFloaterGesture::onClickInventory() { - LLFloaterGesture* self = (LLFloaterGesture*)data; - - LLCtrlListInterface *list = self->childGetListInterface("gesture_list"); + LLCtrlListInterface *list = childGetListInterface("gesture_list"); if (!list) return; const LLUUID& item_id = list->getCurrentID(); @@ -327,22 +287,19 @@ void LLFloaterGesture::onClickInventory(void* data) inv->getPanel()->setSelection(item_id, TRUE); } -// static -void LLFloaterGesture::onClickPlay(void* data) +void LLFloaterGesture::onClickPlay() { - LLFloaterGesture* self = (LLFloaterGesture*)data; - - LLCtrlListInterface *list = self->childGetListInterface("gesture_list"); + LLCtrlListInterface *list = childGetListInterface("gesture_list"); if (!list) return; const LLUUID& item_id = list->getCurrentID(); - if (gGestureManager.isGesturePlaying(item_id)) + if (LLGestureManager::instance().isGesturePlaying(item_id)) { - gGestureManager.stopGesture(item_id); + LLGestureManager::instance().stopGesture(item_id); } else { - gGestureManager.playGesture(item_id); + LLGestureManager::instance().playGesture(item_id); } } @@ -355,8 +312,7 @@ public: } }; -// static -void LLFloaterGesture::onClickNew(void* data) +void LLFloaterGesture::onClickNew() { LLPointer<LLInventoryCallback> cb = new GestureShowCallback(); create_inventory_item(gAgent.getID(), gAgent.getSessionID(), @@ -365,12 +321,9 @@ void LLFloaterGesture::onClickNew(void* data) } -// static -void LLFloaterGesture::onClickEdit(void* data) +void LLFloaterGesture::onClickEdit() { - LLFloaterGesture* self = (LLFloaterGesture*)data; - - LLCtrlListInterface *list = self->childGetListInterface("gesture_list"); + LLCtrlListInterface *list = childGetListInterface("gesture_list"); if (!list) return; const LLUUID& item_id = list->getCurrentID(); @@ -380,26 +333,23 @@ void LLFloaterGesture::onClickEdit(void* data) LLPreviewGesture* previewp = LLPreviewGesture::show(item_id, LLUUID::null); if (!previewp->getHost()) { - previewp->setRect(gFloaterView->findNeighboringPosition(self, previewp)); + previewp->setRect(gFloaterView->findNeighboringPosition(this, previewp)); } } -// static -void LLFloaterGesture::onCommitList(LLUICtrl* ctrl, void* data) +void LLFloaterGesture::onCommitList() { - LLFloaterGesture* self = (LLFloaterGesture*)data; - - const LLUUID& item_id = self->childGetValue("gesture_list").asUUID(); + const LLUUID& item_id = childGetValue("gesture_list").asUUID(); - self->mSelectedID = item_id; - if (gGestureManager.isGesturePlaying(item_id)) + mSelectedID = item_id; + if (LLGestureManager::instance().isGesturePlaying(item_id)) { - self->childSetVisible("play_btn", false); - self->childSetVisible("stop_btn", true); + childSetVisible("play_btn", false); + childSetVisible("stop_btn", true); } else { - self->childSetVisible("play_btn", true); - self->childSetVisible("stop_btn", false); + childSetVisible("play_btn", true); + childSetVisible("stop_btn", false); } } diff --git a/indra/newview/llfloatergesture.h b/indra/newview/llfloatergesture.h index f7c4e558ac..9c1ab27cb0 100644 --- a/indra/newview/llfloatergesture.h +++ b/indra/newview/llfloatergesture.h @@ -56,32 +56,28 @@ class LLFloaterGesture : public LLFloater { public: - LLFloaterGesture(); + LLFloaterGesture(const LLSD& key); virtual ~LLFloaterGesture(); virtual BOOL postBuild(); - static void show(); - static void toggleVisibility(); - static void refreshAll(); + void refreshAll(); protected: // Reads from the gesture manager's list of active gestures // and puts them in this list. void buildGestureList(); - static void onClickInventory(void* data); - static void onClickEdit(void* data); - static void onClickPlay(void* data); - static void onClickNew(void* data); - static void onCommitList(LLUICtrl* ctrl, void* data); + void onClickInventory(); + void onClickEdit(); + void onClickPlay(); + void onClickNew(); + void onCommitList(); protected: LLUUID mSelectedID; - static LLFloaterGesture* sInstance; - static LLFloaterGestureObserver* sObserver; - static LLFloaterGestureInventoryObserver* sInventoryObserver; + LLFloaterGestureObserver* mObserver; }; diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index 6d603fa5c8..886f5ec924 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -186,15 +186,6 @@ void LLFloaterGodTools::updatePopup(LLCoordGL center, MASK mask) } // virtual -void LLFloaterGodTools::onClose(bool app_quitting) -{ - LLFloaterGodTools* god_tools = LLFloaterReg::getTypedInstance<LLFloaterGodTools>("god_tools"); - if(!god_tools) return; - god_tools->setVisible(FALSE); - -} - -// virtual void LLFloaterGodTools::draw() { if (mCurrentHost == LLHost::invalid) diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h index 2564b15b37..ebab1fde11 100644 --- a/indra/newview/llfloatergodtools.h +++ b/indra/newview/llfloatergodtools.h @@ -81,7 +81,6 @@ public: void showPanel(const std::string& panel_name); virtual void onOpen(const LLSD& key); - virtual void onClose(bool app_quitting); virtual void draw(); diff --git a/indra/newview/llfloatergroupinvite.cpp b/indra/newview/llfloatergroupinvite.cpp index 92db0b0926..3598479305 100644 --- a/indra/newview/llfloatergroupinvite.cpp +++ b/indra/newview/llfloatergroupinvite.cpp @@ -79,7 +79,7 @@ void LLFloaterGroupInvite::impl::closeFloater(void* data) // Implementation //----------------------------------------------------------------------------- LLFloaterGroupInvite::LLFloaterGroupInvite(const LLUUID& group_id) -: LLFloater() +: LLFloater(group_id) { static LLUICachedControl<S32> floater_header_size ("UIFloaterHeaderSize", 0); LLRect contents; diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index a967a1833f..7f03d63b3e 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -53,9 +53,6 @@ using namespace LLOldEvents; -// static -std::map<const LLUUID, LLFloaterGroupPicker*> LLFloaterGroupPicker::sInstances; - // helper functions void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 powers_mask = GP_ALL_POWERS); @@ -63,36 +60,16 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 pow /// Class LLFloaterGroupPicker ///---------------------------------------------------------------------------- -// static -LLFloaterGroupPicker* LLFloaterGroupPicker::findInstance(const LLSD& seed) -{ - instance_map_t::iterator found_it = sInstances.find(seed.asUUID()); - if (found_it != sInstances.end()) - { - return found_it->second; - } - return NULL; -} - -// static -LLFloaterGroupPicker* LLFloaterGroupPicker::createInstance(const LLSD &seed) -{ - LLFloaterGroupPicker* pickerp = new LLFloaterGroupPicker(seed); - return pickerp; -} - LLFloaterGroupPicker::LLFloaterGroupPicker(const LLSD& seed) -: LLFloater(), - mPowersMask(GP_ALL_POWERS) +: LLFloater(seed), + mPowersMask(GP_ALL_POWERS), + mID(seed.asUUID()) { - mID = seed.asUUID(); - sInstances.insert(std::make_pair(mID, this)); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_choose_group.xml"); +// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_choose_group.xml"); } LLFloaterGroupPicker::~LLFloaterGroupPicker() { - sInstances.erase(mID); } void LLFloaterGroupPicker::setPowersMask(U64 powers_mask) diff --git a/indra/newview/llfloatergroups.h b/indra/newview/llfloatergroups.h index 0425b81294..489238356d 100644 --- a/indra/newview/llfloatergroups.h +++ b/indra/newview/llfloatergroups.h @@ -56,10 +56,10 @@ class LLScrollListCtrl; class LLButton; class LLFloaterGroupPicker; -class LLFloaterGroupPicker : public LLFloater, public LLUIFactory<LLFloaterGroupPicker, LLFloaterGroupPicker, VisibilityPolicy<LLFloater> > +class LLFloaterGroupPicker : public LLFloater { - friend class LLUIFactory<LLFloaterGroupPicker>; public: + LLFloaterGroupPicker(const LLSD& seed); ~LLFloaterGroupPicker(); // Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots @@ -73,7 +73,6 @@ public: static LLFloaterGroupPicker* createInstance(const LLSD& seed); protected: - LLFloaterGroupPicker(const LLSD& seed); void ok(); static void onBtnOK(void* userdata); static void onBtnCancel(void* userdata); diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index 8121a1cc10..3c3508b65c 100644 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -49,12 +49,10 @@ #include "llwindow.h" #include "llslider.h" -LLFloaterHardwareSettings* LLFloaterHardwareSettings::sHardwareSettings = NULL; - -LLFloaterHardwareSettings::LLFloaterHardwareSettings() - : LLFloater() +LLFloaterHardwareSettings::LLFloaterHardwareSettings(const LLSD& key) + : LLFloater(key) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hardware_settings.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hardware_settings.xml"); } LLFloaterHardwareSettings::~LLFloaterHardwareSettings() @@ -109,48 +107,6 @@ void LLFloaterHardwareSettings::refreshEnabledState() } -// static instance of it -LLFloaterHardwareSettings* LLFloaterHardwareSettings::instance() -{ - if (!sHardwareSettings) - { - sHardwareSettings = new LLFloaterHardwareSettings(); - sHardwareSettings->closeFloater(); - } - return sHardwareSettings; -} -void LLFloaterHardwareSettings::show() -{ - LLFloaterHardwareSettings* hardSettings = instance(); - hardSettings->refresh(); - hardSettings->center(); - - // comment in if you want the menu to rebuild each time - //LLUICtrlFactory::getInstance()->buildFloater(hardSettings, "floater_hardware_settings.xml"); - //hardSettings->initCallbacks(); - - hardSettings->openFloater(); -} - -bool LLFloaterHardwareSettings::isOpen() -{ - if (sHardwareSettings != NULL) - { - return true; - } - return false; -} - -// virtual -void LLFloaterHardwareSettings::onClose(bool app_quitting) -{ - if (sHardwareSettings) - { - sHardwareSettings->setVisible(FALSE); - } -} - - //============================================================================ BOOL LLFloaterHardwareSettings::postBuild() @@ -158,6 +114,7 @@ BOOL LLFloaterHardwareSettings::postBuild() childSetAction("OK", onBtnOK, this); refresh(); + center(); // load it up initCallbacks(); diff --git a/indra/newview/llfloaterhardwaresettings.h b/indra/newview/llfloaterhardwaresettings.h index ec99638740..3f19d89cbb 100644 --- a/indra/newview/llfloaterhardwaresettings.h +++ b/indra/newview/llfloaterhardwaresettings.h @@ -42,7 +42,7 @@ class LLFloaterHardwareSettings : public LLFloater public: - LLFloaterHardwareSettings(); + LLFloaterHardwareSettings(const LLSD& key); /*virtual*/ ~LLFloaterHardwareSettings(); /*virtual*/ BOOL postBuild(); @@ -50,9 +50,6 @@ public: /// initialize all the callbacks for the menu void initCallbacks(void); - /// one and one instance only - static LLFloaterHardwareSettings* instance(); - /// callback for the menus help button static void onClickHelp(void* data); @@ -67,9 +64,6 @@ public: /// return if the menu exists or not static bool isOpen(); - /// stuff to do on exit - virtual void onClose(bool app_quitting); - /// sync up menu with parameters void refresh(); @@ -92,8 +86,6 @@ protected: BOOL mProbeHardwareOnStartup; private: - // one instance on the inside - static LLFloaterHardwareSettings* sHardwareSettings; }; #endif diff --git a/indra/newview/llfloaterhud.cpp b/indra/newview/llfloaterhud.cpp index dd70560bb7..4dcf726c9a 100644 --- a/indra/newview/llfloaterhud.cpp +++ b/indra/newview/llfloaterhud.cpp @@ -101,12 +101,3 @@ BOOL LLFloaterHUD::postBuild() LLFloaterHUD::~LLFloaterHUD() { } -// Save our visibility state on close in case the user accidentally -// quit the application while the tutorial was visible. -// virtual -void LLFloaterHUD::onClose(bool app_quitting) -{ - bool stay_visible = app_quitting; - gSavedSettings.setBOOL("ShowTutorial", stay_visible); - destroy(); -} diff --git a/indra/newview/llfloaterhud.h b/indra/newview/llfloaterhud.h index 33ed9faa67..4772735afc 100644 --- a/indra/newview/llfloaterhud.h +++ b/indra/newview/llfloaterhud.h @@ -42,8 +42,6 @@ class LLFloaterHUD : public LLFloater friend class LLFloaterReg; public: - // Save our visibility state during close - /*virtual*/ void onClose(bool app_quitting); BOOL postBuild(); private: diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 26b969224e..07dbf98a1e 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -59,9 +59,6 @@ #include "llviewertexturelist.h" #include "llstring.h" -//static -S32 LLFloaterImagePreview::sUploadAmount = 10; - const S32 PREVIEW_BORDER_WIDTH = 2; const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH; const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; @@ -93,9 +90,7 @@ BOOL LLFloaterImagePreview::postBuild() { return FALSE; } - - childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d",sUploadAmount)); - + LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface) { @@ -130,7 +125,9 @@ BOOL LLFloaterImagePreview::postBuild() childDisable("clothing_type_combo"); childDisable("ok_btn"); } - + + getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); + return TRUE; } diff --git a/indra/newview/llfloaterimagepreview.h b/indra/newview/llfloaterimagepreview.h index e2781b8231..f007697e88 100644 --- a/indra/newview/llfloaterimagepreview.h +++ b/indra/newview/llfloaterimagepreview.h @@ -121,7 +121,6 @@ public: BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); static void onMouseCaptureLostImagePreview(LLMouseHandler*); - static void setUploadAmount(S32 amount) { sUploadAmount = amount; } void clearAllPreviewTextures(); @@ -139,7 +138,6 @@ protected: LLRectf mPreviewImageRect; LLPointer<LLViewerTexture> mImagep ; - static S32 sUploadAmount; }; #endif // LL_LLFLOATERIMAGEPREVIEW_H diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 2256120362..e26937e93f 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -35,7 +35,6 @@ #include "llfloaterinspect.h" #include "llfloaterreg.h" -#include "llfloateravatarinfo.h" #include "llfloatertools.h" #include "llavataractions.h" #include "llcachename.h" diff --git a/indra/newview/llfloaterinventory.cpp b/indra/newview/llfloaterinventory.cpp index cf78d7d34f..a486ef565a 100644 --- a/indra/newview/llfloaterinventory.cpp +++ b/indra/newview/llfloaterinventory.cpp @@ -50,7 +50,6 @@ // newview includes #include "llappviewer.h" #include "llfirstuse.h" -#include "llfloateravatarinfo.h" #include "llfloaterchat.h" #include "llfloatercustomize.h" #include "llfocusmgr.h" @@ -96,11 +95,11 @@ LLUUID LLFloaterInventory::sWearNewClothingTransactionID; ///---------------------------------------------------------------------------- LLFloaterInventoryFinder::LLFloaterInventoryFinder(LLFloaterInventory* inventory_view) -: LLFloater(), +: LLFloater(LLSD()), mFloaterInventory(inventory_view), mFilter(inventory_view->mActivePanel->getFilter()) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inventory_view_finder.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inventory_view_finder.xml", NULL); updateElementsFromFilter(); } @@ -298,21 +297,6 @@ void LLFloaterInventoryFinder::draw() LLFloater::draw(); } -void LLFloaterInventoryFinder::onClose(bool app_quitting) -{ - gSavedSettings.setBOOL("Inventory.ShowFilters", FALSE); - // If you want to reset the filter on close, do it here. This functionality was - // hotly debated - Paulm -#if 0 - if (mFloaterInventory) - { - LLFloaterInventory::onResetFilter((void *)mFloaterInventory); - } -#endif - destroy(); -} - - BOOL LLFloaterInventoryFinder::getCheckShowEmpty() { return childGetValue("check_show_empty"); @@ -451,7 +435,7 @@ LLFloaterInventory::LLFloaterInventory(const LLSD& key) mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLAssetType::AT_TRASH)); mCommitCallbackRegistrar.add("Inventory.EmptyLostAndFound", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyLostAndFound", LLAssetType::AT_LOST_AND_FOUND)); mCommitCallbackRegistrar.add("Inventory.DoCreate", boost::bind(&LLFloaterInventory::doCreate, this, _2)); - mCommitCallbackRegistrar.add("Inventory.NewWindow", boost::bind(&LLFloaterInventory::newWindow, this)); +// mCommitCallbackRegistrar.add("Inventory.NewWindow", boost::bind(&LLFloaterInventory::newWindow, this)); mCommitCallbackRegistrar.add("Inventory.ShowFilters", boost::bind(&LLFloaterInventory::toggleFindOptions, this)); mCommitCallbackRegistrar.add("Inventory.ResetFilters", boost::bind(&LLFloaterInventory::resetFilters, this)); mCommitCallbackRegistrar.add("Inventory.SetSortBy", boost::bind(&LLFloaterInventory::setSortBy, this, _2)); @@ -463,7 +447,6 @@ LLFloaterInventory::LLFloaterInventory(const LLSD& key) BOOL sort_folders_by_name = ( sort_order & LLInventoryFilter::SO_FOLDERS_BY_NAME ); BOOL sort_system_folders_to_top = ( sort_order & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP ); - gSavedSettings.declareBOOL("Inventory.ShowFilters", FALSE, "Declared in code", FALSE); gSavedSettings.declareBOOL("Inventory.SortByName", sort_by_name, "Declared in code", FALSE); gSavedSettings.declareBOOL("Inventory.SortByDate", !sort_by_name, "Declared in code", FALSE); gSavedSettings.declareBOOL("Inventory.FoldersAlwaysByName", sort_folders_by_name, "Declared in code", FALSE); @@ -598,10 +581,6 @@ void LLFloaterInventory::draw() title << mFilterText; setTitle(title.str()); } - if (mActivePanel && mFilterEditor) - { - mFilterEditor->setText(mActivePanel->getFilterSubString()); - } LLFloater::draw(); } @@ -679,36 +658,11 @@ void LLFloaterInventory::startSearch() } } -// virtual, from LLView -void LLFloaterInventory::setVisible( BOOL visible ) -{ - LLFloater::setVisible(visible); -} - void LLFloaterInventory::onOpen(const LLSD& key) { LLFirstUse::useInventory(); } -// Destroy all but the last floater, which is made invisible. -void LLFloaterInventory::onClose(bool app_quitting) -{ - if (getKey().asInteger() != 0) - { - destroy(); - } - else - { - // clear filters, but save user's folder state first - if (!mActivePanel->getRootFolder()->isFilterModified()) - { - mSavedFolderState->setApply(FALSE); - mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); - } - setVisible(FALSE); - } -} - BOOL LLFloaterInventory::handleKeyHere(KEY key, MASK mask) { LLFolderView* root_folder = mActivePanel ? mActivePanel->getRootFolder() : NULL; @@ -755,14 +709,6 @@ void LLFloaterInventory::changed(U32 mask) } -//static -LLFloaterInventory* LLFloaterInventory::newInstance() -{ - LLMemType mt(LLMemType::MTYPE_INVENTORY_VIEW_SHOW); - static S32 inst_count = 1; - return LLFloaterReg::getTypedInstance<LLFloaterInventory>("inventory", LLSD(inst_count++)); -} - //---------------------------------------------------------------------------- // menu callbacks @@ -781,17 +727,6 @@ void LLFloaterInventory::doCreate(const LLSD& userdata) menu_create_inventory_item(getPanel()->getRootFolder(), NULL, userdata); } -void LLFloaterInventory::newWindow() -{ - LLFloaterInventory* iv = newInstance(); - iv->getActivePanel()->setFilterTypes(getActivePanel()->getFilterTypes()); - iv->getActivePanel()->setFilterSubString(getActivePanel()->getFilterSubString()); - iv->openFloater(); - - // force onscreen - gFloaterView->adjustToFitScreen(iv, FALSE); -} - void LLFloaterInventory::resetFilters() { LLFloaterInventoryFinder *finder = getFinder(); @@ -921,14 +856,10 @@ void LLFloaterInventory::toggleFindOptions() // start background fetch of folders gInventory.startBackgroundFetch(); - - gSavedSettings.setBOOL("Inventory.ShowFilters", TRUE); } else { floater->closeFloater(); - - gSavedSettings.setBOOL("Inventory.ShowFilters", FALSE); } } @@ -979,8 +910,7 @@ void LLFloaterInventory::onFilterEdit(const std::string& search_string ) gInventory.startBackgroundFetch(); - std::string filter_text = search_string; - std::string uppercase_search_string = filter_text; + std::string uppercase_search_string = search_string; LLStringUtil::toUpper(uppercase_search_string); if (mActivePanel->getFilterSubString().empty() && uppercase_search_string.empty()) { diff --git a/indra/newview/llfloaterinventory.h b/indra/newview/llfloaterinventory.h index 35ac1ab380..734ab5032e 100644 --- a/indra/newview/llfloaterinventory.h +++ b/indra/newview/llfloaterinventory.h @@ -188,7 +188,6 @@ class LLFloaterInventoryFinder : public LLFloater public: LLFloaterInventoryFinder( LLFloaterInventory* inventory_view); virtual void draw(); - virtual void onClose(bool app_quitting); /*virtual*/ BOOL postBuild(); void changeFilter(LLInventoryFilter* filter); void updateElementsFromFilter(); @@ -226,9 +225,6 @@ public: void setFilterTextFromFilter() { mFilterText = mActivePanel->getFilter()->getFilterText(); } void startSearch(); - // Spawn a new inventory view - static LLFloaterInventory* newInstance(); - // This method makes sure that an inventory view exists, is // visible, and has focus. The view chosen is returned. static LLFloaterInventory* showAgentInventory(); @@ -248,8 +244,6 @@ public: // LLView & LLFloater functionality virtual void onOpen(const LLSD& key); - virtual void onClose(bool app_quitting); - virtual void setVisible(BOOL visible); virtual void draw(); virtual BOOL handleKeyHere(KEY key, MASK mask); @@ -278,7 +272,6 @@ public: void doToSelected(const LLSD& userdata); void closeAllFolders(); void doCreate(const LLSD& userdata); - void newWindow(); void resetFilters(); void setSortBy(const LLSD& userdata); diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 149df61b35..63ac44da4f 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -204,21 +204,16 @@ void LLFloaterLand::onOpen(const LLSD& key) refresh(); } - -// virtual -void LLFloaterLand::onClose(bool app_quitting) +void LLFloaterLand::onVisibilityChange(const LLSD& visible) { - LLViewerParcelMgr::getInstance()->removeObserver( sObserver ); - delete sObserver; - sObserver = NULL; - - // Might have been showing owned objects - LLSelectMgr::getInstance()->unhighlightAll(); - - // Save which panel we had open - sLastTab = mTabLand->getCurrentPanelIndex(); + if (!visible.asBoolean()) + { + // Might have been showing owned objects + LLSelectMgr::getInstance()->unhighlightAll(); - destroy(); + // Save which panel we had open + sLastTab = mTabLand->getCurrentPanelIndex(); + } } @@ -239,7 +234,9 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed) } BOOL LLFloaterLand::postBuild() -{ +{ + mVisibleSignal.connect(boost::bind(&LLFloaterLand::onVisibilityChange, this, _2)); + LLTabContainer* tab = getChild<LLTabContainer>("landtab"); mTabLand = (LLTabContainer*) tab; @@ -256,6 +253,9 @@ BOOL LLFloaterLand::postBuild() // virtual LLFloaterLand::~LLFloaterLand() { + LLViewerParcelMgr::getInstance()->removeObserver( sObserver ); + delete sObserver; + sObserver = NULL; } // public @@ -781,18 +781,18 @@ void LLPanelLandGeneral::draw() void LLPanelLandGeneral::onClickSetGroup() { - LLFloaterGroupPicker* fg; - LLFloater* parent_floater = gFloaterView->getParentFloater(this); - fg = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); - fg->setSelectGroupCallback( boost::bind(&LLPanelLandGeneral::setGroup, this, _1 )); - - if (parent_floater) + LLFloaterGroupPicker* fg = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID())); + if (fg) { - LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg); - fg->setOrigin(new_rect.mLeft, new_rect.mBottom); - parent_floater->addDependentFloater(fg); + fg->setSelectGroupCallback( boost::bind(&LLPanelLandGeneral::setGroup, this, _1 )); + if (parent_floater) + { + LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg); + fg->setOrigin(new_rect.mLeft, new_rect.mBottom); + parent_floater->addDependentFloater(fg); + } } } diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index 8f86766e3d..7fc5ed0c9e 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -81,8 +81,6 @@ public: static LLPanelLandObjects* getCurrentPanelLandObjects(); static LLPanelLandCovenant* getCurrentPanelLandCovenant(); - // Destroys itself on close. - virtual void onClose(bool app_quitting); virtual void onOpen(const LLSD& key); virtual BOOL postBuild(); @@ -91,6 +89,8 @@ private: // to allocate or destroy. LLFloaterLand(const LLSD& seed); virtual ~LLFloaterLand(); + + void onVisibilityChange(const LLSD& visible); protected: diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index fbefd40c60..de3cd5d4e3 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -56,46 +56,16 @@ #include "llviewermessage.h" #include "lluictrlfactory.h" -// statics -LLFloaterLandHoldings* LLFloaterLandHoldings::sInstance = NULL; - - -// static -void LLFloaterLandHoldings::show(void*) -{ - LLFloaterLandHoldings* floater = new LLFloaterLandHoldings(); - LLUICtrlFactory::getInstance()->buildFloater(floater, "floater_land_holdings.xml"); - floater->center(); - - // query_id null is known to be us - const LLUUID& query_id = LLUUID::null; - - // look only for parcels we own - U32 query_flags = DFQ_AGENT_OWNED; - - send_places_query(query_id, - LLUUID::null, - "", - query_flags, - LLParcel::C_ANY, - ""); - - // TODO: request updated L$ balance? - floater->openFloater(); -} - - // protected -LLFloaterLandHoldings::LLFloaterLandHoldings() -: LLFloater(), +LLFloaterLandHoldings::LLFloaterLandHoldings(const LLSD& key) +: LLFloater(key), mActualArea(0), mBillableArea(0), mFirstPacketReceived(FALSE), mSortColumn(""), mSortAscending(TRUE) { - // Instance management. - sInstance = this; +// LLUICtrlFactory::getInstance()->buildFloater(floater, "floater_land_holdings.xml"); } BOOL LLFloaterLandHoldings::postBuild() @@ -128,7 +98,9 @@ BOOL LLFloaterLandHoldings::postBuild() list->addElement(element, ADD_SORTED); } - + + center(); + return TRUE; } @@ -136,9 +108,23 @@ BOOL LLFloaterLandHoldings::postBuild() // protected LLFloaterLandHoldings::~LLFloaterLandHoldings() { - sInstance = NULL; } +void LLFloaterLandHoldings::onOpen(const LLSD& key) +{ + // query_id null is known to be us + const LLUUID& query_id = LLUUID::null; + + // look only for parcels we own + U32 query_flags = DFQ_AGENT_OWNED; + + send_places_query(query_id, + LLUUID::null, + "", + query_flags, + LLParcel::C_ANY, + ""); +} void LLFloaterLandHoldings::draw() { @@ -168,7 +154,7 @@ void LLFloaterLandHoldings::refresh() // static void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**) { - LLFloaterLandHoldings* self = sInstance; + LLFloaterLandHoldings* self = LLFloaterReg::findTypedInstance<LLFloaterLandHoldings>("land_holdings"); // Is this packet from an old, closed window? if (!self) @@ -224,50 +210,53 @@ void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**) land_type = LLTrans::getString("land_type_unknown"); } - self->mActualArea += actual_area; - self->mBillableArea += billable_area; - - S32 region_x = llround(global_x) % REGION_WIDTH_UNITS; - S32 region_y = llround(global_y) % REGION_WIDTH_UNITS; - - std::string location; - location = llformat("%s (%d, %d)", sim_name.c_str(), region_x, region_y); - - std::string area; - if(billable_area == actual_area) + if(owner_id.notNull()) { - area = llformat("%d", billable_area); + self->mActualArea += actual_area; + self->mBillableArea += billable_area; + + S32 region_x = llround(global_x) % REGION_WIDTH_UNITS; + S32 region_y = llround(global_y) % REGION_WIDTH_UNITS; + + std::string location; + location = llformat("%s (%d, %d)", sim_name.c_str(), region_x, region_y); + + std::string area; + if(billable_area == actual_area) + { + area = llformat("%d", billable_area); + } + else + { + area = llformat("%d / %d", billable_area, actual_area); + } + + std::string hidden; + hidden = llformat("%f %f", global_x, global_y); + + LLSD element; + element["columns"][0]["column"] = "name"; + element["columns"][0]["value"] = name; + element["columns"][0]["font"] = "SANSSERIF"; + + element["columns"][1]["column"] = "location"; + element["columns"][1]["value"] = location; + element["columns"][1]["font"] = "SANSSERIF"; + + element["columns"][2]["column"] = "area"; + element["columns"][2]["value"] = area; + element["columns"][2]["font"] = "SANSSERIF"; + + element["columns"][3]["column"] = "type"; + element["columns"][3]["value"] = land_type; + element["columns"][3]["font"] = "SANSSERIF"; + + // hidden is always last column + element["columns"][4]["column"] = "hidden"; + element["columns"][4]["value"] = hidden; + + list->addElement(element); } - else - { - area = llformat("%d / %d", billable_area, actual_area); - } - - std::string hidden; - hidden = llformat("%f %f", global_x, global_y); - - LLSD element; - element["columns"][0]["column"] = "name"; - element["columns"][0]["value"] = name; - element["columns"][0]["font"] = "SANSSERIF"; - - element["columns"][1]["column"] = "location"; - element["columns"][1]["value"] = location; - element["columns"][1]["font"] = "SANSSERIF"; - - element["columns"][2]["column"] = "area"; - element["columns"][2]["value"] = area; - element["columns"][2]["font"] = "SANSSERIF"; - - element["columns"][3]["column"] = "type"; - element["columns"][3]["value"] = land_type; - element["columns"][3]["font"] = "SANSSERIF"; - - // hidden is always last column - element["columns"][4]["column"] = "hidden"; - element["columns"][4]["value"] = hidden; - - list->addElement(element); } self->refreshAggregates(); diff --git a/indra/newview/llfloaterlandholdings.h b/indra/newview/llfloaterlandholdings.h index def77cf2a8..471ddf7f44 100644 --- a/indra/newview/llfloaterlandholdings.h +++ b/indra/newview/llfloaterlandholdings.h @@ -44,10 +44,11 @@ class LLFloaterLandHoldings : public LLFloater { public: - BOOL postBuild(); - - static void show(void*); - + LLFloaterLandHoldings(const LLSD& key); + virtual ~LLFloaterLandHoldings(); + + virtual BOOL postBuild(); + virtual void onOpen(const LLSD& key); virtual void draw(); void refresh(); @@ -63,14 +64,9 @@ public: static void onGrantList(void* data); protected: - LLFloaterLandHoldings(); - virtual ~LLFloaterLandHoldings(); - void refreshAggregates(); protected: - static LLFloaterLandHoldings* sInstance; - // Sum up as packets arrive the total holdings S32 mActualArea; S32 mBillableArea; diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 6ef72d4c1a..ed7d2c71ea 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -69,15 +69,12 @@ const S32 PREF_BUTTON_HEIGHT = 16; //----------------------------------------------------------------------------- // LLFloaterNameDesc() //----------------------------------------------------------------------------- -LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename ) - : LLFloater() +LLFloaterNameDesc::LLFloaterNameDesc(const LLSD& filename ) + : LLFloater(filename), + mIsAudio(FALSE) { - setTitle("Name/Description Floater"); - mFilenameAndPath = filename; - mFilename = gDirUtilp->getBaseFileName(filename, false); - // SL-5521 Maintain capitalization of filename when making the inventory item. JC - //LLStringUtil::toLower(mFilename); - mIsAudio = FALSE; + mFilenameAndPath = filename.asString(); + mFilename = gDirUtilp->getBaseFileName(mFilenameAndPath, false); } //----------------------------------------------------------------------------- @@ -93,11 +90,6 @@ BOOL LLFloaterNameDesc::postBuild() LLStringUtil::stripNonprintable(asset_name); LLStringUtil::trim(asset_name); - std::string exten = gDirUtilp->getExtension(asset_name); - if (exten == "wav") - { - mIsAudio = TRUE; - } asset_name = gDirUtilp->getBaseFileName(asset_name, true); // no extsntion setTitle(mFilename); @@ -112,7 +104,7 @@ BOOL LLFloaterNameDesc::postBuild() r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT ); - childSetCommitCallback("name_form", doCommit, this); + getChild<LLUICtrl>("name_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this)); childSetValue("name_form", LLSD(asset_name)); LLLineEditor *NameEditor = getChild<LLLineEditor>("name_form"); @@ -126,7 +118,7 @@ BOOL LLFloaterNameDesc::postBuild() y -= PREVIEW_LINE_HEIGHT; r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT ); - childSetCommitCallback("description_form", doCommit, this); + getChild<LLUICtrl>("description_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this)); LLLineEditor *DescEditor = getChild<LLLineEditor>("description_form"); if (DescEditor) { @@ -137,12 +129,12 @@ BOOL LLFloaterNameDesc::postBuild() y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f); // Cancel button - childSetAction("cancel_btn", onBtnCancel, this); + getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this)); - // OK button - childSetAction("ok_btn", onBtnOK, this); + childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload() )); + setDefaultBtn("ok_btn"); - + return TRUE; } @@ -162,45 +154,59 @@ void LLFloaterNameDesc::onCommit() { } -// static //----------------------------------------------------------------------------- // onCommit() //----------------------------------------------------------------------------- -void LLFloaterNameDesc::doCommit( class LLUICtrl *, void* userdata ) +void LLFloaterNameDesc::doCommit() { - LLFloaterNameDesc* self = (LLFloaterNameDesc*) userdata; - self->onCommit(); + onCommit(); } -// static //----------------------------------------------------------------------------- // onBtnOK() //----------------------------------------------------------------------------- -void LLFloaterNameDesc::onBtnOK( void* userdata ) +void LLFloaterNameDesc::onBtnOK( ) { - LLFloaterNameDesc *fp =(LLFloaterNameDesc *)userdata; - - fp->childDisable("ok_btn"); // don't allow inadvertent extra uploads + childDisable("ok_btn"); // don't allow inadvertent extra uploads LLAssetStorage::LLStoreAssetCallback callback = NULL; S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). void *nruserdata = NULL; std::string display_name = LLStringUtil::null; - upload_new_resource(fp->mFilenameAndPath, // file - fp->childGetValue("name_form").asString(), - fp->childGetValue("description_form").asString(), + upload_new_resource(mFilenameAndPath, // file + childGetValue("name_form").asString(), + childGetValue("description_form").asString(), 0, LLAssetType::AT_NONE, LLInventoryType::IT_NONE, LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), display_name, callback, expected_upload_cost, nruserdata); - fp->closeFloater(false); + closeFloater(false); } -// static //----------------------------------------------------------------------------- // onBtnCancel() //----------------------------------------------------------------------------- -void LLFloaterNameDesc::onBtnCancel( void* userdata ) +void LLFloaterNameDesc::onBtnCancel() { - LLFloaterNameDesc *fp =(LLFloaterNameDesc *)userdata; - fp->closeFloater(false); + closeFloater(false); +} + + +//----------------------------------------------------------------------------- +// LLFloaterSoundPreview() +//----------------------------------------------------------------------------- + +LLFloaterSoundPreview::LLFloaterSoundPreview(const LLSD& filename ) + : LLFloaterNameDesc(filename) +{ + mIsAudio = TRUE; +} + +BOOL LLFloaterSoundPreview::postBuild() +{ + if (!LLFloaterNameDesc::postBuild()) + { + return FALSE; + } + getChild<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); + return TRUE; } diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h index 6aa19eba40..2cc7f1101d 100644 --- a/indra/newview/llfloaternamedesc.h +++ b/indra/newview/llfloaternamedesc.h @@ -44,11 +44,14 @@ class LLRadioGroup; class LLFloaterNameDesc : public LLFloater { public: - LLFloaterNameDesc(const std::string& filename); + LLFloaterNameDesc(const LLSD& filename); virtual ~LLFloaterNameDesc(); virtual BOOL postBuild(); - - static void doCommit(class LLUICtrl *, void* userdata); + + void onBtnOK(); + void onBtnCancel(); + void doCommit(); + protected: virtual void onCommit(); @@ -57,9 +60,13 @@ protected: std::string mFilenameAndPath; std::string mFilename; - - static void onBtnOK(void*); - static void onBtnCancel(void*); }; +class LLFloaterSoundPreview : public LLFloaterNameDesc +{ +public: + LLFloaterSoundPreview(const LLSD& filename ); + virtual BOOL postBuild(); +}; + #endif // LL_LLFLOATERNAMEDESC_H diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp index f06af5ca1e..7042882084 100644 --- a/indra/newview/llfloaternotificationsconsole.cpp +++ b/indra/newview/llfloaternotificationsconsole.cpp @@ -168,13 +168,6 @@ LLFloaterNotificationConsole::LLFloaterNotificationConsole(const LLSD& key) //LLUICtrlFactory::instance().buildFloater(this, "floater_notifications_console.xml"); } -void LLFloaterNotificationConsole::onClose(bool app_quitting) -{ - setVisible(FALSE); - //destroy(); -} - - BOOL LLFloaterNotificationConsole::postBuild() { // these are in the order of processing @@ -251,10 +244,10 @@ void LLFloaterNotificationConsole::onClickAdd() //=============== LLFloaterNotification ================ LLFloaterNotification::LLFloaterNotification(LLNotification* note) -: LLFloater(), +: LLFloater(LLSD()), mNote(note) { - LLUICtrlFactory::instance().buildFloater(this, "floater_notification.xml"); + LLUICtrlFactory::instance().buildFloater(this, "floater_notification.xml", NULL); } BOOL LLFloaterNotification::postBuild() diff --git a/indra/newview/llfloaternotificationsconsole.h b/indra/newview/llfloaternotificationsconsole.h index fe161e66f0..7349ff1d8f 100644 --- a/indra/newview/llfloaternotificationsconsole.h +++ b/indra/newview/llfloaternotificationsconsole.h @@ -46,7 +46,6 @@ public: // LLPanel BOOL postBuild(); - void onClose(bool app_quitting); void addChannel(const std::string& type, bool open = false); void updateResizeLimits(LLLayoutStack &stack); @@ -71,7 +70,6 @@ public: // LLPanel BOOL postBuild(); void respond(); - void onClose(bool app_quitting) { setVisible(FALSE); } private: static void onCommitResponse(LLUICtrl* ctrl, void* data) { ((LLFloaterNotification*)data)->respond(); } diff --git a/indra/newview/llfloaterparcel.cpp b/indra/newview/llfloaterparcel.cpp index fa7403874e..af42ce4f4a 100644 --- a/indra/newview/llfloaterparcel.cpp +++ b/indra/newview/llfloaterparcel.cpp @@ -35,6 +35,8 @@ #include "llfloaterparcel.h" +#include "llfloaterreg.h" + // viewer project includes #include "llcommandhandler.h" #include "llpanelplace.h" @@ -47,8 +49,6 @@ // Globals //----------------------------------------------------------------------------- -LLMap< const LLUUID, LLFloaterParcelInfo* > gPlaceInfoInstances; - class LLParcelHandler : public LLCommandHandler { public: @@ -68,8 +68,11 @@ public: } if (params[1].asString() == "about") { - LLFloaterParcelInfo::show(parcel_id); - return true; + if (parcel_id.notNull()) + { + LLFloaterReg::showInstance("parcel_info", LLSD(parcel_id)); + return true; + } } return false; } @@ -82,7 +85,7 @@ LLParcelHandler gParcelHandler; //---------------------------------------------------------------------------- -void* LLFloaterParcelInfo::createPanelPlace(void* data) +void* LLFloaterParcelInfo::createPanelPlace(void* data) { LLFloaterParcelInfo* self = (LLFloaterParcelInfo*)data; self->mPanelParcelp = new LLPanelPlace(); // allow edit self @@ -93,54 +96,29 @@ void* LLFloaterParcelInfo::createPanelPlace(void* data) //---------------------------------------------------------------------------- -LLFloaterParcelInfo::LLFloaterParcelInfo(const LLUUID &parcel_id) -: LLFloater(), - mParcelID( parcel_id ) +LLFloaterParcelInfo::LLFloaterParcelInfo(const LLSD& parcel_id) +: LLFloater(parcel_id), + mParcelID( parcel_id.asUUID() ), + mPanelParcelp(NULL) { mFactoryMap["place_details_panel"] = LLCallbackMap(LLFloaterParcelInfo::createPanelPlace, this); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_url.xml"); - gPlaceInfoInstances.addData(parcel_id, this); +// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_url.xml"); } // virtual LLFloaterParcelInfo::~LLFloaterParcelInfo() { - // child views automatically deleted - gPlaceInfoInstances.removeData(mParcelID); - -} -void LLFloaterParcelInfo::displayParcelInfo(const LLUUID& parcel_id) -{ - mPanelParcelp->setParcelID(parcel_id); } -// static -LLFloaterParcelInfo* LLFloaterParcelInfo::show(const LLUUID &parcel_id) +BOOL LLFloaterParcelInfo::postBuild() { - if (parcel_id.isNull()) + if (mPanelParcelp) { - return NULL; + mPanelParcelp->setParcelID(mParcelID); } - - LLFloaterParcelInfo *floater; - if (gPlaceInfoInstances.checkData(parcel_id)) - { - // ...bring that window to front - floater = gPlaceInfoInstances.getData(parcel_id); - floater->openFloater(); - floater->setFrontmost(true); - } - else - { - floater = new LLFloaterParcelInfo( parcel_id ); - floater->center(); - floater->openFloater(); - floater->displayParcelInfo(parcel_id); - floater->setFrontmost(true); - } - - return floater; + center(); + return LLFloater::postBuild(); } diff --git a/indra/newview/llfloaterparcel.h b/indra/newview/llfloaterparcel.h index c2d5987d8e..386acb3fd5 100644 --- a/indra/newview/llfloaterparcel.h +++ b/indra/newview/llfloaterparcel.h @@ -43,13 +43,13 @@ class LLFloaterParcelInfo public: static void* createPanelPlace(void* data); - LLFloaterParcelInfo( const LLUUID &parcel_id ); + LLFloaterParcelInfo( const LLSD& parcel_id ); /*virtual*/ ~LLFloaterParcelInfo(); - + + /*virtual*/ BOOL postBuild(); + void displayParcelInfo(const LLUUID& parcel_id); - static LLFloaterParcelInfo* show(const LLUUID& parcel_id); - private: LLUUID mParcelID; // for which parcel is this window? LLPanelPlace* mPanelParcelp; diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index c4f1ebe8aa..17bb8221ad 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -53,7 +53,8 @@ LLFloaterPerms::LLFloaterPerms(const LLSD& seed) BOOL LLFloaterPerms::postBuild() { - + mCloseSignal.connect(boost::bind(&LLFloaterPerms::cancel, this)); + refresh(); return TRUE; @@ -106,14 +107,6 @@ void LLFloaterPerms::refresh() mNextOwnerTransfer = gSavedSettings.getBOOL("NextOwnerTransfer"); } -void LLFloaterPerms::onClose(bool app_quitting) -{ - // Cancel any unsaved changes before closing. - // Note: when closed due to the OK button this amounts to a no-op. - cancel(); - destroy(); -} - //static U32 LLFloaterPerms::getGroupPerms(std::string prefix) { diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index a1897a5c00..2426f43ca7 100644 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -41,7 +41,6 @@ class LLFloaterPerms : public LLFloater friend class LLFloaterReg; public: - /*virtual*/ void onClose(bool app_quitting = false); /*virtual*/ BOOL postBuild(); void ok(); void cancel(); diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp index 696531c208..aa68a1b229 100644 --- a/indra/newview/llfloaterpostcard.cpp +++ b/indra/newview/llfloaterpostcard.cpp @@ -45,6 +45,7 @@ #include "lllineeditor.h" #include "llviewertexteditor.h" #include "llbutton.h" +#include "llfloaterreg.h" #include "llviewercontrol.h" #include "llviewernetwork.h" #include "lluictrlfactory.h" @@ -70,40 +71,30 @@ /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- -//static -LLFloaterPostcard::instance_list_t LLFloaterPostcard::sInstances; - ///---------------------------------------------------------------------------- /// Class LLFloaterPostcard ///---------------------------------------------------------------------------- -LLFloaterPostcard::LLFloaterPostcard(LLImageJPEG* jpeg, LLViewerTexture *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global) -: LLFloater(), - mJPEGImage(jpeg), - mViewerImage(img), - mImageScale(img_scale), - mPosTakenGlobal(pos_taken_global), +LLFloaterPostcard::LLFloaterPostcard(const LLSD& key) +: LLFloater(key), + mJPEGImage(NULL), + mViewerImage(NULL), mHasFirstMsgFocus(false) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_postcard.xml"); - - sInstances.insert(this); - - // pick up the user's up-to-date email address - gAgent.sendAgentUserInfoRequest(); - - openFloater(); + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_postcard.xml"); } // Destroys the object LLFloaterPostcard::~LLFloaterPostcard() { - sInstances.erase(this); mJPEGImage = NULL; // deletes image } BOOL LLFloaterPostcard::postBuild() { + // pick up the user's up-to-date email address + gAgent.sendAgentUserInfoRequest(); + childSetAction("cancel_btn", onClickCancel, this); childSetAction("send_btn", onClickSend, this); @@ -127,15 +118,18 @@ BOOL LLFloaterPostcard::postBuild() return TRUE; } - - // static LLFloaterPostcard* LLFloaterPostcard::showFromSnapshot(LLImageJPEG *jpeg, LLViewerTexture *img, const LLVector2 &image_scale, const LLVector3d& pos_taken_global) { // Take the images from the caller // It's now our job to clean them up - LLFloaterPostcard *instance = new LLFloaterPostcard(jpeg, img, image_scale, pos_taken_global); - + LLFloaterPostcard* instance = LLFloaterReg::showTypedInstance<LLFloaterPostcard>("postcard", LLSD(img->getID())); + + instance->mJPEGImage = jpeg; + instance->mViewerImage = img; + instance->mImageScale = image_scale; + instance->mPosTakenGlobal = pos_taken_global; + return instance; } @@ -302,10 +296,11 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data, // static void LLFloaterPostcard::updateUserInfo(const std::string& email) { - for (instance_list_t::iterator iter = sInstances.begin(); - iter != sInstances.end(); ++iter) + LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel"); + for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); + iter != inst_list.end(); ++iter) { - LLFloaterPostcard *instance = *iter; + LLFloater* instance = *iter; const std::string& text = instance->childGetValue("from_form").asString(); if (text.empty()) { diff --git a/indra/newview/llfloaterpostcard.h b/indra/newview/llfloaterpostcard.h index 98910f85f9..49cce53106 100644 --- a/indra/newview/llfloaterpostcard.h +++ b/indra/newview/llfloaterpostcard.h @@ -48,7 +48,7 @@ class LLFloaterPostcard : public LLFloater { public: - LLFloaterPostcard(LLImageJPEG* jpeg, LLViewerTexture *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global); + LLFloaterPostcard(const LLSD& key); virtual ~LLFloaterPostcard(); virtual BOOL postBuild(); @@ -79,9 +79,6 @@ protected: LLVector2 mImageScale; LLVector3d mPosTakenGlobal; boolean mHasFirstMsgFocus; - - typedef std::set<LLFloaterPostcard*> instance_list_t; - static instance_list_t sInstances; }; diff --git a/indra/newview/llfloaterpostprocess.cpp b/indra/newview/llfloaterpostprocess.cpp index a1015918d4..2ab54d6e46 100644 --- a/indra/newview/llfloaterpostprocess.cpp +++ b/indra/newview/llfloaterpostprocess.cpp @@ -36,6 +36,7 @@ #include "llsliderctrl.h" #include "llcheckboxctrl.h" +#include "llcombobox.h" #include "lluictrlfactory.h" #include "llviewerdisplay.h" #include "llpostprocess.h" @@ -44,14 +45,10 @@ #include "llviewerwindow.h" -LLFloaterPostProcess* LLFloaterPostProcess::sPostProcess = NULL; - - -LLFloaterPostProcess::LLFloaterPostProcess() - : LLFloater() +LLFloaterPostProcess::LLFloaterPostProcess(const LLSD& key) + : LLFloater(key) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_post_process.xml"); - + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_post_process.xml"); } LLFloaterPostProcess::~LLFloaterPostProcess() @@ -87,28 +84,16 @@ BOOL LLFloaterPostProcess::postBuild() // Effect loading and saving. LLComboBox* comboBox = getChild<LLComboBox>("PPEffectsCombo"); - childSetAction("PPLoadEffect", &LLFloaterPostProcess::onLoadEffect, comboBox); + getChild<LLComboBox>("PPLoadEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onLoadEffect, this, comboBox)); comboBox->setCommitCallback(boost::bind(&LLFloaterPostProcess::onChangeEffectName, this, _1)); LLLineEditor* editBox = getChild<LLLineEditor>("PPEffectNameEditor"); - childSetAction("PPSaveEffect", &LLFloaterPostProcess::onSaveEffect, editBox); + getChild<LLComboBox>("PPSaveEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onSaveEffect, this, editBox)); syncMenu(); return TRUE; } -LLFloaterPostProcess* LLFloaterPostProcess::instance() -{ - // if we don't have our singleton instance, create it - if (!sPostProcess) - { - sPostProcess = new LLFloaterPostProcess(); - sPostProcess->openFloater(); - sPostProcess->setFocus(TRUE); - } - return sPostProcess; -} - // Bool Toggle void LLFloaterPostProcess::onBoolToggle(LLUICtrl* ctrl, void* userData) { @@ -159,33 +144,29 @@ void LLFloaterPostProcess::onColorControlIMoved(LLUICtrl* ctrl, void* userData) gPostProcess->tweaks[floatVariableName][3] = sldrCtrl->getValue(); } -void LLFloaterPostProcess::onLoadEffect(void* userData) +void LLFloaterPostProcess::onLoadEffect(LLComboBox* comboBox) { - LLComboBox* comboBox = static_cast<LLComboBox*>(userData); - LLSD::String effectName(comboBox->getSelectedValue().asString()); gPostProcess->setSelectedEffect(effectName); - sPostProcess->syncMenu(); + syncMenu(); } -void LLFloaterPostProcess::onSaveEffect(void* userData) +void LLFloaterPostProcess::onSaveEffect(LLLineEditor* editBox) { - LLLineEditor* editBox = static_cast<LLLineEditor*>(userData); - std::string effectName(editBox->getValue().asString()); if (gPostProcess->mAllEffects.has(effectName)) { LLSD payload; payload["effect_name"] = effectName; - LLNotifications::instance().add("PPSaveEffectAlert", LLSD(), payload, &LLFloaterPostProcess::saveAlertCallback); + LLNotifications::instance().add("PPSaveEffectAlert", LLSD(), payload, boost::bind(&LLFloaterPostProcess::saveAlertCallback, this, _1, _2)); } else { gPostProcess->saveEffect(effectName); - sPostProcess->syncMenu(); + syncMenu(); } } @@ -207,30 +188,11 @@ bool LLFloaterPostProcess::saveAlertCallback(const LLSD& notification, const LLS { gPostProcess->saveEffect(notification["payload"]["effect_name"].asString()); - sPostProcess->syncMenu(); + syncMenu(); } return false; } -void LLFloaterPostProcess::show() -{ - // get the instance, make sure the values are synced - // and open the menu - LLFloaterPostProcess* postProcess = instance(); - postProcess->syncMenu(); - postProcess->openFloater(); -} - -// virtual -void LLFloaterPostProcess::onClose(bool app_quitting) -{ - // just set visibility to false, don't get fancy yet - if (sPostProcess) - { - sPostProcess->setVisible(FALSE); - } -} - void LLFloaterPostProcess::syncMenu() { // add the combo boxe contents diff --git a/indra/newview/llfloaterpostprocess.h b/indra/newview/llfloaterpostprocess.h index 68e6d1e244..c789adee00 100644 --- a/indra/newview/llfloaterpostprocess.h +++ b/indra/newview/llfloaterpostprocess.h @@ -36,6 +36,8 @@ #include "llfloater.h" class LLButton; +class LLComboBox; +class LLLineEditor; class LLSliderCtrl; class LLTabContainer; class LLPanelPermissions; @@ -51,11 +53,9 @@ class LLFloaterPostProcess : public LLFloater { public: - LLFloaterPostProcess(); + LLFloaterPostProcess(const LLSD& key); virtual ~LLFloaterPostProcess(); /*virtual*/ BOOL postBuild(); - /// one and one instance only - static LLFloaterPostProcess* instance(); /// post process callbacks static void onBoolToggle(LLUICtrl* ctrl, void* userData); @@ -64,18 +64,12 @@ public: static void onColorControlGMoved(LLUICtrl* ctrl, void* userData); static void onColorControlBMoved(LLUICtrl* ctrl, void* userData); static void onColorControlIMoved(LLUICtrl* ctrl, void* userData); - static void onLoadEffect(void* userData); - static void onSaveEffect(void* userData); + void onLoadEffect(LLComboBox* comboBox); + void onSaveEffect(LLLineEditor* editBox); void onChangeEffectName(LLUICtrl* ctrl); /// prompts a user when overwriting an effect - static bool saveAlertCallback(const LLSD& notification, const LLSD& response); - - /// show off our menu - static void show(); - - /// stuff to do on exit - virtual void onClose(bool app_quitting); + bool saveAlertCallback(const LLSD& notification, const LLSD& response); /// sync up sliders void syncMenu(); @@ -84,8 +78,6 @@ public: void refresh(); */ public: - - static LLFloaterPostProcess* sPostProcess; }; #endif diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 903471ea94..8a7b2d84c0 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -124,9 +124,9 @@ class LLVoiceSetKeyDialog : public LLModalDialog }; LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(LLFloaterPreference* parent) -: LLModalDialog(LLStringUtil::null, 240, 100), mParent(parent) +: LLModalDialog(LLSD(), 240, 100), mParent(parent) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_select_key.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_select_key.xml", NULL); childSetAction("Cancel", onCancel, this); childSetFocus("Cancel"); @@ -367,6 +367,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) BOOL LLFloaterPreference::postBuild() { + mCloseSignal.connect(boost::bind(&LLFloaterPreference::onClose, this)); + LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core"); if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) tabcontainer->selectFirstTab(); @@ -418,7 +420,11 @@ void LLFloaterPreference::apply() panel->apply(); } // hardware menu apply - LLFloaterHardwareSettings::instance()->apply(); + LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::findTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings"); + if (hardware_settings) + { + hardware_settings->apply(); + } LLFloaterVoiceDeviceSettings* voice_device_settings = LLFloaterReg::findTypedInstance<LLFloaterVoiceDeviceSettings>("pref_voicedevicesettings"); if(voice_device_settings) @@ -506,7 +512,11 @@ void LLFloaterPreference::cancel() LLFloaterReg::hideInstance("pref_joystick"); // cancel hardware menu - LLFloaterHardwareSettings::instance()->cancel(); // TODO: angela change the build of the floater to floater reg + LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::findTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings"); + if (hardware_settings) + { + hardware_settings->cancel(); + } // reverts any changes to current skin gSavedSettings.setString("SkinCurrent", sSkin); @@ -539,16 +549,17 @@ void LLFloaterPreference::setHardwareDefaults() LLFeatureManager::getInstance()->applyRecommendedSettings(); refreshEnabledGraphics(); } -void LLFloaterPreference::onClose(bool app_quitting) + +void LLFloaterPreference::onClose() { gSavedSettings.setS32("LastPrefTab", getChild<LLTabContainer>("pref core")->getCurrentPanelIndex()); LLPanelLogin::setAlwaysRefresh(false); cancel(); // will be a no-op if OK or apply was performed just prior. - destroy(); } + void LLFloaterPreference::onOpenHardwareSettings() { - LLFloaterHardwareSettings::show(); + LLFloaterReg::showInstance("prefs_hardware_settings"); } // static void LLFloaterPreference::onBtnOK() @@ -634,9 +645,13 @@ void LLFloaterPreference::refreshEnabledGraphics() LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences"); if(instance) { - LLFloaterHardwareSettings::instance()->refreshEnabledState(); instance->refreshEnabledState(); } + LLFloaterHardwareSettings* hardware_settings = LLFloaterReg::findTypedInstance<LLFloaterHardwareSettings>("prefs_hardware_settings"); + if (hardware_settings) + { + hardware_settings->refreshEnabledState(); + } } void LLFloaterPreference::updateMeterText(LLUICtrl* ctrl) diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 23e05a1ccf..ce31abcd9e 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -72,7 +72,6 @@ public: /*virtual*/ void draw(); virtual BOOL postBuild(); virtual void onOpen(const LLSD& key); - virtual void onClose(bool app_quitting); // static data update, called from message handler static void updateUserInfo(const std::string& visibility, bool im_via_email, const std::string& email); @@ -82,6 +81,8 @@ public: protected: + void onClose(); + void onBtnOK(); void onBtnCancel(); void onBtnApply(); diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 8e86aa3ba9..7312808bd6 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -76,7 +76,8 @@ class LLPropertiesObserver : public LLInventoryObserver { public: - LLPropertiesObserver() + LLPropertiesObserver(LLFloaterProperties* floater) + : mFloater(floater) { gInventory.addObserver(this); } @@ -85,6 +86,8 @@ public: gInventory.removeObserver(this); } virtual void changed(U32 mask); +private: + LLFloaterProperties* mFloater; }; void LLPropertiesObserver::changed(U32 mask) @@ -92,7 +95,7 @@ void LLPropertiesObserver::changed(U32 mask) // if there's a change we're interested in. if((mask & (LLInventoryObserver::LABEL | LLInventoryObserver::INTERNAL | LLInventoryObserver::REMOVE)) != 0) { - LLFloaterProperties::dirtyAll(); + mFloater->dirty(); } } @@ -102,135 +105,65 @@ void LLPropertiesObserver::changed(U32 mask) /// Class LLFloaterProperties ///---------------------------------------------------------------------------- -// static -LLFloaterProperties::instance_map LLFloaterProperties::sInstances; -LLPropertiesObserver* LLFloaterProperties::sPropertiesObserver = NULL; -S32 LLFloaterProperties::sPropertiesObserverCount = 0; - -// static -LLFloaterProperties* LLFloaterProperties::find(const LLUUID& item_id, - const LLUUID& object_id) -{ - // for simplicity's sake, we key the properties window with a - // single uuid. However, the items are keyed by item and object - // (obj == null -> agent inventory). So, we xor the two ids, and - // use that as a lookup key - instance_map::iterator it = sInstances.find(item_id ^ object_id); - if(it != sInstances.end()) - { - return (*it).second; - } - return NULL; -} - -// static -LLFloaterProperties* LLFloaterProperties::show(const LLUUID& item_id, - const LLUUID& object_id) -{ - LLFloaterProperties* instance = find(item_id, object_id); - if(instance) - { - if (LLFloater::getFloaterHost() && LLFloater::getFloaterHost() != instance->getHost()) - { - // this properties window is being opened in a new context - // needs to be rehosted - LLFloater::getFloaterHost()->addFloater(instance, TRUE); - } - - instance->refresh(); - instance->openFloater(); - } - else - { - LLFloaterProperties* floater = new LLFloaterProperties(item_id, object_id); - // keep onscreen - gFloaterView->adjustToFitScreen(floater, FALSE); - } - return instance; -} - -void LLFloaterProperties::dirtyAll() -{ - // ...this is more clear. Possibly more correct, because the - // refresh method may delete the object. - for(instance_map::iterator it = sInstances.begin(); it!=sInstances.end(); ) - { - (*it++).second->dirty(); - } -} - // Default constructor -LLFloaterProperties::LLFloaterProperties(const LLUUID& item_id, const LLUUID& object_id) - : LLFloater(), +LLFloaterProperties::LLFloaterProperties(const LLUUID& item_id) + : LLFloater(mItemID), mItemID(item_id), - mObjectID(object_id), mDirty(TRUE) { - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_inventory_item_properties.xml"); + mPropertiesObserver = new LLPropertiesObserver(this); - if (!sPropertiesObserver) - { - sPropertiesObserver = new LLPropertiesObserver; - } - sPropertiesObserverCount++; - - // add the object to the static structure - LLUUID key = mItemID ^ mObjectID; - sInstances.insert(instance_map::value_type(key, this)); - + //LLUICtrlFactory::getInstance()->buildFloater(this,"floater_inventory_item_properties.xml"); } // Destroys the object LLFloaterProperties::~LLFloaterProperties() { - // clean up the static data. - instance_map::iterator it = sInstances.find(mItemID ^ mObjectID); - if(it != sInstances.end()) - { - sInstances.erase(it); - } - sPropertiesObserverCount--; - if (!sPropertiesObserverCount) - { - delete sPropertiesObserver; - sPropertiesObserver = NULL; - } + delete mPropertiesObserver; + mPropertiesObserver = NULL; } + // virtual BOOL LLFloaterProperties::postBuild() { // build the UI // item name & description childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidatePrintableNotPipe); - childSetCommitCallback("LabelItemName",onCommitName,this); + getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitName,this)); childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidatePrintableNotPipe); - childSetCommitCallback("LabelItemDesc", onCommitDescription, this); + getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLFloaterProperties:: onCommitDescription, this)); // Creator information - childSetAction("BtnCreator",onClickCreator,this); + getChild<LLUICtrl>("BtnCreator")->setCommitCallback(boost::bind(&LLFloaterProperties::onClickCreator,this)); // owner information - childSetAction("BtnOwner",onClickOwner,this); + getChild<LLUICtrl>("BtnOwner")->setCommitCallback(boost::bind(&LLFloaterProperties::onClickOwner,this)); // acquired date // owner permissions // Permissions debug text // group permissions - childSetCommitCallback("CheckShareWithGroup",&onCommitPermissions, this); + getChild<LLUICtrl>("CheckShareWithGroup")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); // everyone permissions - childSetCommitCallback("CheckEveryoneCopy",&onCommitPermissions, this); + getChild<LLUICtrl>("CheckEveryoneCopy")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); // next owner permissions - childSetCommitCallback("CheckNextOwnerModify",&onCommitPermissions, this); - childSetCommitCallback("CheckNextOwnerCopy",&onCommitPermissions, this); - childSetCommitCallback("CheckNextOwnerTransfer",&onCommitPermissions, this); + getChild<LLUICtrl>("CheckNextOwnerModify")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); + getChild<LLUICtrl>("CheckNextOwnerCopy")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); + getChild<LLUICtrl>("CheckNextOwnerTransfer")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitPermissions, this)); // Mark for sale or not, and sale info - childSetCommitCallback("CheckPurchase",&onCommitSaleInfo, this); - childSetCommitCallback("RadioSaleType",&onCommitSaleType, this); + getChild<LLUICtrl>("CheckPurchase")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitSaleInfo, this)); + getChild<LLUICtrl>("RadioSaleType")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitSaleType, this)); // "Price" label for edit - childSetCommitCallback("EditPrice",&onCommitSaleInfo, this); + getChild<LLUICtrl>("EditPrice")->setCommitCallback(boost::bind(&LLFloaterProperties::onCommitSaleInfo, this)); // The UI has been built, now fill in all the values refresh(); return TRUE; } +// virtual +void LLFloaterProperties::onOpen(const LLSD& key) +{ + refresh(); +} + void LLFloaterProperties::refresh() { LLInventoryItem* item = findItem(); @@ -604,12 +537,9 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) } } -// static -void LLFloaterProperties::onClickCreator(void* data) +void LLFloaterProperties::onClickCreator() { - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) return; - LLInventoryItem* item = self->findItem(); + LLInventoryItem* item = findItem(); if(!item) return; if(!item->getCreatorUUID().isNull()) { @@ -618,11 +548,9 @@ void LLFloaterProperties::onClickCreator(void* data) } // static -void LLFloaterProperties::onClickOwner(void* data) +void LLFloaterProperties::onClickOwner() { - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) return; - LLInventoryItem* item = self->findItem(); + LLInventoryItem* item = findItem(); if(!item) return; if(item->getPermissions().isGroupOwned()) { @@ -635,20 +563,15 @@ void LLFloaterProperties::onClickOwner(void* data) } // static -void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data) +void LLFloaterProperties::onCommitName() { //llinfos << "LLFloaterProperties::onCommitName()" << llendl; - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) - { - return; - } - LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->findItem(); + LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); if(!item) { return; } - LLLineEditor* labelItemName = self->getChild<LLLineEditor>("LabelItemName"); + LLLineEditor* labelItemName = getChild<LLLineEditor>("LabelItemName"); if(labelItemName&& (item->getName() != labelItemName->getText()) && @@ -656,7 +579,7 @@ void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data) { LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->rename(labelItemName->getText()); - if(self->mObjectID.isNull()) + if(mObjectID.isNull()) { new_item->updateServer(FALSE); gInventory.updateItem(new_item); @@ -665,7 +588,7 @@ void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data) } else { - LLViewerObject* object = gObjectList.findObject(self->mObjectID); + LLViewerObject* object = gObjectList.findObject(mObjectID); if(object) { object->updateInventory( @@ -677,16 +600,13 @@ void LLFloaterProperties::onCommitName(LLUICtrl* ctrl, void* data) } } -// static -void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data) +void LLFloaterProperties::onCommitDescription() { //llinfos << "LLFloaterProperties::onCommitDescription()" << llendl; - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) return; - LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->findItem(); + LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); if(!item) return; - LLLineEditor* labelItemDesc = self->getChild<LLLineEditor>("LabelItemDesc"); + LLLineEditor* labelItemDesc = getChild<LLLineEditor>("LabelItemDesc"); if(!labelItemDesc) { return; @@ -697,7 +617,7 @@ void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data) LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); new_item->setDescription(labelItemDesc->getText()); - if(self->mObjectID.isNull()) + if(mObjectID.isNull()) { new_item->updateServer(FALSE); gInventory.updateItem(new_item); @@ -705,7 +625,7 @@ void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data) } else { - LLViewerObject* object = gObjectList.findObject(self->mObjectID); + LLViewerObject* object = gObjectList.findObject(mObjectID); if(object) { object->updateInventory( @@ -718,17 +638,15 @@ void LLFloaterProperties::onCommitDescription(LLUICtrl* ctrl, void* data) } // static -void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) +void LLFloaterProperties::onCommitPermissions() { //llinfos << "LLFloaterProperties::onCommitPermissions()" << llendl; - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) return; - LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->findItem(); + LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); if(!item) return; LLPermissions perm(item->getPermissions()); - LLCheckBoxCtrl* CheckShareWithGroup = self->getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); + LLCheckBoxCtrl* CheckShareWithGroup = getChild<LLCheckBoxCtrl>("CheckShareWithGroup"); if(CheckShareWithGroup) { @@ -736,26 +654,26 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) CheckShareWithGroup->get(), PERM_MODIFY | PERM_MOVE | PERM_COPY); } - LLCheckBoxCtrl* CheckEveryoneCopy = self->getChild<LLCheckBoxCtrl>("CheckEveryoneCopy"); + LLCheckBoxCtrl* CheckEveryoneCopy = getChild<LLCheckBoxCtrl>("CheckEveryoneCopy"); if(CheckEveryoneCopy) { perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(), CheckEveryoneCopy->get(), PERM_COPY); } - LLCheckBoxCtrl* CheckNextOwnerModify = self->getChild<LLCheckBoxCtrl>("CheckNextOwnerModify"); + LLCheckBoxCtrl* CheckNextOwnerModify = getChild<LLCheckBoxCtrl>("CheckNextOwnerModify"); if(CheckNextOwnerModify) { perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), CheckNextOwnerModify->get(), PERM_MODIFY); } - LLCheckBoxCtrl* CheckNextOwnerCopy = self->getChild<LLCheckBoxCtrl>("CheckNextOwnerCopy"); + LLCheckBoxCtrl* CheckNextOwnerCopy = getChild<LLCheckBoxCtrl>("CheckNextOwnerCopy"); if(CheckNextOwnerCopy) { perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), CheckNextOwnerCopy->get(), PERM_COPY); } - LLCheckBoxCtrl* CheckNextOwnerTransfer = self->getChild<LLCheckBoxCtrl>("CheckNextOwnerTransfer"); + LLCheckBoxCtrl* CheckNextOwnerTransfer = getChild<LLCheckBoxCtrl>("CheckNextOwnerTransfer"); if(CheckNextOwnerTransfer) { perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), @@ -791,7 +709,7 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; } new_item->setFlags(flags); - if(self->mObjectID.isNull()) + if(mObjectID.isNull()) { new_item->updateServer(FALSE); gInventory.updateItem(new_item); @@ -799,7 +717,7 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) } else { - LLViewerObject* object = gObjectList.findObject(self->mObjectID); + LLViewerObject* object = gObjectList.findObject(mObjectID); if(object) { object->updateInventory( @@ -812,26 +730,22 @@ void LLFloaterProperties::onCommitPermissions(LLUICtrl* ctrl, void* data) else { // need to make sure we don't just follow the click - self->refresh(); + refresh(); } } // static -void LLFloaterProperties::onCommitSaleInfo(LLUICtrl* ctrl, void* data) +void LLFloaterProperties::onCommitSaleInfo() { //llinfos << "LLFloaterProperties::onCommitSaleInfo()" << llendl; - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) return; - self->updateSaleInfo(); + updateSaleInfo(); } // static -void LLFloaterProperties::onCommitSaleType(LLUICtrl* ctrl, void* data) +void LLFloaterProperties::onCommitSaleType() { //llinfos << "LLFloaterProperties::onCommitSaleType()" << llendl; - LLFloaterProperties* self = (LLFloaterProperties*)data; - if(!self) return; - self->updateSaleInfo(); + updateSaleInfo(); } void LLFloaterProperties::updateSaleInfo() @@ -957,13 +871,15 @@ LLInventoryItem* LLFloaterProperties::findItem() const return item; } -void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_id) +//static +void LLFloaterProperties::dirtyAll() { - LLFloaterProperties* floaterp = find(item_id, object_id); - - if (floaterp) + LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("properties"); + for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); + iter != inst_list.end(); ++iter) { - floaterp->closeFloater(); + LLFloaterProperties* floater = dynamic_cast<LLFloaterProperties*>(*iter); + floater->dirty(); } } @@ -972,7 +888,7 @@ void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_ ///---------------------------------------------------------------------------- LLMultiProperties::LLMultiProperties() - : LLMultiFloater() + : LLMultiFloater(LLSD()) { // *TODO: There should be a .xml file for this const LLRect& nextrect = LLFloaterReg::getFloaterRect("properties"); // place where the next properties should show up diff --git a/indra/newview/llfloaterproperties.h b/indra/newview/llfloaterproperties.h index d0e5abefb8..586719a4dc 100644 --- a/indra/newview/llfloaterproperties.h +++ b/indra/newview/llfloaterproperties.h @@ -53,30 +53,27 @@ class LLPropertiesObserver; class LLFloaterProperties : public LLFloater { public: - static LLFloaterProperties* find(const LLUUID& item_id, - const LLUUID& object_id = LLUUID::null); - static LLFloaterProperties* show(const LLUUID& item_id, - const LLUUID& object_id = LLUUID::null); - static void dirtyAll(); - - static void closeByID(const LLUUID& item_id, const LLUUID& object_id); - - LLFloaterProperties(const LLUUID& item_id, const LLUUID& object_id); - virtual ~LLFloaterProperties(); + LLFloaterProperties(const LLUUID& item_id); + /*virtual*/ ~LLFloaterProperties(); + /*virtual*/ BOOL postBuild(); - // do everything necessary + /*virtual*/ void onOpen(const LLSD& key); + void setObjectID(const LLUUID& object_id) { mObjectID = object_id; } + void dirty() { mDirty = TRUE; } void refresh(); - + + static void dirtyAll(); + protected: // ui callbacks - static void onClickCreator(void* data); - static void onClickOwner(void* data); - static void onCommitName(LLUICtrl* ctrl, void* data); - static void onCommitDescription(LLUICtrl* ctrl, void* data); - static void onCommitPermissions(LLUICtrl* ctrl, void* data); - static void onCommitSaleInfo(LLUICtrl* ctrl, void* data); - static void onCommitSaleType(LLUICtrl* ctrl, void* data); + void onClickCreator(); + void onClickOwner(); + void onCommitName(); + void onCommitDescription(); + void onCommitPermissions(); + void onCommitSaleInfo(); + void onCommitSaleType(); void updateSaleInfo(); LLInventoryItem* findItem() const; @@ -93,12 +90,9 @@ protected: // inventory. LLUUID mObjectID; - BOOL mDirty; + BOOL mDirty; - typedef std::map<LLUUID, LLFloaterProperties*, lluuid_less> instance_map; - static instance_map sInstances; - static LLPropertiesObserver* sPropertiesObserver; - static S32 sPropertiesObserverCount; + LLPropertiesObserver* mPropertiesObserver; }; class LLMultiProperties : public LLMultiFloater diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 009902b453..94d25aa0c8 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -724,8 +724,8 @@ bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const L void LLPanelRegionGeneralInfo::onClickManageTelehub() { - LLFloaterReg::getInstance("region_info")->closeFloater(); - LLFloaterTelehub::show(); + LLFloaterReg::hideInstance("region_info"); + LLFloaterReg::showInstance("telehubs"); } // setregioninfo @@ -1455,12 +1455,12 @@ void LLPanelEstateInfo::onChangeFixedSun(LLUICtrl* ctrl, void* user_data) //--------------------------------------------------------------------------- void LLPanelEstateInfo::onClickEditSky(void* user_data) { - LLFloaterWindLight::show(); + LLFloaterReg::showInstance("env_windlight"); } void LLPanelEstateInfo::onClickEditDayCycle(void* user_data) { - LLFloaterDayCycle::show(); + LLFloaterReg::showInstance("env_day_cycle"); } // static @@ -1518,8 +1518,7 @@ bool LLPanelEstateInfo::addAllowedGroup(const LLSD& notification, const LLSD& re LLFloater* parent_floater = gFloaterView->getParentFloater(this); - LLFloaterGroupPicker* widget; - widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); + LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID())); if (widget) { widget->setSelectGroupCallback(boost::bind(&LLPanelEstateInfo::addAllowedGroup2, this, _1)); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 8c96734057..00cbc2f0c8 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -54,6 +54,7 @@ #include "llbutton.h" #include "llcheckboxctrl.h" #include "llfloaterinventory.h" +#include "llfloaterreg.h" #include "lllineeditor.h" #include "lltexturectrl.h" #include "llscrolllistctrl.h" @@ -91,24 +92,14 @@ const U32 INCLUDE_SCREENSHOT = 0x01 << 0; // Globals //----------------------------------------------------------------------------- -// this map keeps track of current reporter instances -// there can only be one instance of each reporter type -LLMap< EReportType, LLFloaterReporter* > gReporterInstances; - -// keeps track of where email is going to - global to avoid a pile -// of static/non-static access outside my control -namespace { - static BOOL gEmailToEstateOwner = FALSE; - static BOOL gDialogVisible = FALSE; -} - //----------------------------------------------------------------------------- // Member functions //----------------------------------------------------------------------------- -LLFloaterReporter::LLFloaterReporter(EReportType report_type) -: LLFloater(), - mReportType(report_type), +LLFloaterReporter::LLFloaterReporter(const LLSD& key) +: LLFloater(key), + mReportType(COMPLAINT_REPORT), + mEmailToEstateOwner(FALSE), mObjectID(), mScreenID(), mAbuserID(), @@ -118,10 +109,34 @@ LLFloaterReporter::LLFloaterReporter(EReportType report_type) mCopyrightWarningSeen( FALSE ), mResourceDatap(new LLResourceData()) { + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_abuse.xml"); +} - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_abuse.xml"); +// static +void LLFloaterReporter::processRegionInfo(LLMessageSystem* msg) +{ + U32 region_flags; + msg->getU32("RegionInfo", "RegionFlags", region_flags); + if ( LLFloaterReg::instanceVisible("reporter") ) + { + LLFloaterReporter *f = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter"); + BOOL email_to_estate_owner = ( region_flags & REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER ); + f->mEmailToEstateOwner = email_to_estate_owner; + if ( email_to_estate_owner ) + { + LLNotifications::instance().add("HelpReportAbuseEmailEO"); + } + else + { + LLNotifications::instance().add("HelpReportAbuseEmailLL"); + } + }; +} +// virtual +BOOL LLFloaterReporter::postBuild() +{ childSetText("abuse_location_edit", gAgent.getSLURL() ); enableControls(TRUE); @@ -135,8 +150,6 @@ LLFloaterReporter::LLFloaterReporter(EReportType report_type) } setPosBox(pos); - gReporterInstances.addData(report_type, this); - // Take a screenshot, but don't draw this floater. setVisible(FALSE); takeScreenshot(); @@ -150,9 +163,6 @@ LLFloaterReporter::LLFloaterReporter(EReportType report_type) mDefaultSummary = childGetText("details_edit"); - gDialogVisible = TRUE; - - // send a message and ask for information about this region - // result comes back in processRegionInfo(..) LLMessageSystem* msg = gMessageSystem; @@ -161,29 +171,8 @@ LLFloaterReporter::LLFloaterReporter(EReportType report_type) msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); gAgent.sendReliableMessage(); - -} - -// static -void LLFloaterReporter::processRegionInfo(LLMessageSystem* msg) -{ - U32 region_flags; - msg->getU32("RegionInfo", "RegionFlags", region_flags); - gEmailToEstateOwner = ( region_flags & REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER ); - - if ( gDialogVisible ) - { - if ( gEmailToEstateOwner ) - { - LLNotifications::instance().add("HelpReportAbuseEmailEO"); - } - else - LLNotifications::instance().add("HelpReportAbuseEmailLL"); - }; -} -// virtual -BOOL LLFloaterReporter::postBuild() -{ + + // abuser name is selected from a list LLLineEditor* le = getChild<LLLineEditor>("abuser_name_edit"); le->setEnabled( FALSE ); @@ -198,12 +187,19 @@ BOOL LLFloaterReporter::postBuild() childSetAction("send_btn", onClickSend, this); childSetAction("cancel_btn", onClickCancel, this); + + // grab the user's name + std::string fullname; + gAgent.buildFullname(fullname); + childSetText("reporter_field", fullname); + + center(); + return TRUE; } // virtual LLFloaterReporter::~LLFloaterReporter() { - gReporterInstances.removeData(mReportType); // child views automatically deleted mObjectID = LLUUID::null; @@ -218,7 +214,6 @@ LLFloaterReporter::~LLFloaterReporter() mMCDList.clear(); delete mResourceDatap; - gDialogVisible = FALSE; } // virtual @@ -227,7 +222,7 @@ void LLFloaterReporter::draw() // this is set by a static callback sometime after the dialog is created. // Only disable screenshot for abuse reports to estate owners - bug reports always // allow screenshots to be taken. - if ( gEmailToEstateOwner ) + if ( mEmailToEstateOwner ) { childSetValue("screen_check", FALSE ); childSetEnabled("screen_check", FALSE ); @@ -474,27 +469,16 @@ void LLFloaterReporter::closePickTool(void *userdata) // static void LLFloaterReporter::showFromMenu(EReportType report_type) { - if (gReporterInstances.checkData(report_type)) + if (COMPLAINT_REPORT != report_type) { - // ...bring that window to front - LLFloaterReporter *f = gReporterInstances.getData(report_type); - f->openFloater(); + llwarns << "Unknown LLViewerReporter type : " << report_type << llendl; + return; } - else + + LLFloaterReporter* f = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter", LLSD()); + if (f) { - LLFloaterReporter *f; - - if (COMPLAINT_REPORT == report_type) - { - f = LLFloaterReporter::createNewAbuseReporter(); - } - else - { - llwarns << "Unknown LLViewerReporter type : " << report_type << llendl; - return; - } - - f->center(); + f->setReportType(report_type); if (report_type == BUG_REPORT) { @@ -504,11 +488,6 @@ void LLFloaterReporter::showFromMenu(EReportType report_type) { // popup for abuse reports is triggered elsewhere } - - // grab the user's name - std::string fullname; - gAgent.buildFullname(fullname); - f->childSetText("reporter_field", fullname); } } @@ -516,9 +495,7 @@ void LLFloaterReporter::showFromMenu(EReportType report_type) // static void LLFloaterReporter::showFromObject(const LLUUID& object_id) { - LLFloaterReporter* f = createNewAbuseReporter(); - f->center(); - f->setFocus(TRUE); + LLFloaterReporter* f = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter"); // grab the user's name std::string fullname; @@ -535,24 +512,6 @@ void LLFloaterReporter::showFromObject(const LLUUID& object_id) } -// static -LLFloaterReporter* LLFloaterReporter::getReporter(EReportType report_type) -{ - LLFloaterReporter *self = NULL; - if (gReporterInstances.checkData(report_type)) - { - // ...bring that window to front - self = gReporterInstances.getData(report_type); - } - return self; -} - -LLFloaterReporter* LLFloaterReporter::createNewAbuseReporter() -{ - return new LLFloaterReporter(COMPLAINT_REPORT); -} - - void LLFloaterReporter::setPickedObjectProperties(const std::string& object_name, const std::string& owner_name, const LLUUID owner_id) { childSetText("object_name", object_name); @@ -710,7 +669,7 @@ LLSD LLFloaterReporter::gatherReport() if (childGetValue("screen_check")) { - if ( gEmailToEstateOwner == FALSE ) + if ( mEmailToEstateOwner == FALSE ) { screenshot_id = childGetValue("screenshot"); } @@ -914,7 +873,7 @@ void LLFloaterReporter::uploadDoneCallback(const LLUUID &uuid, void *user_data, llwarns << "Unknown report type : " << data->mPreferredLocation << llendl; } - LLFloaterReporter *self = getReporter(report_type); + LLFloaterReporter *self = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter"); if (self) { self->mScreenID = uuid; @@ -935,35 +894,35 @@ void LLFloaterReporter::setPosBox(const LLVector3d &pos) childSetText("pos_field", pos_string); } -void LLFloaterReporter::setDescription(const std::string& description, LLMeanCollisionData *mcd) -{ - LLFloaterReporter *self = gReporterInstances[COMPLAINT_REPORT]; - if (self) - { - self->childSetText("details_edit", description); - - for_each(self->mMCDList.begin(), self->mMCDList.end(), DeletePointer()); - self->mMCDList.clear(); - if (mcd) - { - self->mMCDList.push_back(new LLMeanCollisionData(mcd)); - } - } -} - -void LLFloaterReporter::addDescription(const std::string& description, LLMeanCollisionData *mcd) -{ - LLFloaterReporter *self = gReporterInstances[COMPLAINT_REPORT]; - if (self) - { - LLTextEditor* text = self->getChild<LLTextEditor>("details_edit"); - if (text) - { - text->insertText(description); - } - if (mcd) - { - self->mMCDList.push_back(new LLMeanCollisionData(mcd)); - } - } -} +// void LLFloaterReporter::setDescription(const std::string& description, LLMeanCollisionData *mcd) +// { +// LLFloaterReporter *self = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter"); +// if (self) +// { +// self->childSetText("details_edit", description); + +// for_each(self->mMCDList.begin(), self->mMCDList.end(), DeletePointer()); +// self->mMCDList.clear(); +// if (mcd) +// { +// self->mMCDList.push_back(new LLMeanCollisionData(mcd)); +// } +// } +// } + +// void LLFloaterReporter::addDescription(const std::string& description, LLMeanCollisionData *mcd) +// { +// LLFloaterReporter *self = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter"); +// if (self) +// { +// LLTextEditor* text = self->getChild<LLTextEditor>("details_edit"); +// if (text) +// { +// text->insertText(description); +// } +// if (mcd) +// { +// self->mMCDList.push_back(new LLMeanCollisionData(mcd)); +// } +// } +// } diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index 52bea736bf..f363b9531e 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -82,11 +82,13 @@ class LLFloaterReporter : public LLFloater { public: - LLFloaterReporter(EReportType = UNKNOWN_REPORT); + LLFloaterReporter(const LLSD& key); /*virtual*/ ~LLFloaterReporter(); /*virtual*/ BOOL postBuild(); virtual void draw(); - + + void setReportType(EReportType type) { mReportType = type; } + // Enables all buttons static void showFromMenu(EReportType report_type); @@ -101,10 +103,6 @@ public: static void addDescription(const std::string& description, LLMeanCollisionData *mcd = NULL); static void setDescription(const std::string& description, LLMeanCollisionData *mcd = NULL); - // returns a pointer to reporter of report_type - static LLFloaterReporter* getReporter(EReportType report_type); - static LLFloaterReporter* createNewAbuseReporter(); - // static static void processRegionInfo(LLMessageSystem* msg); @@ -126,6 +124,7 @@ private: private: EReportType mReportType; + BOOL mEmailToEstateOwner; LLUUID mObjectID; LLUUID mScreenID; LLUUID mAbuserID; diff --git a/indra/newview/llfloaterscriptdebug.cpp b/indra/newview/llfloaterscriptdebug.cpp index 6cca4927a9..c8690de68c 100644 --- a/indra/newview/llfloaterscriptdebug.cpp +++ b/indra/newview/llfloaterscriptdebug.cpp @@ -32,9 +32,10 @@ #include "llviewerprecompiledheaders.h" -#include "lluictrlfactory.h" #include "llfloaterscriptdebug.h" +#include "llfloaterreg.h" +#include "lluictrlfactory.h" #include "llfontgl.h" #include "llrect.h" #include "llerror.h" @@ -50,19 +51,15 @@ // // Statics // -LLFloaterScriptDebug* LLFloaterScriptDebug::sInstance = NULL; - -void* getOutputWindow(void* data); // // Member Functions // -LLFloaterScriptDebug::LLFloaterScriptDebug(const std::string& filename) - : LLMultiFloater() +LLFloaterScriptDebug::LLFloaterScriptDebug(const LLSD& key) + : LLMultiFloater(key) { - mFactoryMap["all_scripts"] = LLCallbackMap(getOutputWindow, NULL); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_script_debug.xml"); - +// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_script_debug.xml"); + // avoid resizing of the window to match // the initial size of the tabbed-childs, whenever a tab is opened or closed mAutoResize = FALSE; @@ -70,20 +67,11 @@ LLFloaterScriptDebug::LLFloaterScriptDebug(const std::string& filename) LLFloaterScriptDebug::~LLFloaterScriptDebug() { - sInstance = NULL; } void LLFloaterScriptDebug::show(const LLUUID& object_id) { - LLFloater* floaterp = addOutputWindow(object_id); - if (sInstance) - { - sInstance->openFloater(object_id); - if (object_id.notNull()) - sInstance->showFloater(floaterp, LLTabContainer::END); -// else // Jump to [All scripts], but keep it on the left -// sInstance->showFloater(floaterp, LLTabContainer::START); - } + addOutputWindow(object_id); } BOOL LLFloaterScriptDebug::postBuild() @@ -101,26 +89,16 @@ BOOL LLFloaterScriptDebug::postBuild() return FALSE; } -void* getOutputWindow(void* data) -{ - return new LLFloaterScriptDebugOutput(LLUUID::null); -} - LLFloater* LLFloaterScriptDebug::addOutputWindow(const LLUUID &object_id) { - if (!sInstance) - { - sInstance = new LLFloaterScriptDebug("floater_script_debug.xml"); - sInstance->setVisible(FALSE); - } + LLMultiFloater* host = LLFloaterReg::showTypedInstance<LLMultiFloater>("script_debug", LLSD()); + if (!host) + return NULL; - LLFloater::setFloaterHost(sInstance); - LLFloater* floaterp = LLFloaterScriptDebugOutput::show(object_id); + LLFloater::setFloaterHost(host); + LLFloater* floaterp = LLFloaterReg::showInstance("script_debug_output", object_id); LLFloater::setFloaterHost(NULL); - // Tabs sometimes overlap resize handle - sInstance->moveResizeHandlesToFront(); - return floaterp; } @@ -143,26 +121,29 @@ void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std: addOutputWindow(source_id); // add to "All" floater - LLFloaterScriptDebugOutput* floaterp = LLFloaterScriptDebugOutput::getFloaterByID(LLUUID::null); - floaterp->addLine(utf8mesg, user_name, color); - + LLFloaterScriptDebugOutput* floaterp = LLFloaterReg::getTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", LLUUID::null); + if (floaterp) + { + floaterp->addLine(utf8mesg, user_name, color); + } + // add to specific script instance floater - floaterp = LLFloaterScriptDebugOutput::getFloaterByID(source_id); - floaterp->addLine(utf8mesg, floater_label, color); + floaterp = LLFloaterReg::getTypedInstance<LLFloaterScriptDebugOutput>("script_debug_output", source_id); + if (floaterp) + { + floaterp->addLine(utf8mesg, floater_label, color); + } } // // LLFloaterScriptDebugOutput // -std::map<LLUUID, LLFloaterScriptDebugOutput*> LLFloaterScriptDebugOutput::sInstanceMap; - -LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput(const LLUUID& object_id) - : LLFloater(), - mObjectID(object_id) +LLFloaterScriptDebugOutput::LLFloaterScriptDebugOutput(const LLSD& object_id) + : LLFloater(LLSD(object_id)), + mObjectID(object_id.asUUID()) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_script_debug_panel.xml"); - sInstanceMap[object_id] = this; + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_script_debug_panel.xml"); } BOOL LLFloaterScriptDebugOutput::postBuild() @@ -174,7 +155,6 @@ BOOL LLFloaterScriptDebugOutput::postBuild() LLFloaterScriptDebugOutput::~LLFloaterScriptDebugOutput() { - sInstanceMap.erase(mObjectID); } void LLFloaterScriptDebugOutput::addLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color) @@ -193,33 +173,3 @@ void LLFloaterScriptDebugOutput::addLine(const std::string &utf8mesg, const std: mHistoryEditor->appendColoredText(utf8mesg, false, true, color); } -//static -LLFloaterScriptDebugOutput* LLFloaterScriptDebugOutput::show(const LLUUID& object_id) -{ - LLFloaterScriptDebugOutput* floaterp = NULL; - instance_map_t::iterator found_it = sInstanceMap.find(object_id); - if (found_it == sInstanceMap.end()) - { - floaterp = new LLFloaterScriptDebugOutput(object_id); - floaterp->openFloater(); - } - else - { - floaterp = found_it->second; - } - - return floaterp; -} - -//static -LLFloaterScriptDebugOutput* LLFloaterScriptDebugOutput::getFloaterByID(const LLUUID& object_id) -{ - LLFloaterScriptDebugOutput* floaterp = NULL; - instance_map_t::iterator found_it = sInstanceMap.find(object_id); - if (found_it != sInstanceMap.end()) - { - floaterp = found_it->second; - } - - return floaterp; -} diff --git a/indra/newview/llfloaterscriptdebug.h b/indra/newview/llfloaterscriptdebug.h index 5f2cf48125..ffc60e5554 100644 --- a/indra/newview/llfloaterscriptdebug.h +++ b/indra/newview/llfloaterscriptdebug.h @@ -41,15 +41,13 @@ class LLUUID; class LLFloaterScriptDebug : public LLMultiFloater { public: + LLFloaterScriptDebug(const LLSD& key); virtual ~LLFloaterScriptDebug(); - virtual void onClose(bool app_quitting) { setVisible(FALSE); } virtual BOOL postBuild(); static void show(const LLUUID& object_id); static void addScriptLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color, const LLUUID& source_id); protected: - LLFloaterScriptDebug(const std::string& filename); - static LLFloater* addOutputWindow(const LLUUID& object_id); protected: @@ -59,24 +57,17 @@ protected: class LLFloaterScriptDebugOutput : public LLFloater { public: - LLFloaterScriptDebugOutput(); - LLFloaterScriptDebugOutput(const LLUUID& object_id); + LLFloaterScriptDebugOutput(const LLSD& object_id); ~LLFloaterScriptDebugOutput(); void addLine(const std::string &utf8mesg, const std::string &user_name, const LLColor4& color); virtual BOOL postBuild(); - static LLFloaterScriptDebugOutput* show(const LLUUID& object_id); - static LLFloaterScriptDebugOutput* getFloaterByID(const LLUUID& id); - protected: - LLTextEditor* mHistoryEditor; - - typedef std::map<LLUUID, LLFloaterScriptDebugOutput*> instance_map_t; - static instance_map_t sInstanceMap; + LLTextEditor* mHistoryEditor; - LLUUID mObjectID; + LLUUID mObjectID; }; #endif // LL_LLFLOATERSCRIPTDEBUG_H diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index 6775e218cb..a6aa01e83b 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -34,7 +34,7 @@ #include "llfloatersellland.h" #include "llfloateravatarpicker.h" -#include "llfloater.h" +#include "llfloaterreg.h" #include "llfloaterland.h" #include "lllineeditor.h" #include "llnotify.h" @@ -55,10 +55,21 @@ enum Badge { BADGE_OK, BADGE_NOTE, BADGE_WARN, BADGE_ERROR }; class LLFloaterSellLandUI : public LLFloater { -private: - LLFloaterSellLandUI(); +public: + LLFloaterSellLandUI(const LLSD& key); virtual ~LLFloaterSellLandUI(); - + +private: + class SelectionObserver : public LLParcelObserver + { + public: + SelectionObserver(LLFloaterSellLandUI* floater) : mFloater(floater) {} + virtual void changed(); + private: + LLFloaterSellLandUI* mFloater; + }; + +private: LLViewerRegion* mRegion; LLParcelSelectionHandle mParcelSelection; bool mParcelIsForSale; @@ -69,13 +80,12 @@ private: LLUUID mParcelSnapshot; LLUUID mAuthorizedBuyer; bool mParcelSoldWithObjects; + SelectionObserver mParcelSelectionObserver; void updateParcelInfo(); void refreshUI(); void setBadge(const char* id, Badge badge); - static LLFloaterSellLandUI* sInstance; - static void onChangeValue(LLUICtrl *ctrl, void *userdata); static void doSelectAgent(void *userdata); static void doCancel(void *userdata); @@ -89,82 +99,55 @@ private: public: virtual BOOL postBuild(); - static LLFloaterSellLandUI* soleInstance(bool createIfNeeded); - bool setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel); - -private: - class SelectionObserver : public LLParcelObserver - { - public: - virtual void changed(); - }; }; // static void LLFloaterSellLand::sellLand( LLViewerRegion* region, LLParcelSelectionHandle parcel) { - LLFloaterSellLandUI* ui = LLFloaterSellLandUI::soleInstance(true); - if (ui->setParcel(region, parcel)) - { - ui->openFloater(); - } + LLFloaterSellLandUI* ui = LLFloaterReg::showTypedInstance<LLFloaterSellLandUI>("sell_land"); + ui->setParcel(region, parcel); } // static -LLFloaterSellLandUI* LLFloaterSellLandUI::sInstance = NULL; - -// static -LLFloaterSellLandUI* LLFloaterSellLandUI::soleInstance(bool createIfNeeded) +LLFloater* LLFloaterSellLand::buildFloater(const LLSD& key) { - if (!sInstance && createIfNeeded) - { - sInstance = new LLFloaterSellLandUI(); - - LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_sell_land.xml"); - sInstance->center(); - } - - - static SelectionObserver* parcelSelectionObserver = NULL; - if (!parcelSelectionObserver) - { - parcelSelectionObserver = new SelectionObserver; - LLViewerParcelMgr::getInstance()->addObserver(parcelSelectionObserver); - } - - return sInstance; + LLFloaterSellLandUI* floater = new LLFloaterSellLandUI(key); + return floater; } -LLFloaterSellLandUI::LLFloaterSellLandUI() -: LLFloater(), +#if LL_WINDOWS +// passing 'this' during construction generates a warning. The callee +// only uses the pointer to hold a reference to 'this' which is +// already valid, so this call does the correct thing. Disable the +// warning so that we can compile without generating a warning. +#pragma warning(disable : 4355) +#endif +LLFloaterSellLandUI::LLFloaterSellLandUI(const LLSD& key) +: LLFloater(key), + mParcelSelectionObserver(this), mRegion(0) { + LLViewerParcelMgr::getInstance()->addObserver(&mParcelSelectionObserver); +// LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_sell_land.xml"); } LLFloaterSellLandUI::~LLFloaterSellLandUI() { - if (sInstance == this) - { - sInstance = NULL; - } + LLViewerParcelMgr::getInstance()->removeObserver(&mParcelSelectionObserver); } void LLFloaterSellLandUI::SelectionObserver::changed() { - LLFloaterSellLandUI* ui = LLFloaterSellLandUI::soleInstance(false); - if (ui) + if (LLViewerParcelMgr::getInstance()->selectionEmpty()) { - if (LLViewerParcelMgr::getInstance()->selectionEmpty()) - { - ui->closeFloater(); - } - else { - ui->setParcel( - LLViewerParcelMgr::getInstance()->getSelectionRegion(), - LLViewerParcelMgr::getInstance()->getParcelSelection()); - } + mFloater->closeFloater(); + } + else + { + mFloater->setParcel(LLViewerParcelMgr::getInstance()->getSelectionRegion(), + LLViewerParcelMgr::getInstance()->getParcelSelection()); } } @@ -178,6 +161,7 @@ BOOL LLFloaterSellLandUI::postBuild() childSetAction("cancel_btn", doCancel, this); childSetAction("sell_btn", doSellLand, this); childSetAction("show_objects", doShowObjects, this); + center(); return TRUE; } diff --git a/indra/newview/llfloatersellland.h b/indra/newview/llfloatersellland.h index 12b0ecbcef..1adf08052b 100644 --- a/indra/newview/llfloatersellland.h +++ b/indra/newview/llfloatersellland.h @@ -34,6 +34,7 @@ #include "llsafehandle.h" +class LLFloater; class LLParcel; class LLViewerRegion; class LLParcelSelection; @@ -43,6 +44,8 @@ class LLFloaterSellLand public: static void sellLand(LLViewerRegion* region, LLSafeHandle<LLParcelSelection> parcel); + + static LLFloater* buildFloater(const LLSD& key); }; #endif // LL_LLFLOATERSELLLAND_H diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 38d8420c96..371dfa50cd 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -2094,14 +2094,6 @@ void LLFloaterSnapshot::onOpen(const LLSD& key) gSnapshotFloaterView->adjustToFitScreen(this, FALSE); } -void LLFloaterSnapshot::onClose(bool app_quitting) -{ - gSnapshotFloaterView->setEnabled(FALSE); - // Set invisible so it doesn't eat tooltips. JC - gSnapshotFloaterView->setVisible(FALSE); - destroy(); -} - //static void LLFloaterSnapshot::update() { diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index 1333497bd2..bd01f6c573 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -52,7 +52,6 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void draw(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); static void update(); diff --git a/indra/newview/llfloatertelehub.cpp b/indra/newview/llfloatertelehub.cpp index 174350ddf4..9841cd2796 100644 --- a/indra/newview/llfloatertelehub.cpp +++ b/indra/newview/llfloatertelehub.cpp @@ -39,6 +39,7 @@ #include "llfontgl.h" #include "llagent.h" +#include "llfloaterreg.h" #include "llfloatertools.h" #include "llscrolllistctrl.h" #include "llselectmgr.h" @@ -48,59 +49,25 @@ #include "llviewerobjectlist.h" #include "lluictrlfactory.h" -LLFloaterTelehub* LLFloaterTelehub::sInstance = NULL; - - -// static -void LLFloaterTelehub::show() -{ - if (sInstance) - { - sInstance->setVisibleAndFrontmost(); - return; - } - - sInstance = new LLFloaterTelehub(); - - // Show tools floater by selecting translate (select) tool - LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); - LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompTranslate::getInstance() ); - - // Find tools floater, glue to bottom - if (gFloaterTools) - { - LLRect tools_rect = gFloaterTools->getRect(); - S32 our_width = sInstance->getRect().getWidth(); - S32 our_height = sInstance->getRect().getHeight(); - LLRect our_rect; - our_rect.setLeftTopAndSize(tools_rect.mLeft, tools_rect.mBottom, our_width, our_height); - sInstance->setRect(our_rect); - } - - sInstance->sendTelehubInfoRequest(); -} - -LLFloaterTelehub::LLFloaterTelehub() -: LLFloater(), +LLFloaterTelehub::LLFloaterTelehub(const LLSD& key) +: LLFloater(key), mTelehubObjectID(), mTelehubObjectName(), mTelehubPos(), mTelehubRot(), mNumSpawn(0) { - sInstance = this; - - gMessageSystem->setHandlerFunc("TelehubInfo", processTelehubInfo); - - LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_telehub.xml"); + //LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_telehub.xml"); } + BOOL LLFloaterTelehub::postBuild() { + gMessageSystem->setHandlerFunc("TelehubInfo", processTelehubInfo); - childSetAction("connect_btn", onClickConnect, this); - childSetAction("disconnect_btn", onClickDisconnect, this); - childSetAction("add_spawn_point_btn", onClickAddSpawnPoint, this); - childSetAction("remove_spawn_point_btn", onClickRemoveSpawnPoint, this); + getChild<LLUICtrl>("connect_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickConnect, this)); + getChild<LLUICtrl>("disconnect_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickDisconnect, this)); + getChild<LLUICtrl>("add_spawn_point_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickAddSpawnPoint, this)); + getChild<LLUICtrl>("remove_spawn_point_btn")->setCommitCallback(boost::bind(&LLFloaterTelehub::onClickRemoveSpawnPoint, this)); LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list"); if (list) @@ -113,12 +80,28 @@ BOOL LLFloaterTelehub::postBuild() } void LLFloaterTelehub::onOpen(const LLSD& key) { + // Show tools floater by selecting translate (select) tool + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompTranslate::getInstance() ); + + // Find tools floater, glue to bottom + if (gFloaterTools) + { + LLRect tools_rect = gFloaterTools->getRect(); + S32 our_width = getRect().getWidth(); + S32 our_height = getRect().getHeight(); + LLRect our_rect; + our_rect.setLeftTopAndSize(tools_rect.mLeft, tools_rect.mBottom, our_width, our_height); + setRect(our_rect); + } + + sendTelehubInfoRequest(); + mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); } + LLFloaterTelehub::~LLFloaterTelehub() { - sInstance = NULL; - // no longer interested in this message gMessageSystem->setHandlerFunc("TelehubInfo", NULL); } @@ -160,19 +143,22 @@ void LLFloaterTelehub::refresh() BOOL LLFloaterTelehub::renderBeacons() { // only render if we've got a telehub - return sInstance && sInstance->mTelehubObjectID.notNull(); + LLFloaterTelehub* floater = LLFloaterReg::findTypedInstance<LLFloaterTelehub>("telehubs"); + return floater && floater->mTelehubObjectID.notNull(); } // static void LLFloaterTelehub::addBeacons() { - if (!sInstance) return; - + LLFloaterTelehub* floater = LLFloaterReg::findTypedInstance<LLFloaterTelehub>("telehubs"); + if (!floater) + return; + // Find the telehub position, either our cached old position, or // an updated one based on the actual object position. - LLVector3 hub_pos_region = sInstance->mTelehubPos; - LLQuaternion hub_rot = sInstance->mTelehubRot; - LLViewerObject* obj = gObjectList.findObject(sInstance->mTelehubObjectID); + LLVector3 hub_pos_region = floater->mTelehubPos; + LLQuaternion hub_rot = floater->mTelehubRot; + LLViewerObject* obj = gObjectList.findObject(floater->mTelehubObjectID); if (obj) { hub_pos_region = obj->getPositionRegion(); @@ -181,13 +167,13 @@ void LLFloaterTelehub::addBeacons() // Draw nice thick 3-pixel lines. gObjectList.addDebugBeacon(hub_pos_region, "", LLColor4::yellow, LLColor4::white, 4); - LLScrollListCtrl* list = sInstance->getChild<LLScrollListCtrl>("spawn_points_list"); + LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("spawn_points_list"); if (list) { S32 spawn_index = list->getFirstSelectedIndex(); if (spawn_index >= 0) { - LLVector3 spawn_pos = hub_pos_region + (sInstance->mSpawnPointPos[spawn_index] * hub_rot); + LLVector3 spawn_pos = hub_pos_region + (floater->mSpawnPointPos[spawn_index] * hub_rot); gObjectList.addDebugBeacon(spawn_pos, "", LLColor4::orange, LLColor4::white, 4); } } @@ -198,32 +184,27 @@ void LLFloaterTelehub::sendTelehubInfoRequest() LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "info ui"); } -// static -void LLFloaterTelehub::onClickConnect(void* data) +void LLFloaterTelehub::onClickConnect() { LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "connect"); } -// static -void LLFloaterTelehub::onClickDisconnect(void* data) +void LLFloaterTelehub::onClickDisconnect() { LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "delete"); } -// static -void LLFloaterTelehub::onClickAddSpawnPoint(void* data) +void LLFloaterTelehub::onClickAddSpawnPoint() { LLSelectMgr::getInstance()->sendGodlikeRequest("telehub", "spawnpoint add"); LLSelectMgr::getInstance()->deselectAll(); } -// static -void LLFloaterTelehub::onClickRemoveSpawnPoint(void* data) +void LLFloaterTelehub::onClickRemoveSpawnPoint() { - if (!sInstance) return; - - LLScrollListCtrl* list = sInstance->getChild<LLScrollListCtrl>("spawn_points_list"); - if (!list) return; + LLScrollListCtrl* list = getChild<LLScrollListCtrl>("spawn_points_list"); + if (!list) + return; S32 spawn_index = list->getFirstSelectedIndex(); if (spawn_index < 0) return; // nothing selected @@ -261,9 +242,10 @@ void LLFloaterTelehub::onClickRemoveSpawnPoint(void* data) // static void LLFloaterTelehub::processTelehubInfo(LLMessageSystem* msg, void**) { - if (sInstance) + LLFloaterTelehub* floater = LLFloaterReg::findTypedInstance<LLFloaterTelehub>("telehubs"); + if (floater) { - sInstance->unpackTelehubInfo(msg); + floater->unpackTelehubInfo(msg); } } diff --git a/indra/newview/llfloatertelehub.h b/indra/newview/llfloatertelehub.h index 86749dcc0b..5b654585f1 100644 --- a/indra/newview/llfloatertelehub.h +++ b/indra/newview/llfloatertelehub.h @@ -44,26 +44,24 @@ const S32 MAX_SPAWNPOINTS_PER_TELEHUB = 16; class LLFloaterTelehub : public LLFloater { public: - // Opens the floater on screen. - static void show(); + LLFloaterTelehub(const LLSD& key); + ~LLFloaterTelehub(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); - virtual void draw(); - /*virtual*/ BOOL postBuild(); - void onOpen(const LLSD& key); + /*virtual*/ void draw(); + static BOOL renderBeacons(); static void addBeacons(); -private: - LLFloaterTelehub(); - ~LLFloaterTelehub(); - void refresh(); void sendTelehubInfoRequest(); - static void onClickConnect(void* data); - static void onClickDisconnect(void* data); - static void onClickAddSpawnPoint(void* data); - static void onClickRemoveSpawnPoint(void* data); + void onClickConnect(); + void onClickDisconnect(); + void onClickAddSpawnPoint(); + void onClickRemoveSpawnPoint(); static void processTelehubInfo(LLMessageSystem* msg, void**); void unpackTelehubInfo(LLMessageSystem* msg); diff --git a/indra/newview/llfloatertestlistview.cpp b/indra/newview/llfloatertestlistview.cpp index f7a327c088..5c942d0ed9 100644 --- a/indra/newview/llfloatertestlistview.cpp +++ b/indra/newview/llfloatertestlistview.cpp @@ -63,15 +63,15 @@ BOOL LLFloaterTestListView::postBuild() void LLFloaterTestListView::onListViewChanged() { - llinfos << "JAMESDEBUG list view changed" << llendl; + llinfos << "list view changed" << llendl; } void LLFloaterTestListView::onClickTest1() { - llinfos << "JAMESDEBUG test 1" << llendl; + llinfos << "test 1" << llendl; } void LLFloaterTestListView::onClickTest2() { - llinfos << "JAMESDEBUG test 2" << llendl; + llinfos << "test 2" << llendl; } diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 4704630147..bbcab00ab2 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -198,6 +198,7 @@ LLPCode toolData[]={ BOOL LLFloaterTools::postBuild() { + mCloseSignal.connect(boost::bind(&LLFloaterTools::onClose, this)); // Hide until tool selected setVisible(FALSE); @@ -727,11 +728,8 @@ void LLFloaterTools::onOpen(const LLSD& key) gMenuBarView->setItemVisible("BuildTools", TRUE); } -// virtual -void LLFloaterTools::onClose(bool app_quitting) +void LLFloaterTools::onClose() { - setMinimized(FALSE); - setVisible(FALSE); mTab->setVisible(FALSE); LLViewerJoystick::getInstance()->moveAvatar(false); diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index 7bb072232a..1b9f1d31ec 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -73,7 +73,6 @@ public: virtual ~LLFloaterTools(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); /*virtual*/ BOOL canClose(); /*virtual*/ void draw(); /*virtual*/ void onFocusReceived(); @@ -103,10 +102,10 @@ public: static void setEditTool(void* data); void saveLastTool(); private: - static void setObjectType( LLPCode pcode ); - + void onClose(); void refresh(); + static void setObjectType( LLPCode pcode ); static void onClickGridOptions(void* data); public: diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index d75640ccb4..9859d34284 100644 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -52,43 +52,12 @@ #include "message.h" -// static -LLFloaterTOS* LLFloaterTOS::sInstance = NULL; - -// static -LLFloaterTOS* LLFloaterTOS::show(ETOSType type, - const std::string & message, - const YesNoCallback& callback) -{ - if( !LLFloaterTOS::sInstance ) - { - LLFloaterTOS::sInstance = new LLFloaterTOS(type, message, callback); - } - - if (type == TOS_TOS) - { - LLUICtrlFactory::getInstance()->buildFloater(LLFloaterTOS::sInstance, "floater_tos.xml"); - } - else - { - LLUICtrlFactory::getInstance()->buildFloater(LLFloaterTOS::sInstance, "floater_critical.xml"); - } - - sInstance->startModal(); - - return LLFloaterTOS::sInstance; -} - - -LLFloaterTOS::LLFloaterTOS(ETOSType type, - const std::string & message, - const YesNoCallback& callback) -: LLModalDialog( std::string(" "), 100, 100 ), - mType(type), - mMessage(message), +LLFloaterTOS::LLFloaterTOS(const LLSD& message) +: LLModalDialog( message, 100, 100 ), + mMessage(message.asString()), mWebBrowserWindowId( 0 ), mLoadCompleteCount( 0 ), - mCallback(callback) + mCallback() { } @@ -144,8 +113,8 @@ BOOL LLFloaterTOS::postBuild() childSetAction("Continue", onContinue, this); childSetAction("Cancel", onCancel, this); childSetCommitCallback("agree_chk", updateAgree, this); - - if ( mType != TOS_TOS ) + + if (hasChild("tos_text")) { // this displays the critical message LLTextEditor *editor = getChild<LLTextEditor>("tos_text"); @@ -182,17 +151,14 @@ BOOL LLFloaterTOS::postBuild() void LLFloaterTOS::setSiteIsAlive( bool alive ) { // only do this for TOS pages - if ( mType == TOS_TOS ) + if (hasChild("tos_html")) { LLWebBrowserCtrl* web_browser = getChild<LLWebBrowserCtrl>("tos_html"); // if the contents of the site was retrieved if ( alive ) { - if ( web_browser ) - { - // navigate to the "real" page - web_browser->navigateTo( getString( "real_url" ) ); - }; + // navigate to the "real" page + web_browser->navigateTo( getString( "real_url" ) ); } else { @@ -200,8 +166,8 @@ void LLFloaterTOS::setSiteIsAlive( bool alive ) // but if the page is unavailable, we need to do this now LLCheckBoxCtrl* tos_agreement = getChild<LLCheckBoxCtrl>("agree_chk"); tos_agreement->setEnabled( true ); - }; - }; + } + } } LLFloaterTOS::~LLFloaterTOS() @@ -216,8 +182,6 @@ LLFloaterTOS::~LLFloaterTOS() // tell the responder we're not here anymore if ( gResponsePtr ) gResponsePtr->setParent( 0 ); - - LLFloaterTOS::sInstance = NULL; } // virtual @@ -276,3 +240,8 @@ void LLFloaterTOS::onNavigateComplete( const EventType& eventIn ) tos_agreement->setEnabled( true ); }; } + +void LLFloaterTOS::setTOSCallback(LLFloaterTOS::YesNoCallback const & callback) +{ + mCallback = callback; +} diff --git a/indra/newview/llfloatertos.h b/indra/newview/llfloatertos.h index 67d2f0ceec..0b15c24bc8 100644 --- a/indra/newview/llfloatertos.h +++ b/indra/newview/llfloatertos.h @@ -49,22 +49,11 @@ class LLFloaterTOS : public LLWebBrowserCtrlObserver { public: + LLFloaterTOS(const LLSD& message); virtual ~LLFloaterTOS(); - // Types of dialog. - enum ETOSType - { - TOS_TOS = 0, - TOS_CRITICAL_MESSAGE = 1 - }; - typedef boost::function<void(bool)> YesNoCallback; - // Asset_id is overwritten with LLUUID::null when agree is clicked. - static LLFloaterTOS* show(ETOSType type, - const std::string & message, - const YesNoCallback& callback); - BOOL postBuild(); virtual void draw(); @@ -77,20 +66,14 @@ public: virtual void onNavigateComplete( const EventType& eventIn ); -private: - // Asset_id is overwritten with LLUUID::null when agree is clicked. - LLFloaterTOS(ETOSType type, - const std::string & message, - const YesNoCallback& callback); + // *TODO - consider getting rid of this in favor of using an event pump. -brad + void setTOSCallback(YesNoCallback const & callback); private: - ETOSType mType; std::string mMessage; int mWebBrowserWindowId; int mLoadCompleteCount; YesNoCallback mCallback; - - static LLFloaterTOS* sInstance; }; #endif // LL_LLFLOATERTOS_H diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index 4870494b20..e5b4657742 100644 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -71,10 +71,6 @@ #endif // Static initialization -LLFloaterUIPreview* LLFloaterUIPreview::sInstance = NULL; // initialization of static instance pointer to NULL -std::string LLFloaterUIPreview::mSavedEditorPath = std::string(""); -std::string LLFloaterUIPreview::mSavedEditorArgs = std::string(""); -std::string LLFloaterUIPreview::mSavedDiffPath = std::string(""); static const S32 PRIMARY_FLOATER = 1; static const S32 SECONDARY_FLOATER = 2; @@ -86,12 +82,74 @@ static std::string get_xui_dir() return gDirUtilp->getSkinBaseDir() + delim + "default" + delim + "xui" + delim; } +//---------------------------------------------------------------------------- +// Local class declarations +// Reset object to ensure that when we change the current language setting for preview purposes, +// it automatically is reset. Constructed on the stack at the start of the method; the reset +// occurs as it falls out of scope at the end of the method. See llfloateruipreview.cpp for usage. +class LLLocalizationResetForcer +{ +public: + LLLocalizationResetForcer(LLFloaterUIPreview* floater, S32 ID); + virtual ~LLLocalizationResetForcer(); + +private: + std::string mSavedLocalization; // the localization before we change it +}; + +// Implementation of live file +// When a floater is being previewed, any saved changes to its corresponding +// file cause the previewed floater to be reloaded +class LLGUIPreviewLiveFile : public LLLiveFile +{ +public: + LLGUIPreviewLiveFile(std::string path, std::string name, LLFloaterUIPreview* parent); + virtual ~LLGUIPreviewLiveFile(); + LLFloaterUIPreview* mParent; + LLFadeEventTimer* mFadeTimer; // timer for fade-to-yellow-and-back effect to warn that file has been reloaded + BOOL mFirstFade; // setting this avoids showing the fade reload warning on first load + std::string mFileName; +protected: + bool loadFile(); +}; + +// Implementation of graphical fade in/out (on timer) for when XUI files are updated +class LLFadeEventTimer : public LLEventTimer +{ +public: + LLFadeEventTimer(F32 refresh, LLGUIPreviewLiveFile* parent); + BOOL tick(); + LLGUIPreviewLiveFile* mParent; +private: + BOOL mFadingOut; // fades in then out; this is toggled in between + LLColor4 mOriginalColor; // original color; color is reset to this after fade is coimplete +}; + +// Implementation of previewed floater +// Used to override draw and mouse handler +class LLPreviewedFloater : public LLFloater +{ +public: + LLPreviewedFloater(LLFloaterUIPreview* floater) + : LLFloater(LLSD()), + mFloaterUIPreview(floater) + { + } + virtual void draw(); + BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + BOOL selectElement(LLView* parent, int x, int y, int depth); // select element to display its overlappers + + LLFloaterUIPreview* mFloaterUIPreview; +}; + +//---------------------------------------------------------------------------- + // Localization reset forcer -- ensures that when localization is temporarily changed for previewed floater, it is reset // Changes are made here -LLLocalizationResetForcer::LLLocalizationResetForcer(S32 ID) +LLLocalizationResetForcer::LLLocalizationResetForcer(LLFloaterUIPreview* floater, S32 ID) { mSavedLocalization = LLUI::sSettingGroups["config"]->getString("Language"); // save current localization setting - LLUI::sSettingGroups["config"]->setString("Language", LLFloaterUIPreview::getLocStr(ID));// hack language to be the one we want to preview floaters in + LLUI::sSettingGroups["config"]->setString("Language", floater->getLocStr(ID));// hack language to be the one we want to preview floaters in LLUI::setupPaths(); // forcibly reset XUI paths with this new language } @@ -201,7 +259,6 @@ LLFloaterUIPreview::LLFloaterUIPreview(const LLSD& key) mLastDisplayedY(0) { - sInstance = this; // called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_ui_preview.xml"); } @@ -211,27 +268,27 @@ LLFloaterUIPreview::~LLFloaterUIPreview() // spawned floaters are deleted automatically, so we don't need to delete them here // save contents of textfields so it can be restored later if the floater is created again this session - LLFloaterUIPreview::mSavedEditorPath = mEditorPathTextBox->getText(); - LLFloaterUIPreview::mSavedEditorArgs = mEditorArgsTextBox->getText(); - LLFloaterUIPreview::mSavedDiffPath = mDiffPathTextBox->getText(); + mSavedEditorPath = mEditorPathTextBox->getText(); + mSavedEditorArgs = mEditorArgsTextBox->getText(); + mSavedDiffPath = mDiffPathTextBox->getText(); // delete live file if it exists - if(sInstance->mLiveFile) + if(mLiveFile) { - delete sInstance->mLiveFile; - sInstance->mLiveFile = NULL; + delete mLiveFile; + mLiveFile = NULL; } - - sInstance = NULL; // clear static pointer } // Perform post-build setup (defined in superclass) BOOL LLFloaterUIPreview::postBuild() { + mCloseSignal.connect(boost::bind(&LLFloaterUIPreview::onClose, this, _2)); + LLPanel* main_panel_tmp = getChild<LLPanel>("main_panel"); // get a pointer to the main panel in order to... mFileList = main_panel_tmp->getChild<LLScrollListCtrl>("name_list"); // save pointer to file list // Double-click opens the floater, for convenience - mFileList->setDoubleClickCallback(onClickDisplayFloater, (void*)&PRIMARY_FLOATER); + mFileList->setDoubleClickCallback(boost::bind(&LLFloaterUIPreview::onClickDisplayFloater, this, PRIMARY_FLOATER)); // get pointers to buttons and link to callbacks mLanguageSelection = main_panel_tmp->getChild<LLComboBox>("language_select_combo"); @@ -240,26 +297,26 @@ BOOL LLFloaterUIPreview::postBuild() mLanguageSelection_2->setSelectionCallback(boost::bind(&LLFloaterUIPreview::onLanguageComboSelect, this, mLanguageSelection)); LLPanel* editor_panel_tmp = main_panel_tmp->getChild<LLPanel>("editor_panel"); mDisplayFloaterBtn = main_panel_tmp->getChild<LLButton>("display_floater"); - mDisplayFloaterBtn->setClickedCallback(onClickDisplayFloater, (void*)&PRIMARY_FLOATER); + mDisplayFloaterBtn->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickDisplayFloater, this, PRIMARY_FLOATER)); mDisplayFloaterBtn_2 = main_panel_tmp->getChild<LLButton>("display_floater_2"); - mDisplayFloaterBtn_2->setClickedCallback(onClickDisplayFloater, (void*)&SECONDARY_FLOATER); + mDisplayFloaterBtn_2->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickDisplayFloater, this, SECONDARY_FLOATER)); mToggleOverlapButton = main_panel_tmp->getChild<LLButton>("toggle_overlap_panel"); - mToggleOverlapButton->setClickedCallback(onClickToggleOverlapping, this); + mToggleOverlapButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickToggleOverlapping, this)); mCloseOtherButton = main_panel_tmp->getChild<LLButton>("close_displayed_floater"); - mCloseOtherButton->setClickedCallback(onClickCloseDisplayedFloater, (void*)&PRIMARY_FLOATER); + mCloseOtherButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickCloseDisplayedFloater, this, PRIMARY_FLOATER)); mCloseOtherButton_2 = main_panel_tmp->getChild<LLButton>("close_displayed_floater_2"); - mCloseOtherButton_2->setClickedCallback(onClickCloseDisplayedFloater, (void*)&SECONDARY_FLOATER); + mCloseOtherButton_2->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickCloseDisplayedFloater, this, SECONDARY_FLOATER)); mEditFloaterBtn = main_panel_tmp->getChild<LLButton>("edit_floater"); - mEditFloaterBtn->setClickedCallback(onClickEditFloater, this); + mEditFloaterBtn->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickEditFloater, this)); mExecutableBrowseButton = editor_panel_tmp->getChild<LLButton>("browse_for_executable"); LLPanel* vlt_panel_tmp = main_panel_tmp->getChild<LLPanel>("vlt_panel"); - mExecutableBrowseButton->setClickedCallback(onClickBrowseForEditor, this); + mExecutableBrowseButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickBrowseForEditor, this)); mDiffBrowseButton = vlt_panel_tmp->getChild<LLButton>("browse_for_vlt_diffs"); - mDiffBrowseButton->setClickedCallback(onClickBrowseForDiffs, NULL); + mDiffBrowseButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickBrowseForDiffs, this)); mToggleHighlightButton = vlt_panel_tmp->getChild<LLButton>("toggle_vlt_diff_highlight"); - mToggleHighlightButton->setClickedCallback(onClickToggleDiffHighlighting, NULL); - main_panel_tmp->getChild<LLButton>("save_floater")->setClickedCallback(onClickSaveFloater, (void*)&PRIMARY_FLOATER); - main_panel_tmp->getChild<LLButton>("save_all_floaters")->setClickedCallback(onClickSaveAll, (void*)&PRIMARY_FLOATER); + mToggleHighlightButton->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickToggleDiffHighlighting, this)); + main_panel_tmp->getChild<LLButton>("save_floater")->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickSaveFloater, this, PRIMARY_FLOATER)); + main_panel_tmp->getChild<LLButton>("save_all_floaters")->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickSaveAll, this, PRIMARY_FLOATER)); getChild<LLButton>("export_schema")->setClickedCallback(boost::bind(&LLFloaterUIPreview::onClickExportSchema, this)); @@ -269,14 +326,14 @@ BOOL LLFloaterUIPreview::postBuild() mDiffPathTextBox = vlt_panel_tmp->getChild<LLLineEditor>("vlt_diff_path_field"); // *HACK: restored saved editor path and args to textfields - mEditorPathTextBox->setText(LLFloaterUIPreview::mSavedEditorPath); - mEditorArgsTextBox->setText(LLFloaterUIPreview::mSavedEditorArgs); - mDiffPathTextBox->setText(LLFloaterUIPreview::mSavedDiffPath); + mEditorPathTextBox->setText(mSavedEditorPath); + mEditorArgsTextBox->setText(mSavedEditorArgs); + mDiffPathTextBox->setText(mSavedDiffPath); // Set up overlap panel mOverlapPanel = getChild<LLOverlapPanel>("overlap_panel"); - sInstance->childSetVisible("overlap_scroll", mHighlightingOverlaps); + childSetVisible("overlap_scroll", mHighlightingOverlaps); mDelim = gDirUtilp->getDirDelimiter(); // initialize delimiter to dir sep slash @@ -338,7 +395,7 @@ void LLFloaterUIPreview::onLanguageComboSelect(LLUICtrl* ctrl) { if(mDisplayedFloater) { - onClickCloseDisplayedFloater((void*)&PRIMARY_FLOATER); + onClickCloseDisplayedFloater(PRIMARY_FLOATER); displayFloater(TRUE,1); } } @@ -346,7 +403,7 @@ void LLFloaterUIPreview::onLanguageComboSelect(LLUICtrl* ctrl) { if(mDisplayedFloater_2) { - onClickCloseDisplayedFloater((void*)&PRIMARY_FLOATER); + onClickCloseDisplayedFloater(PRIMARY_FLOATER); displayFloater(TRUE,2); // *TODO: make take an arg } } @@ -385,16 +442,17 @@ void LLFloaterUIPreview::onClickExportSchema() // Close click handler -- delete my displayed floater if it exists -void LLFloaterUIPreview::onClose(bool app_quitting) +void LLFloaterUIPreview::onClose(const LLSD& app_quitting) { - if(!app_quitting && sInstance && sInstance->mDisplayedFloater) + if(!app_quitting.asBoolean() && mDisplayedFloater) { - onClickCloseDisplayedFloater((void*)&PRIMARY_FLOATER); - onClickCloseDisplayedFloater((void*)&SECONDARY_FLOATER); - delete sInstance->mDisplayedFloater; - sInstance->mDisplayedFloater = NULL; + onClickCloseDisplayedFloater(PRIMARY_FLOATER); + onClickCloseDisplayedFloater(SECONDARY_FLOATER); + delete mDisplayedFloater; + mDisplayedFloater = NULL; + delete mDisplayedFloater_2; + mDisplayedFloater_2 = NULL; } - destroy(); } // Error handling (to avoid code repetition) @@ -412,18 +470,18 @@ std::string LLFloaterUIPreview::getLocStr(S32 ID) { if(ID == 1) { - return sInstance->mLanguageSelection->getSelectedItemLabel(0); + return mLanguageSelection->getSelectedItemLabel(0); } else { - return sInstance->mLanguageSelection_2->getSelectedItemLabel(0); + return mLanguageSelection_2->getSelectedItemLabel(0); } } // Get localized directory (build path from data directory to XUI files, substituting localization string in for language) std::string LLFloaterUIPreview::getLocalizedDirectory() { - return get_xui_dir() + (sInstance ? getLocStr(1) : "en") + mDelim; // e.g. "C:/Code/guipreview/indra/newview/skins/xui/en/"; + return get_xui_dir() + (getLocStr(1)) + mDelim; // e.g. "C:/Code/guipreview/indra/newview/skins/xui/en/"; } // Refresh the list of floaters by doing a directory traverse for XML XUI floater files @@ -535,36 +593,33 @@ void LLFloaterUIPreview::addFloaterEntry(const std::string& path) } // Respond to button click to display/refresh currently-selected floater -void LLFloaterUIPreview::onClickDisplayFloater(void* data) +void LLFloaterUIPreview::onClickDisplayFloater(S32 caller_id) { - S32 caller_id = *((S32*)data); displayFloater(TRUE, caller_id); - if(caller_id == 1) + if(caller_id == PRIMARY_FLOATER) { - sInstance->mDisplayedFloater->center(); // move displayed floater to the center of the screen + mDisplayedFloater->center(); // move displayed floater to the center of the screen } } // Saves the current floater/panel -void LLFloaterUIPreview::onClickSaveFloater(void* data) +void LLFloaterUIPreview::onClickSaveFloater(S32 caller_id) { - S32 caller_id = *((S32*)data); displayFloater(TRUE, caller_id, true); - if(caller_id == 1) + if(caller_id == PRIMARY_FLOATER) { - sInstance->mDisplayedFloater->center(); // move displayed floater to the center of the screen + mDisplayedFloater->center(); // move displayed floater to the center of the screen } } // Saves all floater/panels -void LLFloaterUIPreview::onClickSaveAll(void* data) +void LLFloaterUIPreview::onClickSaveAll(S32 caller_id) { - S32 caller_id = *((S32*)data); - int listSize = sInstance->mFileList->getItemCount(); + int listSize = mFileList->getItemCount(); for (int index = 0; index < listSize; index++) { - sInstance->mFileList->selectNthItem(index); + mFileList->selectNthItem(index); displayFloater(TRUE, caller_id, true); } } @@ -586,43 +641,43 @@ static std::string append_new_to_xml_filename(const std::string& path) void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save) { // Convince UI that we're in a different language (the one selected on the drop-down menu) - LLLocalizationResetForcer reset_forcer(ID); // save old language in reset forcer object (to be reset upon destruction when it falls out of scope) + LLLocalizationResetForcer reset_forcer(this, ID); // save old language in reset forcer object (to be reset upon destruction when it falls out of scope) - LLPreviewedFloater** floaterp = (ID == 1 ? &(sInstance->mDisplayedFloater) : &(sInstance->mDisplayedFloater_2)); + LLPreviewedFloater** floaterp = (ID == 1 ? &(mDisplayedFloater) : &(mDisplayedFloater_2)); if(ID == 1) { - BOOL floater_already_open = sInstance->mDisplayedFloater != NULL; + BOOL floater_already_open = mDisplayedFloater != NULL; if(floater_already_open) // if we are already displaying a floater { - sInstance->mLastDisplayedX = sInstance->mDisplayedFloater->calcScreenRect().mLeft; // save floater's last known position to put the new one there - sInstance->mLastDisplayedY = sInstance->mDisplayedFloater->calcScreenRect().mBottom; - delete sInstance->mDisplayedFloater; // delete it (this closes it too) - sInstance->mDisplayedFloater = NULL; // and reset the pointer + mLastDisplayedX = mDisplayedFloater->calcScreenRect().mLeft; // save floater's last known position to put the new one there + mLastDisplayedY = mDisplayedFloater->calcScreenRect().mBottom; + delete mDisplayedFloater; // delete it (this closes it too) + mDisplayedFloater = NULL; // and reset the pointer } } else { - if(sInstance->mDisplayedFloater_2 != NULL) + if(mDisplayedFloater_2 != NULL) { - delete sInstance->mDisplayedFloater_2; - sInstance->mDisplayedFloater_2 = NULL; + delete mDisplayedFloater_2; + mDisplayedFloater_2 = NULL; } } - std::string path = sInstance->mFileList->getSelectedItemLabel(1); // get the path of the currently-selected floater + std::string path = mFileList->getSelectedItemLabel(1); // get the path of the currently-selected floater if(std::string("") == path) // if no item is selected { return; // ignore click (this can only happen with empty list; otherwise an item is always selected) } - *floaterp = new LLPreviewedFloater(); + *floaterp = new LLPreviewedFloater(this); if(!strncmp(path.c_str(),"floater_",8)) // if it's a floater { if (save) { LLXMLNodePtr floater_write = new LLXMLNode(); - LLUICtrlFactory::getInstance()->buildFloater(*floaterp, path, FALSE, floater_write); // just build it + LLUICtrlFactory::getInstance()->buildFloater(*floaterp, path, floater_write); // just build it if (!floater_write->isNull()) { @@ -636,7 +691,8 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save) } else { - LLUICtrlFactory::getInstance()->buildFloater(*floaterp, path, TRUE); // just build it + LLUICtrlFactory::getInstance()->buildFloater(*floaterp, path, NULL); // just build it + (*floaterp)->openFloater((*floaterp)->getKey()); } } @@ -702,7 +758,7 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save) if(ID == 1) { - (*floaterp)->setOrigin(sInstance->mLastDisplayedX, sInstance->mLastDisplayedY); + (*floaterp)->setOrigin(mLastDisplayedX, mLastDisplayedY); } // *HACK: Remove ability to close it; if you close it, its destructor gets called, but we don't know it's null and try to delete it again, @@ -711,22 +767,22 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save) if(ID == 1) { - sInstance->mCloseOtherButton->setEnabled(TRUE); // enable my floater's close button + mCloseOtherButton->setEnabled(TRUE); // enable my floater's close button } else { - sInstance->mCloseOtherButton_2->setEnabled(TRUE); + mCloseOtherButton_2->setEnabled(TRUE); } // *TODO: Make the secondary floater pop up next to the primary one. Doesn't seem to always work if secondary was up first... - if((sInstance->mDisplayedFloater && ID == 2) || (sInstance->mDisplayedFloater_2 && ID == 1)) + if((mDisplayedFloater && ID == 2) || (mDisplayedFloater_2 && ID == 1)) { - sInstance->mDisplayedFloater_2->setSnapTarget(sInstance->mDisplayedFloater->getHandle()); - sInstance->mDisplayedFloater->addDependentFloater(sInstance->mDisplayedFloater_2); + mDisplayedFloater_2->setSnapTarget(mDisplayedFloater->getHandle()); + mDisplayedFloater->addDependentFloater(mDisplayedFloater_2); } // Add localization to title so user knows whether it's localized or defaulted to en - std::string full_path = sInstance->getLocalizedDirectory() + path; + std::string full_path = getLocalizedDirectory() + path; std::string floater_lang = "EN"; llstat dummy; if(!LLFile::stat(full_path.c_str(), &dummy)) // if the file does not exist @@ -740,37 +796,37 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save) if(click && ID == 1 && !save) { // set up live file to track it - if(sInstance->mLiveFile) + if(mLiveFile) { - delete sInstance->mLiveFile; - sInstance->mLiveFile = NULL; + delete mLiveFile; + mLiveFile = NULL; } - sInstance->mLiveFile = new LLGUIPreviewLiveFile(std::string(full_path.c_str()),std::string(path.c_str()),sInstance); - sInstance->mLiveFile->checkAndReload(); - sInstance->mLiveFile->addToEventTimer(); + mLiveFile = new LLGUIPreviewLiveFile(std::string(full_path.c_str()),std::string(path.c_str()),this); + mLiveFile->checkAndReload(); + mLiveFile->addToEventTimer(); } if(ID == 1) { - sInstance->mToggleOverlapButton->setEnabled(TRUE); + mToggleOverlapButton->setEnabled(TRUE); } if(LLView::sHighlightingDiffs && click && ID == 1) { - sInstance->highlightChangedElements(); + highlightChangedElements(); } if(ID == 1) { - sInstance->mOverlapMap.clear(); + mOverlapPanel->mOverlapMap.clear(); LLView::sPreviewClickedElement = NULL; // stop overlapping elements from drawing - sInstance->mOverlapPanel->mLastClickedElement = NULL; - sInstance->findOverlapsInChildren((LLView*)sInstance->mDisplayedFloater); + mOverlapPanel->mLastClickedElement = NULL; + findOverlapsInChildren((LLView*)mDisplayedFloater); // highlight and enable them - if(sInstance->mHighlightingOverlaps) + if(mHighlightingOverlaps) { - for(OverlapMap::iterator iter = sInstance->mOverlapMap.begin(); iter != sInstance->mOverlapMap.end(); ++iter) + for(LLOverlapPanel::OverlapMap::iterator iter = mOverlapPanel->mOverlapMap.begin(); iter != mOverlapPanel->mOverlapMap.end(); ++iter) { LLView* viewp = iter->first; LLView::sPreviewHighlightedElements.insert(viewp); @@ -778,7 +834,7 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save) } else if(LLView::sHighlightingDiffs) { - sInstance->highlightChangedElements(); + highlightChangedElements(); } } @@ -786,14 +842,14 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save) } // Respond to button click to edit currently-selected floater -void LLFloaterUIPreview::onClickEditFloater(void*) +void LLFloaterUIPreview::onClickEditFloater() { - std::string file_name = sInstance->mFileList->getSelectedItemLabel(1); // get the file name of the currently-selected floater + std::string file_name = mFileList->getSelectedItemLabel(1); // get the file name of the currently-selected floater if(std::string("") == file_name) // if no item is selected { return; // ignore click } - std::string path = sInstance->getLocalizedDirectory() + file_name; + std::string path = getLocalizedDirectory() + file_name; // stat file to see if it exists (some localized versions may not have it there are no diffs, and then we try to open an nonexistent file) llstat dummy; @@ -802,12 +858,12 @@ void LLFloaterUIPreview::onClickEditFloater(void*) std::string warning = "No file for this floater exists in the selected localization. Opening the EN version instead."; popupAndPrintWarning(warning); - path = get_xui_dir() + sInstance->mDelim + "en" + sInstance->mDelim + file_name; // open the en version instead, by default + path = get_xui_dir() + mDelim + "en" + mDelim + file_name; // open the en version instead, by default } // get executable path const char* exe_path_char; - std::string path_in_textfield = sInstance->mEditorPathTextBox->getText(); + std::string path_in_textfield = mEditorPathTextBox->getText(); if(std::string("") != path_in_textfield) // if the text field is not emtpy, use its path { exe_path_char = path_in_textfield.c_str(); @@ -842,7 +898,7 @@ void LLFloaterUIPreview::onClickEditFloater(void*) { // build paths and arguments std::string args; - std::string custom_args = sInstance->mEditorArgsTextBox->getText(); + std::string custom_args = mEditorArgsTextBox->getText(); int position_of_file = custom_args.find(std::string("%FILE%"), 0); // prepare to replace %FILE% with actual file path std::string first_part_of_args = ""; std::string second_part_of_args = ""; @@ -859,7 +915,7 @@ void LLFloaterUIPreview::onClickEditFloater(void*) } // find directory in which executable resides by taking everything after last slash - int last_slash_position = exe_path.find_last_of(sInstance->mDelim); + int last_slash_position = exe_path.find_last_of(mDelim); if(-1 == last_slash_position) { std::string warning = std::string("Unable to find a valid path to the specified executable for XUI XML editing: ") + exe_path; @@ -973,7 +1029,7 @@ void LLFloaterUIPreview::onClickEditFloater(void*) } // Respond to button click to browse for an executable with which to edit XML files -void LLFloaterUIPreview::onClickBrowseForEditor(void*) +void LLFloaterUIPreview::onClickBrowseForEditor() { // create load dialog box LLFilePicker::ELoadFilter type = (LLFilePicker::ELoadFilter)((intptr_t)((void*)LLFilePicker::FFLOAD_ALL)); // nothing for *.exe so just use all @@ -1025,11 +1081,11 @@ void LLFloaterUIPreview::onClickBrowseForEditor(void*) } #endif - sInstance->mEditorPathTextBox->setText(std::string(executable_path)); // copy the path to the executable to the textfield for display and later fetching + mEditorPathTextBox->setText(std::string(executable_path)); // copy the path to the executable to the textfield for display and later fetching } // Respond to button click to browse for a VLT-generated diffs file -void LLFloaterUIPreview::onClickBrowseForDiffs(void*) +void LLFloaterUIPreview::onClickBrowseForDiffs() { // create load dialog box LLFilePicker::ELoadFilter type = (LLFilePicker::ELoadFilter)((intptr_t)((void*)LLFilePicker::FFLOAD_XML)); // nothing for *.exe so just use all @@ -1041,35 +1097,35 @@ void LLFloaterUIPreview::onClickBrowseForDiffs(void*) // put the selected path into text field const std::string chosen_path = picker.getFirstFile(); - sInstance->mDiffPathTextBox->setText(std::string(chosen_path)); // copy the path to the executable to the textfield for display and later fetching + mDiffPathTextBox->setText(std::string(chosen_path)); // copy the path to the executable to the textfield for display and later fetching if(LLView::sHighlightingDiffs) // if we're already highlighting, toggle off and then on so we get the data from the new file { - onClickToggleDiffHighlighting(NULL); - onClickToggleDiffHighlighting(NULL); + onClickToggleDiffHighlighting(); + onClickToggleDiffHighlighting(); } } -void LLFloaterUIPreview::onClickToggleDiffHighlighting(void*) +void LLFloaterUIPreview::onClickToggleDiffHighlighting() { - if(sInstance->mHighlightingOverlaps) + if(mHighlightingOverlaps) { - onClickToggleOverlapping(NULL); - sInstance->mToggleOverlapButton->toggleState(); + onClickToggleOverlapping(); + mToggleOverlapButton->toggleState(); } LLView::sPreviewHighlightedElements.clear(); // clear lists first - sInstance->mDiffsMap.clear(); - sInstance->mFileList->clearHighlightedItems(); + mDiffsMap.clear(); + mFileList->clearHighlightedItems(); if(LLView::sHighlightingDiffs) // Turning highlighting off { - LLView::sHighlightingDiffs = !sInstance->sHighlightingDiffs; + LLView::sHighlightingDiffs = !sHighlightingDiffs; return; } else // Turning highlighting on { // Get the file and make sure it exists - std::string path_in_textfield = sInstance->mDiffPathTextBox->getText(); // get file path + std::string path_in_textfield = mDiffPathTextBox->getText(); // get file path BOOL error = FALSE; if(std::string("") == path_in_textfield) // check for blank file @@ -1103,18 +1159,18 @@ void LLFloaterUIPreview::onClickToggleDiffHighlighting(void*) { if(!strncmp("file",child->getName().c_str(),5)) { - sInstance->scanDiffFile(child); + scanDiffFile(child); } else if(!strncmp("error",child->getName().c_str(),6)) { std::string error_file, error_message; child->getAttributeString("filename",error_file); child->getAttributeString("message",error_message); - if(sInstance->mDiffsMap.find(error_file) != sInstance->mDiffsMap.end()) + if(mDiffsMap.find(error_file) != mDiffsMap.end()) { - sInstance->mDiffsMap.insert(std::make_pair(error_file,std::make_pair(StringListPtr(new StringList), StringListPtr(new StringList)))); + mDiffsMap.insert(std::make_pair(error_file,std::make_pair(StringListPtr(new StringList), StringListPtr(new StringList)))); } - sInstance->mDiffsMap[error_file].second->push_back(error_message); + mDiffsMap[error_file].second->push_back(error_message); } else { @@ -1141,13 +1197,13 @@ void LLFloaterUIPreview::onClickToggleDiffHighlighting(void*) if(error) // if we encountered an error, reset the button to off { - sInstance->mToggleHighlightButton->setToggleState(FALSE); + mToggleHighlightButton->setToggleState(FALSE); } else // only toggle if we didn't encounter an error { - LLView::sHighlightingDiffs = !sInstance->sHighlightingDiffs; - sInstance->highlightChangedElements(); // *TODO: this is extraneous, right? - sInstance->highlightChangedFiles(); // *TODO: this is extraneous, right? + LLView::sHighlightingDiffs = !sHighlightingDiffs; + highlightChangedElements(); // *TODO: this is extraneous, right? + highlightChangedFiles(); // *TODO: this is extraneous, right? } } } @@ -1204,7 +1260,7 @@ void LLFloaterUIPreview::highlightChangedElements() for(std::list<std::string>::iterator iter = changed_element_paths->begin(); iter != changed_element_paths->end(); ++iter) // for every changed element path { - LLView* element = sInstance->mDisplayedFloater; + LLView* element = mDisplayedFloater; if(!strncmp(iter->c_str(),".",1)) // if it's the root floater itself { continue; @@ -1267,42 +1323,41 @@ void LLFloaterUIPreview::highlightChangedFiles() } // Respond to button click to browse for an executable with which to edit XML files -void LLFloaterUIPreview::onClickCloseDisplayedFloater(void* data) +void LLFloaterUIPreview::onClickCloseDisplayedFloater(S32 caller_id) { - S32 caller_id = *((S32*)data); - if(caller_id == 1) + if(caller_id == PRIMARY_FLOATER) { - sInstance->mCloseOtherButton->setEnabled(FALSE); - sInstance->mToggleOverlapButton->setEnabled(FALSE); + mCloseOtherButton->setEnabled(FALSE); + mToggleOverlapButton->setEnabled(FALSE); - if(sInstance->mDisplayedFloater) + if(mDisplayedFloater) { - sInstance->mLastDisplayedX = sInstance->mDisplayedFloater->calcScreenRect().mLeft; - sInstance->mLastDisplayedY = sInstance->mDisplayedFloater->calcScreenRect().mBottom; - delete sInstance->mDisplayedFloater; - sInstance->mDisplayedFloater = NULL; + mLastDisplayedX = mDisplayedFloater->calcScreenRect().mLeft; + mLastDisplayedY = mDisplayedFloater->calcScreenRect().mBottom; + delete mDisplayedFloater; + mDisplayedFloater = NULL; } - if(sInstance->mLiveFile) + if(mLiveFile) { - delete sInstance->mLiveFile; - sInstance->mLiveFile = NULL; + delete mLiveFile; + mLiveFile = NULL; } - if(sInstance->mToggleOverlapButton->getToggleState()) + if(mToggleOverlapButton->getToggleState()) { - sInstance->mToggleOverlapButton->toggleState(); - onClickToggleOverlapping(NULL); + mToggleOverlapButton->toggleState(); + onClickToggleOverlapping(); } LLView::sPreviewClickedElement = NULL; // stop overlapping elements panel from drawing - sInstance->mOverlapPanel->mLastClickedElement = NULL; + mOverlapPanel->mLastClickedElement = NULL; } else { - sInstance->mCloseOtherButton_2->setEnabled(FALSE); - delete sInstance->mDisplayedFloater_2; - sInstance->mDisplayedFloater_2 = NULL; + mCloseOtherButton_2->setEnabled(FALSE); + delete mDisplayedFloater_2; + mDisplayedFloater_2 = NULL; } } @@ -1358,47 +1413,47 @@ BOOL LLPreviewedFloater::selectElement(LLView* parent, int x, int y, int depth) void LLPreviewedFloater::draw() { - if(NULL != LLFloaterUIPreview::sInstance) + if(NULL != mFloaterUIPreview) { // Set and unset sDrawPreviewHighlights flag so as to avoid using two flags - if(LLFloaterUIPreview::sInstance->mHighlightingOverlaps) + if(mFloaterUIPreview->mHighlightingOverlaps) { LLView::sDrawPreviewHighlights = TRUE; } LLFloater::draw(); - if(LLFloaterUIPreview::sInstance->mHighlightingOverlaps) + if(mFloaterUIPreview->mHighlightingOverlaps) { LLView::sDrawPreviewHighlights = FALSE; } } } -void LLFloaterUIPreview::onClickToggleOverlapping(void*) +void LLFloaterUIPreview::onClickToggleOverlapping() { if(LLView::sHighlightingDiffs) { - onClickToggleDiffHighlighting(NULL); - sInstance->mToggleHighlightButton->toggleState(); + onClickToggleDiffHighlighting(); + mToggleHighlightButton->toggleState(); } LLView::sPreviewHighlightedElements.clear(); // clear lists first S32 width, height; - sInstance->getResizeLimits(&width, &height); // illegal call of non-static member function - if(sInstance->mHighlightingOverlaps) + getResizeLimits(&width, &height); // illegal call of non-static member function + if(mHighlightingOverlaps) { - sInstance->mHighlightingOverlaps = !sInstance->mHighlightingOverlaps; + mHighlightingOverlaps = !mHighlightingOverlaps; // reset list of preview highlighted elements - sInstance->setRect(LLRect(sInstance->getRect().mLeft,sInstance->getRect().mTop,sInstance->getRect().mRight - sInstance->mOverlapPanel->getRect().getWidth(),sInstance->getRect().mBottom)); - sInstance->setResizeLimits(width - sInstance->mOverlapPanel->getRect().getWidth(), height); + setRect(LLRect(getRect().mLeft,getRect().mTop,getRect().mRight - mOverlapPanel->getRect().getWidth(),getRect().mBottom)); + setResizeLimits(width - mOverlapPanel->getRect().getWidth(), height); } else { - sInstance->mHighlightingOverlaps = !sInstance->mHighlightingOverlaps; + mHighlightingOverlaps = !mHighlightingOverlaps; displayFloater(FALSE,1); - sInstance->setRect(LLRect(sInstance->getRect().mLeft,sInstance->getRect().mTop,sInstance->getRect().mRight + sInstance->mOverlapPanel->getRect().getWidth(),sInstance->getRect().mBottom)); - sInstance->setResizeLimits(width + sInstance->mOverlapPanel->getRect().getWidth(), height); + setRect(LLRect(getRect().mLeft,getRect().mTop,getRect().mRight + mOverlapPanel->getRect().getWidth(),getRect().mBottom)); + setResizeLimits(width + mOverlapPanel->getRect().getWidth(), height); } - sInstance->childSetVisible("overlap_scroll", sInstance->mHighlightingOverlaps); + childSetVisible("overlap_scroll", mHighlightingOverlaps); } void LLFloaterUIPreview::findOverlapsInChildren(LLView* parent) @@ -1429,7 +1484,7 @@ void LLFloaterUIPreview::findOverlapsInChildren(LLView* parent) // if they overlap... (we don't care if they're visible or enabled -- we want to check those anyway, i.e. hidden tabs that can be later shown) if(sibling != child && elementOverlap(child, sibling)) { - mOverlapMap[child].push_back(sibling); // add to the map + mOverlapPanel->mOverlapMap[child].push_back(sibling); // add to the map } } findOverlapsInChildren(child); // recur @@ -1481,13 +1536,13 @@ void LLOverlapPanel::draw() } else { - LLFloaterUIPreview::OverlapMap::iterator iterExists = LLFloaterUIPreview::sInstance->mOverlapMap.find(LLView::sPreviewClickedElement); - if(iterExists == LLFloaterUIPreview::sInstance->mOverlapMap.end()) + OverlapMap::iterator iterExists = mOverlapMap.find(LLView::sPreviewClickedElement); + if(iterExists == mOverlapMap.end()) { return; } - std::list<LLView*> overlappers = LLFloaterUIPreview::sInstance->mOverlapMap[LLView::sPreviewClickedElement]; + std::list<LLView*> overlappers = mOverlapMap[LLView::sPreviewClickedElement]; if(overlappers.size() == 0) { LLUI::translate(5,getRect().getHeight()-20); // translate to top-5,left-5 @@ -1518,15 +1573,15 @@ void LLOverlapPanel::draw() if(need_to_recalculate_bounds || LLView::sPreviewClickedElement->getName() != mLastClickedElement->getName()) { // reset panel's rectangle to its default width and height (300x600) - LLRect panel_rect = LLFloaterUIPreview::sInstance->mOverlapPanel->getRect(); - LLFloaterUIPreview::sInstance->mOverlapPanel->setRect(LLRect(panel_rect.mLeft,panel_rect.mTop,panel_rect.mLeft+LLFloaterUIPreview::sInstance->mOverlapPanel->getRect().getWidth(),panel_rect.mTop-LLFloaterUIPreview::sInstance->mOverlapPanel->getRect().getHeight())); + LLRect panel_rect = getRect(); + setRect(LLRect(panel_rect.mLeft,panel_rect.mTop,panel_rect.mLeft+getRect().getWidth(),panel_rect.mTop-getRect().getHeight())); LLRect rect; // change bounds for selected element int height_sum = mLastClickedElement->getRect().getHeight() + mSpacing + 80; - rect = LLFloaterUIPreview::sInstance->mOverlapPanel->getRect(); - LLFloaterUIPreview::sInstance->mOverlapPanel->setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() > mLastClickedElement->getRect().getWidth() + 5 ? rect.mRight : rect.mLeft + mLastClickedElement->getRect().getWidth() + 5, rect.mBottom)); + rect = getRect(); + setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() > mLastClickedElement->getRect().getWidth() + 5 ? rect.mRight : rect.mLeft + mLastClickedElement->getRect().getWidth() + 5, rect.mBottom)); // and widen to accomodate text if that's wider std::string display_text = current_selection_text + LLView::sPreviewClickedElement->getName(); @@ -1534,15 +1589,15 @@ void LLOverlapPanel::draw() rect = getRect(); setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() < text_width ? rect.mLeft + text_width : rect.mRight,rect.mTop)); - std::list<LLView*> overlappers = LLFloaterUIPreview::sInstance->mOverlapMap[LLView::sPreviewClickedElement]; + std::list<LLView*> overlappers = mOverlapMap[LLView::sPreviewClickedElement]; for(std::list<LLView*>::iterator overlap_it = overlappers.begin(); overlap_it != overlappers.end(); ++overlap_it) { LLView* viewp = *overlap_it; height_sum += viewp->getRect().getHeight() + mSpacing*3; // widen panel's rectangle to accommodate widest overlapping element of this floater - rect = LLFloaterUIPreview::sInstance->mOverlapPanel->getRect(); - LLFloaterUIPreview::sInstance->mOverlapPanel->setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() > viewp->getRect().getWidth() + 5 ? rect.mRight : rect.mLeft + viewp->getRect().getWidth() + 5, rect.mBottom)); + rect = getRect(); + setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() > viewp->getRect().getWidth() + 5 ? rect.mRight : rect.mLeft + viewp->getRect().getWidth() + 5, rect.mBottom)); // and widen to accomodate text if that's wider std::string display_text = overlapper_text + viewp->getName(); @@ -1551,8 +1606,8 @@ void LLOverlapPanel::draw() setRect(LLRect(rect.mLeft,rect.mTop,rect.getWidth() < text_width ? rect.mLeft + text_width : rect.mRight,rect.mTop)); } // change panel's height to accommodate all element heights plus spacing between them - rect = LLFloaterUIPreview::sInstance->mOverlapPanel->getRect(); - LLFloaterUIPreview::sInstance->mOverlapPanel->setRect(LLRect(rect.mLeft,rect.mTop,rect.mRight,rect.mTop-height_sum)); + rect = getRect(); + setRect(LLRect(rect.mLeft,rect.mTop,rect.mRight,rect.mTop-height_sum)); } LLUI::translate(5,getRect().getHeight()-10); // translate to top left diff --git a/indra/newview/llfloateruipreview.h b/indra/newview/llfloateruipreview.h index eca8c0a141..b8c378e2e9 100644 --- a/indra/newview/llfloateruipreview.h +++ b/indra/newview/llfloateruipreview.h @@ -54,57 +54,10 @@ class LLXmlTreeNode; class LLFloaterUIPreview; class LLFadeEventTimer; -// Reset object to ensure that when we change the current language setting for preview purposes, -// it automatically is reset. Constructed on the stack at the start of the method; the reset -// occurs as it falls out of scope at the end of the method. See llfloateruipreview.cpp for usage. -class LLLocalizationResetForcer -{ -public: - LLLocalizationResetForcer(S32 ID); - virtual ~LLLocalizationResetForcer(); - -private: - std::string mSavedLocalization; // the localization before we change it -}; - -// Implementation of live file -// When a floater is being previewed, any saved changes to its corresponding -// file cause the previewed floater to be reloaded -class LLGUIPreviewLiveFile : public LLLiveFile -{ -public: - LLGUIPreviewLiveFile(std::string path, std::string name, LLFloaterUIPreview* parent); - virtual ~LLGUIPreviewLiveFile(); - LLFloaterUIPreview* mParent; - LLFadeEventTimer* mFadeTimer; // timer for fade-to-yellow-and-back effect to warn that file has been reloaded - BOOL mFirstFade; // setting this avoids showing the fade reload warning on first load - std::string mFileName; -protected: - bool loadFile(); -}; - -// Implementation of graphical fade in/out (on timer) for when XUI files are updated -class LLFadeEventTimer : public LLEventTimer -{ -public: - LLFadeEventTimer(F32 refresh, LLGUIPreviewLiveFile* parent); - BOOL tick(); - LLGUIPreviewLiveFile* mParent; -private: - BOOL mFadingOut; // fades in then out; this is toggled in between - LLColor4 mOriginalColor; // original color; color is reset to this after fade is coimplete -}; - -// Implementation of previewed floater -// Used to override draw and mouse handler -class LLPreviewedFloater : public LLFloater -{ -public: - LLPreviewedFloater() : LLFloater() {} - virtual void draw(); - BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - BOOL selectElement(LLView* parent, int x, int y, int depth); // select element to display its overlappers -}; +class LLLocalizationResetForcer; +class LLGUIPreviewLiveFile; +class LLFadeEventTimer; +class LLPreviewedFloater; // Implementation of custom overlapping element display panel class LLOverlapPanel : public LLPanel @@ -123,11 +76,16 @@ public: mOriginalHeight = getRect().getHeight(); } virtual void draw(); + + typedef std::map<LLView*, std::list<LLView*> > OverlapMap; + OverlapMap mOverlapMap; // map, of XUI element to a list of XUI elements it overlaps + // LLView *mClickedElement; LLView *mLastClickedElement; int mOriginalWidth, mOriginalHeight, mSpacing; }; + class LLFloaterUIPreview : public LLFloater { public: @@ -135,15 +93,16 @@ public: LLFloaterUIPreview(const LLSD& key); virtual ~LLFloaterUIPreview(); - static std::string getLocStr(S32 ID); // fetches the localization string based on what is selected in the drop-down menu - static void displayFloater(BOOL click, S32 ID, bool save = false); // needs to be public so live file can call it when it finds an update - static BOOL containerType(LLView* viewp); // check if the element is a container type and tree traverses need to look at its children - static LLFloaterUIPreview* sInstance; // static instance of this (for references in handlers) + std::string getLocStr(S32 ID); // fetches the localization string based on what is selected in the drop-down menu + void displayFloater(BOOL click, S32 ID, bool save = false); // needs to be public so live file can call it when it finds an update BOOL postBuild(); // post-build setup (called by superclass' constructor) void refreshList(); // refresh list (empty it out and fill it up from scratch) void addFloaterEntry(const std::string& path); // add a single file's entry to the list of floaters - + + static BOOL containerType(LLView* viewp); // check if the element is a container type and tree traverses need to look at its children + +public: LLPreviewedFloater* mDisplayedFloater; // the floater which is currently being displayed LLPreviewedFloater* mDisplayedFloater_2; // the floater which is currently being displayed LLGUIPreviewLiveFile* mLiveFile; // live file for checking for updates to the currently-displayed XML file @@ -151,9 +110,6 @@ public: // BOOL mHighlightingDiffs; // bool for whether localization diffs are being highlighted or not BOOL mHighlightingOverlaps; // bool for whether overlapping elements are being highlighted - typedef std::map<LLView*, std::list<LLView*> > OverlapMap; - OverlapMap mOverlapMap; // map, of XUI element to a list of XUI elements it overlaps - // typedef std::map<std::string,std::pair<std::list<std::string>,std::list<std::string> > > DiffMap; // this version copies the lists etc., and thus is bad memory-wise typedef std::list<std::string> StringList; typedef boost::shared_ptr<StringList> StringListPtr; @@ -161,7 +117,7 @@ public: DiffMap mDiffsMap; // map, of filename to pair of list of changed element paths and list of errors protected: - virtual void onClose(bool app_quitting); + void onClose(const LLSD& app_quitting); private: // XUI elements for this floater @@ -174,19 +130,19 @@ private: LLButton* mEditFloaterBtn; // button to edit floater LLButton* mExecutableBrowseButton; // button to browse for executable LLButton* mCloseOtherButton; // button to close primary displayed floater - LLButton* mCloseOtherButton_2; // button to close secondary displayed floater + LLButton* mCloseOtherButton_2; // button to close secondary displayed floater LLButton* mDiffBrowseButton; // button to browse for diff file LLButton* mToggleHighlightButton; // button to toggle highlight of files/elements with diffs LLButton* mToggleOverlapButton; // button to togle overlap panel/highlighting LLComboBox* mLanguageSelection; // combo box for primary language selection LLComboBox* mLanguageSelection_2; // combo box for secondary language selection - LLScrollContainer* mOverlapScrollView; // overlapping elements scroll container + LLScrollContainer* mOverlapScrollView; // overlapping elements scroll container S32 mLastDisplayedX, mLastDisplayedY; // stored position of last floater so the new one opens up in the same place - std::string mDelim; // the OS-specific delimiter character (/ or \) (*TODO: this shouldn't be needed, right?) + std::string mDelim; // the OS-specific delimiter character (/ or \) (*TODO: this shouldn't be needed, right?) - static std::string mSavedEditorPath; // stored editor path so closing this floater doesn't reset it - static std::string mSavedEditorArgs; // stored editor args so closing this floater doesn't reset it - static std::string mSavedDiffPath; // stored diff file path so closing this floater doesn't reset it + std::string mSavedEditorPath; // stored editor path so closing this floater doesn't reset it + std::string mSavedEditorArgs; // stored editor args so closing this floater doesn't reset it + std::string mSavedDiffPath; // stored diff file path so closing this floater doesn't reset it // Internal functionality static void popupAndPrintWarning(std::string& warning); // pop up a warning @@ -202,15 +158,15 @@ private: BOOL elementOverlap(LLView* view1, LLView* view2); // Button/drop-down action listeners (self explanatory) - static void onClickDisplayFloater(void*); - static void onClickSaveFloater(void*); - static void onClickSaveAll(void*); - static void onClickEditFloater(void*); - static void onClickBrowseForEditor(void*); - static void onClickBrowseForDiffs(void*); - static void onClickToggleDiffHighlighting(void*); - static void onClickToggleOverlapping(void*); - static void onClickCloseDisplayedFloater(void*); + void onClickDisplayFloater(S32 id); + void onClickSaveFloater(S32 id); + void onClickSaveAll(S32 id); + void onClickEditFloater(); + void onClickBrowseForEditor(); + void onClickBrowseForDiffs(); + void onClickToggleDiffHighlighting(); + void onClickToggleOverlapping(); + void onClickCloseDisplayedFloater(S32 id); void onLanguageComboSelect(LLUICtrl* ctrl); void onClickExportSchema(); }; diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp index 1f59812029..2ad41291f3 100644 --- a/indra/newview/llfloaterurlentry.cpp +++ b/indra/newview/llfloaterurlentry.cpp @@ -86,10 +86,10 @@ public: // LLFloaterURLEntry() //----------------------------------------------------------------------------- LLFloaterURLEntry::LLFloaterURLEntry(LLHandle<LLPanel> parent) - : LLFloater(), + : LLFloater(LLSD()), mPanelLandMediaHandle(parent) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_url_entry.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_url_entry.xml", NULL); } //----------------------------------------------------------------------------- diff --git a/indra/newview/llfloatervoicedevicesettings.cpp b/indra/newview/llfloatervoicedevicesettings.cpp index 0cbeaa591d..fa76bb728d 100644 --- a/indra/newview/llfloatervoicedevicesettings.cpp +++ b/indra/newview/llfloatervoicedevicesettings.cpp @@ -294,6 +294,8 @@ LLFloaterVoiceDeviceSettings::LLFloaterVoiceDeviceSettings(const LLSD& seed) } BOOL LLFloaterVoiceDeviceSettings::postBuild() { + mCloseSignal.connect(boost::bind(&LLFloaterVoiceDeviceSettings::onClose, this)); + center(); return TRUE; } @@ -305,14 +307,12 @@ void LLFloaterVoiceDeviceSettings::onOpen(const LLSD& key) } } -void LLFloaterVoiceDeviceSettings::onClose(bool app_quitting) +void LLFloaterVoiceDeviceSettings::onClose() { if(mDevicePanel) { mDevicePanel->cleanup(); } - - setVisible(FALSE); } void LLFloaterVoiceDeviceSettings::apply() diff --git a/indra/newview/llfloatervoicedevicesettings.h b/indra/newview/llfloatervoicedevicesettings.h index ed8840a9f9..2565bfad2b 100644 --- a/indra/newview/llfloatervoicedevicesettings.h +++ b/indra/newview/llfloatervoicedevicesettings.h @@ -70,7 +70,6 @@ public: virtual BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void draw(); void apply(); void cancel(); @@ -79,7 +78,10 @@ private: protected: static void* createPanelVoiceDeviceSettings(void* user_data); - + + void onClose(); + +protected: LLPanelVoiceDeviceSettings* mDevicePanel; }; diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp index 5b551af836..72c82c178b 100644 --- a/indra/newview/llfloaterwater.cpp +++ b/indra/newview/llfloaterwater.cpp @@ -37,6 +37,7 @@ #include "pipeline.h" #include "llsky.h" +#include "llfloaterreg.h" #include "llsliderctrl.h" #include "llspinctrl.h" #include "llcolorswatch.h" @@ -62,15 +63,19 @@ #undef max -LLFloaterWater* LLFloaterWater::sWaterMenu = NULL; - std::set<std::string> LLFloaterWater::sDefaultPresets; -LLFloaterWater::LLFloaterWater() - : LLFloater() +LLFloaterWater::LLFloaterWater(const LLSD& key) + : LLFloater(key) +{ + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_water.xml"); +} + +LLFloaterWater::~LLFloaterWater() +{ +} +BOOL LLFloaterWater::postBuild() { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_water.xml"); - std::string def_water = getString("WLDefaultWaterNames"); @@ -82,15 +87,7 @@ LLFloaterWater::LLFloaterWater() std::string tok(*token_iter); sDefaultPresets.insert(tok); } - - -} - -LLFloaterWater::~LLFloaterWater() -{ -} -BOOL LLFloaterWater::postBuild() -{ + // add the combo boxes LLComboBox* comboBox = getChild<LLComboBox>("WaterPresetsCombo"); @@ -108,6 +105,7 @@ BOOL LLFloaterWater::postBuild() } // load it up initCallbacks(); + syncMenu(); return TRUE; } void LLFloaterWater::initCallbacks(void) { @@ -131,63 +129,58 @@ void LLFloaterWater::initCallbacks(void) { LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); - childSetCommitCallback("WaterFogColor", onWaterFogColorMoved, ¶m_mgr->mFogColor); + getChild<LLUICtrl>("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterWater::onWaterFogColorMoved, this, _1, ¶m_mgr->mFogColor)); // - childSetCommitCallback("WaterGlow", onColorControlAMoved, ¶m_mgr->mFogColor); + getChild<LLUICtrl>("WaterGlow")->setCommitCallback(boost::bind(&LLFloaterWater::onColorControlAMoved, this, _1, ¶m_mgr->mFogColor)); // fog density - childSetCommitCallback("WaterFogDensity", onExpFloatControlMoved, ¶m_mgr->mFogDensity); - childSetCommitCallback("WaterUnderWaterFogMod", onFloatControlMoved, ¶m_mgr->mUnderWaterFogMod); + getChild<LLUICtrl>("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterWater::onExpFloatControlMoved, this, _1, ¶m_mgr->mFogDensity)); + getChild<LLUICtrl>("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, ¶m_mgr->mUnderWaterFogMod)); // blue density - childSetCommitCallback("WaterNormalScaleX", onVector3ControlXMoved, ¶m_mgr->mNormalScale); - childSetCommitCallback("WaterNormalScaleY", onVector3ControlYMoved, ¶m_mgr->mNormalScale); - childSetCommitCallback("WaterNormalScaleZ", onVector3ControlZMoved, ¶m_mgr->mNormalScale); + getChild<LLUICtrl>("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlXMoved, this, _1, ¶m_mgr->mNormalScale)); + getChild<LLUICtrl>("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlYMoved, this, _1, ¶m_mgr->mNormalScale)); + getChild<LLUICtrl>("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlZMoved, this, _1, ¶m_mgr->mNormalScale)); // fresnel - childSetCommitCallback("WaterFresnelScale", onFloatControlMoved, ¶m_mgr->mFresnelScale); - childSetCommitCallback("WaterFresnelOffset", onFloatControlMoved, ¶m_mgr->mFresnelOffset); + getChild<LLUICtrl>("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, ¶m_mgr->mFresnelScale)); + getChild<LLUICtrl>("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, ¶m_mgr->mFresnelOffset)); // scale above/below - childSetCommitCallback("WaterScaleAbove", onFloatControlMoved, ¶m_mgr->mScaleAbove); - childSetCommitCallback("WaterScaleBelow", onFloatControlMoved, ¶m_mgr->mScaleBelow); + getChild<LLUICtrl>("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, ¶m_mgr->mScaleAbove)); + getChild<LLUICtrl>("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, ¶m_mgr->mScaleBelow)); // blur mult - childSetCommitCallback("WaterBlurMult", onFloatControlMoved, ¶m_mgr->mBlurMultiplier); + getChild<LLUICtrl>("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, ¶m_mgr->mBlurMultiplier)); // Load/save - LLComboBox* comboBox = getChild<LLComboBox>("WaterPresetsCombo"); - - //childSetAction("WaterLoadPreset", onLoadPreset, comboBox); - childSetAction("WaterNewPreset", onNewPreset, comboBox); - childSetAction("WaterSavePreset", onSavePreset, comboBox); - childSetAction("WaterDeletePreset", onDeletePreset, comboBox); +// getChild<LLUICtrl>("WaterLoadPreset")->setCommitCallback(boost::bind(&LLFloaterWater::onLoadPreset, this)); + getChild<LLUICtrl>("WaterNewPreset")->setCommitCallback(boost::bind(&LLFloaterWater::onNewPreset, this)); + getChild<LLUICtrl>("WaterSavePreset")->setCommitCallback(boost::bind(&LLFloaterWater::onSavePreset, this)); + getChild<LLUICtrl>("WaterDeletePreset")->setCommitCallback(boost::bind(&LLFloaterWater::onDeletePreset, this)); // wave direction - childSetCommitCallback("WaterWave1DirX", onVector2ControlXMoved, ¶m_mgr->mWave1Dir); - childSetCommitCallback("WaterWave1DirY", onVector2ControlYMoved, ¶m_mgr->mWave1Dir); - childSetCommitCallback("WaterWave2DirX", onVector2ControlXMoved, ¶m_mgr->mWave2Dir); - childSetCommitCallback("WaterWave2DirY", onVector2ControlYMoved, ¶m_mgr->mWave2Dir); + getChild<LLUICtrl>("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlXMoved, this, _1, ¶m_mgr->mWave1Dir)); + getChild<LLUICtrl>("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlYMoved, this, _1, ¶m_mgr->mWave1Dir)); + getChild<LLUICtrl>("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlXMoved, this, _1, ¶m_mgr->mWave2Dir)); + getChild<LLUICtrl>("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlYMoved, this, _1, ¶m_mgr->mWave2Dir)); - comboBox->setCommitCallback(boost::bind(&LLFloaterWater::onChangePresetName, this, _1)); + getChild<LLUICtrl>("WaterPresetsCombo")->setCommitCallback(boost::bind(&LLFloaterWater::onChangePresetName, this, _1)); LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap"); textCtrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); - childSetCommitCallback("WaterNormalMap", onNormalMapPicked, NULL); + getChild<LLUICtrl>("WaterNormalMap")->setCommitCallback(boost::bind(&LLFloaterWater::onNormalMapPicked, this, _1)); } -void LLFloaterWater::onClickHelp(void* data) +void LLFloaterWater::onClickHelp(std::string xml_alert) { - LLFloaterWater* self = LLFloaterWater::instance(); - - const std::string* xml_alert = (std::string*)data; - LLNotifications::instance().add(self->contextualNotification(*xml_alert)); + LLNotifications::instance().add(contextualNotification(xml_alert)); } void LLFloaterWater::initHelpBtn(const std::string& name, const std::string& xml_alert) { - childSetAction(name, onClickHelp, new std::string(xml_alert)); + getChild<LLButton>(name)->setClickedCallback(boost::bind(&LLFloaterWater::onClickHelp, this, xml_alert)); } bool LLFloaterWater::newPromptCallback(const LLSD& notification, const LLSD& response) @@ -201,7 +194,7 @@ bool LLFloaterWater::newPromptCallback(const LLSD& notification, const LLSD& res } if(option == 0) { - LLComboBox* comboBox = sWaterMenu->getChild<LLComboBox>( "WaterPresetsCombo"); + LLComboBox* comboBox = getChild<LLComboBox>( "WaterPresetsCombo"); LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); @@ -245,7 +238,7 @@ void LLFloaterWater::syncMenu() LLColor4 col = param_mgr->getFogColor(); childSetValue("WaterGlow", col.mV[3]); col.mV[3] = 1.0f; - LLColorSwatchCtrl* colCtrl = sWaterMenu->getChild<LLColorSwatchCtrl>("WaterFogColor"); + LLColorSwatchCtrl* colCtrl = getChild<LLColorSwatchCtrl>("WaterFogColor"); colCtrl->set(col); @@ -290,56 +283,15 @@ void LLFloaterWater::syncMenu() childSetValue("WaterWave2DirX", param_mgr->mWave2Dir.mX); childSetValue("WaterWave2DirY", param_mgr->mWave2Dir.mY); - LLTextureCtrl* textCtrl = sWaterMenu->getChild<LLTextureCtrl>("WaterNormalMap"); + LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap"); textCtrl->setImageAssetID(param_mgr->getNormalMapID()); } -// static -LLFloaterWater* LLFloaterWater::instance() -{ - if (!sWaterMenu) - { - sWaterMenu = new LLFloaterWater(); - sWaterMenu->openFloater(); - sWaterMenu->setFocus(TRUE); - } - return sWaterMenu; -} -void LLFloaterWater::show() -{ - LLFloaterWater* water = instance(); - water->syncMenu(); - - // comment in if you want the menu to rebuild each time - //LLUICtrlFactory::getInstance()->buildFloater(water, "floater_water.xml"); - //water->initCallbacks(); - - water->openFloater(); -} - -bool LLFloaterWater::isOpen() -{ - if (sWaterMenu != NULL) { - return true; - } - return false; -} - -// virtual -void LLFloaterWater::onClose(bool app_quitting) -{ - if (sWaterMenu) - { - sWaterMenu->setVisible(FALSE); - } -} - // vector control callbacks -void LLFloaterWater::onVector3ControlXMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onVector3ControlXMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl) { LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WaterVector3Control * vectorControl = static_cast<WaterVector3Control *>(userData); vectorControl->mX = sldrCtrl->getValueF32(); @@ -349,10 +301,9 @@ void LLFloaterWater::onVector3ControlXMoved(LLUICtrl* ctrl, void* userData) } // vector control callbacks -void LLFloaterWater::onVector3ControlYMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onVector3ControlYMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl) { LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WaterVector3Control * vectorControl = static_cast<WaterVector3Control *>(userData); vectorControl->mY = sldrCtrl->getValueF32(); @@ -362,10 +313,9 @@ void LLFloaterWater::onVector3ControlYMoved(LLUICtrl* ctrl, void* userData) } // vector control callbacks -void LLFloaterWater::onVector3ControlZMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onVector3ControlZMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl) { LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WaterVector3Control * vectorControl = static_cast<WaterVector3Control *>(userData); vectorControl->mZ = sldrCtrl->getValueF32(); @@ -376,10 +326,9 @@ void LLFloaterWater::onVector3ControlZMoved(LLUICtrl* ctrl, void* userData) // vector control callbacks -void LLFloaterWater::onVector2ControlXMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onVector2ControlXMoved(LLUICtrl* ctrl, WaterVector2Control* vectorControl) { LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WaterVector2Control * vectorControl = static_cast<WaterVector2Control *>(userData); vectorControl->mX = sldrCtrl->getValueF32(); @@ -389,10 +338,9 @@ void LLFloaterWater::onVector2ControlXMoved(LLUICtrl* ctrl, void* userData) } // vector control callbacks -void LLFloaterWater::onVector2ControlYMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onVector2ControlYMoved(LLUICtrl* ctrl, WaterVector2Control* vectorControl) { LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WaterVector2Control * vectorControl = static_cast<WaterVector2Control *>(userData); vectorControl->mY = sldrCtrl->getValueF32(); @@ -402,10 +350,9 @@ void LLFloaterWater::onVector2ControlYMoved(LLUICtrl* ctrl, void* userData) } // color control callbacks -void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) { LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData); colorControl->mR = sldrCtrl->getValueF32(); @@ -418,7 +365,7 @@ void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, void* userData) std::string name = colorControl->mSliderName; name.append("I"); - sWaterMenu->childSetValue(name, colorControl->mR); + childSetValue(name, colorControl->mR); } colorControl->update(LLWaterParamManager::instance()->mCurParams); @@ -426,10 +373,9 @@ void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, void* userData) LLWaterParamManager::instance()->propagateParameters(); } -void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) { LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData); colorControl->mG = sldrCtrl->getValueF32(); @@ -442,7 +388,7 @@ void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, void* userData) std::string name = colorControl->mSliderName; name.append("I"); - sWaterMenu->childSetValue(name, colorControl->mG); + childSetValue(name, colorControl->mG); } @@ -451,10 +397,9 @@ void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, void* userData) LLWaterParamManager::instance()->propagateParameters(); } -void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) { LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData); colorControl->mB = sldrCtrl->getValueF32(); @@ -467,7 +412,7 @@ void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, void* userData) std::string name = colorControl->mSliderName; name.append("I"); - sWaterMenu->childSetValue(name, colorControl->mB); + childSetValue(name, colorControl->mB); } colorControl->update(LLWaterParamManager::instance()->mCurParams); @@ -475,10 +420,9 @@ void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, void* userData) LLWaterParamManager::instance()->propagateParameters(); } -void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) { LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData); colorControl->mA = sldrCtrl->getValueF32(); @@ -488,10 +432,9 @@ void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, void* userData) } -void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) { LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData); colorControl->mI = sldrCtrl->getValueF32(); @@ -538,9 +481,9 @@ void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, void* userData) } // set the sliders to the new vals - sWaterMenu->childSetValue(rName, colorControl->mR); - sWaterMenu->childSetValue(gName, colorControl->mG); - sWaterMenu->childSetValue(bName, colorControl->mB); + childSetValue(rName, colorControl->mR); + childSetValue(gName, colorControl->mG); + childSetValue(bName, colorControl->mB); } // now update the current parameters and send them to shaders @@ -548,10 +491,9 @@ void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, void* userData) LLWaterParamManager::instance()->propagateParameters(); } -void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl) { LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WaterExpFloatControl * expFloatControl = static_cast<WaterExpFloatControl *>(userData); F32 val = sldrCtrl->getValueF32(); expFloatControl->mExp = val; @@ -561,50 +503,40 @@ void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, void* userData) LLWaterParamManager::instance()->propagateParameters(); } -void LLFloaterWater::onFloatControlMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floatControl) { LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WaterFloatControl * floatControl = static_cast<WaterFloatControl *>(userData); floatControl->mX = sldrCtrl->getValueF32() / floatControl->mMult; floatControl->update(LLWaterParamManager::instance()->mCurParams); LLWaterParamManager::instance()->propagateParameters(); } -void LLFloaterWater::onWaterFogColorMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onWaterFogColorMoved(LLUICtrl* ctrl, WaterColorControl* colorControl) { LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl); - WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData); *colorControl = swatch->get(); colorControl->update(LLWaterParamManager::instance()->mCurParams); LLWaterParamManager::instance()->propagateParameters(); } -void LLFloaterWater::onBoolToggle(LLUICtrl* ctrl, void* userData) -{ - LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl); - - bool value = cbCtrl->get(); - (*(static_cast<BOOL *>(userData))) = value; -} - -void LLFloaterWater::onNormalMapPicked(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onNormalMapPicked(LLUICtrl* ctrl) { LLTextureCtrl* textCtrl = static_cast<LLTextureCtrl*>(ctrl); LLUUID textID = textCtrl->getImageAssetID(); LLWaterParamManager::instance()->setNormalMapID(textID); } -void LLFloaterWater::onNewPreset(void* userData) +void LLFloaterWater::onNewPreset() { - LLNotifications::instance().add("NewWaterPreset", LLSD(), LLSD(), newPromptCallback); + LLNotifications::instance().add("NewWaterPreset", LLSD(), LLSD(), boost::bind(&LLFloaterWater::newPromptCallback, this, _1, _2)); } -void LLFloaterWater::onSavePreset(void* userData) +void LLFloaterWater::onSavePreset() { // get the name - LLComboBox* comboBox = sWaterMenu->getChild<LLComboBox>("WaterPresetsCombo"); + LLComboBox* comboBox = getChild<LLComboBox>("WaterPresetsCombo"); // don't save the empty name if(comboBox->getSelectedItemLabel() == "") @@ -624,7 +556,7 @@ void LLFloaterWater::onSavePreset(void* userData) return; } - LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback); + LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterWater::saveAlertCallback, this, _1, _2)); } bool LLFloaterWater::saveAlertCallback(const LLSD& notification, const LLSD& response) @@ -645,9 +577,9 @@ bool LLFloaterWater::saveAlertCallback(const LLSD& notification, const LLSD& res return false; } -void LLFloaterWater::onDeletePreset(void* userData) +void LLFloaterWater::onDeletePreset() { - LLComboBox* combo_box = sWaterMenu->getChild<LLComboBox>("WaterPresetsCombo"); + LLComboBox* combo_box = getChild<LLComboBox>("WaterPresetsCombo"); if(combo_box->getSelectedValue().asString() == "") { @@ -656,7 +588,7 @@ void LLFloaterWater::onDeletePreset(void* userData) LLSD args; args["SKY"] = combo_box->getSelectedValue().asString(); - LLNotifications::instance().add("WLDeletePresetAlert", args, LLSD(), deleteAlertCallback); + LLNotifications::instance().add("WLDeletePresetAlert", args, LLSD(), boost::bind(&LLFloaterWater::deleteAlertCallback, this, _1, _2)); } bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& response) @@ -665,14 +597,13 @@ bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& r // if they choose delete, do it. Otherwise, don't do anything if(option == 0) { - LLComboBox* combo_box = sWaterMenu->getChild<LLComboBox>("WaterPresetsCombo"); - LLFloaterDayCycle* day_cycle = NULL; + LLComboBox* combo_box = getChild<LLComboBox>("WaterPresetsCombo"); + LLFloaterDayCycle* day_cycle = LLFloaterReg::findTypedInstance<LLFloaterDayCycle>("env_day_cycle"); LLComboBox* key_combo = NULL; LLMultiSliderCtrl* mult_sldr = NULL; - if(LLFloaterDayCycle::isOpen()) + if (day_cycle) { - day_cycle = LLFloaterDayCycle::instance(); key_combo = day_cycle->getChild<LLComboBox>("WaterKeyPresets"); mult_sldr = day_cycle->getChild<LLMultiSliderCtrl>("WaterDayCycleKeys"); } @@ -723,7 +654,7 @@ void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl) if(!data.empty()) { LLWaterParamManager::instance()->loadPreset(data); - sWaterMenu->syncMenu(); + syncMenu(); } } diff --git a/indra/newview/llfloaterwater.h b/indra/newview/llfloaterwater.h index 50fd7dd450..08c630c69e 100644 --- a/indra/newview/llfloaterwater.h +++ b/indra/newview/llfloaterwater.h @@ -42,91 +42,74 @@ #include <vector> #include "llwlparamset.h" +struct WaterVector2Control; +struct WaterVector3Control; struct WaterColorControl; -struct WaterloatControl; - +struct WaterFloatControl; +struct WaterExpFloatControl; /// Menuing system for all of windlight's functionality class LLFloaterWater : public LLFloater { public: - LLFloaterWater(); + LLFloaterWater(const LLSD& key); virtual ~LLFloaterWater(); /*virtual*/ BOOL postBuild(); /// initialize all void initCallbacks(void); - /// one and one instance only - static LLFloaterWater* instance(); - // help button stuff - static void onClickHelp(void* data); + void onClickHelp(std::string xml_alert); void initHelpBtn(const std::string& name, const std::string& xml_alert); - static bool newPromptCallback(const LLSD& notification, const LLSD& response); + bool newPromptCallback(const LLSD& notification, const LLSD& response); /// general purpose callbacks for dealing with color controllers - static void onColorControlRMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlGMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlBMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlAMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlIMoved(LLUICtrl* ctrl, void* userData); - - static void onVector3ControlXMoved(LLUICtrl* ctrl, void* userData); - static void onVector3ControlYMoved(LLUICtrl* ctrl, void* userData); - static void onVector3ControlZMoved(LLUICtrl* ctrl, void* userData); + void onColorControlRMoved(LLUICtrl* ctrl, WaterColorControl* colorControl); + void onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* colorControl); + void onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* colorControl); + void onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* colorControl); + void onColorControlIMoved(LLUICtrl* ctrl, WaterColorControl* colorControl); - static void onVector2ControlXMoved(LLUICtrl* ctrl, void* userData); - static void onVector2ControlYMoved(LLUICtrl* ctrl, void* userData); + void onVector3ControlXMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl); + void onVector3ControlYMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl); + void onVector3ControlZMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl); - static void onFloatControlMoved(LLUICtrl* ctrl, void* userData); + void onVector2ControlXMoved(LLUICtrl* ctrl, WaterVector2Control* vectorControl); + void onVector2ControlYMoved(LLUICtrl* ctrl, WaterVector2Control* vectorControl); + + void onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floatControl); - static void onExpFloatControlMoved(LLUICtrl* ctrl, void* userData); + void onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl); - static void onWaterFogColorMoved(LLUICtrl* ctrl, void* userData); - - static void onBoolToggle(LLUICtrl* ctrl, void* userData); + void onWaterFogColorMoved(LLUICtrl* ctrl, WaterColorControl* colorControl); /// handle if they choose a new normal map - static void onNormalMapPicked(LLUICtrl* ctrl, void* userData); + void onNormalMapPicked(LLUICtrl* ctrl); /// when user hits the load preset button - static void onNewPreset(void* userData); + void onNewPreset(); /// when user hits the save preset button - static void onSavePreset(void* userData); + void onSavePreset(); /// prompts a user when overwriting a preset - static bool saveAlertCallback(const LLSD& notification, const LLSD& response); + bool saveAlertCallback(const LLSD& notification, const LLSD& response); /// when user hits the save preset button - static void onDeletePreset(void* userData); + void onDeletePreset(); /// prompts a user when overwriting a preset - static bool deleteAlertCallback(const LLSD& notification, const LLSD& response); + bool deleteAlertCallback(const LLSD& notification, const LLSD& response); /// what to do when you change the preset name void onChangePresetName(LLUICtrl* ctrl); - //// menu management - - /// show off our menu - static void show(); - - /// return if the menu exists or not - static bool isOpen(); - - /// stuff to do on exit - virtual void onClose(bool app_quitting); - /// sync up sliders with parameters void syncMenu(); private: - // one instance on the inside - static LLFloaterWater* sWaterMenu; - static std::set<std::string> sDefaultPresets; }; diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp index 2ba4002d94..18745284cb 100644 --- a/indra/newview/llfloaterwindlight.cpp +++ b/indra/newview/llfloaterwindlight.cpp @@ -37,6 +37,7 @@ #include "pipeline.h" #include "llsky.h" +#include "llfloaterreg.h" #include "llsliderctrl.h" #include "llmultislider.h" #include "llmultisliderctrl.h" @@ -61,19 +62,22 @@ #undef max -LLFloaterWindLight* LLFloaterWindLight::sWindLight = NULL; - std::set<std::string> LLFloaterWindLight::sDefaultPresets; static const F32 WL_SUN_AMBIENT_SLIDER_SCALE = 3.0f; -LLFloaterWindLight::LLFloaterWindLight() - : LLFloater() +LLFloaterWindLight::LLFloaterWindLight(const LLSD& key) + : LLFloater(key) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_windlight_options.xml"); - + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_windlight_options.xml"); +} +LLFloaterWindLight::~LLFloaterWindLight() +{ +} +BOOL LLFloaterWindLight::postBuild() +{ // add the list of presets std::string def_days = getString("WLDefaultSkyNames"); @@ -85,13 +89,7 @@ LLFloaterWindLight::LLFloaterWindLight() std::string tok(*token_iter); sDefaultPresets.insert(tok); } -} -LLFloaterWindLight::~LLFloaterWindLight() -{ -} -BOOL LLFloaterWindLight::postBuild() -{ // add the combo boxes LLComboBox* comboBox = getChild<LLComboBox>("WLPresetsCombo"); @@ -112,6 +110,9 @@ BOOL LLFloaterWindLight::postBuild() } // load it up initCallbacks(); + + syncMenu(); + return TRUE; } void LLFloaterWindLight::initCallbacks(void) { @@ -149,102 +150,99 @@ void LLFloaterWindLight::initCallbacks(void) { LLWLParamManager * param_mgr = LLWLParamManager::instance(); // blue horizon - childSetCommitCallback("WLBlueHorizonR", onColorControlRMoved, ¶m_mgr->mBlueHorizon); - childSetCommitCallback("WLBlueHorizonG", onColorControlGMoved, ¶m_mgr->mBlueHorizon); - childSetCommitCallback("WLBlueHorizonB", onColorControlBMoved, ¶m_mgr->mBlueHorizon); - childSetCommitCallback("WLBlueHorizonI", onColorControlIMoved, ¶m_mgr->mBlueHorizon); + getChild<LLUICtrl>("WLBlueHorizonR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mBlueHorizon)); + getChild<LLUICtrl>("WLBlueHorizonG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mBlueHorizon)); + getChild<LLUICtrl>("WLBlueHorizonB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mBlueHorizon)); + getChild<LLUICtrl>("WLBlueHorizonI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr->mBlueHorizon)); // haze density, horizon, mult, and altitude - childSetCommitCallback("WLHazeDensity", onColorControlRMoved, ¶m_mgr->mHazeDensity); - childSetCommitCallback("WLHazeHorizon", onColorControlRMoved, ¶m_mgr->mHazeHorizon); - childSetCommitCallback("WLDensityMult", onFloatControlMoved, ¶m_mgr->mDensityMult); - childSetCommitCallback("WLMaxAltitude", onFloatControlMoved, ¶m_mgr->mMaxAlt); + getChild<LLUICtrl>("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mHazeDensity)); + getChild<LLUICtrl>("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mHazeHorizon)); + getChild<LLUICtrl>("WLDensityMult")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr->mDensityMult)); + getChild<LLUICtrl>("WLMaxAltitude")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr->mMaxAlt)); // blue density - childSetCommitCallback("WLBlueDensityR", onColorControlRMoved, ¶m_mgr->mBlueDensity); - childSetCommitCallback("WLBlueDensityG", onColorControlGMoved, ¶m_mgr->mBlueDensity); - childSetCommitCallback("WLBlueDensityB", onColorControlBMoved, ¶m_mgr->mBlueDensity); - childSetCommitCallback("WLBlueDensityI", onColorControlIMoved, ¶m_mgr->mBlueDensity); + getChild<LLUICtrl>("WLBlueDensityR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mBlueDensity)); + getChild<LLUICtrl>("WLBlueDensityG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mBlueDensity)); + getChild<LLUICtrl>("WLBlueDensityB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mBlueDensity)); + getChild<LLUICtrl>("WLBlueDensityI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr->mBlueDensity)); // Lighting // sunlight - childSetCommitCallback("WLSunlightR", onColorControlRMoved, ¶m_mgr->mSunlight); - childSetCommitCallback("WLSunlightG", onColorControlGMoved, ¶m_mgr->mSunlight); - childSetCommitCallback("WLSunlightB", onColorControlBMoved, ¶m_mgr->mSunlight); - childSetCommitCallback("WLSunlightI", onColorControlIMoved, ¶m_mgr->mSunlight); + getChild<LLUICtrl>("WLSunlightR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mSunlight)); + getChild<LLUICtrl>("WLSunlightG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mSunlight)); + getChild<LLUICtrl>("WLSunlightB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mSunlight)); + getChild<LLUICtrl>("WLSunlightI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr->mSunlight)); // glow - childSetCommitCallback("WLGlowR", onGlowRMoved, ¶m_mgr->mGlow); - childSetCommitCallback("WLGlowB", onGlowBMoved, ¶m_mgr->mGlow); + getChild<LLUICtrl>("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onGlowRMoved, this, _1, ¶m_mgr->mGlow)); + getChild<LLUICtrl>("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onGlowBMoved, this, _1, ¶m_mgr->mGlow)); // ambient - childSetCommitCallback("WLAmbientR", onColorControlRMoved, ¶m_mgr->mAmbient); - childSetCommitCallback("WLAmbientG", onColorControlGMoved, ¶m_mgr->mAmbient); - childSetCommitCallback("WLAmbientB", onColorControlBMoved, ¶m_mgr->mAmbient); - childSetCommitCallback("WLAmbientI", onColorControlIMoved, ¶m_mgr->mAmbient); + getChild<LLUICtrl>("WLAmbientR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mAmbient)); + getChild<LLUICtrl>("WLAmbientG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mAmbient)); + getChild<LLUICtrl>("WLAmbientB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mAmbient)); + getChild<LLUICtrl>("WLAmbientI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr->mAmbient)); // time of day - childSetCommitCallback("WLSunAngle", onSunMoved, ¶m_mgr->mLightnorm); - childSetCommitCallback("WLEastAngle", onSunMoved, ¶m_mgr->mLightnorm); + getChild<LLUICtrl>("WLSunAngle")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSunMoved, this, _1, ¶m_mgr->mLightnorm)); + getChild<LLUICtrl>("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSunMoved, this, _1, ¶m_mgr->mLightnorm)); // Clouds // Cloud Color - childSetCommitCallback("WLCloudColorR", onColorControlRMoved, ¶m_mgr->mCloudColor); - childSetCommitCallback("WLCloudColorG", onColorControlGMoved, ¶m_mgr->mCloudColor); - childSetCommitCallback("WLCloudColorB", onColorControlBMoved, ¶m_mgr->mCloudColor); - childSetCommitCallback("WLCloudColorI", onColorControlIMoved, ¶m_mgr->mCloudColor); + getChild<LLUICtrl>("WLCloudColorR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mCloudColor)); + getChild<LLUICtrl>("WLCloudColorG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mCloudColor)); + getChild<LLUICtrl>("WLCloudColorB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mCloudColor)); + getChild<LLUICtrl>("WLCloudColorI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr->mCloudColor)); // Cloud - childSetCommitCallback("WLCloudX", onColorControlRMoved, ¶m_mgr->mCloudMain); - childSetCommitCallback("WLCloudY", onColorControlGMoved, ¶m_mgr->mCloudMain); - childSetCommitCallback("WLCloudDensity", onColorControlBMoved, ¶m_mgr->mCloudMain); + getChild<LLUICtrl>("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mCloudMain)); + getChild<LLUICtrl>("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mCloudMain)); + getChild<LLUICtrl>("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mCloudMain)); // Cloud Detail - childSetCommitCallback("WLCloudDetailX", onColorControlRMoved, ¶m_mgr->mCloudDetail); - childSetCommitCallback("WLCloudDetailY", onColorControlGMoved, ¶m_mgr->mCloudDetail); - childSetCommitCallback("WLCloudDetailDensity", onColorControlBMoved, ¶m_mgr->mCloudDetail); + getChild<LLUICtrl>("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr->mCloudDetail)); + getChild<LLUICtrl>("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr->mCloudDetail)); + getChild<LLUICtrl>("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr->mCloudDetail)); // Cloud extras - childSetCommitCallback("WLCloudCoverage", onFloatControlMoved, ¶m_mgr->mCloudCoverage); - childSetCommitCallback("WLCloudScale", onFloatControlMoved, ¶m_mgr->mCloudScale); - childSetCommitCallback("WLCloudLockX", onCloudScrollXToggled, NULL); - childSetCommitCallback("WLCloudLockY", onCloudScrollYToggled, NULL); - childSetCommitCallback("WLCloudScrollX", onCloudScrollXMoved, NULL); - childSetCommitCallback("WLCloudScrollY", onCloudScrollYMoved, NULL); - childSetCommitCallback("WLDistanceMult", onFloatControlMoved, ¶m_mgr->mDistanceMult); + getChild<LLUICtrl>("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr->mCloudCoverage)); + getChild<LLUICtrl>("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr->mCloudScale)); + getChild<LLUICtrl>("WLCloudLockX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollXToggled, this, _1)); + getChild<LLUICtrl>("WLCloudLockY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollYToggled, this, _1)); + getChild<LLUICtrl>("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollXMoved, this, _1)); + getChild<LLUICtrl>("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollYMoved, this, _1)); + getChild<LLUICtrl>("WLDistanceMult")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr->mDistanceMult)); getChild<LLUICtrl>("DrawClassicClouds")->setCommitCallback(boost::bind(LLSavedSettingsGlue::setBOOL, _1, "SkyUseClassicClouds")); // WL Top - childSetAction("WLDayCycleMenuButton", onOpenDayCycle, NULL); + getChild<LLUICtrl>("WLDayCycleMenuButton")->setCommitCallback(boost::bind(&LLFloaterWindLight::onOpenDayCycle, this)); // Load/save LLComboBox* comboBox = getChild<LLComboBox>("WLPresetsCombo"); //childSetAction("WLLoadPreset", onLoadPreset, comboBox); - childSetAction("WLNewPreset", onNewPreset, comboBox); - childSetAction("WLSavePreset", onSavePreset, comboBox); - childSetAction("WLDeletePreset", onDeletePreset, comboBox); + getChild<LLUICtrl>("WLNewPreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onNewPreset, this)); + getChild<LLUICtrl>("WLSavePreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSavePreset, this)); + getChild<LLUICtrl>("WLDeletePreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onDeletePreset, this)); comboBox->setCommitCallback(boost::bind(&LLFloaterWindLight::onChangePresetName, this, _1)); // Dome - childSetCommitCallback("WLGamma", onFloatControlMoved, ¶m_mgr->mWLGamma); - childSetCommitCallback("WLStarAlpha", onStarAlphaMoved, NULL); + getChild<LLUICtrl>("WLGamma")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr->mWLGamma)); + getChild<LLUICtrl>("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterWindLight::onStarAlphaMoved, this, _1)); } -void LLFloaterWindLight::onClickHelp(void* data) +void LLFloaterWindLight::onClickHelp(std::string xml_alert) { - LLFloaterWindLight* self = LLFloaterWindLight::instance(); - - const std::string xml_alert = *(std::string*)data; - LLNotifications::instance().add(self->contextualNotification(xml_alert)); + LLNotifications::instance().add(contextualNotification(xml_alert)); } void LLFloaterWindLight::initHelpBtn(const std::string& name, const std::string& xml_alert) { - childSetAction(name, onClickHelp, new std::string(xml_alert)); + getChild<LLButton>(name)->setClickedCallback(boost::bind(&LLFloaterWindLight::onClickHelp, this, xml_alert)); } bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& response) @@ -258,16 +256,13 @@ bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& } if(option == 0) { - LLComboBox* comboBox = sWindLight->getChild<LLComboBox>( - "WLPresetsCombo"); + LLComboBox* comboBox = getChild<LLComboBox>("WLPresetsCombo"); - LLFloaterDayCycle* sDayCycle = NULL; + LLFloaterDayCycle* day_cycle = LLFloaterReg::findTypedInstance<LLFloaterDayCycle>("env_day_cycle"); LLComboBox* keyCombo = NULL; - if(LLFloaterDayCycle::isOpen()) + if(day_cycle) { - sDayCycle = LLFloaterDayCycle::instance(); - keyCombo = sDayCycle->getChild<LLComboBox>( - "WLKeyPresets"); + keyCombo = day_cycle->getChild<LLComboBox>("WLKeyPresets"); } // add the current parameters to the list @@ -292,7 +287,7 @@ bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& comboBox->add(LLStringUtil::null); comboBox->setSelectedByValue(text, true); - if(LLFloaterDayCycle::isOpen()) + if(keyCombo) { keyCombo->add(text); keyCombo->sortByName(); @@ -442,53 +437,12 @@ void LLFloaterWindLight::syncMenu() } -// static -LLFloaterWindLight* LLFloaterWindLight::instance() -{ - if (!sWindLight) - { - sWindLight = new LLFloaterWindLight(); - sWindLight->openFloater(); - sWindLight->setFocus(TRUE); - } - return sWindLight; -} -void LLFloaterWindLight::show() -{ - LLFloaterWindLight* windLight = instance(); - windLight->syncMenu(); - - // comment in if you want the menu to rebuild each time - //LLUICtrlFactory::getInstance()->buildFloater(windLight, "floater_windlight_options.xml"); - //windLight->initCallbacks(); - - windLight->openFloater(); -} - -bool LLFloaterWindLight::isOpen() -{ - if (sWindLight != NULL) { - return true; - } - return false; -} - -// virtual -void LLFloaterWindLight::onClose(bool app_quitting) -{ - if (sWindLight) - { - sWindLight->setVisible(FALSE); - } -} - // color control callbacks -void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, WLColorControl* colorControl) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WLColorControl * colorControl = static_cast<WLColorControl *>(userData); colorControl->r = sldrCtrl->getValueF32(); if(colorControl->isSunOrAmbientColor) { @@ -506,11 +460,11 @@ void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, void* userData) name.append("I"); if(colorControl->isSunOrAmbientColor) { - sWindLight->childSetValue(name, colorControl->r / 3); + childSetValue(name, colorControl->r / 3); } else if(colorControl->isBlueHorizonOrDensity) { - sWindLight->childSetValue(name, colorControl->r / 2); + childSetValue(name, colorControl->r / 2); } else { - sWindLight->childSetValue(name, colorControl->r); + childSetValue(name, colorControl->r); } } @@ -519,12 +473,11 @@ void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, void* userData) LLWLParamManager::instance()->propagateParameters(); } -void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, WLColorControl* colorControl) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WLColorControl * colorControl = static_cast<WLColorControl *>(userData); colorControl->g = sldrCtrl->getValueF32(); if(colorControl->isSunOrAmbientColor) { @@ -542,11 +495,11 @@ void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, void* userData) name.append("I"); if(colorControl->isSunOrAmbientColor) { - sWindLight->childSetValue(name, colorControl->g / 3); + childSetValue(name, colorControl->g / 3); } else if(colorControl->isBlueHorizonOrDensity) { - sWindLight->childSetValue(name, colorControl->g / 2); + childSetValue(name, colorControl->g / 2); } else { - sWindLight->childSetValue(name, colorControl->g); + childSetValue(name, colorControl->g); } } @@ -555,12 +508,11 @@ void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, void* userData) LLWLParamManager::instance()->propagateParameters(); } -void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, WLColorControl* colorControl) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WLColorControl * colorControl = static_cast<WLColorControl *>(userData); colorControl->b = sldrCtrl->getValueF32(); if(colorControl->isSunOrAmbientColor) { @@ -578,11 +530,11 @@ void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, void* userData) name.append("I"); if(colorControl->isSunOrAmbientColor) { - sWindLight->childSetValue(name, colorControl->b / 3); + childSetValue(name, colorControl->b / 3); } else if(colorControl->isBlueHorizonOrDensity) { - sWindLight->childSetValue(name, colorControl->b / 2); + childSetValue(name, colorControl->b / 2); } else { - sWindLight->childSetValue(name, colorControl->b); + childSetValue(name, colorControl->b); } } @@ -591,12 +543,11 @@ void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, void* userData) LLWLParamManager::instance()->propagateParameters(); } -void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, WLColorControl* colorControl) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WLColorControl * colorControl = static_cast<WLColorControl *>(userData); colorControl->i = sldrCtrl->getValueF32(); @@ -653,24 +604,24 @@ void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData) // divide sun color vals by three if(colorControl->isSunOrAmbientColor) { - sWindLight->childSetValue(rName, colorControl->r/3); - sWindLight->childSetValue(gName, colorControl->g/3); - sWindLight->childSetValue(bName, colorControl->b/3); + childSetValue(rName, colorControl->r/3); + childSetValue(gName, colorControl->g/3); + childSetValue(bName, colorControl->b/3); } else if(colorControl->isBlueHorizonOrDensity) { - sWindLight->childSetValue(rName, colorControl->r/2); - sWindLight->childSetValue(gName, colorControl->g/2); - sWindLight->childSetValue(bName, colorControl->b/2); + childSetValue(rName, colorControl->r/2); + childSetValue(gName, colorControl->g/2); + childSetValue(bName, colorControl->b/2); } else { // set the sliders to the new vals - sWindLight->childSetValue(rName, colorControl->r); - sWindLight->childSetValue(gName, colorControl->g); - sWindLight->childSetValue(bName, colorControl->b); + childSetValue(rName, colorControl->r); + childSetValue(gName, colorControl->g); + childSetValue(bName, colorControl->b); } } @@ -680,12 +631,11 @@ void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData) } /// GLOW SPECIFIC CODE -void LLFloaterWindLight::onGlowRMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onGlowRMoved(LLUICtrl* ctrl, WLColorControl* colorControl) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WLColorControl * colorControl = static_cast<WLColorControl *>(userData); // scaled by 20 colorControl->r = (2 - sldrCtrl->getValueF32()) * 20; @@ -695,12 +645,11 @@ void LLFloaterWindLight::onGlowRMoved(LLUICtrl* ctrl, void* userData) } /// \NOTE that we want NEGATIVE (-) B -void LLFloaterWindLight::onGlowBMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onGlowBMoved(LLUICtrl* ctrl, WLColorControl* colorControl) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WLColorControl * colorControl = static_cast<WLColorControl *>(userData); /// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big colorControl->b = -sldrCtrl->getValueF32() * 5; @@ -709,12 +658,11 @@ void LLFloaterWindLight::onGlowBMoved(LLUICtrl* ctrl, void* userData) LLWLParamManager::instance()->propagateParameters(); } -void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* floatControl) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - WLFloatControl * floatControl = static_cast<WLFloatControl *>(userData); floatControl->x = sldrCtrl->getValueF32() / floatControl->mult; @@ -722,29 +670,16 @@ void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, void* userData) LLWLParamManager::instance()->propagateParameters(); } -void LLFloaterWindLight::onBoolToggle(LLUICtrl* ctrl, void* userData) -{ - deactivateAnimator(); - - LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl); - - bool value = cbCtrl->get(); - (*(static_cast<BOOL *>(userData))) = value; -} - - // Lighting callbacks // time of day -void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, WLColorControl* colorControl) { deactivateAnimator(); - LLSliderCtrl* sunSldr = sWindLight->getChild<LLSliderCtrl>("WLSunAngle"); - LLSliderCtrl* eastSldr = sWindLight->getChild<LLSliderCtrl>("WLEastAngle"); + LLSliderCtrl* sunSldr = getChild<LLSliderCtrl>("WLSunAngle"); + LLSliderCtrl* eastSldr = getChild<LLSliderCtrl>("WLEastAngle"); - WLColorControl * colorControl = static_cast<WLColorControl *>(userData); - // get the two angles LLWLParamManager * param_mgr = LLWLParamManager::instance(); @@ -763,18 +698,7 @@ void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userData) param_mgr->propagateParameters(); } -void LLFloaterWindLight::onFloatTweakMoved(LLUICtrl* ctrl, void* userData) -{ - deactivateAnimator(); - - LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); - F32 * tweak = static_cast<F32 *>(userData); - - (*tweak) = sldrCtrl->getValueF32(); - LLWLParamManager::instance()->propagateParameters(); -} - -void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl) { deactivateAnimator(); @@ -783,15 +707,15 @@ void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl, void* userData) LLWLParamManager::instance()->mCurParams.setStarBrightness(sldrCtrl->getValueF32()); } -void LLFloaterWindLight::onNewPreset(void* userData) +void LLFloaterWindLight::onNewPreset() { - LLNotifications::instance().add("NewSkyPreset", LLSD(), LLSD(), newPromptCallback); + LLNotifications::instance().add("NewSkyPreset", LLSD(), LLSD(), boost::bind(&LLFloaterWindLight::newPromptCallback, this, _1, _2)); } -void LLFloaterWindLight::onSavePreset(void* userData) +void LLFloaterWindLight::onSavePreset() { // get the name - LLComboBox* comboBox = sWindLight->getChild<LLComboBox>( + LLComboBox* comboBox = getChild<LLComboBox>( "WLPresetsCombo"); // don't save the empty name @@ -812,7 +736,7 @@ void LLFloaterWindLight::onSavePreset(void* userData) LLWLParamManager::instance()->mCurParams.mName = comboBox->getSelectedItemLabel(); - LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback); + LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterWindLight::saveAlertCallback, this, _1, _2)); } bool LLFloaterWindLight::saveAlertCallback(const LLSD& notification, const LLSD& response) @@ -831,9 +755,9 @@ bool LLFloaterWindLight::saveAlertCallback(const LLSD& notification, const LLSD& return false; } -void LLFloaterWindLight::onDeletePreset(void* userData) +void LLFloaterWindLight::onDeletePreset() { - LLComboBox* combo_box = sWindLight->getChild<LLComboBox>( + LLComboBox* combo_box = getChild<LLComboBox>( "WLPresetsCombo"); if(combo_box->getSelectedValue().asString() == "") @@ -844,7 +768,7 @@ void LLFloaterWindLight::onDeletePreset(void* userData) LLSD args; args["SKY"] = combo_box->getSelectedValue().asString(); LLNotifications::instance().add("WLDeletePresetAlert", args, LLSD(), - boost::bind(&LLFloaterWindLight::deleteAlertCallback, sWindLight, _1, _2)); + boost::bind(&LLFloaterWindLight::deleteAlertCallback, this, _1, _2)); } bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLSD& response) @@ -854,17 +778,14 @@ bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLS // if they choose delete, do it. Otherwise, don't do anything if(option == 0) { - LLComboBox* combo_box = getChild<LLComboBox>( - "WLPresetsCombo"); - LLFloaterDayCycle* day_cycle = NULL; + LLComboBox* combo_box = getChild<LLComboBox>("WLPresetsCombo"); + LLFloaterDayCycle* day_cycle = LLFloaterReg::findTypedInstance<LLFloaterDayCycle>("env_day_cycle"); LLComboBox* key_combo = NULL; LLMultiSliderCtrl* mult_sldr = NULL; - if(LLFloaterDayCycle::isOpen()) + if (day_cycle) { - day_cycle = LLFloaterDayCycle::instance(); - key_combo = day_cycle->getChild<LLComboBox>( - "WLKeyPresets"); + key_combo = day_cycle->getChild<LLComboBox>("WLKeyPresets"); mult_sldr = day_cycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys"); } @@ -915,17 +836,17 @@ void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl) if(!data.empty()) { LLWLParamManager::instance()->loadPreset( data); - sWindLight->syncMenu(); + syncMenu(); } } -void LLFloaterWindLight::onOpenDayCycle(void* userData) +void LLFloaterWindLight::onOpenDayCycle() { - LLFloaterDayCycle::show(); + LLFloaterReg::showInstance("env_day_cycle"); } // Clouds -void LLFloaterWindLight::onCloudScrollXMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onCloudScrollXMoved(LLUICtrl* ctrl) { deactivateAnimator(); @@ -934,7 +855,7 @@ void LLFloaterWindLight::onCloudScrollXMoved(LLUICtrl* ctrl, void* userData) LLWLParamManager::instance()->mCurParams.setCloudScrollX(sldrCtrl->getValueF32() + 10.0f); } -void LLFloaterWindLight::onCloudScrollYMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onCloudScrollYMoved(LLUICtrl* ctrl) { deactivateAnimator(); @@ -944,7 +865,7 @@ void LLFloaterWindLight::onCloudScrollYMoved(LLUICtrl* ctrl, void* userData) LLWLParamManager::instance()->mCurParams.setCloudScrollY(sldrCtrl->getValueF32() + 10.0f); } -void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl) { deactivateAnimator(); @@ -953,7 +874,7 @@ void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl, void* userData) bool lock = cbCtrl->get(); LLWLParamManager::instance()->mCurParams.setEnableCloudScrollX(!lock); - LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>( + LLSliderCtrl* sldr = getChild<LLSliderCtrl>( "WLCloudScrollX"); if(cbCtrl->get()) @@ -967,7 +888,7 @@ void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl, void* userData) } -void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl) { deactivateAnimator(); @@ -975,7 +896,7 @@ void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl, void* userData) bool lock = cbCtrl->get(); LLWLParamManager::instance()->mCurParams.setEnableCloudScrollY(!lock); - LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>( + LLSliderCtrl* sldr = getChild<LLSliderCtrl>( "WLCloudScrollY"); if(cbCtrl->get()) diff --git a/indra/newview/llfloaterwindlight.h b/indra/newview/llfloaterwindlight.h index e527a5637c..56c2c6623b 100644 --- a/indra/newview/llfloaterwindlight.h +++ b/indra/newview/llfloaterwindlight.h @@ -51,54 +51,47 @@ class LLFloaterWindLight : public LLFloater { public: - LLFloaterWindLight(); + LLFloaterWindLight(const LLSD& key); virtual ~LLFloaterWindLight(); /*virtual*/ BOOL postBuild(); /// initialize all void initCallbacks(void); - /// one and one instance only - static LLFloaterWindLight* instance(); - // help button stuff - static void onClickHelp(void* data); + void onClickHelp(std::string alert); void initHelpBtn(const std::string& name, const std::string& xml_alert); - static bool newPromptCallback(const LLSD& notification, const LLSD& response); + bool newPromptCallback(const LLSD& notification, const LLSD& response); /// general purpose callbacks for dealing with color controllers - static void onColorControlRMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlGMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlBMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlIMoved(LLUICtrl* ctrl, void* userData); - static void onFloatControlMoved(LLUICtrl* ctrl, void* userData); - static void onBoolToggle(LLUICtrl* ctrl, void* userData); + void onColorControlRMoved(LLUICtrl* ctrl, WLColorControl* userData); + void onColorControlGMoved(LLUICtrl* ctrl, WLColorControl* userData); + void onColorControlBMoved(LLUICtrl* ctrl, WLColorControl* userData); + void onColorControlIMoved(LLUICtrl* ctrl, WLColorControl* userData); + void onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* userData); /// lighting callbacks for glow - static void onGlowRMoved(LLUICtrl* ctrl, void* userData); + void onGlowRMoved(LLUICtrl* ctrl, WLColorControl* userData); //static void onGlowGMoved(LLUICtrl* ctrl, void* userData); - static void onGlowBMoved(LLUICtrl* ctrl, void* userData); + void onGlowBMoved(LLUICtrl* ctrl, WLColorControl* userData); /// lighting callbacks for sun - static void onSunMoved(LLUICtrl* ctrl, void* userData); - - /// handle if float is changed - static void onFloatTweakMoved(LLUICtrl* ctrl, void* userData); + void onSunMoved(LLUICtrl* ctrl, WLColorControl* userData); /// for handling when the star slider is moved to adjust the alpha - static void onStarAlphaMoved(LLUICtrl* ctrl, void* userData); + void onStarAlphaMoved(LLUICtrl* ctrl); /// when user hits the load preset button - static void onNewPreset(void* userData); + void onNewPreset(); /// when user hits the save preset button - static void onSavePreset(void* userData); + void onSavePreset(); /// prompts a user when overwriting a preset - static bool saveAlertCallback(const LLSD& notification, const LLSD& response); + bool saveAlertCallback(const LLSD& notification, const LLSD& response); /// when user hits the save preset button - static void onDeletePreset(void* userData); + void onDeletePreset(); /// prompts a user when overwriting a preset bool deleteAlertCallback(const LLSD& notification, const LLSD& response); @@ -107,24 +100,13 @@ public: void onChangePresetName(LLUICtrl* ctrl); /// when user hits the save preset button - static void onOpenDayCycle(void* userData); + void onOpenDayCycle(); /// handle cloud scrolling - static void onCloudScrollXMoved(LLUICtrl* ctrl, void* userData); - static void onCloudScrollYMoved(LLUICtrl* ctrl, void* userData); - static void onCloudScrollXToggled(LLUICtrl* ctrl, void* userData); - static void onCloudScrollYToggled(LLUICtrl* ctrl, void* userData); - - //// menu management - - /// show off our menu - static void show(); - - /// return if the menu exists or not - static bool isOpen(); - - /// stuff to do on exit - virtual void onClose(bool app_quitting); + void onCloudScrollXMoved(LLUICtrl* ctrl); + void onCloudScrollYMoved(LLUICtrl* ctrl); + void onCloudScrollXToggled(LLUICtrl* ctrl); + void onCloudScrollYToggled(LLUICtrl* ctrl); /// sync up sliders with parameters void syncMenu(); @@ -133,9 +115,6 @@ public: static void deactivateAnimator(); private: - // one instance on the inside - static LLFloaterWindLight* sWindLight; - static std::set<std::string> sDefaultPresets; }; diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index cdc4cbc411..57acbb147d 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -182,6 +182,8 @@ void* LLFloaterWorldMap::createWorldMapView(void* data) BOOL LLFloaterWorldMap::postBuild() { + mCloseSignal.connect(boost::bind(&LLFloaterWorldMap::onClose, this)); + mTabs = getChild<LLTabContainer>("maptab"); if (!mTabs) return FALSE; @@ -252,13 +254,10 @@ LLFloaterWorldMap* LLFloaterWorldMap::getInstance() return LLFloaterReg::getTypedInstance<LLFloaterWorldMap>("world_map"); } -// virtual -void LLFloaterWorldMap::onClose(bool app_quitting) +void LLFloaterWorldMap::onClose() { // While we're not visible, discard the overlay images we're using LLWorldMap::getInstance()->clearImageRefs(); - - setVisible(FALSE); } // virtual diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index d52079fc06..f117ea05af 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -65,7 +65,6 @@ public: BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void onClose(bool app_quitting); static void reloadIcons(void*); @@ -113,6 +112,8 @@ public: void teleport(); protected: + void onClose(); + void onGoHome(); void onLandmarkComboPrearrange(); diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index eb2c6768f3..69498d3099 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -58,8 +58,6 @@ #include "llviewerstats.h" #include "llnearbychatbar.h" -LLGestureManager gGestureManager; - // Longest time, in seconds, to wait for all animations to stop playing const F32 MAX_WAIT_ANIM_SECS = 30.f; @@ -71,7 +69,9 @@ LLGestureManager::LLGestureManager() mPlaying(), mActive(), mLoadingCount(0) -{ } +{ + gInventory.addObserver(this); +} // We own the data for gestures, so clean them up. @@ -85,6 +85,7 @@ LLGestureManager::~LLGestureManager() delete gesture; gesture = NULL; } + gInventory.removeObserver(this); } @@ -442,7 +443,7 @@ void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new void LLGestureManager::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset_id) { - item_map_t::iterator it = gGestureManager.mActive.find(item_id); + item_map_t::iterator it = LLGestureManager::instance().mActive.find(item_id); if (it == mActive.end()) { llwarns << "replaceGesture for inactive gesture " << item_id << llendl; @@ -451,7 +452,7 @@ void LLGestureManager::replaceGesture(const LLUUID& item_id, const LLUUID& new_a // mActive owns this gesture pointer, so clean up memory. LLMultiGesture* gesture = (*it).second; - gGestureManager.replaceGesture(item_id, gesture, new_asset_id); + LLGestureManager::instance().replaceGesture(item_id, gesture, new_asset_id); } void LLGestureManager::playGesture(LLMultiGesture* gesture) @@ -921,7 +922,7 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs, delete info; info = NULL; - gGestureManager.mLoadingCount--; + LLGestureManager::instance().mLoadingCount--; if (0 == status) { @@ -943,22 +944,34 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs, { if (deactivate_similar) { - gGestureManager.deactivateSimilarGestures(gesture, item_id); + LLGestureManager::instance().deactivateSimilarGestures(gesture, item_id); // Display deactivation message if this was the last of the bunch. - if (gGestureManager.mLoadingCount == 0 - && gGestureManager.mDeactivateSimilarNames.length() > 0) + if (LLGestureManager::instance().mLoadingCount == 0 + && LLGestureManager::instance().mDeactivateSimilarNames.length() > 0) { // we're done with this set of deactivations LLSD args; - args["NAMES"] = gGestureManager.mDeactivateSimilarNames; + args["NAMES"] = LLGestureManager::instance().mDeactivateSimilarNames; LLNotifications::instance().add("DeactivatedGesturesTrigger", args); } } + LLViewerInventoryItem* item = gInventory.getItem(item_id); + if(item) + { + gesture->mName = item->getName(); + } + else + { + // Watch this item and set gesture name when item exists in inventory + LLGestureManager::instance().watchItem(item_id); + } + LLGestureManager::instance().mActive[item_id] = gesture; + // Everything has been successful. Add to the active list. - gGestureManager.mActive[item_id] = gesture; gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); + if (inform_server) { // Inform the database of this change @@ -977,13 +990,13 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs, gAgent.sendReliableMessage(); } - gGestureManager.notifyObservers(); + LLGestureManager::instance().notifyObservers(); } else { llwarns << "Unable to load gesture" << llendl; - gGestureManager.mActive.erase(item_id); + LLGestureManager::instance().mActive.erase(item_id); delete gesture; gesture = NULL; @@ -1005,7 +1018,7 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs, llwarns << "Problem loading gesture: " << status << llendl; - gGestureManager.mActive.erase(item_id); + LLGestureManager::instance().mActive.erase(item_id); } } @@ -1133,3 +1146,19 @@ void LLGestureManager::getItemIDs(std::vector<LLUUID>* ids) ids->push_back(it->first); } } + +void LLGestureManager::done() +{ + for(item_map_t::iterator it = mActive.begin(); it != mActive.end(); ++it) + { + if(it->second->mName.empty()) + { + LLViewerInventoryItem* item = gInventory.getItem(it->first); + if(item) + { + it->second->mName = item->getName(); + } + } + } + notifyObservers(); +} diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h index f564c17486..947773d66d 100644 --- a/indra/newview/llgesturemgr.h +++ b/indra/newview/llgesturemgr.h @@ -38,6 +38,8 @@ #include <vector> #include "llassetstorage.h" // LLAssetType +#include "llinventorymodel.h" +#include "llsingleton.h" #include "llviewerinventory.h" class LLMultiGesture; @@ -52,7 +54,7 @@ public: virtual void changed() = 0; }; -class LLGestureManager +class LLGestureManager : public LLSingleton<LLGestureManager>, public LLInventoryCompletionObserver { public: LLGestureManager(); @@ -133,6 +135,9 @@ protected: // Do a single step in a gesture void runStep(LLMultiGesture* gesture, LLGestureStep* step); + // LLInventoryCompletionObserver trigger + void done(); + // Used by loadGesture static void onLoadComplete(LLVFS *vfs, const LLUUID& asset_uuid, @@ -158,6 +163,4 @@ public: std::vector<LLGestureManagerObserver*> mObservers; }; -extern LLGestureManager gGestureManager; - #endif diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index cda30d8900..30f4447283 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -39,6 +39,127 @@ #include "llfloatergroupinfo.h" #include "llfloaterreg.h" #include "llimview.h" // for gIMMgr +#include "llgroupmgr.h" +#include "llavataractions.h" +#include "llviewercontrol.h" + +// LLGroupActions::teleport helper +// +// Method is offerTeleport should be called. +// First it checks, whether LLGroupMgr contains LLGroupMgrGroupData for this group already. +// If it's there, processMembersList can be called, which builds vector of ID's for online members and +// calls LLAvatarActions::offerTeleport. +// If LLGroupMgr doesn't contain LLGroupMgrGroupData, then ID of group should be saved in +// mID or queue, if mID is not empty. After that processQueue uses ID from mID or queue, +// registers LLGroupTeleporter as observer at LLGroupMgr and sends request for group members. +// LLGroupMgr notifies about response on this request by calling method 'changed'. +// It calls processMembersList, sets mID to null, to indicate that current group is processed, +// and calls processQueue to process remaining groups. +// The reason of calling of LLGroupMgr::addObserver and LLGroupMgr::removeObserver in +// processQueue and 'changed' methods is that LLGroupMgr notifies observers of only particular group, +// so, for each group mID should be updated and addObserver/removeObserver is called. + +class LLGroupTeleporter : public LLGroupMgrObserver +{ +public: + LLGroupTeleporter() : LLGroupMgrObserver(LLUUID()) {} + + void offerTeleport(const LLUUID& group_id); + + // LLGroupMgrObserver trigger + virtual void changed(LLGroupChange gc); +private: + void processQueue(); + void processMembersList(LLGroupMgrGroupData* gdatap); + + std::queue<LLUUID> mGroupsQueue; +}; + +void LLGroupTeleporter::offerTeleport(const LLUUID& group_id) +{ + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id); + + if (!gdatap || !gdatap->isMemberDataComplete()) + { + if (mID.isNull()) + mID = group_id; + else + // Not null mID means that user requested next group teleport before + // previous group is processed, so this group goes to queue + mGroupsQueue.push(group_id); + + processQueue(); + } + else + { + processMembersList(gdatap); + } +} + +// Sends request for group in mID or one group in queue +void LLGroupTeleporter::processQueue() +{ + // Get group from queue, if mID is empty + if (mID.isNull() && !mGroupsQueue.empty()) + { + mID = mGroupsQueue.front(); + mGroupsQueue.pop(); + } + + if (mID.notNull()) + { + LLGroupMgr::getInstance()->addObserver(this); + LLGroupMgr::getInstance()->sendGroupMembersRequest(mID); + } +} + +// Collects all online members of group and offers teleport to them +void LLGroupTeleporter::processMembersList(LLGroupMgrGroupData* gdatap) +{ + U32 limit = gSavedSettings.getU32("GroupTeleportMembersLimit"); + + LLDynamicArray<LLUUID> ids; + for (LLGroupMgrGroupData::member_list_t::iterator iter = gdatap->mMembers.begin(); iter != gdatap->mMembers.end(); iter++) + { + LLGroupMemberData* member = iter->second; + if (!member) + continue; + + if (member->getID() == gAgent.getID()) + // No need to teleport own avatar + continue; + + if (member->getOnlineStatus() == "Online") + ids.push_back(member->getID()); + + if ((U32)ids.size() >= limit) + break; + } + + LLAvatarActions::offerTeleport(ids); +} + +// LLGroupMgrObserver trigger +void LLGroupTeleporter::changed(LLGroupChange gc) +{ + if (gc == GC_MEMBER_DATA) + { + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID); + + if (gdatap && gdatap->isMemberDataComplete()) + processMembersList(gdatap); + + LLGroupMgr::getInstance()->removeObserver(this); + + // group in mID is processed + mID.setNull(); + + // process other groups in queue, if any + processQueue(); + } +} + +static LLGroupTeleporter sGroupTeleporter; // static void LLGroupActions::search() @@ -119,6 +240,12 @@ void LLGroupActions::startChat(const LLUUID& group_id) } } +// static +void LLGroupActions::offerTeleport(const LLUUID& group_id) +{ + sGroupTeleporter.offerTeleport(group_id); +} + //-- Private methods ---------------------------------------------------------- // static diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h index 1e6caea17c..b6ddb4511a 100644 --- a/indra/newview/llgroupactions.h +++ b/indra/newview/llgroupactions.h @@ -71,6 +71,11 @@ public: * Start group instant messaging session. */ static void startChat(const LLUUID& group_id); + + /** + * Offers teleport for online members of group + */ + static void offerTeleport(const LLUUID& group_id); private: static bool onLeaveGroup(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index 4c8c1b5f7f..886fe3da07 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -42,6 +42,7 @@ #include "llfontgl.h" #include "llglheaders.h" #include "llviewerwindow.h" +#include "llui.h" void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent, const LLFontGL &font, diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 248a8dbc4c..4ae188977e 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -35,6 +35,7 @@ #include "llimpanel.h" #include "indra_constants.h" +#include "llfloaterreg.h" #include "llfocusmgr.h" #include "llfontgl.h" #include "llrect.h" @@ -448,13 +449,17 @@ void LLVoiceChannel::setState(EState state) void LLVoiceChannel::toggleCallWindowIfNeeded(EState state) { if (state == STATE_CONNECTED) - LLFloaterCall::openInstance(mSessionID); + { + LLFloaterReg::showInstance("voice_call", mSessionID); + } // By checking that current state is CONNECTED we make sure that the call window // has been shown, hence there's something to hide. This helps when user presses // the "End call" button right after initiating the call. // *TODO: move this check to LLFloaterCall? else if (state == STATE_HUNG_UP && mState == STATE_CONNECTED) - LLFloaterCall::closeInstance(mSessionID); + { + LLFloaterReg::hideInstance("voice_call", mSessionID); + } } //static @@ -1005,7 +1010,7 @@ LLFloaterIMPanel::LLFloaterIMPanel(const std::string& session_label, // All participants will be added to the list of people we've recently interacted with. mSpeakers->addListener(&LLRecentPeople::instance(), "add"); - LLUICtrlFactory::getInstance()->buildFloater(this, xml_filename, FALSE); + LLUICtrlFactory::getInstance()->buildFloater(this, xml_filename, NULL); setTitle(mSessionLabel); mInputEditor->setMaxTextLength(1023); @@ -1088,6 +1093,10 @@ LLFloaterIMPanel::~LLFloaterIMPanel() BOOL LLFloaterIMPanel::postBuild() { + mCloseSignal.connect(boost::bind(&LLFloaterIMPanel::onClose, this)); + + mVisibleSignal.connect(boost::bind(&LLFloaterIMPanel::onVisibilityChange, this, _2)); + requires<LLLineEditor>("chat_editor"); requires<LLTextEditor>("im_history"); @@ -1414,24 +1423,6 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4 } -void LLFloaterIMPanel::setVisible(BOOL b) -{ - LLPanel::setVisible(b); - - LLMultiFloater* hostp = getHost(); - if( b && hostp ) - { - hostp->setFloaterFlashing(this, FALSE); - - /* Don't change containing floater title - leave it "Instant Message" JC - LLUIString title = sTitleString; - title.setArg("[NAME]", mSessionLabel); - hostp->setTitle( title ); - */ - } -} - - void LLFloaterIMPanel::setInputFocus( BOOL b ) { mInputEditor->setFocus( b ); @@ -1671,7 +1662,7 @@ void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller, void* userda } } -void LLFloaterIMPanel::onClose(bool app_quitting) +void LLFloaterIMPanel::onClose() { setTyping(FALSE); @@ -1680,21 +1671,20 @@ void LLFloaterIMPanel::onClose(bool app_quitting) gIMMgr->removeSession(mSessionUUID); // *HACK hide the voice floater - LLFloaterCall::toggleInstanceVisibility(FALSE, mSessionUUID); - - destroy(); + LLFloaterReg::hideInstance("voice_call", mSessionUUID); } -void LLFloaterIMPanel::onVisibilityChange(BOOL new_visibility) +void LLFloaterIMPanel::onVisibilityChange(const LLSD& new_visibility) { - if (new_visibility) + if (new_visibility.asBoolean()) { mNumUnreadMessages = 0; } - - LLFloaterCall::toggleInstanceVisibility( - new_visibility && mVoiceChannel->getState() == LLVoiceChannel::STATE_CONNECTED, - mSessionUUID); + + if (new_visibility.asBoolean() && mVoiceChannel->getState() == LLVoiceChannel::STATE_CONNECTED) + LLFloaterReg::showInstance("voice_call", mSessionUUID); + else + LLFloaterReg::hideInstance("voice_call", mSessionUUID); } void LLFloaterIMPanel::sendMsg() @@ -2047,53 +2037,16 @@ bool LLFloaterIMPanel::onConfirmForceCloseError(const LLSD& notification, const } -std::map<LLUUID, LLIMFloater*> LLIMFloater::sIMFloaterMap; - -LLIMFloater::LLIMFloater(const LLUUID& session_id, - const std::string title, - EInstantMessage dialog) -: mSessionID(session_id), +LLIMFloater::LLIMFloater(const LLUUID& session_id) + : LLFloater(session_id), + mSessionID(session_id), mLastMessageIndex(-1), - mDialog(dialog) + mDialog(IM_NOTHING_SPECIAL), + mHistoryEditor(NULL), + mInputEditor(NULL), + mPositioned(false) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_im_session.xml"); - sIMFloaterMap[mSessionID] = this; - - LLPanelIMControlPanel* im_control_panel = getChild<LLPanelIMControlPanel>("panel_im_control_panel"); - - LLIMModel::LLIMSession* session = get_if_there(LLIMModel::instance().sSessionsMap, session_id, (LLIMModel::LLIMSession*)NULL); - if(session) - { - mOtherParticipantUUID = session->mOtherParticipantID; - im_control_panel->setAvatarId(session->mOtherParticipantID); - } - - LLButton* slide_left = getChild<LLButton>("slide_left_btn"); - slide_left->setVisible(im_control_panel->getVisible()); - slide_left->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); - - LLButton* slide_right = getChild<LLButton>("slide_right_btn"); - slide_right->setVisible(!im_control_panel->getVisible()); - slide_right->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); - - setTitle(title); - setDocked(true); - - mInputEditor = getChild<LLLineEditor>("chat_editor"); - - - mInputEditor->setMaxTextLength(1023); - // enable line history support for instant message bar - mInputEditor->setEnableLineHistory(TRUE); - - mInputEditor->setFocusReceivedCallback( onInputEditorFocusReceived, this ); - mInputEditor->setFocusLostCallback( onInputEditorFocusLost, this ); - mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this ); - mInputEditor->setCommitOnFocusLost( FALSE ); - mInputEditor->setRevertOnEsc( FALSE ); - mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); - - childSetCommitCallback("chat_editor", onSendMsg, this); +// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_im_session.xml"); } /* static */ @@ -2103,8 +2056,7 @@ void LLIMFloater::newIMCallback(const LLSD& data){ { LLUUID session_id = data["session_id"].asUUID(); - LLIMFloater* floater = get_if_there(sIMFloaterMap, session_id, (LLIMFloater*)NULL); - + LLIMFloater* floater = LLFloaterReg::findTypedInstance<LLIMFloater>("impanel", session_id); if (floater == NULL) { llwarns << "new_im_callback for non-existent session_id " << session_id << llendl; @@ -2160,20 +2112,50 @@ void LLIMFloater::sendMsg() LLIMFloater::~LLIMFloater() { - sIMFloaterMap.erase(mSessionID); } //virtual BOOL LLIMFloater::postBuild() { - mHistoryEditor = getChild<LLViewerTextEditor>("im_text", true, false); - mChiclet = LLBottomTray::getInstance()->getChicletPanel()->findChiclet<LLIMChiclet>(mSessionID); + LLPanelIMControlPanel* im_control_panel = getChild<LLPanelIMControlPanel>("panel_im_control_panel"); - if (!mChiclet) + LLIMModel::LLIMSession* session = get_if_there(LLIMModel::instance().sSessionsMap, mSessionID, (LLIMModel::LLIMSession*)NULL); + if(session) { - llwarns << "No chiclet found for the IMFloter" << llendl; + mOtherParticipantUUID = session->mOtherParticipantID; + im_control_panel->setAvatarId(session->mOtherParticipantID); + mDialog = session->mType; } - setDocked(false); + + LLButton* slide_left = getChild<LLButton>("slide_left_btn"); + slide_left->setVisible(im_control_panel->getVisible()); + slide_left->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); + + LLButton* slide_right = getChild<LLButton>("slide_right_btn"); + slide_right->setVisible(!im_control_panel->getVisible()); + slide_right->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); + + mInputEditor = getChild<LLLineEditor>("chat_editor"); + mInputEditor->setMaxTextLength(1023); + // enable line history support for instant message bar + mInputEditor->setEnableLineHistory(TRUE); + + mInputEditor->setFocusReceivedCallback( onInputEditorFocusReceived, this ); + mInputEditor->setFocusLostCallback( onInputEditorFocusLost, this ); + mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this ); + mInputEditor->setCommitOnFocusLost( FALSE ); + mInputEditor->setRevertOnEsc( FALSE ); + mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); + + childSetCommitCallback("chat_editor", onSendMsg, this); + + mHistoryEditor = getChild<LLViewerTextEditor>("im_text", true, false); + + setTitle(LLIMModel::instance().getName(mSessionID)); + setDocked(true); + + mDockTongue = LLUI::getUIImage("windows/Flyout_Pointer.png"); + return TRUE; } @@ -2197,27 +2179,14 @@ void LLIMFloater::onFocusLost() void LLIMFloater::setDocked(bool docked, bool pop_on_undock) { LLFloater::setDocked(docked); - mChiclet->setDockTongueVisible(docked); - if (docked) - { - S32 x, y; - mChiclet->localPointToScreen((mChiclet->getRect().getWidth())/2, 0, &x, &y); - translate(x - getRect().getCenterX(), DOCK_ICON_HEIGHT - getRect().mBottom); - } - else if (pop_on_undock) + + if (!docked && pop_on_undock) { // visually pop up a little bit to emphasize the undocking translate(0, UNDOCK_LEAP_HEIGHT); } } - -void LLIMFloater::onClose(bool app_quitting) -{ - mChiclet->setDockTongueVisible(false); - LLFloater::onClose(app_quitting); -} - void LLIMFloater::onSlide() { LLPanel* im_control_panel = getChild<LLPanel>("panel_im_control_panel"); @@ -2230,31 +2199,22 @@ void LLIMFloater::onSlide() //static LLIMFloater* LLIMFloater::show(const LLUUID& session_id) { - LLIMFloater* floater = get_if_there(sIMFloaterMap, session_id, (LLIMFloater*)NULL); - - if (floater == NULL) - { - floater = new LLIMFloater(session_id, LLIMModel::instance().getName(session_id), IM_NOTHING_SPECIAL); - } - //hide all - for (std::map<LLUUID, LLIMFloater*>::iterator iter = sIMFloaterMap.begin(); - iter != sIMFloaterMap.end(); ++iter) + LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel"); + for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); + iter != inst_list.end(); ++iter) { - LLIMFloater* floater = (*iter).second; - floater->setVisible(false); - floater->mChiclet->setDockTongueVisible(false); - + LLIMFloater* floater = dynamic_cast<LLIMFloater*>(*iter); + if (floater) + { + floater->setVisible(false); + } } - floater->setVisibleAndFrontmost(true); - - if (floater->isDocked()) - { - floater->mChiclet->setDockTongueVisible(true); - } + LLIMFloater* floater = LLFloaterReg::showTypedInstance<LLIMFloater>("impanel", session_id); floater->updateMessages(); + floater->mInputEditor->setFocus(TRUE); return floater; } @@ -2312,7 +2272,24 @@ void LLIMFloater::onInputEditorKeystroke(LLLineEditor* caller, void* userdata) } } + //just a stub for now void LLIMFloater::setTyping(BOOL typing) { } + + +void LLIMFloater::draw() +{ + //if we are docked, make sure we've been positioned by the chiclet + if (!isDocked() || mPositioned) + { + LLFloater::draw(); + + if (isDocked()) + { + mDockTongue->draw( (getRect().getWidth()/2) - mDockTongue->getWidth()/2, -mDockTongue->getHeight()); + } + } +} + diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index e6bde5c93a..dcb0f2416f 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -47,7 +47,6 @@ class LLInventoryItem; class LLInventoryCategory; class LLIMSpeakerMgr; class LLPanelActiveSpeakers; -class LLIMChiclet; class LLVoiceChannel : public LLVoiceClientStatusObserver { @@ -196,8 +195,9 @@ public: // Check typing timeout timer. /*virtual*/ void draw(); - /*virtual*/ void onClose(bool app_quitting = FALSE); - /*virtual*/ void onVisibilityChange(BOOL new_visibility); + + void onClose(); + void onVisibilityChange(const LLSD& new_visibility); // add target ids to the session. // Return TRUE if successful, otherwise FALSE. @@ -213,7 +213,6 @@ public: void selectAll(); void selectNone(); - void setVisible(BOOL b); S32 getNumUnreadMessages() { return mNumUnreadMessages; } @@ -251,6 +250,7 @@ public: void setSpeakers(const LLSD& speaker_list); LLVoiceChannel* getVoiceChannel() { return mVoiceChannel; } EInstantMessage getDialogType() const { return mDialog; } + void setDialogType(EInstantMessage dialog) { mDialog = dialog; } void requestAutoConnect(); @@ -365,14 +365,16 @@ private: class LLIMFloater : public LLFloater { public: - LLIMFloater(const LLUUID& session_id, - const std::string title, - EInstantMessage dialog); + LLIMFloater(const LLUUID& session_id); virtual ~LLIMFloater(); // LLView overrides /*virtual*/ BOOL postBuild(); + + // LLView overrides for drawing dock tongue + /*virtual*/ + void draw(); // Floater should close when user clicks away to other UI area, // hence causing focus loss. @@ -382,7 +384,6 @@ public: /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true); static LLIMFloater* show(const LLUUID& session_id); - void onClose(bool app_quitting); // get new messages from LLIMModel void updateMessages(); @@ -392,8 +393,10 @@ public: // callback for LLIMModel on new messages // route to specific floater if it is visible static void newIMCallback(const LLSD& data); - - static std::map<LLUUID, LLIMFloater*> sIMFloaterMap; + + // called when docked floater's position has been set by chiclet + void setPositioned(bool b) { mPositioned = b; }; + private: @@ -408,11 +411,11 @@ private: LLUUID mSessionID; S32 mLastMessageIndex; EInstantMessage mDialog; - LLIMChiclet* mChiclet; LLUUID mOtherParticipantUUID; LLViewerTextEditor* mHistoryEditor; LLLineEditor* mInputEditor; - + bool mPositioned; + LLUIImagePtr mDockTongue; }; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index b45a6a5f29..66165090ef 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -719,14 +719,14 @@ LLUUID LLIMMgr::computeSessionID( //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LLFloaterIM::LLFloaterIM() - : LLMultiFloater() + : LLMultiFloater(LLSD()) { // autoresize=false is necessary to avoid resizing of the IM window whenever // a session is opened or closed (it would otherwise resize the window to match // the size of the im-sesssion when they were created. This happens in // LLMultiFloater::resizeToContents() when called through LLMultiFloater::addFloater()) - this->mAutoResize = FALSE; - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_im.xml"); + mAutoResize = FALSE; + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_im.xml", NULL); } BOOL LLFloaterIM::postBuild() @@ -813,10 +813,10 @@ BOOL LLFloaterIM::postBuild() // Class LLIncomingCallDialog //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) : - LLModalDialog(LLStringUtil::null, 240, 200), + LLModalDialog(payload, 240, 200), mPayload(payload) { - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_incoming_call.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_incoming_call.xml", NULL); } BOOL LLIncomingCallDialog::postBuild() @@ -1186,10 +1186,6 @@ void LLIMMgr::addMessage( dialog, FALSE); - - LLIMModel::instance().newSession(new_session_id, name, dialog, other_participant_id); - - // When we get a new IM, and if you are a god, display a bit // of information about the source. This is to help liaisons // when answering questions. @@ -1351,7 +1347,10 @@ LLUUID LLIMMgr::addSession( TRUE); noteOfflineUsers(floater, ids); - LLFloaterReg::showInstance("communicate", session_id); + //LLFloaterReg::showInstance("communicate", session_id); + // *NOTE: Is this right? Or should we only do it for + // dialog == IM_NOTHING_SPECIAL and some group types? + LLIMFloater::show(session_id); // Only warn for regular IMs - not group IMs if( dialog == IM_NOTHING_SPECIAL ) @@ -1361,6 +1360,8 @@ LLUUID LLIMMgr::addSession( } else { + // *TODO: Remove this? Otherwise old communicate window opens on + // second initiation of IM session from People panel? floater->openFloater(); } //mTabContainer->selectTabPanel(panel); @@ -1402,7 +1403,8 @@ LLUUID LLIMMgr::addSession( if ( !floater ) return LLUUID::null; noteOfflineUsers(floater, ids); - LLFloaterReg::showInstance("communicate", session_id); + // *BUG: Is this correct? What do we want to spawn for group IMs? + // LLFloaterReg::showInstance("communicate", session_id); // Only warn for regular IMs - not group IMs if( dialog == IM_NOTHING_SPECIAL ) @@ -1762,6 +1764,7 @@ LLFloaterIMPanel* LLIMMgr::createFloater( LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; LLFloaterChatterBox::getInstance()->addFloater(floater, FALSE, i_pt); mFloaters.insert(floater->getHandle()); + LLIMModel::instance().newSession(session_id, session_label, dialog, other_participant_id); return floater; } @@ -1788,6 +1791,7 @@ LLFloaterIMPanel* LLIMMgr::createFloater( LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; LLFloaterChatterBox::getInstance()->addFloater(floater, FALSE, i_pt); mFloaters.insert(floater->getHandle()); + LLIMModel::instance().newSession(session_id, session_label, dialog, other_participant_id); return floater; } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index a0cd0debf4..5877a0b19c 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -252,7 +252,7 @@ BOOL LLInvFVBridge::isItemMovable() // *TODO: make sure this does the right thing void LLInvFVBridge::showProperties() { - LLFloaterProperties::show(mUUID); + LLFloaterReg::showInstance("properties", mUUID); } void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch) @@ -275,7 +275,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc { if(LLAssetType::AT_GESTURE == item->getType()) { - gGestureManager.deactivateGesture(item->getUUID()); + LLGestureManager::instance().deactivateGesture(item->getUUID()); } } } @@ -291,7 +291,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc { if(LLAssetType::AT_GESTURE == descendent_items[j]->getType()) { - gGestureManager.deactivateGesture(descendent_items[j]->getUUID()); + LLGestureManager::instance().deactivateGesture(descendent_items[j]->getUUID()); } } } @@ -1501,9 +1501,9 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, { LLInventoryItem* item = descendent_items[i]; if (item->getType() == LLAssetType::AT_GESTURE - && gGestureManager.isGestureActive(item->getUUID())) + && LLGestureManager::instance().isGestureActive(item->getUUID())) { - gGestureManager.deactivateGesture(item->getUUID()); + LLGestureManager::instance().deactivateGesture(item->getUUID()); } } } @@ -2068,9 +2068,9 @@ BOOL LLFolderBridge::removeItem() { LLInventoryItem* item = descendent_items[i]; if (item->getType() == LLAssetType::AT_GESTURE - && gGestureManager.isGestureActive(item->getUUID())) + && LLGestureManager::instance().isGestureActive(item->getUUID())) { - gGestureManager.deactivateGesture(item->getUUID()); + LLGestureManager::instance().deactivateGesture(item->getUUID()); } } @@ -2594,9 +2594,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, if(accept && drop) { if (inv_item->getType() == LLAssetType::AT_GESTURE - && gGestureManager.isGestureActive(inv_item->getUUID()) && move_is_into_trash) + && LLGestureManager::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash) { - gGestureManager.deactivateGesture(inv_item->getUUID()); + LLGestureManager::instance().deactivateGesture(inv_item->getUUID()); } // If an item is being dragged between windows, unselect // everything in the active window so that we don't follow @@ -3208,7 +3208,7 @@ LLUIImagePtr LLGestureBridge::getIcon() const LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const { - if( gGestureManager.isGestureActive(mUUID) ) + if( LLGestureManager::instance().isGestureActive(mUUID) ) { return LLFontGL::BOLD; } @@ -3220,7 +3220,7 @@ LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const std::string LLGestureBridge::getLabelSuffix() const { - if( gGestureManager.isGestureActive(mUUID) ) + if( LLGestureManager::instance().isGestureActive(mUUID) ) { return LLItemBridge::getLabelSuffix() + " (active)"; } @@ -3235,7 +3235,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode { if ("activate" == action) { - gGestureManager.activateGesture(mUUID); + LLGestureManager::instance().activateGesture(mUUID); LLViewerInventoryItem* item = gInventory.getItem(mUUID); if (!item) return; @@ -3247,7 +3247,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode } else if ("deactivate" == action) { - gGestureManager.deactivateGesture(mUUID); + LLGestureManager::instance().deactivateGesture(mUUID); LLViewerInventoryItem* item = gInventory.getItem(mUUID); if (!item) return; @@ -3281,7 +3281,7 @@ void LLGestureBridge::openItem() BOOL LLGestureBridge::removeItem() { // Force close the preview window, if it exists - gGestureManager.deactivateGesture(mUUID); + LLGestureManager::instance().deactivateGesture(mUUID); return LLItemBridge::removeItem(); } @@ -3490,7 +3490,7 @@ void LLObjectBridge::openItem() } /* - LLFloaterProperties::show(mUUID); + LLFloaterReg::showInstance("properties", mUUID); */ } @@ -4156,7 +4156,7 @@ void wear_inventory_category_on_avatar_step2( BOOL proceed, LLUUID category, BOO { llinfos << "Activating " << gest_count << " gestures" << llendl; - gGestureManager.activateGestures(gest_item_array); + LLGestureManager::instance().activateGestures(gest_item_array); // Update the inventory item labels to reflect the fact // they are active. @@ -4433,9 +4433,9 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_ { for(i = 0; i < gest_count; ++i) { - if ( gGestureManager.isGestureActive( gest_item_array.get(i)->getUUID()) ) + if ( LLGestureManager::instance().isGestureActive( gest_item_array.get(i)->getUUID()) ) { - gGestureManager.deactivateGesture( gest_item_array.get(i)->getUUID() ); + LLGestureManager::instance().deactivateGesture( gest_item_array.get(i)->getUUID() ); gInventory.updateItem( gest_item_array.get(i) ); gInventory.notifyObservers(); } @@ -5028,7 +5028,7 @@ void LLAnimationBridgeAction::doIt() //virtual void LLObjectBridgeAction::doIt() { - LLFloaterProperties::show(mUUID); + LLFloaterReg::showInstance("properties", mUUID); LLInvFVBridgeAction::doIt(); } diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp index 471a0868bc..68143fd1e3 100644 --- a/indra/newview/lllocationhistory.cpp +++ b/indra/newview/lllocationhistory.cpp @@ -47,6 +47,12 @@ void LLLocationHistory::addItem(std::string item) { static LLUICachedControl<S32> max_items("LocationHistoryMaxSize", 100); + std::vector<std::string>::iterator item_iter = std::find(mItems.begin(), mItems.end(), item); + + if (item_iter != mItems.end()) { + mItems.erase(item_iter); + } + mItems.push_back(item); // If the vector size exceeds the maximum, purge the oldest items. @@ -56,7 +62,7 @@ void LLLocationHistory::addItem(std::string item) void LLLocationHistory::removeItems() { - mItems.erase(mItems.begin(), mItems.end()); + mItems.clear(); } diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 94abd128c4..3880ea91eb 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -54,6 +54,7 @@ #include "llsidetray.h" #include "llviewerinventory.h" #include "llviewerparcelmgr.h" +#include "llviewercontrol.h" //============================================================================ /* @@ -330,6 +331,13 @@ void LLLocationInputCtrl::onFocusLost() LLUICtrl::onFocusLost(); refreshLocation(); } +void LLLocationInputCtrl::draw(){ + + if(!hasFocus()){ + refreshLocation(); + } + LLComboBox::draw(); +} void LLLocationInputCtrl::onInfoButtonClicked() { @@ -341,8 +349,7 @@ void LLLocationInputCtrl::onAddLandmarkButtonClicked() LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark")); // Floater "Add Landmark" functionality moved to Side Tray - // TODO* Disable floater "Add Landmark" call - LLFloaterReg::showInstance("add_landmark"); + //LLFloaterReg::showInstance("add_landmark"); } void LLLocationInputCtrl::onAgentParcelChange() @@ -387,8 +394,10 @@ void LLLocationInputCtrl::refreshLocation() // Update location field. std::string location_name; + LLAgent::ELocationFormat format = (gSavedSettings.getBOOL("ShowCoordinatesOption") ? + LLAgent::LOCATION_FORMAT_FULL: LLAgent::LOCATION_FORMAT_NORMAL); - if (!gAgent.buildLocationString(location_name, LLAgent::LOCATION_FORMAT_NORMAL)) + if (!gAgent.buildLocationString(location_name,format)) location_name = "Unknown"; setText(location_name); diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index 2cc63a33b7..bda67fd313 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -71,6 +71,7 @@ public: /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ void onFocusReceived(); /*virtual*/ void onFocusLost(); + /*virtual*/ void draw(); //======================================================================== // LLUICtrl interface diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index f967fcaf97..3c59cb83cd 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -49,6 +49,7 @@ #include "llviewernetwork.h" #include "llviewercontrol.h" #include "llurlsimstring.h" +#include "llfloaterreg.h" #include "llfloatertos.h" #include "llwindow.h" #if LL_LINUX || LL_SOLARIS @@ -221,18 +222,19 @@ bool LLLoginInstance::handleLoginFailure(const LLSD& event) // to reconnect or to end the attempt in failure. if(reason_response == "tos") { - LLFloaterTOS::show(LLFloaterTOS::TOS_TOS, - message_response, - boost::bind(&LLLoginInstance::handleTOSResponse, + LLFloaterTOS * tos = + LLFloaterReg::showTypedInstance<LLFloaterTOS>("message_tos", LLSD(message_response)); + + tos->setTOSCallback(boost::bind(&LLLoginInstance::handleTOSResponse, this, _1, "agree_to_tos")); } else if(reason_response == "critical") { - LLFloaterTOS::show(LLFloaterTOS::TOS_CRITICAL_MESSAGE, - message_response, - boost::bind(&LLLoginInstance::handleTOSResponse, - this, _1, "read_critical") - ); + LLFloaterTOS * tos = + LLFloaterReg::showTypedInstance<LLFloaterTOS>("message_critical",LLSD(message_response)); + + tos->setTOSCallback(boost::bind(&LLLoginInstance::handleTOSResponse, + this, _1, "read_critical")); } else if(reason_response == "update" || gSavedSettings.getBOOL("ForceMandatoryUpdate")) { diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 963be61d93..124a2def7f 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -40,12 +40,17 @@ // Viewer includes #include "llagent.h" +#include "llvoavatarself.h" // to check gAgent.getAvatarObject()->isSitting() +#include "llbottomtray.h" #include "llbutton.h" +#include "llfirsttimetipmanager.h" #include "llfloaterreg.h" +#include "llfloaterfirsttimetip.h" #include "lljoystickbutton.h" #include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llviewercontrol.h" +#include "llselectmgr.h" // // Constants @@ -55,17 +60,24 @@ const F32 MOVE_BUTTON_DELAY = 0.0f; const F32 YAW_NUDGE_RATE = 0.05f; // fraction of normal speed const F32 NUDGE_TIME = 0.25f; // in seconds +const std::string BOTTOM_TRAY_BUTTON_NAME = "movement_btn"; + // // Member functions // // protected LLFloaterMove::LLFloaterMove(const LLSD& key) -: LLFloater(key) +: LLFloater(key), + mForwardButton(NULL), + mBackwardButton(NULL), + mTurnLeftButton(NULL), + mTurnRightButton(NULL), + mMoveUpButton(NULL), + mMoveDownButton(NULL), + mStopFlyingButton(NULL), + mModeActionsPanel(NULL) { - -// LLUICtrlFactory::getInstance()->buildFloater(this,"floater_moveview.xml", DONT_OPEN); - } // virtual @@ -80,36 +92,55 @@ BOOL LLFloaterMove::postBuild() mBackwardButton = getChild<LLJoystickAgentTurn>("backward btn"); mBackwardButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mSlideLeftButton = getChild<LLJoystickAgentSlide>("slide left btn"); - mSlideLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - - mSlideRightButton = getChild<LLJoystickAgentSlide>("slide right btn"); - mSlideRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mTurnLeftButton = getChild<LLButton>("turn left btn"); mTurnLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mTurnLeftButton->setHeldDownCallback( turnLeft, NULL ); - + mTurnLeftButton->setHeldDownCallback(boost::bind(&LLFloaterMove::turnLeft, this)); mTurnRightButton = getChild<LLButton>("turn right btn"); mTurnRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mTurnRightButton->setHeldDownCallback( turnRight, NULL ); + mTurnRightButton->setHeldDownCallback(boost::bind(&LLFloaterMove::turnRight, this)); mMoveUpButton = getChild<LLButton>("move up btn"); - childSetAction("move up btn",moveUp,NULL); mMoveUpButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mMoveUpButton->setHeldDownCallback( moveUp, NULL ); + mMoveUpButton->setHeldDownCallback(boost::bind(&LLFloaterMove::moveUp, this)); mMoveDownButton = getChild<LLButton>("move down btn"); - childSetAction("move down btn",moveDown,NULL); mMoveDownButton->setHeldDownDelay(MOVE_BUTTON_DELAY); - mMoveDownButton->setHeldDownCallback( moveDown, NULL ); + mMoveDownButton->setHeldDownCallback(boost::bind(&LLFloaterMove::moveDown, this)); + + + mStopFlyingButton = getChild<LLButton>("stop_fly_btn"); + + mModeActionsPanel = getChild<LLPanel>("panel_modes"); + + LLButton* btn; + btn = getChild<LLButton>("mode_walk_btn"); + btn->setCommitCallback(boost::bind(&LLFloaterMove::onWalkButtonClick, this)); + + btn = getChild<LLButton>("mode_run_btn"); + btn->setCommitCallback(boost::bind(&LLFloaterMove::onRunButtonClick, this)); + + btn = getChild<LLButton>("mode_fly_btn"); + btn->setCommitCallback(boost::bind(&LLFloaterMove::onFlyButtonClick, this)); + + btn = getChild<LLButton>("stop_fly_btn"); + btn->setCommitCallback(boost::bind(&LLFloaterMove::onStopFlyingButtonClick, this)); + + + + showFlyControls(false); + + initModeTooltips(); + + updatePosition(); + + initModeButtonMap(); + + initMovementMode(); + return TRUE; } -// -// Static member functions -// -// protected static +// static F32 LLFloaterMove::getYawRate( F32 time ) { if( time < NUDGE_TIME ) @@ -123,38 +154,431 @@ F32 LLFloaterMove::getYawRate( F32 time ) } } -// protected static -void LLFloaterMove::turnLeft(void *) + +// static +void LLFloaterMove::setFlyingMode(BOOL fly) { - LLFloaterMove* instance = LLFloaterReg::getTypedInstance<LLFloaterMove>("moveview"); - if(!instance) return; - - F32 time = instance->mTurnLeftButton->getHeldDownTime(); + LLFloaterMove* instance = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview"); + if (instance) + { + instance->setFlyingModeImpl(fly); + instance->showModeButtons(!fly); + } + if (fly) + { + LLPanelStandStopFlying::setStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STOP_FLYING); + } + else + { + LLPanelStandStopFlying::clearStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STOP_FLYING); + } +} +//static +void LLFloaterMove::setAlwaysRunMode(bool run) +{ + LLFloaterMove* instance = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview"); + if (instance) + { + instance->setAlwaysRunModeImpl(run); + } +} + +void LLFloaterMove::setFlyingModeImpl(BOOL fly) +{ + updateButtonsWithMovementMode(fly ? MM_FLY : (gAgent.getAlwaysRun() ? MM_RUN : MM_WALK)); +} + +void LLFloaterMove::setAlwaysRunModeImpl(bool run) +{ + if (!gAgent.getFlying()) + { + updateButtonsWithMovementMode(run ? MM_RUN : MM_WALK); + } +} + +//static +void LLFloaterMove::setSittingMode(BOOL bSitting) +{ + if (bSitting) + { + LLPanelStandStopFlying::setStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STAND); + } + else + { + LLPanelStandStopFlying::clearStandStopFlyingMode(LLPanelStandStopFlying::SSFM_STAND); + } + enableInstance(!bSitting); +} + +// protected +void LLFloaterMove::turnLeft() +{ + F32 time = mTurnLeftButton->getHeldDownTime(); gAgent.moveYaw( getYawRate( time ) ); } -// protected static -void LLFloaterMove::turnRight(void *) +// protected +void LLFloaterMove::turnRight() { - LLFloaterMove* instance = LLFloaterReg::getTypedInstance<LLFloaterMove>("moveview"); - if(!instance) return; - - F32 time = instance->mTurnRightButton->getHeldDownTime(); + F32 time = mTurnRightButton->getHeldDownTime(); gAgent.moveYaw( -getYawRate( time ) ); } -// protected static -void LLFloaterMove::moveUp(void *) +// protected +void LLFloaterMove::moveUp() { // Jumps or flys up, depending on fly state gAgent.moveUp(1); } -// protected static -void LLFloaterMove::moveDown(void *) +// protected +void LLFloaterMove::moveDown() { // Crouches or flys down, depending on fly state gAgent.moveUp(-1); } +////////////////////////////////////////////////////////////////////////// +// Private Section: +////////////////////////////////////////////////////////////////////////// + +void LLFloaterMove::onWalkButtonClick() +{ + setMovementMode(MM_WALK); +} +void LLFloaterMove::onRunButtonClick() +{ + setMovementMode(MM_RUN); +} +void LLFloaterMove::onFlyButtonClick() +{ + setMovementMode(MM_FLY); +} +void LLFloaterMove::onStopFlyingButtonClick() +{ + setMovementMode(gAgent.getAlwaysRun() ? MM_RUN : MM_WALK); +} + +void LLFloaterMove::setMovementMode(const EMovementMode mode) +{ + gAgent.setFlying(MM_FLY == mode); + + switch (mode) + { + case MM_RUN: + gAgent.setAlwaysRun(); + gAgent.setRunning(); + break; + case MM_WALK: + gAgent.clearAlwaysRun(); + gAgent.clearRunning(); + break; + default: + //do nothing for other modes (MM_FLY) + break; + } + // tell the simulator. + gAgent.sendWalkRun(gAgent.getAlwaysRun()); + + updateButtonsWithMovementMode(mode); + + bool bHideModeButtons = MM_FLY == mode + || (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()); + + showModeButtons(!bHideModeButtons); + + showQuickTips(mode); +} + +void LLFloaterMove::updateButtonsWithMovementMode(const EMovementMode newMode) +{ + showFlyControls(MM_FLY == newMode); + setModeTooltip(newMode); + setModeButtonToggleState(newMode); +} + +void LLFloaterMove::showFlyControls(bool bShow) +{ + mMoveUpButton->setVisible(bShow); + mMoveDownButton->setVisible(bShow); + + // *TODO: mantipov: mStopFlyingButton from the FloaterMove is not used now. + // It was not completly removed until functionality is reviewed by LL + mStopFlyingButton->setVisible(FALSE); +} + +void LLFloaterMove::initModeTooltips() +{ + control_tooltip_map_t walkTipMap; + walkTipMap.insert(std::make_pair(mForwardButton, getString("walk_forward_tooltip"))); + walkTipMap.insert(std::make_pair(mBackwardButton, getString("walk_back_tooltip"))); + mModeControlTooltipsMap[MM_WALK] = walkTipMap; + + control_tooltip_map_t runTipMap; + runTipMap.insert(std::make_pair(mForwardButton, getString("run_forward_tooltip"))); + runTipMap.insert(std::make_pair(mBackwardButton, getString("run_back_tooltip"))); + mModeControlTooltipsMap[MM_RUN] = runTipMap; + + control_tooltip_map_t flyTipMap; + flyTipMap.insert(std::make_pair(mForwardButton, getString("fly_forward_tooltip"))); + flyTipMap.insert(std::make_pair(mBackwardButton, getString("fly_back_tooltip"))); + mModeControlTooltipsMap[MM_FLY] = flyTipMap; + + setModeTooltip(MM_WALK); +} + +void LLFloaterMove::initModeButtonMap() +{ + mModeControlButtonMap[MM_WALK] = getChild<LLButton>("mode_walk_btn"); + mModeControlButtonMap[MM_RUN] = getChild<LLButton>("mode_run_btn"); + mModeControlButtonMap[MM_FLY] = getChild<LLButton>("mode_fly_btn"); +} + +void LLFloaterMove::initMovementMode() +{ + EMovementMode initMovementMode = gAgent.getAlwaysRun() ? MM_RUN : MM_WALK; + if (gAgent.getFlying()) + { + initMovementMode = MM_FLY; + } + setMovementMode(initMovementMode); + + if (gAgent.getAvatarObject()) + { + setEnabled(!gAgent.getAvatarObject()->isSitting()); + } +} + +void LLFloaterMove::setModeTooltip(const EMovementMode mode) +{ + llassert_always(mModeControlTooltipsMap.end() != mModeControlTooltipsMap.find(mode)); + control_tooltip_map_t controlsTipMap = mModeControlTooltipsMap[mode]; + control_tooltip_map_t::const_iterator it = controlsTipMap.begin(); + for (; it != controlsTipMap.end(); ++it) + { + LLView* ctrl = it->first; + std::string tooltip = it->second; + ctrl->setToolTip(tooltip); + } +} + +/** + * Updates position of the floater to be center aligned with Move button. + * + * Because Tip floater created as dependent floater this method + * must be called before "showQuickTips()" to get Tip floater be positioned at the right side of the floater + */ +void LLFloaterMove::updatePosition() +{ + LLBottomTray* tray = LLBottomTray::getInstance(); + if (!tray) return; + + LLButton* movement_btn = tray->getChild<LLButton>(BOTTOM_TRAY_BUTTON_NAME, TRUE, FALSE); + if (!movement_btn) return; + + //align centers of a button and a floater + S32 x = movement_btn->calcScreenRect().getCenterX() - getRect().getWidth()/2; + + S32 y = 0; + if (!mModeActionsPanel->getVisible()) + { + y = mModeActionsPanel->getRect().getHeight(); + } + setOrigin(x, y); +} +void LLFloaterMove::showModeButtons(BOOL bShow) +{ + if (mModeActionsPanel->getVisible() == bShow) + return; + mModeActionsPanel->setVisible(bShow); + + LLRect rect = getRect(); + + static S32 height = mModeActionsPanel->getRect().getHeight(); + S32 newHeight = getRect().getHeight(); + if (!bShow) + { + newHeight -= height; + } + else + { + newHeight += height; + } + rect.setLeftTopAndSize(rect.mLeft, rect.mTop, rect.getWidth(), newHeight); + reshape(rect.getWidth(), rect.getHeight()); + setRect(rect); +} +//static +void LLFloaterMove::enableInstance(BOOL bEnable) +{ + LLFloaterMove* instance = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview"); + if (instance) + { + instance->setEnabled(bEnable); + instance->showModeButtons(bEnable); + } +} + +void LLFloaterMove::onOpen(const LLSD& key) +{ + updatePosition(); +} + +void LLFloaterMove::showQuickTips(const EMovementMode mode) +{ + LLFirstTimeTipsManager::EFirstTimeTipType tipType = LLFirstTimeTipsManager::FTT_MOVE_WALK; + switch (mode) + { + case MM_FLY: tipType = LLFirstTimeTipsManager::FTT_MOVE_FLY; break; + case MM_RUN: tipType = LLFirstTimeTipsManager::FTT_MOVE_RUN; break; + case MM_WALK: tipType = LLFirstTimeTipsManager::FTT_MOVE_WALK; break; + default: llwarns << "Quick Tip type was not detected, FTT_MOVE_WALK will be used" << llendl; + } + + LLFirstTimeTipsManager::showTipsFor(tipType, this); +} + +void LLFloaterMove::setModeButtonToggleState(const EMovementMode mode) +{ + llassert_always(mModeControlButtonMap.end() != mModeControlButtonMap.find(mode)); + + mode_control_button_map_t::const_iterator it = mModeControlButtonMap.begin(); + for (; it != mModeControlButtonMap.end(); ++it) + { + it->second->setToggleState(FALSE); + } + + mModeControlButtonMap[mode]->setToggleState(TRUE); +} + + + +/************************************************************************/ +/* LLPanelStandStopFlying */ +/************************************************************************/ +LLPanelStandStopFlying::LLPanelStandStopFlying() : + mStandButton(NULL), + mStopFlyingButton(NULL) +{ + // make sure we have the only instance of this class + static bool b = true; + llassert_always(b); + b=false; +} + +// static +inline LLPanelStandStopFlying* LLPanelStandStopFlying::getInstance() +{ + static LLPanelStandStopFlying* panel = getStandStopFlyingPanel(); + return panel; +} + +//static +void LLPanelStandStopFlying::setStandStopFlyingMode(EStandStopFlyingMode mode) +{ + LLPanelStandStopFlying* panel = getInstance(); + panel->setVisible(TRUE); + + BOOL standVisible = SSFM_STAND == mode; + panel->mStandButton->setVisible(standVisible); + panel->mStopFlyingButton->setVisible(!standVisible); +} + +//static +void LLPanelStandStopFlying::clearStandStopFlyingMode(EStandStopFlyingMode mode) +{ + LLPanelStandStopFlying* panel = getInstance(); + switch(mode) { + case SSFM_STAND: + panel->mStandButton->setVisible(FALSE); + break; + case SSFM_STOP_FLYING: + panel->mStopFlyingButton->setVisible(FALSE); + break; + default: + llerrs << "Unexpected EStandStopFlyingMode is passed: " << mode << llendl; + } + +} + +BOOL LLPanelStandStopFlying::postBuild() +{ + mStandButton = getChild<LLButton>("stand_btn"); + mStandButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStandButtonClick, this)); + mStandButton->setCommitCallback(boost::bind(&LLFloaterMove::enableInstance, TRUE)); + + mStopFlyingButton = getChild<LLButton>("stop_fly_btn"); + mStopFlyingButton->setCommitCallback(boost::bind(&LLFloaterMove::setFlyingMode, FALSE)); + mStopFlyingButton->setCommitCallback(boost::bind(&LLPanelStandStopFlying::onStopFlyingButtonClick, this)); + + + return TRUE; +} + +//virtual +void LLPanelStandStopFlying::setVisible(BOOL visible) +{ + if (visible) + { + updatePosition(); + } + + LLPanel::setVisible(visible); +} + +////////////////////////////////////////////////////////////////////////// +// Private Section +////////////////////////////////////////////////////////////////////////// + +//static +LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel() +{ + LLPanelStandStopFlying* panel = new LLPanelStandStopFlying(); + LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_stand_stop_flying.xml"); + + panel->setVisible(FALSE); + LLUI::getRootView()->addChild(panel); + + llinfos << "Build LLPanelStandStopFlying panel" << llendl; + + panel->updatePosition(); + return panel; +} + +void LLPanelStandStopFlying::onStandButtonClick() +{ + LLSelectMgr::getInstance()->deselectAllForStandingUp(); + gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); + + setVisible(FALSE); +} + +void LLPanelStandStopFlying::onStopFlyingButtonClick() +{ + gAgent.setFlying(FALSE); + + setVisible(FALSE); +} + +/** + * Updates position of the Stand & Stop Flying panel to be center aligned with Move button. + */ +void LLPanelStandStopFlying::updatePosition() +{ + + LLBottomTray* tray = LLBottomTray::getInstance(); + if (!tray) return; + + LLButton* movement_btn = tray->getChild<LLButton>(BOTTOM_TRAY_BUTTON_NAME, TRUE, FALSE); + if (!movement_btn) return; + + //align centers of a button and a floater + S32 x = movement_btn->calcScreenRect().getCenterX() - getRect().getWidth()/2; + + S32 y = tray->getRect().getHeight(); + + setOrigin(x, y); +} + + // EOF diff --git a/indra/newview/llmoveview.h b/indra/newview/llmoveview.h index 250315b9f2..fd9cf9f4c1 100644 --- a/indra/newview/llmoveview.h +++ b/indra/newview/llmoveview.h @@ -55,26 +55,106 @@ public: /*virtual*/ BOOL postBuild(); static F32 getYawRate(F32 time); + static void setFlyingMode(BOOL fly); + void setFlyingModeImpl(BOOL fly); + static void setAlwaysRunMode(bool run); + void setAlwaysRunModeImpl(bool run); + static void setSittingMode(BOOL bSitting); + static void enableInstance(BOOL bEnable); + /*virtual*/ void onOpen(const LLSD& key); + + // *HACK: due to hard enough to have this control aligned with "Move" button while resizing + // let update its position in each frame + /*virtual*/ void draw(){updatePosition(); LLFloater::draw();} + protected: - static void turnLeftNudge(void* userdata); - static void turnLeft(void* userdata); - - static void turnRightNudge(void* userdata); - static void turnRight(void* userdata); + void turnLeft(); + void turnRight(); - static void moveUp(void* userdata); - static void moveDown(void* userdata); + void moveUp(); + void moveDown(); + +private: + typedef enum movement_mode_t + { + MM_WALK, + MM_RUN, + MM_FLY + } EMovementMode; + void onWalkButtonClick(); + void onRunButtonClick(); + void onFlyButtonClick(); + void onStopFlyingButtonClick(); + void initMovementMode(); + void setMovementMode(const EMovementMode mode); + void showFlyControls(bool bShow); + void initModeTooltips(); + void setModeTooltip(const EMovementMode mode); + void showQuickTips(const EMovementMode mode); + void initModeButtonMap(); + void setModeButtonToggleState(const EMovementMode mode); + void updateButtonsWithMovementMode(const EMovementMode newMode); + void updatePosition(); + void showModeButtons(BOOL bShow); public: + LLJoystickAgentTurn* mForwardButton; LLJoystickAgentTurn* mBackwardButton; - LLJoystickAgentSlide* mSlideLeftButton; - LLJoystickAgentSlide* mSlideRightButton; LLButton* mTurnLeftButton; LLButton* mTurnRightButton; LLButton* mMoveUpButton; LLButton* mMoveDownButton; +private: + LLButton* mStopFlyingButton; + LLPanel* mModeActionsPanel; + + typedef std::map<LLView*, std::string> control_tooltip_map_t; + typedef std::map<EMovementMode, control_tooltip_map_t> mode_control_tooltip_map_t; + mode_control_tooltip_map_t mModeControlTooltipsMap; + + typedef std::map<EMovementMode, LLButton*> mode_control_button_map_t; + mode_control_button_map_t mModeControlButtonMap; + +}; + + +/** + * This class contains Stand Up and Stop Flying buttons displayed above Move button in bottom tray + */ +class LLPanelStandStopFlying : public LLPanel +{ +public: + typedef enum stand_stop_flying_mode_t + { + SSFM_STAND, + SSFM_STOP_FLYING + } EStandStopFlyingMode; + + static LLPanelStandStopFlying* getInstance(); + static void setStandStopFlyingMode(EStandStopFlyingMode mode); + static void clearStandStopFlyingMode(EStandStopFlyingMode mode); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void setVisible(BOOL visible); + + // *HACK: due to hard enough to have this control aligned with "Move" button while resizing + // let update its position in each frame + /*virtual*/ void draw(){updatePosition(); LLPanel::draw();} + + +protected: + LLPanelStandStopFlying(); + + +private: + static LLPanelStandStopFlying* getStandStopFlyingPanel(); + void onStandButtonClick(); + void onStopFlyingButtonClick(); + void updatePosition(); + + LLButton* mStandButton; + LLButton* mStopFlyingButton; }; diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index ffc3b2f37a..087fdda14a 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -138,20 +138,20 @@ void LLNameListCtrl::addGroupNameItem(const LLUUID& group_id, EAddPosition pos, item.enabled = enabled; item.target = GROUP; - addRow(item, pos); + addNameItemRow(item, pos); } // public void LLNameListCtrl::addGroupNameItem(LLNameListCtrl::NameItem& item, EAddPosition pos) { item.target = GROUP; - addRow(item, pos); + addNameItemRow(item, pos); } void LLNameListCtrl::addNameItem(LLNameListCtrl::NameItem& item, EAddPosition pos) { item.target = INDIVIDUAL; - addRow(item, pos); + addNameItemRow(item, pos); } LLScrollListItem* LLNameListCtrl::addElement(const LLSD& element, EAddPosition pos, void* userdata) @@ -159,11 +159,11 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& element, EAddPosition p LLNameListCtrl::NameItem item_params; LLParamSDParser::instance().readSD(element, item_params); item_params.userdata = userdata; - return addRow(item_params, pos); + return addNameItemRow(item_params, pos); } -LLScrollListItem* LLNameListCtrl::addRow(const LLNameListCtrl::NameItem& name_item, EAddPosition pos) +LLScrollListItem* LLNameListCtrl::addNameItemRow(const LLNameListCtrl::NameItem& name_item, EAddPosition pos) { LLScrollListItem* item = LLScrollListCtrl::addRow(name_item, pos); if (!item) return NULL; diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index 80feaea881..070b6c4f4f 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -94,15 +94,7 @@ public: void addNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM); /*virtual*/ LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); - LLScrollListItem* addRow(const LLScrollListItem::Params& value, EAddPosition pos = ADD_BOTTOM) - { - // *NOTE:Mani - This implementation overrides the LLScrollListItem::addRow() - // method to call this class's special version of addRow(). - // The dynamic_cast of a reference type should throw - // a std::bad_cast exception on failure. - return addRow(dynamic_cast<const NameItem&>(value), pos); - } - LLScrollListItem* addRow(const NameItem& value, EAddPosition pos = ADD_BOTTOM); + LLScrollListItem* addNameItemRow(const NameItem& value, EAddPosition pos = ADD_BOTTOM); // Add a user to the list by name. It will be added, the name // requested from the cache, and updated as necessary. diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index 58ec2d24a8..06cab9afb0 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -47,12 +47,15 @@ #include "lllocationinputctrl.h" #include "llteleporthistory.h" #include "llsearcheditor.h" +#include "llsidetray.h" #include "llslurl.h" #include "llurlsimstring.h" #include "llviewerinventory.h" #include "llviewermenu.h" #include "llviewerparcelmgr.h" #include "llworldmap.h" +#include "llappviewer.h" +#include "llviewercontrol.h" //-- LLTeleportHistoryMenuItem ----------------------------------------------- @@ -190,6 +193,9 @@ LLNavigationBar::LLNavigationBar() // navigation bar can never get a tab setFocusRoot(FALSE); + + // set a listener function for LoginComplete event + LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLNavigationBar::handleLoginComplete, this)); } LLNavigationBar::~LLNavigationBar() @@ -253,7 +259,7 @@ void LLNavigationBar::draw() LLPanel::draw(); } -BOOL LLNavigationBar::handleRightMouseDown(S32 x, S32 y, MASK mask) +BOOL LLNavigationBar::handleRightMouseUp(S32 x, S32 y, MASK mask) { // *HACK. We should use mCmbLocation's right click callback instead. @@ -271,7 +277,7 @@ BOOL LLNavigationBar::handleRightMouseDown(S32 x, S32 y, MASK mask) } return TRUE; } - return LLPanel:: handleRightMouseDown(x, y, mask); + return LLPanel:: handleRightMouseUp(x, y, mask); } void LLNavigationBar::onBackButtonClicked() @@ -410,21 +416,26 @@ void LLNavigationBar::onRegionNameResponse( } // Location is valid. Add it to the typed locations history. + // If user has typed text this variable will contain -1. S32 selected_item = mCmbLocation->getCurrentIndex(); - if (selected_item == -1) // user has typed text - { - LLLocationHistory* lh = LLLocationHistory::getInstance(); - mCmbLocation->add(typed_location); - lh->addItem(typed_location); - lh->save(); - } + + /* + LLLocationHistory* lh = LLLocationHistory::getInstance(); + lh->addItem(selected_item == -1 ? typed_location : mCmbLocation->getSelectedItemLabel()); + lh->save(); + */ // Teleport to the location. LLVector3d region_pos = from_region_handle(region_handle); LLVector3d global_pos = region_pos + (LLVector3d) local_coords; + llinfos << "Teleporting to: " << global_pos << llendl; gAgent.teleportViaLocation(global_pos); + + LLLocationHistory* lh = LLLocationHistory::getInstance(); + lh->addItem(selected_item == -1 ? typed_location : mCmbLocation->getSelectedItemLabel()); + lh->save(); } void LLNavigationBar::showTeleportHistoryMenu() @@ -456,18 +467,16 @@ void LLNavigationBar::onLocationContextMenuItemClicked(const LLSD& userdata) std::string item = userdata.asString(); LLLineEditor* location_entry = mCmbLocation->getTextEntry(); - if (item == std::string("copy_url")) + if (item == std::string("show_coordinates")) { - std::string sl_url = gAgent.getSLURL(); - LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(sl_url)); - - LLSD args; - args["SLURL"] = sl_url; - LLNotifications::instance().add("CopySLURL", args); + gSavedSettings.setBOOL("ShowCoordinatesOption",!gSavedSettings.getBOOL("ShowCoordinatesOption")); } else if (item == std::string("landmark")) { - LLFloaterReg::showInstance("add_landmark"); + LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark")); + + // Floater "Add Landmark" functionality moved to Side Tray + //LLFloaterReg::showInstance("add_landmark"); } else if (item == std::string("cut")) { @@ -519,6 +528,9 @@ bool LLNavigationBar::onLocationContextMenuItemEnabled(const LLSD& userdata) else if(item == std::string("can_landmark")) { return !LLLandmarkActions::landmarkAlreadyExists(); + }else if(item == std::string("show_coordinates")){ + + return gSavedSettings.getBOOL("ShowCoordinatesOption"); } return false; diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h index a46c59306d..17a1438912 100644 --- a/indra/newview/llnavigationbar.h +++ b/indra/newview/llnavigationbar.h @@ -56,7 +56,7 @@ public: /*virtual*/ void draw(); /*virtual*/ BOOL postBuild(); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); void handleLoginComplete(); void clearHistoryCache(); diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 847262ddfd..1fa1e2a09d 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -252,7 +252,8 @@ void LLNearbyChat::addMessage(const LLChat& chat) void LLNearbyChat::onNearbySpeakers() { - LLSD param = "nearby_panel"; + LLSD param; + param["people_panel_tab_name"] = "nearby_panel"; LLSideTray::getInstance()->showPanel("panel_people",param); } diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 74e3710f40..670a394c95 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -54,12 +54,6 @@ public: LLNearbyChat(const LLSD& key); ~LLNearbyChat(); - LLNearbyChat():mEChatTearofState(CHAT_PINNED){}; - LLNearbyChat(const Params& params):mEChatTearofState(CHAT_PINNED){}; - - //static LLNearbyChat* createInstance(); - //static LLNearbyChat* getInstance (); - BOOL postBuild (); void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE); diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 7b67ae645c..83f8d14b5f 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -50,7 +50,17 @@ void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 static LLDefaultChildRegistry::Register<LLGestureComboBox> r("gesture_combo_box"); -LLGestureComboBox::LLGestureComboBox(const LLComboBox::Params& p) +struct LLChatTypeTrigger { + std::string name; + EChatType type; +}; + +static LLChatTypeTrigger sChatTypeTriggers[] = { + { "/whisper" , CHAT_TYPE_WHISPER}, + { "/shout" , CHAT_TYPE_SHOUT} +}; + +LLGestureComboBox::LLGestureComboBox(const LLGestureComboBox::Params& p) : LLComboBox(p) , mGestureLabelTimer() , mLabel(p.label) @@ -58,7 +68,7 @@ LLGestureComboBox::LLGestureComboBox(const LLComboBox::Params& p) setCommitCallback(boost::bind(&LLGestureComboBox::onCommitGesture, this, _1)); // now register us as observer since we have a place to put the results - gGestureManager.addObserver(this); + LLGestureManager::instance().addObserver(this); // refresh list from current active gestures refreshGestures(); @@ -66,7 +76,7 @@ LLGestureComboBox::LLGestureComboBox(const LLComboBox::Params& p) LLGestureComboBox::~LLGestureComboBox() { - gGestureManager.removeObserver(this); + LLGestureManager::instance().removeObserver(this); } void LLGestureComboBox::refreshGestures() @@ -80,7 +90,7 @@ void LLGestureComboBox::refreshGestures() // collect list of unique gestures std::map <std::string, BOOL> unique; LLGestureManager::item_map_t::iterator it; - for (it = gGestureManager.mActive.begin(); it != gGestureManager.mActive.end(); ++it) + for (it = LLGestureManager::instance().mActive.begin(); it != LLGestureManager::instance().mActive.end(); ++it) { LLMultiGesture* gesture = (*it).second; if (gesture) @@ -130,7 +140,7 @@ void LLGestureComboBox::onCommitGesture(LLUICtrl* ctrl) // substitution and logging. std::string text(trigger); std::string revised_text; - gGestureManager.triggerAndReviseString(text, &revised_text); + LLGestureManager::instance().triggerAndReviseString(text, &revised_text); revised_text = utf8str_trim(revised_text); if (!revised_text.empty()) @@ -219,12 +229,38 @@ BOOL LLNearbyChatBar::handleKeyHere( KEY key, MASK mask ) return handled; } +BOOL LLNearbyChatBar::matchChatTypeTrigger(const std::string& in_str, std::string* out_str) +{ + U32 in_len = in_str.length(); + S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); + + for (S32 n = 0; n < cnt; n++) + { + if (in_len > sChatTypeTriggers[n].name.length()) + continue; + + std::string trigger_trunc = sChatTypeTriggers[n].name; + LLStringUtil::truncate(trigger_trunc, in_len); + + if (!LLStringUtil::compareInsensitive(in_str, trigger_trunc)) + { + *out_str = sChatTypeTriggers[n].name; + return TRUE; + } + } + + return FALSE; +} + void LLNearbyChatBar::onChatBoxKeystroke(LLLineEditor* caller, void* userdata) { + LLNearbyChatBar* self = (LLNearbyChatBar *)userdata; - LLWString raw_text; - if (self->mChatBox) raw_text = self->mChatBox->getWText(); + if (!self->mChatBox) + return; + + LLWString raw_text = self->mChatBox->getWText(); // Can't trim the end, because that will cause autocompletion // to eat trailing spaces that might be part of a gesture. @@ -268,18 +304,21 @@ void LLNearbyChatBar::onChatBoxKeystroke(LLLineEditor* caller, void* userdata) std::string utf8_trigger = wstring_to_utf8str(raw_text); std::string utf8_out_str(utf8_trigger); - if (gGestureManager.matchPrefix(utf8_trigger, &utf8_out_str)) + if (LLGestureManager::instance().matchPrefix(utf8_trigger, &utf8_out_str)) { - if (self->mChatBox) - { - std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); - self->mChatBox->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part - S32 outlength = self->mChatBox->getLength(); // in characters - - // Select to end of line, starting from the character - // after the last one the user typed. - self->mChatBox->setSelection(length, outlength); - } + std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); + self->mChatBox->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part + S32 outlength = self->mChatBox->getLength(); // in characters + + // Select to end of line, starting from the character + // after the last one the user typed. + self->mChatBox->setSelection(length, outlength); + } + else if (matchChatTypeTrigger(utf8_trigger, &utf8_out_str)) + { + std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); + self->mChatBox->setText(utf8_trigger + rest_of_match + " "); // keep original capitalization for user-entered part + self->mChatBox->setCursorToEnd(); } //llinfos << "GESTUREDEBUG " << trigger @@ -296,6 +335,38 @@ void LLNearbyChatBar::onChatBoxFocusLost(LLFocusableElement* caller, void* userd gAgent.stopTyping(); } +EChatType LLNearbyChatBar::processChatTypeTriggers(EChatType type, std::string &str) +{ + U32 length = str.length(); + S32 cnt = sizeof(sChatTypeTriggers) / sizeof(*sChatTypeTriggers); + + for (S32 n = 0; n < cnt; n++) + { + if (length >= sChatTypeTriggers[n].name.length()) + { + std::string trigger = str.substr(0, sChatTypeTriggers[n].name.length()); + + if (!LLStringUtil::compareInsensitive(trigger, sChatTypeTriggers[n].name)) + { + U32 trigger_length = sChatTypeTriggers[n].name.length(); + + // It's to remove space after trigger name + if (length > trigger_length && str[trigger_length] == ' ') + trigger_length++; + + str = str.substr(trigger_length, length); + + if (CHAT_TYPE_NORMAL == type) + return sChatTypeTriggers[n].type; + else + break; + } + } + } + + return type; +} + void LLNearbyChatBar::sendChat( EChatType type ) { if (mChatBox) @@ -315,7 +386,7 @@ void LLNearbyChatBar::sendChat( EChatType type ) if (0 == channel) { // discard returned "found" boolean - gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text); + LLGestureManager::instance().triggerAndReviseString(utf8text, &utf8_revised_text); } else { @@ -324,6 +395,8 @@ void LLNearbyChatBar::sendChat( EChatType type ) utf8_revised_text = utf8str_trim(utf8_revised_text); + type = processChatTypeTriggers(type, utf8_revised_text); + if (!utf8_revised_text.empty()) { // Chat with animation diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h index d1f5fbff6b..b640aedf7a 100644 --- a/indra/newview/llnearbychatbar.h +++ b/indra/newview/llnearbychatbar.h @@ -43,8 +43,10 @@ class LLGestureComboBox : public LLComboBox , public LLGestureManagerObserver { +public: + struct Params : public LLInitParam::Block<Params, LLComboBox::Params> { }; protected: - LLGestureComboBox(const LLComboBox::Params&); + LLGestureComboBox(const Params&); friend class LLUICtrlFactory; public: ~LLGestureComboBox(); @@ -86,6 +88,7 @@ public: static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); protected: + static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str); static void onChatBoxKeystroke(LLLineEditor* caller, void* userdata); static void onChatBoxFocusLost(LLFocusableElement* caller, void* userdata); @@ -93,6 +96,7 @@ protected: void onChatBoxCommit(); static LLWString stripChannelNumber(const LLWString &mesg, S32* channel); + EChatType processChatTypeTriggers(EChatType type, std::string &str); // Which non-zero channel did we last chat on? static S32 sLastSpecialChatChannel; diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp index 955f50caf5..d088c45710 100644 --- a/indra/newview/lloutputmonitorctrl.cpp +++ b/indra/newview/lloutputmonitorctrl.cpp @@ -70,6 +70,7 @@ LLOutputMonitorCtrl::LLOutputMonitorCtrl(const LLOutputMonitorCtrl::Params& p) : LLView(p), mPower(0), mIsMuted(true), + mIsTalking(false), mImageMute(p.image_mute), mImageOff(p.image_off), mImageOn(p.image_on), @@ -116,31 +117,32 @@ void LLOutputMonitorCtrl::draw() // call directly into gVoiceClient to ask if that agent-id is muted, is // speaking, and what power. This avoids duplicating data, which can get // out of sync. + const F32 LEVEL_0 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL / 3.f; + const F32 LEVEL_1 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL * 2.f / 3.f; + const F32 LEVEL_2 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL; + LLPointer<LLUIImage> icon; if (mIsMuted) { icon = mImageMute; } - else if (mPower == 0.f) + else if (mPower == 0.f && !mIsTalking) { + // only show off if PTT is not engaged icon = mImageOff; } - else if (mPower < LLVoiceClient::OVERDRIVEN_POWER_LEVEL) + else if (mPower < LEVEL_0) + { + // PTT is on, possibly with quiet background noise + icon = mImageOn; + } + else if (mPower < LEVEL_1) + { + icon = mImageLevel1; + } + else if (mPower < LEVEL_2) { - S32 icon_image_idx = llmin(2, llfloor((mPower / LLVoiceClient::OVERDRIVEN_POWER_LEVEL) * 3.f)); - switch(icon_image_idx) - { - default: - case 0: - icon = mImageOn; - break; - case 1: - icon = mImageLevel1; - break; - case 2: - icon = mImageLevel2; - break; - } + icon = mImageLevel2; } else { diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h index e391c14e40..98b2fe9dc6 100644 --- a/indra/newview/lloutputmonitorctrl.h +++ b/indra/newview/lloutputmonitorctrl.h @@ -76,6 +76,10 @@ public: bool getIsMuted() const { return mIsMuted; } void setIsMuted(bool val) { mIsMuted = val; } + // For the current user, need to know the PTT state to show + // correct button image. + void setIsTalking(bool val) { mIsTalking = val; } + private: //static LLColor4 sColorMuted; //static LLColor4 sColorNormal; @@ -87,6 +91,7 @@ private: F32 mPower; bool mIsMuted; + bool mIsTalking; LLPointer<LLUIImage> mImageMute; LLPointer<LLUIImage> mImageOff; LLPointer<LLUIImage> mImageOn; diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index a24d1ed54a..0eb96f992a 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -231,7 +231,7 @@ void LLOverlayBar::refresh() BOOL sitting = FALSE; if (gAgent.getAvatarObject()) { - sitting = gAgent.getAvatarObject()->mIsSitting; + sitting = gAgent.getAvatarObject()->isSitting(); } button = getChild<LLButton>("Stand Up"); diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index f57489934a..91156ae542 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -269,7 +269,7 @@ void LLPanelAvatarProfile::processProperties(void* data, EAvatarProcessorType ty childSetValue("sl_description_edit", avatar_data->about_text); childSetValue("fl_description_edit",avatar_data->fl_about_text); childSetValue("2nd_life_pic", avatar_data->image_id); - childSetValue("1st_life_pic", avatar_data->fl_image_id); + childSetValue("real_world_pic", avatar_data->fl_image_id); childSetValue("homepage_edit", avatar_data->profile_url); if (!isEditMode()) @@ -365,7 +365,7 @@ void LLPanelAvatarProfile::clear() void LLPanelAvatarProfile::clearControls() { childSetValue("2nd_life_pic",LLUUID::null); - childSetValue("1st_life_pic",LLUUID::null); + childSetValue("real_world_pic",LLUUID::null); childSetValue("online_status",LLStringUtil::null); childSetValue("status_message",LLStringUtil::null); childSetValue("sl_description_edit",LLStringUtil::null); @@ -489,7 +489,7 @@ void LLPanelAvatarProfile::onShareButtonClick() { pic->setFallbackImageName("default_land_picture.j2c"); } - pic = getChild<LLTextureCtrl>("1st_life_pic",TRUE,FALSE); + pic = getChild<LLTextureCtrl>("real_world_pic",TRUE,FALSE); if(pic) { pic->setFallbackImageName("default_land_picture.j2c"); @@ -510,13 +510,13 @@ void LLPanelAvatarProfile::onOpen(const LLSD& key) void LLPanelAvatarProfile::updateChildrenList() { - if (mUpdated || isEditMode()) - { - return; - } switch (mProfileType) { case PT_OWN: + if (mUpdated || isEditMode()) + { + return; + } childSetVisible("user_name", true); childSetVisible("status_panel", false); childSetVisible("profile_buttons_panel", false); diff --git a/indra/newview/llpanelavatartag.cpp b/indra/newview/llpanelavatartag.cpp new file mode 100644 index 0000000000..e66c36287b --- /dev/null +++ b/indra/newview/llpanelavatartag.cpp @@ -0,0 +1,129 @@ +/** + * @file llpanelavatartag.cpp + * @brief Avatar tag panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpanelavatartag.h" + +#include "lluictrlfactory.h" +#include "llavatariconctrl.h" +#include "lltextbox.h" + +LLPanelAvatarTag::LLPanelAvatarTag(const LLUUID& key, const std::string im_time) + : LLPanel() + , mAvatarId(LLUUID::null) +// , mFadeTimer() +{ + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_tag.xml"); + setLeftButtonClickCallback(boost::bind(&LLPanelAvatarTag::onClick, this)); + setAvatarId(key); + setTime(im_time); +} + +LLPanelAvatarTag::~LLPanelAvatarTag() +{ + // Name callbacks will be automatically disconnected since LLPanel is trackable +} + +BOOL LLPanelAvatarTag::postBuild() +{ + mIcon = getChild<LLAvatarIconCtrl>("avatar_tag_icon"); + mName = getChild<LLTextBox>("sender_tag_name"); + mTime = getChild<LLTextBox>("tag_time"); + return TRUE; +} + +void LLPanelAvatarTag::draw() +{ + + ///TODO: ANGELA do something similar to fade the panel out +/* // HACK: assuming tooltip background is in ToolTipBGColor, perform fade out + LLColor4 bg_color = LLUIColorTable::instance().getColor( "ToolTipBgColor" ); + if (tooltip_vis) + { + mToolTipFadeTimer.stop(); + mToolTip->setBackgroundColor(bg_color); + } + else + { + if (!mToolTipFadeTimer.getStarted()) + { + mToolTipFadeTimer.start(); + } + F32 tool_tip_fade_time = gSavedSettings.getF32("ToolTipFadeTime"); + bg_color.mV[VALPHA] = clamp_rescale(mToolTipFadeTimer.getElapsedTimeF32(), 0.f, tool_tip_fade_time, bg_color.mV[VALPHA], 0.f); + mToolTip->setBackgroundColor(bg_color); + } + + // above interpolation of bg_color alpha is guaranteed to reach 0.f exactly + mToolTip->setVisible( bg_color.mV[VALPHA] != 0.f ); + */ +} +void LLPanelAvatarTag::setName(const std::string& name) +{ + if (mName) + mName->setText(name); +} + +void LLPanelAvatarTag::setTime(const std::string& time) +{ + if (mTime) + mTime->setText(time); +} + + +void LLPanelAvatarTag::setAvatarId(const LLUUID& avatar_id) +{ + mAvatarId = avatar_id; + if (mIcon) + { + mIcon->setValue(avatar_id); + } + setName(std::string(mIcon->getFirstName()+ " "+ mIcon->getLastName())); +} + +boost::signals2::connection LLPanelAvatarTag::setLeftButtonClickCallback( + const commit_callback_t& cb) +{ + return mCommitSignal.connect(cb); +} + +BOOL LLPanelAvatarTag::handleMouseDown(S32 x, S32 y, MASK mask) +{ + onCommit(); + return TRUE; +} + +void LLPanelAvatarTag::onClick() +{ + // Do the on click stuff. +} diff --git a/indra/newview/llpanelavatartag.h b/indra/newview/llpanelavatartag.h new file mode 100644 index 0000000000..d68b0d7299 --- /dev/null +++ b/indra/newview/llpanelavatartag.h @@ -0,0 +1,93 @@ +/** + * @file llpanelavatartag.h + * @brief Avatar row panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELAVATARTAG_H +#define LL_LLPANELAVATARTAG_H + +#include "llpanel.h" +#include "llavatarpropertiesprocessor.h" + +class LLAvatarIconCtrl; +class LLTextBox; + +/** + * Avatar Tag panel. + * + * Test. + * + * Contains avatar name + * Provide methods for setting avatar id, state, muted status and speech power. + */ +class LLPanelAvatarTag : public LLPanel +{ +public: + LLPanelAvatarTag(const LLUUID& key, const std::string im_time); + virtual ~LLPanelAvatarTag(); + + /** + * Set avatar ID. + * + * After the ID is set, it is possible to track the avatar status and get its name. + */ + void setAvatarId(const LLUUID& avatar_id); + void setTime (const std::string& time); + + const LLUUID& getAvatarId() const { return mAvatarId; } + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void draw(); + + virtual boost::signals2::connection setLeftButtonClickCallback( + const commit_callback_t& cb); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + + void onClick(); +private: + void setName(const std::string& name); + + /** + * Called by LLCacheName when the avatar name gets updated. + */ + void nameUpdatedCallback( + const LLUUID& id, + const std::string& first, + const std::string& last, + BOOL is_group); + + LLAvatarIconCtrl* mIcon; /// status tracking avatar icon + LLTextBox* mName; /// displays avatar name + LLTextBox* mTime; /// displays time + LLUUID mAvatarId; +// LLFrameTimer mFadeTimer; +}; + +#endif diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index df687ffb30..42522942f3 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -55,7 +55,6 @@ #include "llcommandhandler.h" // for classified HTML detail page click tracking #include "llviewercontrol.h" #include "lllineeditor.h" -#include "llfloaterclassified.h" #include "lltextbox.h" #include "llcombobox.h" #include "llviewertexteditor.h" @@ -1063,7 +1062,7 @@ void LLPanelClassified::sendClassifiedClickMessage(const std::string& type) //////////////////////////////////////////////////////////////////////////////////////////// LLFloaterPriceForListing::LLFloaterPriceForListing() -: LLFloater(), +: LLFloater(LLSD()), mCallback(NULL), mUserData(NULL) { } @@ -1099,7 +1098,7 @@ void LLFloaterPriceForListing::show( void (*callback)(S32, std::string, void*), LLFloaterPriceForListing *self = new LLFloaterPriceForListing(); // Builds and adds to gFloaterView - LLUICtrlFactory::getInstance()->buildFloater(self, "floater_price_for_listing.xml"); + LLUICtrlFactory::getInstance()->buildFloater(self, "floater_price_for_listing.xml", NULL); self->center(); self->mCallback = callback; diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 1c52c3cea4..50e1f84cad 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -144,17 +144,22 @@ BOOL LLPanelGroupRoles::postBuild() if (!mSubTabContainer) return FALSE; // Hook up each sub-tabs callback and widgets. - S32 i; - for (i = 0; i < mSubTabContainer->getTabCount(); ++i) + for (S32 i = 0; i < mSubTabContainer->getTabCount(); ++i) { - LLPanelGroupSubTab* subtabp = (LLPanelGroupSubTab*) mSubTabContainer->getPanelByIndex(i); - + LLPanel* panel = mSubTabContainer->getPanelByIndex(i); + LLPanelGroupSubTab* subtabp = dynamic_cast<LLPanelGroupSubTab*>(panel); + if (!subtabp) + { + llwarns << "Invalid subtab panel: " << panel->getName() << llendl; + return FALSE; + } // Add click callbacks to all the tabs. mSubTabContainer->setCommitCallback(boost::bind(&LLPanelGroupRoles::handleClickSubTab, this)); // Hand the subtab a pointer to this LLPanelGroupRoles, so that it can // look around for the widgets it is interested in. - if (!subtabp->postBuildSubTab(this)) return FALSE; + if (!subtabp->postBuildSubTab(this)) + return FALSE; subtabp->addObserver(this); } @@ -1711,7 +1716,18 @@ void* LLPanelGroupRolesSubTab::createTab(void* data) } LLPanelGroupRolesSubTab::LLPanelGroupRolesSubTab(const LLUUID& group_id) -: LLPanelGroupSubTab(group_id), mHasRoleChange(FALSE) + : LLPanelGroupSubTab(group_id), + mRolesList(NULL), + mAssignedMembersList(NULL), + mAllowedActionsList(NULL), + mRoleName(NULL), + mRoleTitle(NULL), + mRoleDescription(NULL), + mMemberVisibleCheck(NULL), + mDeleteRoleButton(NULL), + mCreateRoleButton(NULL), + + mHasRoleChange(FALSE) { } diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 8e5625f49a..7007bfc9d5 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -431,8 +431,14 @@ BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask) # if !LL_RELEASE_FOR_DOWNLOAD if ( KEY_F2 == key ) { - llinfos << "Spawning floater TOS window" << llendl; - LLFloaterTOS::show(LLFloaterTOS::TOS_TOS,"", NULL); + llinfos << "Spawning floater TOS window (TOS)" << llendl; + LLFloaterReg::showInstance("message_tos",LLSD("")); + return TRUE; + } + if ( KEY_F3 == key ) + { + llinfos << "Spawning floater TOS window (critical message)" << llendl; + LLFloaterReg::showInstance("message_critical",LLSD("")); return TRUE; } #endif @@ -635,7 +641,12 @@ void LLPanelLogin::refreshLocation( bool force_visible ) BOOL show_start = TRUE; if ( ! force_visible ) - show_start = gSavedSettings.getBOOL("ShowStartLocation"); + { + // Don't show on first run after install + // Otherwise ShowStartLocation defaults to true. + show_start = gSavedSettings.getBOOL("ShowStartLocation") + && !gSavedSettings.getBOOL("FirstRunThisInstall"); + } sInstance->childSetVisible("start_location_combo", show_start); sInstance->childSetVisible("start_location_text", show_start); @@ -792,7 +803,8 @@ void LLPanelLogin::loadLoginPage() { oStr << "&auto_login=TRUE"; } - if (gSavedSettings.getBOOL("ShowStartLocation")) + if (gSavedSettings.getBOOL("ShowStartLocation") + && !gSavedSettings.getBOOL("FirstRunThisInstall")) { oStr << "&show_start_location=TRUE"; } diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 92a8653252..9be2fb12d2 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -330,6 +330,8 @@ LLPanelPeople::~LLPanelPeople() BOOL LLPanelPeople::postBuild() { + mVisibleSignal.connect(boost::bind(&LLPanelPeople::onVisibilityChange, this, _2)); + mFilterEditor = getChild<LLFilterEditor>("filter_input"); mFilterEditor->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); @@ -539,7 +541,7 @@ void LLPanelPeople::updateButtons() } bool item_selected = selected_id.notNull(); - buttonSetEnabled("teleport_btn", friends_tab_active && item_selected); + buttonSetEnabled("teleport_btn", (friends_tab_active || group_tab_active) && item_selected); buttonSetEnabled("view_profile_btn", item_selected); buttonSetEnabled("im_btn", item_selected); buttonSetEnabled("call_btn", item_selected && false); // not implemented yet @@ -589,9 +591,9 @@ void LLPanelPeople::showGroupMenu(LLMenuGL* menu) LLMenuGL::showPopup(parent_panel, menu, menu_x, menu_y); } -void LLPanelPeople::onVisibilityChange(BOOL new_visibility) +void LLPanelPeople::onVisibilityChange(const LLSD& new_visibility) { - if (new_visibility == FALSE) + if (new_visibility.asBoolean() == FALSE) { // Don't update anything while we're invisible. mNearbyListUpdater->setActive(FALSE); @@ -618,9 +620,9 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string) mFilterSubString = search_string; + // Searches are case-insensitive LLStringUtil::toUpper(mFilterSubString); LLStringUtil::trimHead(mFilterSubString); - mFilterEditor->setText(mFilterSubString); // Apply new filter to all tabs. filterNearbyList(); @@ -771,7 +773,16 @@ void LLPanelPeople::onCallButtonClicked() void LLPanelPeople::onTeleportButtonClicked() { - LLAvatarActions::offerTeleport(getCurrentItemID()); + std::string cur_tab = mTabContainer->getCurrentPanel()->getName(); + + if (cur_tab == FRIENDS_TAB_NAME) + { + LLAvatarActions::offerTeleport(getCurrentItemID()); + } + else if (cur_tab == GROUP_TAB_NAME) + { + LLGroupActions::offerTeleport(getCurrentItemID()); + } } void LLPanelPeople::onShareButtonClicked() @@ -786,22 +797,10 @@ void LLPanelPeople::onMoreButtonClicked() void LLPanelPeople::onOpen(const LLSD& key) { - // Profile View is activated through LLSideTray::showPanel(), - // hide Profile View to be able to see Panel People content - hideProfileView(); - - std::string tab_name = key.asString(); + std::string tab_name = key["people_panel_tab_name"]; if (!tab_name.empty()) mTabContainer->selectTabByName(tab_name); else reSelectedCurrentTab(); } -void LLPanelPeople::hideProfileView() -{ - LLView* view = getChildView("panel_profile_view",true,false); - if(view && view->getVisible()) - { - view->setVisible(false); - } -} diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 2ac1bf424c..58ed77f0f2 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -72,7 +72,7 @@ private: void buttonSetAction(const std::string& btn_name, const commit_signal_t::slot_type& cb); void showGroupMenu(LLMenuGL* menu); - /*virtual*/ void onVisibilityChange(BOOL new_visibility); + void onVisibilityChange( const LLSD& new_visibility); void reSelectedCurrentTab(); @@ -104,8 +104,6 @@ private: const std::vector<LLUUID>& ids, void*); - void hideProfileView(); - LLFilterEditor* mFilterEditor; LLTabContainer* mTabContainer; LLAvatarList* mFriendList; diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 371c0f2df3..19aef93d7e 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -58,6 +58,7 @@ #include "lldbstrings.h" #include "llfloatergroupinfo.h" #include "llfloatergroups.h" +#include "llfloaterreg.h" #include "llavataractions.h" #include "llnamebox.h" #include "llviewercontrol.h" @@ -836,15 +837,17 @@ void LLPanelPermissions::onClickGroup() if(owners_identical && (owner_id == gAgent.getID())) { - LLFloaterGroupPicker* fg; - fg = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); - fg->setSelectGroupCallback( boost::bind(&LLPanelPermissions::cbGroupID, this, _1) ); - - if (parent_floater) + LLFloaterGroupPicker* fg = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID())); + if (fg) { - LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg); - fg->setOrigin(new_rect.mLeft, new_rect.mBottom); - parent_floater->addDependentFloater(fg); + fg->setSelectGroupCallback( boost::bind(&LLPanelPermissions::cbGroupID, this, _1) ); + + if (parent_floater) + { + LLRect new_rect = gFloaterView->findNeighboringPosition(parent_floater, fg); + fg->setOrigin(new_rect.mLeft, new_rect.mBottom); + parent_floater->addDependentFloater(fg); + } } } } diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp index b43828e681..31d76ca4e2 100644 --- a/indra/newview/llpanelplaceinfo.cpp +++ b/indra/newview/llpanelplaceinfo.cpp @@ -51,6 +51,7 @@ #include "llagent.h" #include "llfloaterworldmap.h" #include "llinventorymodel.h" +#include "lllandmarkactions.h" #include "lltexturectrl.h" #include "llviewerinventory.h" #include "llviewerparcelmgr.h" @@ -488,6 +489,26 @@ void LLPanelPlaceInfo::onCommitTitleOrNote(LANDMARK_INFO_TYPE type) } } +void LLPanelPlaceInfo::createLandmark(const LLUUID& folder_id) +{ + std::string name = mTitleEditor->getText(); + std::string desc = mNotesEditor->getText(); + + LLStringUtil::trim(name); + LLStringUtil::trim(desc); + + // If typed name is empty use the parcel name instead. + if (name.empty()) + { + name = mParcelName->getText() + "; " + mRegionName->getText(); + } + + LLStringUtil::replaceChar(desc, '\n', ' '); + // If no folder chosen use the "Landmarks" folder. + LLLandmarkActions::createLandmarkHere(name, desc, + folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK)); +} + void LLPanelPlaceInfo::reshape(S32 width, S32 height, BOOL called_from_parent) { if (mMinHeight > 0) diff --git a/indra/newview/llpanelplaceinfo.h b/indra/newview/llpanelplaceinfo.h index f06a2d1fb7..e7b81dc3e6 100644 --- a/indra/newview/llpanelplaceinfo.h +++ b/indra/newview/llpanelplaceinfo.h @@ -79,6 +79,10 @@ public: // sets a corresponding title and contents. void setInfoType(INFO_TYPE type); + // Create a landmark for the current location + // in a folder specified by folder_id + void createLandmark(const LLUUID& folder_id); + BOOL isMediaPanelVisible(); void toggleMediaPanel(BOOL visible); void displayItemInfo(const LLInventoryItem* pItem); diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index b443cc4d5e..31b2d01dcf 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -39,6 +39,7 @@ #include "llnotifications.h" #include "llfiltereditor.h" #include "lltabcontainer.h" +#include "lltrans.h" #include "lluictrlfactory.h" #include "llagent.h" @@ -48,11 +49,15 @@ #include "llpanellandmarks.h" #include "llpanelteleporthistory.h" #include "llsidetray.h" +#include "lltoggleablemenu.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" -// Helper function to get local position from global -const LLVector3 get_pos_local_from_global(const LLVector3d &pos_global); +// Helper functions +static bool cmp_folders(const folder_pair_t& left, const folder_pair_t& right); +static std::string getFullFolderName(const LLViewerInventoryCategory* cat); +static void collectLandmarkFolders(LLInventoryModel::cat_array_t& cats); +static const LLVector3 get_pos_local_from_global(const LLVector3d &pos_global); static LLRegisterPanelClassWrapper<LLPanelPlaces> t_places("panel_places"); @@ -63,6 +68,7 @@ LLPanelPlaces::LLPanelPlaces() mFilterEditor(NULL), mPlaceInfo(NULL), mItem(NULL), + mLandmarkFoldersMenuHandle(), mPosGlobal() { gInventory.addObserver(this); @@ -77,17 +83,25 @@ LLPanelPlaces::~LLPanelPlaces() { if (gInventory.containsObserver(this)) gInventory.removeObserver(this); + + LLView::deleteViewByHandle(mLandmarkFoldersMenuHandle); } BOOL LLPanelPlaces::postBuild() { + mCreateLandmarkBtn = getChild<LLButton>("create_landmark_btn"); + mCreateLandmarkBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onCreateLandmarkButtonClicked, this, LLUUID())); + + mFolderMenuBtn = getChild<LLButton>("folder_menu_btn"); + mFolderMenuBtn->setClickedCallback(boost::bind(&LLPanelPlaces::showLandmarkFoldersMenu, this)); + mTeleportBtn = getChild<LLButton>("teleport_btn"); mTeleportBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onTeleportButtonClicked, this)); mShowOnMapBtn = getChild<LLButton>("map_btn"); mShowOnMapBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onShowOnMapButtonClicked, this)); - //mShareBtn = getChild<LLButton>("share_btn"); + mShareBtn = getChild<LLButton>("share_btn"); //mShareBtn->setClickedCallback(boost::bind(&LLPanelPlaces::onShareButtonClicked, this)); mOverflowBtn = getChild<LLButton>("overflow_btn"); @@ -155,6 +169,11 @@ void LLPanelPlaces::onOpen(const LLSD& key) } else if (mPlaceInfoType == "remote_place") { + if (mPlaceInfo->isMediaPanelVisible()) + { + toggleMediaPanel(); + } + mPosGlobal = LLVector3d(key["x"].asReal(), key["y"].asReal(), key["z"].asReal()); @@ -220,11 +239,10 @@ void LLPanelPlaces::onFilterEdit(const std::string& search_string) { mFilterSubString = search_string; + // Searches are case-insensitive LLStringUtil::toUpper(mFilterSubString); LLStringUtil::trimHead(mFilterSubString); - mFilterEditor->setText(mFilterSubString); - mActivePanel->onSearchEdit(mFilterSubString); } } @@ -323,20 +341,31 @@ void LLPanelPlaces::onShowOnMapButtonClicked() } } +void LLPanelPlaces::onCreateLandmarkButtonClicked(const LLUUID& folder_id) +{ + if (!mPlaceInfo) + return; + + mPlaceInfo->createLandmark(folder_id); + + onBackButtonClicked(); + LLSideTray::getInstance()->collapseSideBar(); +} + void LLPanelPlaces::onBackButtonClicked() { togglePlaceInfoPanel(FALSE); // Resetting mPlaceInfoType when Place Info panel is closed. mPlaceInfoType = LLStringUtil::null; - + updateVerbs(); } void LLPanelPlaces::toggleMediaPanel() { if (!mPlaceInfo) - return; + return; mPlaceInfo->toggleMediaPanel(!mPlaceInfo->isMediaPanelVisible()); } @@ -403,7 +432,7 @@ void LLPanelPlaces::onAgentParcelChange() { if (mPlaceInfo->getVisible() && (mPlaceInfoType == "agent" || mPlaceInfoType == "create_landmark")) { - LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", mPlaceInfoType)); + onOpen(LLSD().insert("type", mPlaceInfoType)); } else { @@ -415,9 +444,20 @@ void LLPanelPlaces::updateVerbs() { bool is_place_info_visible = mPlaceInfo->getVisible(); bool is_agent_place_info_visible = mPlaceInfoType == "agent"; + bool is_create_landmark_visible = mPlaceInfoType == "create_landmark"; + + mTeleportBtn->setVisible(!is_create_landmark_visible); + mShareBtn->setVisible(!is_create_landmark_visible); + mCreateLandmarkBtn->setVisible(is_create_landmark_visible); + mFolderMenuBtn->setVisible(is_create_landmark_visible); + + // Enable overflow button only when showing the information + // about agent's current location. + mOverflowBtn->setEnabled(is_agent_place_info_visible); + if (is_place_info_visible) { - if (is_agent_place_info_visible || mPlaceInfoType == "create_landmark") + if (is_agent_place_info_visible) { // We don't need to teleport to the current location so disable the button mTeleportBtn->setEnabled(FALSE); @@ -433,9 +473,205 @@ void LLPanelPlaces::updateVerbs() { mActivePanel->updateVerbs(); } +} + +void LLPanelPlaces::showLandmarkFoldersMenu() +{ + if (mLandmarkFoldersMenuHandle.isDead()) + { + LLToggleableMenu::Params menu_p; + menu_p.name("landmarks_folders_menu"); + menu_p.can_tear_off(false); + menu_p.visible(false); + menu_p.scrollable(true); + + LLToggleableMenu* menu = LLUICtrlFactory::create<LLToggleableMenu>(menu_p); + + mLandmarkFoldersMenuHandle = menu->getHandle(); + } + + LLToggleableMenu* menu = (LLToggleableMenu*)mLandmarkFoldersMenuHandle.get(); + if(!menu) + return; + + if (menu->getClosedByButtonClick()) + { + menu->resetClosedByButtonClick(); + return; + } + + if (menu->getVisible()) + { + menu->setVisible(FALSE); + menu->resetClosedByButtonClick(); + return; + } + + // Collect all folders that can contain landmarks. + LLInventoryModel::cat_array_t cats; + collectLandmarkFolders(cats); + + // Sort the folders by their full name. + folder_vec_t folders; + S32 count = cats.count(); + for (S32 i = 0; i < count; i++) + { + const LLViewerInventoryCategory* cat = cats.get(i); + std::string cat_full_name = getFullFolderName(cat); + folders.push_back(folder_pair_t(cat->getUUID(), cat_full_name)); + } + sort(folders.begin(), folders.end(), cmp_folders); + + LLRect btn_rect = mFolderMenuBtn->getRect(); + + LLRect root_rect = getRootView()->getRect(); + + // Check it there are changed items or viewer dimensions + // have changed since last call + if (mLandmarkFoldersCache.size() == count && + mRootViewWidth == root_rect.getWidth() && + mRootViewHeight == root_rect.getHeight()) + { + S32 i; + for (i = 0; i < count; i++) + { + if (mLandmarkFoldersCache[i].second != folders[i].second) + { + break; + } + } + + // Check passed, just show the menu + if (i == count) + { + menu->buildDrawLabels(); + menu->updateParent(LLMenuGL::sMenuContainer); + + menu->setButtonRect(btn_rect, this); + LLMenuGL::showPopup(this, menu, btn_rect.mRight, btn_rect.mTop); + return; + } + } + + // If there are changes, store the new viewer dimensions + // and a list of folders + mRootViewWidth = root_rect.getWidth(); + mRootViewHeight = root_rect.getHeight(); + mLandmarkFoldersCache = folders; + + menu->empty(); + U32 max_width = 0; + + // Menu width must not exceed the root view limits, + // so we assume the space between the left edge of + // the root view and + LLRect screen_btn_rect; + localRectToScreen(btn_rect, &screen_btn_rect); + S32 free_space = screen_btn_rect.mRight; + + for(folder_vec_t::const_iterator it = mLandmarkFoldersCache.begin(); it != mLandmarkFoldersCache.end(); it++) + { + const std::string& item_name = it->second; + + LLMenuItemCallGL::Params item_params; + item_params.name(item_name); + item_params.label(item_name); + + item_params.on_click.function(boost::bind(&LLPanelPlaces::onCreateLandmarkButtonClicked, this, it->first)); + + LLMenuItemCallGL *menu_item = LLUICtrlFactory::create<LLMenuItemCallGL>(item_params); + + // Check whether item name wider than menu + if ((S32) menu_item->getNominalWidth() > free_space) + { + S32 chars_total = item_name.length(); + S32 chars_fitted = 1; + menu_item->setLabel(LLStringExplicit("")); + S32 label_space = free_space - menu_item->getFont()->getWidth("...") - + menu_item->getNominalWidth(); // This returns width of menu item with empty label (pad pixels) + + while (chars_fitted < chars_total && menu_item->getFont()->getWidth(item_name, 0, chars_fitted) < label_space) + { + chars_fitted++; + } + chars_fitted--; // Rolling back one char, that doesn't fit + + menu_item->setLabel(item_name.substr(0, chars_fitted) + "..."); + } + + max_width = llmax(max_width, menu_item->getNominalWidth()); + + menu->addChild(menu_item); + } - // Enable overflow button only when showing the information about agent's current location. - mOverflowBtn->setEnabled(is_place_info_visible && is_agent_place_info_visible); + menu->buildDrawLabels(); + menu->updateParent(LLMenuGL::sMenuContainer); + menu->setButtonRect(btn_rect, this); + LLMenuGL::showPopup(this, menu, btn_rect.mRight, btn_rect.mTop); +} + +static bool cmp_folders(const folder_pair_t& left, const folder_pair_t& right) +{ + return left.second < right.second; +} + +static std::string getFullFolderName(const LLViewerInventoryCategory* cat) +{ + std::string name = cat->getName(); + LLUUID parent_id; + + // translate category name, if it's right below the root + // FIXME: it can throw notification about non existent string in strings.xml + if (cat->getParentUUID().notNull() && cat->getParentUUID() == gInventory.getRootFolderID()) + { + name = LLTrans::getString("InvFolder " + name); + } + + // we don't want "My Inventory" to appear in the name + while ((parent_id = cat->getParentUUID()).notNull() && parent_id != gInventory.getRootFolderID()) + { + cat = gInventory.getCategory(parent_id); + name = cat->getName() + "/" + name; + } + + return name; +} + +static void collectLandmarkFolders(LLInventoryModel::cat_array_t& cats) +{ + // Add the "Landmarks" category itself. + LLUUID landmarks_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK); + LLViewerInventoryCategory* landmarks_cat = gInventory.getCategory(landmarks_id); + if (!landmarks_cat) + { + llwarns << "Cannot find the landmarks folder" << llendl; + } + else + { + cats.put(landmarks_cat); + } + + // Add descendent folders of the "Landmarks" category. + LLInventoryModel::item_array_t items; // unused + LLIsType is_category(LLAssetType::AT_CATEGORY); + gInventory.collectDescendentsIf( + landmarks_id, + cats, + items, + LLInventoryModel::EXCLUDE_TRASH, + is_category); + + // Add the "My Favorites" category. + LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE); + LLViewerInventoryCategory* favorites_cat = gInventory.getCategory(favorites_id); + if (!favorites_cat) + { + llwarns << "Cannot find the favorites folder" << llendl; + } + else + { + cats.put(favorites_cat); + } } const LLVector3 get_pos_local_from_global(const LLVector3d &pos_global) @@ -445,4 +681,4 @@ const LLVector3 get_pos_local_from_global(const LLVector3d &pos_global) LLVector3 pos_local(region_x, region_y, (F32)pos_global.mdV[VZ]); return pos_local; -} +} diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h index c100ace8cc..695c78cfba 100644 --- a/indra/newview/llpanelplaces.h +++ b/indra/newview/llpanelplaces.h @@ -47,6 +47,8 @@ class LLPanelPlacesTab; class LLFilterEditor; class LLTabContainer; +typedef std::pair<LLUUID, std::string> folder_pair_t; + class LLPanelPlaces : public LLPanel, LLInventoryObserver { public: @@ -69,6 +71,7 @@ private: //void onShareButtonClicked(); void onTeleportButtonClicked(); void onShowOnMapButtonClicked(); + void onCreateLandmarkButtonClicked(const LLUUID& folder_id); void onBackButtonClicked(); void toggleMediaPanel(); @@ -76,15 +79,19 @@ private: void onAgentParcelChange(); void updateVerbs(); + + void showLandmarkFoldersMenu(); LLFilterEditor* mFilterEditor; LLPanelPlacesTab* mActivePanel; LLTabContainer* mTabContainer; LLPanelPlaceInfo* mPlaceInfo; - //LLButton* mShareBtn; + LLButton* mCreateLandmarkBtn; + LLButton* mFolderMenuBtn; LLButton* mTeleportBtn; LLButton* mShowOnMapBtn; + LLButton* mShareBtn; LLButton* mOverflowBtn; // Pointer to a landmark item or to a linked landmark @@ -100,6 +107,20 @@ private: // Information type currently shown in Place Information panel std::string mPlaceInfoType; + + // Menu handle for pop-up menu to chose a landmark saving + // folder when creating a new landmark + LLHandle<LLView> mLandmarkFoldersMenuHandle; + + typedef std::vector<folder_pair_t> folder_vec_t; + + // List of folders to choose from when creating a landmark + folder_vec_t mLandmarkFoldersCache; + + // If root view width or height is changed + // the pop-up menu must be updated + S32 mRootViewWidth; + S32 mRootViewHeight; }; #endif //LL_LLPANELPLACES_H diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index deca08050b..f97105caa8 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -35,6 +35,8 @@ #include "lltabcontainer.h" #include "llpanelpicks.h" #include "llagent.h" +#include "llcommandhandler.h" +#include "llavataractions.h" static const std::string PANEL_PICKS = "panel_picks"; static const std::string PANEL_NOTES = "panel_notes"; @@ -44,6 +46,33 @@ static LLRegisterPanelClassWrapper<LLPanelAvatarProfile> t_panel_profile(PANEL_P static LLRegisterPanelClassWrapper<LLPanelPicks> t_panel_picks(PANEL_PICKS); +class LLAgentHandler : public LLCommandHandler +{ +public: + // requires trusted browser to trigger + LLAgentHandler() : LLCommandHandler("agent", true) { } + + bool handle(const LLSD& params, const LLSD& query_map, + LLWebBrowserCtrl* web) + { + if (params.size() < 2) return false; + LLUUID agent_id; + if (!agent_id.set(params[0], FALSE)) + { + return false; + } + + if (params[1].asString() == "about") + { + LLAvatarActions::showProfile(agent_id); + return true; + } + return false; + } +}; +LLAgentHandler gAgentHandler; + + LLPanelProfile::LLPanelProfile() : LLPanel(), mTabContainer(NULL) @@ -68,25 +97,6 @@ BOOL LLPanelProfile::postBuild() return TRUE; } -void LLPanelProfile::onOpen(const LLSD& key) -{ - //*NOTE LLUUID::null in this context means Agent related stuff - LLUUID id(key.has("id") ? key["id"].asUUID() : gAgentID); - if (key.has("open_tab_name")) - mTabContainer->selectTabByName(key["open_tab_name"]); - - if(id.notNull() && mAvatarId.notNull() && mAvatarId != id) - { - mTabs[PANEL_PROFILE]->clear(); - mTabs[PANEL_PICKS]->clear(); - mTabs[PANEL_NOTES]->clear(); - } - - mAvatarId = id; - - mTabContainer->getCurrentPanel()->onOpen(mAvatarId); -} - //*TODO redo panel toggling void LLPanelProfile::togglePanel(LLPanel* panel) { diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index e8aea849df..2f6d53a859 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -46,7 +46,7 @@ class LLPanelProfile : public LLPanel public: virtual BOOL postBuild(); - virtual void onOpen(const LLSD& key); + virtual void onOpen(const LLSD& key) {}; virtual void togglePanel(LLPanel*); diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp index 7d02c8ff0b..00254ee8ee 100644 --- a/indra/newview/llpanelprofileview.cpp +++ b/indra/newview/llpanelprofileview.cpp @@ -35,6 +35,7 @@ #include "llpanelavatar.h" #include "llpanelpicks.h" +#include "llsidetraypanelcontainer.h" #include "llpanelprofile.h" static LLRegisterPanelClassWrapper<LLPanelProfileView> t_panel_target_profile("panel_profile_view"); @@ -56,15 +57,23 @@ LLPanelProfileView::~LLPanelProfileView(void) /*virtual*/ void LLPanelProfileView::onOpen(const LLSD& key) { - LLPanelProfile::onOpen(key); - - //*NOTE profile view panel doesn't have own side tray tab and - //is usually opened over People side tray tab. By Back button - // Profile View panel just becomes invisible, see onBackBtnClick() - setVisible(TRUE); + LLUUID id = key["id"]; + if (key.has("open_tab_name")) + mTabContainer->selectTabByName(key["open_tab_name"]); + + if(id.notNull() && mAvatarId != id) + { + mAvatarId = id; + + mTabs[PANEL_PROFILE]->clear(); + mTabs[PANEL_PICKS]->clear(); + mTabs[PANEL_NOTES]->clear(); + } + + mTabContainer->getCurrentPanel()->onOpen(mAvatarId); std::string full_name; - gCacheName->getFullName(key["id"],full_name); + gCacheName->getFullName(mAvatarId,full_name); childSetValue("user_name",full_name); } @@ -85,5 +94,9 @@ BOOL LLPanelProfileView::postBuild() void LLPanelProfileView::onBackBtnClick() { - setVisible(FALSE); + LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent()); + if(parent) + { + parent->openPreviousPanel(); + } } diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index 9a987c8d7c..7faabbb28b 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -442,7 +442,7 @@ void LLPreview::handleReshape(const LLRect& new_rect, bool by_user) // LLMultiPreview::LLMultiPreview() - : LLMultiFloater() + : LLMultiFloater(LLSD()) { // *TODO: There should be a .xml file for this const LLRect& nextrect = LLFloaterReg::getFloaterRect("preview"); // place where the next preview should show up diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index c4037c94fe..6fe23e8aeb 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -69,6 +69,8 @@ void LLPreviewAnim::endAnimCallback( void *userdata ) // virtual BOOL LLPreviewAnim::postBuild() { + mCloseSignal.connect(boost::bind(&LLPreviewAnim::onClose, this)); + const LLInventoryItem* item = getItem(); if(item) { @@ -180,7 +182,7 @@ void LLPreviewAnim::auditionAnim( void *userdata ) } } -void LLPreviewAnim::onClose(bool app_quitting) +void LLPreviewAnim::onClose() { const LLInventoryItem *item = getItem(); @@ -198,5 +200,4 @@ void LLPreviewAnim::onClose(bool app_quitting) motion->setDeactivateCallback(NULL, (void *)NULL); } } - destroy(); } diff --git a/indra/newview/llpreviewanim.h b/indra/newview/llpreviewanim.h index ca42b7e731..d24e624c32 100644 --- a/indra/newview/llpreviewanim.h +++ b/indra/newview/llpreviewanim.h @@ -49,7 +49,7 @@ public: void activate(e_activation_type type); protected: - virtual void onClose(bool app_quitting); + void onClose(); LLAnimPauseRequest mPauseRequest; LLUUID mItemID; diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index ac08fd23a4..04827e3a78 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -260,11 +260,9 @@ BOOL LLPreviewGesture::canClose() } } -// virtual -void LLPreviewGesture::onClose(bool app_quitting) +void LLPreviewGesture::onClose() { - gGestureManager.stopGesture(mPreviewGesture); - LLPreview::onClose(app_quitting); + LLGestureManager::instance().stopGesture(mPreviewGesture); } // virtual @@ -273,18 +271,11 @@ void LLPreviewGesture::onUpdateSucceeded() refresh(); } -// virtual -void LLPreviewGesture::setMinimized(BOOL minimize) +void LLPreviewGesture::onVisibilityChange ( const LLSD& new_visibility ) { - if (minimize != isMinimized()) + if (new_visibility.asBoolean()) { - LLFloater::setMinimized(minimize); - - // We're being restored - if (!minimize) - { - refresh(); - } + refresh(); } } @@ -295,13 +286,13 @@ bool LLPreviewGesture::handleSaveChangesDialog(const LLSD& notification, const L switch(option) { case 0: // "Yes" - gGestureManager.stopGesture(mPreviewGesture); + LLGestureManager::instance().stopGesture(mPreviewGesture); mCloseAfterSave = TRUE; onClickSave(this); break; case 1: // "No" - gGestureManager.stopGesture(mPreviewGesture); + LLGestureManager::instance().stopGesture(mPreviewGesture); mDirty = FALSE; // Force the dirty flag because user has clicked NO on confirm save dialog... closeFloater(); break; @@ -363,6 +354,9 @@ LLPreviewGesture::~LLPreviewGesture() BOOL LLPreviewGesture::postBuild() { + mCloseSignal.connect(boost::bind(&LLPreviewGesture::onClose, this)); + mVisibleSignal.connect(boost::bind(&LLPreviewGesture::onVisibilityChange, this, _2)); + LLLineEditor* edit; LLComboBox* combo; LLButton* btn; @@ -778,7 +772,7 @@ void LLPreviewGesture::refresh() mOptionsText->setText(optionstext); - BOOL active = gGestureManager.isGestureActive(mItemUUID); + BOOL active = LLGestureManager::instance().isGestureActive(mItemUUID); mActiveCheck->set(active); // Can only preview if there are steps @@ -1130,10 +1124,10 @@ void LLPreviewGesture::saveIfNeeded() // If this gesture is active, then we need to update the in-memory // active map with the new pointer. - if (!delayedUpload && gGestureManager.isGestureActive(mItemUUID)) + if (!delayedUpload && LLGestureManager::instance().isGestureActive(mItemUUID)) { // gesture manager now owns the pointer - gGestureManager.replaceGesture(mItemUUID, gesture, asset_id); + LLGestureManager::instance().replaceGesture(mItemUUID, gesture, asset_id); // replaceGesture may deactivate other gestures so let the // inventory know. @@ -1694,13 +1688,13 @@ void LLPreviewGesture::onClickDelete(void* data) void LLPreviewGesture::onCommitActive(LLUICtrl* ctrl, void* data) { LLPreviewGesture* self = (LLPreviewGesture*)data; - if (!gGestureManager.isGestureActive(self->mItemUUID)) + if (!LLGestureManager::instance().isGestureActive(self->mItemUUID)) { - gGestureManager.activateGesture(self->mItemUUID); + LLGestureManager::instance().activateGesture(self->mItemUUID); } else { - gGestureManager.deactivateGesture(self->mItemUUID); + LLGestureManager::instance().deactivateGesture(self->mItemUUID); } // Make sure the (active) label in the inventory gets updated. @@ -1739,14 +1733,14 @@ void LLPreviewGesture::onClickPreview(void* data) self->mPreviewBtn->setLabel(self->getString("stop_txt")); // play it, and delete when done - gGestureManager.playGesture(self->mPreviewGesture); + LLGestureManager::instance().playGesture(self->mPreviewGesture); self->refresh(); } else { // Will call onDonePreview() below - gGestureManager.stopGesture(self->mPreviewGesture); + LLGestureManager::instance().stopGesture(self->mPreviewGesture); self->refresh(); } diff --git a/indra/newview/llpreviewgesture.h b/indra/newview/llpreviewgesture.h index d3e9c77789..16ac935775 100644 --- a/indra/newview/llpreviewgesture.h +++ b/indra/newview/llpreviewgesture.h @@ -70,8 +70,6 @@ public: // LLFloater /*virtual*/ BOOL canClose(); - /*virtual*/ void setMinimized(BOOL minimize); - /*virtual*/ void onClose(bool app_quitting); /*virtual*/ void onUpdateSucceeded(); /*virtual*/ void refresh(); @@ -109,7 +107,10 @@ protected: // Add a step. Pass the name of the step, like "Animation", // "Sound", "Chat", or "Wait" LLScrollListItem* addStep(const enum EStepType step_type); - + + void onClose(); + void onVisibilityChange ( const LLSD& new_visibility ); + static std::string getLabel(std::vector<std::string> labels); static void updateLabel(LLScrollListItem* item); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 7883b1ab06..ad978cc5b3 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -156,10 +156,10 @@ private: LLFloaterScriptSearch* LLFloaterScriptSearch::sInstance = NULL; LLFloaterScriptSearch::LLFloaterScriptSearch(LLScriptEdCore* editor_core) -: LLFloater(), +: LLFloater(LLSD()), mEditorCore(editor_core) { - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_search.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_script_search.xml", NULL); sInstance = this; @@ -640,8 +640,8 @@ void LLScriptEdCore::onBtnDynamicHelp() return; } - live_help_floater = new LLFloater(); - LLUICtrlFactory::getInstance()->buildFloater(live_help_floater, "floater_lsl_guide.xml"); + live_help_floater = new LLFloater(LLSD()); + LLUICtrlFactory::getInstance()->buildFloater(live_help_floater, "floater_lsl_guide.xml", NULL); LLFloater* parent = dynamic_cast<LLFloater*>(getParent()); parent->addDependentFloater(live_help_floater, TRUE); live_help_floater->childSetCommitCallback("lock_check", onCheckLock, this); diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 5dca12e06b..5ae79f6c63 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -59,6 +59,7 @@ LLScreenChannel::LLScreenChannel(): mUnreadToastsPanel(NULL), //TODO: load as a resource string mOverflowFormatString = "You have %d more notification"; + mToastList.clear(); setMouseOpaque( false ); } @@ -266,7 +267,7 @@ void LLScreenChannel::showToastsBottom() { mHiddenToastsNum++; } - createOverflowToast(bottom); + createOverflowToast(bottom, gSavedSettings.getS32("NotificationToastTime")); } } @@ -319,7 +320,7 @@ void LLScreenChannel::createOverflowToast(S32 bottom, F32 timer) mUnreadToastsPanel->reshape(getRect().getWidth(), toast_rect.getHeight(), true); toast_rect.setLeftTopAndSize(getRect().mLeft, bottom + toast_rect.getHeight()+gSavedSettings.getS32("ToastMargin"), getRect().getWidth(), toast_rect.getHeight()); mUnreadToastsPanel->setRect(toast_rect); - mUnreadToastsPanel->setAndStartTimer(timer ? timer : gSavedSettings.getS32("NotificationToastTime")); + mUnreadToastsPanel->setAndStartTimer(timer); getRootView()->addChild(mUnreadToastsPanel); text_box->setValue(text); @@ -337,14 +338,19 @@ void LLScreenChannel::onOverflowToastHide() } //-------------------------------------------------------------------------- -void LLScreenChannel::hideToastsFromScreen() +void LLScreenChannel::closeUnreadToastsPanel() { - if(mUnreadToastsPanel) + if(mUnreadToastsPanel != NULL) { mUnreadToastsPanel->close(); - delete mUnreadToastsPanel; mUnreadToastsPanel = NULL; } +} + +//-------------------------------------------------------------------------- +void LLScreenChannel::hideToastsFromScreen() +{ + closeUnreadToastsPanel(); for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++) (*it).toast->setVisible(FALSE); } diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index f05c205e2a..a205b913ab 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -73,6 +73,7 @@ public: void setHovering(bool hovering) { mIsHovering = hovering; } void removeToastsFromChannel(); + void closeUnreadToastsPanel(); void hideToastsFromScreen(); void setStoreToasts(bool store) { mStoreToasts = store; } @@ -125,7 +126,7 @@ private: void showToastsCentre(); void showToastsTop(); - void createOverflowToast(S32 bottom, F32 timer = 0); + void createOverflowToast(S32 bottom, F32 timer); void onOverflowToastHide(); static bool mWasStartUpToastShown; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index c24b3f0d04..5984af5df4 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -4452,8 +4452,7 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use // the reporter widget askes the server for info about picked objects if (request_flags & COMPLAINT_REPORT_REQUEST ) { - EReportType report_type = COMPLAINT_REPORT ; - LLFloaterReporter *reporterp = LLFloaterReporter::getReporter(report_type); + LLFloaterReporter *reporterp = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter"); if (reporterp) { std::string fullname; @@ -5405,6 +5404,7 @@ void dialog_refresh_all() } LLFloaterProperties::dirtyAll(); + LLFloaterInspect* inspect_instance = LLFloaterReg::getTypedInstance<LLFloaterInspect>("inspect"); if(inspect_instance) { diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 2688399139..5f0fbe6ee5 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -44,6 +44,7 @@ #include "llfloater.h" //for gFloaterView #include "lliconctrl.h"//for Home tab icon +#include "llsidetraypanelcontainer.h" #include "llwindow.h"//for SetCursor //#include "llscrollcontainer.h" @@ -609,9 +610,22 @@ LLPanel* LLSideTray::showPanel (const std::string& panel_name, const LLSD& para if(view) { onTabButtonClick((*child_it)->getName()); + + LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent()); + if(container) + { + LLSD new_params = params; + new_params[LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME] = panel_name; + container->onOpen(new_params); + + return container->getCurrentPanel(); + } + LLPanel* panel = dynamic_cast<LLPanel*>(view); if(panel) + { panel->onOpen(params); + } return panel; } } diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h index 99e84f8141..1f8b6b402f 100644 --- a/indra/newview/llsidetray.h +++ b/indra/newview/llsidetray.h @@ -163,6 +163,7 @@ public: /** * Activate tab with "panel_name" panel * if no such tab - return NULL, otherwise a pointer to the panel + * Pass params as array, or they may be overwritten(example - params["name"]="nearby") */ LLPanel* showPanel (const std::string& panel_name, const LLSD& params); diff --git a/indra/newview/llsidetraypanelcontainer.cpp b/indra/newview/llsidetraypanelcontainer.cpp new file mode 100644 index 0000000000..21061a802a --- /dev/null +++ b/indra/newview/llsidetraypanelcontainer.cpp @@ -0,0 +1,89 @@ +/** +* @file llsidetraypanelcontainer.cpp +* @brief LLSideTrayPanelContainer implementation +* +* $LicenseInfo:firstyear=2001&license=viewergpl$ +* +* Copyright (c) 2001-2009, Linden Research, Inc. +* +* Second Life Viewer Source Code +* The source code in this file ("Source Code") is provided by Linden Lab +* to you under the terms of the GNU General Public License, version 2.0 +* ("GPL"), unless you have obtained a separate licensing agreement +* ("Other License"), formally executed by you and Linden Lab. Terms of +* the GPL can be found in doc/GPL-license.txt in this distribution, or +* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at +* http://secondlifegrid.net/programs/open_source/licensing/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" +#include "llsidetraypanelcontainer.h" + +static LLDefaultChildRegistry::Register<LLSideTrayPanelContainer> r2("panel_container"); + +std::string LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME = "sub_panel_name"; + +LLSideTrayPanelContainer::Params::Params() +{ + // Always hide tabs. + hide_tabs(true); +} + +LLSideTrayPanelContainer::LLSideTrayPanelContainer(const Params& p) + : LLTabContainer(p) +{ +} + +void LLSideTrayPanelContainer::onOpen(const LLSD& key) +{ + // Select specified panel and save navigation history. + if(key.has(PARAM_SUB_PANEL_NAME)) + { + // Save panel navigation history + std::string panel_name = key[PARAM_SUB_PANEL_NAME]; + S32 old_index = getCurrentPanelIndex(); + + selectTabByName(panel_name); + + S32 new_index = getCurrentPanelIndex(); + + // Don't update navigation history if we are opening same panel again. + if(old_index != new_index) + { + mPanelHistory[panel_name] = old_index; + } + } + // Will reopen current panel if no panel name was passed. + getCurrentPanel()->onOpen(key); +} + +void LLSideTrayPanelContainer::openPreviousPanel() +{ + std::string current_panel_name = getCurrentPanel()->getName(); + panel_navigation_history_t::const_iterator it = mPanelHistory.find(current_panel_name); + if(mPanelHistory.end() != it) + { + selectTab(it->second); + } +} + +BOOL LLSideTrayPanelContainer::handleKeyHere(KEY key, MASK mask) +{ + // No key press handling code for Panel Container - this disables + // Tab Container's Alt + Left/Right Button tab switching. + return TRUE; +} diff --git a/indra/newview/llsidetraypanelcontainer.h b/indra/newview/llsidetraypanelcontainer.h new file mode 100644 index 0000000000..3f3cb552f8 --- /dev/null +++ b/indra/newview/llsidetraypanelcontainer.h @@ -0,0 +1,95 @@ +/** +* @file llsidetraypanelcontainer.h +* @brief LLSideTrayPanelContainer class declaration +* +* $LicenseInfo:firstyear=2009&license=viewergpl$ +* +* Copyright (c) 2009, Linden Research, Inc. +* +* Second Life Viewer Source Code +* The source code in this file ("Source Code") is provided by Linden Lab +* to you under the terms of the GNU General Public License, version 2.0 +* ("GPL"), unless you have obtained a separate licensing agreement +* ("Other License"), formally executed by you and Linden Lab. Terms of +* the GPL can be found in doc/GPL-license.txt in this distribution, or +* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at +* http://secondlifegrid.net/programs/open_source/licensing/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ + +#ifndef LL_LLSIDETRAY_PANEL_CONTAINER_H +#define LL_LLSIDETRAY_PANEL_CONTAINER_H + +#include "lltabcontainer.h" + +/** +* LLSideTrayPanelContainer class acts like LLTabContainer with invisible tabs. +* It is designed to make panel switching easier, avoid setVisible(TRUE) setVisible(FALSE) +* calls and related workarounds. +* use onOpen to open sub panel, pass the name of panel to open +* in key[PARAM_SUB_PANEL_NAME]. +* LLSideTrayPanelContainer also implements panel navigation history - it allows to +* open previous or next panel if navigation history is available(after user +* has opened two or more panels). *NOTE - only back navigation is implemented so far. +*/ +class LLSideTrayPanelContainer : public LLTabContainer +{ +public: + + struct Params : public LLInitParam::Block<Params, LLTabContainer::Params> + { + Params(); + }; + + /** + * Opens sub panel + * @param key - params to be passed to panel, use key[PARAM_SUB_PANEL_NAME] + * to specify panel name to be opened. + */ + /*virtual*/ void onOpen(const LLSD& key); + + /** + * Opens previous panel from panel navigation history. + */ + void openPreviousPanel(); + + /** + * Overrides LLTabContainer::handleKeyHere to disable panel switch on + * Alt + Left/Right button press. + */ + BOOL handleKeyHere(KEY key, MASK mask); + + /** + * Name of parameter that stores panel name to open. + */ + static std::string PARAM_SUB_PANEL_NAME; + +protected: + LLSideTrayPanelContainer(const Params& p); + friend class LLUICtrlFactory; + + /** + * std::string - name of panel + * S32 - index of previous panel + * *NOTE - no forward navigation implemented yet + */ + typedef std::map<std::string, S32> panel_navigation_history_t; + + // Navigation history + panel_navigation_history_t mPanelHistory; +}; + +#endif //LL_LLSIDETRAY_PANEL_CONTAINER_H diff --git a/indra/newview/llsplitbutton.cpp b/indra/newview/llsplitbutton.cpp new file mode 100644 index 0000000000..ffd9bc7624 --- /dev/null +++ b/indra/newview/llsplitbutton.cpp @@ -0,0 +1,275 @@ +/** + * @file llsplitbutton.cpp + * @brief LLSplitButton base class + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +// A control that consolidates several buttons as options + +#include "llviewerprecompiledheaders.h" + +#include "llsplitbutton.h" + +#include "llinitparam.h" +#include "llpanel.h" +#include "llfocusmgr.h" +#include "llviewerwindow.h" +#include "llrootview.h" + + +S32 BUTTON_PAD = 2; //pad between buttons on an items panel + + +static LLDefaultChildRegistry::Register<LLSplitButton> split_button("split_button"); + +void LLSplitButton::ArrowPositionValues::declareValues() +{ + declare("left", LEFT); + declare("right", RIGHT); +} + +LLSplitButton::ItemParams::ItemParams() +{ +} + +LLSplitButton::Params::Params() +: arrow_position("arrow_position", LEFT), + items("item"), + arrow_button("arrow_button"), + items_panel("items_panel") +{ +} + + +void LLSplitButton::onFocusLost() +{ + hideButtons(); + LLUICtrl::onFocusLost(); +} + +void LLSplitButton::setFocus(BOOL b) +{ + LLUICtrl::setFocus(b); + + if (b) + { + if (mItemsPanel && mItemsPanel->getVisible()) + { + mItemsPanel->setFocus(TRUE); + } + } +} + +void LLSplitButton::setEnabled(BOOL enabled) +{ + LLView::setEnabled(enabled); + mArrowBtn->setEnabled(enabled); +} + + +void LLSplitButton::onArrowBtnDown() +{ + if (!mItemsPanel->getVisible()) + { + showButtons(); + + setFocus(TRUE); + + if (mArrowBtn->hasMouseCapture() || mShownItem->hasMouseCapture()) + { + gFocusMgr.setMouseCapture(this); + } + } + else + { + hideButtons(); + } +} + +void LLSplitButton::onHeldDownShownButton() +{ + if (!mItemsPanel->getVisible()) onArrowBtnDown(); +} + +void LLSplitButton::onItemSelected(LLUICtrl* ctrl) +{ + if (!ctrl) return; + + hideButtons(); + + // call the callback if it exists + if(!mSelectionCallback.empty()) + { + mSelectionCallback(this, ctrl->getName()); + } + + gFocusMgr.setKeyboardFocus(NULL); +} + +BOOL LLSplitButton::handleMouseUp(S32 x, S32 y, MASK mask) +{ + gFocusMgr.setMouseCapture(NULL); + + if (mShownItem->parentPointInView(x, y)) + { + onItemSelected(mShownItem); + return TRUE; + } + + for (std::list<LLButton*>::const_iterator it = mHidenItems.begin(); it != mHidenItems.end(); ++it) + { + LLButton* item = *it; + + S32 panel_x = 0; + S32 panel_y = 0; + localPointToOtherView(x, y, &panel_x, &panel_y, mItemsPanel); + + if (item->parentPointInView(panel_x, panel_y)) + { + onItemSelected(item); + return TRUE; + } + } + return TRUE; +} + +void LLSplitButton::showButtons() +{ + mItemsPanel->setOrigin(0, getRect().getHeight()); + + // register ourselves as a "top" control + // effectively putting us into a special draw layer + gFocusMgr.setTopCtrl(this); + + mItemsPanel->setFocus(TRUE); + + //push arrow button down and show the item buttons + mArrowBtn->setToggleState(TRUE); + mItemsPanel->setVisible(TRUE); + + setUseBoundingRect(TRUE); +} + +void LLSplitButton::hideButtons() +{ + mItemsPanel->setVisible(FALSE); + mArrowBtn->setToggleState(FALSE); + + setUseBoundingRect(FALSE); + if(gFocusMgr.getTopCtrl() == this) + { + gFocusMgr.setTopCtrl(NULL); + } +} + + +// protected/private + +LLSplitButton::LLSplitButton(const LLSplitButton::Params& p) +: LLUICtrl(p), + mArrowBtn(NULL), + mShownItem(NULL), + mItemsPanel(NULL), + mArrowPosition(p.arrow_position) +{ + LLRect rc(p.rect); + + LLButton::Params arrow_params = p.arrow_button; + S32 arrow_width = p.arrow_button.rect.width; + + //Default arrow rect values for LEFT arrow position + S32 arrow_left = 0; + S32 arrow_right = arrow_width; + S32 btn_left = arrow_width; + S32 btn_right = rc.getWidth(); + + if (mArrowPosition == RIGHT) + { + arrow_left = rc.getWidth()- arrow_width; + arrow_right = rc.getWidth(); + btn_left = 0; + btn_right = arrow_left; + } + + arrow_params.rect(LLRect(arrow_left, rc.getHeight(), arrow_right, 0)); + arrow_params.label(""); + arrow_params.mouse_down_callback.function(boost::bind(&LLSplitButton::onArrowBtnDown, this)); + mArrowBtn = LLUICtrlFactory::create<LLButton>(arrow_params); + addChild(mArrowBtn); + + //a panel for hidden item buttons + LLPanel::Params panel_params = p.items_panel; + mItemsPanel= prepareItemsPanel(panel_params, p.items.numValidElements()); + addChild(mItemsPanel); + + + LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items().begin(); + + //processing shown item button + mShownItem = prepareItemButton(*it); + mShownItem->setHeldDownCallback(boost::bind(&LLSplitButton::onHeldDownShownButton, this)); + mShownItem->setMouseUpCallback(boost::bind(&LLSplitButton::onItemSelected, this, _1)); + mShownItem->setRect(LLRect(btn_left, rc.getHeight(), btn_right, 0)); + addChild(mShownItem); + + //processing hidden item buttons + S32 item_top = mItemsPanel->getRect().getHeight(); + for (++it; it != p.items().end(); ++it) + { + LLButton* hidden_button = prepareItemButton(*it); + hidden_button->setRect(LLRect(btn_left, item_top, btn_right, item_top - rc.getHeight())); + hidden_button->setMouseDownCallback(boost::bind(&LLSplitButton::onItemSelected, this, _1)); + mHidenItems.push_back(hidden_button); + mItemsPanel->addChild(hidden_button); + + //calculate next button's top + item_top -= (rc.getHeight() + BUTTON_PAD); + } + + setTopLostCallback(boost::bind(&LLSplitButton::hideButtons, this)); +} + + +LLButton* LLSplitButton::prepareItemButton(LLButton::Params params) +{ + params.label(""); + params.is_toggle(false); + return LLUICtrlFactory::create<LLButton>(params); +} + +LLPanel* LLSplitButton::prepareItemsPanel(LLPanel::Params params, S32 items_count) +{ + S32 num_hiden_btns = items_count - 1; + S32 panel_height = num_hiden_btns * (getRect().getHeight() + BUTTON_PAD); + params.visible(false); + params.rect.width(getRect().getWidth()); + params.rect.height(panel_height); + return LLUICtrlFactory::create<LLPanel>(params); +} + diff --git a/indra/newview/llsplitbutton.h b/indra/newview/llsplitbutton.h new file mode 100644 index 0000000000..0fb5f6594e --- /dev/null +++ b/indra/newview/llsplitbutton.h @@ -0,0 +1,112 @@ +/** + * @file llsplitbutton.h + * @brief LLSplitButton base class + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +// A control that displays the name of the chosen item, which when clicked +// shows a scrolling box of choices. + + +#include "llbutton.h" +#include "llpanel.h" +#include "lluictrl.h" + + +#ifndef LL_LLSPLITBUTTON_H +#define LL_LLSPLITBUTTON_H + +class LLSplitButton + : public LLUICtrl +{ +public: + typedef enum e_arrow_position + { + LEFT, + RIGHT + } EArrowPosition; + + struct ArrowPositionValues : public LLInitParam::TypeValuesHelper<EArrowPosition, ArrowPositionValues> + { + static void declareValues(); + }; + + struct ItemParams : public LLInitParam::Block<ItemParams, LLButton::Params> + { + ItemParams(); + }; + + struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> + { + Optional<EArrowPosition, ArrowPositionValues> arrow_position; + Optional<LLButton::Params> arrow_button; + Optional<LLPanel::Params> items_panel; + Multiple<ItemParams> items; + + Params(); + }; + + + virtual ~LLSplitButton() {}; + + //Overridden + virtual void onFocusLost(); + virtual void setFocus(BOOL b); + virtual void setEnabled(BOOL enabled); + + //Callbacks + void onArrowBtnDown(); + void onHeldDownShownButton(); + void onItemSelected(LLUICtrl* ctrl); + void setSelectionCallback(commit_callback_t cb) { mSelectionCallback = cb; } + + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + + virtual void showButtons(); + virtual void hideButtons(); + + +protected: + friend class LLUICtrlFactory; + LLSplitButton(const LLSplitButton::Params& p); + + LLButton* prepareItemButton(LLButton::Params params); + LLPanel* prepareItemsPanel(LLPanel::Params params, S32 items_count); + + LLPanel* mItemsPanel; + std::list<LLButton*> mHidenItems; + LLButton* mArrowBtn; + LLButton* mShownItem; + EArrowPosition mArrowPosition; + + commit_callback_t mSelectionCallback; +}; + + +#endif diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index cc933fbf1e..a2e879d24d 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -297,8 +297,11 @@ public: virtual void done() { // we've downloaded all the items, so repaint the dialog - LLFloaterGesture::refreshAll(); - + LLFloaterGesture* floater = LLFloaterReg::findTypedInstance<LLFloaterGesture>("gestures"); + if (floater) + { + floater->refreshAll(); + } gInventory.removeObserver(this); delete this; } @@ -1217,13 +1220,6 @@ bool idle_startup() } gLoginMenuBarView->setVisible( FALSE ); gLoginMenuBarView->setEnabled( FALSE ); - - LLFloaterReg::showInitialVisibleInstances(); - - if (gSavedSettings.getBOOL("BeaconAlwaysOn")) - { - LLFloaterReg::showInstance("beacons"); - } if (!gNoRender) { @@ -1667,6 +1663,7 @@ bool idle_startup() // We're successfully logged in. gSavedSettings.setBOOL("FirstLoginThisInstall", FALSE); + LLFloaterReg::showInitialVisibleInstances(); // based on the comments, we've successfully logged in so we can delete the 'forced' // URL that the updater set in settings.ini (in a mostly paranoid fashion) @@ -1709,7 +1706,7 @@ bool idle_startup() // Could schedule and delay these for later. const BOOL no_inform_server = FALSE; const BOOL no_deactivate_similar = FALSE; - gGestureManager.activateGestureWithAsset(item_id, asset_id, + LLGestureManager::instance().activateGestureWithAsset(item_id, asset_id, no_inform_server, no_deactivate_similar); // We need to fetch the inventory items for these gestures diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index d792b972bb..3c7a8d757b 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -110,7 +110,6 @@ public: virtual BOOL handleKeyHere(KEY key, MASK mask); // LLFloater overrides - virtual void onClose(bool app_quitting); virtual BOOL postBuild(); // New functions @@ -131,6 +130,7 @@ public: void commitIfImmediateSet(); void onFilterEdit(const std::string& search_string ); + void onClose(); static void onBtnSetToDefault( void* userdata ); static void onBtnSelect( void* userdata ); @@ -181,7 +181,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( PermissionMask non_immediate_filter_perm_mask, BOOL can_apply_immediately, const std::string& fallback_image_name) -: LLFloater(), +: LLFloater(LLSD()), mOwner( owner ), mImageAssetID( owner->getImageAssetID() ), mFallbackImageName( fallback_image_name ), @@ -197,7 +197,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mContextConeOpacity(0.f) { mCanApplyImmediately = can_apply_immediately; - LLUICtrlFactory::getInstance()->buildFloater(this,"floater_texture_ctrl.xml"); + LLUICtrlFactory::getInstance()->buildFloater(this,"floater_texture_ctrl.xml",NULL); setCanMinimize(FALSE); } @@ -369,20 +369,20 @@ BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask) return LLFloater::handleKeyHere(key, mask); } -// virtual -void LLFloaterTexturePicker::onClose(bool app_quitting) +void LLFloaterTexturePicker::onClose() { if (mOwner) { mOwner->onFloaterClose(); } stopUsingPipette(); - destroy(); } // virtual BOOL LLFloaterTexturePicker::postBuild() { + mCloseSignal.connect(boost::bind(&LLFloaterTexturePicker::onClose, this)); + LLFloater::postBuild(); if (!mLabel.empty()) @@ -523,9 +523,6 @@ void LLFloaterTexturePicker::draw() childSetEnabled("Pipette", mActive); childSetValue("Pipette", LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); - //RN: reset search bar to reflect actual search query (all caps, for example) - mFilterEdit->setText(mInventoryPanel->getFilterSubString()); - //BOOL allow_copy = FALSE; if( mOwner ) { diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index 6f5b25214e..8a7c7708b9 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -36,19 +36,21 @@ #include "llbutton.h" #include "llfocusmgr.h" +#include "llviewercontrol.h" using namespace LLNotificationsUI; //-------------------------------------------------------------------------- LLToast::LLToast(LLPanel* panel) : - LLFloater(), + LLFloater(LLSD()), mTimerValue(5), mIsViewed(false), mPanel(panel), mCanFade(true), mHideBtn(NULL), mIsModal(false), - mCanBeStored(true) + mCanBeStored(true), + mHideBtnPressed(false) { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_toast.xml"); @@ -104,8 +106,7 @@ bool LLToast::timerHasExpired() if (mTimer.getStarted()) { F32 elapsed_time = mTimer.getElapsedTimeF32(); - // after 4 seconds a toast should start fade - if (elapsed_time > 4) + if (elapsed_time > gSavedSettings.getS32("ToastOpaqueTime")) { setBackgroundOpaque(FALSE); } @@ -218,6 +219,7 @@ void LLToast::onMouseEnter(S32 x, S32 y, MASK mask) //-------------------------------------------------------------------------- void LLToast::onMouseLeave(S32 x, S32 y, MASK mask) { + llinfos << "MOUSE LEAVE: x = " << x << "y = " << y << llendl; mOnToastHover(this, MOUSE_LEAVE); if(mCanFade && !mIsViewed) @@ -226,14 +228,26 @@ void LLToast::onMouseLeave(S32 x, S32 y, MASK mask) } if(mHideBtn && mHideBtn->getEnabled()) { - if( mHideBtn->getRect().pointInRect(x, y) ) + if( mHideBtnPressed ) + { + mHideBtnPressed = false; return; - mHideBtn->setVisible(FALSE); + } + mHideBtn->setVisible(FALSE); } } //-------------------------------------------------------------------------- +BOOL LLToast::handleMouseDown(S32 x, S32 y, MASK mask) +{ + if(mHideBtn && mHideBtn->getEnabled()) + { + mHideBtnPressed = mHideBtn->getRect().pointInRect(x, y); + } + + return LLFloater::handleMouseDown(x, y, mask); +} diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index 018664f3d1..f998754585 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -55,6 +55,7 @@ public: LLToast(LLPanel* panel); virtual ~LLToast(); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); // bool isViewed() { return mIsViewed; } @@ -109,6 +110,7 @@ private: bool mCanFade; bool mIsModal; bool mCanBeStored; + bool mHideBtnPressed; }; } diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp index afaa01a77a..5d67015526 100644 --- a/indra/newview/lltoastalertpanel.cpp +++ b/indra/newview/lltoastalertpanel.cpp @@ -66,7 +66,8 @@ static const S32 HPAD = 25; static const S32 BTN_HPAD = 8; LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal) - : LLToastPanel(notification), + : LLFloater(LLSD()), + LLToastPanel(notification), mDefaultOption( 0 ), mCheck(NULL), mCaution(notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH), @@ -359,11 +360,6 @@ void LLToastAlertPanel::setVisible( BOOL visible ) } } -void LLToastAlertPanel::onClose(bool app_quitting) -{ - LLFloater::onClose(app_quitting); -} - LLToastAlertPanel::~LLToastAlertPanel() { } diff --git a/indra/newview/lltoastalertpanel.h b/indra/newview/lltoastalertpanel.h index f714630c77..543c14d404 100644 --- a/indra/newview/lltoastalertpanel.h +++ b/indra/newview/lltoastalertpanel.h @@ -78,7 +78,6 @@ public: virtual void draw(); virtual void setVisible( BOOL visible ); - virtual void onClose(bool app_quitting); bool setCheckBox( const std::string&, const std::string& ); void setCaution(BOOL val = TRUE) { mCaution = val; } diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp index 477e452907..5478e0005a 100644 --- a/indra/newview/lltoolbar.cpp +++ b/indra/newview/lltoolbar.cpp @@ -253,7 +253,7 @@ void LLToolBar::refresh() BOOL sitting = FALSE; if (gAgent.getAvatarObject()) { - sitting = gAgent.getAvatarObject()->mIsSitting; + sitting = gAgent.getAvatarObject()->isSitting(); } if (!gAgent.canFly()) diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 72812d0bb9..70fa2f715b 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -2463,7 +2463,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture( } else { - gGestureManager.activateGesture(item->getUUID()); + LLGestureManager::instance().activateGesture(item->getUUID()); gInventory.updateItem(item); gInventory.notifyObservers(); } diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index ee6e36518f..297cf2c667 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -56,6 +56,8 @@ #include "llviewerwindow.h" #include "llvoavatarself.h" #include "llmorphview.h" +#include "llfloaterreg.h" +#include "llfloatercamera.h" // Globals BOOL gCameraBtnZoom = TRUE; @@ -254,7 +256,11 @@ void LLToolCamera::releaseMouse() gViewerWindow->showCursor(); - LLToolMgr::getInstance()->clearTransientTool(); + //for the situation when left click was performed on the Agent + if (!LLFloaterCamera::inFreeCameraMode()) + { + LLToolMgr::getInstance()->clearTransientTool(); + } mMouseSteering = FALSE; mValidClickPoint = FALSE; diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 350657538b..fab336f17d 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -42,7 +42,6 @@ #include "llagent.h" #include "llviewercontrol.h" #include "llfirstuse.h" -#include "llfloateravatarinfo.h" #include "llfloaterland.h" #include "llfloaterreg.h" #include "llfloaterscriptdebug.h" @@ -190,7 +189,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback() // touch behavior down below... break; case CLICK_ACTION_SIT: - if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting)) // agent not already sitting + if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // agent not already sitting { handle_sit_or_stand(); return TRUE; @@ -362,7 +361,7 @@ ECursorType cursor_from_object(LLViewerObject* object) switch(click_action) { case CLICK_ACTION_SIT: - if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting)) // not already sitting? + if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // not already sitting? { cursor = UI_CURSOR_TOOLSIT; } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 5c38be86d5..9c29131def 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -40,45 +40,74 @@ #include "llcompilequeue.h" #include "llfloaterabout.h" #include "llfloateractivespeakers.h" -#include "llfloaterauction.h" #include "llfloateraddlandmark.h" -#include "llfloateravatarinfo.h" +#include "llfloateranimpreview.h" +#include "llfloaterauction.h" +#include "llfloateravatarpicker.h" +#include "llfloateravatartextures.h" #include "llfloaterbeacons.h" -#include "llfloaterbulkpermission.h" #include "llfloaterbuildoptions.h" +#include "llfloaterbuy.h" +#include "llfloaterbuycontents.h" +#include "llfloaterbuycurrency.h" +#include "llfloaterbuyland.h" +#include "llfloaterbulkpermission.h" #include "llfloaterbump.h" +#include "llfloatercall.h" #include "llfloatercamera.h" #include "llfloaterchat.h" #include "llfloaterchatterbox.h" +#include "llfloaterdaycycle.h" #include "llfloaterdirectory.h" +#include "llfloaterfirsttimetip.h" +#include "llfloaterenvsettings.h" #include "llfloaterfonttest.h" +#include "llfloatergesture.h" #include "llfloatergodtools.h" +#include "llfloatergroupinfo.h" +#include "llfloatergroups.h" +#include "llfloaterhardwaresettings.h" #include "llfloaterhtmlcurrency.h" #include "llfloaterhtmlhelp.h" #include "llfloaterhud.h" +#include "llfloaterimagepreview.h" +#include "llimpanel.h" #include "llfloaterinspect.h" +#include "llfloaterinventory.h" #include "llfloaterjoystick.h" -#include "llfloaternotificationsconsole.h" #include "llfloaterlagmeter.h" #include "llfloaterland.h" +#include "llfloaterlandholdings.h" #include "llfloatermap.h" #include "llfloatermemleak.h" #include "llfloatermute.h" -#include "llfloaterobjectiminfo.h" +#include "llfloaternamedesc.h" +#include "llfloaternotificationsconsole.h" #include "llfloateropenobject.h" +#include "llgivemoney.h" +#include "llfloaterparcel.h" #include "llfloaterperms.h" +#include "llfloaterpostcard.h" +#include "llfloaterpostprocess.h" #include "llfloaterpreference.h" +#include "llfloaterproperties.h" #include "llfloaterregioninfo.h" -#include "llfloatersnapshot.h" +#include "llfloaterreporter.h" +#include "llfloaterscriptdebug.h" +#include "llfloatersellland.h" #include "llfloatersettingsdebug.h" +#include "llfloatersnapshot.h" +#include "llfloatertelehub.h" #include "llfloatertestlistview.h" -#include "llfloatertopobjects.h" #include "llfloatertools.h" +#include "llfloatertos.h" +#include "llfloatertopobjects.h" #include "llfloateruipreview.h" #include "llfloaterurldisplay.h" #include "llfloatervoicedevicesettings.h" +#include "llfloaterwater.h" +#include "llfloaterwindlight.h" #include "llfloaterworldmap.h" -#include "llfloaterinventory.h" #include "llmediaremotectrl.h" #include "llmoveview.h" #include "llnearbychat.h" @@ -96,13 +125,21 @@ void LLViewerFloaterReg::registerFloaters() { + // *NOTE: Please keep these alphabetized for easier merges + LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLand>); LLFloaterReg::add("active_speakers", "floater_active_speakers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterActiveSpeakers>); LLFloaterReg::add("add_landmark", "floater_add_landmark.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAddLandmark>); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAuction>); + LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarPicker>); + LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarTextures>); LLFloaterReg::add("beacons", "floater_beacons.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBeacons>); LLFloaterReg::add("bulk_perms", "floater_bulk_perms.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBulkPermission>); + LLFloaterReg::add("buy_currency", "floater_buy_currency.xml", &LLFloaterBuyCurrency::buildFloater); + LLFloaterReg::add("buy_land", "floater_buy_land.xml", &LLFloaterBuyLand::buildFloater); + LLFloaterReg::add("buy_object", "floater_buy_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuy>); + LLFloaterReg::add("buy_object_contents", "floater_buy_contents.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuyContents>); LLFloaterReg::add("build", "floater_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTools>); LLFloaterReg::add("build_options", "floater_build_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuildOptions>); LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBump>); @@ -114,23 +151,37 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCompileQueue>); LLFloaterReg::add("contacts", "floater_my_friends.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMyFriends>); + LLFloaterReg::add("first_time_tip", "floater_first_time_tip.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFirstTimeTip>); + LLFloaterReg::add("env_day_cycle", "floater_day_cycle_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDayCycle>); + LLFloaterReg::add("env_post_process", "floater_post_process.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPostProcess>); + LLFloaterReg::add("env_settings", "floater_env_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterEnvSettings>); + LLFloaterReg::add("env_water", "floater_water.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWater>); + LLFloaterReg::add("env_windlight", "floater_windlight_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWindLight>); + LLFloaterReg::add("font_test", "floater_font_test.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterFontTest>); + LLFloaterReg::add("gestures", "floater_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGesture>); LLFloaterReg::add("god_tools", "floater_god_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGodTools>); + LLFloaterReg::add("group_info", "floater_groupinfo.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGroupInfo>); + LLFloaterReg::add("group_picker", "floater_choose_group.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterGroupPicker>); - LLFloaterReg::add("html_currency", "floater_html_simple.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHtmlCurrency>); LLFloaterReg::add("hud", "floater_hud.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHUD>); - + LLFloaterReg::add("html_simple", "floater_html_simple.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHtmlSimple>); + + LLFloaterReg::add("impanel", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIMFloater>); LLFloaterReg::add("inventory", "floater_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInventory>); LLFloaterReg::add("inspect", "floater_inspect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInspect>); LLFloaterReg::add("lagmeter", "floater_lagmeter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLagMeter>); + LLFloaterReg::add("land_holdings", "floater_land_holdings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLandHoldings>); LLFloaterReg::add("mem_leaking", "floater_mem_leaking.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMemLeak>); - LLFloaterReg::add("me_profile", "floater_me.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarInfo>); LLFloaterReg::add("media_browser", "floater_media_browser.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMediaBrowser>); + LLFloaterReg::add("message_critical", "floater_critical.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTOS>); + LLFloaterReg::add("message_tos", "floater_tos.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTOS>); LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMove>); LLFloaterReg::add("mute", "floater_mute.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMute>); + LLFloaterReg::add("mute_object", "floater_mute_object.xml", &LLFloaterMute::buildFloaterMuteObjectUI); LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMap>); LLFloaterReg::add("mini_inspector", "panel_mini_inspector.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMiniInspector>); @@ -138,13 +189,18 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("nearby_chat", "floater_nearby_chat.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLNearbyChat>); LLFloaterReg::add("openobject", "floater_openobject.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterOpenObject>); + + LLFloaterReg::add("parcel_info", "floater_preview_url.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterParcelInfo>); + LLFloaterReg::add("pay_resident", "floater_pay.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPay>); + LLFloaterReg::add("pay_object", "floater_pay_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPay>); + LLFloaterReg::add("postcard", "floater_postcard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPostcard>); LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>); + LLFloaterReg::add("prefs_hardware_settings", "floater_hardware_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHardwareSettings>); LLFloaterReg::add("perm_prefs", "floater_perm_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPerms>); LLFloaterReg::add("preview_url", "floater_preview_url.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterURLDisplay>); LLFloaterReg::add("pref_joystick", "floater_joystick.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterJoystick>); LLFloaterReg::add("pref_voicedevicesettings", "floater_device_settings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterVoiceDeviceSettings>); - LLFloaterReg::add("preview_avatar", "floater_profile.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarInfo>); LLFloaterReg::add("preview_anim", "floater_preview_animation.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewAnim>, "preview"); LLFloaterReg::add("preview_gesture", "floater_preview_gesture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewGesture>, "preview"); LLFloaterReg::add("preview_landmark", "floater_preview_existing_landmark.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewLandmark>, "preview"); @@ -153,15 +209,21 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("preview_scriptedit", "floater_live_lsleditor.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLLiveLSLEditor>, "preview"); LLFloaterReg::add("preview_sound", "floater_preview_sound.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewSound>, "preview"); LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLPreviewTexture>, "preview"); - + LLFloaterReg::add("properties", "floater_inventory_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterProperties>); + + LLFloaterReg::add("telehubs", "floater_telehub.xml",&LLFloaterReg::build<LLFloaterTelehub>); LLFloaterReg::add("test_list_view", "floater_test_list_view.xml",&LLFloaterReg::build<LLFloaterTestListView>); LLFloaterReg::add("test_widgets", "floater_test_widgets.xml", &LLFloaterReg::build<LLFloater>); LLFloaterReg::add("top_objects", "floater_top_objects.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterTopObjects>); + LLFloaterReg::add("reporter", "floater_report_abuse.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterReporter>); LLFloaterReg::add("reset_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterResetQueue>); LLFloaterReg::add("region_info", "floater_region_info.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRegionInfo>); - LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsDebug>); + LLFloaterReg::add("script_debug", "floater_script_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptDebug>); + LLFloaterReg::add("script_debug_output", "floater_script_debug_panel.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterScriptDebugOutput>); + LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater); + LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSettingsDebug>); LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater>); LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRunQueue>); LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotRunQueue>); @@ -170,14 +232,23 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("search", "floater_directory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDirectory>); LLFloaterReg::add("ui_preview", "floater_ui_preview.xml", &LLFloaterReg::build<LLFloaterUIPreview>); + LLFloaterReg::add("upload_anim", "floater_animation_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAnimPreview>, "upload"); + LLFloaterReg::add("upload_image", "floater_image_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterImagePreview>, "upload"); + LLFloaterReg::add("upload_sound", "floater_sound_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundPreview>, "upload"); + + LLFloaterReg::add("voice_call", "floater_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterCall>); LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWorldMap>); + + // *NOTE: Please keep these alphabetized for easier merges - LLObjectIMInfo::register_floater(); // debug use only LLFloaterReg::add("media_remote_ctrl", "floater_media_remote.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMediaRemoteCtrl>); - - // *NOTE: Please keep these alphabetized for easier merges + + // Untested / dangerous - not for release +#if !LL_RELEASE_FOR_DOWNLOAD + LLFloaterReg::add("buy_currency_html", "floater_html_simple.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHtmlCurrency>); +#endif LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving } diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 66da7d89fb..bb14a619c5 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -201,10 +201,19 @@ void LLViewerInventoryItem::fetchFromServer(void) const { std::string url; - if( ALEXANDRIA_LINDEN_ID.getString() == mPermissions.getOwner().getString()) - url = gAgent.getRegion()->getCapability("FetchLib"); - else - url = gAgent.getRegion()->getCapability("FetchInventory"); + LLViewerRegion* region = gAgent.getRegion(); + // we have to check region. It can be null after region was destroyed. See EXT-245 + if (region) + { + if( ALEXANDRIA_LINDEN_ID.getString() == mPermissions.getOwner().getString()) + url = region->getCapability("FetchLib"); + else + url = region->getCapability("FetchInventory"); + } + else + { + llwarns << "Agent Region is absent" << llendl; + } if (!url.empty()) { @@ -665,13 +674,12 @@ void RezAttachmentCallback::fire(const LLUUID& inv_item) } } -extern LLGestureManager gGestureManager; void ActivateGestureCallback::fire(const LLUUID& inv_item) { if (inv_item.isNull()) return; - gGestureManager.activateGesture(inv_item); + LLGestureManager::instance().activateGesture(inv_item); } void CreateGestureCallback::fire(const LLUUID& inv_item) @@ -679,7 +687,7 @@ void CreateGestureCallback::fire(const LLUUID& inv_item) if (inv_item.isNull()) return; - gGestureManager.activateGesture(inv_item); + LLGestureManager::instance().activateGesture(inv_item); LLViewerInventoryItem* item = gInventory.getItem(inv_item); if (!item) return; diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 4e0c4023fd..6bb302727d 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -44,6 +44,7 @@ #include "lltoolfocus.h" #include "llviewerwindow.h" #include "llvoavatarself.h" +#include "llfloatercamera.h" // // Constants @@ -135,14 +136,29 @@ static void agent_push_forwardbackward( EKeystate s, S32 direction, LLAgent::EDo } } +void camera_move_forward( EKeystate s ); + void agent_push_forward( EKeystate s ) { + //in free camera control mode we need to intercept keyboard events for avatar movements + if (LLFloaterCamera::inFreeCameraMode()) + { + camera_move_forward(s); + return; + } agent_push_forwardbackward(s, 1, LLAgent::DOUBLETAP_FORWARD); } +void camera_move_backward( EKeystate s ); void agent_push_backward( EKeystate s ) { + //in free camera control mode we need to intercept keyboard events for avatar movements + if (LLFloaterCamera::inFreeCameraMode()) + { + camera_move_backward(s); + return; + } agent_push_forwardbackward(s, -1, LLAgent::DOUBLETAP_BACKWARD); } @@ -175,8 +191,17 @@ void agent_slide_right( EKeystate s ) agent_slide_leftright(s, -1, LLAgent::DOUBLETAP_SLIDERIGHT); } +void camera_spin_around_cw( EKeystate s ); + void agent_turn_left( EKeystate s ) { + //in free camera control mode we need to intercept keyboard events for avatar movements + if (LLFloaterCamera::inFreeCameraMode()) + { + camera_spin_around_cw(s); + return; + } + if (LLToolCamera::getInstance()->mouseSteerMode()) { agent_slide_left(s); @@ -189,9 +214,17 @@ void agent_turn_left( EKeystate s ) } } +void camera_spin_around_ccw( EKeystate s ); void agent_turn_right( EKeystate s ) { + //in free camera control mode we need to intercept keyboard events for avatar movements + if (LLFloaterCamera::inFreeCameraMode()) + { + camera_spin_around_ccw(s); + return; + } + if (LLToolCamera::getInstance()->mouseSteerMode()) { agent_slide_right(s); @@ -842,7 +875,7 @@ EKeyboardMode LLViewerKeyboard::getMode() { return MODE_EDIT_AVATAR; } - else if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->mIsSitting) + else if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()) { return MODE_SITTING; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 96ebe49354..eb676d3188 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -81,6 +81,7 @@ #include "lldrawpooltree.h" #include "llface.h" #include "llfirstuse.h" +#include "llfirsttimetipmanager.h" #include "llfloater.h" #include "llfloaterabout.h" #include "llfloaterbuycurrency.h" @@ -3048,7 +3049,7 @@ class LLAvatarDebug : public view_listener_t strings.push_back(avatar->getID().asString()); LLUUID invoice; send_generic_message("dumptempassetdata", strings, invoice); - LLFloaterAvatarTextures::show( avatar->getID() ); + LLFloaterReg::showInstance( "avatar_tetures", LLSD(avatar->getID()) ); } return true; } @@ -3439,7 +3440,7 @@ class LLSelfStandUp : public view_listener_t { bool handleEvent(const LLSD& userdata) { - gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); + gAgent.standUp(); return true; } }; @@ -3448,7 +3449,7 @@ class LLSelfEnableStandUp : public view_listener_t { bool handleEvent(const LLSD& userdata) { - bool new_value = gAgent.getAvatarObject() && gAgent.getAvatarObject()->mIsSitting; + bool new_value = gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting(); return new_value; } }; @@ -3676,7 +3677,7 @@ bool handle_sit_or_stand() if (sitting_on_selection()) { - gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); + gAgent.standUp(); return true; } @@ -3722,7 +3723,7 @@ class LLLandSit : public view_listener_t { bool handleEvent(const LLSD& userdata) { - gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); + gAgent.standUp(); LLViewerParcelMgr::getInstance()->deselectLand(); LLVector3d posGlobal = LLToolPie::getInstance()->getPick().mPosGlobal; @@ -4630,7 +4631,7 @@ BOOL sitting_on_selection() return FALSE; } - return (avatar->mIsSitting && avatar->getRoot() == root_object); + return (avatar->isSitting() && avatar->getRoot() == root_object); } class LLToolsSaveToInventory : public view_listener_t @@ -5225,6 +5226,9 @@ class LLWorldAlwaysRun : public view_listener_t // tell the simulator. gAgent.sendWalkRun(gAgent.getAlwaysRun()); + // Update Movement Controls according to AlwaysRun mode + LLFloaterMove::setAlwaysRunMode(gAgent.getAlwaysRun()); + return true; } }; @@ -5275,7 +5279,10 @@ class LLWorldCreateLandmark : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLFloaterReg::showInstance("add_landmark"); + LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark")); + + // Floater "Add Landmark" functionality moved to Side Tray + //LLFloaterReg::showInstance("add_landmark"); return true; } }; @@ -5330,8 +5337,7 @@ void invite_to_group(const LLUUID& dest_id) LLViewerObject* dest = gObjectList.findObject(dest_id); if(dest && dest->isAvatar()) { - LLFloaterGroupPicker* widget; - widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); + LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(gAgent.getID())); if (widget) { widget->center(); @@ -5533,11 +5539,7 @@ class LLShowFloater : public view_listener_t bool handleEvent(const LLSD& userdata) { std::string floater_name = userdata.asString(); - if (floater_name == "gestures") - { - LLFloaterGesture::toggleVisibility(); - } - else if (floater_name == "appearance") + if (floater_name == "appearance") { if (gAgentWearables.areWearablesLoaded()) { @@ -5548,10 +5550,6 @@ class LLShowFloater : public view_listener_t { LLToolBar::toggle(NULL); } - else if (floater_name == "my land") - { - LLFloaterLandHoldings::show(NULL); - } else if (floater_name == "buy land") { if (LLViewerParcelMgr::getInstance()->selectionEmpty()) @@ -6808,7 +6806,7 @@ void handle_debug_avatar_textures(void*) LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if (objectp) { - LLFloaterAvatarTextures::show(objectp->getID()); + LLFloaterReg::showInstance( "avatar_tetures", LLSD(objectp->getID()) ); } } @@ -7063,8 +7061,8 @@ void handle_load_from_xml(void*) if (picker.getOpenFile(LLFilePicker::FFLOAD_XML)) { std::string filename = picker.getFirstFile(); - LLFloater* floater = new LLFloater(); - LLUICtrlFactory::getInstance()->buildFloater(floater, filename); + LLFloater* floater = new LLFloater(LLSD()); + LLUICtrlFactory::getInstance()->buildFloater(floater, filename, NULL); } } @@ -7110,14 +7108,7 @@ void handle_buy_currency_test(void*) llinfos << "buy currency url " << url << llendl; - LLFloaterHtmlCurrency* floater =LLFloaterReg::getTypedInstance<LLFloaterHtmlCurrency>("html_currency", LLSD(url)); - if(floater) - { - LLFloaterReg::showInstance("html_currency", LLSD(url)); - // Needed so we can use secondlife:///app/floater/self/close SLURLs - floater->setTrusted(true); - floater->center(); - } + LLFloaterReg::showInstance("buy_currency_html", LLSD(url)); } void handle_rebake_textures(void*) @@ -7517,16 +7508,7 @@ class LLWorldEnvSettings : public view_listener_t if (tod == "editor") { // if not there or is hidden, show it - if( !LLFloaterEnvSettings::isOpen() || - !LLFloaterEnvSettings::instance()->getVisible()) { - LLFloaterEnvSettings::show(); - - // otherwise, close it button acts like a toggle - } - else - { - LLFloaterEnvSettings::instance()->closeFloater(); - } + LLFloaterReg::toggleInstance("env_settings"); return true; } @@ -7588,17 +7570,7 @@ class LLWorldWaterSettings : public view_listener_t { bool handleEvent(const LLSD& userdata) { - // if not there or is hidden, show it - if( !LLFloaterWater::isOpen() || - !LLFloaterWater::instance()->getVisible()) { - LLFloaterWater::show(); - - // otherwise, close it button acts like a toggle - } - else - { - LLFloaterWater::instance()->closeFloater(); - } + LLFloaterReg::toggleInstance("env_water"); return true; } }; @@ -7608,7 +7580,7 @@ class LLWorldPostProcess : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLFloaterPostProcess::show(); + LLFloaterReg::showInstance("env_post_process"); return true; } }; @@ -7618,12 +7590,28 @@ class LLWorldDayCycle : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLFloaterDayCycle::show(); + LLFloaterReg::showInstance("env_day_cycle"); return true; } }; +/// Show First Time Tips calbacks +class LLHelpCheckShowFirstTimeTip : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + return LLFirstTimeTipsManager::tipsEnabled(); + } +}; +class LLHelpShowFirstTimeTip : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLFirstTimeTipsManager::enabledTip(!userdata.asBoolean()); + return true; + } +}; void initialize_menus() { @@ -7728,6 +7716,9 @@ void initialize_menus() view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess"); view_listener_t::addMenu(new LLWorldDayCycle(), "World.DayCycle"); + view_listener_t::addMenu(new LLHelpCheckShowFirstTimeTip(), "Help.CheckShowFirstTimeTip"); + view_listener_t::addMenu(new LLHelpShowFirstTimeTip(), "Help.ShowQuickTips"); + // Tools menu view_listener_t::addMenu(new LLToolsSelectTool(), "Tools.SelectTool"); view_listener_t::addMenu(new LLToolsSelectOnlyMyObjects(), "Tools.SelectOnlyMyObjects"); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index e34c47368c..02e9528f7d 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -37,10 +37,8 @@ // project includes #include "llagent.h" #include "llfilepicker.h" -#include "llfloateranimpreview.h" +#include "llfloaterreg.h" #include "llfloaterbuycurrency.h" -#include "llfloaterimagepreview.h" -#include "llfloaternamedesc.h" #include "llfloatersnapshot.h" #include "llinventorymodel.h" // gInventory #include "llresourcedata.h" @@ -254,8 +252,7 @@ class LLFileUploadImage : public view_listener_t std::string filename = upload_pick((void *)LLFilePicker::FFLOAD_IMAGE); if (!filename.empty()) { - LLFloaterImagePreview* floaterp = new LLFloaterImagePreview(filename); - LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_image_preview.xml"); + LLFloaterReg::showInstance("upload_image", LLSD(filename)); } return TRUE; } @@ -268,9 +265,7 @@ class LLFileUploadSound : public view_listener_t std::string filename = upload_pick((void*)LLFilePicker::FFLOAD_WAV); if (!filename.empty()) { - LLFloaterNameDesc* floaterp = new LLFloaterNameDesc(filename); - LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_sound_preview.xml"); - floaterp->childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload() )); + LLFloaterReg::showInstance("upload_sound", LLSD(filename)); } return true; } @@ -283,8 +278,7 @@ class LLFileUploadAnim : public view_listener_t const std::string filename = upload_pick((void*)LLFilePicker::FFLOAD_ANIM); if (!filename.empty()) { - LLFloaterAnimPreview* floaterp = new LLFloaterAnimPreview(filename); - LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_animation_preview.xml"); + LLFloaterReg::showInstance("upload_anim", LLSD(filename)); } return true; } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 25c00bb816..f8b6e0f687 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -96,6 +96,7 @@ #include "llinventorymodel.h" #include "llfloaterinventory.h" #include "llmenugl.h" +#include "llmoveview.h" #include "llmutelist.h" #include "llnotifications.h" #include "llnotify.h" @@ -1184,9 +1185,6 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& { opener = open_agent_offer; } - - // add buddy to recent people list - LLRecentPeople::instance().add(mFromID); } break; case IM_TASK_INVENTORY_OFFERED: @@ -1259,6 +1257,12 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& break; } + if(IM_INVENTORY_OFFERED == mIM) + { + // add buddy to recent people list + LLRecentPeople::instance().add(mFromID); + } + if(opener) { gInventory.addObserver(opener); @@ -1465,6 +1469,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat); BOOL is_linden = LLMuteList::getInstance()->isLinden(name); BOOL is_owned_by_me = FALSE; + BOOL is_friend = (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL) ? false : true; + BOOL accept_im_from_only_friend = gSavedSettings.getBOOL("VoiceCallsFriendsOnly"); chat.mMuted = is_muted && !is_linden; chat.mFromID = from_id; @@ -1592,7 +1598,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; - if (!is_muted || is_linden) + bool mute_im = is_muted; + if(accept_im_from_only_friend&&!is_friend) + { + mute_im = true; + } + if (!mute_im || is_linden) { gIMMgr->addMessage( session_id, @@ -1783,7 +1794,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // Someone has offered us some inventory. { LLOfferInfo* info = new LLOfferInfo; - + bool mute_im = false; if (IM_INVENTORY_OFFERED == dialog) { struct offer_agent_bucket_t @@ -1800,6 +1811,11 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0]; info->mType = (LLAssetType::EType) bucketp->asset_type; info->mObjectID = bucketp->object_id; + + if(accept_im_from_only_friend&&!is_friend) + { + mute_im = true; + } } else { @@ -1830,7 +1846,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) info->mDesc = message; info->mHost = msg->getSender(); //if (((is_busy && !is_owned_by_me) || is_muted)) - if ( is_muted ) + if ( is_muted || mute_im) { // Same as closing window info->forceResponse(IOR_DECLINE); @@ -2431,12 +2447,17 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // show on screen and add to history LLNotificationsUI::LLNotificationManager::instance().onChat( chat, LLNotificationsUI::NT_NEARBYCHAT); + + // adding temporarily so that communications window chat bar + // works until the new chat window is ready + LLFloaterChat::addChat(chat, FALSE, FALSE); } else { LLNotificationsUI::LLNotificationManager::instance().onChat( chat, LLNotificationsUI::NT_NEARBYCHAT); - // just add to chat history + // adding temporarily + LLFloaterChat::addChatHistory(chat); } } } @@ -3850,7 +3871,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data) if (object) { LLVector3 sit_spot = object->getPositionAgent() + (sitPosition * object->getRotation()); - if (!use_autopilot || (avatar && avatar->mIsSitting && avatar->getRoot() == object->getRoot())) + if (!use_autopilot || (avatar && avatar->isSitting() && avatar->getRoot() == object->getRoot())) { //we're already sitting on this object, so don't autopilot } @@ -4522,9 +4543,6 @@ void process_economy_data(LLMessageSystem *msg, void** /*user_data*/) LL_INFOS_ONCE("Messaging") << "EconomyData message arrived; upload cost is L$" << upload_cost << LL_ENDL; - LLFloaterImagePreview::setUploadAmount(upload_cost); - LLFloaterAnimPreview::setUploadAmount(upload_cost); - gMenuHolder->childSetLabelArg("Upload Image", "[COST]", llformat("%d", upload_cost)); gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", llformat("%d", upload_cost)); gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", llformat("%d", upload_cost)); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index cf3491ef03..ec11e0aee2 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -42,6 +42,7 @@ #include "llviewercontrol.h" #include "lldatapacker.h" #include "llfasttimer.h" +#include "llfloaterreg.h" #include "llfontgl.h" #include "llframetimer.h" #include "llinventory.h" @@ -2595,7 +2596,7 @@ void LLViewerObject::doInventoryCallback() void LLViewerObject::removeInventory(const LLUUID& item_id) { // close any associated floater properties - LLFloaterProperties::closeByID(item_id, mID); + LLFloaterReg::hideInstance("properties", item_id); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_RemoveTaskInventory); diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 0fadba1364..afee30293a 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -44,7 +44,6 @@ #include "llviewertexteditor.h" #include "llfloaterchat.h" -#include "llfloateravatarinfo.h" #include "llfloaterworldmap.h" #include "llnotify.h" #include "llpanelplaces.h" @@ -64,6 +63,7 @@ #include "llnotecard.h" #include "llmemorystream.h" #include "llmenugl.h" +#include "llavataractions.h" #include "llappviewer.h" // for gPacificDaylightTime @@ -1394,9 +1394,7 @@ void LLViewerTextEditor::openEmbeddedCallingcard( LLInventoryItem* item, llwchar { if(item && !item->getCreatorUUID().isNull()) { - BOOL online; - online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()); - LLFloaterAvatarInfo::showFromFriend(item->getCreatorUUID(), online); + LLAvatarActions::showProfile(item->getCreatorUUID()); } } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 533889b2f7..6ea1522b47 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1940,6 +1940,8 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL { generateGLTexture() ; } + mGLTexturep->setNeedsAlphaAndPickMask(FALSE) ; + mIsPlaying = FALSE ; } @@ -1952,6 +1954,7 @@ void LLViewerMediaTexture::reinit(BOOL usemipmaps /* = TRUE */) getLastReferencedTimer()->reset() ; generateGLTexture() ; + mGLTexturep->setNeedsAlphaAndPickMask(FALSE) ; } void LLViewerMediaTexture::setUseMipMaps(BOOL mipmap) diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 2f3ed0e68a..ca9e89723c 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -142,20 +142,12 @@ void LLViewerTextureList::doPreloadImages() image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - else - { - llinfos << "JAMESDEBUG" << llendl; - } image = LLViewerTextureManager::getFetchedTextureFromFile("world/NoEntryPassLines.png", MIPMAP_YES, IMMEDIATE_YES); if (image) { image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } - else - { - llinfos << "JAMESDEBUG" << llendl; - } image = LLViewerTextureManager::getFetchedTexture(DEFAULT_WATER_NORMAL, MIPMAP_YES, IMMEDIATE_YES); if (image) { diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 616e44b29a..b4838db690 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -542,7 +542,7 @@ public: ypos += y_inc; } // only display these messages if we are actually rendering beacons at this moment - if (LLPipeline::getRenderBeacons(NULL) && gSavedSettings.getBOOL("BeaconAlwaysOn")) + if (LLPipeline::getRenderBeacons(NULL) && LLFloaterReg::instanceVisible("beacons")) { if (LLPipeline::getRenderParticleBeacons(NULL)) { @@ -2227,7 +2227,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } // Try for a new-format gesture - if (gGestureManager.triggerGesture(key, mask)) + if (LLGestureManager::instance().triggerGesture(key, mask)) { return TRUE; } @@ -4260,30 +4260,19 @@ void LLViewerWindow::destroyWindow() void LLViewerWindow::drawMouselookInstructions() { - // Draw instructions for mouselook ("Press ESC to leave Mouselook" in a box at the top of the screen.) + // Draw instructions for mouselook ("Press ESC to return to World View" partially transparent at the bottom of the screen.) const std::string instructions = LLTrans::getString("LeaveMouselook"); - const LLFontGL* font = LLFontGL::getFontSansSerif(); - - const S32 INSTRUCTIONS_PAD = 5; - LLRect instructions_rect; - instructions_rect.setLeftTopAndSize( - mWorldViewRect.mLeft + INSTRUCTIONS_PAD, - mWorldViewRect.mTop - INSTRUCTIONS_PAD, - font->getWidth( instructions ) + 2 * INSTRUCTIONS_PAD, - llround(font->getLineHeight() + 2 * INSTRUCTIONS_PAD)); - - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4f( 0.9f, 0.9f, 0.9f, 1.0f ); - gl_rect_2d( instructions_rect ); - } + const LLFontGL* font = LLFontGL::getFont(LLFontDescriptor("SansSerif", "Huge", LLFontGL::BOLD)); + //to be on top of Bottom bar when it is opened + const S32 INSTRUCTIONS_PAD = 50; + font->renderUTF8( instructions, 0, - instructions_rect.mLeft + INSTRUCTIONS_PAD, - instructions_rect.mTop - INSTRUCTIONS_PAD, - LLColor4( 0.0f, 0.0f, 0.0f, 1.f ), - LLFontGL::LEFT, LLFontGL::TOP); + mWorldViewRect.getCenterX(), + mWorldViewRect.mBottom + INSTRUCTIONS_PAD, + LLColor4( 0.0f, 0.0f, 0.0f, 0.6f ), + LLFontGL::HCENTER, LLFontGL::TOP); } @@ -4402,11 +4391,6 @@ BOOL LLViewerWindow::getShowProgress() const return (mProgressView && mProgressView->getVisible()); } -void LLViewerWindow::handleLoginComplete() -{ - LLNavigationBar::getInstance()->handleLoginComplete(); -} - void LLViewerWindow::moveProgressViewToFront() { if( mProgressView && mRootView ) diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 3455ce8ede..60b0d3c34b 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -50,6 +50,8 @@ #include "llnotifications.h" #include "llmousehandler.h" #include "llcursortypes.h" +#include "llhandle.h" + #include <boost/scoped_ptr.hpp> class LLView; @@ -269,7 +271,6 @@ public: void setProgressMessage(const std::string& msg); void setProgressCancelButtonVisible( BOOL b, const std::string& label = LLStringUtil::null ); LLProgressView *getProgressView() const; - void handleLoginComplete(); void updateObjectUnderCursor(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 714145ce14..2b5c3361c4 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -57,6 +57,7 @@ #include "llkeyframestandmotion.h" #include "llkeyframewalkmotion.h" #include "llmutelist.h" +#include "llmoveview.h" #include "llnotify.h" #include "llquantize.h" #include "llregionhandle.h" @@ -2214,7 +2215,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) else { llinfos << "oops - CurrentGesticulationLevel can be only 0, 1, or 2" << llendl; } // this is the call that Karl S. created for triggering gestures from within the code. - gGestureManager.triggerAndReviseString( gestureString ); + LLGestureManager::instance().triggerAndReviseString( gestureString ); } } @@ -4244,7 +4245,7 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL } else if (anim_id == ANIM_AGENT_SIT_GROUND_CONSTRAINED) { - mIsSitting = TRUE; + sitDown(TRUE); } @@ -4261,7 +4262,7 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL { if (anim_id == ANIM_AGENT_SIT_GROUND_CONSTRAINED) { - mIsSitting = FALSE; + sitDown(FALSE); } stopMotion(anim_id); result = TRUE; @@ -5484,6 +5485,19 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) } //----------------------------------------------------------------------------- +// sitDown() +//----------------------------------------------------------------------------- +void LLVOAvatar::sitDown(BOOL bSitting) +{ + mIsSitting = bSitting; + if (isSelf()) + { + // Update Movement Controls according to own Sitting mode + LLFloaterMove::setSittingMode(bSitting); + } +} + +//----------------------------------------------------------------------------- // sitOnObject() //----------------------------------------------------------------------------- void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) @@ -5502,7 +5516,7 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) mDrawable->mXform.setRotation(mDrawable->getWorldRotation() * inv_obj_rot); gPipeline.markMoved(mDrawable, TRUE); - mIsSitting = TRUE; + sitDown(TRUE); mRoot.getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject mRoot.setPosition(getPosition()); mRoot.updateWorldMatrixChildren(); @@ -5566,7 +5580,8 @@ void LLVOAvatar::getOffObject() gPipeline.markMoved(mDrawable, TRUE); - mIsSitting = FALSE; + sitDown(FALSE); + mRoot.getXform()->setParent(NULL); // LLVOAvatar::getOffObject mRoot.setPosition(cur_position_world); mRoot.setRotation(cur_rotation_world); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index f36d64aa8e..59be38a1b0 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -784,8 +784,13 @@ public: // Sitting //-------------------------------------------------------------------- public: + void sitDown(BOOL bSitting); + BOOL isSitting(){return mIsSitting;} void sitOnObject(LLViewerObject *sit_object); void getOffObject(); + +private: + // set this property only with LLVOAvatar::sitDown method BOOL mIsSitting; /** Hierarchy diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 4a6bb6facb..9df25bdb11 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1006,6 +1006,15 @@ void LLVOAvatarSelf::localTextureLoaded(BOOL success, LLViewerFetchedTexture *sr ETextureIndex index = data->mIndex; if (!isIndexLocalTexture(index)) return; LLLocalTextureObject *local_tex_obj = getLocalTextureObject(index, 0); + + // fix for EXT-268. Preventing using of NULL pointer + if(NULL == local_tex_obj) + { + LL_WARNS("TAG") << "There is no Local Texture Object with index: " << index + << ", final: " << final + << LL_ENDL; + return; + } if (success) { if (!local_tex_obj->getBakedReady() && diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 50e407739b..92c223e43d 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -39,6 +39,7 @@ #include "pipeline.h" #include "llsky.h" +#include "llfloaterreg.h" #include "llsliderctrl.h" #include "llspinctrl.h" #include "llcheckboxctrl.h" @@ -270,9 +271,10 @@ void LLWaterParamManager::update(LLViewerCamera * cam) propagateParameters(); // sync menus if they exist - if(LLFloaterWater::isOpen()) + LLFloaterWater* waterfloater = LLFloaterReg::findTypedInstance<LLFloaterWater>("env_water"); + if(waterfloater) { - LLFloaterWater::instance()->syncMenu(); + waterfloater->syncMenu(); } stop_glerror(); diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index b8a2bf0bd2..c237c0bded 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -37,6 +37,7 @@ #include "pipeline.h" #include "llsky.h" +#include "llfloaterreg.h" #include "llsliderctrl.h" #include "llspinctrl.h" #include "llcheckboxctrl.h" @@ -377,17 +378,20 @@ void LLWLParamManager::update(LLViewerCamera * cam) propagateParameters(); // sync menus if they exist - if(LLFloaterWindLight::isOpen()) + LLFloaterWindLight* wlfloater = LLFloaterReg::findTypedInstance<LLFloaterWindLight>("env_windlight"); + if (wlfloater) { - LLFloaterWindLight::instance()->syncMenu(); + wlfloater->syncMenu(); } - if(LLFloaterDayCycle::isOpen()) + LLFloaterDayCycle* dlfloater = LLFloaterReg::findTypedInstance<LLFloaterDayCycle>("env_day_cycle"); + if (dlfloater) { - LLFloaterDayCycle::instance()->syncMenu(); + dlfloater->syncMenu(); } - if(LLFloaterEnvSettings::isOpen()) + LLFloaterEnvSettings* envfloater = LLFloaterReg::findTypedInstance<LLFloaterEnvSettings>("env_settings"); + if (envfloater) { - LLFloaterEnvSettings::instance()->syncMenu(); + envfloater->syncMenu(); } F32 camYaw = cam->getYaw(); diff --git a/indra/newview/macview_Prefix.h b/indra/newview/macview_Prefix.h index a273320b3d..0fcdf2da4f 100644 --- a/indra/newview/macview_Prefix.h +++ b/indra/newview/macview_Prefix.h @@ -63,7 +63,6 @@ #include "lldrawable.h" #include "llfirstuse.h" #include "llfloater.h" -#include "llfloateravatarinfo.h" #include "llfloaterbuildoptions.h" #include "llfloaterchat.h" #include "llfloatercustomize.h" diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 38c81bf027..f422791868 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -66,6 +66,7 @@ #include "llface.h" #include "llfeaturemanager.h" #include "llfloatertelehub.h" +#include "llfloaterreg.h" #include "llgldbg.h" #include "llhudmanager.h" #include "lllightconstants.h" @@ -2299,7 +2300,7 @@ void LLPipeline::postSort(LLCamera& camera) } // only render if the flag is set. The flag is only set if we are in edit mode or the toggle is set in the menus - if (gSavedSettings.getBOOL("BeaconAlwaysOn") && !sShadowRender) + if (LLFloaterReg::instanceVisible("beacons") && !sShadowRender) { if (sRenderScriptedTouchBeacons) { diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index d55f9fa42f..73f0d32d12 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -262,7 +262,7 @@ reference="White" /> <color name="FilterBackgroundColor" - reference="FloaterDefaultBackgroundColor" /> + reference="DkGray" /> <color name="FilterTextColor" value="1 0.78 0.27 1" /> diff --git a/indra/newview/skins/default/textures/quick_tips/avatar_free_mode.png b/indra/newview/skins/default/textures/quick_tips/avatar_free_mode.png Binary files differnew file mode 100644 index 0000000000..be7c87efb6 --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/avatar_free_mode.png diff --git a/indra/newview/skins/default/textures/quick_tips/camera_free_mode.png b/indra/newview/skins/default/textures/quick_tips/camera_free_mode.png Binary files differnew file mode 100644 index 0000000000..9a3f3703b2 --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/camera_free_mode.png diff --git a/indra/newview/skins/default/textures/quick_tips/camera_orbit_mode.png b/indra/newview/skins/default/textures/quick_tips/camera_orbit_mode.png Binary files differnew file mode 100644 index 0000000000..dd72cc0162 --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/camera_orbit_mode.png diff --git a/indra/newview/skins/default/textures/quick_tips/camera_pan_mode.png b/indra/newview/skins/default/textures/quick_tips/camera_pan_mode.png Binary files differnew file mode 100644 index 0000000000..b537dcbe46 --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/camera_pan_mode.png diff --git a/indra/newview/skins/default/textures/quick_tips/camera_preset_front_view.png b/indra/newview/skins/default/textures/quick_tips/camera_preset_front_view.png Binary files differnew file mode 100644 index 0000000000..7674a75ac3 --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/camera_preset_front_view.png diff --git a/indra/newview/skins/default/textures/quick_tips/camera_preset_group_view.png b/indra/newview/skins/default/textures/quick_tips/camera_preset_group_view.png Binary files differnew file mode 100644 index 0000000000..9c9b923a5a --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/camera_preset_group_view.png diff --git a/indra/newview/skins/default/textures/quick_tips/camera_preset_rear_view.png b/indra/newview/skins/default/textures/quick_tips/camera_preset_rear_view.png Binary files differnew file mode 100644 index 0000000000..15c3053491 --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/camera_preset_rear_view.png diff --git a/indra/newview/skins/default/textures/quick_tips/move_fly_first.png b/indra/newview/skins/default/textures/quick_tips/move_fly_first.png Binary files differnew file mode 100644 index 0000000000..b6e2ce60e4 --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/move_fly_first.png diff --git a/indra/newview/skins/default/textures/quick_tips/move_fly_second.png b/indra/newview/skins/default/textures/quick_tips/move_fly_second.png Binary files differnew file mode 100644 index 0000000000..84b63cc338 --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/move_fly_second.png diff --git a/indra/newview/skins/default/textures/quick_tips/move_run_first.png b/indra/newview/skins/default/textures/quick_tips/move_run_first.png Binary files differnew file mode 100644 index 0000000000..16093dc683 --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/move_run_first.png diff --git a/indra/newview/skins/default/textures/quick_tips/move_run_second.png b/indra/newview/skins/default/textures/quick_tips/move_run_second.png Binary files differnew file mode 100644 index 0000000000..19fa43ec32 --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/move_run_second.png diff --git a/indra/newview/skins/default/textures/quick_tips/move_walk_first.png b/indra/newview/skins/default/textures/quick_tips/move_walk_first.png Binary files differnew file mode 100644 index 0000000000..92d120d53e --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/move_walk_first.png diff --git a/indra/newview/skins/default/textures/quick_tips/move_walk_second.png b/indra/newview/skins/default/textures/quick_tips/move_walk_second.png Binary files differnew file mode 100644 index 0000000000..f8e28722be --- /dev/null +++ b/indra/newview/skins/default/textures/quick_tips/move_walk_second.png diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index dc5936a435..96d93e7081 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -1,33 +1,24 @@ <textures version="101"> <!-- Please add new files alphabetically to prevent merge conflicts. JC --> + <texture name="Accordion_ArrowClosed_Off" file_name="containers/Accordion_ArrowClosed_Off.png" preload="false" /> + <texture name="Accordion_ArrowClosed_Press" file_name="containers/Accordion_ArrowClosed_Press.png" preload="false" /> + <texture name="Accordion_ArrowOpened_Off" file_name="containers/Accordion_ArrowOpened_Off.png" preload="false" /> + <texture name="Accordion_ArrowOpened_Press" file_name="containers/Accordion_ArrowOpened_Press.png" preload="false" /> + <texture name="Accordion_Off" file_name="containers/Accordion_Off.png" preload="false" /> + <texture name="Accordion_Press" file_name="containers/Accordion_Press.png" preload="false" /> - <texture name="ScrollThumb_Horiz" file_name="widgets/ScrollThumb_Horiz.png" preload="true" scale.left="4" scale.top="10" scale.bottom="53" scale.right="4" /> - <texture name="ScrollThumb_Vert" file_name="widgets/ScrollThumb_Vert.png" preload="true" scale.left="4" scale.top="53" scale.bottom="10" scale.right="4" /> - <texture name="ScrollTrack_Vert" file_name="widgets/ScrollTrack_Vert.png" preload="true" scale.left="2" scale.top="40" scale.bottom="13" scale.right="0" /> - <texture name="ScrollTrack_Horiz" file_name="widgets/ScrollTrack_Horiz.png" preload="true" scale.left="0" scale.top="13" scale.bottom="40" scale.right="2" /> - <texture name="sm_rounded_corners_simple.tga" scale.left="4" scale.top="4" scale.bottom="4" scale.right="4"/> + <texture name="AddItem_Off" file_name="icons/AddItem_Off.png" preload="false" /> + <texture name="AddItem_Press" file_name="icons/AddItem_Press.png" preload="false" /> - <!--There are still references to this old textfield art in the code somewhere -erica--> - <texture name="icn_textfield_enabled.tga" scale.left="5" scale.top="5" scale.bottom="5" scale.right="5"/> - <texture name="icn_rounded-text-field.tga" scale.left="14" scale.bottom="16" scale.top="16" scale.right="114"/> - - <texture name="TextField_Search_Disabled" file_name="widgets/TextField_Search_Disabled.png" preload="true" scale.left="4" scale.top="18" scale.right="252" scale.bottom="4" /> - <texture name="TextField_Off" file_name="widgets/TextField_Off.png" preload="true" scale.left="4" scale.top="18" scale.right="252" scale.bottom="4" /> - <texture name="TextField_Search_Active" file_name="widgets/TextField_Search_Active.png" preload="true" scale.left="4" scale.top="18" scale.right="252" scale.bottom="4" /> - <texture name="TextField_Search_Off" file_name="widgets/TextField_Search_Off.png" preload="true" scale.left="4" scale.top="18" scale.right="252" scale.bottom="4" /> - <texture name="TextField_Disabled" file_name="widgets/TextField_Disabled.png" preload="true" scale.left="4" scale.top="18" scale.right="252" scale.bottom="4" /> - <texture name="TextField_Active" file_name="widgets/TextField_Active.png" preload="true" scale.left="4" scale.top="18" scale.right="252" scale.bottom="4" /> + <texture name="Arrow_Left_Off" file_name="navbar/Arrow_Left_Off.png" preload="true"/> + <texture name="Arrow_Left_Press" file_name="navbar/Arrow_Left_Press.png" preload="true"/> + <texture name="Arrow_Right_Off" file_name="navbar/Arrow_Right_Off.png" preload="true"/> + <texture name="Arrow_Right_Press" file_name="navbar/Arrow_Right_Press.png" preload="true"/> - <texture name="PushButton_Off" file_name="widgets/PushButton_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> - <texture name="PushButton_Press" file_name="widgets/PushButton_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> - <texture name="PushButton_Disabled" file_name="widgets/PushButton_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> - <texture name="PushButton_Selected" file_name="widgets/PushButton_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> - <texture name="PushButton_Selected_Press" file_name="widgets/PushButton_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> - <texture name="PushButton_Selected_Disabled" file_name="widgets/PushButton_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> + <texture name="BackArrow_Off" file_name="icons/BackArrow_Off.png" preload="false" /> + <texture name="BackArrow_Press" file_name="icons/BackArrow_Press.png" preload="false" /> - <texture name="toolbar_btn_enabled.tga" scale.left="7" scale.top="32" scale.right="121" scale.bottom="0" /> - <texture name="toolbar_btn_disabled.tga" scale.left="7" scale.top="32" scale.right="121" scale.bottom="0" /> - <texture name="toolbar_btn_selected.tga" scale.left="7" scale.top="32" scale.right="121" scale.bottom="0" /> + <texture name="BottomTray_BG" file_name="bottomtray/BottomTray_BG.png" preload="false" /> <texture name="Checkbox_Off_Disabled" file_name="widgets/Checkbox_Disabled.png" preload="true" /> <texture name="Checkbox_On_Disabled" file_name="widgets/Checkbox_On_Disabled.png" preload="true" /> @@ -35,124 +26,314 @@ <texture name="Checkbox_On" file_name="widgets/Checkbox_On.png" preload="true" /> <texture name="Checkbox_On_Press" file_name="widgets/Checkbox_On_Press.png" preload="true" /> <texture name="Checkbox_Press" file_name="widgets/Checkbox_Press.png" preload="true" /> - <texture name="RadioButton_On_Press" file_name="widgets/RadioButton_On_Press.png" preload="true" /> - <texture name="minimize_inactive.tga" preload="true"/> - <texture name="minimize.tga" preload="true" /> - <texture name="minimize_pressed.tga" preload="true"/> + <texture name="ComboButton_Disabled" file_name="widgets/ComboButton_Disabled.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + <texture name="ComboButton_Over" file_name="widgets/ComboButton_Over.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + <texture name="ComboButton_Press" file_name="widgets/ComboButton_Press.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + <texture name="ComboButton_Selected" file_name="widgets/ComboButton_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + <texture name="ComboButton_Off" file_name="widgets/ComboButton_Off.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + + <texture name="Container" file_name="containers/Container.png" preload="false" /> + + <texture name="DisclosureArrow_Closed_Off" file_name="widgets/DisclosureArrow_Closed_Off.png" preload="true" /> + <texture name="DisclosureArrow_Closed_Press" file_name="widgets/DisclosureArrow_Closed_Press.png" preload="true" /> + <texture name="DisclosureArrow_Opened_Off" file_name="widgets/DisclosureArrow_Opened_Off.png" preload="true" /> + <texture name="DisclosureArrow_Opened_Press" file_name="widgets/DisclosureArrow_Opened_Press.png" preload="true" /> + + <texture name="DownArrow" file_name="bottomtray/DownArrow.png" preload="false" /> + + <texture name="DropDown_Disabled" file_name="widgets/DropDown_Disabled.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + <texture name="DropDown_Over" file_name="widgets/DropDown_Over.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + <texture name="DropDown_Press" file_name="widgets/DropDown_Press.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + <texture name="DropDown_Selected" file_name="widgets/DropDown_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + <texture name="DropDown_Off" file_name="widgets/DropDown_Off.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + + <texture name="Favorite_Star_Active" file_name="navbar/Favorite_Star_Active.png" preload="false" /> + <texture name="Favorite_Star_Off" file_name="navbar/Favorite_Star_Off.png" preload="false" /> + <texture name="Favorite_Star_Press" file_name="navbar/Favorite_Star_Press.png" preload="false" /> + <texture name="Favorite_Star_Over" file_name="navbar/Favorite_Star_Over.png" preload="false"/> + + <texture name="FileMenu_BarSelect" file_name="navbar/FileMenu_BarSelect.png" preload="false" /> + <texture name="FileMenu_BG" file_name="navbar/FileMenu_BG.png" preload="false" /> + + <texture name="Help_Off" file_name="navbar/Help_Off.png" preload="false"/> + <texture name="Help_Press" file_name="navbar/Help_Press.png" preload="false"/> + + <texture name="History_Arrow" file_name="navbar/History_Arrow.png" preload="true"/> + + <texture name="Home_Off" file_name="navbar/Home_Off.png" preload="false"/> + <texture name="Home_Press" file_name="navbar/Home_Press.png" preload="false"/> <texture name="Icon_Close_Background" file_name="windows/Icon_Close_Background.png" preload="true" /> <texture name="Icon_Close_Foreground" file_name="windows/Icon_Close_Foreground.png" preload="true" /> <texture name="Icon_Close_Press" file_name="windows/Icon_Close_Press.png" preload="true" /> <texture name="Icon_Close_Toast" file_name="windows/Icon_Close_Toast.png" preload="true" /> + <texture name="Icon_Dock_Background" file_name="windows/Icon_Dock_Background.png" preload="true" /> <texture name="Icon_Dock_Foreground" file_name="windows/Icon_Dock_Foreground.png" preload="true" /> <texture name="Icon_Dock_Press" file_name="windows/Icon_Dock_Press.png" preload="true" /> + + <texture name="Icon_Gear_Background" file_name="windows/Icon_Gear_Background.png" preload="false"/> + <texture name="Icon_Gear_Foreground" file_name="windows/Icon_Gear_Foreground.png" preload="false"/> + <texture name="Icon_Gear_Press" file_name="windows/Icon_Gear_Press.png" preload="false"/> + <texture name="Icon_Undock_Background" file_name="windows/Icon_Undock_Background.png" preload="true" /> <texture name="Icon_Undock_Foreground" file_name="windows/Icon_Undock_Foreground.png" preload="true" /> <texture name="Icon_Undock_Press" file_name="windows/Icon_Undock_Press.png" preload="true" /> - <texture name="Toast_CloseBtn" file_name="windows/Toast_CloseBtn.png" preload="true" /> - <texture name="Toast" file_name="windows/Toast.png" preload="true" /> - - <texture name="Window_Background" file_name="windows/Window_Background.png" preload="true" /> - <texture name="Window_Foreground" file_name="windows/Window_Foreground.png" preload="true" /> - - <texture name="Favorite_Star_Active" file_name="navbar/Favorite_Star_Active.png" preload="true" /> - <texture name="Favorite_Star_Off" file_name="navbar/Favorite_Star_Off.png" preload="true" /> - <texture name="Favorite_Star_Press" file_name="navbar/Favorite_Star_Press.png" preload="true" /> - <texture name="FileMenu_BarSelect" file_name="navbar/FileMenu_BarSelect.png" preload="true" /> - <texture name="FileMenu_BG" file_name="navbar/FileMenu_BG.png" preload="true" /> - <texture name="NavBar_BG_NoFav" file_name="navbar/NavBar_BG_NoFav.png" preload="true" /> - <texture name="NavBar_BG" file_name="navbar/NavBar_BG.png" preload="true" /> - <texture name="Row_Selection" file_name="navbar/Row_Selection.png" preload="true" /> - - <texture name="BottomTray_BG" file_name="bottomtray/BottomTray_BG.png" preload="true" /> - <texture name="DownArrow" file_name="bottomtray/DownArrow.png" preload="true" /> - <texture name="NearbyVoice_Lvl1" file_name="bottomtray/NearbyVoice_Lvl1.png" preload="true" /> - <texture name="NearbyVoice_Lvl2" file_name="bottomtray/NearbyVoice_Lvl2.png" preload="true" /> - <texture name="NearbyVoice_Lvl3" file_name="bottomtray/NearbyVoice_Lvl3.png" preload="true" /> - <texture name="NearbyVoice_On" file_name="bottomtray/NearbyVoice_On.png" preload="true" /> - <texture name="Unread_IM" file_name="bottomtray/Unread_IM.png" preload="true" /> - <texture name="Unread_Msg" file_name="bottomtray/Unread_Msg.png" preload="true" /> - <texture name="VoicePPT_Lvl1" file_name="bottomtray/VoicePPT_Lvl1.png" preload="true" /> - <texture name="VoicePPT_Lvl2" file_name="bottomtray/VoicePPT_Lvl2.png" preload="true" /> - <texture name="VoicePPT_Lvl3" file_name="bottomtray/VoicePPT_Lvl3.png" preload="true" /> - <texture name="VoicePPT_Off" file_name="bottomtray/VoicePPT_Off.png" preload="true" /> - <texture name="VoicePPT_On" file_name="bottomtray/VoicePPT_On.png" preload="true" /> - - <texture name="Accordion_ArrowClosed_Off" file_name="containers/Accordion_ArrowClosed_Off.png" preload="true" /> - <texture name="Accordion_ArrowClosed_Press" file_name="containers/Accordion_ArrowClosed_Press.png" preload="true" /> - <texture name="Accordion_ArrowOpened_Off" file_name="containers/Accordion_ArrowOpened_Off.png" preload="true" /> - <texture name="Accordion_ArrowOpened_Press" file_name="containers/Accordion_ArrowOpened_Press.png" preload="true" /> - <texture name="Accordion_Off" file_name="containers/Accordion_Off.png" preload="true" /> - <texture name="Accordion_Press" file_name="containers/Accordion_Press.png" preload="true" /> - <texture name="Container" file_name="containers/Container.png" preload="true" /> - <texture name="TabTop_Divider" file_name="containers/TabTop_Divider.png" preload="true" /> - <texture name="TabTop_Left_Press" file_name="containers/TabTop_Left_Press.png" preload="true" /> - <texture name="TabTop_Middle_Press" file_name="containers/TabTop_Middle_Press.png" preload="true" /> - <texture name="TabTop_Right_Off" file_name="containers/TabTop_Right_Off.png" preload="true" /> - <texture name="TabTop_Right_Press" file_name="containers/TabTop_Right_Press.png" preload="true" /> - <texture name="TabTop_Right_Selected" file_name="containers/TabTop_Right_Selected.png" preload="true" /> - <texture name="Toolbar_Divider" file_name="containers/Toolbar_Divider.png" preload="true" /> - <texture name="Toolbar_Left_Off" file_name="containers/Toolbar_Left_Off.png" preload="true" /> - <texture name="Toolbar_Left_Press" file_name="containers/Toolbar_Left_Press.png" preload="true" /> - <texture name="Toolbar_Left_Selected" file_name="containers/Toolbar_Left_Selected.png" preload="true" /> - <texture name="Toolbar_Middle_Off" file_name="containers/Toolbar_Middle_Off.png" preload="true" /> - <texture name="Toolbar_Middle_Press" file_name="containers/Toolbar_Middle_Press.png" preload="true" /> - <texture name="Toolbar_Middle_Selected" file_name="containers/Toolbar_Middle_Selected.png" preload="true" /> - <texture name="Toolbar_Right_Off" file_name="containers/Toolbar_Right_Off.png" preload="true" /> - <texture name="Toolbar_Right_Press" file_name="containers/Toolbar_Right_Press.png" preload="true" /> - <texture name="Toolbar_Right_Selected" file_name="containers/Toolbar_Right_Selected.png" preload="true" /> - - <texture name="AddItem_Off" file_name="icons/AddItem_Off.png" preload="true" /> - <texture name="AddItem_Press" file_name="icons/AddItem_Press.png" preload="true" /> - <texture name="BackArrow_Off" file_name="icons/BackArrow_Off.png" preload="true" /> - <texture name="BackArrow_Press" file_name="icons/BackArrow_Press.png" preload="true" /> - <texture name="Info" file_name="icons/Info.png" preload="true" /> - <texture name="OptionsMenu_Off" file_name="icons/OptionsMenu_Off.png" preload="true" /> - <texture name="OptionsMenu_Press" file_name="icons/OptionsMenu_Press.png" preload="true" /> - <texture name="TrashItem_Off" file_name="icons/TrashItem_Off.png" preload="true" /> - <texture name="TrashItem_Press" file_name="icons/TrashItem_Press.png" preload="true" /> - <texture name="Widget_DownArrow" file_name="icons/Widget_DownArrow.png" preload="true" /> - - <texture name="TabIcon_Close_Off" file_name="taskpanel/TabIcon_Close_Off.png" preload="true" /> - <texture name="TabIcon_Home_Off" file_name="taskpanel/TabIcon_Home_Off.png" preload="true" /> - <texture name="TabIcon_Home_Selected" file_name="taskpanel/TabIcon_Home_Selected.png" preload="true" /> - <texture name="TabIcon_Me_Off" file_name="taskpanel/TabIcon_Me_Off.png" preload="true" /> - <texture name="TabIcon_Me_Selected" file_name="taskpanel/TabIcon_Me_Selected.png" preload="true" /> - <texture name="TabIcon_Open_Off" file_name="taskpanel/TabIcon_Open_Off.png" preload="true" /> - <texture name="TabIcon_People_Off" file_name="taskpanel/TabIcon_People_Off.png" preload="true" /> - <texture name="TabIcon_People_Selected" file_name="taskpanel/TabIcon_People_Selected.png" preload="true" /> - <texture name="TabIcon_Places_Off" file_name="taskpanel/TabIcon_Places_Off.png" preload="true" /> - <texture name="TabIcon_Places_Selected" file_name="taskpanel/TabIcon_Places_Selected.png" preload="true" /> - <texture name="TabIcon_Things_Off" file_name="taskpanel/TabIcon_Things_Off.png" preload="true" /> - <texture name="TabIcon_Things_Selected" file_name="taskpanel/TabIcon_Things_Selected.png" preload="true" /> - - <texture name="DisclosureArrow_Closed_Off" file_name="widgets/DisclosureArrow_Closed_Off.png" preload="true" /> - <texture name="DisclosureArrow_Closed_Process" file_name="widgets/DisclosureArrow_Closed_Process.png" preload="true" /> - <texture name="DisclosureArrow_Opened_Off" file_name="widgets/DisclosureArrow_Opened_Off.png" preload="true" /> - <texture name="DisclosureArrow_Opened_Press" file_name="widgets/DisclosureArrow_Opened_Press.png" preload="true" /> + + <texture name="Info" file_name="icons/Info.png" preload="false" /> + + <texture name="Info_Off" file_name="navbar/Info_Off.png" preload="false"/> + <texture name="Info_Press" file_name="navbar/Info_Press.png" preload="false"/> + <texture name="ListItem_Select" file_name="widgets/ListItem_Select.png" preload="true" /> + <texture name="menu_separator" file_name="navbar/FileMenu_Divider.png" scale.left="4" scale.top="166" scale.right="0" scale.bottom="0" /> + + <texture name="NavBar_BG_NoFav" file_name="navbar/NavBar_BG_NoFav.png" preload="false" /> + <texture name="NavBar_BG" file_name="navbar/NavBar_BG.png" preload="false" /> + + <texture name="NearbyVoice_Lvl1" file_name="bottomtray/NearbyVoice_Lvl1.png" preload="false" /> + <texture name="NearbyVoice_Lvl2" file_name="bottomtray/NearbyVoice_Lvl2.png" preload="false" /> + <texture name="NearbyVoice_Lvl3" file_name="bottomtray/NearbyVoice_Lvl3.png" preload="false" /> + <texture name="NearbyVoice_On" file_name="bottomtray/NearbyVoice_On.png" preload="false" /> + + <texture name="OptionsMenu_Off" file_name="icons/OptionsMenu_Off.png" preload="false" /> + <texture name="OptionsMenu_Press" file_name="icons/OptionsMenu_Press.png" preload="false" /> + + <texture name="ProgressBar" file_name="widgets/ProgressBar.png" preload="true" scale.left="4" scale.top="10" scale.right="48" scale.bottom="2" /> + <texture name="ProgressTrack" file_name="widgets/ProgressTrack.png" preload="true" scale.left="4" scale.top="13" scale.right="148" scale.bottom="2" /> + + <texture name="PushButton_Off" file_name="widgets/PushButton_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> + <texture name="PushButton_Press" file_name="widgets/PushButton_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> + <texture name="PushButton_Disabled" file_name="widgets/PushButton_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> + <texture name="PushButton_Selected" file_name="widgets/PushButton_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> + <texture name="PushButton_Selected_Press" file_name="widgets/PushButton_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> + <texture name="PushButton_Selected_Disabled" file_name="widgets/PushButton_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" /> + + <texture name="RadioButton_On_Press" file_name="widgets/RadioButton_On_Press.png" preload="true" /> <texture name="RadioButton_Off" file_name="widgets/RadioButton_Off.png" preload="true" /> <texture name="RadioButton_On" file_name="widgets/RadioButton_On.png" preload="true" /> <texture name="RadioButton_Disabled" file_name="widgets/RadioButton_Disabled.png" preload="true" /> <texture name="RadioButton_On_Disabled" file_name="widgets/RadioButton_On_Disabled.png" preload="true" /> - <texture name="ComboButton_Disabled" file_name="widgets/ComboButton_Disabled.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> - <texture name="ComboButton_Over" file_name="widgets/ComboButton_Over.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> - <texture name="ComboButton_Press" file_name="widgets/ComboButton_Press.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> - <texture name="ComboButton_Selected" file_name="widgets/ComboButton_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> - <texture name="ComboButton_Off" file_name="widgets/ComboButton_Off.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + <texture name="Resize_Corner" file_name="windows/Resize_Corner.png" preload="true"/> - <texture name="DropDown_Disabled" file_name="widgets/DropDown_Disabled.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> - <texture name="DropDown_Over" file_name="widgets/DropDown_Over.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> - <texture name="DropDown_Press" file_name="widgets/DropDown_Press.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> - <texture name="DropDown_Selected" file_name="widgets/DropDown_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> - <texture name="DropDown_Off" file_name="widgets/DropDown_Off.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + <texture name="Row_Selection" file_name="navbar/Row_Selection.png" preload="false" /> - <texture name="Resize_Corner" file_name="windows/Resize_Corner.png" preload="true"/> + <texture name="ScrollArrow_Down" file_name="widgets/ScrollArrow_Down.png" preload="true" scale.left="2" scale.top="13" scale.right="13" scale.bottom="2" /> + <texture name="ScrollArrow_Left" file_name="widgets/ScrollArrow_Left.png" preload="true" scale.left="2" scale.top="13" scale.right="13" scale.bottom="2" /> + <texture name="ScrollArrow_Right" file_name="widgets/ScrollArrow_Right.png" preload="true" scale.left="2" scale.top="13" scale.right="13" scale.bottom="2" /> + <texture name="ScrollArrow_Up" file_name="widgets/ScrollArrow_Up.png" preload="true" scale.left="2" scale.top="13" scale.right="13" scale.bottom="2" /> + + <texture name="ScrollThumb_Horiz" file_name="widgets/ScrollThumb_Horiz.png" preload="true" scale.left="0" scale.top="0" scale.bottom="0" scale.right="0" /> + <texture name="ScrollThumb_Vert" file_name="widgets/ScrollThumb_Vert.png" preload="true" scale.left="4" scale.top="53" scale.bottom="10" scale.right="4" /> + <texture name="ScrollTrack_Vert" file_name="widgets/ScrollTrack_Vert.png" preload="true" scale.left="2" scale.top="40" scale.bottom="13" scale.right="0" /> + <texture name="ScrollTrack_Horiz" file_name="widgets/ScrollTrack_Horiz.png" preload="true" scale.left="0" scale.top="0" scale.bottom="0" scale.right="2" /> + + <texture name="Search" file_name="navbar/Search.png" preload="false"/> + + <texture name="SegmentedBtn_Left_Off" file_name="widgets/SegmentedBtn_Left_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Left_Press" file_name="widgets/SegmentedBtn_Left_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Left_Disabled" file_name="widgets/SegmentedBtn_Left_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Left_Selected" file_name="widgets/SegmentedBtn_Left_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Left_Selected_Press" file_name="widgets/SegmentedBtn_Left_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Left_Selected_Disabled" file_name="widgets/SegmentedBtn_Left_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + + <texture name="SegmentedBtn_Middle_Off" file_name="widgets/SegmentedBtn_Middle_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Middle_Press" file_name="widgets/SegmentedBtn_Middle_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Middle_Disabled" file_name="widgets/SegmentedBtn_Middle_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Middle_Selected" file_name="widgets/SegmentedBtn_Middle_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Middle_Selected_Press" file_name="widgets/SegmentedBtn_Middle_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Middle_Selected_Disabled" file_name="widgets/SegmentedBtn_Middle_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + + <texture name="SegmentedBtn_Right_Off" file_name="widgets/SegmentedBtn_Right_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Right_Press" file_name="widgets/SegmentedBtn_Right_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Right_Disabled" file_name="widgets/SegmentedBtn_Right_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Right_Selected" file_name="widgets/SegmentedBtn_Right_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Right_Selected_Press" file_name="widgets/SegmentedBtn_Right_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Right_Selected_Disabled" file_name="widgets/SegmentedBtn_Right_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + + <texture name="SliderTrack_Horiz" file_name="widgets/SliderTrack_Horiz.png" scale.left="4" scale.top="4" scale.right="100" scale.bottom="2" /> + <texture name="SliderTrack_Vert" file_name="widgets/SliderTrack_Vert.png" scale.left="2" scale.top="100" scale.right="4" scale.bottom="4" /> + <texture name="SliderThumb_Off" file_name="widgets/SliderThumb_Off.png" /> + <texture name="SliderThumb_Disabled" file_name="widgets/SliderThumb_Disabled.png" /> + <texture name="SliderThumb_Press" file_name="widgets/SliderThumb_Press.png" /> + + <texture name="Stepper_Down_Disabled" file_name="widgets/Stepper_Down_Disabled.png" preload="true"/> + <texture name="Stepper_Down_Off" file_name="widgets/Stepper_Down_Off.png" preload="true"/> + <texture name="Stepper_Down_Press" file_name="widgets/Stepper_Down_Press.png" preload="true"/> + <texture name="Stepper_Up_Disabled" file_name="widgets/Stepper_Up_Disabled.png" preload="true"/> + <texture name="Stepper_Up_Off" file_name="widgets/Stepper_Up_Off.png" preload="true"/> + <texture name="Stepper_Up_Press" file_name="widgets/Stepper_Up_Press.png" preload="true"/> + + <texture name="TabIcon_Close_Off" file_name="taskpanel/TabIcon_Close_Off.png" preload="false" /> + <texture name="TabIcon_Close_Over" file_name="taskpanel/TabIcon_Close_Over.png" preload="false"/> + <texture name="TabIcon_Home_Off" file_name="taskpanel/TabIcon_Home_Off.png" preload="false" /> + <texture name="TabIcon_Home_Over" file_name="taskpanel/TabIcon_Home_Over.png" preload="false"/> + <texture name="TabIcon_Home_Selected" file_name="taskpanel/TabIcon_Home_Selected.png" preload="false" /> + <texture name="TabIcon_Me_Off" file_name="taskpanel/TabIcon_Me_Off.png" preload="false" /> + <texture name="TabIcon_Me_Over" file_name="taskpanel/TabIcon_Me_Over.png" preload="false"/> + <texture name="TabIcon_Me_Selected" file_name="taskpanel/TabIcon_Me_Selected.png" preload="false" /> + <texture name="TabIcon_Open_Off" file_name="taskpanel/TabIcon_Open_Off.png" preload="false" /> + <texture name="TabIcon_Open_Over" file_name="taskpanel/TabIcon_Open_Over.png" preload="false"/> + <texture name="TabIcon_People_Off" file_name="taskpanel/TabIcon_People_Off.png" preload="false" /> + <texture name="TabIcon_People_Over" file_name="taskpanel/TabIcon_People_Over.png" preload="false"/> + <texture name="TabIcon_People_Selected" file_name="taskpanel/TabIcon_People_Selected.png" preload="false" /> + <texture name="TabIcon_Places_Over" file_name="taskpanel/TabIcon_Places_Over.png" preload="false"/> + <texture name="TabIcon_Places_Off" file_name="taskpanel/TabIcon_Places_Off.png" preload="false" /> + <texture name="TabIcon_Places_Selected" file_name="taskpanel/TabIcon_Places_Selected.png" preload="false" /> + <texture name="TabIcon_Things_Off" file_name="taskpanel/TabIcon_Things_Off.png" preload="false" /> + <texture name="TabIcon_Things_Selected" file_name="taskpanel/TabIcon_Things_Selected.png" preload="false" /> + <texture name="TabIcon_Things_Over" file_name="taskpanel/TabIcon_Things_Over.png" preload="false"/> + + <texture name="TabTop_Divider" file_name="containers/TabTop_Divider.png" preload="false" /> + <texture name="TabTop_Left_Press" file_name="containers/TabTop_Left_Press.png" preload="false" /> + <texture name="TabTop_Middle_Press" file_name="containers/TabTop_Middle_Press.png" preload="false" /> + <texture name="TabTop_Right_Off" file_name="containers/TabTop_Right_Off.png" preload="false" /> + <texture name="TabTop_Right_Press" file_name="containers/TabTop_Right_Press.png" preload="false" /> + <texture name="TabTop_Right_Selected" file_name="containers/TabTop_Right_Selected.png" preload="false" /> + <texture name="TabTop_Middle_Off" file_name="containers/TabTop_Middle_Off.png" preload="false" scale.left="8" scale.top="8" scale.right="120" scale.bottom="9" /> + <texture name="TabTop_Middle_Selected" file_name="containers/TabTop_Middle_Selected.png" preload="false" scale.left="8" scale.top="8" scale.right="96" scale.bottom="9" /> + <texture name="TabTop_Left_Off" file_name="containers/TabTop_Left_Off.png" preload="false" scale.left="8" scale.top="8" scale.right="120" scale.bottom="9"/> + <texture name="TabTop_Left_Selected" file_name="containers/TabTop_Left_Selected.png" preload="false" scale.left="8" scale.top="8" scale.right="96" scale.bottom="9"/> + + <texture name="TaskPanel_Tab_Off" file_name="taskpanel/TaskPanel_Tab_Off.png" preload="false" scale.left="4" scale.top="29" scale.right="36" scale.bottom="4" /> + <texture name="TaskPanel_Tab_Selected" file_name="taskpanel/TaskPanel_Tab_Selected.png" preload="false" scale.left="5" scale.top="30" scale.right="36" scale.bottom="5" /> + <texture name="TaskPanel_BG" file_name="taskpanel/TaskPanel_BG.png" preload="false" scale.left="4" scale.top="146" scale.right="146" scale.bottom="4" /> + <texture name="TaskPanel_Tab_Unselected" file_name="taskpanel/TaskPanel_Tab_Over.png" preload="false" scale.left="5" scale.top="30" scale.right="36" scale.bottom="5" /> + + <texture name="TextField_Search_Disabled" file_name="widgets/TextField_Search_Disabled.png" preload="true" scale.left="4" scale.top="18" scale.right="252" scale.bottom="4" /> + <texture name="TextField_Off" file_name="widgets/TextField_Off.png" preload="true" scale.left="4" scale.top="18" scale.right="252" scale.bottom="4" /> + <texture name="TextField_Search_Active" file_name="widgets/TextField_Search_Active.png" preload="true" scale.left="4" scale.top="18" scale.right="252" scale.bottom="4" /> + <texture name="TextField_Search_Off" file_name="widgets/TextField_Search_Off.png" preload="true" scale.left="4" scale.top="18" scale.right="252" scale.bottom="4" /> + <texture name="TextField_Disabled" file_name="widgets/TextField_Disabled.png" preload="true" scale.left="4" scale.top="18" scale.right="252" scale.bottom="4" /> + <texture name="TextField_Active" file_name="widgets/TextField_Active.png" preload="true" scale.left="4" scale.top="18" scale.right="252" scale.bottom="4" /> + + <texture name="Toast_CloseBtn" file_name="windows/Toast_CloseBtn.png" preload="true" /> + <texture name="Toast" file_name="windows/Toast.png" preload="true" /> + + <texture name="Toolbar_Divider" file_name="containers/Toolbar_Divider.png" preload="false" /> + <texture name="Toolbar_Left_Off" file_name="containers/Toolbar_Left_Off.png" preload="false" /> + <texture name="Toolbar_Left_Press" file_name="containers/Toolbar_Left_Press.png" preload="false" /> + <texture name="Toolbar_Left_Selected" file_name="containers/Toolbar_Left_Selected.png" preload="false" /> + <texture name="Toolbar_Middle_Off" file_name="containers/Toolbar_Middle_Off.png" preload="false" /> + <texture name="Toolbar_Middle_Press" file_name="containers/Toolbar_Middle_Press.png" preload="false" /> + <texture name="Toolbar_Middle_Selected" file_name="containers/Toolbar_Middle_Selected.png" preload="false" /> + <texture name="Toolbar_Right_Off" file_name="containers/Toolbar_Right_Off.png" preload="false" /> + <texture name="Toolbar_Right_Press" file_name="containers/Toolbar_Right_Press.png" preload="false" /> + <texture name="Toolbar_Right_Selected" file_name="containers/Toolbar_Right_Selected.png" preload="false" /> + + <texture name="TrashItem_Off" file_name="icons/TrashItem_Off.png" preload="false" /> + <texture name="TrashItem_Press" file_name="icons/TrashItem_Press.png" preload="false" /> + + <texture name="Unread_IM" file_name="bottomtray/Unread_IM.png" preload="false" /> + <texture name="Unread_Msg" file_name="bottomtray/Unread_Msg.png" preload="false" /> + + <texture name="VoicePTT_Lvl1" file_name="bottomtray/VoicePTT_Lvl1.png" preload="false" /> + <texture name="VoicePTT_Lvl2" file_name="bottomtray/VoicePTT_Lvl2.png" preload="false" /> + <texture name="VoicePTT_Lvl3" file_name="bottomtray/VoicePTT_Lvl3.png" preload="false" /> + <texture name="VoicePTT_Off" file_name="bottomtray/VoicePTT_Off.png" preload="false" /> + <texture name="VoicePTT_On" file_name="bottomtray/VoicePTT_On.png" preload="false" /> + + <texture name="Widget_DownArrow" file_name="icons/Widget_DownArrow.png" preload="true" /> + + <texture name="Window_Background" file_name="windows/Window_Background.png" preload="true" /> + <texture name="Window_Foreground" file_name="windows/Window_Foreground.png" preload="true" /> + + + + + + <!--There are still references to this old textfield art in the code somewhere -erica--> + + <texture name="btn_chatbar.tga" scale.left="20" scale.top="24" scale.right="44" scale.bottom="0"/> + <texture name="btn_chatbar_selected.tga" scale.left="20" scale.top="24" scale.right="44" scale.bottom="0"/> + + <texture name="cam_rotate_out.tga" preload="false"/> + <texture name="cam_rotate_in.tga" preload="false"/> + <texture name="cam_zoom_out.tga" preload="false"/> + <texture name="cam_zoom_plus_in.tga" preload="false"/> + <texture name="cam_zoom_minus_in.tga" preload="false"/> + + <texture name="close_inactive_blue.tga"/> + <texture name="closebox.tga"/> + <texture name="icn_clear_lineeditor.tga" /> + + <texture name="icn_chatbar.tga"/> + <texture name="icn_media-pause.tga"/> + <texture name="icn_media-play.tga"/> + <texture name="icn_music-play.tga"/> + <texture name="icn_music-pause.tga"/> + <texture name="icn_media_web.tga" preload="true"/> + <texture name="icn_media_movie.tga" preload="true"/> + + <texture name="icn_speaker-muted_dark.tga"/> + <texture name="icn_speaker_dark.tga"/> + + <texture name="icn_voice-localchat.tga"/> + <texture name="icn_voice-groupfocus.tga"/> + <texture name="icn_voice-pvtfocus.tga"/> + + <texture name="jump_left_out.tga"/> + <texture name="jump_left_in.tga"/> + <texture name="jump_right_out.tga"/> + <texture name="jump_right_in.tga"/> + + <texture name="move_forward_out.tga" preload="false"/> + <texture name="move_forward_in.tga" preload="false"/> + <texture name="move_left_out.tga" preload="false"/> + <texture name="move_left_in.tga" preload="false"/> + <texture name="move_turn_left_out.tga" preload="false"/> + <texture name="move_turn_left_in.tga" preload="false"/> + <texture name="move_turn_right_out.tga" preload="false"/> + <texture name="move_turn_right_in.tga" preload="false"/> + <texture name="move_right_out.tga" preload="false"/> + <texture name="move_right_in.tga" preload="false"/> + <texture name="move_up_in.tga" preload="false"/> + <texture name="move_up_out.tga" preload="false"/> + <texture name="move_down_in.tga" preload="false"/> + <texture name="move_down_out.tga" preload="false"/> + + <texture name="tool_grab.tga"/> + <texture name="tool_grab_active.tga"/> + + <texture name="tool_face.tga"/> + <texture name="tool_face_active.tga"/> + + <texture name="tool_create.tga"/> + <texture name="tool_create_active.tga"/> + + <texture name="up_arrow.tga" file_name="up_arrow.png"/> + <texture name="down_arrow.tga" file_name="down_arrow.png"/> + + <texture name="restore_inactive.tga"/> + <texture name="restore.tga"/> + <texture name="restore_pressed.tga"/> + + <texture name="tearoffbox.tga"/> + <texture name="tearoff_pressed.tga"/> + + <texture name="icn_label_music.tga"/> + <texture name="icn_label_media.tga"/> + <texture name="arrow_down.tga"/> + <texture name="cloud-particle.j2c" use_mips="true"/> + + <texture name="skin_thumbnail_default.png" preload="false" /> + + <texture name="icn_textfield_enabled.tga" scale.left="5" scale.top="5" scale.bottom="5" scale.right="5"/> + <texture name="icn_rounded-text-field.tga" scale.left="14" scale.bottom="16" scale.top="16" scale.right="114"/> + + <texture name="toolbar_btn_enabled.tga" scale.left="7" scale.top="32" scale.right="121" scale.bottom="0" /> + <texture name="toolbar_btn_disabled.tga" scale.left="7" scale.top="32" scale.right="121" scale.bottom="0" /> + <texture name="toolbar_btn_selected.tga" scale.left="7" scale.top="32" scale.right="121" scale.bottom="0" /> + + <texture name="minimize_inactive.tga" preload="true"/> + <texture name="minimize.tga" preload="true" /> + <texture name="minimize_pressed.tga" preload="true"/> + <texture name="sm_rounded_corners_simple.tga" scale.left="4" scale.top="4" scale.bottom="4" scale.right="4"/> + <texture name="rounded_square.tga" file_name="rounded_square.j2c" preload="true" scale.left="16" scale.top="16" scale.right="112" scale.bottom="16" /> <texture name="rounded_square_soft.tga" file_name="rounded_square_soft.j2c" preload="true" scale.left="16" scale.top="16" scale.right="112" scale.bottom="16"/> @@ -160,20 +341,8 @@ <texture name="toolbar_tab.tga" preload="true" scale.left="6" scale.top="42" scale.right="104" scale.bottom="8"/> <texture name="toolbar_bg.tga" preload="true" scale.left="6" scale.top="42" scale.right="96" scale.bottom="16"/> - <texture name="ProgressBar" file_name="widgets/ProgressBar.png" preload="true" scale.left="4" scale.top="10" scale.right="48" scale.bottom="2" /> - <texture name="ProgressTrack" file_name="widgets/ProgressTrack.png" preload="true" scale.left="4" scale.top="13" scale.right="148" scale.bottom="2" /> - - <texture name="ScrollArrow_Down" file_name="widgets/ScrollArrow_Down.png" preload="true" scale.left="2" scale.top="13" scale.right="13" scale.bottom="2" /> - <texture name="ScrollArrow_Left" file_name="widgets/ScrollArrow_Left.png" preload="true" scale.left="2" scale.top="13" scale.right="13" scale.bottom="2" /> - <texture name="ScrollArrow_Right" file_name="widgets/ScrollArrow_Right.png" preload="true" scale.left="2" scale.top="13" scale.right="13" scale.bottom="2" /> - <texture name="ScrollArrow_Up" file_name="widgets/ScrollArrow_Up.png" preload="true" scale.left="2" scale.top="13" scale.right="13" scale.bottom="2" /> - - <texture name="TabTop_Middle_Off" file_name="containers/TabTop_Middle_Off.png" preload="true" scale.left="8" scale.top="8" scale.right="120" scale.bottom="9" /> - <texture name="TabTop_Middle_Selected" file_name="containers/TabTop_Middle_Selected.png" preload="true" scale.left="8" scale.top="8" scale.right="96" scale.bottom="9" /> - <texture name="TabTop_Left_Off" file_name="containers/TabTop_Left_Off.png" preload="true" scale.left="8" scale.top="8" scale.right="120" scale.bottom="9"/> - <texture name="TabTop_Left_Selected" file_name="containers/TabTop_Left_Selected.png" preload="true" scale.left="8" scale.top="8" scale.right="96" scale.bottom="9"/> - <texture name="tab_top_blue.tga" preload="true" scale.left="8" scale.top="8" scale.right="120" scale.bottom="9"/> - <texture name="tab_top_selected_blue.tga" preload="true" scale.left="8" scale.top="8" scale.right="96" scale.bottom="9"/> + <texture name="tab_top_blue.tga" preload="false" scale.left="8" scale.top="8" scale.right="120" scale.bottom="9"/> + <texture name="tab_top_selected_blue.tga" preload="false" scale.left="8" scale.top="8" scale.right="96" scale.bottom="9"/> <texture name="startup_logo.j2c" preload="true"/> <texture name="color_swatch_alpha.tga" preload="true"/> @@ -266,8 +435,8 @@ <texture name="media_icon.tga" file_name="icn_label_media.tga" /> <texture name="music_icon.tga" file_name="icn_label_music.tga" /> - <texture name="NoEntryLines" file_name="world/NoEntryLines.png" use_mips="true" preload="true" /> - <texture name="NoEntryPassLines" file_name="world/NoEntryPassLines.png" use_mips="true" preload="true" /> + <texture name="NoEntryLines" file_name="world/NoEntryLines.png" use_mips="true" preload="false" /> + <texture name="NoEntryPassLines" file_name="world/NoEntryPassLines.png" use_mips="true" preload="false" /> <texture name="notify_tip_icon.tga"/> <texture name="notify_caution_icon.tga"/> @@ -342,140 +511,8 @@ <texture name="mute_icon.tga"/> - <texture name="SliderTrack_Horiz" file_name="widgets/SliderTrack_Horiz.png" scale.left="4" scale.top="4" scale.right="100" scale.bottom="2" /> - <texture name="SliderTrack_Vert" file_name="widgets/SliderTrack_Vert.png" scale.left="2" scale.top="100" scale.right="4" scale.bottom="4" /> - <texture name="SliderThumb_Off" file_name="widgets/SliderThumb_Off.png" /> - <texture name="SliderThumb_Disabled" file_name="widgets/SliderThumb_Disabled.png" /> - <texture name="SliderThumb_Press" file_name="widgets/SliderThumb_Press.png" /> - - <texture name="icn_speaker-muted_dark.tga"/> - <texture name="icn_speaker_dark.tga"/> - - <texture name="icn_voice-localchat.tga"/> - <texture name="icn_voice-groupfocus.tga"/> - <texture name="icn_voice-pvtfocus.tga"/> - - <texture name="icn_media-pause.tga"/> - <texture name="icn_media-play.tga"/> - <texture name="icn_music-play.tga"/> - <texture name="icn_music-pause.tga"/> - <texture name="icn_media_web.tga" preload="true"/> - <texture name="icn_media_movie.tga" preload="true"/> - - <texture name="icn_chatbar.tga"/> - <texture name="btn_chatbar.tga" scale.left="20" scale.top="24" scale.right="44" scale.bottom="0"/> - <texture name="btn_chatbar_selected.tga" scale.left="20" scale.top="24" scale.right="44" scale.bottom="0"/> - - <texture name="SegmentedBtn_Left_Off" file_name="widgets/SegmentedBtn_Left_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Left_Press" file_name="widgets/SegmentedBtn_Left_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Left_Disabled" file_name="widgets/SegmentedBtn_Left_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Left_Selected" file_name="widgets/SegmentedBtn_Left_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Left_Selected_Press" file_name="widgets/SegmentedBtn_Left_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Left_Selected_Disabled" file_name="widgets/SegmentedBtn_Left_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - - <texture name="SegmentedBtn_Middle_Off" file_name="widgets/SegmentedBtn_Middle_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Middle_Press" file_name="widgets/SegmentedBtn_Middle_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Middle_Disabled" file_name="widgets/SegmentedBtn_Middle_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Middle_Selected" file_name="widgets/SegmentedBtn_Middle_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Middle_Selected_Press" file_name="widgets/SegmentedBtn_Middle_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Middle_Selected_Disabled" file_name="widgets/SegmentedBtn_Middle_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - - <texture name="SegmentedBtn_Right_Off" file_name="widgets/SegmentedBtn_Right_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Right_Press" file_name="widgets/SegmentedBtn_Right_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Right_Disabled" file_name="widgets/SegmentedBtn_Right_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Right_Selected" file_name="widgets/SegmentedBtn_Right_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Right_Selected_Press" file_name="widgets/SegmentedBtn_Right_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - <texture name="SegmentedBtn_Right_Selected_Disabled" file_name="widgets/SegmentedBtn_Right_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> - - <texture name="move_forward_out.tga" preload="true"/> - <texture name="move_forward_in.tga" preload="true"/> - <texture name="move_left_out.tga" preload="true"/> - <texture name="move_left_in.tga" preload="true"/> - <texture name="move_turn_left_out.tga" preload="true"/> - <texture name="move_turn_left_in.tga" preload="true"/> - <texture name="move_turn_right_out.tga" preload="true"/> - <texture name="move_turn_right_in.tga" preload="true"/> - <texture name="move_right_out.tga" preload="true"/> - <texture name="move_right_in.tga" preload="true"/> - <texture name="move_up_in.tga" preload="true"/> - <texture name="move_up_out.tga" preload="true"/> - <texture name="move_down_in.tga" preload="true"/> - <texture name="move_down_out.tga" preload="true"/> - - <texture name="cam_rotate_out.tga" preload="true"/> - <texture name="cam_rotate_in.tga" preload="true"/> - <texture name="cam_zoom_out.tga" preload="true"/> - <texture name="cam_zoom_plus_in.tga" preload="true"/> - <texture name="cam_zoom_minus_in.tga" preload="true"/> - - <texture name="jump_left_out.tga"/> - <texture name="jump_left_in.tga"/> - <texture name="jump_right_out.tga"/> - <texture name="jump_right_in.tga"/> - - <texture name="tool_grab.tga"/> - <texture name="tool_grab_active.tga"/> - - <texture name="tool_face.tga"/> - <texture name="tool_face_active.tga"/> - - <texture name="tool_create.tga"/> - <texture name="tool_create_active.tga"/> - - <texture name="close_inactive_blue.tga"/> - <texture name="closebox.tga"/> - <texture name="icn_clear_lineeditor.tga" /> - - <texture name="up_arrow.tga" file_name="up_arrow.png"/> - <texture name="down_arrow.tga" file_name="down_arrow.png"/> - - <texture name="restore_inactive.tga"/> - <texture name="restore.tga"/> - <texture name="restore_pressed.tga"/> - - <texture name="tearoffbox.tga"/> - <texture name="tearoff_pressed.tga"/> - - <texture name="icn_label_music.tga"/> - <texture name="icn_label_media.tga"/> - <texture name="arrow_down.tga"/> - <texture name="cloud-particle.j2c" use_mips="true"/> - - <texture name="skin_thumbnail_default.png" preload="true" /> - <texture name="default_land_picture.j2c"/> <texture name="default_profile_picture.j2c"/> <texture name="locked_image.j2c"/> - <texture name="menu_separator" file_name="navbar/FileMenu_Divider.png" scale.left="4" scale.top="166" scale.right="0" scale.bottom="0" /> - <texture name="TaskPanel_Tab_Off" file_name="taskpanel/TaskPanel_Tab_Off.png" preload="true" scale.left="4" scale.top="29" scale.right="36" scale.bottom="4" /> - <texture name="TaskPanel_Tab_Selected" file_name="taskpanel/TaskPanel_Tab_Selected.png" preload="true" scale.left="5" scale.top="30" scale.right="36" scale.bottom="5" /> - <texture name="TaskPanel_BG" file_name="taskpanel/TaskPanel_BG.png" preload="true" scale.left="4" scale.top="146" scale.right="146" scale.bottom="4" /> - <texture name="TaskPanel_Tab_Unselected" file_name="taskpanel/TaskPanel_Tab_Over.png" preload="true" scale.left="5" scale.top="30" scale.right="36" scale.bottom="5" /> - - <texture name="Arrow_Left_Off" file_name="navbar/Arrow_Left_Off.png" preload="true"/> - <texture name="Arrow_Left_Press" file_name="navbar/Arrow_Left_Press.png" preload="true"/> - <texture name="Arrow_Right_Off" file_name="navbar/Arrow_Right_Off.png" preload="true"/> - <texture name="Arrow_Right_Press" file_name="navbar/Arrow_Right_Press.png" preload="true"/> - <texture name="Home_Off" file_name="navbar/Home_Off.png" preload="true"/> - <texture name="Home_Press" file_name="navbar/Home_Press.png" preload="true"/> - <texture name="Info_Off" file_name="navbar/Info_Off.png" preload="true"/> - <texture name="Info_Press" file_name="navbar/Info_Press.png" preload="true"/> - <texture name="Favorite_Star_Over" file_name="navbar/Favorite_Star_Over.png" preload="true"/> - <texture name="History_Arrow" file_name="navbar/History_Arrow.png" preload="true"/> - <texture name="Search" file_name="navbar/Search.png" preload="true"/> - <texture name="Help_Off" file_name="navbar/Help_Off.png" preload="true"/> - <texture name="Help_Press" file_name="navbar/Help_Press.png" preload="true"/> - - <texture name="Icon_Gear_Background" file_name="windows/Icon_Gear_Background.png" preload="true"/> - <texture name="Icon_Gear_Foreground" file_name="windows/Icon_Gear_Foreground.png" preload="true"/> - <texture name="Icon_Gear_Press" file_name="windows/Icon_Gear_Press.png" preload="true"/> - <texture name="Stepper_Down_Disabled" file_name="widgets/Stepper_Down_Disabled.png" preload="true"/> - <texture name="Stepper_Down_Off" file_name="widgets/Stepper_Down_Off.png" preload="true"/> - <texture name="Stepper_Down_Press" file_name="widgets/Stepper_Down_Press.png" preload="true"/> - <texture name="Stepper_Up_Disabled" file_name="widgets/Stepper_Up_Disabled.png" preload="true"/> - <texture name="Stepper_Up_Off" file_name="widgets/Stepper_Up_Off.png" preload="true"/> - <texture name="Stepper_Up_Press" file_name="widgets/Stepper_Up_Press.png" preload="true"/> - - <!-- Please add new files alphabetically to prevent merge conflicts. JC --> </textures> diff --git a/indra/newview/skins/default/textures/world/NoEntryLines.png b/indra/newview/skins/default/textures/world/NoEntryLines.png Binary files differindex 5a1f0ea95e..18e270bde5 100644 --- a/indra/newview/skins/default/textures/world/NoEntryLines.png +++ b/indra/newview/skins/default/textures/world/NoEntryLines.png diff --git a/indra/newview/skins/default/xui/da/language_settings.xml b/indra/newview/skins/default/xui/da/language_settings.xml new file mode 100644 index 0000000000..71418d446a --- /dev/null +++ b/indra/newview/skins/default/xui/da/language_settings.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- This file contains strings that used to be hardcoded in the source.--> +<strings> + + <!-- Locale Information --> + <string name="MicrosoftLocale">english</string> + <string name="DarwinLocale">C</string> + <string name="LinuxLocale">C</string> + + <!-- + datetimeToCodes["wkday"] = "%a"; // Thu + datetimeToCodes["weekday"] = "%A"; // Thursday + datetimeToCodes["year4"] = "%Y"; // 2009 + datetimeToCodes["year"] = "%Y"; // 2009 + datetimeToCodes["year2"] = "%y"; // 09 + datetimeToCodes["mth"] = "%b"; // Aug + datetimeToCodes["month"] = "%B"; // August + datetimeToCodes["mthnum"] = "%m"; // 08 + datetimeToCodes["day"] = "%d"; // 31 + datetimeToCodes["hour24"] = "%H"; // 14 + datetimeToCodes["hour"] = "%H"; // 14 + datetimeToCodes["hour12"] = "%I"; // 02 + datetimeToCodes["min"] = "%M"; // 59 + datetimeToCodes["ampm"] = "%p"; // AM + datetimeToCodes["second"] = "%S"; // 59 + datetimeToCodes["timezone"] = "%Z"; // PST + --> + + <string name="TimeHour">hour,datetime,slt</string> + <string name="TimeMin">min,datetime,slt</string> + <string name="TimeYear">year,datetime,slt</string> + <string name="TimeDay">day,datetime,slt</string> + <string name="TimeMonth">mthnum,datetime,slt</string> + <string name="TimeWeek">wkday,datetime,slt</string> + <string name="TimeAMPM">ampm,datetime,slt</string> + <string name="TimeHour12">hour12,datetime,slt</string> + + <string name="LTimeMthNum">mthnum,datetime,local</string> + <string name="LTimeWeek">wkday,datetime,local</string> + <string name="LTimeMonth">mth,datetime,local</string> + <string name="LTimeDay">day,datetime,local</string> + <string name="LTimeSec">second,datetime,local</string> + <string name="LTimeHour">hour,datetime,local</string> + <string name="LTimeMin">min,datetime,local</string> + <string name="LTimeYear">year,datetime,local</string> + + <string name="UTCTimeWeek">weekday,datetime,utc</string> + <string name="UTCTimeDay">day,datetime,utc</string> + <string name="UTCTimeMth">mth,datetime,utc</string> + <string name="UTCTimeYr">year,datetime,utc</string> + <string name="UTCTimeHr">hour,datetime,utc</string> + <string name="UTCTimeMin">min,datetime,utc</string> + <string name="UTCTimeSec">second,datetime,utc</string> + <string name="UTCTimeTimezone">timezone,datetime,utc</string> +</strings> diff --git a/indra/newview/skins/default/xui/de/language_settings.xml b/indra/newview/skins/default/xui/de/language_settings.xml new file mode 100644 index 0000000000..71418d446a --- /dev/null +++ b/indra/newview/skins/default/xui/de/language_settings.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- This file contains strings that used to be hardcoded in the source.--> +<strings> + + <!-- Locale Information --> + <string name="MicrosoftLocale">english</string> + <string name="DarwinLocale">C</string> + <string name="LinuxLocale">C</string> + + <!-- + datetimeToCodes["wkday"] = "%a"; // Thu + datetimeToCodes["weekday"] = "%A"; // Thursday + datetimeToCodes["year4"] = "%Y"; // 2009 + datetimeToCodes["year"] = "%Y"; // 2009 + datetimeToCodes["year2"] = "%y"; // 09 + datetimeToCodes["mth"] = "%b"; // Aug + datetimeToCodes["month"] = "%B"; // August + datetimeToCodes["mthnum"] = "%m"; // 08 + datetimeToCodes["day"] = "%d"; // 31 + datetimeToCodes["hour24"] = "%H"; // 14 + datetimeToCodes["hour"] = "%H"; // 14 + datetimeToCodes["hour12"] = "%I"; // 02 + datetimeToCodes["min"] = "%M"; // 59 + datetimeToCodes["ampm"] = "%p"; // AM + datetimeToCodes["second"] = "%S"; // 59 + datetimeToCodes["timezone"] = "%Z"; // PST + --> + + <string name="TimeHour">hour,datetime,slt</string> + <string name="TimeMin">min,datetime,slt</string> + <string name="TimeYear">year,datetime,slt</string> + <string name="TimeDay">day,datetime,slt</string> + <string name="TimeMonth">mthnum,datetime,slt</string> + <string name="TimeWeek">wkday,datetime,slt</string> + <string name="TimeAMPM">ampm,datetime,slt</string> + <string name="TimeHour12">hour12,datetime,slt</string> + + <string name="LTimeMthNum">mthnum,datetime,local</string> + <string name="LTimeWeek">wkday,datetime,local</string> + <string name="LTimeMonth">mth,datetime,local</string> + <string name="LTimeDay">day,datetime,local</string> + <string name="LTimeSec">second,datetime,local</string> + <string name="LTimeHour">hour,datetime,local</string> + <string name="LTimeMin">min,datetime,local</string> + <string name="LTimeYear">year,datetime,local</string> + + <string name="UTCTimeWeek">weekday,datetime,utc</string> + <string name="UTCTimeDay">day,datetime,utc</string> + <string name="UTCTimeMth">mth,datetime,utc</string> + <string name="UTCTimeYr">year,datetime,utc</string> + <string name="UTCTimeHr">hour,datetime,utc</string> + <string name="UTCTimeMin">min,datetime,utc</string> + <string name="UTCTimeSec">second,datetime,utc</string> + <string name="UTCTimeTimezone">timezone,datetime,utc</string> +</strings> diff --git a/indra/newview/skins/default/xui/en/floater_aaa.xml b/indra/newview/skins/default/xui/en/floater_aaa.xml new file mode 100644 index 0000000000..d2a0193763 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_aaa.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + height="440" + layout="topleft" + name="floater_aaa" + save_rect="true" + title="About [SECOND_LIFE_VIEWER]" + width="470"> + <text_editor + follows="left|top|right|bottom" + height="400" + layout="topleft" + left="6" + max_length="65536" + name="credits_editor" + top="25" + width="458" + word_wrap="true"> + This is line 1a + + + This is line 4 + </text_editor> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_beacons.xml b/indra/newview/skins/default/xui/en/floater_beacons.xml index 049ea9ab14..ea41289769 100644 --- a/indra/newview/skins/default/xui/en/floater_beacons.xml +++ b/indra/newview/skins/default/xui/en/floater_beacons.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater - control_name="BeaconAlwaysOn" height="225" layout="topleft" name="beacons" save_rect="true" + save_visibility="true" + single_instance="true" title="Beacons" width="250"> <panel diff --git a/indra/newview/skins/default/xui/en/floater_buy_currency.xml b/indra/newview/skins/default/xui/en/floater_buy_currency.xml index 245d84fff4..e2bdc756a9 100644 --- a/indra/newview/skins/default/xui/en/floater_buy_currency.xml +++ b/indra/newview/skins/default/xui/en/floater_buy_currency.xml @@ -4,6 +4,7 @@ height="270" layout="topleft" name="buy currency" + single_instance="true" title="Buy Currency" width="350"> <floater.string diff --git a/indra/newview/skins/default/xui/en/floater_buy_land.xml b/indra/newview/skins/default/xui/en/floater_buy_land.xml index ca025346fd..ec52c565ae 100644 --- a/indra/newview/skins/default/xui/en/floater_buy_land.xml +++ b/indra/newview/skins/default/xui/en/floater_buy_land.xml @@ -4,6 +4,7 @@ height="484" layout="topleft" name="buy land" + single_instance="true" title="Buy Land" width="740"> <floater.string diff --git a/indra/newview/skins/default/xui/en/floater_buy_object.xml b/indra/newview/skins/default/xui/en/floater_buy_object.xml index 24010dda93..505411b964 100644 --- a/indra/newview/skins/default/xui/en/floater_buy_object.xml +++ b/indra/newview/skins/default/xui/en/floater_buy_object.xml @@ -7,6 +7,7 @@ min_width="154" name="contents" save_rect="true" + single_instance="true" title="Buy Copy of Object" width="280"> <floater.string diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml index 343ff893e8..1501f39b67 100644 --- a/indra/newview/skins/default/xui/en/floater_camera.xml +++ b/indra/newview/skins/default/xui/en/floater_camera.xml @@ -1,14 +1,15 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater can_minimize="false" + can_close="false" center_horiz="true" follows="top" - height="64" + height="95" layout="topleft" name="camera_floater" save_rect="true" save_visibility="true" - width="176"> + width="105"> <floater.string name="rotate_tooltip"> Rotate Camera Around Focus @@ -21,50 +22,121 @@ name="move_tooltip"> Move Camera Up and Down, Left and Right </floater.string> - <joystick_rotate - follows="top|left" + <panel + border="true" height="64" - image_selected="cam_rotate_in.tga" - image_unselected="cam_rotate_out.tga" layout="topleft" - left="16" - name="cam_rotate_stick" - picture_style="true" - quadrant="left" - scale_image="false" - sound_flags="3" - tool_tip="rotate_tooltip" + left="0" top="0" - width="64" /> - <joystick_zoom - follows="top|left" - height="64" - image_unselected="cam_zoom_out.tga" - layout="topleft" - left_delta="64" - minus_image="cam_zoom_minus_in.tga" - name="zoom" - picture_style="true" - plus_image="cam_zoom_plus_in.tga" - quadrant="left" - scale_image="false" - sound_flags="3" - tool_tip="zoom_tooltip" - top_delta="0" - width="16" /> - <joystick_track - follows="top|left" - height="64" - image_selected="cam_tracking_in.tga" - image_unselected="cam_tracking_out.tga" + name="controls" + width="105"> + <joystick_rotate + follows="top|left" + height="64" + image_selected="cam_rotate_in.tga" + image_unselected="cam_rotate_out.tga" + layout="topleft" + left="2" + name="cam_rotate_stick" + picture_style="true" + quadrant="left" + scale_image="false" + sound_flags="3" + tool_tip="Orbit Camera Around Focus" + top="0" + width="64" /> + <joystick_track + follows="top|left" + height="64" + image_selected="cam_tracking_in.tga" + image_unselected="cam_tracking_out.tga" + layout="topleft" + left="2" + name="cam_track_stick" + picture_style="true" + quadrant="left" + scale_image="false" + sound_flags="3" + tool_tip="Move Camera Up and Down, Left and Right" + top="0" + visible="false" + width="64" /> + <joystick_zoom + follows="top|left" + height="64" + image_unselected="cam_zoom_out.tga" + layout="topleft" + left_delta="74" + minus_image="cam_zoom_minus_in.tga" + name="zoom" + picture_style="true" + plus_image="cam_zoom_plus_in.tga" + quadrant="left" + scale_image="false" + sound_flags="3" + tool_tip="Zoom Camera Towards Focus" + top_delta="0" + width="16" /> + </panel> + <panel + border="true" + height="30" layout="topleft" - left_delta="16" - name="cam_track_stick" - picture_style="true" - quadrant="left" - scale_image="false" - sound_flags="3" - tool_tip="move_tooltip" - top_delta="0" - width="64" /> + left="0" + top_pad="1" + name="buttons" + width="105"> + <button + height="25" + label="" + layout="topleft" + left="0" + is_toggle="true" + image_selected="btn_orbit_selected.png" + image_unselected="btn_orbit_unselected.png" + name="orbit_btn" + tab_stop="false" + tool_tip="Orbit Camera" + value="true" + width="25"> + </button> + <button + height="25" + label="" + layout="topleft" + left_pad="1" + is_toggle="true" + image_selected="btn_pan_selected.png" + image_unselected="btn_pan_unselected.png" + name="pan_btn" + tab_stop="false" + tool_tip="Pan Camera" + width="25"> + </button> + <button + height="25" + label="" + layout="topleft" + left_pad="1" + is_toggle="true" + image_selected="btn_freecamera_selected.png" + image_unselected="btn_freecamera_unselected.png" + name="freecamera_btn" + tab_stop="false" + tool_tip="View Object" + width="25"> + </button> + <button + height="25" + label="" + layout="topleft" + left_pad="2" + image_selected="btn_firstperson_selected.png" + image_unselected="btn_firstperson_unselected.png" + name="avatarview_btn" + tab_stop="false" + tool_tip="See as Avatar" + width="25"> + </button> + </panel> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_first_time_tip.xml b/indra/newview/skins/default/xui/en/floater_first_time_tip.xml new file mode 100644 index 0000000000..c16373ba3c --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_first_time_tip.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + can_close="true" + can_minimize="false" + height="250" + layout="topleft" + name="set_name_in_the_cladd" + save_rect="true" + width="300"> + <check_box + height="20" + follows="left|bottom|right" + label="Turn off Quick Tips" + layout="topleft" + left="5" + name="DontShowFirstTimeTip_checkbox" + text_enabled_color="white" + top="225" + width="200" /> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_hud.xml b/indra/newview/skins/default/xui/en/floater_hud.xml index f62b7eece0..73804f90a5 100644 --- a/indra/newview/skins/default/xui/en/floater_hud.xml +++ b/indra/newview/skins/default/xui/en/floater_hud.xml @@ -4,6 +4,8 @@ height="292" layout="topleft" name="floater_hud" + save_rect="true" + save_visibility="true" title="Tutorial" width="362"> <web_browser diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 44c56e4207..4d7fa45a47 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -9,7 +9,7 @@ top="0"
can_dock="true"
can_minimize="false"
- visible="false"
+ visible="true"
width="315">
<layout_stack follows="left|top|right|bottom"
height="235"
diff --git a/indra/newview/skins/default/xui/en/floater_inventory.xml b/indra/newview/skins/default/xui/en/floater_inventory.xml index 6a54c187cb..37c6cbf391 100644 --- a/indra/newview/skins/default/xui/en/floater_inventory.xml +++ b/indra/newview/skins/default/xui/en/floater_inventory.xml @@ -9,6 +9,7 @@ name="Inventory" save_rect="true" save_visibility="true" + single_instance="true" title="Inventory" width="467"> <floater.string diff --git a/indra/newview/skins/default/xui/en/floater_moveview.xml b/indra/newview/skins/default/xui/en/floater_moveview.xml index 7666a2494d..17d12c89b7 100644 --- a/indra/newview/skins/default/xui/en/floater_moveview.xml +++ b/indra/newview/skins/default/xui/en/floater_moveview.xml @@ -1,128 +1,184 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater + can_close="false" can_minimize="false" center_horiz="true" follows="bottom" - height="58" + height="95" layout="topleft" name="move_floater" save_rect="true" save_visibility="true" - width="135"> - <button - follows="left|bottom" - height="25" - image_disabled="move_turn_left_out.tga" - image_disabled_selected="move_turn_left_in.tga" - image_selected="move_turn_left_in.tga" - image_unselected="move_turn_left_out.tga" - layout="topleft" - left="20" - name="turn left btn" - picture_style="true" - scale_image="false" - tool_tip="Turn Left" - top="29" - width="25" /> - <button - follows="left|bottom" - height="25" - image_disabled="move_turn_right_out.tga" - image_disabled_selected="move_turn_right_in.tga" - image_selected="move_turn_right_in.tga" - image_unselected="move_turn_right_out.tga" - layout="topleft" - left_pad="21" - name="turn right btn" - picture_style="true" - scale_image="false" - tool_tip="Turn Right" - top_delta="0" - width="25" /> - <button - follows="left|bottom" - height="25" - image_disabled="move_up_out.tga" - image_disabled_selected="move_up_in.tga" - image_selected="move_up_in.tga" - image_unselected="move_up_out.tga" - layout="topleft" - left="91" - name="move up btn" - picture_style="true" - scale_image="false" - tool_tip="Jump or Fly Up" - top="4" - width="25" /> - <button - follows="left|bottom" - height="25" - image_disabled="move_down_out.tga" - image_disabled_selected="move_down_in.tga" - image_selected="move_down_in.tga" - image_unselected="move_down_out.tga" - layout="topleft" - left_delta="0" - name="move down btn" - picture_style="true" - scale_image="false" - tool_tip="Crouch or Fly Down" - top_delta="25" - width="25" /> - <joystick_slide - follows="left|bottom" - height="25" - image_selected="move_left_in.tga" - image_unselected="move_left_out.tga" - layout="topleft" - left="20" - name="slide left btn" - picture_style="true" - quadrant="left" - scale_image="false" - tool_tip="Move Left" - top="4" - width="25" /> - <joystick_slide - follows="left|bottom" - height="25" - image_selected="move_right_in.tga" - image_unselected="move_right_out.tga" - layout="topleft" - left_pad="21" - name="slide right btn" - picture_style="true" - quadrant="right" - scale_image="false" - tool_tip="Move Right" - top_delta="0" - width="25" /> - <joystick_turn - follows="left|bottom" - height="25" - image_selected="move_forward_in.tga" - image_unselected="move_forward_out.tga" + width="115"> + <string + name="walk_forward_tooltip"> + Walk Forward (press Up Arrow or W) + </string> + <string + name="walk_back_tooltip"> + Walk Backwards (press Down Arrow or S) + </string> + <string + name="run_forward_tooltip"> + Run Forward (press Up Arrow or W) + </string> + <string + name="run_back_tooltip"> + Run Backwards (press Down Arrow or S) + </string> + <string + name="fly_forward_tooltip"> + Fly Forward (press Up Arrow or W) + </string> + <string + name="fly_back_tooltip"> + Fly Backwards (press Down Arrow or S) + </string> + <panel + border="true" + height="70" + follows="left|top" layout="topleft" - left_delta="-21" - name="forward btn" - picture_style="true" - quadrant="up" - scale_image="false" - tool_tip="Move Forward" - top_delta="0" - width="21" /> - <joystick_turn - follows="left|bottom" + left="0" + name="panel_actions" + top="0" + width="115"> + <button + follows="left|bottom" + height="25" + image_selected="move_turn_left_in.tga" + image_unselected="move_turn_left_out.tga" + layout="topleft" + left="10" + name="turn left btn" + picture_style="true" + scale_image="false" + tool_tip="Turn Left (press Left Arrow or A)" + top="35" + width="25" /> + <button + follows="left|bottom" + height="25" + image_selected="move_turn_right_in.tga" + image_unselected="move_turn_right_out.tga" + layout="topleft" + left_pad="45" + name="turn right btn" + picture_style="true" + scale_image="false" + tool_tip="Turn Right (press Right Arrow or D)" + top_delta="0" + width="25" /> + <button + follows="left|bottom" + height="25" + image_selected="move_up_in.tga" + image_unselected="move_up_out.tga" + layout="topleft" + left="10" + name="move up btn" + picture_style="true" + scale_image="false" + tool_tip="Fly Up, Press "E"" + top="4" + width="25" /> + <button + follows="left|bottom" + height="25" + image_selected="move_down_in.tga" + image_unselected="move_down_out.tga" + layout="topleft" + left_pad="45" + name="move down btn" + picture_style="true" + scale_image="false" + tool_tip="Fly Down, Press "C"" + top_delta="0" + width="25" /> + <joystick_turn + follows="left|bottom" + height="25" + image_selected="move_forward_in.tga" + image_unselected="move_forward_out.tga" + layout="topleft" + left="47" + name="forward btn" + picture_style="true" + quadrant="up" + scale_image="false" + tool_tip="Walk Forward (press Up Arrow or W)" + top_delta="10" + width="21" /> + <joystick_turn + follows="left|bottom" + height="25" + image_selected="move_backward_in.tga" + image_unselected="move_backward_out.tga" + layout="topleft" + left_delta="0" + name="backward btn" + picture_style="true" + quadrant="down" + scale_image="false" + tool_tip="Walk Backward (press Down Arrow or S)" + top_delta="30" + width="21" /> + </panel> +<!-- Width and height of this panel should be synchronized with panel_stand_stop_flying.xml --> + <panel + border="true" height="25" - image_selected="move_backward_in.tga" - image_unselected="move_backward_out.tga" layout="topleft" - left_delta="0" - name="backward btn" - picture_style="true" - quadrant="down" - scale_image="false" - tool_tip="Move Backward" - top_delta="25" - width="21" /> + left="0" + name="panel_modes" + top_pad="1" + width="115"> + <button + follows="left|bottom" + height="20" + label="Walk" + layout="topleft" + name="mode_walk_btn" + pad_left="0" + pad_right="0" + tool_tip="Walking Mode" + top="2" + width="43" /> + <button + follows="left|bottom" + font="SansSerifSmall" + height="20" + label="Run" + layout="topleft" + left_pad="0" + name="mode_run_btn" + pad_left="0" + pad_right="0" + tool_tip="Running Mode" + top="2" + width="37" /> + <button + follows="left|bottom" + height="20" + label="Fly" + layout="topleft" + left_pad="0" + name="mode_fly_btn" + pad_left="0" + pad_right="0" + tool_tip="Flying Mode" + top="2" + width="35" /> + <button + visible="false" + follows="left|bottom" + height="20" + label="Stop Flying" + layout="topleft" + left="0" + name="stop_fly_btn" + tool_tip="Stop Flying" + top="2" + width="115" /> + </panel> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_notifications_console.xml b/indra/newview/skins/default/xui/en/floater_notifications_console.xml index 14aa12aed7..34bda53ef1 100644 --- a/indra/newview/skins/default/xui/en/floater_notifications_console.xml +++ b/indra/newview/skins/default/xui/en/floater_notifications_console.xml @@ -5,6 +5,7 @@ layout="topleft" min_height="50" name="notifications_console" + single_instance="true" title="Notifications Console" width="500"> <combo_box diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index 8a76c2167f..d9602c75ee 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -103,66 +103,10 @@ name="advanced2" /> <panel class="panel_preference" - filename="panel_preferences_advanced3.xml" - label="Not in specs" - layout="topleft" - name="advanced3" /> - <panel - class="panel_preference" filename="panel_preferences_advanced4.xml" label="Storage/Kill" layout="topleft" name="advanced4" /> - <!--panel - class="panel_preference" - filename="panel_preferences_network.xml" - label="Network" - layout="topleft" - name="network" /> - <panel - class="panel_preference" - filename="panel_preferences_web.xml" - label="Web" - layout="topleft" - name="web" /> - <panel - class="panel_preference" - filename="panel_preferences_voice.xml" - label="Voice Chat" - layout="topleft" - name="voice" /> - <panel - class="panel_preference" - filename="panel_preferences_skins.xml" - label="Skins" - layout="topleft" - name="skins" /--> </tab_container> - - <!--button - follows="left|bottom" - height="20" - label="About" - label_selected="About" - layout="topleft" - left_delta="-512" - name="About..." - top_delta="0" - width="90"> - <button.commit_callback - function="Floater.Show" - parameter="sl_about" /> - </button--> - <!--bottom" - height="20" - help_url="https://support.secondlife.com/ics/support/default.asp?deptID=4417" - label="Help" - label_selected="Help" - layout="topleft" - left_pad="3" - name="Help" - top_delta="0" - width="90" /--> - - + </floater> diff --git a/indra/newview/skins/default/xui/en/floater_sell_land.xml b/indra/newview/skins/default/xui/en/floater_sell_land.xml index 85e35926ab..cf26b7ab47 100644 --- a/indra/newview/skins/default/xui/en/floater_sell_land.xml +++ b/indra/newview/skins/default/xui/en/floater_sell_land.xml @@ -4,6 +4,7 @@ height="600" layout="topleft" name="sell land" + single_instance="true" title="Sell Land" width="280"> <texture_picker @@ -322,4 +323,4 @@ on parcel will change ownership. name="cancel_btn" top_delta="0" width="90" /> -</floater>
\ No newline at end of file +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_test_widgets.xml b/indra/newview/skins/default/xui/en/floater_test_widgets.xml index c6c561b497..d773e1f2b8 100644 --- a/indra/newview/skins/default/xui/en/floater_test_widgets.xml +++ b/indra/newview/skins/default/xui/en/floater_test_widgets.xml @@ -15,6 +15,7 @@ Otherwise specify location with left and top attributes. --> <floater + can_dock="true" can_resize="true" title="Test Floater" height="500" diff --git a/indra/newview/skins/default/xui/en/language_settings.xml b/indra/newview/skins/default/xui/en/language_settings.xml new file mode 100644 index 0000000000..71418d446a --- /dev/null +++ b/indra/newview/skins/default/xui/en/language_settings.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- This file contains strings that used to be hardcoded in the source.--> +<strings> + + <!-- Locale Information --> + <string name="MicrosoftLocale">english</string> + <string name="DarwinLocale">C</string> + <string name="LinuxLocale">C</string> + + <!-- + datetimeToCodes["wkday"] = "%a"; // Thu + datetimeToCodes["weekday"] = "%A"; // Thursday + datetimeToCodes["year4"] = "%Y"; // 2009 + datetimeToCodes["year"] = "%Y"; // 2009 + datetimeToCodes["year2"] = "%y"; // 09 + datetimeToCodes["mth"] = "%b"; // Aug + datetimeToCodes["month"] = "%B"; // August + datetimeToCodes["mthnum"] = "%m"; // 08 + datetimeToCodes["day"] = "%d"; // 31 + datetimeToCodes["hour24"] = "%H"; // 14 + datetimeToCodes["hour"] = "%H"; // 14 + datetimeToCodes["hour12"] = "%I"; // 02 + datetimeToCodes["min"] = "%M"; // 59 + datetimeToCodes["ampm"] = "%p"; // AM + datetimeToCodes["second"] = "%S"; // 59 + datetimeToCodes["timezone"] = "%Z"; // PST + --> + + <string name="TimeHour">hour,datetime,slt</string> + <string name="TimeMin">min,datetime,slt</string> + <string name="TimeYear">year,datetime,slt</string> + <string name="TimeDay">day,datetime,slt</string> + <string name="TimeMonth">mthnum,datetime,slt</string> + <string name="TimeWeek">wkday,datetime,slt</string> + <string name="TimeAMPM">ampm,datetime,slt</string> + <string name="TimeHour12">hour12,datetime,slt</string> + + <string name="LTimeMthNum">mthnum,datetime,local</string> + <string name="LTimeWeek">wkday,datetime,local</string> + <string name="LTimeMonth">mth,datetime,local</string> + <string name="LTimeDay">day,datetime,local</string> + <string name="LTimeSec">second,datetime,local</string> + <string name="LTimeHour">hour,datetime,local</string> + <string name="LTimeMin">min,datetime,local</string> + <string name="LTimeYear">year,datetime,local</string> + + <string name="UTCTimeWeek">weekday,datetime,utc</string> + <string name="UTCTimeDay">day,datetime,utc</string> + <string name="UTCTimeMth">mth,datetime,utc</string> + <string name="UTCTimeYr">year,datetime,utc</string> + <string name="UTCTimeHr">hour,datetime,utc</string> + <string name="UTCTimeMin">min,datetime,utc</string> + <string name="UTCTimeSec">second,datetime,utc</string> + <string name="UTCTimeTimezone">timezone,datetime,utc</string> +</strings> diff --git a/indra/newview/skins/default/xui/en/menu_navbar.xml b/indra/newview/skins/default/xui/en/menu_navbar.xml index 013136a593..435d928f00 100644 --- a/indra/newview/skins/default/xui/en/menu_navbar.xml +++ b/indra/newview/skins/default/xui/en/menu_navbar.xml @@ -8,14 +8,17 @@ top="624" visible="false" width="128"> - <menu_item_call - label="Copy SLurl to Clipboard" - layout="topleft" - name="Copy SLURL"> - <menu_item_call.on_click - function="Navbar.Action" - parameter="copy_url" /> - </menu_item_call> + <menu_item_check + label="Show Coordinates" + layout="topleft" + name="Show Coordinates"> + <menu_item_check.on_click + function="Navbar.Action" + parameter="show_coordinates" /> + <menu_item_check.on_check + function="Navbar.EnableMenuItem" + parameter="show_coordinates" /> + </menu_item_check> <menu_item_call label="Add Landmark..." layout="topleft" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index fe1baf22d0..44565333e5 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -51,7 +51,7 @@ name="My Land"> <menu_item_call.on_click function="ShowFloater" - parameter="my land" /> + parameter="land_holdings" /> </menu_item_call> <menu_item_call label="Buy Land" @@ -405,6 +405,15 @@ function="Floater.Show" parameter="hud" /> </menu_item_call> + <menu_item_check + label="Show Quick Tips" + layout="topleft" + name="Show Quick Tips"> + <menu_item_check.on_check + function="Help.CheckShowFirstTimeTip" /> + <menu_item_check.on_click + function="Help.ShowQuickTips" /> + </menu_item_check> <menu_item_separator layout="topleft" /> <menu_item_call @@ -2670,6 +2679,14 @@ function="Advanced.WebBrowserTest" /> </menu_item_call> <menu_item_call + label="Simple Web Browser Test" + layout="topleft" + name="Simple Web Browser Test"> + <menu_item_call.on_click + function="Floater.Show" + parameter="html_simple.http://www.secondlife.com" /> + </menu_item_call> + <menu_item_call label="Buy Currency Test" layout="topleft" name="Buy Currency Test"> diff --git a/indra/newview/skins/default/xui/en/panel_avatar_tag.xml b/indra/newview/skins/default/xui/en/panel_avatar_tag.xml new file mode 100644 index 0000000000..34b4736979 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_avatar_tag.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<panel + name="avatar_tag_notification" + top="10" + width="250" + height="100" + background_opaque="false" + background_visible="true" + follows="left|top|bottom|right" + bg_alpha_color="0.3 0.3 0.3 1.0"> + <panel + width="250" + height="30" + background_visible="true" + background_opaque="false" + follows="left|top|right" + bg_alpha_color="0.0 0.0 0.0 1.0" + name="msg_caption"> + <avatar_icon + top="-7" + left="10" + width="20" + height="20" + follows="left|top" + color="1 1 1 1" + enabled="true" + name="avatar_tag_icon"/> + <text + width="160" + top="-10" + left="40" + height="20" + follows="left|right|top" + font="SansSerifBigBold" + text_color="white" + word_wrap="true" + mouse_opaque="true" + name="sender_tag_name" > + Angela Tester + </text> + <text + width="30" + top="-12" + left="210" + height="20" + follows="right|top" + text_color="white" + word_wrap="true" + mouse_opaque="true" + name="tag_time" > + 07:52 + </text> + </panel> + <text_editor + top="65" + left="10" + right="-10" + can_resize="true" + height="100" + follows="left|top|bottom|right" + font="SansSerifSmall" + read_only="true" + bg_readonly_color="0 0 0 0" + hide_scrollbar="true" + word_wrap="true" + mouse_opaque="true" + name="msg_text" > + The quick brown fox jumps over the lazy dog. + </text_editor> +</panel> + diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml index d42943d225..4c880f6dc0 100644 --- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml @@ -55,8 +55,8 @@ left="0" name="DUMMY" top="0" - width="5" - min_width="5"/> + width="3" + min_width="3"/> <layout_panel auto_resize="false" follows="right" @@ -64,19 +64,116 @@ layout="topleft" left="5" min_height="28" - width="90" + width="70" top_delta="-10" - min_width="90" + min_width="70" user_resize="false"> <button - bottom="22" follows="right" height="20" - label="Stand Up" + is_toggle="true" + label="Move" + layout="topleft" + name="movement_btn" + tab_stop="false" + tool_tip="Shows/Hide Movement controls" + top="6" + width="70"> + <button.init_callback + function="Button.SetFloaterToggle" + parameter="moveview" /> + </button> + </layout_panel> + <icon + auto_resize="false" + color="0 0 0 0" + follows="left|right" + height="10" + image_name="spacer24.tga" + layout="topleft" + left="0" + name="DUMMY" + top="0" + width="8" + min_width="8"/> + <layout_panel + auto_resize="false" + follows="right" + height="28" + layout="topleft" + min_height="28" + min_width="150" + top_delta="-10" + width="150"> + <split_button + follows="right" + height="18" + name="presets" + top="6" + width="35"> + <split_button.arrow_button + image_selected="camera_presets/camera_presets_arrow.png" + image_unselected="camera_presets/camera_presets_arrow.png" + image_disabled_selected="camera_presets/camera_presets_arrow.png" + image_disabled="camera_presets/camera_presets_arrow.png" + tool_tip="Camera Presets" + /> + <split_button.item + image_selected="camera_presets/camera_presets_rear_view.png" + image_unselected="camera_presets/camera_presets_rear_view.png" + name="rear_view" + tool_tip="Rear View" + /> + <split_button.item + image_selected="camera_presets/camera_presets_34_view.png" + image_unselected="camera_presets/camera_presets_34_view.png" + name="3/4_view" + tool_tip="3/4 View" + /> + <split_button.item + image_selected="camera_presets/camera_presets_fron_view.png" + image_unselected="camera_presets/camera_presets_fron_view.png" + name="front_view" + tool_tip="Front View" + /> + </split_button> + <button + follows="right" + height="20" + is_toggle="true" + label="Camera" layout="topleft" - name="stand" - top="3" - width="90" /> + left_pad="0" + tab_stop="false" + tool_tip="Shows/Hide Camera controls" + top="6" + name="camera_btn" + width="70"> + <button.init_callback + function="Button.SetFloaterToggle" + parameter="camera" /> + </button> + <split_button + arrow_position="right" + follows="right" + height="18" + left_pad="0" + name="snapshots" + top="6" + width="35"> + <split_button.arrow_button + image_selected="camera_presets/camera_presets_arrow_right.png" + image_unselected="camera_presets/camera_presets_arrow_right.png" + image_disabled_selected="camera_presets/camera_presets_arrow_right.png" + image_disabled="camera_presets/camera_presets_arrow_right.png" + tool_tip="Snapshot Settings" /> + /> + <split_button.item + image_selected="camera_presets/camera_presets_snapshot.png" + image_unselected="camera_presets/camera_presets_snapshot.png" + name="snapshot" + tool_tip="Take Snapshot" /> + </split_button> </layout_panel> <icon auto_resize="false" diff --git a/indra/newview/skins/default/xui/en/panel_edit_profile.xml b/indra/newview/skins/default/xui/en/panel_edit_profile.xml index 26354ce611..b0f8052a9c 100644 --- a/indra/newview/skins/default/xui/en/panel_edit_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_edit_profile.xml @@ -155,8 +155,8 @@ type="string" length="1" follows="left|top|right" - font="SansSerif" - height="45" + font="SansSerifSmall" + height="120" layout="topleft" left="9" name="sl_description_edit" @@ -182,8 +182,8 @@ type="string" length="1" follows="left|top|right" - font="SansSerif" - height="45" + font="SansSerifSmall" + height="120" layout="topleft" left="9" name="fl_description_edit" @@ -209,7 +209,7 @@ follows="left|top|right" font="SansSerif" font.style="UNDERLINE" - height="15" + height="20" layout="topleft" left="9" name="homepage_edit" diff --git a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml index c9a0b6bc38..4904a0d40a 100644 --- a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml @@ -11,7 +11,7 @@ <button follows="left|top" font="SansSerifSmall" - height="20" + height="23" image_disabled="PushButton_Disabled" image_disabled_selected="PushButton_Disabled" image_overlay="Arrow_Left_Off" @@ -19,17 +19,17 @@ image_unselected="PushButton_Off" hover_glow_amount="0.15" layout="topleft" - left="5" + left="10" name="back_btn" picture_style="true" tool_tip="Go back to previous location" top="8" - width="20" /> + width="31" /> <button follows="left|top" font="SansSerifSmall" - height="20" + height="23" image_disabled="PushButton_Disabled" image_disabled_selected="PushButton_Disabled" image_overlay="Arrow_Right_Off" @@ -37,16 +37,16 @@ image_unselected="PushButton_Off" hover_glow_amount="0.15" layout="topleft" - left_pad="2" + left_pad="0" name="forward_btn" picture_style="true" tool_tip="Go forward one location" top_delta="0" - width="20" /> + width="31" /> <button follows="left|top" font="SansSerifSmall" - height="20" + height="23" image_disabled="PushButton_Disabled" image_disabled_selected="PushButton_Disabled" image_overlay="Home_Off" @@ -54,24 +54,24 @@ image_unselected="PushButton_Off" hover_glow_amount="0.15" layout="topleft" - left_pad="5" + left_pad="7" name="home_btn" picture_style="true" tool_tip="Teleport to your home location" top_delta="0" - width="20" /> + width="32" /> <location_input follows="left|right|top" halign="right" - height="20" + height="22" label="Location" layout="topleft" - left_pad="5" + left_pad="7" max_chars="254" mouse_opaque="false" name="location_combo" top_delta="0" - width="320"> + width="266"> <!-- *TODO: Delete. Let the location_input use the correct art sizes. <location_input.add_landmark_button height="18" @@ -108,33 +108,17 @@ commit_on_focus_lost="false" follows="right|top" halign="right" - height="20" + height="22" label="Search All" layout="topleft" - left_pad="5" + left_pad="7" mouse_opaque="false" name="search_input" tool_tip="Search All" top_delta="0" - width="135" /> + width="200" /> + - <button - follows="right|top" - font="SansSerifSmall" - height="20" - image_disabled="PushButton_Disabled" - image_disabled_selected="PushButton_Disabled" - image_overlay="Help_Off" - image_selected="PushButton_Selected" - image_unselected="PushButton_Off" - hover_glow_amount="0.15" - layout="topleft" - left_pad="15" - name="help_btn" - picture_style="true" - tool_tip="Help" - top_delta="0" - width="20" /> <favorites_bar follows="left|right|top" diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index f7b2481f1c..6b3f5eaee1 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -7,7 +7,6 @@ height="465" follows="left|top|right|bottom" background_visible="true" - bg_alpha_color="0.3 0.3 0.3 1" label="People" name="people_panel"> <filter_editor @@ -492,16 +491,4 @@ <string name="no_groups"> No groups </string> - <panel - layout="topleft" - name="panel_profile_view" - class="panel_profile_view" - filename="panel_profile_view.xml" - top="0" - left="0" - width="355" - height="465" - follows="left|right|top|bottom" - visible="false" - /> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_places.xml b/indra/newview/skins/default/xui/en/panel_places.xml index c91cb2394c..1a88cc55ec 100644 --- a/indra/newview/skins/default/xui/en/panel_places.xml +++ b/indra/newview/skins/default/xui/en/panel_places.xml @@ -1,52 +1,48 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel background_visible="true" - follows="left|top|right|bottom" + follows="all" height="400" label="Places" layout="topleft" - left="0" min_height="350" min_width="240" name="places panel" - top="400" width="305"> - <panel.string - name="landmarks_tab_title"> - Landmarks - </panel.string> - <panel.string - name="teleport_history_tab_title"> - Teleport History - </panel.string> + <string + name="landmarks_tab_title" + value="Landmarks" /> + <string + name="teleport_history_tab_title" + value="Teleport History" /> <filter_editor + background_image="TextField_Search_Off" follows="left|top|right" + font="SansSerif" height="20" label="Filter" layout="topleft" left="15" name="Filter" - top="3" - width="270" - font="SansSerif" - background_image="TextField_Search_Off" + text_color="black" text_pad_left="23" - text_color="black"/> + top="3" + width="270" /> <button - name="landmark_search" - layout="topleft" - top="5" - left="23" - width="13" - height="13" - scale_image="false" - follows="left|top|right" - font="SansSerifBigBold" - image_selected="Search" - image_unselected="Search" - picture_style="true"/> + follows="left|top|right" + font="SansSerifBigBold" + height="13" + image_selected="Search" + image_unselected="Search" + layout="topleft" + left="23" + name="landmark_search" + picture_style="true" + scale_image="false" + top="5" + width="13" /> <tab_container - follows="left|top|right|bottom" + follows="all" height="326" layout="topleft" left="10" @@ -54,26 +50,42 @@ tab_position="top" top_pad="19" width="280" /> - <panel - class="panel_place_info" - filename="panel_place_info.xml" - follows="left|top|right|bottom" - height="675" + <button + follows="bottom|left" + font="SansSerifSmallBold" + height="25" + image_disabled="widgets/SegmentedBtn_Left_Disabled.png" + image_selected="widgets/SegmentedBtn_Left_Selected.png" + image_unselected="widgets/SegmentedBtn_Left_Off.png" + label="Create" layout="topleft" - left="0" - name="panel_place_info" - top="-310" + left="10" + name="create_landmark_btn" + top_pad="5" visible="false" - width="280" /> + width="60" /> + <button + follows="bottom|left" + font="SansSerifSmallBold" + height="25" + image_disabled="widgets/ComboButton_Disabled.png" + image_selected="widgets/ComboButton_Selected.png" + image_unselected="widgets/ComboButton_Off.png" + label="â–¼" + layout="topleft" + left_pad="0" + name="folder_menu_btn" + visible="false" + width="20" /> <button follows="bottom|left" font="SansSerifSmallBold" height="25" label="Teleport" layout="topleft" - left_delta="10" + left="10" name="teleport_btn" - top_pad="5" + top_delta="0" width="80" /> <button follows="bottom|left" @@ -97,7 +109,6 @@ top_delta="0" width="60" /> <button - enabled="true" follows="bottom|right" font="SansSerifSmallBold" height="25" @@ -107,4 +118,13 @@ name="overflow_btn" top_delta="0" width="30" /> + <panel + class="panel_place_info" + filename="panel_place_info.xml" + follows="all" + layout="topleft" + left="0" + name="panel_place_info" + top="-200" + visible="false" /> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index 624345367f..13efa7bcff 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -10,18 +10,6 @@ name="advanced" top="1" width="517"> - <text - type="string" - text_color="LabelSelectedDisabledColor" - length="1" - follows="left|top" - layout="topleft" - left="8" - name="text status" - top_pad="3" - width="280"> -Beware the Trout! - </text> <!-- ADVANCED --> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml index 70d15c237b..2d42757150 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml @@ -30,7 +30,7 @@ max_chars="135" name="language_combobox" top_pad="10" - width="155"> + width="170"> <combo_box.item enabled="true" label="System Default" @@ -154,7 +154,7 @@ left_delta="50" name="maturity_desired_combobox" top_pad="10" - width="155"> + width="170"> <combo_box.item label="PG, Mature and Adult" name="Desired_Adult" @@ -188,7 +188,7 @@ left_delta="50" name="start_location_combo" top_pad="10" - width="155"> + width="170"> <combo_box.item label="My Last Location" name="MyLastLocation" @@ -221,7 +221,6 @@ width="400"> Name tags: </text> - <!-- THIS IS A NEW RADIO GROUP ADDED BY LIS --> <radio_group control_name="AvatarNameTagMode" height="30" @@ -273,7 +272,7 @@ left_delta="0" name="show_all_title_checkbox" top_pad="5" - width="256" /> + width="300" /> <text type="string" length="1" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml index 563056890a..0c01aec95d 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml @@ -26,7 +26,7 @@ left="30" name="WindowSizeLabel" top="10" - width="128"> + width="300"> Window size: </text> <check_box @@ -37,44 +37,65 @@ left_delta="30" name="windowed mode" top_pad="4" - width="100"> + width="175"> </check_box> - <combo_box + <combo_box visiblity_control="WindowFullScreen" - allow_text_entry="true" - height="16" - layout="topleft" - left_delta="175" - max_chars="100" - name="aspect_ratio" - tool_tip="width / height" - top_delta="0" - width="150"> - <combo_box.item - enabled="true" - label="4:3 (Standard CRT)" - name="item1" - value="1.333333" /> - <combo_box.item - enabled="true" - label="5:4 (1280x1024 LCD)" - name="item2" - value="1.25" /> - <combo_box.item - enabled="true" - label="8:5 (Widescreen)" - name="item3" - value="1.6" /> - <combo_box.item - enabled="true" - label="16:9 (Widescreen)" - name="item4" - value="1.7777777" /> - <combo_box.commit_callback - function="setControlFalse" - parameter="FullScreenAutoDetectAspectRatio" /> - </combo_box> - <text + allow_text_entry="false" + enabled="true" + layout="topleft" + height="18" + left_delta="220" + max_chars="20" + mouse_opaque="true" + name="windowsize combo" + top_delta="-1" + width="150"> + <combo_box.item + type="string" + length="1" + enabled="true" + name="640x480" + value="640 x 480"> + 640x480 + </combo_box.item> + <combo_box.item + type="string" + length="1" + enabled="true" + name="800x600" + value="800 x 600"> + 800x600 + </combo_box.item> + <combo_box.item + type="string" + length="1" + enabled="true" + name="720x480" + value="720 x 480"> + 720x480 (NTSC) + </combo_box.item> + <combo_box.item + type="string" + length="1" + enabled="true" + name="768x576" + value="768 x 576"> + 768x576 (PAL) + </combo_box.item> + <combo_box.item + type="string" + length="1" + enabled="true" + name="1024x768" + value="1024 x 768"> + 1024x768 + </combo_box.item> + <combo_box.commit_callback + function="setControlFalse" + parameter="FullScreenAutoDetectAspectRatio" /> + </combo_box> + <text type="string" length="1" follows="left|top" @@ -83,7 +104,7 @@ left="30" name="UI Size:" top_pad="4" - width="100"> + width="300"> UI Size: </text> <slider @@ -148,7 +169,7 @@ left_delta="360" name="BetterText" top_delta="0" - width="80"> + width="100"> Better </text> <icon @@ -428,30 +449,7 @@ name="AvatarCloth" top_pad="1" width="256" /> - <text - type="string" - length="1" - follows="left|top" - height="12" - layout="topleft" - left="457" - name="DrawDistanceMeterText1" - top="3" - width="128"> - m - </text> - <text - type="string" - length="1" - follows="left|top" - height="12" - layout="topleft" - left_delta="6" - name="DrawDistanceMeterText2" - top_delta="0" - width="128"> - m - </text> + <slider control_name="RenderFarClip" decimal_digits="0" @@ -462,15 +460,27 @@ label="Draw Distance:" label_width="140" layout="topleft" - left_delta="-248" + left="216" max_val="512" min_val="64" name="DrawDistance" - top_delta="0" + top="3" width="255"> <slider.commit_callback function="Pref.UpdateMeterText" /> </slider> + <text + type="string" + length="1" + follows="left|top" + height="12" + layout="topleft" + left_delta="250" + name="DrawDistanceMeterText2" + top_delta="1" + width="128"> + m + </text> <slider control_name="RenderMaxPartCount" decimal_digits="0" @@ -481,10 +491,10 @@ label="Max. Particle Count:" label_width="140" layout="topleft" - left_delta="0" + left="216" max_val="8192" name="MaxParticleCount" - top_pad="4" + top_pad="6" width="262" /> <slider control_name="RenderGlowResolutionPow" @@ -830,10 +840,7 @@ left_pad="35" name="Advanced" top_delta="0" - width="115"> - <button.commit_callback - function="Pref.ChangeCustom" /> - </button> + width="115" /> <button follows="right|bottom" height="20" diff --git a/indra/newview/skins/default/xui/en/panel_profile.xml b/indra/newview/skins/default/xui/en/panel_profile.xml index 4f559394a6..2b21c05283 100644 --- a/indra/newview/skins/default/xui/en/panel_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_profile.xml @@ -438,7 +438,7 @@ left="0" name="status_me_panel" top_pad="20" - width="125"> + width="250"> <text type="string" follows="left|top" diff --git a/indra/newview/skins/default/xui/en/panel_profile_view.xml b/indra/newview/skins/default/xui/en/panel_profile_view.xml index cd46ccb0bc..2466480d16 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_view.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_view.xml @@ -3,12 +3,12 @@ background_visible="true" follows="left|top|right|bottom" height="660" - label="Me" + label="Profile" layout="topleft" left="0" name="panel_target_profile" top="0" - width="305"> + width="250"> <button layout="topleft" name="back" @@ -17,6 +17,7 @@ width="20" height="20" label="" + tab_stop="false" follows="top|left" image_selected="navbar_bg_button.tga" image_unselected="navbar_bg_button.tga" diff --git a/indra/newview/skins/default/xui/en/panel_side_tray.xml b/indra/newview/skins/default/xui/en/panel_side_tray.xml index 096b60adb1..8953633276 100644 --- a/indra/newview/skins/default/xui/en/panel_side_tray.xml +++ b/indra/newview/skins/default/xui/en/panel_side_tray.xml @@ -20,8 +20,6 @@ <panel name="panel_home" filename="panel_sidetray_home_tab.xml" - width="355" - height="465" label="home" border="true" /> @@ -31,21 +29,28 @@ name="sidebar_people" tab_title="People" description="Find your friends, contacts and people nearby." - image="icn_voice-groupfocus.tga" + image="TabIcon_People_Off" mouse_opaque="false" background_opaque="false" background_visible="true" bg_opaque_color="0.5 0.5 0.5 1.0" > + <panel_container + name="panel_container" + > <panel class="panel_people" name="panel_people" filename="panel_people.xml" - width="280" - height="465" - label="People" border="true" /> + <panel + class="panel_profile_view" + name="panel_profile_view" + filename="panel_profile_view.xml" + border="true" + /> + </panel_container> </sidetray_tab> <!-- *TODO Vadim: isn't the sidetray_tab "label" attribute redundant since we have "tab_title" ? --> <sidetray_tab @@ -53,7 +58,7 @@ tab_title="Places" label="Places" description="Find places to go and places you've been." - image="inv_item_landmark.tga" + image="TabIcon_Places_Off" mouse_opaque="false" background_visible="true" bg_opaque_color="0.5 0.5 0.5 1.0" @@ -71,7 +76,7 @@ name="sidebar_me" tab_title="Me" description="Change your profile, your look and quick links to your outfits." - image="icn_voice-pvtfocus.tga" + image="TabIcon_Me_Off" mouse_opaque="false" background_visible="true" bg_opaque_color="0.5 0.5 0.5 1.0" diff --git a/indra/newview/skins/default/xui/en/panel_stand_stop_flying.xml b/indra/newview/skins/default/xui/en/panel_stand_stop_flying.xml new file mode 100644 index 0000000000..445c9cc288 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_stand_stop_flying.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- Width and height of this panel should be synchronized with "panel_modes" in the floater_moveview.xml--> +<panel + height="25" + layout="topleft" + name="panel_stand_stop_flying" + mouse_opaque="false" + visible="false" + width="115"> + <button + follows="left|bottom" + height="20" + label="Stand" + layout="topleft" + name="stand_btn" + tool_tip="Click here to stand up." + top="2" + width="115" /> + <button + follows="left|bottom" + height="20" + label="Stop Flying" + layout="topleft" + name="stop_fly_btn" + tool_tip="Stop Flying" + top="2" + width="115" /> +</panel> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index e5665b0194..bc364687e9 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -335,7 +335,7 @@ <string name="GraphicsQualityHigh">High</string> <!-- mouselook --> - <string name="LeaveMouselook">Press ESC to leave Mouselook.</string> + <string name="LeaveMouselook">Press ESC to return to World View</string> <!-- inventory --> <string name="InventoryNoMatchingItems">No matching items found in inventory.</string> @@ -736,56 +736,4 @@ If you continue to receive this message, contact customer support. <!-- Group Information --> - <!-- Locale Information --> - <string name="MicrosoftLocale">english</string> - <string name="DarwinLocale">C</string> - <string name="LinuxLocale">C</string> - - <!-- - datetimeToCodes["wkday"] = "%a"; // Thu - datetimeToCodes["weekday"] = "%A"; // Thursday - datetimeToCodes["year4"] = "%Y"; // 2009 - datetimeToCodes["year"] = "%Y"; // 2009 - datetimeToCodes["year2"] = "%y"; // 09 - datetimeToCodes["mth"] = "%b"; // Aug - datetimeToCodes["month"] = "%B"; // August - datetimeToCodes["mthnum"] = "%m"; // 08 - datetimeToCodes["day"] = "%d"; // 31 - datetimeToCodes["hour24"] = "%H"; // 14 - datetimeToCodes["hour"] = "%H"; // 14 - datetimeToCodes["hour12"] = "%I"; // 02 - datetimeToCodes["min"] = "%M"; // 59 - datetimeToCodes["ampm"] = "%p"; // AM - datetimeToCodes["second"] = "%S"; // 59 - datetimeToCodes["timezone"] = "%Z"; // PST - --> - - <string name="TimeHour">hour,datetime,slt</string> - <string name="TimeMin">min,datetime,slt</string> - <string name="TimeYear">year,datetime,slt</string> - <string name="TimeDay">day,datetime,slt</string> - <string name="TimeMonth">mthnum,datetime,slt</string> - <string name="TimeWeek">wkday,datetime,slt</string> - <string name="TimeAMPM">ampm,datetime,slt</string> - <string name="TimeHour12">hour12,datetime,slt</string> - - <string name="LTimeMthNum">mthnum,datetime,local</string> - <string name="LTimeWeek">wkday,datetime,local</string> - <string name="LTimeMonth">mth,datetime,local</string> - <string name="LTimeDay">day,datetime,local</string> - <string name="LTimeSec">second,datetime,local</string> - <string name="LTimeHour">hour,datetime,local</string> - <string name="LTimeMin">min,datetime,local</string> - <string name="LTimeYear">year,datetime,local</string> - - <string name="UTCTimeWeek">weekday,datetime,utc</string> - <string name="UTCTimeDay">day,datetime,utc</string> - <string name="UTCTimeMth">mth,datetime,utc</string> - <string name="UTCTimeYr">year,datetime,utc</string> - <string name="UTCTimeHr">hour,datetime,utc</string> - <string name="UTCTimeMin">min,datetime,utc</string> - <string name="UTCTimeSec">second,datetime,utc</string> - <string name="UTCTimeTimezone">timezone,datetime,utc</string> - - </strings> diff --git a/indra/newview/skins/default/xui/en/widgets/combo_box.xml b/indra/newview/skins/default/xui/en/widgets/combo_box.xml index a042a61a26..d7369d0726 100644 --- a/indra/newview/skins/default/xui/en/widgets/combo_box.xml +++ b/indra/newview/skins/default/xui/en/widgets/combo_box.xml @@ -10,8 +10,7 @@ scale_image="true" image_unselected="ComboButton_Off" image_selected="ComboButton_Selected" - image_disabled="ComboButton_Disabled" - image_disabled_selected="ComboButton_Disabled_Selected" /> + image_disabled="ComboButton_Disabled" /> <combo_box.drop_down_button name="Drop Down Button" label="" hover_glow_amount="0.15" @@ -20,8 +19,7 @@ pad_right="24" image_unselected="DropDown_Off" image_selected="DropDown_Selected" - image_disabled="DropDown_Disabled" - image_disabled_selected="DropDown_Disabled_Selected" /> + image_disabled="DropDown_Disabled" /> <combo_box.combo_list bg_writeable_color="MenuDefaultBgColor" /> <combo_box.combo_editor name="Combo Text Entry" select_on_focus="true" diff --git a/indra/newview/skins/default/xui/en/widgets/filter_editor.xml b/indra/newview/skins/default/xui/en/widgets/filter_editor.xml index f77aa396ec..aef3363259 100644 --- a/indra/newview/skins/default/xui/en/widgets/filter_editor.xml +++ b/indra/newview/skins/default/xui/en/widgets/filter_editor.xml @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<filter_editor select_on_focus="true"
- background="TextField_Search_Off" >
+ background="TextField_Search_Off"
+ background_image_disabled="TextField_Search_Disabled"
+ background_image_focused="TextField_Search_Active">
<clear_filter_button label=""
image_unselected="Icon_Close_Foreground"
image_selected="Icon_Close_Press" />
diff --git a/indra/newview/skins/default/xui/en/widgets/gesture_combo_box.xml b/indra/newview/skins/default/xui/en/widgets/gesture_combo_box.xml index 45b1e1eb9f..17e9a7beb2 100644 --- a/indra/newview/skins/default/xui/en/widgets/gesture_combo_box.xml +++ b/indra/newview/skins/default/xui/en/widgets/gesture_combo_box.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<combo_box font="SansSerifSmall" +<gesture_combo_box font="SansSerifSmall" list_position="below" max_chars="20" follows="right|top"> - <combo_box.combo_button name="Combobox Button" + <gesture_combo_box.combo_button name="Combobox Button" label="" hover_glow_amount="0.15" font="SansSerifSmall" @@ -12,7 +12,7 @@ image_selected="ComboButton_Selected" image_disabled="ComboButton_Disabled" image_disabled_selected="ComboButton_Disabled_Selected" /> - <combo_box.drop_down_button name="Drop Down Button" + <gesture_combo_box.drop_down_button name="Drop Down Button" label="" hover_glow_amount="0.15" font="SansSerifSmall" @@ -22,8 +22,9 @@ image_selected="DropDown_Selected" image_disabled="DropDown_Disabled" image_disabled_selected="DropDown_Disabled_Selected" /> - <combo_box.combo_list bg_writeable_color="white" /> - <combo_box.combo_editor name="Combo Text Entry" + <gesture_combo_box.combo_list bg_writeable_color="MenuDefaultBgColor" /> + <gesture_combo_box.combo_editor name="Combo Text Entry" select_on_focus="true" font="SansSerifSmall" /> -</combo_box> + <gesture_combo_box.item label="Gestures" /> +</gesture_combo_box> diff --git a/indra/newview/skins/default/xui/en/widgets/line_editor.xml b/indra/newview/skins/default/xui/en/widgets/line_editor.xml index 08205cacbc..8b4126952e 100644 --- a/indra/newview/skins/default/xui/en/widgets/line_editor.xml +++ b/indra/newview/skins/default/xui/en/widgets/line_editor.xml @@ -9,7 +9,7 @@ ignore_tab="true" cursor_color="TextCursorColor" text_color="TextFgColor" - text_readonly_color="Green" + text_readonly_color="TextFgReadOnlyColor" text_tentative_color="TextFgTentativeColor" highlight_color="EmphasisColor" preedit_bg_color="White" diff --git a/indra/newview/skins/default/xui/en/widgets/menu.xml b/indra/newview/skins/default/xui/en/widgets/menu.xml index 10bc124ea3..58543338f6 100644 --- a/indra/newview/skins/default/xui/en/widgets/menu.xml +++ b/indra/newview/skins/default/xui/en/widgets/menu.xml @@ -2,5 +2,6 @@ <menu bg_color="MenuDefaultBgColor" bg_visible="true" drop_shadow="true" - tear_off="false"> + tear_off="false" + shortcut_pad="15"> </menu> diff --git a/indra/newview/skins/default/xui/en/widgets/output_monitor.xml b/indra/newview/skins/default/xui/en/widgets/output_monitor.xml index 2f6d808125..505c7ba936 100644 --- a/indra/newview/skins/default/xui/en/widgets/output_monitor.xml +++ b/indra/newview/skins/default/xui/en/widgets/output_monitor.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <output_monitor image_mute="mute_icon.tga" - image_off="icn_voice_ptt-off.tga" - image_on="icn_voice_ptt-on.tga" - image_level_1="icn_voice_ptt-on-lvl1.tga" - image_level_2="icn_voice_ptt-on-lvl2.tga" - image_level_3="icn_voice_ptt-on-lvl3.tga" + image_off="VoicePTT_Off" + image_on="VoicePTT_On" + image_level_1="VoicePTT_Lvl1" + image_level_2="VoicePTT_Lvl2" + image_level_3="VoicePTT_Lvl3" /> diff --git a/indra/newview/skins/default/xui/en/widgets/progress_bar.xml b/indra/newview/skins/default/xui/en/widgets/progress_bar.xml index 39cd464872..339e53fbb8 100644 --- a/indra/newview/skins/default/xui/en/widgets/progress_bar.xml +++ b/indra/newview/skins/default/xui/en/widgets/progress_bar.xml @@ -1,19 +1,10 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <progress_bar image_bar="ProgressTrack" image_fill="ProgressBar" - image_shadow="rounded_square_soft.tga" color_bar.red="0.5764" color_bar.green="0.6627" color_bar.blue="0.8352" color_bar.alpha="1" - color_bar2.red="0.5764" - color_bar2.green="0.6627" - color_bar2.blue="0.8352" - color_bar2.alpha="1" - color_shadow.red="0.2000" - color_shadow.green="0.2000" - color_shadow.blue="0.4000" - color_shadow="1" color_bg.red="0.3254" color_bg.green="0.4000" color_bg.blue="0.5058" diff --git a/indra/newview/skins/default/xui/en/widgets/scroll_bar.xml b/indra/newview/skins/default/xui/en/widgets/scroll_bar.xml index 3b195c6b33..4ad11c41da 100644 --- a/indra/newview/skins/default/xui/en/widgets/scroll_bar.xml +++ b/indra/newview/skins/default/xui/en/widgets/scroll_bar.xml @@ -1,7 +1,9 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<scroll_bar thumb_image="ScrollThumb_Vert" - track_image="ScrollTrack_Vert" - track_color="ScrollbarTrackColor" +<scroll_bar thumb_image_vertical ="ScrollThumb_Vert" + thumb_image_horizontal ="ScrollThumb_Horiz" + track_image_vertical ="ScrollTrack_Vert" + track_image_horizontal ="ScrollTrack_Horiz" + track_color="ScrollbarTrackColor" thumb_color="ScrollbarThumbColor" thickness="15"> <up_button image_unselected="ScrollArrow_Up" diff --git a/indra/newview/skins/default/xui/en/widgets/search_editor.xml b/indra/newview/skins/default/xui/en/widgets/search_editor.xml index 6f557e239d..15b23ea9b3 100644 --- a/indra/newview/skins/default/xui/en/widgets/search_editor.xml +++ b/indra/newview/skins/default/xui/en/widgets/search_editor.xml @@ -1,10 +1,15 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <search_editor + text_pad_left="4" select_on_focus="true" background_image="TextField_Search_Off" background_image_disabled="TextField_Search_Disabled" background_image_focused="TextField_Search_Active" > <search_button label="" + top_pad="4" + left_pad="4" + width="13" + height="13" image_unselected="Search" image_selected="Search" /> </search_editor> diff --git a/indra/newview/skins/default/xui/en/widgets/split_button.xml b/indra/newview/skins/default/xui/en/widgets/split_button.xml new file mode 100644 index 0000000000..b0367b599b --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/split_button.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<split_button
+ font="SansSerifSmall"
+ arrow_position="left"
+ follows="right|top">
+ <split_button.arrow_button
+ name="Arrow Button"
+ label=""
+ font="SansSerifSmall"
+ scale_image="true"
+ image_selected="camera_presets/camera_presets_arrow.png"
+ image_unselected="camera_presets/camera_presets_arrow.png"
+ image_disabled_selected="camera_presets/camera_presets_arrow.png"
+ image_disabled="camera_presets/camera_presets_arrow.png"
+ width="10"/>
+ <split_button.items_panel
+ background_visible="true"
+ border="true"
+ bg_alpha_color="1 1 1 1"
+ bg_opaq_color="1 1 1 1"
+ layout="topleft"
+ name="item_buttons"
+ />
+</split_button>
diff --git a/indra/newview/skins/default/xui/es/language_settings.xml b/indra/newview/skins/default/xui/es/language_settings.xml new file mode 100644 index 0000000000..71418d446a --- /dev/null +++ b/indra/newview/skins/default/xui/es/language_settings.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- This file contains strings that used to be hardcoded in the source.--> +<strings> + + <!-- Locale Information --> + <string name="MicrosoftLocale">english</string> + <string name="DarwinLocale">C</string> + <string name="LinuxLocale">C</string> + + <!-- + datetimeToCodes["wkday"] = "%a"; // Thu + datetimeToCodes["weekday"] = "%A"; // Thursday + datetimeToCodes["year4"] = "%Y"; // 2009 + datetimeToCodes["year"] = "%Y"; // 2009 + datetimeToCodes["year2"] = "%y"; // 09 + datetimeToCodes["mth"] = "%b"; // Aug + datetimeToCodes["month"] = "%B"; // August + datetimeToCodes["mthnum"] = "%m"; // 08 + datetimeToCodes["day"] = "%d"; // 31 + datetimeToCodes["hour24"] = "%H"; // 14 + datetimeToCodes["hour"] = "%H"; // 14 + datetimeToCodes["hour12"] = "%I"; // 02 + datetimeToCodes["min"] = "%M"; // 59 + datetimeToCodes["ampm"] = "%p"; // AM + datetimeToCodes["second"] = "%S"; // 59 + datetimeToCodes["timezone"] = "%Z"; // PST + --> + + <string name="TimeHour">hour,datetime,slt</string> + <string name="TimeMin">min,datetime,slt</string> + <string name="TimeYear">year,datetime,slt</string> + <string name="TimeDay">day,datetime,slt</string> + <string name="TimeMonth">mthnum,datetime,slt</string> + <string name="TimeWeek">wkday,datetime,slt</string> + <string name="TimeAMPM">ampm,datetime,slt</string> + <string name="TimeHour12">hour12,datetime,slt</string> + + <string name="LTimeMthNum">mthnum,datetime,local</string> + <string name="LTimeWeek">wkday,datetime,local</string> + <string name="LTimeMonth">mth,datetime,local</string> + <string name="LTimeDay">day,datetime,local</string> + <string name="LTimeSec">second,datetime,local</string> + <string name="LTimeHour">hour,datetime,local</string> + <string name="LTimeMin">min,datetime,local</string> + <string name="LTimeYear">year,datetime,local</string> + + <string name="UTCTimeWeek">weekday,datetime,utc</string> + <string name="UTCTimeDay">day,datetime,utc</string> + <string name="UTCTimeMth">mth,datetime,utc</string> + <string name="UTCTimeYr">year,datetime,utc</string> + <string name="UTCTimeHr">hour,datetime,utc</string> + <string name="UTCTimeMin">min,datetime,utc</string> + <string name="UTCTimeSec">second,datetime,utc</string> + <string name="UTCTimeTimezone">timezone,datetime,utc</string> +</strings> diff --git a/indra/newview/skins/default/xui/fr/language_settings.xml b/indra/newview/skins/default/xui/fr/language_settings.xml new file mode 100644 index 0000000000..71418d446a --- /dev/null +++ b/indra/newview/skins/default/xui/fr/language_settings.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- This file contains strings that used to be hardcoded in the source.--> +<strings> + + <!-- Locale Information --> + <string name="MicrosoftLocale">english</string> + <string name="DarwinLocale">C</string> + <string name="LinuxLocale">C</string> + + <!-- + datetimeToCodes["wkday"] = "%a"; // Thu + datetimeToCodes["weekday"] = "%A"; // Thursday + datetimeToCodes["year4"] = "%Y"; // 2009 + datetimeToCodes["year"] = "%Y"; // 2009 + datetimeToCodes["year2"] = "%y"; // 09 + datetimeToCodes["mth"] = "%b"; // Aug + datetimeToCodes["month"] = "%B"; // August + datetimeToCodes["mthnum"] = "%m"; // 08 + datetimeToCodes["day"] = "%d"; // 31 + datetimeToCodes["hour24"] = "%H"; // 14 + datetimeToCodes["hour"] = "%H"; // 14 + datetimeToCodes["hour12"] = "%I"; // 02 + datetimeToCodes["min"] = "%M"; // 59 + datetimeToCodes["ampm"] = "%p"; // AM + datetimeToCodes["second"] = "%S"; // 59 + datetimeToCodes["timezone"] = "%Z"; // PST + --> + + <string name="TimeHour">hour,datetime,slt</string> + <string name="TimeMin">min,datetime,slt</string> + <string name="TimeYear">year,datetime,slt</string> + <string name="TimeDay">day,datetime,slt</string> + <string name="TimeMonth">mthnum,datetime,slt</string> + <string name="TimeWeek">wkday,datetime,slt</string> + <string name="TimeAMPM">ampm,datetime,slt</string> + <string name="TimeHour12">hour12,datetime,slt</string> + + <string name="LTimeMthNum">mthnum,datetime,local</string> + <string name="LTimeWeek">wkday,datetime,local</string> + <string name="LTimeMonth">mth,datetime,local</string> + <string name="LTimeDay">day,datetime,local</string> + <string name="LTimeSec">second,datetime,local</string> + <string name="LTimeHour">hour,datetime,local</string> + <string name="LTimeMin">min,datetime,local</string> + <string name="LTimeYear">year,datetime,local</string> + + <string name="UTCTimeWeek">weekday,datetime,utc</string> + <string name="UTCTimeDay">day,datetime,utc</string> + <string name="UTCTimeMth">mth,datetime,utc</string> + <string name="UTCTimeYr">year,datetime,utc</string> + <string name="UTCTimeHr">hour,datetime,utc</string> + <string name="UTCTimeMin">min,datetime,utc</string> + <string name="UTCTimeSec">second,datetime,utc</string> + <string name="UTCTimeTimezone">timezone,datetime,utc</string> +</strings> diff --git a/indra/newview/skins/default/xui/it/language_settings.xml b/indra/newview/skins/default/xui/it/language_settings.xml new file mode 100644 index 0000000000..71418d446a --- /dev/null +++ b/indra/newview/skins/default/xui/it/language_settings.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- This file contains strings that used to be hardcoded in the source.--> +<strings> + + <!-- Locale Information --> + <string name="MicrosoftLocale">english</string> + <string name="DarwinLocale">C</string> + <string name="LinuxLocale">C</string> + + <!-- + datetimeToCodes["wkday"] = "%a"; // Thu + datetimeToCodes["weekday"] = "%A"; // Thursday + datetimeToCodes["year4"] = "%Y"; // 2009 + datetimeToCodes["year"] = "%Y"; // 2009 + datetimeToCodes["year2"] = "%y"; // 09 + datetimeToCodes["mth"] = "%b"; // Aug + datetimeToCodes["month"] = "%B"; // August + datetimeToCodes["mthnum"] = "%m"; // 08 + datetimeToCodes["day"] = "%d"; // 31 + datetimeToCodes["hour24"] = "%H"; // 14 + datetimeToCodes["hour"] = "%H"; // 14 + datetimeToCodes["hour12"] = "%I"; // 02 + datetimeToCodes["min"] = "%M"; // 59 + datetimeToCodes["ampm"] = "%p"; // AM + datetimeToCodes["second"] = "%S"; // 59 + datetimeToCodes["timezone"] = "%Z"; // PST + --> + + <string name="TimeHour">hour,datetime,slt</string> + <string name="TimeMin">min,datetime,slt</string> + <string name="TimeYear">year,datetime,slt</string> + <string name="TimeDay">day,datetime,slt</string> + <string name="TimeMonth">mthnum,datetime,slt</string> + <string name="TimeWeek">wkday,datetime,slt</string> + <string name="TimeAMPM">ampm,datetime,slt</string> + <string name="TimeHour12">hour12,datetime,slt</string> + + <string name="LTimeMthNum">mthnum,datetime,local</string> + <string name="LTimeWeek">wkday,datetime,local</string> + <string name="LTimeMonth">mth,datetime,local</string> + <string name="LTimeDay">day,datetime,local</string> + <string name="LTimeSec">second,datetime,local</string> + <string name="LTimeHour">hour,datetime,local</string> + <string name="LTimeMin">min,datetime,local</string> + <string name="LTimeYear">year,datetime,local</string> + + <string name="UTCTimeWeek">weekday,datetime,utc</string> + <string name="UTCTimeDay">day,datetime,utc</string> + <string name="UTCTimeMth">mth,datetime,utc</string> + <string name="UTCTimeYr">year,datetime,utc</string> + <string name="UTCTimeHr">hour,datetime,utc</string> + <string name="UTCTimeMin">min,datetime,utc</string> + <string name="UTCTimeSec">second,datetime,utc</string> + <string name="UTCTimeTimezone">timezone,datetime,utc</string> +</strings> diff --git a/indra/newview/skins/default/xui/ja/language_settings.xml b/indra/newview/skins/default/xui/ja/language_settings.xml new file mode 100644 index 0000000000..71418d446a --- /dev/null +++ b/indra/newview/skins/default/xui/ja/language_settings.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- This file contains strings that used to be hardcoded in the source.--> +<strings> + + <!-- Locale Information --> + <string name="MicrosoftLocale">english</string> + <string name="DarwinLocale">C</string> + <string name="LinuxLocale">C</string> + + <!-- + datetimeToCodes["wkday"] = "%a"; // Thu + datetimeToCodes["weekday"] = "%A"; // Thursday + datetimeToCodes["year4"] = "%Y"; // 2009 + datetimeToCodes["year"] = "%Y"; // 2009 + datetimeToCodes["year2"] = "%y"; // 09 + datetimeToCodes["mth"] = "%b"; // Aug + datetimeToCodes["month"] = "%B"; // August + datetimeToCodes["mthnum"] = "%m"; // 08 + datetimeToCodes["day"] = "%d"; // 31 + datetimeToCodes["hour24"] = "%H"; // 14 + datetimeToCodes["hour"] = "%H"; // 14 + datetimeToCodes["hour12"] = "%I"; // 02 + datetimeToCodes["min"] = "%M"; // 59 + datetimeToCodes["ampm"] = "%p"; // AM + datetimeToCodes["second"] = "%S"; // 59 + datetimeToCodes["timezone"] = "%Z"; // PST + --> + + <string name="TimeHour">hour,datetime,slt</string> + <string name="TimeMin">min,datetime,slt</string> + <string name="TimeYear">year,datetime,slt</string> + <string name="TimeDay">day,datetime,slt</string> + <string name="TimeMonth">mthnum,datetime,slt</string> + <string name="TimeWeek">wkday,datetime,slt</string> + <string name="TimeAMPM">ampm,datetime,slt</string> + <string name="TimeHour12">hour12,datetime,slt</string> + + <string name="LTimeMthNum">mthnum,datetime,local</string> + <string name="LTimeWeek">wkday,datetime,local</string> + <string name="LTimeMonth">mth,datetime,local</string> + <string name="LTimeDay">day,datetime,local</string> + <string name="LTimeSec">second,datetime,local</string> + <string name="LTimeHour">hour,datetime,local</string> + <string name="LTimeMin">min,datetime,local</string> + <string name="LTimeYear">year,datetime,local</string> + + <string name="UTCTimeWeek">weekday,datetime,utc</string> + <string name="UTCTimeDay">day,datetime,utc</string> + <string name="UTCTimeMth">mth,datetime,utc</string> + <string name="UTCTimeYr">year,datetime,utc</string> + <string name="UTCTimeHr">hour,datetime,utc</string> + <string name="UTCTimeMin">min,datetime,utc</string> + <string name="UTCTimeSec">second,datetime,utc</string> + <string name="UTCTimeTimezone">timezone,datetime,utc</string> +</strings> diff --git a/indra/newview/skins/default/xui/nl/language_settings.xml b/indra/newview/skins/default/xui/nl/language_settings.xml new file mode 100644 index 0000000000..71418d446a --- /dev/null +++ b/indra/newview/skins/default/xui/nl/language_settings.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- This file contains strings that used to be hardcoded in the source.--> +<strings> + + <!-- Locale Information --> + <string name="MicrosoftLocale">english</string> + <string name="DarwinLocale">C</string> + <string name="LinuxLocale">C</string> + + <!-- + datetimeToCodes["wkday"] = "%a"; // Thu + datetimeToCodes["weekday"] = "%A"; // Thursday + datetimeToCodes["year4"] = "%Y"; // 2009 + datetimeToCodes["year"] = "%Y"; // 2009 + datetimeToCodes["year2"] = "%y"; // 09 + datetimeToCodes["mth"] = "%b"; // Aug + datetimeToCodes["month"] = "%B"; // August + datetimeToCodes["mthnum"] = "%m"; // 08 + datetimeToCodes["day"] = "%d"; // 31 + datetimeToCodes["hour24"] = "%H"; // 14 + datetimeToCodes["hour"] = "%H"; // 14 + datetimeToCodes["hour12"] = "%I"; // 02 + datetimeToCodes["min"] = "%M"; // 59 + datetimeToCodes["ampm"] = "%p"; // AM + datetimeToCodes["second"] = "%S"; // 59 + datetimeToCodes["timezone"] = "%Z"; // PST + --> + + <string name="TimeHour">hour,datetime,slt</string> + <string name="TimeMin">min,datetime,slt</string> + <string name="TimeYear">year,datetime,slt</string> + <string name="TimeDay">day,datetime,slt</string> + <string name="TimeMonth">mthnum,datetime,slt</string> + <string name="TimeWeek">wkday,datetime,slt</string> + <string name="TimeAMPM">ampm,datetime,slt</string> + <string name="TimeHour12">hour12,datetime,slt</string> + + <string name="LTimeMthNum">mthnum,datetime,local</string> + <string name="LTimeWeek">wkday,datetime,local</string> + <string name="LTimeMonth">mth,datetime,local</string> + <string name="LTimeDay">day,datetime,local</string> + <string name="LTimeSec">second,datetime,local</string> + <string name="LTimeHour">hour,datetime,local</string> + <string name="LTimeMin">min,datetime,local</string> + <string name="LTimeYear">year,datetime,local</string> + + <string name="UTCTimeWeek">weekday,datetime,utc</string> + <string name="UTCTimeDay">day,datetime,utc</string> + <string name="UTCTimeMth">mth,datetime,utc</string> + <string name="UTCTimeYr">year,datetime,utc</string> + <string name="UTCTimeHr">hour,datetime,utc</string> + <string name="UTCTimeMin">min,datetime,utc</string> + <string name="UTCTimeSec">second,datetime,utc</string> + <string name="UTCTimeTimezone">timezone,datetime,utc</string> +</strings> diff --git a/indra/newview/skins/default/xui/pl/language_settings.xml b/indra/newview/skins/default/xui/pl/language_settings.xml new file mode 100644 index 0000000000..71418d446a --- /dev/null +++ b/indra/newview/skins/default/xui/pl/language_settings.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- This file contains strings that used to be hardcoded in the source.--> +<strings> + + <!-- Locale Information --> + <string name="MicrosoftLocale">english</string> + <string name="DarwinLocale">C</string> + <string name="LinuxLocale">C</string> + + <!-- + datetimeToCodes["wkday"] = "%a"; // Thu + datetimeToCodes["weekday"] = "%A"; // Thursday + datetimeToCodes["year4"] = "%Y"; // 2009 + datetimeToCodes["year"] = "%Y"; // 2009 + datetimeToCodes["year2"] = "%y"; // 09 + datetimeToCodes["mth"] = "%b"; // Aug + datetimeToCodes["month"] = "%B"; // August + datetimeToCodes["mthnum"] = "%m"; // 08 + datetimeToCodes["day"] = "%d"; // 31 + datetimeToCodes["hour24"] = "%H"; // 14 + datetimeToCodes["hour"] = "%H"; // 14 + datetimeToCodes["hour12"] = "%I"; // 02 + datetimeToCodes["min"] = "%M"; // 59 + datetimeToCodes["ampm"] = "%p"; // AM + datetimeToCodes["second"] = "%S"; // 59 + datetimeToCodes["timezone"] = "%Z"; // PST + --> + + <string name="TimeHour">hour,datetime,slt</string> + <string name="TimeMin">min,datetime,slt</string> + <string name="TimeYear">year,datetime,slt</string> + <string name="TimeDay">day,datetime,slt</string> + <string name="TimeMonth">mthnum,datetime,slt</string> + <string name="TimeWeek">wkday,datetime,slt</string> + <string name="TimeAMPM">ampm,datetime,slt</string> + <string name="TimeHour12">hour12,datetime,slt</string> + + <string name="LTimeMthNum">mthnum,datetime,local</string> + <string name="LTimeWeek">wkday,datetime,local</string> + <string name="LTimeMonth">mth,datetime,local</string> + <string name="LTimeDay">day,datetime,local</string> + <string name="LTimeSec">second,datetime,local</string> + <string name="LTimeHour">hour,datetime,local</string> + <string name="LTimeMin">min,datetime,local</string> + <string name="LTimeYear">year,datetime,local</string> + + <string name="UTCTimeWeek">weekday,datetime,utc</string> + <string name="UTCTimeDay">day,datetime,utc</string> + <string name="UTCTimeMth">mth,datetime,utc</string> + <string name="UTCTimeYr">year,datetime,utc</string> + <string name="UTCTimeHr">hour,datetime,utc</string> + <string name="UTCTimeMin">min,datetime,utc</string> + <string name="UTCTimeSec">second,datetime,utc</string> + <string name="UTCTimeTimezone">timezone,datetime,utc</string> +</strings> diff --git a/indra/newview/skins/default/xui/pt/language_settings.xml b/indra/newview/skins/default/xui/pt/language_settings.xml new file mode 100644 index 0000000000..71418d446a --- /dev/null +++ b/indra/newview/skins/default/xui/pt/language_settings.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<!-- This file contains strings that used to be hardcoded in the source.--> +<strings> + + <!-- Locale Information --> + <string name="MicrosoftLocale">english</string> + <string name="DarwinLocale">C</string> + <string name="LinuxLocale">C</string> + + <!-- + datetimeToCodes["wkday"] = "%a"; // Thu + datetimeToCodes["weekday"] = "%A"; // Thursday + datetimeToCodes["year4"] = "%Y"; // 2009 + datetimeToCodes["year"] = "%Y"; // 2009 + datetimeToCodes["year2"] = "%y"; // 09 + datetimeToCodes["mth"] = "%b"; // Aug + datetimeToCodes["month"] = "%B"; // August + datetimeToCodes["mthnum"] = "%m"; // 08 + datetimeToCodes["day"] = "%d"; // 31 + datetimeToCodes["hour24"] = "%H"; // 14 + datetimeToCodes["hour"] = "%H"; // 14 + datetimeToCodes["hour12"] = "%I"; // 02 + datetimeToCodes["min"] = "%M"; // 59 + datetimeToCodes["ampm"] = "%p"; // AM + datetimeToCodes["second"] = "%S"; // 59 + datetimeToCodes["timezone"] = "%Z"; // PST + --> + + <string name="TimeHour">hour,datetime,slt</string> + <string name="TimeMin">min,datetime,slt</string> + <string name="TimeYear">year,datetime,slt</string> + <string name="TimeDay">day,datetime,slt</string> + <string name="TimeMonth">mthnum,datetime,slt</string> + <string name="TimeWeek">wkday,datetime,slt</string> + <string name="TimeAMPM">ampm,datetime,slt</string> + <string name="TimeHour12">hour12,datetime,slt</string> + + <string name="LTimeMthNum">mthnum,datetime,local</string> + <string name="LTimeWeek">wkday,datetime,local</string> + <string name="LTimeMonth">mth,datetime,local</string> + <string name="LTimeDay">day,datetime,local</string> + <string name="LTimeSec">second,datetime,local</string> + <string name="LTimeHour">hour,datetime,local</string> + <string name="LTimeMin">min,datetime,local</string> + <string name="LTimeYear">year,datetime,local</string> + + <string name="UTCTimeWeek">weekday,datetime,utc</string> + <string name="UTCTimeDay">day,datetime,utc</string> + <string name="UTCTimeMth">mth,datetime,utc</string> + <string name="UTCTimeYr">year,datetime,utc</string> + <string name="UTCTimeHr">hour,datetime,utc</string> + <string name="UTCTimeMin">min,datetime,utc</string> + <string name="UTCTimeSec">second,datetime,utc</string> + <string name="UTCTimeTimezone">timezone,datetime,utc</string> +</strings> diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index 5af8acebaf..d3080d6e4a 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -91,15 +91,23 @@ LLURLSimString LLURLSimString::sInstance; bool LLURLSimString::parse() { return true; }
//-----------------------------------------------------------------------------
+#include "llfloaterreg.h"
#include "../llfloatertos.h"
-static LLFloaterTOS::ETOSType gTOSType;
+static std::string gTOSType;
static LLFloaterTOS::YesNoCallback gTOSCallback;
-LLFloaterTOS* LLFloaterTOS::show(LLFloaterTOS::ETOSType type,
- const std::string & message,
- const YesNoCallback& callback)
+
+void LLFloaterTOS::setTOSCallback(YesNoCallback const & callback)
{
- gTOSType = type;
gTOSCallback = callback;
+}
+
+//static
+LLFloater* LLFloaterReg::showInstance(const std::string & name,
+ const LLSD & key,
+ BOOL focus)
+{
+ gTOSType = name;
+ gTOSCallback = LLFloaterTOS::YesNoCallback();
return NULL;
}
@@ -182,7 +190,7 @@ namespace tut gLoginCreds.clear();
gDisconnectCalled = false;
- // gTOSType = -1; // Set to invalid value.
+ gTOSType = ""; // Set to invalid value.
gTOSCallback = 0; // clear the callback.
@@ -271,7 +279,7 @@ namespace tut response["data"]["reason"] = "tos";
gTestPump.post(response);
- ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_TOS);
+ ensure_equals("TOS Dialog type", gTOSType, "message_tos");
ensure("TOS callback given", gTOSCallback != 0);
gTOSCallback(false); // Call callback denying TOS.
ensure("No TOS, failed auth", logininstance->authFailure());
@@ -297,7 +305,7 @@ namespace tut response["data"]["reason"] = "critical"; // Change response to "critical message"
gTestPump.post(response);
- ensure_equals("TOS Dialog type", gTOSType, LLFloaterTOS::TOS_CRITICAL_MESSAGE);
+ ensure_equals("TOS Dialog type", gTOSType, "message_critical");
ensure("TOS callback given", gTOSCallback != 0);
gTOSCallback(true);
ensure_equals("Accepted read critical message", gLoginCreds["params"]["read_critical"].asBoolean(), true);
|