From 0daf4297d43e97a4b715196e9821cc290ebd65b3 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 13 Nov 2009 16:16:12 -0800 Subject: EXT-2484 Auto Set Touch to Buy when a user checks the For Sale option Reviewed with Richard. --- indra/newview/llpanelpermissions.cpp | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 2d3f901370..1051326e72 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -970,19 +970,32 @@ void LLPanelPermissions::setAllSaleInfo() if (price < 0) sale_type = LLSaleInfo::FS_NOT; - LLSaleInfo sale_info(sale_type, price); - LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(sale_info); + LLSaleInfo old_sale_info; + LLSelectMgr::getInstance()->selectGetSaleInfo(old_sale_info); + + LLSaleInfo new_sale_info(sale_type, price); + LLSelectMgr::getInstance()->selectionSetObjectSaleInfo(new_sale_info); - // If turned off for-sale, make sure click-action buy is turned - // off as well - if (sale_type == LLSaleInfo::FS_NOT) + U8 old_click_action = 0; + LLSelectMgr::getInstance()->selectionGetClickAction(&old_click_action); + + if (old_sale_info.isForSale() + && !new_sale_info.isForSale() + && old_click_action == CLICK_ACTION_BUY) { - U8 click_action = 0; - LLSelectMgr::getInstance()->selectionGetClickAction(&click_action); - if (click_action == CLICK_ACTION_BUY) - { - LLSelectMgr::getInstance()->selectionSetClickAction(CLICK_ACTION_TOUCH); - } + // If turned off for-sale, make sure click-action buy is turned + // off as well + LLSelectMgr::getInstance()-> + selectionSetClickAction(CLICK_ACTION_TOUCH); + } + else if (new_sale_info.isForSale() + && !old_sale_info.isForSale() + && old_click_action == CLICK_ACTION_TOUCH) + { + // If just turning on for-sale, preemptively turn on one-click buy + // unless user have a different click action set + LLSelectMgr::getInstance()-> + selectionSetClickAction(CLICK_ACTION_BUY); } } -- cgit v1.2.3 From d5efbfcd2874dd7045baabe33944da37e738872e Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 16 Nov 2009 12:36:35 -0800 Subject: Convert mForcePressedState to bool from BOOL --- indra/llui/llbutton.cpp | 2 +- indra/llui/llbutton.h | 4 ++-- indra/llui/llmenubutton.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index bbaf908d2e..b65f248db2 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -146,7 +146,7 @@ LLButton::LLButton(const LLButton::Params& p) mHoverGlowStrength(p.hover_glow_amount), mCommitOnReturn(p.commit_on_return), mFadeWhenDisabled(FALSE), - mForcePressedState(FALSE), + mForcePressedState(false), mLastDrawCharsCount(0) { static LLUICachedControl llbutton_orig_h_pad ("UIButtonOrigHPad", 0); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 08f289092f..3c1b57c4be 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -238,7 +238,7 @@ public: static void setDockableFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname); static void showHelp(LLUICtrl* ctrl, const LLSD& sdname); - void setForcePressedState(BOOL b) { mForcePressedState = b; } + void setForcePressedState(bool b) { mForcePressedState = b; } protected: LLPointer getImageUnselected() const { return mImageUnselected; } @@ -315,7 +315,7 @@ private: BOOL mNeedsHighlight; BOOL mCommitOnReturn; BOOL mFadeWhenDisabled; - BOOL mForcePressedState; + bool mForcePressedState; LLFrameTimer mFlashingTimer; }; diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index a657ed039a..cdbd17e4dc 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -133,11 +133,11 @@ void LLMenuButton::draw() if (mMenuVisibleLastFrame) { - setForcePressedState(TRUE); + setForcePressedState(true); } LLButton::draw(); - setForcePressedState(FALSE); + setForcePressedState(false); } -- cgit v1.2.3 From 7cc233b3a83bd82f7a42bf1f64901d2578beaf2c Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 16 Nov 2009 12:52:25 -0800 Subject: EXT-772 Dropbox widget needs "pressed" state - currently shows wrong art Reviewed with Richard. --- indra/llui/llcombobox.cpp | 19 +++++++++++++++++-- indra/llui/llcombobox.h | 3 ++- indra/newview/skins/default/textures/textures.xml | 1 + indra/newview/skins/default/xui/en/widgets/button.xml | 4 ++++ .../skins/default/xui/en/widgets/combo_box.xml | 4 +++- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 36e309d639..803978bfa2 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -109,7 +109,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) // Text label button LLButton::Params button_params = (mAllowTextEntry ? p.combo_button : p.drop_down_button); - button_params.mouse_down_callback.function(boost::bind(&LLComboBox::onButtonDown, this)); + button_params.mouse_down_callback.function( + boost::bind(&LLComboBox::onButtonMouseDown, this)); button_params.follows.flags(FOLLOWS_LEFT|FOLLOWS_BOTTOM|FOLLOWS_RIGHT); button_params.rect(p.rect); @@ -140,6 +141,10 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) mList = LLUICtrlFactory::create(params); addChild(mList); + // Mouse-down on button will transfer mouse focus to the list + // Grab the mouse-up event and make sure the button state is correct + mList->setMouseUpCallback(boost::bind(&LLComboBox::onListMouseUp, this)); + for (LLInitParam::ParamIterator::const_iterator it = p.items().begin(); it != p.items().end(); ++it) @@ -644,7 +649,7 @@ void LLComboBox::hideList() } } -void LLComboBox::onButtonDown() +void LLComboBox::onButtonMouseDown() { if (!mList->getVisible()) { @@ -670,6 +675,10 @@ void LLComboBox::onButtonDown() if (mButton->hasMouseCapture()) { gFocusMgr.setMouseCapture(mList); + + // But keep the "pressed" look, which buttons normally lose when they + // lose focus + mButton->setForcePressedState(true); } } else @@ -679,6 +688,12 @@ void LLComboBox::onButtonDown() } +void LLComboBox::onListMouseUp() +{ + // In some cases this is the termination of a mouse click that started on + // the button, so clear its pressed state + mButton->setForcePressedState(false); +} //------------------------------------------------------------------ // static functions diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 6285ca5170..11acdb9b8f 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -204,7 +204,8 @@ public: void setButtonVisible(BOOL visible); - void onButtonDown(); + void onButtonMouseDown(); + void onListMouseUp(); void onItemSelected(const LLSD& data); void onTextCommit(const LLSD& data); diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index d5293bdbb5..8af65b25e9 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -106,6 +106,7 @@ + diff --git a/indra/newview/skins/default/xui/en/widgets/button.xml b/indra/newview/skins/default/xui/en/widgets/button.xml index 5bb48ef5aa..6b11e72247 100644 --- a/indra/newview/skins/default/xui/en/widgets/button.xml +++ b/indra/newview/skins/default/xui/en/widgets/button.xml @@ -1,4 +1,8 @@ +