diff options
author | Jonathan Yap <jhwelch@gmail.com> | 2018-01-12 09:08:49 -0500 |
---|---|---|
committer | Jonathan Yap <jhwelch@gmail.com> | 2018-01-12 09:08:49 -0500 |
commit | 1e586749efeeb8c40503330572680a8709ae5487 (patch) | |
tree | 5c1ebee5dbdb5004f354b9fb0837d60f6dd3cfcc /indra/llui | |
parent | 32f16633c77564d567ed0752e56eb38abb916ccd (diff) | |
parent | 1693ccba58eef676df1f91e50627545ac35bb819 (diff) |
STORM-2145 Merge up to viewer-release
Diffstat (limited to 'indra/llui')
60 files changed, 662 insertions, 338 deletions
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 53720a6044..eaf1284237 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -361,6 +361,7 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p) { mStoredOpenCloseState = false; mWasStateStored = false; + mSkipChangesOnNotifyParent = false; mDropdownBGColor = LLColor4::white; LLAccordionCtrlTabHeader::Params headerParams; @@ -691,7 +692,7 @@ S32 LLAccordionCtrlTab::notifyParent(const LLSD& info) mExpandedHeight = height; - if(isExpanded()) + if(isExpanded() && !mSkipChangesOnNotifyParent) { LLRect panel_rect = getRect(); panel_rect.setLeftTopAndSize( panel_rect.mLeft, panel_rect.mTop, panel_rect.getWidth(), height); @@ -822,6 +823,11 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) void LLAccordionCtrlTab::showAndFocusHeader() { + if (!mHeader) + { + return; + } + mHeader->setFocus(true); mHeader->setSelected(mSelectionEnabled); diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index 7a78700e0f..0263bce4be 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -195,6 +195,8 @@ public: void setFitPanel( bool fit ) { mFitPanel = true; } bool getFitParent() const { return mFitPanel; } + void setIgnoreResizeNotification(bool ignore) { mSkipChangesOnNotifyParent = ignore;} + protected: void adjustContainerPanel (const LLRect& child_rect); void adjustContainerPanel (); @@ -235,6 +237,7 @@ private: bool mStoredOpenCloseState; bool mWasStateStored; + bool mSkipChangesOnNotifyParent; bool mSelectionEnabled; diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 8c7df45884..510a2537b9 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -808,11 +808,12 @@ void LLButton::draw() } else { - imagep->draw(0, 0, (enabled ? mImageColor.get() : disabled_color) % alpha ); + S32 y = getLocalRect().getHeight() - imagep->getHeight(); + imagep->draw(0, y, (enabled ? mImageColor.get() : disabled_color) % alpha); if (mCurGlowStrength > 0.01f) { gGL.setSceneBlendType(glow_type); - imagep->drawSolid(0, 0, glow_color % (mCurGlowStrength * alpha)); + imagep->drawSolid(0, y, glow_color % (mCurGlowStrength * alpha)); gGL.setSceneBlendType(LLRender::BT_ALPHA); } } @@ -954,7 +955,8 @@ void LLButton::drawBorder(LLUIImage* imagep, const LLColor4& color, S32 size) } else { - imagep->drawBorder(0, 0, color, size); + S32 y = getLocalRect().getHeight() - imagep->getHeight(); + imagep->drawBorder(0, y, color, size); } } diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 58d80e2687..a668ac1ac6 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -48,10 +48,10 @@ class LLClipboard : public LLSingleton<LLClipboard> { -public: - LLClipboard(); + LLSINGLETON(LLClipboard); ~LLClipboard(); +public: // Clears the clipboard void reset(); // Returns the state of the clipboard so client can know if it has been modified (comparing with tracked state) diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index f2f2145953..8cec5e2b24 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -173,6 +173,9 @@ private: class LLCommandManager : public LLSingleton<LLCommandManager> { + LLSINGLETON(LLCommandManager); + ~LLCommandManager(); + public: struct Params : public LLInitParam::Block<Params> { @@ -184,9 +187,6 @@ public: } }; - LLCommandManager(); - ~LLCommandManager(); - U32 commandCount() const; LLCommand * getCommand(U32 commandIndex); LLCommand * getCommand(const LLCommandId& commandId); diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h index ac92b19977..99267d978a 100644 --- a/indra/llui/llcontainerview.h +++ b/indra/llui/llcontainerview.h @@ -35,7 +35,9 @@ class LLScrollContainer; struct ContainerViewRegistry : public LLChildRegistry<ContainerViewRegistry> -{}; +{ + LLSINGLETON_EMPTY_CTOR(ContainerViewRegistry); +}; class LLContainerView : public LLView { diff --git a/indra/llui/lleditmenuhandler.h b/indra/llui/lleditmenuhandler.h index 0932f094ef..cd4fea8c52 100644 --- a/indra/llui/lleditmenuhandler.h +++ b/indra/llui/lleditmenuhandler.h @@ -58,9 +58,6 @@ public: virtual void deselect() {}; virtual BOOL canDeselect() const { return FALSE; } - - virtual void duplicate() {}; - virtual BOOL canDuplicate() const { return FALSE; } // TODO: Instead of being a public data member, it would be better to hide it altogether // and have a "set" method and then a bunch of static versions of the cut, copy, paste diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 299f5e42d4..5e00bf7f45 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -105,6 +105,81 @@ bool LLFlatListView::addItem(LLPanel * item, const LLSD& value /*= LLUUID::null* return true; } +bool LLFlatListView::addItemPairs(pairs_list_t panel_list, bool rearrange /*= true*/) +{ + if (!mItemComparator) + { + LL_WARNS_ONCE() << "No comparator specified for inserting FlatListView items." << LL_ENDL; + return false; + } + if (panel_list.size() == 0) + { + return false; + } + + // presort list so that it will be easier to sort elements into mItemPairs + panel_list.sort(ComparatorAdaptor(*mItemComparator)); + + pairs_const_iterator_t new_pair_it = panel_list.begin(); + item_pair_t* new_pair = *new_pair_it; + pairs_iterator_t pair_it = mItemPairs.begin(); + item_pair_t* item_pair = *pair_it; + + // sort panel_list into mItemPars + while (new_pair_it != panel_list.end() && pair_it != mItemPairs.end()) + { + if (!new_pair->first || new_pair->first->getParent() == mItemsPanel) + { + // iterator already used or we are reusing existing panel + new_pair_it++; + new_pair = *new_pair_it; + } + else if (mItemComparator->compare(new_pair->first, item_pair->first)) + { + LLPanel* panel = new_pair->first; + + mItemPairs.insert(pair_it, new_pair); + mItemsPanel->addChild(panel); + + //_4 is for MASK + panel->setMouseDownCallback(boost::bind(&LLFlatListView::onItemMouseClick, this, new_pair, _4)); + panel->setRightMouseDownCallback(boost::bind(&LLFlatListView::onItemRightMouseClick, this, new_pair, _4)); + // Children don't accept the focus + panel->setTabStop(false); + } + else + { + pair_it++; + item_pair = *pair_it; + } + } + + // Add what is left of panel_list into the end of mItemPairs. + for (; new_pair_it != panel_list.end(); ++new_pair_it) + { + item_pair_t* item_pair = *new_pair_it; + LLPanel *panel = item_pair->first; + if (panel && panel->getParent() != mItemsPanel) + { + mItemPairs.push_back(item_pair); + mItemsPanel->addChild(panel); + + //_4 is for MASK + panel->setMouseDownCallback(boost::bind(&LLFlatListView::onItemMouseClick, this, item_pair, _4)); + panel->setRightMouseDownCallback(boost::bind(&LLFlatListView::onItemRightMouseClick, this, item_pair, _4)); + // Children don't accept the focus + panel->setTabStop(false); + } + } + + if (rearrange) + { + rearrangeItems(); + notifyParentItemsRectChanged(); + } + return true; +} + bool LLFlatListView::insertItemAfter(LLPanel* after_item, LLPanel* item_to_add, const LLSD& value /*= LLUUID::null*/) { @@ -1289,6 +1364,28 @@ void LLFlatListViewEx::setFilterSubString(const std::string& filter_str) } } +void LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action) +{ + if (!item) return; + + // 0 signifies that filter is matched, + // i.e. we don't hide items that don't support 'match_filter' action, separators etc. + if (0 == item->notify(action)) + { + mHasMatchedItems = true; + item->setVisible(true); + } + else + { + // TODO: implement (re)storing of current selection. + if (!mForceShowingUnmatchedItems) + { + selectItem(item, false); + } + item->setVisible(mForceShowingUnmatchedItems); + } +} + void LLFlatListViewEx::filterItems() { typedef std::vector <LLPanel*> item_panel_list_t; @@ -1309,22 +1406,7 @@ void LLFlatListViewEx::filterItems() iter != iter_end; ++iter) { LLPanel* pItem = (*iter); - // 0 signifies that filter is matched, - // i.e. we don't hide items that don't support 'match_filter' action, separators etc. - if (0 == pItem->notify(action)) - { - mHasMatchedItems = true; - pItem->setVisible(true); - } - else - { - // TODO: implement (re)storing of current selection. - if(!mForceShowingUnmatchedItems) - { - selectItem(pItem, false); - } - pItem->setVisible(mForceShowingUnmatchedItems); - } + updateItemVisibility(pItem, action); } sort(); diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 92bf429031..230ea200d8 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -351,6 +351,8 @@ protected: virtual bool removeItemPair(item_pair_t* item_pair, bool rearrange); + bool addItemPairs(pairs_list_t panel_list, bool rearrange = true); + /** * Notify parent about changed size of internal controls with "size_changes" action * @@ -480,6 +482,7 @@ public: * Sets up new filter string and filters the list. */ void setFilterSubString(const std::string& filter_str); + std::string getFilterSubString() { return mFilterSubString; } /** * Filters the list, rearranges and notifies parent about shape changes. @@ -503,6 +506,14 @@ protected: */ void updateNoItemsMessage(const std::string& filter_string); + /** + * Applies visibility acording to action and LLFlatListView settings. + * + * @param item - item we are changing + * @param item - action - parameters to determin visibility from + */ + void updateItemVisibility(LLPanel* item, const LLSD &action); + private: std::string mNoFilteredItemsMsg; std::string mNoItemsMsg; diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 8b0e19e4f6..e5fe6967d1 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -64,8 +64,6 @@ // use this to control "jumping" behavior when Ctrl-Tabbing const S32 TABBED_FLOATER_OFFSET = 0; -extern LLControlGroup gSavedSettings; - namespace LLInitParam { void TypeValues<LLFloaterEnums::EOpenPositioning>::declareValues() @@ -653,13 +651,7 @@ void LLFloater::openFloater(const LLSD& key) && !getFloaterHost() && (!getVisible() || isMinimized())) { - //Don't play a sound for incoming voice call based upon chat preference setting - bool playSound = !(getName() == "incoming call" && gSavedSettings.getBOOL("PlaySoundIncomingVoiceCall") == FALSE); - - if(playSound) - { - make_ui_sound("UISndWindowOpen"); - } + make_ui_sound("UISndWindowOpen"); } //RN: for now, we don't allow rehosting from one multifloater to another @@ -1153,11 +1145,11 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user) { setDocked( false, false); } - storeRectControl(); mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; LLRect screen_rect = calcScreenRect(); mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); - } + } + storeRectControl(); // gather all snapped dependents for(handle_set_iter_t dependent_it = mDependents.begin(); diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index f9664e0658..895753aeae 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -102,6 +102,18 @@ void LLCloseAllFoldersFunctor::doFolder(LLFolderViewFolder* folder) void LLCloseAllFoldersFunctor::doItem(LLFolderViewItem* item) { } +//--------------------------------------------------------------------------- + +void LLAllDescendentsPassedFilter::doFolder(LLFolderViewFolder* folder) +{ + mAllDescendentsPassedFilter &= (folder) && (folder->passedFilter()) && (folder->descendantsPassedFilter()); +} + +void LLAllDescendentsPassedFilter::doItem(LLFolderViewItem* item) +{ + mAllDescendentsPassedFilter &= (item) && (item->passedFilter()); +} + ///---------------------------------------------------------------------------- /// Class LLFolderViewScrollContainer ///---------------------------------------------------------------------------- diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index b5deefd653..2926e160d0 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -400,6 +400,18 @@ public: virtual void doItem(LLFolderViewItem* item); }; +class LLAllDescendentsPassedFilter : public LLFolderViewFunctor +{ +public: + LLAllDescendentsPassedFilter() : mAllDescendentsPassedFilter(true) {} + /*virtual*/ ~LLAllDescendentsPassedFilter() {} + /*virtual*/ void doFolder(LLFolderViewFolder* folder); + /*virtual*/ void doItem(LLFolderViewItem* item); + bool allDescendentsPassedFilter() const { return mAllDescendentsPassedFilter; } +protected: + bool mAllDescendentsPassedFilter; +}; + // Flags for buildContextMenu() const U32 SUPPRESS_OPEN_ITEM = 0x1; const U32 FIRST_SELECTED_ITEM = 0x2; diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 3d618548c4..0510e472c5 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -1176,6 +1176,11 @@ BOOL LLFolderViewFolder::needsArrange() return mLastArrangeGeneration < getRoot()->getArrangeGeneration(); } +bool LLFolderViewFolder::descendantsPassedFilter(S32 filter_generation) +{ + return getViewModelItem()->descendantsPassedFilter(filter_generation); +} + // Passes selection information on to children and record selection // information if necessary. BOOL LLFolderViewFolder::setSelection(LLFolderViewItem* selection, BOOL openitem, diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 641241a88c..f71a88c56e 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -147,6 +147,10 @@ public: virtual const std::string& getDisplayName() const = 0; virtual const std::string& getSearchableName() const = 0; + virtual std::string getSearchableDescription() const = 0; + virtual std::string getSearchableCreatorName()const = 0; + virtual std::string getSearchableUUIDString() const = 0; + virtual LLPointer<LLUIImage> getIcon() const = 0; virtual LLPointer<LLUIImage> getIconOpen() const { return getIcon(); } virtual LLPointer<LLUIImage> getIconOverlay() const { return NULL; } diff --git a/indra/llui/llfunctorregistry.h b/indra/llui/llfunctorregistry.h index f5364f4863..e43974bc52 100644 --- a/indra/llui/llfunctorregistry.h +++ b/indra/llui/llfunctorregistry.h @@ -53,14 +53,8 @@ template <typename FUNCTOR_TYPE> class LLFunctorRegistry : public LLSingleton<LLFunctorRegistry<FUNCTOR_TYPE> > { - friend class LLSingleton<LLFunctorRegistry>; + LLSINGLETON(LLFunctorRegistry); LOG_CLASS(LLFunctorRegistry); -private: - LLFunctorRegistry() : LOGFUNCTOR("LogFunctor"), DONOTHING("DoNothing") - { - mMap[LOGFUNCTOR] = log_functor; - mMap[DONOTHING] = do_nothing; - } public: typedef FUNCTOR_TYPE ResponseFunctor; @@ -125,6 +119,14 @@ private: }; template <typename FUNCTOR_TYPE> +LLFunctorRegistry<FUNCTOR_TYPE>::LLFunctorRegistry() : + LOGFUNCTOR("LogFunctor"), DONOTHING("DoNothing") +{ + mMap[LOGFUNCTOR] = log_functor; + mMap[DONOTHING] = do_nothing; +} + +template <typename FUNCTOR_TYPE> class LLFunctorRegistration { public: diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index a245ebe1b9..f772dbc6b4 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -40,7 +40,9 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack> public: struct LayoutStackRegistry : public LLChildRegistry<LayoutStackRegistry> - {}; + { + LLSINGLETON_EMPTY_CTOR(LayoutStackRegistry); + }; struct Params : public LLInitParam::Block<Params, LLView::Params> { diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index c89e1dac1d..becb45fa79 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -163,6 +163,9 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) { llassert( mMaxLengthBytes > 0 ); + LLUICtrl::setEnabled(TRUE); + setEnabled(p.enabled); + mScrollTimer.reset(); mTripleClickTimer.reset(); setText(p.default_text()); @@ -218,6 +221,13 @@ LLLineEditor::~LLLineEditor() gFocusMgr.releaseFocusIfNeeded( this ); } +void LLLineEditor::initFromParams(const LLLineEditor::Params& params) +{ + LLUICtrl::initFromParams(params); + LLUICtrl::setEnabled(TRUE); + setEnabled(params.enabled); +} + void LLLineEditor::onFocusReceived() { gEditMenuHandler = this; diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index ccbd305a16..88468503df 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -108,6 +108,9 @@ public: Params(); }; + + void initFromParams(const LLLineEditor::Params& params); + protected: LLLineEditor(const Params&); friend class LLUICtrlFactory; diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 848367f8a8..0d42f726fa 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -1736,6 +1736,7 @@ LLMenuGL::LLMenuGL(const LLMenuGL::Params& p) mJumpKey(p.jump_key), mCreateJumpKeys(p.create_jump_keys), mNeedsArrange(FALSE), + mAlwaysShowMenu(FALSE), mResetScrollPositionOnShow(true), mShortcutPad(p.shortcut_pad) { @@ -3223,20 +3224,23 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) menu->setVisible( TRUE ); - //Do not show menu if all menu items are disabled - BOOL item_enabled = false; - for (LLView::child_list_t::const_iterator itor = menu->getChildList()->begin(); - itor != menu->getChildList()->end(); - ++itor) + if(!menu->getAlwaysShowMenu()) { - LLView *menu_item = (*itor); - item_enabled = item_enabled || menu_item->getEnabled(); - } + //Do not show menu if all menu items are disabled + BOOL item_enabled = false; + for (LLView::child_list_t::const_iterator itor = menu->getChildList()->begin(); + itor != menu->getChildList()->end(); + ++itor) + { + LLView *menu_item = (*itor); + item_enabled = item_enabled || menu_item->getEnabled(); + } - if(!item_enabled) - { - menu->setVisible( FALSE ); - return; + if(!item_enabled) + { + menu->setVisible( FALSE ); + return; + } } // Save click point for detecting cursor moves before mouse-up. @@ -3327,6 +3331,7 @@ BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) if (getHighlightedItem()) { clearHoverItem(); + LLMenuGL::setKeyboardMode(FALSE); } else { @@ -3338,6 +3343,12 @@ BOOL LLMenuBarGL::handleAcceleratorKey(KEY key, MASK mask) return TRUE; } + if (result && !getHighlightedItem() && LLMenuGL::sMenuContainer->hasVisibleMenu()) + { + // close menus originating from other menu bars + LLMenuGL::sMenuContainer->hideMenus(); + } + return result; } @@ -3767,10 +3778,10 @@ BOOL LLMenuHolderGL::hideMenus() { return FALSE; } + LLMenuGL::setKeyboardMode(FALSE); BOOL menu_visible = hasVisibleMenu(); if (menu_visible) { - LLMenuGL::setKeyboardMode(FALSE); // clicked off of menu, hide them all for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it) { diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 628dedb906..69f7d21513 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -347,7 +347,9 @@ private: // child widget registry struct MenuRegistry : public LLChildRegistry<MenuRegistry> -{}; +{ + LLSINGLETON_EMPTY_CTOR(MenuRegistry); +}; class LLMenuGL @@ -529,6 +531,9 @@ public: void resetScrollPositionOnShow(bool reset_scroll_pos) { mResetScrollPositionOnShow = reset_scroll_pos; } bool isScrollPositionOnShowReset() { return mResetScrollPositionOnShow; } + void setAlwaysShowMenu(BOOL show) { mAlwaysShowMenu = show; } + BOOL getAlwaysShowMenu() { return mAlwaysShowMenu; } + // add a context menu branch BOOL appendContextSubMenu(LLMenuGL *menu); @@ -570,6 +575,8 @@ private: static LLColor4 sDefaultBackgroundColor; static BOOL sKeyboardMode; + BOOL mAlwaysShowMenu; + LLUIColor mBackgroundColor; BOOL mBgVisible; LLHandle<LLView> mParentMenuItem; diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 0cb959a315..7bafd711cb 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -67,7 +67,8 @@ LLNotificationForm::FormIgnore::FormIgnore() : text("text"), control("control"), invert_control("invert_control", false), - save_option("save_option", false) + save_option("save_option", false), + session_only("session_only", false) {} LLNotificationForm::FormButton::FormButton() @@ -125,6 +126,7 @@ bool handleIgnoredNotification(const LLSD& payload) switch(form->getIgnoreType()) { case LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE: + case LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE_SESSION_ONLY: response = pNotif->getResponseTemplate(LLNotification::WITH_DEFAULT_BUTTON); break; case LLNotificationForm::IGNORE_WITH_LAST_RESPONSE: @@ -197,7 +199,7 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica if (!p.ignore.save_option) { - mIgnore = IGNORE_WITH_DEFAULT_RESPONSE; + mIgnore = p.ignore.session_only ? IGNORE_WITH_DEFAULT_RESPONSE_SESSION_ONLY : IGNORE_WITH_DEFAULT_RESPONSE; } else { @@ -426,6 +428,7 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mLogToChat(p.log_to_chat), mLogToIM(p.log_to_im), mShowToast(p.show_toast), + mFadeToast(p.fade_toast), mSoundName("") { if (p.sound.isProvided() @@ -942,6 +945,11 @@ bool LLNotification::canShowToast() const return mTemplatep->mShowToast; } +bool LLNotification::canFadeToast() const +{ + return mTemplatep->mFadeToast; +} + bool LLNotification::hasFormElements() const { return mTemplatep->mForm->getNumElements() != 0; @@ -1405,20 +1413,14 @@ void LLNotifications::createDefaultChannels() mDefaultChannels.push_back(new LLPersistentNotificationChannel()); // connect action methods to these channels - LLNotifications::instance().getChannel("Enabled")-> - connectFailedFilter(&defaultResponse); - LLNotifications::instance().getChannel("Expiration")-> - connectChanged(boost::bind(&LLNotifications::expirationHandler, this, _1)); + getChannel("Enabled")->connectFailedFilter(&defaultResponse); + getChannel("Expiration")->connectChanged(boost::bind(&LLNotifications::expirationHandler, this, _1)); // uniqueHandler slot should be added as first slot of the signal due to // usage LLStopWhenHandled combiner in LLStandardSignal - LLNotifications::instance().getChannel("Unique")-> - connectAtFrontChanged(boost::bind(&LLNotifications::uniqueHandler, this, _1)); - LLNotifications::instance().getChannel("Unique")-> - connectFailedFilter(boost::bind(&LLNotifications::failedUniquenessTest, this, _1)); - LLNotifications::instance().getChannel("Ignore")-> - connectFailedFilter(&handleIgnoredNotification); - LLNotifications::instance().getChannel("VisibilityRules")-> - connectFailedFilter(&visibilityRuleMached); + getChannel("Unique")->connectAtFrontChanged(boost::bind(&LLNotifications::uniqueHandler, this, _1)); + getChannel("Unique")->connectFailedFilter(boost::bind(&LLNotifications::failedUniquenessTest, this, _1)); + getChannel("Ignore")->connectFailedFilter(&handleIgnoredNotification); + getChannel("VisibilityRules")->connectFailedFilter(&visibilityRuleMached); } @@ -1798,6 +1800,18 @@ bool LLNotifications::getIgnoreAllNotifications() { return mIgnoreAllNotifications; } + +void LLNotifications::setIgnored(const std::string& name, bool ignored) +{ + LLNotificationTemplatePtr templatep = getTemplate(name); + templatep->mForm->setIgnored(ignored); +} + +bool LLNotifications::getIgnored(const std::string& name) +{ + LLNotificationTemplatePtr templatep = getTemplate(name); + return (mIgnoreAllNotifications) || ( (templatep->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) && (templatep->mForm->getIgnored()) ); +} bool LLNotifications::isVisibleByRules(LLNotificationPtr n) { diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 354add0b82..ccdfb90054 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -179,6 +179,7 @@ public: Optional<bool> save_option; Optional<std::string> control; Optional<bool> invert_control; + Optional<bool> session_only; FormIgnore(); }; @@ -232,7 +233,8 @@ public: typedef enum e_ignore_type { IGNORE_NO, - IGNORE_WITH_DEFAULT_RESPONSE, + IGNORE_WITH_DEFAULT_RESPONSE, + IGNORE_WITH_DEFAULT_RESPONSE_SESSION_ONLY, IGNORE_WITH_LAST_RESPONSE, IGNORE_SHOW_AGAIN } EIgnoreType; @@ -558,6 +560,7 @@ public: bool canLogToChat() const; bool canLogToIM() const; bool canShowToast() const; + bool canFadeToast() const; bool hasFormElements() const; void playSound(); @@ -884,9 +887,9 @@ class LLNotifications : public LLSingleton<LLNotifications>, public LLNotificationChannelBase { + LLSINGLETON(LLNotifications); LOG_CLASS(LLNotifications); - friend class LLSingleton<LLNotifications>; public: // Needed to clear up RefCounted things prior to actual destruction @@ -963,11 +966,12 @@ public: void setIgnoreAllNotifications(bool ignore); bool getIgnoreAllNotifications(); + void setIgnored(const std::string& name, bool ignored); + bool getIgnored(const std::string& name); + bool isVisibleByRules(LLNotificationPtr pNotification); private: - // we're a singleton, so we don't have a public constructor - LLNotifications(); /*virtual*/ void initSingleton(); void loadPersistentNotifications(); diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index bed29254d8..20cbc89ede 100644 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -177,6 +177,7 @@ struct LLNotificationTemplate Optional<bool> persist, log_to_im, show_toast, + fade_toast, log_to_chat, force_urls_external; Optional<std::string> functor, @@ -199,6 +200,7 @@ struct LLNotificationTemplate Params() : name("name"), persist("persist", false), + fade_toast("fade_toast", true), log_to_im("log_to_im", false), show_toast("show_toast", true), log_to_chat("log_to_chat", true), @@ -316,6 +318,7 @@ struct LLNotificationTemplate bool mLogToChat; bool mLogToIM; bool mShowToast; + bool mFadeToast; }; #endif //LL_LLNOTIFICATION_TEMPLATE_H diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index c2185f24de..b8f47ef6ba 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -268,8 +268,9 @@ typedef boost::function<LLPanel* (void)> LLPanelClassCreatorFunc; class LLRegisterPanelClass : public LLSingleton< LLRegisterPanelClass > { + LLSINGLETON_EMPTY_CTOR(LLRegisterPanelClass); public: - // reigister with either the provided builder, or the generic templated builder + // register with either the provided builder, or the generic templated builder void addPanelClass(const std::string& tag,LLPanelClassCreatorFunc func) { mPanelClassesNames[tag] = func; diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index 8cf72928ff..2c7e7ab13d 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -54,6 +54,7 @@ public: /*virtual*/ void setValue(const LLSD& value); /*virtual*/ BOOL postBuild(); + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); LLSD getPayload() { return mPayload; } @@ -224,6 +225,22 @@ BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event) return TRUE; } +void LLRadioGroup::focusSelectedRadioBtn() +{ + if (mSelectedIndex >= 0) + { + LLRadioCtrl* radio_item = mRadioButtons[mSelectedIndex]; + if (radio_item->hasTabStop() && radio_item->getEnabled()) + { + radio_item->focusFirstItem(FALSE, FALSE); + } + } + else if (mRadioButtons[0]->hasTabStop() || hasTabStop()) + { + focusFirstItem(FALSE, FALSE); + } +} + BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask) { BOOL handled = FALSE; @@ -283,19 +300,6 @@ BOOL LLRadioGroup::handleKeyHere(KEY key, MASK mask) return handled; } -BOOL LLRadioGroup::handleMouseDown(S32 x, S32 y, MASK mask) -{ - // grab focus preemptively, before child button takes mousecapture - // - if (hasTabStop()) - { - focusFirstItem(FALSE, FALSE); - } - - return LLUICtrl::handleMouseDown(x, y, mask); -} - - // Handle one button being clicked. All child buttons must have this // function as their callback function. @@ -466,6 +470,29 @@ BOOL LLRadioCtrl::postBuild() return TRUE; } +BOOL LLRadioCtrl::handleMouseDown(S32 x, S32 y, MASK mask) +{ + // Grab focus preemptively, before button takes mousecapture + if (hasTabStop() && getEnabled()) + { + focusFirstItem(FALSE, FALSE); + } + else + { + // Only currently selected item in group has tab stop as result it is + // unclear how focus should behave on click, just let the group handle + // focus and LLRadioGroup::onClickButton() will set correct state later + // if needed + LLRadioGroup* parent = (LLRadioGroup*)getParent(); + if (parent) + { + parent->focusSelectedRadioBtn(); + } + } + + return LLCheckBoxCtrl::handleMouseDown(x, y, mask); +} + LLRadioCtrl::~LLRadioCtrl() { } diff --git a/indra/llui/llradiogroup.h b/indra/llui/llradiogroup.h index 8bd5698538..dcb2f43bfe 100644 --- a/indra/llui/llradiogroup.h +++ b/indra/llui/llradiogroup.h @@ -66,8 +66,6 @@ public: virtual BOOL postBuild(); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleKeyHere(KEY key, MASK mask); void setIndexEnabled(S32 index, BOOL enabled); @@ -75,6 +73,8 @@ public: S32 getSelectedIndex() const { return mSelectedIndex; } // set the index value programatically BOOL setSelectedIndex(S32 index, BOOL from_event = FALSE); + // foxus child by index if it can get focus + void focusSelectedRadioBtn(); // Accept and retrieve strings of the radio group control names virtual void setValue(const LLSD& value ); diff --git a/indra/llui/llresmgr.h b/indra/llui/llresmgr.h index a652dcd2c0..b19d8d40b8 100644 --- a/indra/llui/llresmgr.h +++ b/indra/llui/llresmgr.h @@ -42,9 +42,9 @@ enum LLLOCALE_ID class LLResMgr : public LLSingleton<LLResMgr> { -public: - LLResMgr(); + LLSINGLETON(LLResMgr); +public: void setLocale( LLLOCALE_ID locale_id ); LLLOCALE_ID getLocale() const { return mLocale; } diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index f70eebc594..6135cc56ad 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -72,6 +72,7 @@ LLScrollContainer::Params::Params() hide_scrollbar("hide_scrollbar"), min_auto_scroll_rate("min_auto_scroll_rate", 100), max_auto_scroll_rate("max_auto_scroll_rate", 1000), + max_auto_scroll_zone("max_auto_scroll_zone", 16), reserve_scroll_corner("reserve_scroll_corner", false), size("size", -1) {} @@ -88,6 +89,7 @@ LLScrollContainer::LLScrollContainer(const LLScrollContainer::Params& p) mReserveScrollCorner(p.reserve_scroll_corner), mMinAutoScrollRate(p.min_auto_scroll_rate), mMaxAutoScrollRate(p.max_auto_scroll_rate), + mMaxAutoScrollZone(p.max_auto_scroll_zone), mScrolledView(NULL), mSize(p.size) { @@ -290,8 +292,22 @@ BOOL LLScrollContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, return TRUE; } +bool LLScrollContainer::canAutoScroll(S32 x, S32 y) +{ + if (mAutoScrolling) + { + return true; // already scrolling + } + return autoScroll(x, y, false); +} + bool LLScrollContainer::autoScroll(S32 x, S32 y) { + return autoScroll(x, y, true); +} + +bool LLScrollContainer::autoScroll(S32 x, S32 y, bool do_scroll) +{ static LLUICachedControl<S32> scrollbar_size_control ("UIScrollbarSize", 0); S32 scrollbar_size = (mSize == -1 ? scrollbar_size_control : mSize); @@ -302,6 +318,8 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y) screenRectToLocal(getRootView()->getLocalRect(), &screen_local_extents); LLRect inner_rect_local( 0, mInnerRect.getHeight(), mInnerRect.getWidth(), 0 ); + // Note: Will also include scrollers as scroll zones, so opposite + // scroll zones might have different size due to visible scrollers if( mScrollbar[HORIZONTAL]->getVisible() ) { inner_rect_local.mBottom += scrollbar_size; @@ -316,8 +334,8 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y) S32 auto_scroll_speed = ll_round(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32()); // autoscroll region should take up no more than one third of visible scroller area - S32 auto_scroll_region_width = llmin(inner_rect_local.getWidth() / 3, 10); - S32 auto_scroll_region_height = llmin(inner_rect_local.getHeight() / 3, 10); + S32 auto_scroll_region_width = llmin(inner_rect_local.getWidth() / 3, (S32)mMaxAutoScrollZone); + S32 auto_scroll_region_height = llmin(inner_rect_local.getHeight() / 3, (S32)mMaxAutoScrollZone); if( mScrollbar[HORIZONTAL]->getVisible() ) { @@ -325,8 +343,11 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y) left_scroll_rect.mRight = inner_rect_local.mLeft + auto_scroll_region_width; if( left_scroll_rect.pointInRect( x, y ) && (mScrollbar[HORIZONTAL]->getDocPos() > 0) ) { - mScrollbar[HORIZONTAL]->setDocPos( mScrollbar[HORIZONTAL]->getDocPos() - auto_scroll_speed ); - mAutoScrolling = TRUE; + if (do_scroll) + { + mScrollbar[HORIZONTAL]->setDocPos(mScrollbar[HORIZONTAL]->getDocPos() - auto_scroll_speed); + mAutoScrolling = TRUE; + } scrolling = true; } @@ -334,8 +355,11 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y) right_scroll_rect.mLeft = inner_rect_local.mRight - auto_scroll_region_width; if( right_scroll_rect.pointInRect( x, y ) && (mScrollbar[HORIZONTAL]->getDocPos() < mScrollbar[HORIZONTAL]->getDocPosMax()) ) { - mScrollbar[HORIZONTAL]->setDocPos( mScrollbar[HORIZONTAL]->getDocPos() + auto_scroll_speed ); - mAutoScrolling = TRUE; + if (do_scroll) + { + mScrollbar[HORIZONTAL]->setDocPos(mScrollbar[HORIZONTAL]->getDocPos() + auto_scroll_speed); + mAutoScrolling = TRUE; + } scrolling = true; } } @@ -345,8 +369,11 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y) bottom_scroll_rect.mTop = inner_rect_local.mBottom + auto_scroll_region_height; if( bottom_scroll_rect.pointInRect( x, y ) && (mScrollbar[VERTICAL]->getDocPos() < mScrollbar[VERTICAL]->getDocPosMax()) ) { - mScrollbar[VERTICAL]->setDocPos( mScrollbar[VERTICAL]->getDocPos() + auto_scroll_speed ); - mAutoScrolling = TRUE; + if (do_scroll) + { + mScrollbar[VERTICAL]->setDocPos(mScrollbar[VERTICAL]->getDocPos() + auto_scroll_speed); + mAutoScrolling = TRUE; + } scrolling = true; } @@ -354,8 +381,11 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y) top_scroll_rect.mBottom = inner_rect_local.mTop - auto_scroll_region_height; if( top_scroll_rect.pointInRect( x, y ) && (mScrollbar[VERTICAL]->getDocPos() > 0) ) { - mScrollbar[VERTICAL]->setDocPos( mScrollbar[VERTICAL]->getDocPos() - auto_scroll_speed ); - mAutoScrolling = TRUE; + if (do_scroll) + { + mScrollbar[VERTICAL]->setDocPos(mScrollbar[VERTICAL]->getDocPos() - auto_scroll_speed); + mAutoScrolling = TRUE; + } scrolling = true; } } diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index f64cf43a8e..e6c7891397 100644 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h @@ -48,7 +48,9 @@ class LLUICtrlFactory; *****************************************************************************/ struct ScrollContainerRegistry : public LLChildRegistry<ScrollContainerRegistry> -{}; +{ + LLSINGLETON_EMPTY_CTOR(ScrollContainerRegistry); +}; class LLScrollContainer : public LLUICtrl { @@ -64,6 +66,7 @@ public: hide_scrollbar; Optional<F32> min_auto_scroll_rate, max_auto_scroll_rate; + Optional<U32> max_auto_scroll_zone; Optional<LLUIColor> bg_color; Optional<LLScrollbar::callback_t> scroll_callback; Optional<S32> size; @@ -112,7 +115,8 @@ public: virtual void draw(); virtual bool addChild(LLView* view, S32 tab_group = 0); - + + bool canAutoScroll(S32 x, S32 y); bool autoScroll(S32 x, S32 y); S32 getSize() const { return mSize; } @@ -126,6 +130,7 @@ private: virtual void scrollHorizontal( S32 new_pos ); virtual void scrollVertical( S32 new_pos ); void updateScroll(); + bool autoScroll(S32 x, S32 y, bool do_scroll); void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const; LLScrollbar* mScrollbar[ORIENTATION_COUNT]; @@ -139,6 +144,7 @@ private: F32 mAutoScrollRate; F32 mMinAutoScrollRate; F32 mMaxAutoScrollRate; + U32 mMaxAutoScrollZone; bool mHideScrollbar; }; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index db8fdc46b7..7c1f4a4dca 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -345,6 +345,21 @@ S32 LLScrollListCtrl::getItemCount() const return mItemList.size(); } +BOOL LLScrollListCtrl::hasSelectedItem() const +{ + item_list::iterator iter; + for (iter = mItemList.begin(); iter < mItemList.end(); ) + { + LLScrollListItem* itemp = *iter; + if (itemp && itemp->getSelected()) + { + return TRUE; + } + iter++; + } + return FALSE; +} + // virtual LLScrolListInterface function (was deleteAllItems) void LLScrollListCtrl::clearRows() { @@ -1808,6 +1823,7 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) registrar.add("Url.ShowProfile", boost::bind(&LLScrollListCtrl::showProfile, id, is_group)); registrar.add("Url.SendIM", boost::bind(&LLScrollListCtrl::sendIM, id)); registrar.add("Url.AddFriend", boost::bind(&LLScrollListCtrl::addFriend, id)); + registrar.add("Url.RemoveFriend", boost::bind(&LLScrollListCtrl::removeFriend, id)); registrar.add("Url.Execute", boost::bind(&LLScrollListCtrl::showNameDetails, id, is_group)); registrar.add("Url.CopyLabel", boost::bind(&LLScrollListCtrl::copyNameToClipboard, id, is_group)); registrar.add("Url.CopyUrl", boost::bind(&LLScrollListCtrl::copySLURLToClipboard, id, is_group)); @@ -1852,6 +1868,12 @@ void LLScrollListCtrl::addFriend(std::string id) LLUrlAction::addFriend(slurl); } +void LLScrollListCtrl::removeFriend(std::string id) +{ + std::string slurl = "secondlife:///app/agent/" + id + "/about"; + LLUrlAction::removeFriend(slurl); +} + void LLScrollListCtrl::showNameDetails(std::string id, bool is_group) { // open the resident's details or the group details diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 6325a79cd5..699a8744e1 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -201,6 +201,8 @@ public: virtual BOOL isSelected(const LLSD& value) const; + BOOL hasSelectedItem() const; + BOOL handleClick(S32 x, S32 y, MASK mask); BOOL selectFirstItem(); BOOL selectNthItem( S32 index ); @@ -432,6 +434,7 @@ private: static void showProfile(std::string id, bool is_group); static void sendIM(std::string id); static void addFriend(std::string id); + static void removeFriend(std::string id); static void showNameDetails(std::string id, bool is_group); static void copyNameToClipboard(std::string id, bool is_group); static void copySLURLToClipboard(std::string id, bool is_group); diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index 0db4281059..5a52600337 100644 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -161,6 +161,7 @@ void LLSpellChecker::refreshDictionaryMap() } // Load user installed dictionary information + user_filename = user_path + DICT_FILE_USER; llifstream custom_file(user_filename.c_str(), std::ios::binary); if (custom_file.is_open()) { diff --git a/indra/llui/llspellcheck.h b/indra/llui/llspellcheck.h index 4ab80195ea..acac589e43 100644 --- a/indra/llui/llspellcheck.h +++ b/indra/llui/llspellcheck.h @@ -29,16 +29,15 @@ #include "llsingleton.h" #include "llui.h" +#include "llinitdestroyclass.h" #include <boost/signals2.hpp> class Hunspell; class LLSpellChecker : public LLSingleton<LLSpellChecker>, public LLInitClass<LLSpellChecker> { - friend class LLSingleton<LLSpellChecker>; + LLSINGLETON(LLSpellChecker); friend class LLInitClass<LLSpellChecker>; -protected: - LLSpellChecker(); ~LLSpellChecker(); public: diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 8b1ba406c8..f6831c6d5e 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -130,6 +130,7 @@ LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p) params.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM); mEditor = LLUICtrlFactory::create<LLLineEditor> (params); mEditor->setFocusReceivedCallback( boost::bind(&LLSpinCtrl::onEditorGainFocus, _1, this )); + mEditor->setFocusLostCallback( boost::bind(&LLSpinCtrl::onEditorLostFocus, _1, this )); if (p.allow_digits_only) { mEditor->setPrevalidateInput(LLTextValidate::validateNonNegativeS32NoSpace); @@ -153,7 +154,7 @@ F32 clamp_precision(F32 value, S32 decimal_precision) for (S32 i = 0; i < decimal_precision; i++) clamped_value *= 10.0; - clamped_value = ll_round((F32)clamped_value); + clamped_value = ll_round(clamped_value); for (S32 i = 0; i < decimal_precision; i++) clamped_value /= 10.0; @@ -239,6 +240,31 @@ void LLSpinCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata ) self->onFocusReceived(); } +// static +void LLSpinCtrl::onEditorLostFocus( LLFocusableElement* caller, void *userdata ) +{ + LLSpinCtrl* self = (LLSpinCtrl*) userdata; + llassert( caller == self->mEditor ); + + self->onFocusLost(); + + std::string text = self->mEditor->getText(); + + LLLocale locale(LLLocale::USER_LOCALE); + F32 val = (F32)atof(text.c_str()); + + F32 saved_val = self->getValueF32(); + if (saved_val != val && !self->mEditor->isDirty()) + { + // Editor was focused when value update arrived, string + // in editor is different from one in spin control. + // Since editor is not dirty, it won't commit, so either + // attempt to commit value from editor or revert to a more + // recent value from spin control + self->updateEditor(); + } +} + void LLSpinCtrl::setValue(const LLSD& value ) { F32 v = (F32)value.asReal(); diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h index e34add879d..cab99c35bd 100644 --- a/indra/llui/llspinctrl.h +++ b/indra/llui/llspinctrl.h @@ -93,6 +93,7 @@ public: void onEditorCommit(const LLSD& data); static void onEditorGainFocus(LLFocusableElement* caller, void *userdata); + static void onEditorLostFocus(LLFocusableElement* caller, void *userdata); static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata); void onUpBtn(const LLSD& data); diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 35f5330a3f..6c8e63442b 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -40,6 +40,7 @@ #include "lltooltip.h" #include "lllocalcliprect.h" #include <iostream> +#include "lltrans.h" // rate at which to update display of value that is rapidly changing const F32 MEAN_VALUE_UPDATE_TIME = 1.f / 4.f; @@ -619,19 +620,19 @@ void LLStatBar::drawLabelAndValue( F32 value, std::string &label, LLRect &bar_re std::string value_str = !llisnan(value) ? llformat("%10.*f %s", decimal_digits, value, label.c_str()) - : "n/a"; + : LLTrans::getString("na"); // Draw the current value. if (mOrientation == HORIZONTAL) { LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, bar_rect.mRight, getRect().getHeight(), - LLColor4(1.f, 1.f, 1.f, 0.5f), + LLColor4(1.f, 1.f, 1.f, 1.f), LLFontGL::RIGHT, LLFontGL::TOP); } else { LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, bar_rect.mRight, getRect().getHeight(), - LLColor4(1.f, 1.f, 1.f, 0.5f), + LLColor4(1.f, 1.f, 1.f, 1.f), LLFontGL::RIGHT, LLFontGL::TOP); } } diff --git a/indra/llui/llstatview.h b/indra/llui/llstatview.h index bc78d3b5fd..af4db7d7ea 100644 --- a/indra/llui/llstatview.h +++ b/indra/llui/llstatview.h @@ -35,7 +35,9 @@ class LLStatBar; // widget registrars struct StatViewRegistry : public LLChildRegistry<StatViewRegistry> -{}; +{ + LLSINGLETON_EMPTY_CTOR(StatViewRegistry); +}; class LLStatView : public LLContainerView { diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 701a06a085..1b2f09cff5 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -210,6 +210,7 @@ LLTabContainer::Params::Params() label_pad_left("label_pad_left"), tab_position("tab_position"), hide_tabs("hide_tabs", false), + hide_scroll_arrows("hide_scroll_arrows", false), tab_padding_right("tab_padding_right"), first_tab("first_tab"), middle_tab("middle_tab"), @@ -240,6 +241,7 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) mPrevArrowBtn(NULL), mNextArrowBtn(NULL), mIsVertical( p.tab_position == LEFT ), + mHideScrollArrows(p.hide_scroll_arrows), // Horizontal Specific mJumpPrevArrowBtn(NULL), mJumpNextArrowBtn(NULL), @@ -409,7 +411,7 @@ void LLTabContainer::draw() setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLSmoothInterpolation::getInterpolant(0.08f))); - BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0)); + BOOL has_scroll_arrows = !mHideScrollArrows && !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0)); if (!mIsVertical) { mJumpPrevArrowBtn->setVisible( has_scroll_arrows ); @@ -517,7 +519,7 @@ BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) { static LLUICachedControl<S32> tabcntrv_pad ("UITabCntrvPad", 0); BOOL handled = FALSE; - BOOL has_scroll_arrows = (getMaxScrollPos() > 0) && !getTabsHidden(); + BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); if (has_scroll_arrows) { @@ -591,7 +593,7 @@ BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask ) BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask ) { BOOL handled = FALSE; - BOOL has_scroll_arrows = (getMaxScrollPos() > 0) && !getTabsHidden(); + BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); if (has_scroll_arrows) { @@ -633,7 +635,7 @@ BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask ) BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask ) { BOOL handled = FALSE; - BOOL has_scroll_arrows = (getMaxScrollPos() > 0) && !getTabsHidden(); + BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0) && !getTabsHidden(); S32 local_x = x - getRect().mLeft; S32 local_y = y - getRect().mBottom; @@ -701,7 +703,7 @@ BOOL LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask) { LLTabTuple* firsttuple = getTab(0); - BOOL has_scroll_arrows = (getMaxScrollPos() > 0); + BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); LLRect clip; if (mIsVertical) { @@ -826,7 +828,7 @@ BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask) // virtual BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, std::string &tooltip) { - BOOL has_scroll_arrows = (getMaxScrollPos() > 0); + BOOL has_scroll_arrows = !mHideScrollArrows && (getMaxScrollPos() > 0); if(mOpenTabsOnDragAndDrop && !getTabsHidden()) { @@ -1543,7 +1545,7 @@ BOOL LLTabContainer::setTab(S32 which) is_visible = FALSE; } } - else if (getMaxScrollPos() > 0) + else if (!mHideScrollArrows && getMaxScrollPos() > 0) { if( i < getScrollPos() ) { diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 057809dc42..4a5f08f5d3 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -83,6 +83,7 @@ public: label_pad_left; Optional<bool> hide_tabs; + Optional<bool> hide_scroll_arrows; Optional<S32> tab_padding_right; Optional<TabParams> first_tab, @@ -262,6 +263,7 @@ private: S32 mCurrentTabIdx; BOOL mTabsHidden; + BOOL mHideScrollArrows; BOOL mScrolled; LLFrameTimer mScrollTimer; diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 20be739286..c570285856 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1505,8 +1505,8 @@ void LLTextBase::reflow() segment_set_t::iterator seg_iter = mSegments.begin(); S32 seg_offset = 0; S32 line_start_index = 0; - const S32 text_available_width = mVisibleTextRect.getWidth() - mHPad; // reserve room for margin - S32 remaining_pixels = text_available_width; + const F32 text_available_width = mVisibleTextRect.getWidth() - mHPad; // reserve room for margin + F32 remaining_pixels = text_available_width; S32 line_count = 0; // find and erase line info structs starting at start_index and going to end of document @@ -1522,6 +1522,7 @@ void LLTextBase::reflow() } S32 line_height = 0; + S32 seg_line_offset = line_count + 1; while(seg_iter != mSegments.end()) { @@ -1531,13 +1532,15 @@ void LLTextBase::reflow() S32 cur_index = segment->getStart() + seg_offset; // ask segment how many character fit in remaining space - S32 character_count = segment->getNumChars(getWordWrap() ? llmax(0, remaining_pixels) : S32_MAX, + S32 character_count = segment->getNumChars(getWordWrap() ? llmax(0, ll_round(remaining_pixels)) : S32_MAX, seg_offset, cur_index - line_start_index, - S32_MAX); + S32_MAX, + line_count - seg_line_offset); - S32 segment_width, segment_height; - bool force_newline = segment->getDimensions(seg_offset, character_count, segment_width, segment_height); + F32 segment_width; + S32 segment_height; + bool force_newline = segment->getDimensionsF32(seg_offset, character_count, segment_width, segment_height); // grow line height as necessary based on reported height of this segment line_height = llmax(line_height, segment_height); remaining_pixels -= segment_width; @@ -1546,11 +1549,13 @@ void LLTextBase::reflow() S32 last_segment_char_on_line = segment->getStart() + seg_offset; - S32 text_actual_width = text_available_width - remaining_pixels; + // Note: make sure text will fit in width - use ceil, but also make sure + // ceil is used only once per line + S32 text_actual_width = llceil(text_available_width - remaining_pixels); S32 text_left = getLeftOffset(text_actual_width); LLRect line_rect(text_left, cur_top, - text_left + text_actual_width, + text_left + text_actual_width, cur_top - line_height); // if we didn't finish the current segment... @@ -1597,6 +1602,7 @@ void LLTextBase::reflow() } ++seg_iter; seg_offset = 0; + seg_line_offset = force_newline ? line_count + 1 : line_count; } if (force_newline) { @@ -3063,9 +3069,17 @@ boost::signals2::connection LLTextBase::setIsObjectBlockedCallback(const is_bloc LLTextSegment::~LLTextSegment() {} -bool LLTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const { width = 0; height = 0; return false;} +bool LLTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { width = 0; height = 0; return false; } +bool LLTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const +{ + F32 fwidth = 0; + bool result = getDimensionsF32(first_char, num_chars, fwidth, height); + width = ll_round(fwidth); + return result; +} + S32 LLTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const { return 0; } -S32 LLTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const { return 0; } +S32 LLTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const { return 0; } void LLTextSegment::updateLayout(const LLTextBase& editor) {} F32 LLTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect) { return draw_rect.mLeft; } bool LLTextSegment::canEdit() const { return false; } @@ -3311,7 +3325,7 @@ void LLNormalTextSegment::setToolTip(const std::string& tooltip) mTooltip = tooltip; } -bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const +bool LLNormalTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { height = 0; width = 0; @@ -3320,7 +3334,7 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt height = mFontHeight; const LLWString &text = getWText(); // if last character is a newline, then return true, forcing line break - width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars); + width = mStyle->getFont()->getWidthF32(text.c_str(), mStart + first_char, num_chars); } return false; } @@ -3335,7 +3349,7 @@ S32 LLNormalTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, round); } -S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const +S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const { const LLWString &text = getWText(); @@ -3352,7 +3366,7 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin // if no character yet displayed on this line, don't require word wrapping since // we can just move to the next line, otherwise insist on it so we make forward progress - LLFontGL::EWordWrapStyle word_wrap_style = (line_offset == 0) + LLFontGL::EWordWrapStyle word_wrap_style = (line_offset == 0) ? LLFontGL::WORD_BOUNDARY_IF_POSSIBLE : LLFontGL::ONLY_WORD_BOUNDARIES; @@ -3488,14 +3502,28 @@ LLInlineViewSegment::~LLInlineViewSegment() mView->die(); } -bool LLInlineViewSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const +bool LLInlineViewSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { - if (first_char == 0 && num_chars == 0) + if (first_char == 0 && num_chars == 0) { - // we didn't fit on a line, the widget will fall on the next line - // so dimensions here are 0 + // We didn't fit on a line or were forced to new string + // the widget will fall on the next line, so width here is 0 width = 0; - height = 0; + + if (mForceNewLine) + { + // Chat, string can't be smaller then font height even if it is empty + LLStyleSP s(new LLStyle(LLStyle::Params().visible(true))); + height = s->getFont()->getLineHeight(); + + return true; // new line + } + else + { + // height from previous segment in same string will be used, word-wrap + height = 0; + } + } else { @@ -3506,13 +3534,16 @@ bool LLInlineViewSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt return false; } -S32 LLInlineViewSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const +S32 LLInlineViewSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const { // if putting a widget anywhere but at the beginning of a line // and the widget doesn't fit or mForceNewLine is true // then return 0 chars for that line, and all characters for the next - if (line_offset != 0 - && (mForceNewLine || num_pixels < mView->getRect().getWidth())) + if (mForceNewLine && line_ind == 0) + { + return 0; + } + else if (line_offset != 0 && num_pixels < mView->getRect().getWidth()) { return 0; } @@ -3558,14 +3589,14 @@ LLLineBreakTextSegment::LLLineBreakTextSegment(LLStyleConstSP style,S32 pos):LLT LLLineBreakTextSegment::~LLLineBreakTextSegment() { } -bool LLLineBreakTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const +bool LLLineBreakTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { width = 0; height = mFontHeight; return true; } -S32 LLLineBreakTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const +S32 LLLineBreakTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const { return 1; } @@ -3587,7 +3618,7 @@ LLImageTextSegment::~LLImageTextSegment() static const S32 IMAGE_HPAD = 3; -bool LLImageTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const +bool LLImageTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { width = 0; height = mStyle->getFont()->getLineHeight(); @@ -3601,7 +3632,7 @@ bool LLImageTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width return false; } -S32 LLImageTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const +S32 LLImageTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const { LLUIImagePtr image = mStyle->getImage(); diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 3d3a6ca869..5fdde445ef 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -61,10 +61,23 @@ public: mEnd(end) {} virtual ~LLTextSegment(); + bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; - virtual bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + virtual bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; virtual S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const; - virtual S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; + + /** + * Get number of chars that fit into free part of current line. + * + * @param num_pixels - maximum width of rect + * @param segment_offset - symbol in segment we start processing line from + * @param line_offset - symbol in line after which segment starts + * @param max_chars - limit of symbols that will fit in current line + * @param line_ind - index of not word-wrapped string inside segment for multi-line segments. + * Two string separated by word-wrap will have same index. + * @return number of chars that will fit into current line + */ + virtual S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const; virtual void updateLayout(const class LLTextBase& editor); virtual F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); virtual bool canEdit() const; @@ -114,9 +127,9 @@ public: LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); virtual ~LLNormalTextSegment(); - /*virtual*/ bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; /*virtual*/ S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const; - /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; + /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const; /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); /*virtual*/ bool canEdit() const { return true; } /*virtual*/ const LLColor4& getColor() const { return mStyle->getColor(); } @@ -200,8 +213,8 @@ public: LLInlineViewSegment(const Params& p, S32 start, S32 end); ~LLInlineViewSegment(); - /*virtual*/ bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; - /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; + /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; + /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const; /*virtual*/ void updateLayout(const class LLTextBase& editor); /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); /*virtual*/ bool canEdit() const { return false; } @@ -224,8 +237,8 @@ public: LLLineBreakTextSegment(LLStyleConstSP style,S32 pos); LLLineBreakTextSegment(S32 pos); ~LLLineBreakTextSegment(); - bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; - S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; + /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; + S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const; F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); private: @@ -237,8 +250,8 @@ class LLImageTextSegment : public LLTextSegment public: LLImageTextSegment(LLStyleConstSP style,S32 pos,class LLTextBase& editor); ~LLImageTextSegment(); - bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; - S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const; + /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; + S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 char_offset, S32 max_chars, S32 line_ind) const; F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 73f961b36b..1a49b94c23 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1459,6 +1459,10 @@ void LLTextEditor::pasteHelper(bool is_primary) // Clean up string (replace tabs and remove characters that our fonts don't support). void LLTextEditor::cleanStringForPaste(LLWString & clean_string) { + std::string clean_string_utf = wstring_to_utf8str(clean_string); + std::replace( clean_string_utf.begin(), clean_string_utf.end(), '\r', '\n'); + clean_string = utf8str_to_wstring(clean_string_utf); + LLWStringUtil::replaceTabsWithSpaces(clean_string, SPACES_PER_TAB); if( mAllowEmbeddedItems ) { diff --git a/indra/llui/lltextparser.h b/indra/llui/lltextparser.h index 400aeeb8be..3d71e40452 100644 --- a/indra/llui/lltextparser.h +++ b/indra/llui/lltextparser.h @@ -37,14 +37,14 @@ class LLColor4; class LLTextParser : public LLSingleton<LLTextParser> { + LLSINGLETON(LLTextParser); + public: typedef enum e_condition_type { CONTAINS, MATCHES, STARTS_WITH, ENDS_WITH } EConditionType; typedef enum e_highlight_type { PART, ALL } EHighlightType; typedef enum e_highlight_position { WHOLE, START, MIDDLE, END } EHighlightPosition; typedef enum e_dialog_action { ACTION_NONE, ACTION_CLOSE, ACTION_ADD, ACTION_COPY, ACTION_UPDATE } EDialogAction; - LLTextParser(); - LLSD parsePartialLineHighlights(const std::string &text,const LLColor4 &color, EHighlightPosition part=WHOLE, S32 index=0); bool parseFullLineHighlights(const std::string &text, LLColor4 *color); diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index fad127fc4c..0b1fbe5367 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -129,9 +129,10 @@ public: class LLToolTipMgr : public LLSingleton<LLToolTipMgr> { + LLSINGLETON(LLToolTipMgr); LOG_CLASS(LLToolTipMgr); + public: - LLToolTipMgr(); void show(const LLToolTip::Params& params); void show(const std::string& message); diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index f790d8e005..770f13c1c3 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -60,6 +60,7 @@ #include "llflyoutbutton.h" #include "llsearcheditor.h" #include "lltoolbar.h" +#include "llcleanup.h" // for XUIParse #include "llquaternion.h" @@ -208,7 +209,7 @@ void LLUI::initClass(const settings_map_t& settings, void LLUI::cleanupClass() { - LLRender2D::cleanupClass(); + SUBSYSTEM_CLEANUP(LLRender2D); } void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups) diff --git a/indra/llui/llui.h b/indra/llui/llui.h index c727f75c4f..d7151dbee9 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -344,95 +344,6 @@ private: // Moved LLLocalClipRect to lllocalcliprect.h -class LLCallbackRegistry -{ -public: - typedef boost::signals2::signal<void()> callback_signal_t; - - void registerCallback(const callback_signal_t::slot_type& slot) - { - mCallbacks.connect(slot); - } - - void fireCallbacks() - { - mCallbacks(); - } - -private: - callback_signal_t mCallbacks; -}; - -class LLInitClassList : - public LLCallbackRegistry, - public LLSingleton<LLInitClassList> -{ - friend class LLSingleton<LLInitClassList>; -private: - LLInitClassList() {} -}; - -class LLDestroyClassList : - public LLCallbackRegistry, - public LLSingleton<LLDestroyClassList> -{ - friend class LLSingleton<LLDestroyClassList>; -private: - LLDestroyClassList() {} -}; - -template<typename T> -class LLRegisterWith -{ -public: - LLRegisterWith(boost::function<void ()> func) - { - T::instance().registerCallback(func); - } - - // this avoids a MSVC bug where non-referenced static members are "optimized" away - // even if their constructors have side effects - S32 reference() - { - S32 dummy; - dummy = 0; - return dummy; - } -}; - -template<typename T> -class LLInitClass -{ -public: - LLInitClass() { sRegister.reference(); } - - static LLRegisterWith<LLInitClassList> sRegister; -private: - - static void initClass() - { - LL_ERRS() << "No static initClass() method defined for " << typeid(T).name() << LL_ENDL; - } -}; - -template<typename T> -class LLDestroyClass -{ -public: - LLDestroyClass() { sRegister.reference(); } - - static LLRegisterWith<LLDestroyClassList> sRegister; -private: - - static void destroyClass() - { - LL_ERRS() << "No static destroyClass() method defined for " << typeid(T).name() << LL_ENDL; - } -}; - -template <typename T> LLRegisterWith<LLInitClassList> LLInitClass<T>::sRegister(&T::initClass); -template <typename T> LLRegisterWith<LLDestroyClassList> LLDestroyClass<T>::sRegister(&T::destroyClass); - // useful parameter blocks struct TimeIntervalParam : public LLInitParam::ChoiceBlock<TimeIntervalParam> { diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h index 6a7a681d57..44472070cc 100644 --- a/indra/llui/lluicolortable.h +++ b/indra/llui/lluicolortable.h @@ -38,7 +38,8 @@ class LLUIColor; class LLUIColorTable : public LLSingleton<LLUIColorTable> { -LOG_CLASS(LLUIColorTable); + LLSINGLETON_EMPTY_CTOR(LLUIColorTable); + LOG_CLASS(LLUIColorTable); // consider using sorted vector, can be much faster typedef std::map<std::string, LLUIColor> string_color_map_t; diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 99553ee0d2..550bee5c70 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -258,18 +258,25 @@ public: class LLTextInputFilter : public LLQueryFilter, public LLSingleton<LLTextInputFilter> { + LLSINGLETON_EMPTY_CTOR(LLTextInputFilter); /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const { return filterResult_t(view->isCtrl() && static_cast<const LLUICtrl *>(view)->acceptsTextInput(), TRUE); } }; - + template <typename F, typename DERIVED> class CallbackRegistry : public LLRegistrySingleton<std::string, F, DERIVED > {}; - class CommitCallbackRegistry : public CallbackRegistry<commit_callback_t, CommitCallbackRegistry>{}; + class CommitCallbackRegistry : public CallbackRegistry<commit_callback_t, CommitCallbackRegistry> + { + LLSINGLETON_EMPTY_CTOR(CommitCallbackRegistry); + }; // the enable callback registry is also used for visiblity callbacks - class EnableCallbackRegistry : public CallbackRegistry<enable_callback_t, EnableCallbackRegistry>{}; + class EnableCallbackRegistry : public CallbackRegistry<enable_callback_t, EnableCallbackRegistry> + { + LLSINGLETON_EMPTY_CTOR(EnableCallbackRegistry); + }; protected: diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 4cc7da1267..fdefae01b1 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -92,15 +92,27 @@ void LLUICtrlFactory::loadWidgetTemplate(const std::string& widget_tag, LLInitPa { std::string filename = gDirUtilp->add("widgets", widget_tag + ".xml"); LLXMLNodePtr root_node; + std::vector<std::string> search_paths = + gDirUtilp->findSkinnedFilenames(LLDir::XUI, filename); - // Here we're looking for the "en" version, the default-language version - // of the file, rather than the localized version. - std::string full_filename = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, filename); - if (!full_filename.empty()) + if (search_paths.empty()) { - LLUICtrlFactory::instance().pushFileName(full_filename); - LLSimpleXUIParser parser; - parser.readXUI(full_filename, block); + return; + } + + // "en" version, the default-language version of the file. + std::string base_filename = search_paths.front(); + if (!base_filename.empty()) + { + LLUICtrlFactory::instance().pushFileName(base_filename); + + if (!LLXMLNode::getLayeredXMLNode(root_node, search_paths)) + { + LL_WARNS() << "Couldn't parse widget from: " << base_filename << LL_ENDL; + return; + } + LLXUIParser parser; + parser.readXUI(root_node, block, base_filename); LLUICtrlFactory::instance().popFileName(); } } diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 3ce39c947f..03d946f1b7 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -33,6 +33,8 @@ #include "llxuiparser.h" #include "llstl.h" #include "lldir.h" +#include "llsingleton.h" +#include "llheteromap.h" class LLView; @@ -57,22 +59,24 @@ protected: class LLDefaultChildRegistry : public LLChildRegistry<LLDefaultChildRegistry> { -protected: - LLDefaultChildRegistry(){} - friend class LLSingleton<LLDefaultChildRegistry>; + LLSINGLETON_EMPTY_CTOR(LLDefaultChildRegistry); }; // lookup widget name by type class LLWidgetNameRegistry : public LLRegistrySingleton<const std::type_info*, std::string, LLWidgetNameRegistry> -{}; +{ + LLSINGLETON_EMPTY_CTOR(LLWidgetNameRegistry); +}; // lookup function for generating empty param block by widget type // this is used for schema generation //typedef const LLInitParam::BaseBlock& (*empty_param_block_func_t)(); //class LLDefaultParamBlockRegistry //: public LLRegistrySingleton<const std::type_info*, empty_param_block_func_t, LLDefaultParamBlockRegistry> -//{}; +//{ +// LLSINGLETON(LLDefaultParamBlockRegistry); +//}; extern LLTrace::BlockTimerStatHandle FTM_WIDGET_SETUP; extern LLTrace::BlockTimerStatHandle FTM_WIDGET_CONSTRUCTION; @@ -85,31 +89,15 @@ extern template class LLUICtrlFactory* LLSingleton<class LLUICtrlFactory>::getIn class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory> { -private: - friend class LLSingleton<LLUICtrlFactory>; - LLUICtrlFactory(); + LLSINGLETON(LLUICtrlFactory); ~LLUICtrlFactory(); // only partial specialization allowed in inner classes, so use extra dummy parameter template <typename PARAM_BLOCK, int DUMMY> - class ParamDefaults : public LLSingleton<ParamDefaults<PARAM_BLOCK, DUMMY> > + class ParamDefaults { public: - ParamDefaults() - { - // look up template file for this param block... - const std::string* param_block_tag = LLWidgetNameRegistry::instance().getValue(&typeid(PARAM_BLOCK)); - if (param_block_tag) - { // ...and if it exists, back fill values using the most specific template first - PARAM_BLOCK params; - LLUICtrlFactory::loadWidgetTemplate(*param_block_tag, params); - mPrototype.fillFrom(params); - } - // recursively fill from base class param block - ((typename PARAM_BLOCK::base_block_t&)mPrototype).fillFrom(ParamDefaults<typename PARAM_BLOCK::base_block_t, DUMMY>::instance().get()); - - } - + ParamDefaults(); const PARAM_BLOCK& get() { return mPrototype; } private: @@ -118,9 +106,10 @@ private: // base case for recursion, there are NO base classes of LLInitParam::BaseBlock template<int DUMMY> - class ParamDefaults<LLInitParam::BaseBlock, DUMMY> : public LLSingleton<ParamDefaults<LLInitParam::BaseBlock, DUMMY> > + class ParamDefaults<LLInitParam::BaseBlock, DUMMY> { public: + ParamDefaults(); const LLInitParam::BaseBlock& get() { return mBaseBlock; } private: LLInitParam::BaseBlock mBaseBlock; @@ -132,7 +121,7 @@ public: template<typename T> static const typename T::Params& getDefaultParams() { - return ParamDefaults<typename T::Params, 0>::instance().get(); + return instance().mParamDefaultsMap.obtain< ParamDefaults<typename T::Params, 0> >().get(); } // Does what you want for LLFloaters and LLPanels @@ -147,7 +136,8 @@ public: template<typename T> static T* create(typename T::Params& params, LLView* parent = NULL) { - params.fillFrom(ParamDefaults<typename T::Params, 0>::instance().get()); + params.fillFrom(instance().mParamDefaultsMap.obtain< + ParamDefaults<typename T::Params, 0> >().get()); T* widget = createWidgetImpl<T>(params, parent); if (widget) @@ -295,8 +285,40 @@ private: class LLPanel* mDummyPanel; std::vector<std::string> mFileNames; + + // store ParamDefaults specializations + // Each ParamDefaults specialization used to be an LLSingleton in its own + // right. But the 2016 changes to the LLSingleton mechanism, making + // LLSingleton instances polymorphic, are incompatible with current + // LLInitParam::BaseBlock functionality. (Thanks NickyD for spotting + // that!) Moreover, instances of the private nested ParamDefaults template + // aren't global resources -- which is what LLSingleton is designed for. + // This is simply a cache looked up by type. Its lifespan is tied to + // LLUICtrlFactory. Use LLHeteroMap for this cache. + LLHeteroMap mParamDefaultsMap; }; +template <typename PARAM_BLOCK, int DUMMY> +LLUICtrlFactory::ParamDefaults<PARAM_BLOCK, DUMMY>::ParamDefaults() +{ + // look up template file for this param block... + const std::string* param_block_tag = LLWidgetNameRegistry::instance().getValue(&typeid(PARAM_BLOCK)); + if (param_block_tag) + { // ...and if it exists, back fill values using the most specific template first + PARAM_BLOCK params; + LLUICtrlFactory::loadWidgetTemplate(*param_block_tag, params); + mPrototype.fillFrom(params); + } + // recursively fill from base class param block + ((typename PARAM_BLOCK::base_block_t&)mPrototype).fillFrom( + LLUICtrlFactory::instance().mParamDefaultsMap.obtain< + ParamDefaults<typename PARAM_BLOCK::base_block_t, DUMMY> >().get()); + +} + +template <int DUMMY> +LLUICtrlFactory::ParamDefaults<LLInitParam::BaseBlock, DUMMY>::ParamDefaults() {} + // this is here to make gcc happy with reference to LLUICtrlFactory template<typename DERIVED> template<typename T> diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 27a2456deb..a4243ebfa1 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -764,7 +764,23 @@ LLUrlEntryAgentCompleteName::LLUrlEntryAgentCompleteName() std::string LLUrlEntryAgentCompleteName::getName(const LLAvatarName& avatar_name) { - return avatar_name.getCompleteName(); + return avatar_name.getCompleteName(true, true); +} + +// +// LLUrlEntryAgentLegacyName describes a Second Life agent legacy name Url, e.g., +// secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/legacyname +// x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/legacyname +// +LLUrlEntryAgentLegacyName::LLUrlEntryAgentLegacyName() +{ + mPattern = boost::regex(APP_HEADER_REGEX "/agent/[\\da-f-]+/legacyname", + boost::regex::perl|boost::regex::icase); +} + +std::string LLUrlEntryAgentLegacyName::getName(const LLAvatarName& avatar_name) +{ + return avatar_name.getLegacyName(); } // @@ -780,7 +796,7 @@ LLUrlEntryAgentDisplayName::LLUrlEntryAgentDisplayName() std::string LLUrlEntryAgentDisplayName::getName(const LLAvatarName& avatar_name) { - return avatar_name.getDisplayName(); + return avatar_name.getDisplayName(true); } // @@ -901,7 +917,7 @@ std::string LLUrlEntryInventory::getLabel(const std::string &url, const LLUrlLab // LLUrlEntryObjectIM::LLUrlEntryObjectIM() { - mPattern = boost::regex("secondlife:///app/objectim/[\\da-f-]+\?.*", + mPattern = boost::regex("secondlife:///app/objectim/[\\da-f-]+\?\\S*\\w", boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_objectim.xml"; } @@ -1377,7 +1393,7 @@ std::string LLUrlEntryIcon::getIcon(const std::string &url) LLUrlEntryEmail::LLUrlEntryEmail() : LLUrlEntryBase() { - mPattern = boost::regex("(mailto:)?[\\w\\.\\-]+@[\\w\\.\\-]+\\.[a-z]{2,6}", + mPattern = boost::regex("(mailto:)?[\\w\\.\\-]+@[\\w\\.\\-]+\\.[a-z]{2,63}", boost::regex::perl | boost::regex::icase); mMenuName = "menu_url_email.xml"; mTooltip = LLTrans::getString("TooltipEmail"); diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 413c20a657..28e9931718 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -269,6 +269,14 @@ private: /*virtual*/ std::string getName(const LLAvatarName& avatar_name); }; +class LLUrlEntryAgentLegacyName : public LLUrlEntryAgentName +{ +public: + LLUrlEntryAgentLegacyName(); +private: + /*virtual*/ std::string getName(const LLAvatarName& avatar_name); +}; + /// /// LLUrlEntryAgentDisplayName Describes a Second Life agent display name Url, e.g., /// secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/displayname diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index 23c6d5a954..fa6593267a 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -57,6 +57,7 @@ LLUrlRegistry::LLUrlRegistry() mUrlEntryHTTPLabel = new LLUrlEntryHTTPLabel(); registerUrl(mUrlEntryHTTPLabel); registerUrl(new LLUrlEntryAgentCompleteName()); + registerUrl(new LLUrlEntryAgentLegacyName()); registerUrl(new LLUrlEntryAgentDisplayName()); registerUrl(new LLUrlEntryAgentUserName()); // LLUrlEntryAgent*Name must appear before LLUrlEntryAgent since diff --git a/indra/llui/llurlregistry.h b/indra/llui/llurlregistry.h index 24c3a2b513..efafe543ab 100644 --- a/indra/llui/llurlregistry.h +++ b/indra/llui/llurlregistry.h @@ -62,9 +62,9 @@ void LLUrlRegistryNullCallback(const std::string &url, /// class LLUrlRegistry : public LLSingleton<LLUrlRegistry> { -public: + LLSINGLETON(LLUrlRegistry); ~LLUrlRegistry(); - +public: /// add a new Url handler to the registry (will be freed on destruction) /// optionally force it to the front of the list, making it take /// priority over other regular expression matches for URLs @@ -89,9 +89,6 @@ public: bool isUrl(const LLWString &text); private: - LLUrlRegistry(); - friend class LLSingleton<LLUrlRegistry>; - std::vector<LLUrlEntryBase *> mUrlEntry; LLUrlEntryBase* mUrlEntryTrusted; LLUrlEntryBase* mUrlEntryIcon; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 9604e5ce10..89ad8138d8 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1912,6 +1912,7 @@ private: class SortByTabOrder : public LLQuerySorter, public LLSingleton<SortByTabOrder> { + LLSINGLETON_EMPTY_CTOR(SortByTabOrder); /*virtual*/ void sort(LLView * parent, LLView::child_list_t &children) const { children.sort(CompareByTabOrder(parent->getTabOrder(), parent->getDefaultTabGroup())); @@ -1935,6 +1936,7 @@ const LLViewQuery & LLView::getTabOrderQuery() // This class is only used internally by getFocusRootsQuery below. class LLFocusRootsFilter : public LLQueryFilter, public LLSingleton<LLFocusRootsFilter> { + LLSINGLETON_EMPTY_CTOR(LLFocusRootsFilter); /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const { return filterResult_t(view->isCtrl() && view->isFocusRoot(), !view->isFocusRoot()); diff --git a/indra/llui/llviewereventrecorder.h b/indra/llui/llviewereventrecorder.h index 375efcc3de..d1059d55de 100644 --- a/indra/llui/llviewereventrecorder.h +++ b/indra/llui/llviewereventrecorder.h @@ -44,13 +44,10 @@ class LLViewerEventRecorder : public LLSingleton<LLViewerEventRecorder> { - - public: - - LLViewerEventRecorder(); // TODO Protect constructor better if we can (not happy in private section) - could add a factory... - we are singleton + LLSINGLETON(LLViewerEventRecorder); ~LLViewerEventRecorder(); - + public: void updateMouseEventInfo(S32 local_x,S32 local_y, S32 global_x, S32 global_y, std::string mName); void setMouseLocalCoords(S32 x,S32 y); void setMouseGlobalCoords(S32 x,S32 y); diff --git a/indra/llui/llviewquery.h b/indra/llui/llviewquery.h index 9044c4ff29..21bb1be26f 100644 --- a/indra/llui/llviewquery.h +++ b/indra/llui/llviewquery.h @@ -54,31 +54,37 @@ public: class LLLeavesFilter : public LLQueryFilter, public LLSingleton<LLLeavesFilter> { + LLSINGLETON_EMPTY_CTOR(LLLeavesFilter); /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; }; class LLRootsFilter : public LLQueryFilter, public LLSingleton<LLRootsFilter> { + LLSINGLETON_EMPTY_CTOR(LLRootsFilter); /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; }; class LLVisibleFilter : public LLQueryFilter, public LLSingleton<LLVisibleFilter> { + LLSINGLETON_EMPTY_CTOR(LLVisibleFilter); /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; }; class LLEnabledFilter : public LLQueryFilter, public LLSingleton<LLEnabledFilter> { + LLSINGLETON_EMPTY_CTOR(LLEnabledFilter); /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; }; class LLTabStopFilter : public LLQueryFilter, public LLSingleton<LLTabStopFilter> { + LLSINGLETON_EMPTY_CTOR(LLTabStopFilter); /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; }; class LLCtrlFilter : public LLQueryFilter, public LLSingleton<LLCtrlFilter> { + LLSINGLETON_EMPTY_CTOR(LLCtrlFilter); /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; }; diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 99a0869ce3..138ba8bf02 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -58,10 +58,6 @@ static LLInitParam::Parser::parser_inspect_func_map_t sSimpleXUIInspectFuncs; const char* NO_VALUE_MARKER = "no_value"; -#ifdef LL_WINDOWS -const S32 LINE_NUMBER_HERE = 0; -#endif - struct MaxOccursValues : public LLInitParam::TypeValuesHelper<U32, MaxOccursValues> { static void declareValues() @@ -1313,22 +1309,14 @@ bool LLXUIParser::writeSDValue(Parser& parser, const void* val_ptr, name_stack_t void LLXUIParser::parserWarning(const std::string& message) { -#ifdef LL_WINDOWS - // use Visual Studio friendly formatting of output message for easy access to originating xml - LL_INFOS() << llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()) << LL_ENDL; -#else - Parser::parserWarning(message); -#endif + std::string warning_msg = llformat("%s:\t%s(%d)", message.c_str(), mCurFileName.c_str(), mCurReadNode->getLineNumber()); + Parser::parserWarning(warning_msg); } void LLXUIParser::parserError(const std::string& message) { -#ifdef LL_WINDOWS - // use Visual Studio friendly formatting of output message for easy access to originating xml - LL_INFOS() << llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()) << LL_ENDL; -#else - Parser::parserError(message); -#endif + std::string error_msg = llformat("%s:\t%s(%d)", message.c_str(), mCurFileName.c_str(), mCurReadNode->getLineNumber()); + Parser::parserError(error_msg); } @@ -1641,22 +1629,14 @@ bool LLSimpleXUIParser::processText() void LLSimpleXUIParser::parserWarning(const std::string& message) { -#ifdef LL_WINDOWS - // use Visual Studio friendly formatting of output message for easy access to originating xml - LL_INFOS() << llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()) << LL_ENDL; -#else - Parser::parserWarning(message); -#endif + std::string warning_msg = llformat("%s:\t%s", message.c_str(), mCurFileName.c_str()); + Parser::parserWarning(warning_msg); } void LLSimpleXUIParser::parserError(const std::string& message) { -#ifdef LL_WINDOWS - // use Visual Studio friendly formatting of output message for easy access to originating xml - LL_INFOS() << llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()) << LL_ENDL; -#else - Parser::parserError(message); -#endif + std::string error_msg = llformat("%s:\t%s", message.c_str(), mCurFileName.c_str()); + Parser::parserError(error_msg); } bool LLSimpleXUIParser::readFlag(Parser& parser, void* val_ptr) diff --git a/indra/llui/llxuiparser.h b/indra/llui/llxuiparser.h index ad2a39cab7..eb0eac8194 100644 --- a/indra/llui/llxuiparser.h +++ b/indra/llui/llxuiparser.h @@ -41,7 +41,9 @@ class LLView; // lookup widget type by name class LLWidgetTypeRegistry : public LLRegistrySingleton<std::string, const std::type_info*, LLWidgetTypeRegistry> -{}; +{ + LLSINGLETON_EMPTY_CTOR(LLWidgetTypeRegistry); +}; // global static instance for registering all widget types @@ -51,7 +53,9 @@ typedef LLRegistry<std::string, LLWidgetCreatorFunc> widget_registry_t; class LLChildRegistryRegistry : public LLRegistrySingleton<const std::type_info*, widget_registry_t, LLChildRegistryRegistry> -{}; +{ + LLSINGLETON_EMPTY_CTOR(LLChildRegistryRegistry); +}; class LLXSDWriter : public LLInitParam::Parser { @@ -60,7 +64,7 @@ public: void writeXSD(const std::string& name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace); /*virtual*/ std::string getCurrentElementName() { return LLStringUtil::null; } - + /*virtual*/ std::string getCurrentFileName() { return LLStringUtil::null; } LLXSDWriter(); ~LLXSDWriter(); @@ -98,6 +102,7 @@ public: typedef LLInitParam::Parser::name_stack_t name_stack_t; /*virtual*/ std::string getCurrentElementName(); + /*virtual*/ std::string getCurrentFileName() { return mCurFileName; } /*virtual*/ void parserWarning(const std::string& message); /*virtual*/ void parserError(const std::string& message); @@ -200,6 +205,7 @@ public: virtual ~LLSimpleXUIParser(); /*virtual*/ std::string getCurrentElementName(); + /*virtual*/ std::string getCurrentFileName() { return mCurFileName; } /*virtual*/ void parserWarning(const std::string& message); /*virtual*/ void parserError(const std::string& message); diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index f01178c374..338be1808d 100644..100755 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -31,6 +31,7 @@ #include "llcachename.h" #include "lluuid.h" #include "message.h" +#include "llpounceable.h" #include <string> @@ -165,7 +166,7 @@ LLFontGL* LLFontGL::getFontDefault() char const* const _PREHASH_AgentData = (char *)"AgentData"; char const* const _PREHASH_AgentID = (char *)"AgentID"; -LLMessageSystem* gMessageSystem = NULL; +LLPounceable<LLMessageSystem*, LLPounceableStatic> gMessageSystem; // // Stub implementation for LLMessageSystem |