From a7ee24a9ed954a09632ebe9371a0c1783fee9dc3 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 16 Jan 2009 15:41:01 -0600 Subject: Use UI callbacks to initiate rebuilding filter. Instead of rebuilding from draw() every frame. --- ChangeLog.txt | 9 ++++++ linden/indra/newview/llinventoryview.cpp | 47 +++++++++++++++++++++++++++++++- linden/indra/newview/llinventoryview.h | 4 +++ 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index ba3afcd..1b7aaea 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,12 @@ +2009-01-16 Jacek Antonelli + + * linden/indra/newview/llinventoryview.cpp: + Use UI callbacks to initiate rebuilding filter. + Instead of rebuilding from draw() every frame. + * linden/indra/newview/llinventoryview.h: + Ditto. + + 2009-01-15 Jacek Antonelli * linden/indra/newview/llfolderview.cpp: diff --git a/linden/indra/newview/llinventoryview.cpp b/linden/indra/newview/llinventoryview.cpp index 4576ff9..401d6e2 100644 --- a/linden/indra/newview/llinventoryview.cpp +++ b/linden/indra/newview/llinventoryview.cpp @@ -118,6 +118,21 @@ LLInventoryViewFinder::LLInventoryViewFinder(const std::string& name, LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inventory_view_finder.xml"); + + childSetCommitCallback("check_animation", onCheckFilterType, this); + childSetCommitCallback("check_bodypart", onCheckFilterType, this); + childSetCommitCallback("check_calling_card", onCheckFilterType, this); + childSetCommitCallback("check_clothing", onCheckFilterType, this); + childSetCommitCallback("check_gesture", onCheckFilterType, this); + childSetCommitCallback("check_landmark", onCheckFilterType, this); + childSetCommitCallback("check_notecard", onCheckFilterType, this); + childSetCommitCallback("check_object", onCheckFilterType, this); + childSetCommitCallback("check_script", onCheckFilterType, this); + childSetCommitCallback("check_sound", onCheckFilterType, this); + childSetCommitCallback("check_texture", onCheckFilterType, this); + childSetCommitCallback("check_snapshot", onCheckFilterType, this); + + childSetAction("All", selectAllTypes, this); childSetAction("None", selectNoTypes, this); @@ -127,6 +142,8 @@ LLInventoryViewFinder::LLInventoryViewFinder(const std::string& name, mSpinSinceDays = getChild("spin_days_ago"); childSetCommitCallback("spin_days_ago", onTimeAgo, this); + childSetCommitCallback("check_show_empty", onCheckShowEmptyFolders, this); + // mCheckSinceLogoff = getChild("check_since_logoff"); childSetCommitCallback("check_since_logoff", onCheckSinceLogoff, this); @@ -136,6 +153,16 @@ LLInventoryViewFinder::LLInventoryViewFinder(const std::string& name, } +// Callback when an inventory type checkbox is changed. +void LLInventoryViewFinder::onCheckFilterType(LLUICtrl *ctrl, void *user_data) +{ + LLInventoryViewFinder *self = (LLInventoryViewFinder *)user_data; + if (!self) return; + + self->rebuildFilter(); +} + + void LLInventoryViewFinder::onCheckSinceLogoff(LLUICtrl *ctrl, void *user_data) { LLInventoryViewFinder *self = (LLInventoryViewFinder *)user_data; @@ -148,6 +175,8 @@ void LLInventoryViewFinder::onCheckSinceLogoff(LLUICtrl *ctrl, void *user_data) { self->mSpinSinceHours->set(1.0f); } + + self->rebuildFilter(); } void LLInventoryViewFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data) @@ -161,8 +190,20 @@ void LLInventoryViewFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data) since_logoff = false; } self->childSetValue("check_since_logoff", since_logoff); + + self->rebuildFilter(); +} + + +void LLInventoryViewFinder::onCheckShowEmptyFolders(LLUICtrl *ctrl, void *user_data) +{ + LLInventoryViewFinder *self = (LLInventoryViewFinder *)user_data; + if (!self) return; + + self->rebuildFilter(); } + void LLInventoryViewFinder::changeFilter(LLInventoryFilter* filter) { mFilter = filter; @@ -203,7 +244,6 @@ void LLInventoryViewFinder::updateElementsFromFilter() void LLInventoryViewFinder::draw() { - rebuildFilter(); LLFloater::draw(); } @@ -362,6 +402,9 @@ void LLInventoryViewFinder::selectAllTypes(void* user_data) self->mCheckSound->set(TRUE); self->mCheckTexture->set(TRUE); self->mCheckSnapshot->set(TRUE);*/ + + self->rebuildFilter(); + } //static @@ -396,6 +439,8 @@ void LLInventoryViewFinder::selectNoTypes(void* user_data) self->childSetValue("check_sound", FALSE); self->childSetValue("check_texture", FALSE); self->childSetValue("check_snapshot", FALSE); + + self->rebuildFilter(); } diff --git a/linden/indra/newview/llinventoryview.h b/linden/indra/newview/llinventoryview.h index 26f3003..439f869 100644 --- a/linden/indra/newview/llinventoryview.h +++ b/linden/indra/newview/llinventoryview.h @@ -170,7 +170,11 @@ public: BOOL getCheckShowEmpty(); BOOL getCheckSinceLogoff(); + /** Callback when an inventory type checkbox is changed. */ + static void onCheckFilterType(LLUICtrl *ctrl, void *user_data); + static void onTimeAgo(LLUICtrl*, void *); + static void onCheckShowEmptyFolders(LLUICtrl*, void *); static void onCheckSinceLogoff(LLUICtrl*, void *); static void onCloseBtn(void* user_data); static void selectAllTypes(void* user_data); -- cgit v1.1