From 97d03860fc6f1c2aaa9122826e34042ebc7e1fe4 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 12 Sep 2011 14:33:41 -0700 Subject: EXP-1200 FIX -- Newness Badge shows in UI when dragging Inventory tab to undock * Sidetab buttons now have their visibility toggled when they are not displayed. * Sidetab passes visibility to its corresponding badge, if one exists. --- indra/newview/llsidetray.cpp | 255 +++++++++++++++++++++++-------------------- 1 file changed, 139 insertions(+), 116 deletions(-) (limited to 'indra') diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index f53b08a4bc..55d6378ad8 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -62,6 +62,8 @@ using namespace std; using namespace LLNotificationsUI; +class LLSideTrayButton; + static LLRootViewRegistry::Register t1("side_tray"); static LLDefaultChildRegistry::Register t2("sidetray_tab"); @@ -168,8 +170,131 @@ private: bool mHasBadge; LLBadge::Params mBadgeParams; + LLSideTrayButton* mSideTrayButton; +}; + +////////////////////////////////////////////////////////////////////////////// +// LLSideTrayButton +// Side Tray tab button with "tear off" handling. +////////////////////////////////////////////////////////////////////////////// + +class LLSideTrayButton : public LLButton +{ +public: + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) + { + // Route future Mouse messages here preemptively. (Release on mouse up.) + // No handler needed for focus lost since this class has no state that depends on it. + gFocusMgr.setMouseCapture(this); + + localPointToScreen(x, y, &mDragLastScreenX, &mDragLastScreenY); + + // Note: don't pass on to children + return TRUE; + } + + /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) + { + // We only handle the click if the click both started and ended within us + if( !hasMouseCapture() ) return FALSE; + + S32 screen_x; + S32 screen_y; + localPointToScreen(x, y, &screen_x, &screen_y); + + S32 delta_x = screen_x - mDragLastScreenX; + S32 delta_y = screen_y - mDragLastScreenY; + + LLSideTray* side_tray = LLSideTray::getInstance(); + + // Check if the tab we are dragging is docked. + if (!side_tray->isTabAttached(mTabName)) return FALSE; + + // Same value is hardcoded in LLDragHandle::handleHover(). + const S32 undock_threshold = 12; + + // Detach a tab if it has been pulled further than undock_threshold. + if (delta_x <= -undock_threshold || delta_x >= undock_threshold || + delta_y <= -undock_threshold || delta_y >= undock_threshold) + { + LLSideTrayTab* tab = side_tray->getTab(mTabName); + if (!tab) return FALSE; + + tab->setDocked(false); + + LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab->getName()); + if (!floater_tab) return FALSE; + + LLRect original_rect = floater_tab->getRect(); + S32 header_snap_y = floater_tab->getHeaderHeight() / 2; + S32 snap_x = screen_x - original_rect.mLeft - original_rect.getWidth() / 2; + S32 snap_y = screen_y - original_rect.mTop + header_snap_y; + + // Move the floater to appear "under" the mouse pointer. + floater_tab->setRect(original_rect.translate(snap_x, snap_y)); + + // Snap the mouse pointer to the center of the floater header + // and call 'mouse down' event handler to begin dragging. + floater_tab->handleMouseDown(original_rect.getWidth() / 2, + original_rect.getHeight() - header_snap_y, + mask); + + return TRUE; + } + + return FALSE; + } + + void setBadgeDriver(LLSideTrayTabBadgeDriver* driver) + { + mBadgeDriver = driver; + } + + void setVisible(BOOL visible) + { + setBadgeVisibility(visible); + + LLButton::setVisible(visible); + } + +protected: + LLSideTrayButton(const LLButton::Params& p) + : LLButton(p) + , mDragLastScreenX(0) + , mDragLastScreenY(0) + , mBadgeDriver(NULL) + { + // Find out the tab name to use in handleHover(). + size_t pos = getName().find("_button"); + llassert(pos != std::string::npos); + mTabName = getName().substr(0, pos); + } + + friend class LLUICtrlFactory; + + void draw() + { + if (mBadgeDriver) + { + setBadgeLabel(mBadgeDriver->getBadgeString()); + } + + LLButton::draw(); + } + +private: + S32 mDragLastScreenX; + S32 mDragLastScreenY; + + std::string mTabName; + LLSideTrayTabBadgeDriver* mBadgeDriver; }; + +//////////////////////////////////////////////////// +// LLSideTrayTab implementation +//////////////////////////////////////////////////// + LLSideTrayTab::LLSideTrayTab(const Params& p) : LLPanel(), mTabTitle(p.tab_title), @@ -177,7 +302,8 @@ LLSideTrayTab::LLSideTrayTab(const Params& p) mImageSelected(p.image_selected), mDescription(p.description), mMainPanel(NULL), - mBadgeParams(p.badge) + mBadgeParams(p.badge), + mSideTrayButton(NULL) { mHasBadge = p.badge.isProvided(); } @@ -271,6 +397,11 @@ void LLSideTrayTab::toggleTabDocked(bool toggle_floater /* = true */) bool docking = !isDocked(); + if (mSideTrayButton) + { + mSideTrayButton->setVisible(docking); + } + // Hide the "Tear Off" button when a tab gets undocked // and show "Dock" button instead. getChild("undock")->setVisible(docking); @@ -461,116 +592,6 @@ LLSideTrayTab* LLSideTrayTab::createInstance () template <> LLPanel* tab_cast(LLSideTrayTab* tab) { return tab; } -////////////////////////////////////////////////////////////////////////////// -// LLSideTrayButton -// Side Tray tab button with "tear off" handling. -////////////////////////////////////////////////////////////////////////////// - -class LLSideTrayButton : public LLButton -{ -public: - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) - { - // Route future Mouse messages here preemptively. (Release on mouse up.) - // No handler needed for focus lost since this class has no state that depends on it. - gFocusMgr.setMouseCapture(this); - - localPointToScreen(x, y, &mDragLastScreenX, &mDragLastScreenY); - - // Note: don't pass on to children - return TRUE; - } - - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) - { - // We only handle the click if the click both started and ended within us - if( !hasMouseCapture() ) return FALSE; - - S32 screen_x; - S32 screen_y; - localPointToScreen(x, y, &screen_x, &screen_y); - - S32 delta_x = screen_x - mDragLastScreenX; - S32 delta_y = screen_y - mDragLastScreenY; - - LLSideTray* side_tray = LLSideTray::getInstance(); - - // Check if the tab we are dragging is docked. - if (!side_tray->isTabAttached(mTabName)) return FALSE; - - // Same value is hardcoded in LLDragHandle::handleHover(). - const S32 undock_threshold = 12; - - // Detach a tab if it has been pulled further than undock_threshold. - if (delta_x <= -undock_threshold || delta_x >= undock_threshold || - delta_y <= -undock_threshold || delta_y >= undock_threshold) - { - LLSideTrayTab* tab = side_tray->getTab(mTabName); - if (!tab) return FALSE; - - tab->setDocked(false); - - LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab->getName()); - if (!floater_tab) return FALSE; - - LLRect original_rect = floater_tab->getRect(); - S32 header_snap_y = floater_tab->getHeaderHeight() / 2; - S32 snap_x = screen_x - original_rect.mLeft - original_rect.getWidth() / 2; - S32 snap_y = screen_y - original_rect.mTop + header_snap_y; - - // Move the floater to appear "under" the mouse pointer. - floater_tab->setRect(original_rect.translate(snap_x, snap_y)); - - // Snap the mouse pointer to the center of the floater header - // and call 'mouse down' event handler to begin dragging. - floater_tab->handleMouseDown(original_rect.getWidth() / 2, - original_rect.getHeight() - header_snap_y, - mask); - - return TRUE; - } - - return FALSE; - } - - void setBadgeDriver(LLSideTrayTabBadgeDriver* driver) - { - mBadgeDriver = driver; - } - -protected: - LLSideTrayButton(const LLButton::Params& p) - : LLButton(p) - , mDragLastScreenX(0) - , mDragLastScreenY(0) - , mBadgeDriver(NULL) - { - // Find out the tab name to use in handleHover(). - size_t pos = getName().find("_button"); - llassert(pos != std::string::npos); - mTabName = getName().substr(0, pos); - } - - friend class LLUICtrlFactory; - - void draw() - { - if (mBadgeDriver) - { - setBadgeLabel(mBadgeDriver->getBadgeString()); - } - - LLButton::draw(); - } - -private: - S32 mDragLastScreenX; - S32 mDragLastScreenY; - - std::string mTabName; - LLSideTrayTabBadgeDriver* mBadgeDriver; -}; - ////////////////////////////////////////////////////////////////////////////// // LLSideTray ////////////////////////////////////////////////////////////////////////////// @@ -786,7 +807,7 @@ bool LLSideTray::selectTabByName(const std::string& name, bool keep_prev_visible { // Keep previously active tab visible if requested. if (keep_prev_visible) tab_to_keep_visible = mActiveTab; - toggleTabButton(mActiveTab); + toggleTabButton(mActiveTab); } //select new tab @@ -794,9 +815,9 @@ bool LLSideTray::selectTabByName(const std::string& name, bool keep_prev_visible if (mActiveTab) { - toggleTabButton(mActiveTab); - LLSD key;//empty - mActiveTab->onOpen(key); + toggleTabButton(mActiveTab); + LLSD key;//empty + mActiveTab->onOpen(key); } //arrange(); @@ -976,7 +997,9 @@ LLButton* LLSideTrayTab::createButton(bool allowTearOff, LLUICtrl::commit_callba LLButton* button; if (allowTearOff) { - button = LLUICtrlFactory::create(bparams); + mSideTrayButton = LLUICtrlFactory::create(bparams); + + button = mSideTrayButton; } else { -- cgit v1.2.3 From ba96fb5c2b6801398481a30189f991cff98fed8b Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 12 Sep 2011 16:06:58 -0700 Subject: EXP-1199 FIX -- Inbox new tag sometimes differs from recent item delivery times, sim timezone settings differences suspected. * LastInventoryInboxActivity setting now stored as the value of time_correct(), the corrected time difference (established at login) between the client and official SL time. --- indra/newview/app_settings/settings_per_account.xml | 14 +++++++------- indra/newview/llpanelmarketplaceinbox.cpp | 2 +- indra/newview/llpanelmarketplaceinboxinventory.cpp | 14 +++++--------- indra/newview/llsidepanelinventory.cpp | 4 ++-- 4 files changed, 15 insertions(+), 19 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index c7140283f1..d8295ddb87 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -34,15 +34,15 @@ LastInventoryInboxActivity - - Comment + + Comment The last time the received items inbox was poked by the user. - Persist + Persist 1 - Type - String - Value - + Type + U32 + Value + 0 LastLogoff diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 2cb91f771f..4ea2ea24a1 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -116,7 +116,7 @@ void LLPanelMarketplaceInbox::onFocusReceived() sidepanel_inventory->clearSelections(true, false, true); - gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString()); + gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); } BOOL LLPanelMarketplaceInbox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp index d51aa73c93..f525dbf434 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp @@ -192,20 +192,16 @@ void LLInboxFolderViewFolder::draw() void LLInboxFolderViewFolder::computeFreshness() { - const std::string& last_expansion = gSavedPerAccountSettings.getString("LastInventoryInboxActivity"); + const U32 last_expansion = gSavedPerAccountSettings.getU32("LastInventoryInboxActivity"); - if (!last_expansion.empty()) + if (last_expansion > 0) { - // Inventory DB timezone is hardcoded to PDT or GMT-7, which is 7 hours behind GMT - const F64 SEVEN_HOURS_IN_SECONDS = 7 * 60 * 60; - const F64 saved_freshness_inventory_db_timezone = LLDate(last_expansion).secondsSinceEpoch() - SEVEN_HOURS_IN_SECONDS; - - mFresh = (mCreationDate > saved_freshness_inventory_db_timezone); + mFresh = (mCreationDate > last_expansion); #if DEBUGGING_FRESHNESS if (mFresh) { - llinfos << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << saved_freshness_inventory_db_timezone << llendl; + llinfos << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << last_expansion << llendl; } #endif } @@ -219,7 +215,7 @@ void LLInboxFolderViewFolder::deFreshify() { mFresh = false; - gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString()); + gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); } void LLInboxFolderViewFolder::selectItem() diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 9814e5b81a..bd62b5c101 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -539,7 +539,7 @@ void LLSidepanelInventory::onToggleInboxBtn() if (inbox_expanded && inboxPanel->isInVisibleChain()) { - gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString()); + gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); } } @@ -568,7 +568,7 @@ void LLSidepanelInventory::onOpen(const LLSD& key) #else if (mInboxEnabled && getChild(INBOX_BUTTON_NAME)->getToggleState()) { - gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString()); + gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected()); } #endif -- cgit v1.2.3 From 860962d365ba49d063d2f934706a6e4832352b4b Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 12 Sep 2011 18:00:52 -0700 Subject: EXP-1063 FIX Destination Guide link in side panel does not open to destination guide specific search window fixed param->LLSD serialization to not introduce empty strings --- indra/llui/llsdparam.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra') diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 9ad13054cb..7deedb18b8 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -159,6 +159,11 @@ LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack) it != name_stack.end(); ++it) { + if (it->first.empty()) + { + continue; + } + bool new_array_entry = false; if (prev_it == mNameStack.end()) { -- cgit v1.2.3 From 3f4a063758d1ff795258272065c1f7f72a5d4efd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 13 Sep 2011 10:58:51 -0700 Subject: increased fast timer history to 300 to make fast timers more usable --- indra/llcommon/llfasttimer_class.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llcommon/llfasttimer_class.h b/indra/llcommon/llfasttimer_class.h index 827747f0c6..f481e968a6 100644 --- a/indra/llcommon/llfasttimer_class.h +++ b/indra/llcommon/llfasttimer_class.h @@ -66,7 +66,7 @@ public: public: ~NamedTimer(); - enum { HISTORY_NUM = 60 }; + enum { HISTORY_NUM = 300 }; const std::string& getName() const { return mName; } NamedTimer* getParent() const { return mParent; } -- cgit v1.2.3 From 201d0659192977071ff0fc2219a28ecbc3025171 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 13 Sep 2011 11:17:02 -0700 Subject: EXP-1071 FIX -- User can drag items to Received Items folder under Recent Tab * Inventory panel now has an optional "accepts_drag_and_drop" parameter set to true by default. * Recent Inventory Panel sets "accepts_drag_and_drop" to false. * Items can still be dragged out of Recent to a second inventory panel. Reviewed by Leyla. --- indra/newview/llinventorypanel.cpp | 26 +++++++++++++--------- indra/newview/llinventorypanel.h | 5 ++++- .../skins/default/xui/en/panel_main_inventory.xml | 5 +++-- .../default/xui/en/widgets/inventory_panel.xml | 11 ++++----- 4 files changed, 29 insertions(+), 18 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 173e5c6ae6..615d3aefde 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -129,6 +129,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : mScroller(NULL), mSortOrderSetting(p.sort_order_setting), mInventory(p.inventory), + mAcceptsDragAndDrop(p.accepts_drag_and_drop), mAllowMultiSelect(p.allow_multi_select), mShowItemLinkOverlays(p.show_item_link_overlays), mShowLoadStatus(p.show_load_status), @@ -824,19 +825,24 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EAcceptance* accept, std::string& tooltip_msg) { - BOOL handled = LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + BOOL handled = FALSE; - // If folder view is empty the (x, y) point won't be in its rect - // so the handler must be called explicitly. - // but only if was not handled before. See EXT-6746. - if (!handled && !mFolderRoot->hasVisibleChildren()) + if (mAcceptsDragAndDrop) { - handled = mFolderRoot->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - } + handled = LLPanel::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - if (handled) - { - mFolderRoot->setDragAndDropThisFrame(); + // If folder view is empty the (x, y) point won't be in its rect + // so the handler must be called explicitly. + // but only if was not handled before. See EXT-6746. + if (!handled && !mFolderRoot->hasVisibleChildren()) + { + handled = mFolderRoot->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + } + + if (handled) + { + mFolderRoot->setDragAndDropThisFrame(); + } } return handled; diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index cfb84bf4b7..8635ebc5c8 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -86,6 +86,7 @@ public: Optional use_label_suffix; Optional show_load_status; Optional scroll; + Optional accepts_drag_and_drop; Params() : sort_order_setting("sort_order_setting"), @@ -96,7 +97,8 @@ public: start_folder("start_folder"), use_label_suffix("use_label_suffix", true), show_load_status("show_load_status"), - scroll("scroll") + scroll("scroll"), + accepts_drag_and_drop("accepts_drag_and_drop") {} }; @@ -181,6 +183,7 @@ protected: LLInventoryModel* mInventory; LLInventoryObserver* mInventoryObserver; LLInvPanelComplObserver* mCompletionObserver; + BOOL mAcceptsDragAndDrop; BOOL mAllowMultiSelect; BOOL mShowItemLinkOverlays; // Shows link graphic over inventory item icons BOOL mShowLoadStatus; diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml index 888230a00e..e6c5110999 100644 --- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml @@ -82,10 +82,11 @@ left="0" name="All Items" sort_order_setting="InventorySortOrder" - show_item_link_overlays="true" + show_item_link_overlays="true" top="16" width="288" /> + name="Inventory Scroller" + follows="all" + reserve_scroll_corner="true" + tab_stop="true" + /> -- cgit v1.2.3 From 781fded069d877ea9c07d5e5077178f65ef82e7a Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 13 Sep 2011 14:26:02 -0700 Subject: EXP-1010 FIX -- Received Items panel scroll snaps to current selection when Direct Delivery folders with a large # of items are being delivered from Marketplace * Updated the inventory filter isNotDefault() function to properly check the filter types and filter links flags against the default filter ops. * Updated the inbox and outbox to mark their date sort order as the default. Reviewed by Leyla. --- indra/newview/llinventoryfilter.cpp | 24 ++++++++++++++---------- indra/newview/llpanelmarketplaceinbox.cpp | 1 + indra/newview/llpanelmarketplaceoutbox.cpp | 5 ++++- 3 files changed, 19 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index d6278a5fda..516b47e616 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -256,16 +256,20 @@ std::string::size_type LLInventoryFilter::getStringMatchOffset() const // has user modified default filter params? BOOL LLInventoryFilter::isNotDefault() const { - return mFilterOps.mFilterObjectTypes != mDefaultFilterOps.mFilterObjectTypes - || mFilterOps.mFilterCategoryTypes != mDefaultFilterOps.mFilterCategoryTypes - || mFilterOps.mFilterWearableTypes != mDefaultFilterOps.mFilterWearableTypes - || mFilterOps.mFilterTypes != FILTERTYPE_OBJECT - || mFilterOps.mFilterLinks != FILTERLINK_INCLUDE_LINKS - || mFilterSubString.size() - || mFilterOps.mPermissions != mDefaultFilterOps.mPermissions - || mFilterOps.mMinDate != mDefaultFilterOps.mMinDate - || mFilterOps.mMaxDate != mDefaultFilterOps.mMaxDate - || mFilterOps.mHoursAgo != mDefaultFilterOps.mHoursAgo; + BOOL not_default = FALSE; + + not_default |= (mFilterOps.mFilterObjectTypes != mDefaultFilterOps.mFilterObjectTypes); + not_default |= (mFilterOps.mFilterCategoryTypes != mDefaultFilterOps.mFilterCategoryTypes); + not_default |= (mFilterOps.mFilterWearableTypes != mDefaultFilterOps.mFilterWearableTypes); + not_default |= (mFilterOps.mFilterTypes != mDefaultFilterOps.mFilterTypes); + not_default |= (mFilterOps.mFilterLinks != mDefaultFilterOps.mFilterLinks); + not_default |= (mFilterSubString.size()); + not_default |= (mFilterOps.mPermissions != mDefaultFilterOps.mPermissions); + not_default |= (mFilterOps.mMinDate != mDefaultFilterOps.mMinDate); + not_default |= (mFilterOps.mMaxDate != mDefaultFilterOps.mMaxDate); + not_default |= (mFilterOps.mHoursAgo != mDefaultFilterOps.mHoursAgo); + + return not_default; } BOOL LLInventoryFilter::isActive() const diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 4ea2ea24a1..0579ecbb90 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -97,6 +97,7 @@ LLInventoryPanel * LLPanelMarketplaceInbox::setupInventoryPanel() // Set the sort order newest to oldest mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE); + mInventoryPanel->getFilter()->markDefault(); // Set selection callback for proper update of inventory status buttons mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceInbox::onSelectionChange, this)); diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp index 839369bffe..73fb92ff72 100644 --- a/indra/newview/llpanelmarketplaceoutbox.cpp +++ b/indra/newview/llpanelmarketplaceoutbox.cpp @@ -117,8 +117,11 @@ LLInventoryPanel * LLPanelMarketplaceOutbox::setupInventoryPanel() LLRect inventory_placeholder_rect = outbox_inventory_placeholder->getRect(); mInventoryPanel->setShape(inventory_placeholder_rect); - // Set the sort order newest to oldest, and a selection change callback + // Set the sort order newest to oldest mInventoryPanel->setSortOrder(LLInventoryFilter::SO_DATE); + mInventoryPanel->getFilter()->markDefault(); + + // Set selection callback for proper update of inventory status buttons mInventoryPanel->setSelectCallback(boost::bind(&LLPanelMarketplaceOutbox::onSelectionChange, this)); // Set up the note to display when the outbox is empty -- cgit v1.2.3 From 8b7c07651c4e2c57e06c283243b30e03da327b42 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 14 Sep 2011 10:50:32 -0700 Subject: improved fast timers display can move and resize better visualization of timer history can click drag to browse history increased frame history to 300 --- indra/llcommon/llfasttimer_class.cpp | 19 +-- indra/llcommon/llfasttimer_class.h | 2 +- indra/newview/lldebugview.cpp | 8 +- indra/newview/llfasttimerview.cpp | 154 ++++++++++++--------- indra/newview/llfasttimerview.h | 7 +- indra/newview/llviewerfloaterreg.cpp | 2 + indra/newview/llviewermenu.cpp | 4 +- .../skins/default/xui/en/floater_fast_timers.xml | 28 ++++ 8 files changed, 131 insertions(+), 93 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/floater_fast_timers.xml (limited to 'indra') diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp index ebb5961c91..463f558c2c 100644 --- a/indra/llcommon/llfasttimer_class.cpp +++ b/indra/llcommon/llfasttimer_class.cpp @@ -303,14 +303,15 @@ LLFastTimer::NamedTimer::~NamedTimer() std::string LLFastTimer::NamedTimer::getToolTip(S32 history_idx) { + F64 ms_multiplier = 1000.0 / (F64)LLFastTimer::countsPerSecond(); if (history_idx < 0) { - // by default, show average number of calls - return llformat("%s (%d calls)", getName().c_str(), (S32)getCallAverage()); + // by default, show average number of call + return llformat("%s (%d ms, %d calls)", getName().c_str(), (S32)(getCountAverage() * ms_multiplier), (S32)getCallAverage()); } else { - return llformat("%s (%d calls)", getName().c_str(), (S32)getHistoricalCalls(history_idx)); + return llformat("%s (%d ms, %d calls)", getName().c_str(), (S32)(getHistoricalCount(history_idx) * ms_multiplier), (S32)getHistoricalCalls(history_idx)); } } @@ -693,17 +694,7 @@ void LLFastTimer::nextFrame() llinfos << "Slow frame, fast timers inaccurate" << llendl; } - if (sPauseHistory) - { - sResetHistory = true; - } - else if (sResetHistory) - { - sLastFrameIndex = 0; - sCurFrameIndex = 0; - sResetHistory = false; - } - else // not paused + if (!sPauseHistory) { NamedTimer::processTimes(); sLastFrameIndex = sCurFrameIndex++; diff --git a/indra/llcommon/llfasttimer_class.h b/indra/llcommon/llfasttimer_class.h index 827747f0c6..f481e968a6 100644 --- a/indra/llcommon/llfasttimer_class.h +++ b/indra/llcommon/llfasttimer_class.h @@ -66,7 +66,7 @@ public: public: ~NamedTimer(); - enum { HISTORY_NUM = 60 }; + enum { HISTORY_NUM = 300 }; const std::string& getName() const { return mName; } NamedTimer* getParent() const { return mParent; } diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index 216cc66ef8..cc6ba05e7e 100644 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -41,6 +41,7 @@ #include "llmemoryview.h" #include "llsceneview.h" #include "llviewertexture.h" +#include "llfloaterreg.h" // // Globals @@ -79,12 +80,7 @@ void LLDebugView::init() r.setLeftTopAndSize(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f), (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f)); - mFastTimerView = new LLFastTimerView(r); - mFastTimerView->setFollowsTop(); - mFastTimerView->setFollowsLeft(); - mFastTimerView->setVisible(FALSE); // start invisible - addChild(mFastTimerView); - mFastTimerView->setRect(rect); + mFastTimerView = dynamic_cast(LLFloaterReg::getInstance("fast_timers")); gSceneView = new LLSceneView(r); gSceneView->setFollowsTop(); diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 366154302c..a161428c2b 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -80,12 +80,10 @@ static timer_tree_iterator_t end_timer_tree() return timer_tree_iterator_t(); } -LLFastTimerView::LLFastTimerView(const LLRect& rect) -: LLFloater(LLSD()), +LLFastTimerView::LLFastTimerView(const LLSD& key) +: LLFloater(key), mHoverTimer(NULL) { - setRect(rect); - setVisible(FALSE); mDisplayMode = 0; mAvgCountTotal = 0; mMaxCountTotal = 0; @@ -98,10 +96,30 @@ LLFastTimerView::LLFastTimerView(const LLRect& rect) FTV_NUM_TIMERS = LLFastTimer::NamedTimer::instanceCount(); mPrintStats = -1; mAverageCyclesPerTimer = 0; - setCanMinimize(false); - setCanClose(true); } +void LLFastTimerView::onPause() +{ + LLFastTimer::sPauseHistory = !LLFastTimer::sPauseHistory; + // reset scroll to bottom when unpausing + if (!LLFastTimer::sPauseHistory) + { + mScrollIndex = 0; + getChild("pause_btn")->setLabel(getString("pause")); + } + else + { + getChild("pause_btn")->setLabel(getString("run")); + } +} + +BOOL LLFastTimerView::postBuild() +{ + LLButton& pause_btn = getChildRef("pause_btn"); + + pause_btn.setCommitCallback(boost::bind(&LLFastTimerView::onPause, this)); + return TRUE; +} BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) { @@ -116,14 +134,16 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) { mHoverTimer->getParent()->setCollapsed(true); } + return TRUE; } else if (mBarRect.pointInRect(x, y)) { S32 bar_idx = MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight()); bar_idx = llclamp(bar_idx, 0, MAX_VISIBLE_HISTORY); mPrintStats = LLFastTimer::NamedTimer::HISTORY_NUM - mScrollIndex - bar_idx; + return TRUE; } - return FALSE; + return LLFloater::handleRightMouseDown(x, y, mask); } LLFastTimer::NamedTimer* LLFastTimerView::getLegendID(S32 y) @@ -151,18 +171,6 @@ BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask) BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) { - - { - S32 local_x = x - mButtons[BUTTON_CLOSE]->getRect().mLeft; - S32 local_y = y - mButtons[BUTTON_CLOSE]->getRect().mBottom; - if(mButtons[BUTTON_CLOSE]->getVisible() - && mButtons[BUTTON_CLOSE]->pointInView(local_x, local_y) ) - { - return LLFloater::handleMouseDown(x, y, mask);; - } - } - - if (x < mBarRect.mLeft) { LLFastTimer::NamedTimer* idp = getLegendID(y); @@ -196,36 +204,42 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) { mDisplayCenter = (ChildAlignment)((mDisplayCenter + 1) % ALIGN_COUNT); } - else + else if (mGraphRect.pointInRect(x, y)) { - // pause/unpause - LLFastTimer::sPauseHistory = !LLFastTimer::sPauseHistory; - // reset scroll to bottom when unpausing - if (!LLFastTimer::sPauseHistory) - { - mScrollIndex = 0; - } + gFocusMgr.setMouseCapture(this); + return TRUE; } - // SJB: Don't pass mouse clicks through the display - return TRUE; + //else + //{ + // // pause/unpause + // LLFastTimer::sPauseHistory = !LLFastTimer::sPauseHistory; + // // reset scroll to bottom when unpausing + // if (!LLFastTimer::sPauseHistory) + // { + // mScrollIndex = 0; + // } + //} + return LLFloater::handleMouseDown(x, y, mask); } BOOL LLFastTimerView::handleMouseUp(S32 x, S32 y, MASK mask) { + if (hasMouseCapture()) { - S32 local_x = x - mButtons[BUTTON_CLOSE]->getRect().mLeft; - S32 local_y = y - mButtons[BUTTON_CLOSE]->getRect().mBottom; - if(mButtons[BUTTON_CLOSE]->getVisible() - && mButtons[BUTTON_CLOSE]->pointInView(local_x, local_y) ) - { - return LLFloater::handleMouseUp(x, y, mask);; - } + gFocusMgr.setMouseCapture(NULL); } - return FALSE; + return LLFloater::handleMouseUp(x, y, mask);; } BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) { + if (hasMouseCapture()) + { + F32 lerp = llclamp(1.f - (F32) (x - mGraphRect.mLeft) / (F32) mGraphRect.getWidth(), 0.f, 1.f); + mScrollIndex = llround( lerp * (F32)(LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); + mScrollIndex = llclamp( mScrollIndex, 0, LLFastTimer::getLastFrameIndex()); + return TRUE; + } mHoverTimer = NULL; mHoverID = NULL; @@ -282,7 +296,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) } } - return FALSE; + return LLFloater::handleHover(x, y, mask); } @@ -318,15 +332,15 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) } } } - - return FALSE; + + return LLFloater::handleToolTip(x, y, mask); } BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) { LLFastTimer::sPauseHistory = TRUE; - mScrollIndex = llclamp(mScrollIndex - clicks, - 0, + mScrollIndex = llclamp( mScrollIndex + clicks, + 0, llmin(LLFastTimer::getLastFrameIndex(), (S32)LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); return TRUE; } @@ -345,8 +359,8 @@ void LLFastTimerView::draw() F64 iclock_freq = 1000.0 / clock_freq; S32 margin = 10; - S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f); - S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f); + S32 height = getRect().getHeight(); + S32 width = getRect().getWidth(); LLRect new_rect; new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); @@ -630,7 +644,6 @@ void LLFastTimerView::draw() LLFontGL::LEFT, LLFontGL::TOP); } - LLRect graph_rect; // Draw borders { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -663,9 +676,9 @@ void LLFastTimerView::draw() by = LINE_GRAPH_HEIGHT-barh-dy-7; //line graph - graph_rect = LLRect(xleft-5, by, getRect().getWidth()-5, 5); + mGraphRect = LLRect(xleft-5, by, getRect().getWidth()-5, 5); - gl_rect_2d(graph_rect, FALSE); + gl_rect_2d(mGraphRect, FALSE); } mBarStart.clear(); @@ -813,7 +826,7 @@ void LLFastTimerView::draw() //draw line graph history { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLLocalClipRect clip(graph_rect); + LLLocalClipRect clip(mGraphRect); //normalize based on last frame's maximum static U64 last_max = 0; @@ -830,8 +843,8 @@ void LLFastTimerView::draw() else tdesc = llformat("%4.2f ms", ms); - x = graph_rect.mRight - LLFontGL::getFontMonospace()->getWidth(tdesc)-5; - y = graph_rect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight()); + x = mGraphRect.mRight - LLFontGL::getFontMonospace()->getWidth(tdesc)-5; + y = mGraphRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight()); LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); @@ -841,24 +854,24 @@ void LLFastTimerView::draw() S32 first_frame = LLFastTimer::NamedTimer::HISTORY_NUM - mScrollIndex; S32 last_frame = first_frame - MAX_VISIBLE_HISTORY; - F32 frame_delta = ((F32) (graph_rect.getWidth()))/(LLFastTimer::NamedTimer::HISTORY_NUM-1); + F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(LLFastTimer::NamedTimer::HISTORY_NUM-1); - F32 right = (F32) graph_rect.mLeft + frame_delta*first_frame; - F32 left = (F32) graph_rect.mLeft + frame_delta*last_frame; + F32 right = (F32) mGraphRect.mLeft + frame_delta*first_frame; + F32 left = (F32) mGraphRect.mLeft + frame_delta*last_frame; gGL.color4f(0.5f,0.5f,0.5f,0.3f); - gl_rect_2d((S32) left, graph_rect.mTop, (S32) right, graph_rect.mBottom); + gl_rect_2d((S32) left, mGraphRect.mTop, (S32) right, mGraphRect.mBottom); if (mHoverBarIndex >= 0) { S32 bar_frame = first_frame - mHoverBarIndex; - F32 bar = (F32) graph_rect.mLeft + frame_delta*bar_frame; + F32 bar = (F32) mGraphRect.mLeft + frame_delta*bar_frame; gGL.color4f(0.5f,0.5f,0.5f,1); gGL.begin(LLRender::LINES); - gGL.vertex2i((S32)bar, graph_rect.mBottom); - gGL.vertex2i((S32)bar, graph_rect.mTop); + gGL.vertex2i((S32)bar, mGraphRect.mBottom); + gGL.vertex2i((S32)bar, mGraphRect.mTop); gGL.end(); } } @@ -883,7 +896,7 @@ void LLFastTimerView::draw() if (mHoverID != NULL && idp != mHoverID) - { //fade out non-hihglighted timers + { //fade out non-highlighted timers if (idp->getParent() != mHoverID) { alpha = alpha_interp; @@ -891,8 +904,10 @@ void LLFastTimerView::draw() } gGL.color4f(col[0], col[1], col[2], alpha); - gGL.begin(LLRender::LINE_STRIP); - for (U32 j = 0; j < LLFastTimer::NamedTimer::HISTORY_NUM; j++) + gGL.begin(LLRender::TRIANGLE_STRIP); + for (U32 j = llmax(0, LLFastTimer::NamedTimer::HISTORY_NUM - LLFastTimer::getLastFrameIndex()); + j < LLFastTimer::NamedTimer::HISTORY_NUM; + j++) { U64 ticks = idp->getHistoricalCount(j); @@ -912,9 +927,10 @@ void LLFastTimerView::draw() //normalize to highlighted timer cur_max = llmax(cur_max, ticks); } - F32 x = graph_rect.mLeft + ((F32) (graph_rect.getWidth()))/(LLFastTimer::NamedTimer::HISTORY_NUM-1)*j; - F32 y = graph_rect.mBottom + (F32) graph_rect.getHeight()/max_ticks*ticks; + F32 x = mGraphRect.mLeft + ((F32) (mGraphRect.getWidth()))/(LLFastTimer::NamedTimer::HISTORY_NUM-1)*j; + F32 y = mGraphRect.mBottom + (F32) mGraphRect.getHeight()/max_ticks*ticks; gGL.vertex2f(x,y); + gGL.vertex2f(x,mGraphRect.mBottom); } gGL.end(); @@ -932,18 +948,20 @@ void LLFastTimerView::draw() } //interpolate towards new maximum - F32 dt = gFrameIntervalSeconds*3.f; - last_max = (U64) ((F32) last_max + ((F32) cur_max- (F32) last_max) * dt); + last_max = (U64) lerp((F32)last_max, (F32) cur_max, LLCriticalDamp::getInterpolant(0.1f)); + if (last_max - cur_max <= 1 || cur_max - last_max <= 1) + { + last_max = cur_max; + } F32 alpha_target = last_max > cur_max ? llmin((F32) last_max/ (F32) cur_max - 1.f,1.f) : llmin((F32) cur_max/ (F32) last_max - 1.f,1.f); - - alpha_interp = alpha_interp + (alpha_target-alpha_interp) * dt; + alpha_interp = lerp(alpha_interp, alpha_target, LLCriticalDamp::getInterpolant(0.1f)); if (mHoverID != NULL) { - x = (graph_rect.mRight + graph_rect.mLeft)/2; - y = graph_rect.mBottom + 8; + x = (mGraphRect.mRight + mGraphRect.mLeft)/2; + y = mGraphRect.mBottom + 8; LLFontGL::getFontMonospace()->renderUTF8( mHoverID->getName(), diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index ea8251191b..a349e7ad4c 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -33,8 +33,9 @@ class LLFastTimerView : public LLFloater { public: - LLFastTimerView(const LLRect& rect); - + LLFastTimerView(const LLSD&); + BOOL postBuild(); + static BOOL sAnalyzePerformance; static void outputAllMetrics(); @@ -44,6 +45,7 @@ private: static void doAnalysisDefault(std::string baseline, std::string target, std::string output) ; static LLSD analyzePerformanceLogDefault(std::istream& is) ; static void exportCharts(const std::string& base, const std::string& target); + void onPause(); public: @@ -89,6 +91,7 @@ private: LLFrameTimer mHighlightTimer; S32 mPrintStats; S32 mAverageCyclesPerTimer; + LLRect mGraphRect; }; #endif diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index fecc6d91bd..4af5fdd9f3 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -33,6 +33,7 @@ #include "llcompilequeue.h" #include "llcallfloater.h" +#include "llfasttimerview.h" #include "llfloaterabout.h" #include "llfloateranimpreview.h" #include "llfloaterauction.h" @@ -159,6 +160,7 @@ void LLViewerFloaterReg::registerFloaters() // *NOTE: Please keep these alphabetized for easier merges LLFloaterAboutUtil::registerFloater(); + LLFloaterReg::add("fast_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 26599f557e..754731b290 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -523,7 +523,7 @@ class LLAdvancedToggleConsole : public view_listener_t } else if ("fast timers" == console_type) { - toggle_visibility( (void*)gDebugView->mFastTimerView ); + LLFloaterReg::toggleInstance("fast_timers"); } else if ("scene view" == console_type) { @@ -563,7 +563,7 @@ class LLAdvancedCheckConsole : public view_listener_t } else if ("fast timers" == console_type) { - new_value = get_visibility( (void*)gDebugView->mFastTimerView ); + new_value = LLFloaterReg::instanceVisible("fast_timers"); } else if ("scene view" == console_type) { diff --git a/indra/newview/skins/default/xui/en/floater_fast_timers.xml b/indra/newview/skins/default/xui/en/floater_fast_timers.xml new file mode 100644 index 0000000000..49aa8f3840 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_fast_timers.xml @@ -0,0 +1,28 @@ + + + Pause + Run +