From 58ee415c4972c37256cbd23e2c96cc5f644944d1 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 24 Nov 2009 11:39:22 -0800 Subject: Fixed line editor right padding to work when left padding also assigned Eliminated UILineEditorHPad and added 2 px of padding to all custom line editors. EXT-1735 Show parcel property icons Review with Leyla pending --- indra/newview/lllocationinputctrl.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/lllocationinputctrl.h') diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index 3bd23e80a9..608176290e 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -65,7 +65,8 @@ public: add_landmark_image_disabled, add_landmark_image_hover, add_landmark_image_selected; - Optional icon_hpad; + Optional icon_hpad, + add_landmark_hpad; Optional add_landmark_button, info_button; Optional voice_icon, @@ -139,7 +140,8 @@ private: LLMenuGL* mLocationContextMenu; LLButton* mAddLandmarkBtn; LLButton* mInfoBtn; - S32 mIconHPad; + S32 mIconHPad; // pad between all icons + S32 mAddLandmarkHPad; // pad to left of landmark star enum EParcelIcon { -- cgit v1.3 From 123ef91f2d3a402cf17fe8245c5c237167dc5400 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 24 Nov 2009 17:28:02 -0800 Subject: Partial EXT-1735 added "for sale" clickable icon next to landmark star --- indra/newview/lllocationinputctrl.cpp | 57 +++++++++++++--------- indra/newview/lllocationinputctrl.h | 2 + .../default/xui/en/widgets/location_input.xml | 11 ++++- 3 files changed, 47 insertions(+), 23 deletions(-) (limited to 'indra/newview/lllocationinputctrl.h') diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index a57aea5734..bb713aba19 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -161,6 +161,7 @@ LLLocationInputCtrl::Params::Params() add_landmark_hpad("add_landmark_hpad", 0), icon_hpad("icon_hpad", 0), add_landmark_button("add_landmark_button"), + for_sale_button("for_sale_button"), info_button("info_button"), voice_icon("voice_icon"), fly_icon("fly_icon"), @@ -176,9 +177,10 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) : LLComboBox(p), mIconHPad(p.icon_hpad), mAddLandmarkHPad(p.add_landmark_hpad), - mInfoBtn(NULL), mLocationContextMenu(NULL), mAddLandmarkBtn(NULL), + mForSaleBtn(NULL), + mInfoBtn(NULL), mLandmarkImageOn(NULL), mLandmarkImageOff(NULL) { @@ -239,6 +241,11 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) mAddLandmarkBtn = LLUICtrlFactory::create(al_params); enableAddLandmarkButton(true); addChild(mAddLandmarkBtn); + + LLButton::Params for_sale_button = p.for_sale_button; + mForSaleBtn = LLUICtrlFactory::create( for_sale_button ); + // *TODO: Make clickable? + addChild(mForSaleBtn); // Parcel property icons LLIconCtrl::Params voice_icon = p.voice_icon; @@ -607,17 +614,30 @@ void LLLocationInputCtrl::refreshLocation() setText(location_name); } +// returns new right edge +static S32 layout_widget(LLUICtrl* widget, S32 right) +{ + if (widget->getVisible()) + { + LLRect rect = widget->getRect(); + rect.mLeft = right - rect.getWidth(); + rect.mRight = right; + widget->setRect( rect ); + right -= rect.getWidth(); + } + return right; +} + void LLLocationInputCtrl::refreshParcelIcons() { // Our "cursor" moving right to left - S32 x = mAddLandmarkBtn->getRect().mLeft - mAddLandmarkHPad; + S32 x = mAddLandmarkBtn->getRect().mLeft - mIconHPad; static LLUICachedControl show_properties("NavBarShowParcelProperties", false); if (show_properties) { LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); - // *TODO buy - //bool allow_buy = vpm->canAgentBuyParcel( vpm->getAgentParcel(), false); + bool allow_buy = vpm->canAgentBuyParcel( vpm->getAgentParcel(), false); bool allow_voice = vpm->allowAgentVoice(); bool allow_fly = vpm->allowAgentFly(); bool allow_push = vpm->allowAgentPush(); @@ -626,6 +646,7 @@ void LLLocationInputCtrl::refreshParcelIcons() bool allow_damage = vpm->allowAgentDamage(); // Most icons are "block this ability" + mForSaleBtn->setVisible(allow_buy); mParcelIcon[VOICE_ICON]->setVisible( !allow_voice ); mParcelIcon[FLY_ICON]->setVisible( !allow_fly ); mParcelIcon[PUSH_ICON]->setVisible( !allow_push ); @@ -634,28 +655,22 @@ void LLLocationInputCtrl::refreshParcelIcons() mParcelIcon[DAMAGE_ICON]->setVisible( allow_damage ); mDamageText->setVisible(allow_damage); - // Slide the parcel icons rect from right to left, adjusting rectangles of - // visible icons. Assumes all icon rects are the same. + x = layout_widget(mForSaleBtn, x); + // Padding goes to left of both landmark star and for sale btn + x -= mAddLandmarkHPad; + + // Slide the parcel icons rect from right to left, adjusting rectangles for (S32 i = 0; i < ICON_COUNT; ++i) { - LLIconCtrl* icon = mParcelIcon[i]; - if (icon->getVisible()) - { - LLRect r = icon->getRect(); - r.mLeft = x - r.getWidth(); - r.mRight = x; - icon->setRect( r ); - x -= r.getWidth() + mIconHPad; - } + x = layout_widget(mParcelIcon[i], x); + x -= mIconHPad; } - LLRect text_rect = mDamageText->getRect(); - text_rect.mLeft = x - text_rect.getWidth(); - text_rect.mRight = x; - mDamageText->setRect(text_rect); - x -= text_rect.getWidth() + mIconHPad; + x = layout_widget(mDamageText, x); + x -= mIconHPad; } else { + mForSaleBtn->setVisible(false); for (S32 i = 0; i < ICON_COUNT; ++i) { mParcelIcon[i]->setVisible(false); @@ -666,8 +681,6 @@ void LLLocationInputCtrl::refreshParcelIcons() S32 left_pad, right_pad; mTextEntry->getTextPadding(&left_pad, &right_pad); right_pad = mTextEntry->getRect().mRight - x; - llinfos << "JAMESDEBUG text entry rect " << mTextEntry->getRect() - << " x " << x << " left_pad " << left_pad << " right_pad " << right_pad << llendl; mTextEntry->setTextPadding(left_pad, right_pad); } diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index 608176290e..442a64f521 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -68,6 +68,7 @@ public: Optional icon_hpad, add_landmark_hpad; Optional add_landmark_button, + for_sale_button, info_button; Optional voice_icon, fly_icon, @@ -139,6 +140,7 @@ private: LLMenuGL* mLocationContextMenu; LLButton* mAddLandmarkBtn; + LLButton* mForSaleBtn; LLButton* mInfoBtn; S32 mIconHPad; // pad between all icons S32 mAddLandmarkHPad; // pad to left of landmark star diff --git a/indra/newview/skins/default/xui/en/widgets/location_input.xml b/indra/newview/skins/default/xui/en/widgets/location_input.xml index 5984634e4c..90887dead6 100644 --- a/indra/newview/skins/default/xui/en/widgets/location_input.xml +++ b/indra/newview/skins/default/xui/en/widgets/location_input.xml @@ -11,7 +11,7 @@ add_landmark_image_disabled="Favorite_Star_Off" add_landmark_image_hover="Favorite_Star_Over" add_landmark_image_selected="Favorite_Star_Press" - add_landmark_hpad="8" + add_landmark_hpad="10" icon_hpad="2" allow_text_entry="true" list_position="below" @@ -39,6 +39,15 @@ scale_image="false" top="19" left="-3" /> + Date: Wed, 25 Nov 2009 11:51:49 -0800 Subject: Hook up nav bar For Sale icon to buy land functionality. --- indra/newview/lllocationinputctrl.cpp | 7 +++++++ indra/newview/lllocationinputctrl.h | 1 + indra/newview/llviewermenu.cpp | 17 ++++++++++------- indra/newview/llviewermenu.h | 2 ++ 4 files changed, 20 insertions(+), 7 deletions(-) (limited to 'indra/newview/lllocationinputctrl.h') diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index bb713aba19..45c60df84f 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -243,6 +243,8 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) addChild(mAddLandmarkBtn); LLButton::Params for_sale_button = p.for_sale_button; + for_sale_button.click_callback.function( + boost::bind(&LLLocationInputCtrl::onForSaleButtonClicked, this)); mForSaleBtn = LLUICtrlFactory::create( for_sale_button ); // *TODO: Make clickable? addChild(mForSaleBtn); @@ -474,6 +476,11 @@ void LLLocationInputCtrl::onInfoButtonClicked() LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "agent")); } +void LLLocationInputCtrl::onForSaleButtonClicked() +{ + handle_buy_land(); +} + void LLLocationInputCtrl::onAddLandmarkButtonClicked() { LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos(); diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index 442a64f521..0211062b05 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -132,6 +132,7 @@ private: void onLocationPrearrange(const LLSD& data); void onTextEditorRightClicked(S32 x, S32 y, MASK mask); void onLandmarkLoaded(LLLandmark* lm); + void onForSaleButtonClicked(); void onAddLandmarkButtonClicked(); void onAgentParcelChange(); // callbacks diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index f853a70c87..4307002980 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -5628,12 +5628,7 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "buy land") { - if (LLViewerParcelMgr::getInstance()->selectionEmpty()) - { - LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); - } - - LLViewerParcelMgr::getInstance()->startBuyLand(); + handle_buy_land(); } else if (floater_name == "script errors") { @@ -5843,7 +5838,15 @@ BOOL enable_buy_land(void*) LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(), false); } - +void handle_buy_land() +{ + LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); + if (vpm->selectionEmpty()) + { + vpm->selectParcelAt(gAgent.getPositionGlobal()); + } + vpm->startBuyLand(); +} class LLObjectAttachToAvatar : public view_listener_t { diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 9a6fe03f9f..01a6b34170 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -102,6 +102,8 @@ void handle_take_copy(); void handle_look_at_selection(const LLSD& param); void handle_zoom_to_object(LLUUID object_id); +void handle_buy_land(); + // Takes avatar UUID, or if no UUID passed, uses last selected object void handle_avatar_freeze(const LLSD& avatar_id); -- cgit v1.3