From 5baf0de6a396b120aba4e2351ed5bff70f2562ef Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Mon, 19 Sep 2011 19:13:39 +0300 Subject: EXP-1203 FIXED (As a FUI user, I want the address bar and favorites to be on one line) - Relocated address bar, combined with favorite landmarks EXP-1208 - Added dragger to change amount of space allocated to address bar and favorites bar EXP-1217 - Modified Favorites ->> More spillover EXP-1218 - Combined context menu menuitems for favorites & address bars EXP-1219 --- indra/newview/llfavoritesbar.cpp | 8 +- indra/newview/llfavoritesbar.h | 4 +- indra/newview/llnavigationbar.cpp | 148 ---------- indra/newview/llnavigationbar.h | 3 - indra/newview/llviewercontrol.cpp | 9 +- indra/newview/llviewerwindow.cpp | 11 +- indra/newview/skins/default/xui/en/main_view.xml | 2 +- .../skins/default/xui/en/menu_hide_navbar.xml | 13 +- .../skins/default/xui/en/panel_navigation_bar.xml | 319 +++++++++++---------- 9 files changed, 188 insertions(+), 329 deletions(-) diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 0b17d64eb0..63519b7c21 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -360,7 +360,7 @@ struct LLFavoritesSort LLFavoritesBarCtrl::Params::Params() : image_drag_indication("image_drag_indication"), - chevron_button("chevron_button"), + more_button("more_button"), label("label") { } @@ -389,9 +389,9 @@ LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p) gInventory.addObserver(this); //make chevron button - LLButton::Params chevron_button_params(p.chevron_button); - chevron_button_params.click_callback.function(boost::bind(&LLFavoritesBarCtrl::showDropDownMenu, this)); - mChevronButton = LLUICtrlFactory::create (chevron_button_params); + LLTextBox::Params more_button_params(p.more_button); + mChevronButton = LLUICtrlFactory::create (more_button_params); + mChevronButton->setClickedCallback(boost::bind(&LLFavoritesBarCtrl::showDropDownMenu, this)); addChild(mChevronButton); LLTextBox::Params label_param(p.label); diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h index 1a28731c4f..3811de3e2f 100644 --- a/indra/newview/llfavoritesbar.h +++ b/indra/newview/llfavoritesbar.h @@ -40,7 +40,7 @@ public: struct Params : public LLInitParam::Block { Optional image_drag_indication; - Optional chevron_button; + Optional more_button; Optional label; Params(); }; @@ -135,7 +135,7 @@ private: BOOL mShowDragMarker; LLUICtrl* mLandingTab; LLUICtrl* mLastTab; - LLButton* mChevronButton; + LLTextBox* mChevronButton; LLTextBox* mBarLabel; LLUUID mDragItemId; diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index 9d54ad7463..133168f0ba 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -736,151 +736,3 @@ int LLNavigationBar::getDefFavBarHeight() { return mDefaultFpRect.getHeight(); } - -void LLNavigationBar::showNavigationPanel(BOOL visible) -{ - bool fpVisible = gSavedSettings.getBOOL("ShowNavbarFavoritesPanel"); - - LLFavoritesBarCtrl* fb = getChild("favorite"); - LLPanel* navPanel = getChild("navigation_panel"); - - LLRect nbRect(getRect()); - LLRect fbRect(fb->getRect()); - - navPanel->setVisible(visible); - - if (visible) - { - if (fpVisible) - { - // Navigation Panel must be shown. Favorites Panel is visible. - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), mDefaultNbRect.getHeight()); - fbRect.setLeftTopAndSize(fbRect.mLeft, mDefaultFpRect.mTop, fbRect.getWidth(), fbRect.getHeight()); - - // this is duplicated in 'else' section because it should be called BEFORE fb->reshape - reshape(nbRect.getWidth(), nbRect.getHeight()); - setRect(nbRect); - // propagate size to parent container - getParent()->reshape(nbRect.getWidth(), nbRect.getHeight()); - - fb->reshape(fbRect.getWidth(), fbRect.getHeight()); - fb->setRect(fbRect); - } - else - { - // Navigation Panel must be shown. Favorites Panel is hidden. - - S32 height = mDefaultNbRect.getHeight() - mDefaultFpRect.getHeight() - FAVBAR_TOP_PADDING; - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), height); - - reshape(nbRect.getWidth(), nbRect.getHeight()); - setRect(nbRect); - getParent()->reshape(nbRect.getWidth(), nbRect.getHeight()); - } - } - else - { - if (fpVisible) - { - // Navigation Panel must be hidden. Favorites Panel is visible. - - S32 fpHeight = mDefaultFpRect.getHeight() + FAVBAR_TOP_PADDING; - S32 fpTop = fpHeight - (mDefaultFpRect.getHeight() / 2) + 1; - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), fpHeight); - fbRect.setLeftTopAndSize(fbRect.mLeft, fpTop, fbRect.getWidth(), mDefaultFpRect.getHeight()); - - // this is duplicated in 'else' section because it should be called BEFORE fb->reshape - reshape(nbRect.getWidth(), nbRect.getHeight()); - setRect(nbRect); - getParent()->reshape(nbRect.getWidth(), nbRect.getHeight()); - - fb->reshape(fbRect.getWidth(), fbRect.getHeight()); - fb->setRect(fbRect); - } - else - { - // Navigation Panel must be hidden. Favorites Panel is hidden. - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), 0); - - reshape(nbRect.getWidth(), nbRect.getHeight()); - setRect(nbRect); - getParent()->reshape(nbRect.getWidth(), nbRect.getHeight()); - } - } - - getChildView("bg_icon")->setVisible( visible && fpVisible); - getChildView("bg_icon_no_fav_bevel")->setVisible( visible && !fpVisible); - getChildView("bg_icon_no_nav_bevel")->setVisible( !visible && fpVisible); -} - -void LLNavigationBar::showFavoritesPanel(BOOL visible) -{ - bool npVisible = gSavedSettings.getBOOL("ShowNavbarNavigationPanel"); - - LLFavoritesBarCtrl* fb = getChild("favorite"); - - LLRect nbRect(getRect()); - LLRect fbRect(fb->getRect()); - - if (visible) - { - if (npVisible) - { - // Favorites Panel must be shown. Navigation Panel is visible. - - S32 fbHeight = fbRect.getHeight(); - S32 newHeight = nbRect.getHeight() + fbHeight + FAVBAR_TOP_PADDING; - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), newHeight); - fbRect.setLeftTopAndSize(mDefaultFpRect.mLeft, mDefaultFpRect.mTop, fbRect.getWidth(), fbRect.getHeight()); - } - else - { - // Favorites Panel must be shown. Navigation Panel is hidden. - - S32 fpHeight = mDefaultFpRect.getHeight() + FAVBAR_TOP_PADDING; - S32 fpTop = fpHeight - (mDefaultFpRect.getHeight() / 2) + 1; - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), fpHeight); - fbRect.setLeftTopAndSize(fbRect.mLeft, fpTop, fbRect.getWidth(), mDefaultFpRect.getHeight()); - } - - reshape(nbRect.getWidth(), nbRect.getHeight()); - setRect(nbRect); - getParent()->reshape(nbRect.getWidth(), nbRect.getHeight()); - - fb->reshape(fbRect.getWidth(), fbRect.getHeight()); - fb->setRect(fbRect); - } - else - { - if (npVisible) - { - // Favorites Panel must be hidden. Navigation Panel is visible. - - S32 fbHeight = fbRect.getHeight(); - S32 newHeight = nbRect.getHeight() - fbHeight - FAVBAR_TOP_PADDING; - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), newHeight); - } - else - { - // Favorites Panel must be hidden. Navigation Panel is hidden. - - nbRect.setLeftTopAndSize(nbRect.mLeft, nbRect.mTop, nbRect.getWidth(), 0); - } - - reshape(nbRect.getWidth(), nbRect.getHeight()); - setRect(nbRect); - getParent()->reshape(nbRect.getWidth(), nbRect.getHeight()); - } - - getChildView("bg_icon")->setVisible( npVisible && visible); - getChildView("bg_icon_no_fav_bevel")->setVisible( npVisible && !visible); - getChildView("bg_icon_no_nav_bevel")->setVisible( !npVisible && visible); - - fb->setVisible(visible); -} diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h index 3c9f8a762d..f200253de5 100644 --- a/indra/newview/llnavigationbar.h +++ b/indra/newview/llnavigationbar.h @@ -98,9 +98,6 @@ public: void handleLoginComplete(); void clearHistoryCache(); - void showNavigationPanel(BOOL visible); - void showFavoritesPanel(BOOL visible); - int getDefNavBarHeight(); int getDefFavBarHeight(); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index b87ca1eaec..cd522c9121 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -538,18 +538,12 @@ bool toggle_show_navigation_panel(const LLSD& newvalue) { bool value = newvalue.asBoolean(); - LLNavigationBar::getInstance()->showNavigationPanel(value); + LLNavigationBar::getInstance()->setVisible(value); gSavedSettings.setBOOL("ShowMiniLocationPanel", !value); return true; } -bool toggle_show_favorites_panel(const LLSD& newvalue) -{ - LLNavigationBar::getInstance()->showFavoritesPanel(newvalue.asBoolean()); - return true; -} - bool toggle_show_mini_location_panel(const LLSD& newvalue) { bool value = newvalue.asBoolean(); @@ -732,7 +726,6 @@ void settings_setup_listeners() gSavedSettings.getControl("UseDebugMenus")->getSignal()->connect(boost::bind(&show_debug_menus)); gSavedSettings.getControl("AgentPause")->getSignal()->connect(boost::bind(&toggle_agent_pause, _2)); gSavedSettings.getControl("ShowNavbarNavigationPanel")->getSignal()->connect(boost::bind(&toggle_show_navigation_panel, _2)); - gSavedSettings.getControl("ShowNavbarFavoritesPanel")->getSignal()->connect(boost::bind(&toggle_show_favorites_panel, _2)); gSavedSettings.getControl("ShowMiniLocationPanel")->getSignal()->connect(boost::bind(&toggle_show_mini_location_panel, _2)); gSavedSettings.getControl("ShowObjectRenderingCost")->getSignal()->connect(boost::bind(&toggle_show_object_render_cost, _2)); gSavedSettings.getControl("UpdaterServiceSetting")->getSignal()->connect(boost::bind(&toggle_updater_service_active, _2)); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 5893259d96..3665ed4b5b 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1885,12 +1885,7 @@ void LLViewerWindow::initWorldUI() if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel")) { - navbar->showNavigationPanel(FALSE); - } - - if (!gSavedSettings.getBOOL("ShowNavbarFavoritesPanel")) - { - navbar->showFavoritesPanel(FALSE); + navbar->setVisible(FALSE); } // Top Info bar @@ -2196,7 +2191,9 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible ) LLNavigationBar* navbarp = LLUI::getRootView()->findChild("navigation_bar"); if (navbarp) { - navbarp->setVisible( visible ); + // when it's time to show navigation bar we need to ensure that the user wants to see it + // i.e. ShowNavbarNavigationPanel option is true + navbarp->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") ); } } diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index a7d1aa963c..688349aa16 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -16,7 +16,7 @@ orientation="vertical" top="19"> - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_help_browser.xml b/indra/newview/skins/minimal/xui/en/floater_help_browser.xml deleted file mode 100644 index 477f210352..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_help_browser.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - Loading... - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_media_browser.xml b/indra/newview/skins/minimal/xui/en/floater_media_browser.xml deleted file mode 100644 index 4862146c94..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_media_browser.xml +++ /dev/null @@ -1,242 +0,0 @@ - - - - http://www.secondlife.com - - - http://support.secondlife.com - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_nearby_chat.xml b/indra/newview/skins/minimal/xui/en/floater_nearby_chat.xml deleted file mode 100644 index 74ac885202..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_nearby_chat.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_side_bar_tab.xml b/indra/newview/skins/minimal/xui/en/floater_side_bar_tab.xml deleted file mode 100644 index 83b1260620..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_side_bar_tab.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_web_content.xml b/indra/newview/skins/minimal/xui/en/floater_web_content.xml deleted file mode 100644 index 1d9a967d5a..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_web_content.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/inspect_avatar.xml b/indra/newview/skins/minimal/xui/en/inspect_avatar.xml deleted file mode 100644 index 853d5f8735..0000000000 --- a/indra/newview/skins/minimal/xui/en/inspect_avatar.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - -[AGE] - - -[SL_PROFILE] - - - - - - This is my second life description and I really think it is great. But for some reason my description is super extra long because I like to talk a whole lot - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/panel_group_control_panel.xml b/indra/newview/skins/minimal/xui/en/panel_group_control_panel.xml deleted file mode 100644 index abddc59296..0000000000 --- a/indra/newview/skins/minimal/xui/en/panel_group_control_panel.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - + -- cgit v1.2.3 From cb699e3f2d64999e9817d0c4df5b7f9484e8e722 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 27 Sep 2011 10:52:47 -0700 Subject: EXP-1252 Opening chat history crashes browser (from dev work in progress) EXP-1253 Entering text in chat bar does not show for other users (dev work in progress) --- indra/newview/llbottomtray.cpp | 6 +++--- indra/newview/llnearbychat.cpp | 39 +++++++-------------------------------- indra/newview/llnearbychat.h | 6 +++--- 3 files changed, 13 insertions(+), 38 deletions(-) diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 7a60903950..55c63edd74 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -400,7 +400,7 @@ void LLBottomTray::onMouselookModeOut() { mIsInLiteMode = false; mBottomTrayLite->setVisible(FALSE); - mNearbyChatBar->getChatBox()->setText(mBottomTrayLite->mNearbyChatBar->getChatBox()->getText()); + //mNearbyChatBar->getChatBox()->setText(mBottomTrayLite->mNearbyChatBar->getChatBox()->getText()); setVisible(TRUE); } @@ -413,8 +413,8 @@ void LLBottomTray::onMouselookModeIn() getParent()->addChild(mBottomTrayLite); mBottomTrayLite->setShape(getLocalRect()); - mBottomTrayLite->mNearbyChatBar->getChatBox()->setText(mNearbyChatBar->getChatBox()->getText()); - mBottomTrayLite->mGesturePanel->setVisible(gSavedSettings.getBOOL("ShowGestureButton")); + //mBottomTrayLite->mNearbyChatBar->getChatBox()->setText(mNearbyChatBar->getChatBox()->getText()); + //mBottomTrayLite->mGesturePanel->setVisible(gSavedSettings.getBOOL("ShowGestureButton")); mIsInLiteMode = true; } diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 361912a5cb..8d57ae3a32 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -58,7 +58,7 @@ static const S32 RESIZE_BAR_THICKNESS = 3; LLNearbyChat::LLNearbyChat(const LLSD& key) - : LLDockableFloater(NULL, false, false, key) + : LLFloater(key) ,mChatHistory(NULL) { @@ -86,20 +86,9 @@ BOOL LLNearbyChat::postBuild() mChatHistory = getChild("chat_history"); - if(!LLDockableFloater::postBuild()) + if(!LLFloater::postBuild()) return false; - if (getDockControl() == NULL) - { - setDockControl(new LLDockControl( - LLFloaterReg::getInstance("chat_bar"), this, - getDockTongue(), LLDockControl::TOP, boost::bind(&LLNearbyChat::getAllowedRect, this, _1))); - } - - //fix for EXT-4621 - //chrome="true" prevents floater from stilling capture - setIsChrome(true); - //chrome="true" hides floater caption if (mDragHandle) mDragHandle->setTitleVisible(TRUE); @@ -118,20 +107,6 @@ void LLNearbyChat::applySavedVariables() setRect(rect); } } - - - if(!LLFloater::getControlGroup()->controlExists(mDocStateControl)) - { - setDocked(true); - } - else - { - if (mDocStateControl.size() > 1) - { - bool dockState = LLFloater::getControlGroup()->getBOOL(mDocStateControl); - setDocked(dockState); - } - } } std::string appendTime() @@ -229,17 +204,17 @@ void LLNearbyChat::setVisible(BOOL visible) } } - LLDockableFloater::setVisible(visible); + LLFloater::setVisible(visible); } void LLNearbyChat::onOpen(const LLSD& key ) { - LLDockableFloater::onOpen(key); + LLFloater::onOpen(key); } void LLNearbyChat::setRect (const LLRect &rect) { - LLDockableFloater::setRect(rect); + LLFloater::setRect(rect); } void LLNearbyChat::getAllowedRect(LLRect& rect) @@ -367,7 +342,7 @@ BOOL LLNearbyChat::handleMouseDown(S32 x, S32 y, MASK mask) if(mChatHistory) mChatHistory->setFocus(TRUE); - return LLDockableFloater::handleMouseDown(x, y, mask); + return LLFloater::handleMouseDown(x, y, mask); } void LLNearbyChat::draw() @@ -380,5 +355,5 @@ void LLNearbyChat::draw() setTransparencyType(hasFocus() ? TT_ACTIVE : TT_INACTIVE); } - LLDockableFloater::draw(); + LLFloater::draw(); } diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 2ea79797f8..834a31bbf0 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -1,4 +1,4 @@ -/** + /** * @file llnearbychat.h * @brief nearby chat history scrolling panel implementation * @@ -27,14 +27,14 @@ #ifndef LL_LLNEARBYCHAT_H_ #define LL_LLNEARBYCHAT_H_ -#include "lldockablefloater.h" #include "llscrollbar.h" #include "llviewerchat.h" +#include "llfloater.h" class LLResizeBar; class LLChatHistory; -class LLNearbyChat: public LLDockableFloater +class LLNearbyChat: public LLFloater { public: LLNearbyChat(const LLSD& key); -- cgit v1.2.3 From 0f3221e25d6261d7f29b5b37391156c07fde1d0c Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 27 Sep 2011 21:05:05 +0300 Subject: EXP-1225 FIXED Added a floater for My Inventory side tab. - Replaced calls to LLSideTray with LLFloaterSidePanelContainer. - Added LLFloaterSidePanelContainer::getPanel() for getting custom type panels. --- indra/newview/llavataractions.cpp | 12 +++-- indra/newview/llfloatersidepanelcontainer.cpp | 18 ++++++- indra/newview/llfloatersidepanelcontainer.h | 23 +++++++++ indra/newview/llinspectobject.cpp | 3 +- indra/newview/llinventoryfunctions.cpp | 17 +++++-- indra/newview/llinventorypanel.cpp | 57 ++++++++-------------- indra/newview/llpanelmaininventory.cpp | 12 +++-- indra/newview/llpanelmarketplaceinbox.cpp | 16 +++--- indra/newview/llpanelmarketplaceoutbox.cpp | 17 ++++--- indra/newview/llsidepanelinventory.cpp | 20 +++++--- indra/newview/llviewerfloaterreg.cpp | 1 + indra/newview/llviewerinventory.cpp | 3 +- indra/newview/llviewermenu.cpp | 14 +++--- .../skins/default/xui/en/floater_my_inventory.xml | 20 ++++++++ indra/newview/skins/default/xui/en/menu_viewer.xml | 4 +- .../skins/minimal/xui/en/panel_bottomtray.xml | 2 +- 16 files changed, 158 insertions(+), 81 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/floater_my_inventory.xml diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 4cdfcea64e..efb46166b8 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -47,6 +47,7 @@ #include "llfloatergroups.h" #include "llfloaterreg.h" #include "llfloaterpay.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterwebcontent.h" #include "llfloaterworldmap.h" #include "llfolderview.h" @@ -438,8 +439,7 @@ void LLAvatarActions::csr(const LLUUID& id, std::string name) void LLAvatarActions::share(const LLUUID& id) { LLSD key; - LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); - + LLFloaterSidePanelContainer::showPanel("my_inventory", key); LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL,id); @@ -696,9 +696,11 @@ std::set LLAvatarActions::getInventorySelectedUUIDs() if (inventory_selected_uuids.empty()) { - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - - inventory_selected_uuids = sidepanel_inventory->getInboxOrOutboxSelectionList(); + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (sidepanel_inventory) + { + inventory_selected_uuids = sidepanel_inventory->getInboxOrOutboxSelectionList(); + } } return inventory_selected_uuids; diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index cf66fd1792..c73ec90a12 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -33,6 +33,9 @@ #include "llsidetraypanelcontainer.h" #include "lltransientfloatermgr.h" +//static +const std::string LLFloaterSidePanelContainer::sMainPanelName("main_panel"); + LLFloaterSidePanelContainer::LLFloaterSidePanelContainer(const LLSD& key, const Params& params) : LLFloater(key, params) { @@ -48,7 +51,7 @@ LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer() void LLFloaterSidePanelContainer::onOpen(const LLSD& key) { - getChild("main_panel")->onOpen(key); + getChild(sMainPanelName)->onOpen(key); } LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params) @@ -82,6 +85,17 @@ void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, con LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance(floater_name); if (floaterp) { - floaterp->openChildPanel("main_panel", panel_name); + floaterp->openChildPanel(sMainPanelName, panel_name); } } + +LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name, const std::string& panel_name) +{ + LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance(floater_name); + if (floaterp) + { + return floaterp->findChild(panel_name, true); + } + + return NULL; +} diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h index 7b4e7643ae..0d17a14c0b 100644 --- a/indra/newview/llfloatersidepanelcontainer.h +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -51,6 +51,29 @@ public: LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params); static void showPanel(const std::string& floater_name, const LLSD& panel_name); + + static LLPanel* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName); + + /** + * Gets the panel of given type T (doesn't show it or do anything else with it). + * + * @param floater_name a string specifying the floater to be searched for a child panel. + * @param panel_name a string specifying the child panel to get. + * @returns a pointer to the panel of given type T. + */ + template + static T* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName) + { + T* panel = dynamic_cast(getPanel(floater_name, panel_name)); + if (!panel) + { + llwarns << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << llendl; + } + return panel; + } + +private: + static const std::string sMainPanelName; }; #endif // LL_LLFLOATERSIDEPANELCONTAINER_H diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp index ee076f68ea..29d7a4a6b0 100644 --- a/indra/newview/llinspectobject.cpp +++ b/indra/newview/llinspectobject.cpp @@ -28,6 +28,7 @@ #include "llinspectobject.h" // Viewer +#include "llfloatersidepanelcontainer.h" #include "llinspect.h" #include "llmediaentry.h" #include "llnotificationsutil.h" // *TODO: Eliminate, add LLNotificationsUtil wrapper @@ -640,7 +641,7 @@ void LLInspectObject::onClickMoreInfo() { LLSD key; key["task"] = "task"; - LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); + LLFloaterSidePanelContainer::showPanel("my_inventory", key); closeFloater(); } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 0af013fde5..acec02b507 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -47,6 +47,7 @@ #include "llappviewer.h" //#include "llfirstuse.h" #include "llfloaterinventory.h" +#include "llfloatersidepanelcontainer.h" #include "llfocusmgr.h" #include "llfolderview.h" #include "llgesturemgr.h" @@ -459,22 +460,28 @@ BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id) void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id) { - LLSideTray::getInstance()->showPanel("sidepanel_inventory", LLSD().with("id", item_uuid).with("object", object_id)); + LLFloaterSidePanelContainer::showPanel("my_inventory", LLSD().with("id", item_uuid).with("object", object_id)); } void show_item_profile(const LLUUID& item_uuid) { LLUUID linked_uuid = gInventory.getLinkedItemID(item_uuid); - LLSideTray::getInstance()->showPanel("sidepanel_inventory", LLSD().with("id", linked_uuid)); + LLFloaterSidePanelContainer::showPanel("my_inventory", LLSD().with("id", linked_uuid)); } void show_item_original(const LLUUID& item_uuid) { + LLFloater* floater_my_inventory = LLFloaterReg::getInstance("my_inventory"); + if (!floater_my_inventory) + { + llwarns << "Could not find My Inventory floater" << llendl; + return; + } + //sidetray inventory panel - LLSidepanelInventory *sidepanel_inventory = - dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); - bool reset_inventory_filter = !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory"); + bool reset_inventory_filter = !floater_my_inventory->isInVisibleChain(); LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(); if (!active_panel) diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 173e5c6ae6..c4f810fc93 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -35,6 +35,7 @@ #include "llavataractions.h" #include "llfloaterinventory.h" #include "llfloaterreg.h" +#include "llfloatersidepanelcontainer.h" #include "llfolderview.h" #include "llimfloater.h" #include "llimview.h" @@ -1071,10 +1072,9 @@ void LLInventoryPanel::dumpSelectionInformation(void* user_data) BOOL is_inventorysp_active() { - if (!LLSideTray::getInstance()->isPanelActive("sidepanel_inventory")) return FALSE; - LLSidepanelInventory *inventorySP = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - if (!inventorySP) return FALSE; - return inventorySP->isMainInventoryPanelActive(); + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (!sidepanel_inventory || !sidepanel_inventory->isInVisibleChain()) return FALSE; + return sidepanel_inventory->isMainInventoryPanelActive(); } // static @@ -1084,34 +1084,24 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) LLInventoryPanel* res = NULL; LLFloater* active_inv_floaterp = NULL; - // A. If the inventory side panel is open, use that preferably. - if (is_inventorysp_active()) + LLFloater* floater_my_inventory = LLFloaterReg::getInstance("my_inventory"); + if (!floater_my_inventory) { - LLSidepanelInventory *inventorySP = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - if (inventorySP) - { - return inventorySP->getActivePanel(); - } + llwarns << "Could not find My Inventory floater" << llendl; + return FALSE; } - // or if it is in floater undocked from sidetray get it and remember z order of floater to later compare it - // with other inventory floaters order. - else if (!LLSideTray::getInstance()->isTabAttached("sidebar_inventory")) + + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + + // A. If the inventory side panel floater is open, use that preferably. + if (is_inventorysp_active()) { - LLSidepanelInventory *inventorySP = - dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - LLFloater* inv_floater = LLFloaterReg::findInstance("side_bar_tab", LLSD("sidebar_inventory")); - if (inventorySP && inv_floater) - { - res = inventorySP->getActivePanel(); - z_min = gFloaterView->getZOrder(inv_floater); - active_inv_floaterp = inv_floater; - } - else - { - llwarns << "Inventory tab is detached from sidetray, but either panel or floater were not found!" << llendl; - } + // Get the floater's z order to compare it to other inventory floaters' order later. + res = sidepanel_inventory->getActivePanel(); + z_min = gFloaterView->getZOrder(floater_my_inventory); + active_inv_floaterp = floater_my_inventory; } - + // B. Iterate through the inventory floaters and return whichever is on top. LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory"); for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter) @@ -1141,14 +1131,9 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) // C. If no panels are open and we don't want to force open a panel, then just abort out. if (!auto_open) return NULL; - // D. Open the inventory side panel and use that. - LLSD key; - LLSidepanelInventory *sidepanel_inventory = - dynamic_cast(LLSideTray::getInstance()->showPanel("sidepanel_inventory", key)); - if (sidepanel_inventory) - { - return sidepanel_inventory->getActivePanel(); - } + // D. Open the inventory side panel floater and use that. + floater_my_inventory->openFloater(); + return sidepanel_inventory->getActivePanel(); return NULL; } diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 858f5cf575..c1341af2ef 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -38,6 +38,7 @@ #include "llinventorymodelbackgroundfetch.h" #include "llinventorypanel.h" #include "llfiltereditor.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterreg.h" #include "llmenubutton.h" #include "lloutfitobserver.h" @@ -579,8 +580,13 @@ void LLPanelMainInventory::updateItemcountText() void LLPanelMainInventory::onFocusReceived() { - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (!sidepanel_inventory) + { + llwarns << "Could not find Inventory Panel in My Inventory floater" << llendl; + return; + } + sidepanel_inventory->clearSelections(false, true, true); } @@ -1164,7 +1170,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) if (command_name == "share") { - LLSidepanelInventory* parent = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + LLSidepanelInventory* parent = LLFloaterSidePanelContainer::getPanel("my_inventory"); return parent ? parent->canShare() : FALSE; } diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 2cb91f771f..a412eabc0a 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -32,6 +32,7 @@ #include "llappviewer.h" #include "llbutton.h" #include "llinventorypanel.h" +#include "llfloatersidepanelcontainer.h" #include "llfolderview.h" #include "llsidepanelinventory.h" #include "llviewercontrol.h" @@ -67,7 +68,7 @@ BOOL LLPanelMarketplaceInbox::postBuild() void LLPanelMarketplaceInbox::onSelectionChange() { - LLSidepanelInventory* sidepanel_inventory = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); sidepanel_inventory->updateVerbs(); } @@ -112,9 +113,11 @@ LLInventoryPanel * LLPanelMarketplaceInbox::setupInventoryPanel() void LLPanelMarketplaceInbox::onFocusReceived() { - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - - sidepanel_inventory->clearSelections(true, false, true); + LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->clearSelections(true, false, true); + } gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString()); } @@ -185,9 +188,10 @@ std::string LLPanelMarketplaceInbox::getBadgeString() const { std::string item_count_str(""); + LLPanel *inventory_panel = LLFloaterSidePanelContainer::getPanel("my_inventory"); + // If the inbox is visible, and the side panel is collapsed or expanded and not the inventory panel - if (getParent()->getVisible() && - (LLSideTray::getInstance()->getCollapsed() || !LLSideTray::getInstance()->isPanelActive("sidepanel_inventory"))) + if (getParent()->getVisible() && inventory_panel && !inventory_panel->isInVisibleChain()) { U32 item_count = getFreshItemCount(); diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp index 839369bffe..f0a4b9898d 100644 --- a/indra/newview/llpanelmarketplaceoutbox.cpp +++ b/indra/newview/llpanelmarketplaceoutbox.cpp @@ -33,6 +33,7 @@ #include "llbutton.h" #include "llcoros.h" #include "lleventcoro.h" +#include "llfloatersidepanelcontainer.h" #include "llinventorypanel.h" #include "llloadingindicator.h" #include "llnotificationsutil.h" @@ -89,16 +90,20 @@ void LLPanelMarketplaceOutbox::handleLoginComplete() void LLPanelMarketplaceOutbox::onFocusReceived() { - LLSidepanelInventory * sidepanel_inventory = LLSideTray::getInstance()->getPanel("sidepanel_inventory"); - - sidepanel_inventory->clearSelections(true, true, false); + LLSidepanelInventory * sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->clearSelections(true, true, false); + } } void LLPanelMarketplaceOutbox::onSelectionChange() { - LLSidepanelInventory* sidepanel_inventory = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - - sidepanel_inventory->updateVerbs(); + LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->updateVerbs(); + } } LLInventoryPanel * LLPanelMarketplaceOutbox::setupInventoryPanel() diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 9814e5b81a..e223de5469 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -34,6 +34,7 @@ #include "llbutton.h" #include "lldate.h" #include "llfirstuse.h" +#include "llfloatersidepanelcontainer.h" #include "llfoldertype.h" #include "llhttpclient.h" #include "llinventorybridge.h" @@ -172,16 +173,20 @@ LLSidepanelInventory::~LLSidepanelInventory() void handleInventoryDisplayInboxChanged() { - LLSidepanelInventory* sidepanel_inventory = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - - sidepanel_inventory->enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox")); + LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox")); + } } void handleInventoryDisplayOutboxChanged() { - LLSidepanelInventory* sidepanel_inventory = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); - - sidepanel_inventory->enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox")); + LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel("my_inventory"); + if (sidepanel_inventory) + { + sidepanel_inventory->enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox")); + } } BOOL LLSidepanelInventory::postBuild() @@ -283,6 +288,9 @@ BOOL LLSidepanelInventory::postBuild() gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged)); gSavedSettings.getControl("InventoryDisplayOutbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayOutboxChanged)); + // Update the verbs buttons state. + updateVerbs(); + return TRUE; } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index b30ef11978..bca166e390 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -223,6 +223,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("moveview", "floater_moveview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("mute_object_by_name", "floater_mute_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("mini_map", "floater_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("my_inventory", "floater_my_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("my_profile", "floater_my_profile.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("notifications_console", "floater_notifications_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index ad65a8846c..d798f1900f 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -35,6 +35,7 @@ #include "llagentcamera.h" #include "llagentwearables.h" #include "llviewerfoldertype.h" +#include "llfloatersidepanelcontainer.h" #include "llfolderview.h" #include "llviewercontrol.h" #include "llconsole.h" @@ -220,7 +221,7 @@ public: // support secondlife:///app/inventory/show if (params[0].asString() == "show") { - LLSideTray::getInstance()->showPanel("sidepanel_inventory", LLSD()); + LLFloaterSidePanelContainer::showPanel("my_inventory", LLSD()); return true; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 63d6e0ac30..a71900167c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2634,7 +2634,7 @@ void handle_object_inspect() { LLSD key; key["task"] = "task"; - LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); + LLFloaterSidePanelContainer::showPanel("my_inventory", key); } /* @@ -5661,18 +5661,18 @@ class LLShowSidetrayPanel : public view_listener_t { bool handleEvent(const LLSD& userdata) { - std::string panel_name = userdata.asString(); + std::string floater_name = userdata.asString(); - LLPanel* panel = LLSideTray::getInstance()->getPanel(panel_name); + LLPanel* panel = LLFloaterSidePanelContainer::getPanel(floater_name); if (panel) { if (panel->isInVisibleChain()) { - LLSideTray::getInstance()->hidePanel(panel_name); + LLFloaterReg::getInstance(floater_name)->closeFloater(); } else { - LLSideTray::getInstance()->showPanel(panel_name); + LLFloaterReg::getInstance(floater_name)->openFloater(); } } return true; @@ -5683,9 +5683,9 @@ class LLSidetrayPanelVisible : public view_listener_t { bool handleEvent(const LLSD& userdata) { - std::string panel_name = userdata.asString(); + std::string floater_name = userdata.asString(); // Toggle the panel - if (LLSideTray::getInstance()->isPanelActive(panel_name)) + if (LLFloaterReg::getInstance(floater_name)->isInVisibleChain()) { return true; } diff --git a/indra/newview/skins/default/xui/en/floater_my_inventory.xml b/indra/newview/skins/default/xui/en/floater_my_inventory.xml new file mode 100644 index 0000000000..fd03a5324e --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_my_inventory.xml @@ -0,0 +1,20 @@ + + + + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 36ebe73753..2e9a66de5b 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -67,10 +67,10 @@ visible="true"> + parameter="my_inventory" /> + parameter="my_inventory" /> + parameter="people" /> Date: Tue, 27 Sep 2011 22:06:56 +0300 Subject: EXP-1226 FIXED (Create and register a floater for Appearance side tab) - Added xml for a new floater Appearance and registred it in the floaterreg - Removed side tray dependencies - Added static helper method: LLFloaterSidePanelContainer::getPanel --- indra/newview/llagentwearables.cpp | 3 ++- indra/newview/llappearancemgr.cpp | 9 +++++---- indra/newview/llavataractions.cpp | 3 ++- indra/newview/llcofwearables.cpp | 5 +++-- indra/newview/llfloatersidepanelcontainer.cpp | 18 ++++++++++++++++-- indra/newview/llfloatersidepanelcontainer.h | 5 +++++ indra/newview/llinventorybridge.cpp | 2 +- indra/newview/lloutfitslist.cpp | 3 ++- indra/newview/llpaneloutfitsinventory.cpp | 8 ++++---- indra/newview/llpanelwearing.cpp | 3 ++- indra/newview/llsidepanelappearance.cpp | 3 ++- indra/newview/llviewerfloaterreg.cpp | 1 + indra/newview/llviewerinventory.cpp | 3 ++- indra/newview/llviewermenu.cpp | 10 +++++----- indra/newview/llwearable.cpp | 7 ++++--- .../skins/default/xui/en/floater_my_appearance.xml | 20 ++++++++++++++++++++ 16 files changed, 76 insertions(+), 27 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/floater_my_appearance.xml diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index b9125ec8d3..404cd8e5b6 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -33,6 +33,7 @@ #include "llagentwearablesfetch.h" #include "llappearancemgr.h" #include "llcallbacklist.h" +#include "llfloatersidepanelcontainer.h" #include "llgesturemgr.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" @@ -2015,7 +2016,7 @@ void LLAgentWearables::editWearable(const LLUUID& item_id) } const BOOL disable_camera_switch = LLWearableType::getDisableCameraSwitch(wearable->getType()); - LLPanel* panel = LLSideTray::getInstance()->getPanel("sidepanel_appearance"); + LLPanel* panel = LLFloaterSidePanelContainer::getPanel("appearance"); LLSidepanelAppearance::editWearable(wearable, panel, disable_camera_switch); } diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 3cb9b77010..c638f881a5 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -34,6 +34,7 @@ #include "llattachmentsmgr.h" #include "llcommandhandler.h" #include "lleventtimer.h" +#include "llfloatersidepanelcontainer.h" #include "llgesturemgr.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" @@ -116,7 +117,7 @@ public: return true; } - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD()); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); return true; } }; @@ -1505,7 +1506,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) void LLAppearanceMgr::updatePanelOutfitName(const std::string& name) { LLSidepanelAppearance* panel_appearance = - dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); if (panel_appearance) { panel_appearance->refreshCurrentOutfitName(name); @@ -1943,7 +1944,7 @@ void LLAppearanceMgr::wearInventoryCategoryOnAvatar( LLInventoryCategory* catego if (gAgentCamera.cameraCustomizeAvatar()) { // switching to outfit editor should automagically save any currently edited wearable - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } LLAppearanceMgr::changeOutfit(TRUE, category->getUUID(), append); @@ -2468,7 +2469,7 @@ public: LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key); } LLOutfitsList *outfits_list = - dynamic_cast(LLSideTray::getInstance()->getPanel("outfitslist_tab")); + dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "outfitslist_tab")); if (outfits_list) { outfits_list->setSelectedOutfitByUUID(mFolderID); diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 4cdfcea64e..db5bbf7167 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -47,6 +47,7 @@ #include "llfloatergroups.h" #include "llfloaterreg.h" #include "llfloaterpay.h" +#include "llfloatersidepanelcontainer.h" #include "llfloaterwebcontent.h" #include "llfloaterworldmap.h" #include "llfolderview.h" @@ -462,7 +463,7 @@ namespace action_give_inventory */ static LLInventoryPanel* get_outfit_editor_inventory_panel() { - LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast(LLSideTray::getInstance()->getPanel("panel_outfit_edit")); + LLPanelOutfitEdit* panel_outfit_edit = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); if (NULL == panel_outfit_edit) return NULL; LLInventoryPanel* inventory_panel = panel_outfit_edit->findChild("folder_view"); diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index 254c0adef1..80e0cca780 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -33,6 +33,7 @@ #include "llagentdata.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" #include "llinventory.h" #include "llinventoryfunctions.h" #include "lllistcontextmenu.h" @@ -165,7 +166,7 @@ protected: // absent instance. Explicit relations between components avoids situations // when we tries to construct instance with unsatisfied implicit input conditions. LLPanelOutfitEdit * panel_outfit_edit = - dynamic_cast (LLSideTray::getInstance()->getPanel( + dynamic_cast (LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); if (panel_outfit_edit != NULL) { @@ -237,7 +238,7 @@ protected: // *HACK* need to pass pointer to LLPanelOutfitEdit instead of LLSideTray::getInstance()->getPanel(). // LLSideTray::getInstance()->getPanel() is rather slow variant - LLPanelOutfitEdit* panel_oe = dynamic_cast(LLSideTray::getInstance()->getPanel("panel_outfit_edit")); + LLPanelOutfitEdit* panel_oe = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); registrar.add("BodyPart.Replace", boost::bind(&LLPanelOutfitEdit::onReplaceMenuItemClicked, panel_oe, selected_id)); registrar.add("BodyPart.Edit", boost::bind(LLAgentWearables::editWearable, selected_id)); registrar.add("BodyPart.Create", boost::bind(&CofBodyPartContextMenu::createNew, this, selected_id)); diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index cff46e80eb..ab874e4b9f 100644 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -33,6 +33,9 @@ #include "llsidetraypanelcontainer.h" #include "lltransientfloatermgr.h" +//static +const std::string LLFloaterSidePanelContainer::sMainPanelName("main_panel"); + LLFloaterSidePanelContainer::LLFloaterSidePanelContainer(const LLSD& key, const Params& params) : LLFloater(key, params) { @@ -48,7 +51,7 @@ LLFloaterSidePanelContainer::~LLFloaterSidePanelContainer() void LLFloaterSidePanelContainer::onOpen(const LLSD& key) { - getChild("main_panel")->onOpen(key); + getChild(sMainPanelName)->onOpen(key); } LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params) @@ -82,6 +85,17 @@ void LLFloaterSidePanelContainer::showPanel(const std::string& floater_name, con LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance(floater_name); if (floaterp) { - floaterp->openChildPanel("main_panel", panel_name); + floaterp->openChildPanel(sMainPanelName, panel_name); } } + +LLPanel* LLFloaterSidePanelContainer::getPanel(const std::string& floater_name, const std::string& panel_name) +{ + LLFloaterSidePanelContainer* floaterp = LLFloaterReg::getTypedInstance(floater_name); + if (floaterp) + { + return floaterp->findChild(panel_name, true); + } + + return NULL; +} diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h index 7b4e7643ae..5c05f26f45 100644 --- a/indra/newview/llfloatersidepanelcontainer.h +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -42,6 +42,9 @@ */ class LLFloaterSidePanelContainer : public LLFloater { +private: + static const std::string sMainPanelName; + public: LLFloaterSidePanelContainer(const LLSD& key, const Params& params = getDefaultParams()); ~LLFloaterSidePanelContainer(); @@ -51,6 +54,8 @@ public: LLPanel* openChildPanel(const std::string& panel_name, const LLSD& params); static void showPanel(const std::string& floater_name, const LLSD& panel_name); + + static LLPanel* getPanel(const std::string& floater_name, const std::string& panel_name = sMainPanelName); }; #endif // LL_LLFLOATERSIDEPANELCONTAINER_H diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 0b3d6d8030..b6041c7f31 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -4781,7 +4781,7 @@ void remove_inventory_category_from_avatar( LLInventoryCategory* category ) if (gAgentCamera.cameraCustomizeAvatar()) { // switching to outfit editor should automagically save any currently edited wearable - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() ); diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 10887aa53a..c2739867b1 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -35,6 +35,7 @@ #include "llaccordionctrltab.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" #include "lllistcontextmenu.h" @@ -327,7 +328,7 @@ protected: static void editOutfit() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } static void renameOutfit(const LLUUID& outfit_cat_id) diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index a90f864ae2..3ac0d6616b 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -31,6 +31,7 @@ #include "llnotificationsutil.h" #include "lltabcontainer.h" +#include "llfloatersidepanelcontainer.h" #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" #include "llagentwearables.h" @@ -222,7 +223,7 @@ void LLPanelOutfitsInventory::onSave() //static LLPanelOutfitsInventory* LLPanelOutfitsInventory::findInstance() { - return dynamic_cast(LLSideTray::getInstance()->getPanel("panel_outfits_inventory")); + return dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfits_inventory")); } ////////////////////////////////////////////////////////////////////////////////// @@ -319,8 +320,7 @@ void LLPanelOutfitsInventory::onWearablesLoading() // static LLSidepanelAppearance* LLPanelOutfitsInventory::getAppearanceSP() { - static LLSidepanelAppearance* panel_appearance = - dynamic_cast - (LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + LLSidepanelAppearance* panel_appearance = + dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); return panel_appearance; } diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index f19b54c1d4..87e9bb7b28 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -31,6 +31,7 @@ #include "lltoggleablemenu.h" #include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" #include "llinventoryobserver.h" @@ -44,7 +45,7 @@ // Context menu and Gear menu helper. static void edit_outfit() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 28ec11d1c7..a356013830 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -32,6 +32,7 @@ #include "llagentcamera.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" #include "llfolderview.h" #include "llinventorypanel.h" #include "llfiltereditor.h" @@ -456,7 +457,7 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) //static void LLSidepanelAppearance::editWearable(LLWearable *wearable, LLView *data, BOOL disable_camera_switch) { - LLSideTray::getInstance()->showPanel("sidepanel_appearance"); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); LLSidepanelAppearance *panel = dynamic_cast(data); if (panel) diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index b28373c6d5..665e0a2bd6 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -161,6 +161,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterAboutUtil::registerFloater(); LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index ad65a8846c..6b5b47d0db 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -34,6 +34,7 @@ #include "llagent.h" #include "llagentcamera.h" #include "llagentwearables.h" +#include "llfloatersidepanelcontainer.h" #include "llviewerfoldertype.h" #include "llfolderview.h" #include "llviewercontrol.h" @@ -976,7 +977,7 @@ void ModifiedCOFCallback::fire(const LLUUID& inv_item) if( gAgentCamera.cameraCustomizeAvatar() ) { // If we're in appearance editing mode, the current tab may need to be refreshed - LLSidepanelAppearance *panel = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); if (panel) { panel->showDefaultSubpart(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 63d6e0ac30..1dd5b05818 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3758,7 +3758,7 @@ void handle_reset_view() if (gAgentCamera.cameraCustomizeAvatar()) { // switching to outfit selector should automagically save any currently edited wearable - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "my_outfits")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits")); } gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW); @@ -5576,22 +5576,22 @@ void handle_viewer_disable_message_log(void*) void handle_customize_avatar() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "my_outfits")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits")); } void handle_edit_outfit() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } void handle_edit_shape() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_shape")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_shape")); } void handle_edit_physics() { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_physics")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_physics")); } void handle_report_abuse() diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index d1c0990f90..276e8f462d 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -30,6 +30,7 @@ #include "llagentcamera.h" #include "llagentwearables.h" #include "lldictionary.h" +#include "llfloatersidepanelcontainer.h" #include "lllocaltextureobject.h" #include "llnotificationsutil.h" #include "llviewertexturelist.h" @@ -697,7 +698,7 @@ void LLWearable::removeFromAvatar( LLWearableType::EType type, BOOL upload_bake if(gAgentCamera.cameraCustomizeAvatar()) { - LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit")); + LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "edit_outfit")); } gAgentAvatarp->updateVisualParams(); @@ -967,7 +968,7 @@ void LLWearable::revertValues() syncImages(mSavedTEMap, mTEMap); - LLSidepanelAppearance *panel = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); if( panel ) { panel->updateScrollingPanelList(); @@ -1008,7 +1009,7 @@ void LLWearable::saveValues() syncImages(mTEMap, mSavedTEMap); - LLSidepanelAppearance *panel = dynamic_cast(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); + LLSidepanelAppearance *panel = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance")); if( panel ) { panel->updateScrollingPanelList(); diff --git a/indra/newview/skins/default/xui/en/floater_my_appearance.xml b/indra/newview/skins/default/xui/en/floater_my_appearance.xml new file mode 100644 index 0000000000..8f97887b3f --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_my_appearance.xml @@ -0,0 +1,20 @@ + + + + + -- cgit v1.2.3 From b6feeea2b550b981dbb04558902020e8cae16f7b Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 27 Sep 2011 12:40:06 -0700 Subject: * Updated toybox to center bottom button and add delimeter --- indra/newview/skins/default/xui/en/floater_toybox.xml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index 60a39b0bff..092eddaa53 100644 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -46,6 +46,7 @@ - + top="85" /> + + -- cgit v1.2.3 From c7f5aebbb71228b705059be248e82e83ee0f9475 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 27 Sep 2011 15:41:41 -0700 Subject: Nearby chat panel --- .../skins/default/xui/en/panel_nearby_chat.xml | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 indra/newview/skins/default/xui/en/panel_nearby_chat.xml diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml new file mode 100644 index 0000000000..f766236b2e --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml @@ -0,0 +1,35 @@ + + + + + -- cgit v1.2.3 From 8912a9bef62386e5eecaa61ba9079d507ae16d90 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 27 Sep 2011 15:53:38 -0700 Subject: EXP-1258 WIP toggle buttons between icons and icons+text modes better button sizing also disabled context menu for non-toolbar region --- indra/llui/llbutton.cpp | 24 ++++++++++++++++++------ indra/llui/llbutton.h | 1 + indra/llui/lltoolbar.cpp | 4 +++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 06781f1bdf..02ac928dfb 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -554,6 +554,16 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask) return TRUE; } +void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height) +{ + overlay_width = mImageOverlay->getWidth(); + overlay_height = mImageOverlay->getHeight(); + + F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f); + overlay_width = llround((F32)overlay_width * scale_factor); + overlay_height = llround((F32)overlay_height * scale_factor); +} + // virtual void LLButton::draw() @@ -781,12 +791,10 @@ void LLButton::draw() if (mImageOverlay.notNull()) { // get max width and height (discard level 0) - S32 overlay_width = mImageOverlay->getWidth(); - S32 overlay_height = mImageOverlay->getHeight(); + S32 overlay_width; + S32 overlay_height; - F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f); - overlay_width = llround((F32)overlay_width * scale_factor); - overlay_height = llround((F32)overlay_height * scale_factor); + getOverlayImageSize(overlay_width, overlay_height); S32 center_x = getLocalRect().getCenterX(); S32 center_y = getLocalRect().getCenterY(); @@ -994,11 +1002,15 @@ void LLButton::resize(LLUIString label) S32 min_width = label_width + mLeftHPad + mRightHPad; if (mImageOverlay) { + S32 overlay_width = mImageOverlay->getWidth(); + F32 scale_factor = getRect().getHeight() / (F32)mImageOverlay->getHeight(); + overlay_width = llround((F32)overlay_width * scale_factor); + switch(mImageOverlayAlignment) { case LLFontGL::LEFT: case LLFontGL::RIGHT: - min_width += mImageOverlay->getWidth() + mImgOverlayLabelSpace; + min_width += overlay_width + mImgOverlayLabelSpace; break; case LLFontGL::HCENTER: break; diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index bc5e69fad5..08b45e01b3 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -270,6 +270,7 @@ public: protected: LLPointer getImageUnselected() const { return mImageUnselected; } LLPointer getImageSelected() const { return mImageSelected; } + void getOverlayImageSize(S32& overlay_width, S32& overlay_height); LLFrameTimer mMouseDownTimer; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 0c3052b1ab..9ca5a0f480 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -247,7 +247,9 @@ bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled) BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask) { - BOOL handle_it_here = !mReadOnly; + LLRect button_panel_rect; + mButtonPanel->localRectToOtherView(mButtonPanel->getLocalRect(), &button_panel_rect, this); + BOOL handle_it_here = !mReadOnly && button_panel_rect.pointInRect(x, y); if (handle_it_here) { -- cgit v1.2.3 From bce16356c9e1fb76bd92a3530375e4c6c7a5430a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 27 Sep 2011 17:47:52 -0700 Subject: fixed wobble when toggling inbox/outbox --- indra/newview/skins/default/xui/en/sidepanel_inventory.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index 7a176ff367..2b5e3143a4 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -67,6 +67,8 @@ top="0" orientation="vertical" name="inbox_outbox_layout_stack" + open_time_constant="0.02" + close_time_constant="0.02" height="235" width="330"> Date: Tue, 27 Sep 2011 19:06:02 -0700 Subject: EXP-1258 WIP toggle buttons between icons and icons+text modes fixed button layout for icon+text layout stack now uses floating point precision to avoid clamping panels to 0 --- indra/llui/llbutton.cpp | 2 + indra/llui/lllayoutstack.cpp | 252 +++++++-------------- indra/llui/lllayoutstack.h | 18 +- indra/llui/lltoolbar.cpp | 40 ++-- .../skins/default/xui/en/floater_test_toolbar.xml | 4 + 5 files changed, 123 insertions(+), 193 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 02ac928dfb..e1bea086b2 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -819,6 +819,7 @@ void LLButton::draw() { case LLFontGL::LEFT: text_left += overlay_width + mImgOverlayLabelSpace; + text_width -= overlay_width + mImgOverlayLabelSpace; mImageOverlay->draw( mLeftHPad, center_y - (overlay_height / 2), @@ -836,6 +837,7 @@ void LLButton::draw() break; case LLFontGL::RIGHT: text_right -= overlay_width + mImgOverlayLabelSpace; + text_width -= overlay_width + mImgOverlayLabelSpace; mImageOverlay->draw( getRect().getWidth() - mRightHPad - overlay_width, center_y - (overlay_height / 2), diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 0d1f608e61..89b3f671a4 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -55,11 +55,12 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mMaxDim(p.max_dim), mAutoResize(p.auto_resize), mUserResize(p.user_resize), - mFitContent(p.fit_content), mCollapsed(FALSE), mCollapseAmt(0.f), mVisibleAmt(1.f), // default to fully visible - mResizeBar(NULL) + mResizeBar(NULL), + mFractionalSize(0.f), + mOrientation(LLLayoutStack::HORIZONTAL) { // Set the expanded min dim if it is provided, otherwise it gets the p.min_dim value if (p.expanded_min_dim.isProvided()) @@ -89,9 +90,22 @@ LLLayoutPanel::~LLLayoutPanel() mResizeBar = NULL; } -F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation) +void LLLayoutPanel::reshape(S32 width, S32 height, BOOL called_from_parent) { - if (orientation == LLLayoutStack::HORIZONTAL) + if (mOrientation == LLLayoutStack::HORIZONTAL) + { + mFractionalSize += width - llround(mFractionalSize); + } + else + { + mFractionalSize += height - llround(mFractionalSize); + } + LLPanel::reshape(width, height, called_from_parent); +} + +F32 LLLayoutPanel::getCollapseFactor() +{ + if (mOrientation == LLLayoutStack::HORIZONTAL) { F32 collapse_amt = clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)getRelevantMinDim() / (F32)llmax(1, getRect().getWidth())); @@ -105,14 +119,6 @@ F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientati } } -void LLLayoutPanel::fitToContent() -{ - if (mFitContent) - { - setShape(calcBoundingRect()); - } -} - // // LLLayoutStack // @@ -158,11 +164,11 @@ void LLLayoutStack::draw() // scale clipping rectangle by visible amount if (mOrientation == HORIZONTAL) { - clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor(mOrientation)); + clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor()); } else { - clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor(mOrientation)); + clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor()); } LLPanel* panelp = (*panel_it); @@ -202,36 +208,15 @@ bool LLLayoutStack::addChild(LLView* child, S32 tab_group) LLLayoutPanel* panelp = dynamic_cast(child); if (panelp) { + panelp->mFractionalSize = (mOrientation == HORIZONTAL) + ? panelp->getRect().getWidth() + : panelp->getRect().getHeight(); + panelp->setOrientation(mOrientation); mPanels.push_back(panelp); } return LLView::addChild(child, tab_group); } - -S32 LLLayoutStack::getDefaultHeight(S32 cur_height) -{ - // if we are spanning our children (crude upward propagation of size) - // then don't enforce our size on our children - if (mOrientation == HORIZONTAL) - { - cur_height = llmax(mMinHeight, getRect().getHeight()); - } - - return cur_height; -} - -S32 LLLayoutStack::getDefaultWidth(S32 cur_width) -{ - // if we are spanning our children (crude upward propagation of size) - // then don't enforce our size on our children - if (mOrientation == VERTICAL) - { - cur_width = llmax(mMinWidth, getRect().getWidth()); - } - - return cur_width; -} - void LLLayoutStack::movePanel(LLPanel* panel_to_move, LLPanel* target_panel, bool move_to_front) { LLLayoutPanel* embedded_panel_to_move = findEmbeddedPanel(panel_to_move); @@ -326,14 +311,15 @@ void LLLayoutStack::updateLayout(BOOL force_resize) createResizeBars(); // calculate current extents - S32 total_width = 0; - S32 total_height = 0; + F32 total_size = 0.f; + // + // animate visibility + // e_panel_list_t::iterator panel_it; for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { LLLayoutPanel* panelp = (*panel_it); - panelp->fitToContent(); if (panelp->getVisible()) { if (mAnimate) @@ -371,181 +357,110 @@ void LLLayoutStack::updateLayout(BOOL force_resize) } } - if (panelp->mCollapsed) - { - panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, 1.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); - } - else - { - panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); - } + F32 collapse_state = panelp->mCollapsed ? 1.f : 0.f; + panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); - if (mOrientation == HORIZONTAL) + total_size += panelp->mFractionalSize * panelp->getCollapseFactor(); + // want n-1 panel gaps for n panels + if (panel_it != mPanels.begin()) { - // enforce minimize size constraint by default - if (panelp->getRect().getWidth() < panelp->getRelevantMinDim()) - { - panelp->reshape(panelp->getRelevantMinDim(), panelp->getRect().getHeight()); - } - total_width += llround(panelp->getRect().getWidth() * panelp->getCollapseFactor(mOrientation)); - // want n-1 panel gaps for n panels - if (panel_it != mPanels.begin()) - { - total_width += mPanelSpacing; - } - } - else //VERTICAL - { - // enforce minimize size constraint by default - if (panelp->getRect().getHeight() < panelp->getRelevantMinDim()) - { - panelp->reshape(panelp->getRect().getWidth(), panelp->getRelevantMinDim()); - } - total_height += llround(panelp->getRect().getHeight() * panelp->getCollapseFactor(mOrientation)); - if (panel_it != mPanels.begin()) - { - total_height += mPanelSpacing; - } + total_size += mPanelSpacing; } } S32 num_resizable_panels = 0; - S32 shrink_headroom_available = 0; - S32 shrink_headroom_total = 0; + F32 shrink_headroom_available = 0.f; + F32 shrink_headroom_total = 0.f; for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { + LLLayoutPanel* panelp = (*panel_it); + // panels that are not fully visible do not count towards shrink headroom - if ((*panel_it)->getCollapseFactor(mOrientation) < 1.f) + if (panelp->getCollapseFactor() < 1.f) { continue; } - S32 relevant_dimension = (mOrientation == HORIZONTAL) ? (*panel_it)->getRect().getWidth() : (*panel_it)->getRect().getHeight(); - S32 relevant_min = (*panel_it)->getRelevantMinDim(); + F32 cur_size = panelp->mFractionalSize; + F32 min_size = (F32)panelp->getRelevantMinDim(); // if currently resizing a panel or the panel is flagged as not automatically resizing // only track total available headroom, but don't use it for automatic resize logic - if ((*panel_it)->mResizeBar->hasMouseCapture() - || (!(*panel_it)->mAutoResize + if (panelp->mResizeBar->hasMouseCapture() + || (!panelp->mAutoResize && !force_resize)) { - shrink_headroom_total += relevant_dimension - relevant_min; + shrink_headroom_total += cur_size - min_size; } else { num_resizable_panels++; - shrink_headroom_available += relevant_dimension - relevant_min; - shrink_headroom_total += relevant_dimension - relevant_min; + shrink_headroom_available += cur_size - min_size; + shrink_headroom_total += cur_size - min_size; } } // calculate how many pixels need to be distributed among layout panels // positive means panels need to grow, negative means shrink - S32 pixels_to_distribute; - if (mOrientation == HORIZONTAL) - { - pixels_to_distribute = getRect().getWidth() - total_width; - } - else //VERTICAL - { - pixels_to_distribute = getRect().getHeight() - total_height; - } + F32 pixels_to_distribute = (mOrientation == HORIZONTAL) + ? getRect().getWidth() - total_size + : getRect().getHeight() - total_size; // now we distribute the pixels... - S32 cur_x = 0; - S32 cur_y = getRect().getHeight(); + F32 cur_x = 0.f; + F32 cur_y = (F32)getRect().getHeight(); for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { LLLayoutPanel* panelp = (*panel_it); - S32 cur_width = panelp->getRect().getWidth(); - S32 cur_height = panelp->getRect().getHeight(); - S32 new_width = cur_width; - S32 new_height = cur_height; - S32 relevant_min = panelp->getRelevantMinDim(); - - if (mOrientation == HORIZONTAL) - { - new_width = llmax(relevant_min, new_width); - } - else - { - new_height = llmax(relevant_min, new_height); - } - S32 delta_size = 0; + F32 min_size = panelp->getRelevantMinDim(); + F32 delta_size = 0.f; // if panel can automatically resize (not animating, and resize flag set)... - if (panelp->getCollapseFactor(mOrientation) == 1.f + if (panelp->getCollapseFactor() == 1.f && (force_resize || panelp->mAutoResize) && !panelp->mResizeBar->hasMouseCapture()) { - if (mOrientation == HORIZONTAL) + if (pixels_to_distribute < 0.f) { - // if we're shrinking - if (pixels_to_distribute < 0) - { - // shrink proportionally to amount over minimum - // so we can do this in one pass - delta_size = (shrink_headroom_available > 0) - ? llround((F32)pixels_to_distribute * ((F32)(cur_width - relevant_min) / (F32)shrink_headroom_available)) - : 0; - shrink_headroom_available -= (cur_width - relevant_min); - } - else - { - // grow all elements equally - delta_size = llround((F32)pixels_to_distribute / (F32)num_resizable_panels); - num_resizable_panels--; - } - pixels_to_distribute -= delta_size; - new_width = llmax(relevant_min, cur_width + delta_size); + // shrink proportionally to amount over minimum + // so we can do this in one pass + delta_size = (shrink_headroom_available > 0.f) + ? pixels_to_distribute * ((F32)(panelp->mFractionalSize - min_size) / shrink_headroom_available) + : 0.f; + shrink_headroom_available -= (panelp->mFractionalSize - min_size); } else { - new_width = getDefaultWidth(new_width); - } - - if (mOrientation == VERTICAL) - { - if (pixels_to_distribute < 0) - { - // shrink proportionally to amount over minimum - // so we can do this in one pass - delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_height - relevant_min) / (F32)shrink_headroom_available)) : 0; - shrink_headroom_available -= (cur_height - relevant_min); - } - else - { - delta_size = llround((F32)pixels_to_distribute / (F32)num_resizable_panels); - num_resizable_panels--; - } - pixels_to_distribute -= delta_size; - new_height = llmax(relevant_min, cur_height + delta_size); - } - else - { - new_height = getDefaultHeight(new_height); - } - } - else - { - if (mOrientation == HORIZONTAL) - { - new_height = getDefaultHeight(new_height); - } - else // VERTICAL - { - new_width = getDefaultWidth(new_width); + // grow all elements equally + delta_size = pixels_to_distribute / (F32)num_resizable_panels; + num_resizable_panels--; } + + panelp->mFractionalSize = llmax(min_size, panelp->mFractionalSize + delta_size); + pixels_to_distribute -= delta_size; } // adjust running headroom count based on new sizes shrink_headroom_total += delta_size; LLRect panel_rect; - panel_rect.setLeftTopAndSize(cur_x, cur_y, new_width, new_height); + if (mOrientation == HORIZONTAL) + { + panel_rect.setLeftTopAndSize(llround(cur_x), + llround(cur_y), + llround(panelp->mFractionalSize), + getRect().getHeight()); + } + else + { + panel_rect.setLeftTopAndSize(llround(cur_x), + llround(cur_y), + getRect().getWidth(), + llround(panelp->mFractionalSize)); + } panelp->setShape(panel_rect); LLRect resize_bar_rect = panel_rect; @@ -561,13 +476,14 @@ void LLLayoutStack::updateLayout(BOOL force_resize) } (*panel_it)->mResizeBar->setRect(resize_bar_rect); + F32 size = ((*panel_it)->mFractionalSize * (*panel_it)->getCollapseFactor()) + (F32)mPanelSpacing; if (mOrientation == HORIZONTAL) { - cur_x += llround(new_width * (*panel_it)->getCollapseFactor(mOrientation)) + mPanelSpacing; + cur_x += size; } else //VERTICAL { - cur_y -= llround(new_height * (*panel_it)->getCollapseFactor(mOrientation)) + mPanelSpacing; + cur_y -= size; } } diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 2ed32a2fa9..5d79505fc3 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -126,8 +126,6 @@ protected: private: void createResizeBars(); void calcMinExtents(); - S32 getDefaultHeight(S32 cur_height); - S32 getDefaultWidth(S32 cur_width); const ELayoutOrientation mOrientation; @@ -161,16 +159,14 @@ public: min_dim, max_dim; Optional user_resize, - auto_resize, - fit_content; + auto_resize; Params() : expanded_min_dim("expanded_min_dim", 0), min_dim("min_dim", 0), max_dim("max_dim", 0), user_resize("user_resize", true), - auto_resize("auto_resize", true), - fit_content("fit_content", false) + auto_resize("auto_resize", true) { addSynonym(min_dim, "min_width"); addSynonym(min_dim, "min_height"); @@ -183,6 +179,8 @@ public: void initFromParams(const Params& p); + void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + S32 getMinDim() const { return mMinDim; } void setMinDim(S32 value) { mMinDim = value; if (!mExpandedMinDimSpecified) mExpandedMinDim = value; } @@ -204,11 +202,12 @@ public: return min_dim; } + void setOrientation(LLLayoutStack::ELayoutOrientation orientation) { mOrientation = orientation; } + protected: LLLayoutPanel(const Params& p); - F32 getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation); - void fitToContent(); + F32 getCollapseFactor(); bool mExpandedMinDimSpecified; S32 mExpandedMinDim; @@ -218,9 +217,10 @@ protected: bool mAutoResize; bool mUserResize; bool mCollapsed; - bool mFitContent; F32 mVisibleAmt; F32 mCollapseAmt; + F32 mFractionalSize; + LLLayoutStack::ELayoutOrientation mOrientation; class LLResizeBar* mResizeBar; }; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 677d50a0c7..57a9151649 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -126,14 +126,13 @@ void LLToolBar::createContextMenu() { // Setup bindings specific to this instance for the context menu options - LLUICtrl::CommitCallbackRegistry::Registrar& commit_reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar(); + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar commit_reg; commit_reg.add("Toolbars.EnableSetting", boost::bind(&LLToolBar::onSettingEnable, this, _2)); - LLUICtrl::EnableCallbackRegistry::Registrar& enable_reg = LLUICtrl::EnableCallbackRegistry::defaultRegistrar(); + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_reg; enable_reg.add("Toolbars.CheckSetting", boost::bind(&LLToolBar::isSettingChecked, this, _2)); // Create the context menu - LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile("menu_toolbars.xml", LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (menu) @@ -146,10 +145,6 @@ void LLToolBar::createContextMenu() { llwarns << "Unable to load toolbars context menu." << llendl; } - - // Remove this instance's bindings - commit_reg.remove("Toolbars.EnableSetting"); - enable_reg.remove("Toolbars.CheckSetting"); } } @@ -184,7 +179,6 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) center_panel_p.rect = getLocalRect(); center_panel_p.auto_resize = false; center_panel_p.user_resize = false; - center_panel_p.fit_content = true; LLLayoutPanel* center_panel = LLUICtrlFactory::create(center_panel_p); mCenteringStack->addChild(center_panel); @@ -196,6 +190,11 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) mCenteringStack->addChild(LLUICtrlFactory::create(border_panel_p)); + BOOST_FOREACH(LLCommandId::Params params, p.commands) + { + addCommand(params); + } + mNeedsLayout = true; } @@ -207,8 +206,8 @@ bool LLToolBar::addCommand(const LLCommandId& commandId) if (add_command) { - mButtonCommands.push_back(commandId); - createButtons(); + mButtonCommands.push_back(commandId); + createButtons(); } return add_command; @@ -220,9 +219,9 @@ bool LLToolBar::hasCommand(const LLCommandId& commandId) const if (commandId != LLCommandId::null) { - for (std::list::const_iterator cmd = mButtonCommands.begin(); cmd != mButtonCommands.end(); ++cmd) + BOOST_FOREACH(LLCommandId cmd, mButtonCommands) { - if ((*cmd) == commandId) + if (cmd == commandId) { has_command = true; break; @@ -410,11 +409,11 @@ void LLToolBar::updateLayoutAsNeeded() cur_start = row_pad_start; cur_row += max_row_girth + mPadBetween; max_row_girth = 0; - } + } - LLRect button_rect; - if (orientation == LLLayoutStack::HORIZONTAL) - { + LLRect button_rect; + if (orientation == LLLayoutStack::HORIZONTAL) + { button_rect.setLeftTopAndSize(cur_start, panel_rect.mTop - cur_row, button_clamped_width, button->getRect().getHeight()); } else // VERTICAL @@ -460,6 +459,9 @@ void LLToolBar::updateLayoutAsNeeded() mButtonPanel->reshape(total_girth, max_row_length); } + // make parent fit button panel + mButtonPanel->getParent()->setShape(mButtonPanel->getLocalRect()); + // re-center toolbar buttons mCenteringStack->updateLayout(); @@ -470,7 +472,13 @@ void LLToolBar::updateLayoutAsNeeded() void LLToolBar::draw() { + if (mButtons.empty()) return; updateLayoutAsNeeded(); + // rect may have shifted during layout + LLUI::popMatrix(); + LLUI::pushMatrix(); + LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom, 0.f); + LLUICtrl::draw(); } diff --git a/indra/newview/skins/default/xui/en/floater_test_toolbar.xml b/indra/newview/skins/default/xui/en/floater_test_toolbar.xml index fbfbe51a69..067c1fed82 100644 --- a/indra/newview/skins/default/xui/en/floater_test_toolbar.xml +++ b/indra/newview/skins/default/xui/en/floater_test_toolbar.xml @@ -8,6 +8,7 @@ translate="false" width="500"> Date: Tue, 27 Sep 2011 19:22:09 -0700 Subject: EXP-1258 FIX toggle buttons between icons and icons+text modes fixed button layout for icon only buttons --- indra/llui/llbutton.cpp | 1 + indra/llui/lltoolbar.cpp | 30 ++++++++++++++++++------------ indra/llui/lltoolbar.h | 1 + 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index e1bea086b2..f259e8027e 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -1015,6 +1015,7 @@ void LLButton::resize(LLUIString label) min_width += overlay_width + mImgOverlayLabelSpace; break; case LLFontGL::HCENTER: + min_width = llmax(min_width, overlay_width + mLeftHPad + mRightHPad); break; default: // draw nothing diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 57a9151649..c5219b11e8 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -207,7 +207,7 @@ bool LLToolBar::addCommand(const LLCommandId& commandId) if (add_command) { mButtonCommands.push_back(commandId); - createButtons(); + createButton(commandId); } return add_command; @@ -498,19 +498,25 @@ void LLToolBar::createButtons() BOOST_FOREACH(LLCommandId& command_id, mButtonCommands) { - LLCommand* commandp = LLCommandManager::instance().getCommand(command_id); - if (!commandp) continue; + createButton(command_id); + } - LLToolBarButton::Params button_p; - button_p.label = LLTrans::getString(commandp->labelRef()); - button_p.image_overlay = LLUI::getUIImage(commandp->icon()); - button_p.overwriteFrom(mButtonParams[mButtonType]); - LLToolBarButton* button = LLUICtrlFactory::create(button_p); +} - mButtons.push_back(button); - mButtonPanel->addChild(button); - } +void LLToolBar::createButton(const LLCommandId& id) +{ + LLCommand* commandp = LLCommandManager::instance().getCommand(id); + if (!commandp) return; + + LLToolBarButton::Params button_p; + button_p.label = LLTrans::getString(commandp->labelRef()); + button_p.tool_tip = button_p.label(); + button_p.image_overlay = LLUI::getUIImage(commandp->icon()); + button_p.overwriteFrom(mButtonParams[mButtonType]); + LLToolBarButton* button = LLUICtrlFactory::create(button_p); + + mButtons.push_back(button); + mButtonPanel->addChild(button); mNeedsLayout = true; } - diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 75ae499a3d..02db58128c 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -135,6 +135,7 @@ private: void createContextMenu(); void updateLayoutAsNeeded(); void createButtons(); + void createButton(const LLCommandId& id); void resizeButtonsInRow(std::vector& buttons_in_row, S32 max_row_girth); BOOL isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); -- cgit v1.2.3 From 04a5c45020e72e7e24eed1cc1f53014da92594e5 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 27 Sep 2011 20:24:00 -0700 Subject: EXP-1207 : Commented out the red and yellow debug draw on the toolbars --- indra/llui/lltoolbarview.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index 7047cca948..641c3eb0ab 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -193,7 +193,6 @@ void LLToolBarView::draw() if (mToolbarLeft) mToolbarLeft->localRectToOtherView(mToolbarLeft->getLocalRect(), &left_rect, this); if (mToolbarRight) mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this); - if ((old_width != getRect().getWidth()) || (old_height != getRect().getHeight())) debug_print = true; if (debug_print) @@ -215,9 +214,9 @@ void LLToolBarView::draw() back_color_hori[VALPHA] = 0.5f; back_color_vert[VALPHA] = 0.5f; //gl_rect_2d(getLocalRect(), back_color, TRUE); - gl_rect_2d(bottom_rect, back_color_hori, TRUE); - gl_rect_2d(left_rect, back_color_vert, TRUE); - gl_rect_2d(right_rect, back_color_vert, TRUE); + //gl_rect_2d(bottom_rect, back_color_hori, TRUE); + //gl_rect_2d(left_rect, back_color_vert, TRUE); + //gl_rect_2d(right_rect, back_color_vert, TRUE); LLUICtrl::draw(); } -- cgit v1.2.3 From b234c23aa3c70ccac6d4332532a0da6184ec03db Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 27 Sep 2011 20:51:26 -0700 Subject: EXP-1211 : Factorize code a bit --- indra/llui/lltoolbarview.cpp | 48 +++++++++++++++++--------------------------- indra/llui/lltoolbarview.h | 1 + 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index 641c3eb0ab..73c8c99418 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -80,52 +80,25 @@ bool LLToolBarView::load() } // Add commands to each toolbar - // *TODO: factorize that code : tricky with Blocks though, simple lexical approach fails - LLCommandManager& mgr = LLCommandManager::instance(); - if (toolbar_set.left_toolbar.isProvided() && mToolbarLeft) { BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.left_toolbar.commands) { - LLCommandId* commandId = new LLCommandId(command); - if (mgr.getCommand(*commandId)) - { - mToolbarLeft->addCommand(*commandId); - } - else - { - llwarns << "Toolbars creation : the command " << commandId->name() << " cannot be found in the command manager" << llendl; - } + addCommand(LLCommandId(command),mToolbarLeft); } } if (toolbar_set.right_toolbar.isProvided() && mToolbarRight) { BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.right_toolbar.commands) { - LLCommandId* commandId = new LLCommandId(command); - if (mgr.getCommand(*commandId)) - { - mToolbarRight->addCommand(*commandId); - } - else - { - llwarns << "Toolbars creation : the command " << commandId->name() << " cannot be found in the command manager" << llendl; - } + addCommand(LLCommandId(command),mToolbarRight); } } if (toolbar_set.bottom_toolbar.isProvided() && mToolbarBottom) { BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.bottom_toolbar.commands) { - LLCommandId* commandId = new LLCommandId(command); - if (mgr.getCommand(*commandId)) - { - mToolbarBottom->addCommand(*commandId); - } - else - { - llwarns << "Toolbars creation : the command " << commandId->name() << " cannot be found in the command manager" << llendl; - } + addCommand(LLCommandId(command),mToolbarBottom); } } return true; @@ -179,6 +152,21 @@ bool LLToolBarView::hasCommand(const LLCommandId& commandId) const return has_command; } +bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar) +{ + LLCommandManager& mgr = LLCommandManager::instance(); + if (mgr.getCommand(command)) + { + toolbar->addCommand(command); + } + else + { + llwarns << "Toolbars creation : the command " << command.name() << " cannot be found in the command manager" << llendl; + return false; + } + return true; +} + void LLToolBarView::draw() { static bool debug_print = true; diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index 0f16b89ecc..208660da8e 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -78,6 +78,7 @@ protected: private: // Loads the toolbars from the existing user or default settings bool load(); // return false if load fails + bool addCommand(const LLCommandId& commandId, LLToolBar* toolbar); // Pointers to the toolbars handled by the toolbar view LLToolBar* mToolbarLeft; -- cgit v1.2.3 From 15f3ea39d7deb0c956b56703a94f6d072b7f2d21 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 27 Sep 2011 22:45:09 -0700 Subject: EXP-1257 : Save toolbar settings in a per user toolbars.xml file --- indra/llui/llcommandmanager.h | 2 + indra/llui/lltoolbar.h | 3 +- indra/llui/lltoolbarview.cpp | 172 +++++++++++++++++++++++++++++------------- indra/llui/lltoolbarview.h | 3 +- 4 files changed, 124 insertions(+), 56 deletions(-) diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 8435d915f3..4781f77177 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -81,6 +81,8 @@ private: std::string mName; }; +typedef std::list command_id_list_t; + class LLCommand { public: diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 02db58128c..8e484c7e13 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -123,6 +123,7 @@ public: bool addCommand(const LLCommandId& commandId); bool hasCommand(const LLCommandId& commandId) const; bool enableCommand(const LLCommandId& commandId, bool enabled); + command_id_list_t& getCommandsList() { return mButtonCommands; } protected: friend class LLUICtrlFactory; @@ -143,7 +144,7 @@ private: const bool mReadOnly; std::list mButtons; - std::list mButtonCommands; + command_id_list_t mButtonCommands; LLToolBarEnums::ButtonType mButtonType; LLLayoutStack* mCenteringStack; LLLayoutStack* mWrapStack; diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index 73c8c99418..aee7ffa517 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -50,59 +50,6 @@ LLToolBarView::ToolbarSet::ToolbarSet() bottom_toolbar("bottom_toolbar") {} -bool LLToolBarView::load() -{ - LLToolBarView::ToolbarSet toolbar_set; - - // Load the default toolbars.xml file - // *TODO : pick up the user's toolbar setting if existing - std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); - - LLXMLNodePtr root; - if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) - { - llerrs << "Unable to load toolbars from file: " << toolbar_file << llendl; - return false; - } - if(!root->hasName("toolbars")) - { - llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl; - return false; - } - - // Parse the toolbar settings - LLXUIParser parser; - parser.readXUI(root, toolbar_set, toolbar_file); - if (!toolbar_set.validateBlock()) - { - llerrs << "Unable to validate toolbars from file: " << toolbar_file << llendl; - return false; - } - - // Add commands to each toolbar - if (toolbar_set.left_toolbar.isProvided() && mToolbarLeft) - { - BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.left_toolbar.commands) - { - addCommand(LLCommandId(command),mToolbarLeft); - } - } - if (toolbar_set.right_toolbar.isProvided() && mToolbarRight) - { - BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.right_toolbar.commands) - { - addCommand(LLCommandId(command),mToolbarRight); - } - } - if (toolbar_set.bottom_toolbar.isProvided() && mToolbarBottom) - { - BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.bottom_toolbar.commands) - { - addCommand(LLCommandId(command),mToolbarBottom); - } - } - return true; -} LLToolBarView::LLToolBarView(const LLToolBarView::Params& p) : LLUICtrl(p), @@ -120,6 +67,7 @@ void LLToolBarView::initFromParams(const LLToolBarView::Params& p) LLToolBarView::~LLToolBarView() { + saveToolbars(); } BOOL LLToolBarView::postBuild() @@ -129,7 +77,7 @@ BOOL LLToolBarView::postBuild() mToolbarBottom = getChild("toolbar_bottom"); // Load the toolbars from the settings - load(); + loadToolbars(); return TRUE; } @@ -167,6 +115,122 @@ bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar) return true; } +bool LLToolBarView::loadToolbars() +{ + LLToolBarView::ToolbarSet toolbar_set; + + // Load the default toolbars.xml file + // *TODO : pick up the user's toolbar setting if existing + std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); + + LLXMLNodePtr root; + if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) + { + llerrs << "Unable to load toolbars from file: " << toolbar_file << llendl; + return false; + } + if(!root->hasName("toolbars")) + { + llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl; + return false; + } + + // Parse the toolbar settings + LLXUIParser parser; + parser.readXUI(root, toolbar_set, toolbar_file); + if (!toolbar_set.validateBlock()) + { + llerrs << "Unable to validate toolbars from file: " << toolbar_file << llendl; + return false; + } + + // Add commands to each toolbar + if (toolbar_set.left_toolbar.isProvided() && mToolbarLeft) + { + BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.left_toolbar.commands) + { + addCommand(LLCommandId(command),mToolbarLeft); + } + } + if (toolbar_set.right_toolbar.isProvided() && mToolbarRight) + { + BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.right_toolbar.commands) + { + addCommand(LLCommandId(command),mToolbarRight); + } + } + if (toolbar_set.bottom_toolbar.isProvided() && mToolbarBottom) + { + BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.bottom_toolbar.commands) + { + addCommand(LLCommandId(command),mToolbarBottom); + } + } + return true; +} + +void LLToolBarView::saveToolbars() const +{ + // Build the parameter tree from the toolbar data + LLToolBarView::ToolbarSet toolbar_set; + + // *TODO : factorize that code a bit... + if (mToolbarLeft) + { + command_id_list_t& command_list = mToolbarLeft->getCommandsList(); + for (command_id_list_t::const_iterator it = command_list.begin(); + it != command_list.end(); + ++it) + { + LLCommandId::Params command; + command.name = it->name(); + toolbar_set.left_toolbar.commands.add(command); + } + } + if (mToolbarRight) + { + command_id_list_t& command_list = mToolbarRight->getCommandsList(); + for (command_id_list_t::const_iterator it = command_list.begin(); + it != command_list.end(); + ++it) + { + LLCommandId::Params command; + command.name = it->name(); + toolbar_set.right_toolbar.commands.add(command); + } + } + if (mToolbarBottom) + { + command_id_list_t& command_list = mToolbarBottom->getCommandsList(); + for (command_id_list_t::const_iterator it = command_list.begin(); + it != command_list.end(); + ++it) + { + LLCommandId::Params command; + command.name = it->name(); + toolbar_set.bottom_toolbar.commands.add(command); + } + } + + // Serialize the parameter tree + LLXMLNodePtr output_node = new LLXMLNode("toolbars", false); + LLXUIParser parser; + parser.writeXUI(output_node, toolbar_set); + + // Write the resulting XML to file + if(!output_node->isNull()) + { + const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml"); + LLFILE *fp = LLFile::fopen(filename, "w"); + if (fp != NULL) + { + LLXMLNode::writeHeaderToFile(fp); + output_node->writeToFile(fp); + fclose(fp); + } + } +} + void LLToolBarView::draw() { static bool debug_print = true; diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index 208660da8e..646a1fd636 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -77,7 +77,8 @@ protected: private: // Loads the toolbars from the existing user or default settings - bool load(); // return false if load fails + bool loadToolbars(); // return false if load fails + void saveToolbars() const; bool addCommand(const LLCommandId& commandId, LLToolBar* toolbar); // Pointers to the toolbars handled by the toolbar view -- cgit v1.2.3 From e4e499e326812e66de9b9c0392ea9899a6e71e63 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 28 Sep 2011 10:27:03 -0700 Subject: EXP-1261 FIX Left hand toolbar does not show labels when icons and labels option selected --- indra/llui/lltoolbarview.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index aee7ffa517..b374a0bfc4 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -241,9 +241,21 @@ void LLToolBarView::draw() LLRect bottom_rect, left_rect, right_rect; - if (mToolbarBottom) mToolbarBottom->localRectToOtherView(mToolbarBottom->getLocalRect(), &bottom_rect, this); - if (mToolbarLeft) mToolbarLeft->localRectToOtherView(mToolbarLeft->getLocalRect(), &left_rect, this); - if (mToolbarRight) mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this); + if (mToolbarBottom) + { + mToolbarBottom->getParent()->reshape(mToolbarBottom->getParent()->getRect().getWidth(), mToolbarBottom->getRect().getHeight()); + mToolbarBottom->localRectToOtherView(mToolbarBottom->getLocalRect(), &bottom_rect, this); + } + if (mToolbarLeft) + { + mToolbarLeft->getParent()->reshape(mToolbarLeft->getRect().getWidth(), mToolbarLeft->getParent()->getRect().getHeight()); + mToolbarLeft->localRectToOtherView(mToolbarLeft->getLocalRect(), &left_rect, this); + } + if (mToolbarRight) + { + mToolbarRight->getParent()->reshape(mToolbarRight->getRect().getWidth(), mToolbarRight->getParent()->getRect().getHeight()); + mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this); + } if ((old_width != getRect().getWidth()) || (old_height != getRect().getHeight())) debug_print = true; -- cgit v1.2.3 From fc0f5173eb20fad8934420e6eec8873d71490894 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 28 Sep 2011 10:40:28 -0700 Subject: fix linux build --- indra/llui/lllayoutstack.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 89b3f671a4..4991c4afa6 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -498,13 +498,13 @@ void LLLayoutStack::updateLayout(BOOL force_resize) { (*panel_it)->mResizeBar->setResizeLimits( relevant_min, - relevant_min + shrink_headroom_total); + relevant_min + llround(shrink_headroom_total)); } else //VERTICAL { (*panel_it)->mResizeBar->setResizeLimits( relevant_min, - relevant_min + shrink_headroom_total); + relevant_min + llround(shrink_headroom_total)); } // toggle resize bars based on panel visibility, resizability, etc -- cgit v1.2.3 From d447f1908bc2da9067d1f4d34825618a4d176602 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 28 Sep 2011 15:27:34 -0700 Subject: EXP-1262 Hitting single letters reserved for shortcuts inworld opens chat but not associated shortcuts (like Mouselook and Fly) EXP-1266 Communicate > Nearby Chat menu item does not bring up chat floater --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9a06423422..148b80e817 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1493,7 +1493,7 @@ Type S32 Value - 1 + 0 ChatBubbleOpacity diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 2e93243b0f..923430d6fd 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -227,10 +227,10 @@ use_mac_ctrl="true"> + parameter="chat_bar" /> + parameter="chat_bar" /> Date: Wed, 28 Sep 2011 15:27:53 -0700 Subject: removing old xml nearby chat --- .../skins/default/xui/en/floater_nearby_chat.xml | 50 ---------------------- 1 file changed, 50 deletions(-) delete mode 100644 indra/newview/skins/default/xui/en/floater_nearby_chat.xml diff --git a/indra/newview/skins/default/xui/en/floater_nearby_chat.xml b/indra/newview/skins/default/xui/en/floater_nearby_chat.xml deleted file mode 100644 index ab966dbb0e..0000000000 --- a/indra/newview/skins/default/xui/en/floater_nearby_chat.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - -- cgit v1.2.3 From 21543fdf26e8104d00bd683bdff5185d6dd620ef Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 28 Sep 2011 16:23:04 -0700 Subject: EXP-1257 : Implemented loading of toolbar settings per user account. Also factorize a bit and clean up the related saveToolbars code. --- indra/llui/lltoolbarview.cpp | 56 ++++++++++++++++------------------------ indra/llui/lltoolbarview.h | 6 +++-- indra/newview/llviewerwindow.cpp | 4 ++- 3 files changed, 29 insertions(+), 37 deletions(-) diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index aee7ffa517..140a26ddd5 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -76,9 +76,6 @@ BOOL LLToolBarView::postBuild() mToolbarRight = getChild("toolbar_right"); mToolbarBottom = getChild("toolbar_bottom"); - // Load the toolbars from the settings - loadToolbars(); - return TRUE; } @@ -120,8 +117,12 @@ bool LLToolBarView::loadToolbars() LLToolBarView::ToolbarSet toolbar_set; // Load the default toolbars.xml file - // *TODO : pick up the user's toolbar setting if existing - std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); + std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml"); + if (!gDirUtilp->fileExists(toolbar_file)) + { + llwarns << "User toolbars def not found -> use default" << llendl; + toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); + } LLXMLNodePtr root; if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) @@ -173,43 +174,17 @@ void LLToolBarView::saveToolbars() const { // Build the parameter tree from the toolbar data LLToolBarView::ToolbarSet toolbar_set; - - // *TODO : factorize that code a bit... if (mToolbarLeft) { - command_id_list_t& command_list = mToolbarLeft->getCommandsList(); - for (command_id_list_t::const_iterator it = command_list.begin(); - it != command_list.end(); - ++it) - { - LLCommandId::Params command; - command.name = it->name(); - toolbar_set.left_toolbar.commands.add(command); - } + addToToolset(mToolbarLeft->getCommandsList(),toolbar_set.left_toolbar); } if (mToolbarRight) { - command_id_list_t& command_list = mToolbarRight->getCommandsList(); - for (command_id_list_t::const_iterator it = command_list.begin(); - it != command_list.end(); - ++it) - { - LLCommandId::Params command; - command.name = it->name(); - toolbar_set.right_toolbar.commands.add(command); - } + addToToolset(mToolbarRight->getCommandsList(),toolbar_set.right_toolbar); } if (mToolbarBottom) { - command_id_list_t& command_list = mToolbarBottom->getCommandsList(); - for (command_id_list_t::const_iterator it = command_list.begin(); - it != command_list.end(); - ++it) - { - LLCommandId::Params command; - command.name = it->name(); - toolbar_set.bottom_toolbar.commands.add(command); - } + addToToolset(mToolbarBottom->getCommandsList(),toolbar_set.bottom_toolbar); } // Serialize the parameter tree @@ -231,6 +206,19 @@ void LLToolBarView::saveToolbars() const } } +// Enumerate the commands in command_list and add them as Params to the toolbar +void LLToolBarView::addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const +{ + for (command_id_list_t::const_iterator it = command_list.begin(); + it != command_list.end(); + ++it) + { + LLCommandId::Params command; + command.name = it->name(); + toolbar.commands.add(command); + } +} + void LLToolBarView::draw() { static bool debug_print = true; diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index 646a1fd636..b19841997b 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -67,7 +67,10 @@ public: virtual void draw(); // Toolbar view interface with the rest of the world + // Checks if the commandId is being used somewhere in one of the toolbars bool hasCommand(const LLCommandId& commandId) const; + // Loads the toolbars from the existing user or default settings + bool loadToolbars(); // return false if load fails protected: friend class LLUICtrlFactory; @@ -76,10 +79,9 @@ protected: void initFromParams(const Params&); private: - // Loads the toolbars from the existing user or default settings - bool loadToolbars(); // return false if load fails void saveToolbars() const; bool addCommand(const LLCommandId& commandId, LLToolBar* toolbar); + void addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const; // Pointers to the toolbars handled by the toolbar view LLToolBar* mToolbarLeft; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 7c930b80c2..6c9ee17a76 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1950,9 +1950,11 @@ void LLViewerWindow::initWorldUI() buttons_panel->setFollowsAll(); buttons_panel_container->addChild(buttons_panel); - // Make the toolbars visible + // Load and make the toolbars visible + // Note: we need to load the toolbars only *after* the user is logged in and IW if (gToolBarView) { + gToolBarView->loadToolbars(); gToolBarView->setVisible(TRUE); } } -- cgit v1.2.3 From 6a49f2947f05963c577a1644c16a8affc779da63 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 28 Sep 2011 16:25:32 -0700 Subject: EXP-1234 WIP experimental drag and drop --- indra/llui/lltoolbar.cpp | 93 ++++++++++++++++++++++++++++++-------------- indra/llui/lltoolbar.h | 16 +++++++- indra/llui/lltoolbarview.cpp | 41 ++++++++++++++++++- indra/llui/lltoolbarview.h | 9 ++++- indra/llui/llview.h | 14 +++++++ 5 files changed, 140 insertions(+), 33 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index c5219b11e8..fe989cee22 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -33,6 +33,7 @@ #include "llcommandmanager.h" #include "llmenugl.h" #include "lltrans.h" +#include "lltoolbarview.h" // uncomment this and remove the one in llui.cpp when there is an external reference to this translation unit // thanks, MSVC! @@ -201,35 +202,27 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) bool LLToolBar::addCommand(const LLCommandId& commandId) { LLCommand * command = LLCommandManager::instance().getCommand(commandId); + if (!command) return false; - bool add_command = (command != NULL); - - if (add_command) - { - mButtonCommands.push_back(commandId); - createButton(commandId); - } + mButtonCommands.push_back(commandId); + LLToolBarButton* button = createButton(commandId); + mButtons.push_back(button); + mButtonPanel->addChild(button); + mButtonMap.insert(std::make_pair(commandId, button)); + mNeedsLayout = true; - return add_command; + return true; } bool LLToolBar::hasCommand(const LLCommandId& commandId) const { - bool has_command = false; - if (commandId != LLCommandId::null) { - BOOST_FOREACH(LLCommandId cmd, mButtonCommands) - { - if (cmd == commandId) - { - has_command = true; - break; - } - } + command_id_map::const_iterator it = mButtonMap.find(commandId); + return (it != mButtonMap.end()); } - return has_command; + return false; } bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled) @@ -238,11 +231,10 @@ bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled) if (commandId != LLCommandId::null) { - command_button = mButtonPanel->findChild(commandId.name()); - - if (command_button) + command_id_map::iterator it = mButtonMap.find(commandId); + if (it != mButtonMap.end()) { - command_button->setEnabled(enabled); + it->second->setEnabled(enabled); } } @@ -498,15 +490,19 @@ void LLToolBar::createButtons() BOOST_FOREACH(LLCommandId& command_id, mButtonCommands) { - createButton(command_id); + LLToolBarButton* button = createButton(command_id); + mButtons.push_back(button); + mButtonPanel->addChild(button); + mButtonMap.insert(std::make_pair(command_id, button)); } + mNeedsLayout = true; } -void LLToolBar::createButton(const LLCommandId& id) +LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) { LLCommand* commandp = LLCommandManager::instance().getCommand(id); - if (!commandp) return; + if (!commandp) return NULL; LLToolBarButton::Params button_p; button_p.label = LLTrans::getString(commandp->labelRef()); @@ -515,8 +511,47 @@ void LLToolBar::createButton(const LLCommandId& id) button_p.overwriteFrom(mButtonParams[mButtonType]); LLToolBarButton* button = LLUICtrlFactory::create(button_p); - mButtons.push_back(button); - mButtonPanel->addChild(button); + button->setCommandId(id); + return button; +} - mNeedsLayout = true; +// +// LLToolBarButton +// + +LLToolBarButton::LLToolBarButton(const Params& p) +: LLButton(p), + mMouseDownX(0), + mMouseDownY(0), + mId("") +{} + + +BOOL LLToolBarButton::handleMouseDown(S32 x, S32 y, MASK mask) +{ + mMouseDownX = x; + mMouseDownY = y; + return LLButton::handleMouseDown(x, y, mask); +} + +BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) +{ + if (hasMouseCapture()) + { + S32 dist_squared = (x - mMouseDownX) * (x - mMouseDownX) + (y - mMouseDownY) * (y - mMouseDownY); + S32 threshold = LLUI::sSettingGroups["config"]->getS32("DragAndDropDistanceThreshold"); + S32 threshold_squared = threshold * threshold; + if (dist_squared > threshold_squared) + { + // start drag and drop + LLToolBarView* view = getParentByType(); + LLToolBar* bar = getParentByType(); + if (view) + { + view->startDrag(bar->createButton(mId)); + setVisible(FALSE); + } + } + } + return LLButton::handleHover(x, y, mask); } diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 8e484c7e13..77bac87dbc 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -42,7 +42,15 @@ public: { }; - LLToolBarButton(const Params& p) : LLButton(p) {} + LLToolBarButton(const Params& p); + + BOOL handleMouseDown(S32 x, S32 y, MASK mask); + BOOL handleHover(S32 x, S32 y, MASK mask); + void setCommandId(const LLCommandId& id) { mId = id; } +private: + LLCommandId mId; + S32 mMouseDownX; + S32 mMouseDownY; }; @@ -125,6 +133,8 @@ public: bool enableCommand(const LLCommandId& commandId, bool enabled); command_id_list_t& getCommandsList() { return mButtonCommands; } + LLToolBarButton* createButton(const LLCommandId& id); + protected: friend class LLUICtrlFactory; LLToolBar(const Params&); @@ -136,7 +146,6 @@ private: void createContextMenu(); void updateLayoutAsNeeded(); void createButtons(); - void createButton(const LLCommandId& id); void resizeButtonsInRow(std::vector& buttons_in_row, S32 max_row_girth); BOOL isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); @@ -145,6 +154,9 @@ private: std::list mButtons; command_id_list_t mButtonCommands; + typedef std::map command_id_map; + command_id_map mButtonMap; + LLToolBarEnums::ButtonType mButtonType; LLLayoutStack* mCenteringStack; LLLayoutStack* mWrapStack; diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index b374a0bfc4..0c3a6bd0ac 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -55,7 +55,10 @@ LLToolBarView::LLToolBarView(const LLToolBarView::Params& p) : LLUICtrl(p), mToolbarLeft(NULL), mToolbarRight(NULL), - mToolbarBottom(NULL) + mToolbarBottom(NULL), + mDragButton(NULL), + mMouseX(0), + mMouseY(0) { } @@ -283,4 +286,40 @@ void LLToolBarView::draw() //gl_rect_2d(right_rect, back_color_vert, TRUE); LLUICtrl::draw(); + + if (mDragButton) + { + S32 cursor_x, cursor_y; + mDragButton->setOrigin(mMouseX - mDragButton->getRect().getWidth(), mMouseY - mDragButton->getRect().getHeight()); + drawChild(mDragButton); + } +} + +void LLToolBarView::startDrag(LLToolBarButton* button) +{ + mDragButton = button; + addChild(mDragButton); + gFocusMgr.setMouseCapture(this); +} + +BOOL LLToolBarView::handleHover(S32 x, S32 y, MASK mask) +{ + mMouseX = x; + mMouseY = y; + return LLUICtrl::handleHover(x, y, mask); +} + +BOOL LLToolBarView::handleMouseUp(S32 x, S32 y, MASK mask) +{ + if (hasMouseCapture()) + { + gFocusMgr.setMouseCapture(NULL); + } + return LLUICtrl::handleMouseUp(x, y, mask); +} + +void LLToolBarView::onMouseCaptureLost() +{ + delete mDragButton; + mDragButton = NULL; } diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index 646a1fd636..cbe3d6c083 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -65,7 +65,10 @@ public: virtual ~LLToolBarView(); virtual BOOL postBuild(); virtual void draw(); - + virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual void onMouseCaptureLost(); + void startDrag(LLToolBarButton*); // Toolbar view interface with the rest of the world bool hasCommand(const LLCommandId& commandId) const; @@ -85,6 +88,10 @@ private: LLToolBar* mToolbarLeft; LLToolBar* mToolbarRight; LLToolBar* mToolbarBottom; + bool mDragging; + LLToolBarButton* mDragButton; + S32 mMouseX; + S32 mMouseY; }; extern LLToolBarView* gToolBarView; diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 9039366e7e..f4e31b109a 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -465,6 +465,20 @@ public: return dynamic_cast(widgetp); } + template T* getParentByType() const + { + LLView* parent = getParent(); + while(parent) + { + if (dynamic_cast(parent)) + { + return static_cast(parent); + } + parent = parent->getParent(); + } + return NULL; + } + ////////////////////////////////////////////// // statics ////////////////////////////////////////////// -- cgit v1.2.3 From fdf042bdb9aeefa209694e04d4012a3a1f911a52 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 28 Sep 2011 16:54:34 -0700 Subject: EXP-1205 PROGRESS -- As a User, I want a toybox which will contain all buttons that I can d&d into the toolbars EXP-1233 FIX -- Populate the toybox floater window with all FUI toolbar buttons indicated as such in the "commands.xml" definition. EXP-1267 FIX -- Enable/disable buttons in the toybox * Hooked up button callbacks to the toolbar buttons * Fixed toybox button enable/disable to function properly and live update as buttons change states. * Removed the toybox toolbar background image Reviewed by Leyla --- indra/llui/llcommandmanager.cpp | 4 +-- indra/llui/llcommandmanager.h | 6 ++-- indra/llui/lltoolbar.cpp | 10 +++++- indra/llui/lluictrl.cpp | 10 ++++++ indra/llui/lluictrl.h | 3 ++ indra/newview/app_settings/commands.xml | 42 +++++++++++----------- indra/newview/llfloatertoybox.cpp | 19 +++++++--- .../skins/default/xui/en/floater_toybox.xml | 4 ++- 8 files changed, 65 insertions(+), 33 deletions(-) diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 783990780b..b1147134c2 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -53,7 +53,7 @@ LLCommand::Params::Params() , icon("icon") , label_ref("label_ref") , name("name") - , param("param") + , parameter("parameter") , tooltip_ref("tooltip_ref") { } @@ -64,7 +64,7 @@ LLCommand::LLCommand(const LLCommand::Params& p) , mIcon(p.icon) , mIdentifier(p.name) , mLabelRef(p.label_ref) - , mParam(p.param) + , mParameter(p.parameter) , mTooltipRef(p.tooltip_ref) { } diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 4781f77177..6481a05689 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -93,7 +93,7 @@ public: Mandatory icon; Mandatory label_ref; Mandatory name; - Optional param; + Optional parameter; Mandatory tooltip_ref; Params(); @@ -106,7 +106,7 @@ public: const std::string& icon() const { return mIcon; } const LLCommandId& id() const { return mIdentifier; } const std::string& labelRef() const { return mLabelRef; } - const std::string& param() const { return mParam; } + const LLSD& parameter() const { return mParameter; } const std::string& tooltipRef() const { return mTooltipRef; } private: @@ -116,7 +116,7 @@ private: std::string mFunction; std::string mIcon; std::string mLabelRef; - std::string mParam; + LLSD mParameter; std::string mTooltipRef; }; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index c5219b11e8..45567d5859 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -500,7 +500,6 @@ void LLToolBar::createButtons() { createButton(command_id); } - } void LLToolBar::createButton(const LLCommandId& id) @@ -509,12 +508,21 @@ void LLToolBar::createButton(const LLCommandId& id) if (!commandp) return; LLToolBarButton::Params button_p; + button_p.name = id.name(); button_p.label = LLTrans::getString(commandp->labelRef()); button_p.tool_tip = button_p.label(); button_p.image_overlay = LLUI::getUIImage(commandp->icon()); button_p.overwriteFrom(mButtonParams[mButtonType]); LLToolBarButton* button = LLUICtrlFactory::create(button_p); + if (!mReadOnly) + { + LLUICtrl::CommitCallbackParam cbParam; + cbParam.function_name = commandp->functionName(); + cbParam.parameter = commandp->parameter(); + button->setCommitCallback(cbParam); + } + mButtons.push_back(button); mButtonPanel->addChild(button); diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index d58df5801b..5e8bf498c0 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -992,6 +992,16 @@ void LLUICtrl::setTransparencyType(ETypeTransparency type) mTransparencyType = type; } +boost::signals2::connection LLUICtrl::setCommitCallback(const CommitCallbackParam& cb) +{ + return setCommitCallback(initCommitCallback(cb)); +} + +boost::signals2::connection LLUICtrl::setValidateCallback(const EnableCallbackParam& cb) +{ + return setValidateCallback(initEnableCallback(cb)); +} + boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb ) { if (!mCommitSignal) mCommitSignal = new commit_signal_t(); diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 09bed9b958..fc56e5fc35 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -235,6 +235,9 @@ public: // topic then put in help_topic_out bool findHelpTopic(std::string& help_topic_out); + boost::signals2::connection setCommitCallback(const CommitCallbackParam& cb); + boost::signals2::connection setValidateCallback(const EnableCallbackParam& cb); + boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb ); diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 4a33b24075..5fbd9248c1 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -6,7 +6,7 @@ label_ref="Command_Avatar_Label" tooltip_ref="Command_Avatar_Tooltip" function="Floater.ToolbarToggle" - param="avatar" + parameter="avatar" /> diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index beb928ea36..c3fa322f85 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -67,9 +67,6 @@ BOOL LLFloaterToybox::postBuild() if (command->availableInToybox()) { mToolBar->addCommand(command->id()); - - llassert(gToolBarView != NULL); - mToolBar->enableCommand(command->id(), !gToolBarView->hasCommand(command->id())); } } @@ -93,17 +90,29 @@ void LLFloaterToybox::onClose(bool app_quitting) void LLFloaterToybox::draw() { + llassert(gToolBarView != NULL); + + LLCommandManager& cmdMgr = LLCommandManager::instance(); + + for (U32 i = 0; i < cmdMgr.commandCount(); i++) + { + LLCommand * command = cmdMgr.getCommand(i); + + if (command->availableInToybox()) + { + mToolBar->enableCommand(command->id(), !gToolBarView->hasCommand(command->id())); + } + } + LLFloater::draw(); } void LLFloaterToybox::onFocusReceived() { - } void LLFloaterToybox::onBtnRestoreDefaults() { - } diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index 092eddaa53..feb19571b2 100644 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -59,7 +59,9 @@ read_only="true" right="-20" side="top" - top="85" /> + top="85"> + + Date: Thu, 29 Sep 2011 21:43:07 +0300 Subject: EXP-1209 FIXED Sidetray removed. - Removed all sidetray dependencies and the sidetray itself. - Also removed LLFloaterSidetrayTab and LLSidetrayListener as unused. --- indra/newview/CMakeLists.txt | 6 - indra/newview/app_settings/settings.xml | 11 - indra/newview/llagentwearables.cpp | 1 - indra/newview/llappearancemgr.cpp | 4 +- indra/newview/llappviewer.cpp | 7 - indra/newview/llavataractions.cpp | 1 - indra/newview/llbottomtray.cpp | 1 - indra/newview/llchathistory.cpp | 2 - indra/newview/llcofwearables.cpp | 8 - indra/newview/llfavoritesbar.cpp | 1 - indra/newview/llfloaterpreference.cpp | 7 +- indra/newview/llfloatersidetraytab.cpp | 52 - indra/newview/llfloatersidetraytab.h | 49 - indra/newview/llgroupactions.cpp | 1 - indra/newview/llimfloater.cpp | 38 - indra/newview/llimfloater.h | 4 - indra/newview/llinspectobject.cpp | 1 - indra/newview/llinventorybridge.cpp | 1 - indra/newview/llinventoryfunctions.cpp | 1 - indra/newview/llinventorypanel.cpp | 1 - indra/newview/lllocationinputctrl.cpp | 1 - indra/newview/llnavigationbar.cpp | 1 - indra/newview/llnearbychat.cpp | 1 - indra/newview/lloutfitslist.cpp | 1 - indra/newview/llpanelblockedlist.cpp | 1 - indra/newview/llpanelgroup.cpp | 1 - indra/newview/llpanelimcontrolpanel.cpp | 1 - indra/newview/llpanellandmarks.cpp | 1 - indra/newview/llpanelmaininventory.cpp | 1 - indra/newview/llpanelmarketplaceinbox.cpp | 8 - indra/newview/llpanelmarketplaceinbox.h | 4 +- indra/newview/llpanelmarketplaceoutbox.cpp | 1 - indra/newview/llpanelme.cpp | 14 - indra/newview/llpanelobjectinventory.cpp | 1 - indra/newview/llpaneloutfitsinventory.cpp | 1 - indra/newview/llpanelpeople.cpp | 3 +- indra/newview/llpanelplaces.cpp | 1 - indra/newview/llpanelteleporthistory.cpp | 1 - indra/newview/llpaneltopinfobar.cpp | 1 - indra/newview/llpaneltopinfobar.h | 2 +- indra/newview/llpanelwearing.cpp | 1 - indra/newview/llscreenchannel.cpp | 41 +- indra/newview/llscreenchannel.h | 1 - indra/newview/llsidepanelappearance.cpp | 2 - indra/newview/llsidepanelinventory.cpp | 5 +- indra/newview/llsidepanelinventory.h | 2 +- indra/newview/llsidetray.cpp | 1489 -------------------- indra/newview/llsidetray.h | 260 ---- indra/newview/llsidetraylistener.cpp | 179 --- indra/newview/llsidetraylistener.h | 53 - indra/newview/llstartup.cpp | 1 - indra/newview/llurldispatcher.cpp | 1 - indra/newview/llviewerfloaterreg.cpp | 2 - indra/newview/llviewerinventory.cpp | 1 - indra/newview/llviewermenu.cpp | 45 +- indra/newview/llviewermessage.cpp | 5 +- indra/newview/llviewertexteditor.cpp | 1 - indra/newview/llviewerwindow.cpp | 27 - indra/newview/llviewerwindow.h | 2 - indra/newview/llwearable.cpp | 1 - indra/newview/llworldview.cpp | 61 - indra/newview/skins/default/xui/en/main_view.xml | 19 - indra/newview/skins/default/xui/en/menu_login.xml | 8 - .../default/xui/en/panel_preferences_move.xml | 10 - 64 files changed, 29 insertions(+), 2431 deletions(-) delete mode 100644 indra/newview/llfloatersidetraytab.cpp delete mode 100644 indra/newview/llfloatersidetraytab.h delete mode 100644 indra/newview/llsidetray.cpp delete mode 100644 indra/newview/llsidetray.h delete mode 100644 indra/newview/llsidetraylistener.cpp delete mode 100644 indra/newview/llsidetraylistener.h delete mode 100644 indra/newview/llworldview.cpp diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 59e1ca10e6..c488d51ba5 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -229,7 +229,6 @@ set(viewer_SOURCE_FILES llfloatersellland.cpp llfloatersettingsdebug.cpp llfloatersidepanelcontainer.cpp - llfloatersidetraytab.cpp llfloatersnapshot.cpp llfloatersounddevices.cpp llfloatertelehub.cpp @@ -442,8 +441,6 @@ set(viewer_SOURCE_FILES llsidepanelinventorysubpanel.cpp llsidepaneliteminfo.cpp llsidepaneltaskinfo.cpp - llsidetray.cpp - llsidetraylistener.cpp llsidetraypanelcontainer.cpp llsky.cpp llslurl.cpp @@ -794,7 +791,6 @@ set(viewer_HEADER_FILES llfloatersellland.h llfloatersettingsdebug.h llfloatersidepanelcontainer.h - llfloatersidetraytab.h llfloatersnapshot.h llfloatersounddevices.h llfloatertelehub.h @@ -1002,8 +998,6 @@ set(viewer_HEADER_FILES llsidepanelinventorysubpanel.h llsidepaneliteminfo.h llsidepaneltaskinfo.h - llsidetray.h - llsidetraylistener.h llsidetraypanelcontainer.h llsky.h llslurl.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 148b80e817..3d3185600b 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9921,17 +9921,6 @@ Value 0 - SidebarCameraMovement - - Comment - Reflects world rect changing while changing sidebar visibility. - Persist - 1 - Type - Boolean - Value - 0 - GroupListShowIcons Comment diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 404cd8e5b6..ccbf6bf932 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -43,7 +43,6 @@ #include "llnotificationsutil.h" #include "lloutfitobserver.h" #include "llsidepanelappearance.h" -#include "llsidetray.h" #include "lltexlayer.h" #include "lltooldraganddrop.h" #include "llviewerregion.h" diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index c638f881a5..e5369dc2b8 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -44,7 +44,6 @@ #include "lloutfitslist.h" #include "llselectmgr.h" #include "llsidepanelappearance.h" -#include "llsidetray.h" #include "llviewerobjectlist.h" #include "llvoavatar.h" #include "llvoavatarself.h" @@ -2466,7 +2465,8 @@ public: // add may be processed after login process is finished if (mShowPanel) { - LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key); + LLFloaterSidePanelContainer::showPanel("appearance", "panel_outfits_inventory", key); + } LLOutfitsList *outfits_list = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "outfitslist_tab")); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 43c8750b02..7b75bbf430 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -81,7 +81,6 @@ #include "llviewermenufile.h" #include "llvoicechannel.h" #include "llvoavatarself.h" -#include "llsidetray.h" #include "llurlmatch.h" #include "lltextutil.h" #include "lllogininstance.h" @@ -3499,8 +3498,6 @@ void LLAppViewer::requestQuit() gFloaterView->closeAllChildren(true); } - LLSideTray::getInstance()->notifyChildren(LLSD().with("request","quit")); - send_stats(); gLogoutTimer.reset(); @@ -4559,10 +4556,6 @@ void LLAppViewer::idleShutdown() return; } - if (LLSideTray::getInstance()->notifyChildren(LLSD().with("request","wait_quit"))) - { - return; - } diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index fb7517a98b..b14c02a5d6 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -61,7 +61,6 @@ #include "llpaneloutfitedit.h" #include "llpanelprofile.h" #include "llrecentpeople.h" -#include "llsidetray.h" #include "lltrans.h" #include "llviewercontrol.h" #include "llviewerobjectlist.h" diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 19061c55ca..98712f1334 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -48,7 +48,6 @@ #include "llimfloater.h" // for LLIMFloater #include "llnearbychatbar.h" #include "llnearbychatbarlistener.h" -#include "llsidetray.h" #include "llspeakbutton.h" #include "llsplitbutton.h" #include "llsyswellwindow.h" diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index d6773b8b29..7a444edd43 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -59,8 +59,6 @@ #include "llviewercontrol.h" -#include "llsidetray.h"//for blocked objects panel - static LLDefaultChildRegistry::Register r("chat_history"); const static std::string NEW_LINE(rawstr_to_utf8("\n")); diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index 80e0cca780..54598f90c8 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -41,7 +41,6 @@ #include "llviewermenu.h" #include "llwearableitemslist.h" #include "llpaneloutfitedit.h" -#include "llsidetray.h" #include "lltrans.h" static LLRegisterPanelClassWrapper t_cof_wearables("cof_wearables"); @@ -160,11 +159,6 @@ public: protected: static void replaceWearable(const LLUUID& item_id) { - // *TODO: Most probable that accessing to LLPanelOutfitEdit instance should be: - // LLSideTray::getInstance()->getSidepanelAppearance()->getPanelOutfitEdit() - // without casting. Getter methods provides possibility to check and construct - // absent instance. Explicit relations between components avoids situations - // when we tries to construct instance with unsatisfied implicit input conditions. LLPanelOutfitEdit * panel_outfit_edit = dynamic_cast (LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); @@ -236,8 +230,6 @@ protected: LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar; LLUUID selected_id = mUUIDs.back(); - // *HACK* need to pass pointer to LLPanelOutfitEdit instead of LLSideTray::getInstance()->getPanel(). - // LLSideTray::getInstance()->getPanel() is rather slow variant LLPanelOutfitEdit* panel_oe = dynamic_cast(LLFloaterSidePanelContainer::getPanel("appearance", "panel_outfit_edit")); registrar.add("BodyPart.Replace", boost::bind(&LLPanelOutfitEdit::onReplaceMenuItemClicked, panel_oe, selected_id)); registrar.add("BodyPart.Edit", boost::bind(LLAgentWearables::editWearable, selected_id)); diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 1eabf32b9f..6dcfa95a0e 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -45,7 +45,6 @@ #include "llfloaterworldmap.h" #include "lllandmarkactions.h" #include "llnotificationsutil.h" -#include "llsidetray.h" #include "lltoggleablemenu.h" #include "llviewerinventory.h" #include "llviewermenu.h" diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index d8b6b2e966..47c86ae549 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -67,7 +67,6 @@ #include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "llsliderctrl.h" -#include "llsidetray.h" #include "lltabcontainer.h" #include "lltrans.h" #include "llviewercontrol.h" @@ -1497,11 +1496,7 @@ void LLFloaterPreference::onChangeMaturity() // but the UI for this will still be enabled void LLFloaterPreference::onClickBlockList() { - // don't create side tray on demand - if (LLSideTray::instanceCreated()) - { - LLFloaterSidePanelContainer::showPanel("people", "panel_block_list_sidetray", LLSD()); - } + LLFloaterSidePanelContainer::showPanel("people", "panel_block_list_sidetray", LLSD()); } void LLFloaterPreference::onDoubleClickCheckBox(LLUICtrl* ctrl) diff --git a/indra/newview/llfloatersidetraytab.cpp b/indra/newview/llfloatersidetraytab.cpp deleted file mode 100644 index 9f15e62d84..0000000000 --- a/indra/newview/llfloatersidetraytab.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @file llfloatersidetraytab.cpp - * @brief LLFloaterSideTrayTab class definition - * - * $LicenseInfo:firstyear=2010&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloatersidetraytab.h" - -// newview includes -#include "lltransientfloatermgr.h" -#include "llsidetray.h" - -LLFloaterSideTrayTab::LLFloaterSideTrayTab(const LLSD& key, const Params& params) -: LLFloater(key, params) -{ - // Prevent transient floaters (e.g. IM windows) from hiding - // when this floater is clicked. - LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::GLOBAL, this); -} - -LLFloaterSideTrayTab::~LLFloaterSideTrayTab() -{ - LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this); -} - -void LLFloaterSideTrayTab::onClose(bool app_quitting) -{ - // The floater is already being closed, so don't toggle it once more (that may crash viewer). - LLSideTray::getInstance()->setTabDocked(getName(), /* dock = */ true, /* toggle_floater = */ false); -} diff --git a/indra/newview/llfloatersidetraytab.h b/indra/newview/llfloatersidetraytab.h deleted file mode 100644 index 89f2444a0e..0000000000 --- a/indra/newview/llfloatersidetraytab.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file llfloatersidetraytab.h - * @brief LLFloaterSideTrayTab class definition - * - * $LicenseInfo:firstyear=2010&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLFLOATERSIDETRAYTAB_H -#define LL_LLFLOATERSIDETRAYTAB_H - -#include "llfloater.h" - -/** - * When a side tray tab gets detached, it's wrapped in an instance of this class. - * - * This class helps to make sure that clicking a detached side tray tab doesn't - * make transient floaters (e.g. IM windows) hide, so that it's possible to - * drag an inventory item from detached My Inventory window to a docked IM window, - * i.e. share the item (see VWR-22891). - */ -class LLFloaterSideTrayTab : public LLFloater -{ -public: - LLFloaterSideTrayTab(const LLSD& key, const Params& params = getDefaultParams()); - ~LLFloaterSideTrayTab(); - - void onClose(bool app_quitting); -}; - -#endif // LL_LLFLOATERSIDETRAYTAB_H diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index cbbd66d868..623ebb76f2 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -38,7 +38,6 @@ #include "llgroupmgr.h" #include "llimview.h" // for gIMMgr #include "llnotificationsutil.h" -#include "llsidetray.h" #include "llstatusbar.h" // can_afford_transaction() #include "llimfloater.h" #include "groupchatlistener.h" diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 50a9c56518..14d85246e9 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -55,15 +55,9 @@ #include "llinventorymodel.h" #include "llrootview.h" #include "llspeakers.h" -#include "llsidetray.h" #include "llviewerchat.h" -static const S32 RECT_PADDING_NOT_INIT = -1; -static const S32 RECT_PADDING_NEED_RECALC = -2; - -S32 LLIMFloater::sAllowedRectRightPadding = RECT_PADDING_NOT_INIT; - LLIMFloater::LLIMFloater(const LLUUID& session_id) : LLTransientDockableFloater(NULL, true, session_id), mControlPanel(NULL), @@ -472,41 +466,9 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) return floater; } -//static -bool LLIMFloater::resetAllowedRectPadding() -{ - //reset allowed rect right padding if "SidebarCameraMovement" option - //or sidebar state changed - sAllowedRectRightPadding = RECT_PADDING_NEED_RECALC ; - return true; -} - void LLIMFloater::getAllowedRect(LLRect& rect) { - if (sAllowedRectRightPadding == RECT_PADDING_NOT_INIT) //wasn't initialized - { - gSavedSettings.getControl("SidebarCameraMovement")->getSignal()->connect(boost::bind(&LLIMFloater::resetAllowedRectPadding)); - - LLSideTray* side_bar = LLSideTray::getInstance(); - side_bar->setVisibleWidthChangeCallback(boost::bind(&LLIMFloater::resetAllowedRectPadding)); - sAllowedRectRightPadding = RECT_PADDING_NEED_RECALC; - } - rect = gViewerWindow->getWorldViewRectScaled(); - if (sAllowedRectRightPadding == RECT_PADDING_NEED_RECALC) //recalc allowed rect right padding - { - LLPanel* side_bar_tabs = - gViewerWindow->getRootView()->getChild ( - "side_bar_tabs"); - sAllowedRectRightPadding = side_bar_tabs->getRect().getWidth(); - LLTransientFloaterMgr::getInstance()->addControlView(side_bar_tabs); - - if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE) - { - sAllowedRectRightPadding += LLSideTray::getInstance()->getVisibleWidth(); - } - } - rect.mRight -= sAllowedRectRightPadding; } void LLIMFloater::setDocked(bool docked, bool pop_on_undock) diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 5158f6c1f7..8a3020ea10 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -156,10 +156,6 @@ private: static void closeHiddenIMToasts(); - static bool resetAllowedRectPadding(); - //need to keep this static for performance issues - static S32 sAllowedRectRightPadding; - static void confirmLeaveCallCallback(const LLSD& notification, const LLSD& response); LLPanelChatControlPanel* mControlPanel; diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp index 29d7a4a6b0..026c8a0923 100644 --- a/indra/newview/llinspectobject.cpp +++ b/indra/newview/llinspectobject.cpp @@ -46,7 +46,6 @@ #include "llmenubutton.h" #include "llresmgr.h" // getMonetaryString #include "llsafehandle.h" -#include "llsidetray.h" #include "lltextbox.h" // for description truncation #include "lltoggleablemenu.h" #include "lltrans.h" diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index b6041c7f31..2066cbc6b2 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -60,7 +60,6 @@ #include "llpreviewtexture.h" #include "llselectmgr.h" #include "llsidepanelappearance.h" -#include "llsidetray.h" #include "lltrans.h" #include "llviewerassettype.h" #include "llviewerfoldertype.h" diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index acec02b507..21a026bcf7 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -71,7 +71,6 @@ #include "llscrollbar.h" #include "llscrollcontainer.h" #include "llselectmgr.h" -#include "llsidetray.h" #include "llsidepanelinventory.h" #include "lltabcontainer.h" #include "lltooldraganddrop.h" diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 27db28367c..b0f9cb28e6 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -43,7 +43,6 @@ #include "llinventoryfunctions.h" #include "llinventorymodelbackgroundfetch.h" #include "llsidepanelinventory.h" -#include "llsidetray.h" #include "llviewerattachmenu.h" #include "llviewerfoldertype.h" #include "llvoavatarself.h" diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index f519ad759e..025181ead5 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -49,7 +49,6 @@ #include "lllandmarkactions.h" #include "lllandmarklist.h" #include "llteleporthistory.h" -#include "llsidetray.h" #include "llslurl.h" #include "llstatusbar.h" // getHealth() #include "lltrans.h" diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index 4c0823874c..fc264db5af 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -45,7 +45,6 @@ #include "llpaneltopinfobar.h" #include "llteleporthistory.h" #include "llsearchcombobox.h" -#include "llsidetray.h" #include "llslurl.h" #include "llurlregistry.h" #include "llurldispatcher.h" diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index a16ea0e7d3..9eaa64a124 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -32,7 +32,6 @@ #include "llrootview.h" //#include "llchatitemscontainerctrl.h" #include "lliconctrl.h" -#include "llsidetray.h" #include "llfloatersidepanelcontainer.h" #include "llfocusmgr.h" #include "llresizebar.h" diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index c2739867b1..1dc4d796ab 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -42,7 +42,6 @@ #include "llmenubutton.h" #include "llnotificationsutil.h" #include "lloutfitobserver.h" -#include "llsidetray.h" #include "lltoggleablemenu.h" #include "lltransutil.h" #include "llviewermenu.h" diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 856dabb6b7..5c85ec438c 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -38,7 +38,6 @@ // project include #include "llfloateravatarpicker.h" #include "llfloatersidepanelcontainer.h" -#include "llsidetray.h" #include "llsidetraypanelcontainer.h" static LLRegisterPanelClassWrapper t_panel_blocked_list("panel_block_list_sidetray"); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 70dcf61d7d..ae217958f0 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -50,7 +50,6 @@ #include "llpanelgroupnotices.h" #include "llpanelgroupgeneral.h" -#include "llsidetray.h" #include "llaccordionctrltab.h" #include "llaccordionctrl.h" diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp index e370f2f622..0295ad151f 100644 --- a/indra/newview/llpanelimcontrolpanel.cpp +++ b/indra/newview/llpanelimcontrolpanel.cpp @@ -40,7 +40,6 @@ #include "llparticipantlist.h" #include "llimview.h" #include "llvoicechannel.h" -#include "llsidetray.h" #include "llspeakers.h" #include "lltrans.h" diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 1b9eb4813b..a65631b8d8 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -52,7 +52,6 @@ #include "llmenubutton.h" #include "llplacesinventorybridge.h" #include "llplacesinventorypanel.h" -#include "llsidetray.h" #include "lltoggleablemenu.h" #include "llviewermenu.h" #include "llviewerregion.h" diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index c1341af2ef..6562b259c3 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -52,7 +52,6 @@ #include "llviewermenu.h" #include "llviewertexturelist.h" #include "llsidepanelinventory.h" -#include "llsidetray.h" const std::string FILTERS_FILENAME("filters.xml"); diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index a336472fc0..d1aea51a09 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -59,8 +59,6 @@ LLPanelMarketplaceInbox::~LLPanelMarketplaceInbox() // virtual BOOL LLPanelMarketplaceInbox::postBuild() { - LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLPanelMarketplaceInbox::handleLoginComplete, this)); - LLFocusableElement::setFocusReceivedCallback(boost::bind(&LLPanelMarketplaceInbox::onFocusReceived, this)); return TRUE; @@ -74,12 +72,6 @@ void LLPanelMarketplaceInbox::onSelectionChange() } -void LLPanelMarketplaceInbox::handleLoginComplete() -{ - // Set us up as the class to drive the badge value for the sidebar_inventory button - LLSideTray::getInstance()->setTabButtonBadgeDriver("sidebar_inventory", this); -} - LLInventoryPanel * LLPanelMarketplaceInbox::setupInventoryPanel() { LLView * inbox_inventory_placeholder = getChild("inbox_inventory_placeholder"); diff --git a/indra/newview/llpanelmarketplaceinbox.h b/indra/newview/llpanelmarketplaceinbox.h index 705a095cf0..3531518e51 100644 --- a/indra/newview/llpanelmarketplaceinbox.h +++ b/indra/newview/llpanelmarketplaceinbox.h @@ -28,11 +28,10 @@ #define LL_LLPANELMARKETPLACEINBOX_H #include "llpanel.h" -#include "llsidetray.h" class LLInventoryPanel; -class LLPanelMarketplaceInbox : public LLPanel, public LLSideTrayTabBadgeDriver +class LLPanelMarketplaceInbox : public LLPanel { public: @@ -61,7 +60,6 @@ public: std::string getBadgeString() const; private: - void handleLoginComplete(); void onSelectionChange(); diff --git a/indra/newview/llpanelmarketplaceoutbox.cpp b/indra/newview/llpanelmarketplaceoutbox.cpp index c0de5deb0a..d4f9654e6e 100644 --- a/indra/newview/llpanelmarketplaceoutbox.cpp +++ b/indra/newview/llpanelmarketplaceoutbox.cpp @@ -40,7 +40,6 @@ #include "llpanelmarketplaceinbox.h" #include "llsdutil.h" #include "llsidepanelinventory.h" -#include "llsidetray.h" #include "lltimer.h" #include "llviewernetwork.h" #include "llagent.h" diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index 4d86fa15df..0b687009bf 100644 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -72,20 +72,6 @@ BOOL LLPanelMe::postBuild() void LLPanelMe::onOpen(const LLSD& key) { LLPanelProfile::onOpen(key); - - // Removed this action as per SOCIAL-431 The first time a new resident opens the profile tab - // in the sidebar, they see the old profile editing panel - // - //// Force Edit My Profile if this is the first time when user is opening Me Panel (EXT-5068) - //bool opened = gSavedSettings.getBOOL("MePanelOpened"); - //// In some cases Side Tray my call onOpen() twice, check getCollapsed() to be sure this - //// is the last time onOpen() is called - //if( !opened && !LLSideTray::getInstance()->getCollapsed() ) - //{ - // buildEditPanel(); - // openPanel(mEditPanel, getAvatarId()); - // gSavedSettings.setBOOL("MePanelOpened", true); - //} } void LLPanelMe::buildEditPanel() diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 44364b5831..98ea680504 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -57,7 +57,6 @@ #include "llpreviewtexture.h" #include "llscrollcontainer.h" #include "llselectmgr.h" -#include "llsidetray.h" #include "llstatusbar.h" #include "lltooldraganddrop.h" #include "lltrans.h" diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 3ac0d6616b..f90236f6f2 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -41,7 +41,6 @@ #include "llpanelwearing.h" #include "llsaveoutfitcombobtn.h" #include "llsidepanelappearance.h" -#include "llsidetray.h" #include "llviewerfoldertype.h" static const std::string OUTFITS_TAB_NAME = "outfitslist_tab"; diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 86e481d953..80c431f481 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -57,7 +57,6 @@ #include "llinventoryobserver.h" #include "llnetmap.h" #include "llpanelpeoplemenus.h" -#include "llsidetray.h" #include "llsidetraypanelcontainer.h" #include "llrecentpeople.h" #include "llviewercontrol.h" // for gSavedSettings @@ -1452,7 +1451,7 @@ bool LLPanelPeople::notifyChildren(const LLSD& info) container->onOpen(LLSD().with(LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME, getName())); } else - LLSideTray::getInstance()->collapseSideBar(); + LLFloaterReg::hideFloaterInstance("people"); return true; // this notification is only supposed to be handled by task panels } diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 0129ac753a..7f8f9b29af 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -65,7 +65,6 @@ #include "llpanelplaceprofile.h" #include "llpanelteleporthistory.h" #include "llremoteparcelrequest.h" -#include "llsidetray.h" #include "llteleporthistorystorage.h" #include "lltoggleablemenu.h" #include "llviewerinventory.h" diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index 52dd70f005..79171dbcb9 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -31,7 +31,6 @@ #include "llfloaterworldmap.h" #include "llpanelteleporthistory.h" -#include "llsidetray.h" #include "llworldmap.h" #include "llteleporthistorystorage.h" #include "lltextutil.h" diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp index b6e32dba78..5ed23d2f42 100644 --- a/indra/newview/llpaneltopinfobar.cpp +++ b/indra/newview/llpaneltopinfobar.cpp @@ -36,7 +36,6 @@ #include "lllocationinputctrl.h" #include "llnotificationsutil.h" #include "llparcel.h" -#include "llsidetray.h" #include "llslurl.h" #include "llstatusbar.h" #include "lltrans.h" diff --git a/indra/newview/llpaneltopinfobar.h b/indra/newview/llpaneltopinfobar.h index 583e91d15e..e934b522be 100644 --- a/indra/newview/llpaneltopinfobar.h +++ b/indra/newview/llpaneltopinfobar.h @@ -148,7 +148,7 @@ private: void setParcelInfoText(const std::string& new_text); /** - * Implementation of LLDestroyClass + * Implementation of LLDestroyClass */ static void destroyClass() { diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index 87e9bb7b28..e2801c09bd 100644 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -36,7 +36,6 @@ #include "llinventorymodel.h" #include "llinventoryobserver.h" #include "llmenubutton.h" -#include "llsidetray.h" #include "llviewermenu.h" #include "llwearableitemslist.h" #include "llsdserialize.h" diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index e3bc67a414..a3b0574bca 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -41,7 +41,6 @@ #include "llsyswellwindow.h" #include "llimfloater.h" #include "llscriptfloater.h" -#include "llsidetray.h" #include @@ -83,25 +82,8 @@ bool LLScreenChannelBase::isHovering() return mHoveredToast->isHovered(); } -void LLScreenChannelBase::resetPositionAndSize() -{ - LLRect rc = gViewerWindow->getWorldViewRectScaled(); - updatePositionAndSize(rc, rc); -} - void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect) { - /* - take sidetray into account - screenchannel should not overlap sidetray - */ - S32 world_rect_padding = 0; - if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE - && LLSideTray::instanceCreated ()) - { - world_rect_padding += LLSideTray::getInstance()->getVisibleWidth(); - } - - S32 top_delta = old_world_rect.mTop - new_world_rect.mTop; LLRect this_rect = getRect(); @@ -111,10 +93,10 @@ void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect ne case CA_LEFT : break; case CA_CENTRE : - this_rect.setCenterAndSize( (new_world_rect.getWidth() - world_rect_padding) / 2, new_world_rect.getHeight() / 2, this_rect.getWidth(), this_rect.getHeight()); + this_rect.setCenterAndSize( (new_world_rect.getWidth()) / 2, new_world_rect.getHeight() / 2, this_rect.getWidth(), this_rect.getHeight()); break; case CA_RIGHT : - this_rect.setLeftTopAndSize(new_world_rect.mRight - world_rect_padding - this_rect.getWidth(), + this_rect.setLeftTopAndSize(new_world_rect.mRight - this_rect.getWidth(), this_rect.mTop, this_rect.getWidth(), this_rect.getHeight()); @@ -126,12 +108,6 @@ void LLScreenChannelBase::updatePositionAndSize(LLRect old_world_rect, LLRect ne void LLScreenChannelBase::init(S32 channel_left, S32 channel_right) { - if(LLSideTray::instanceCreated()) - { - LLSideTray* side_bar = LLSideTray::getInstance(); - side_bar->setVisibleWidthChangeCallback(boost::bind(&LLScreenChannelBase::resetPositionAndSize, this)); - } - // top and bottom set by updateBottom() setRect(LLRect(channel_left, 0, channel_right, 0)); updateBottom(); @@ -203,17 +179,6 @@ std::list LLScreenChannel::findToasts(const Matcher& matcher) //-------------------------------------------------------------------------- void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect) { - /* - take sidetray into account - screenchannel should not overlap sidetray - */ - S32 world_rect_padding = 0; - if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE - && LLSideTray::instanceCreated ()) - { - world_rect_padding += LLSideTray::getInstance()->getVisibleWidth(); - } - - LLRect this_rect = getRect(); switch(mChannelAlignment) @@ -226,7 +191,7 @@ void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_wo return; case CA_RIGHT : this_rect.mTop = (S32) (new_world_rect.getHeight() * getHeightRatio()); - this_rect.setLeftTopAndSize(new_world_rect.mRight - world_rect_padding - this_rect.getWidth(), + this_rect.setLeftTopAndSize(new_world_rect.mRight - this_rect.getWidth(), this_rect.mTop, this_rect.getWidth(), this_rect.getHeight()); diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index d207d13981..8f11c82673 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -59,7 +59,6 @@ public: // Channel's outfit-functions // update channel's size and position in the World View virtual void updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect); - void resetPositionAndSize(); // initialization of channel's shape and position virtual void init(S32 channel_left, S32 channel_right); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index a356013830..853656905c 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -42,7 +42,6 @@ #include "lloutfitobserver.h" #include "llpaneleditwearable.h" #include "llpaneloutfitsinventory.h" -#include "llsidetray.h" #include "lltextbox.h" #include "lluictrlfactory.h" #include "llviewercontrol.h" @@ -164,7 +163,6 @@ void LLSidepanelAppearance::onOpen(const LLSD& key) else { // Switch to the requested panel. - // *TODO: replace this crap with LLSideTrayPanelContainer std::string type = key["type"].asString(); if (type == "my_outfits") { diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 0226896f54..f9dc70ccc0 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -282,19 +282,20 @@ BOOL LLSidepanelInventory::postBuild() enableOutbox(gSavedSettings.getBOOL("InventoryDisplayOutbox")); // Trigger callback for after login so we can setup to track inbox and outbox changes after initial inventory load - LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::handleLoginComplete, this)); + LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::updateInboxOutbox, this)); } gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged)); gSavedSettings.getControl("InventoryDisplayOutbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayOutboxChanged)); + updateInboxOutbox(); // Update the verbs buttons state. updateVerbs(); return TRUE; } -void LLSidepanelInventory::handleLoginComplete() +void LLSidepanelInventory::updateInboxOutbox() { // // Track inbox and outbox folder changes diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index b7d11f7f9b..4e34926a4b 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -47,7 +47,7 @@ public: virtual ~LLSidepanelInventory(); private: - void handleLoginComplete(); + void updateInboxOutbox(); public: void observeInboxOutboxCreation(); diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp deleted file mode 100644 index 55d6378ad8..0000000000 --- a/indra/newview/llsidetray.cpp +++ /dev/null @@ -1,1489 +0,0 @@ -/** - * @file llsidetray.cpp - * @brief SideBar implementation - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "lltextbox.h" - -#include "llagentcamera.h" -#include "llappviewer.h" -#include "llbadge.h" -#include "llbottomtray.h" -#include "llfloaterreg.h" -#include "llfirstuse.h" -#include "llhints.h" -#include "llsidetray.h" -#include "llviewerwindow.h" -#include "llaccordionctrl.h" -#include "llfocusmgr.h" -#include "llrootview.h" -#include "llnavigationbar.h" -#include "llpanelmarketplaceinbox.h" - -#include "llaccordionctrltab.h" - -#include "llfloater.h" //for gFloaterView -#include "lliconctrl.h"//for OpenClose tab icon -#include "llsidetraypanelcontainer.h" -#include "llscreenchannel.h" -#include "llchannelmanager.h" -#include "llwindow.h"//for SetCursor -#include "lltransientfloatermgr.h" - -#include "llsidepanelappearance.h" - -#include "llsidetraylistener.h" - -//#include "llscrollcontainer.h" - -using namespace std; -using namespace LLNotificationsUI; - -class LLSideTrayButton; - -static LLRootViewRegistry::Register t1("side_tray"); -static LLDefaultChildRegistry::Register t2("sidetray_tab"); - -static const S32 BOTTOM_BAR_PAD = 5; - -static const std::string COLLAPSED_NAME = "<<"; -static const std::string EXPANDED_NAME = ">>"; - -static const std::string TAB_PANEL_CAPTION_NAME = "sidetray_tab_panel"; -static const std::string TAB_PANEL_CAPTION_TITLE_BOX = "sidetray_tab_title"; - -LLSideTray* LLSideTray::sInstance = 0; - -static LLSideTrayListener sSideTrayListener(LLSideTray::getInstance); - -// static -LLSideTray* LLSideTray::getInstance() -{ - if (!sInstance) - { - sInstance = LLUICtrlFactory::createFromFile("panel_side_tray.xml",NULL, LLRootView::child_registry_t::instance()); - sInstance->setXMLFilename("panel_side_tray.xml"); - } - - return sInstance; -} - -// static -bool LLSideTray::instanceCreated () -{ - return sInstance!=0; -} - -////////////////////////////////////////////////////////////////////////////// -// LLSideTrayTab -// Represents a single tab in the side tray, only used by LLSideTray -////////////////////////////////////////////////////////////////////////////// - -class LLSideTrayTab: public LLPanel -{ - LOG_CLASS(LLSideTrayTab); - friend class LLUICtrlFactory; - friend class LLSideTray; -public: - - struct Params - : public LLInitParam::Block - { - // image name - Optional image; - Optional image_selected; - Optional tab_title; - Optional description; - Optional badge; - - Params() - : image("image"), - image_selected("image_selected"), - tab_title("tab_title","no title"), - description("description","no description"), - badge("badge") - {}; - }; -protected: - LLSideTrayTab(const Params& params); - - void dock(LLFloater* floater_tab); - void undock(LLFloater* floater_tab); - - LLSideTray* getSideTray(); - -public: - virtual ~LLSideTrayTab(); - - /*virtual*/ BOOL postBuild (); - /*virtual*/ bool addChild (LLView* view, S32 tab_group); - - - void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE); - - static LLSideTrayTab* createInstance (); - - const std::string& getDescription () const { return mDescription;} - - void onOpen (const LLSD& key); - - void toggleTabDocked(bool toggle_floater = true); - void setDocked(bool dock); - bool isDocked() const; - - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - - LLPanel* getPanel(); - - LLButton* createButton(bool allowTearOff, LLUICtrl::commit_callback_t callback); - -private: - std::string mTabTitle; - std::string mImage; - std::string mImageSelected; - std::string mDescription; - - LLView* mMainPanel; - - 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), - mImage(p.image), - mImageSelected(p.image_selected), - mDescription(p.description), - mMainPanel(NULL), - mBadgeParams(p.badge), - mSideTrayButton(NULL) -{ - mHasBadge = p.badge.isProvided(); -} - -LLSideTrayTab::~LLSideTrayTab() -{ -} - -bool LLSideTrayTab::addChild(LLView* view, S32 tab_group) -{ - if(mMainPanel == 0 && TAB_PANEL_CAPTION_NAME != view->getName())//skip our caption panel - mMainPanel = view; - return LLPanel::addChild(view,tab_group); - //return res; -} - -//virtual -BOOL LLSideTrayTab::postBuild() -{ - LLPanel* title_panel = LLUICtrlFactory::getInstance()->createFromFile("panel_side_tray_tab_caption.xml",this, child_registry_t::instance()); - string name = title_panel->getName(); - LLPanel::addChild(title_panel); - - title_panel->getChild(TAB_PANEL_CAPTION_TITLE_BOX)->setValue(mTabTitle); - - getChild("undock")->setCommitCallback(boost::bind(&LLSideTrayTab::setDocked, this, false)); - getChild("dock")->setCommitCallback(boost::bind(&LLSideTrayTab::setDocked, this, true)); - - return LLPanel::postBuild(); -} - -static const S32 splitter_margin = 1; - -void LLSideTrayTab::reshape (S32 width, S32 height, BOOL called_from_parent ) -{ - LLPanel::reshape(width, height, called_from_parent); - LLView* title_panel = findChildView(TAB_PANEL_CAPTION_NAME, true); - if (!title_panel) - { - // not fully constructed yet - return; - } - - S32 title_height = title_panel->getRect().getHeight(); - title_panel->setOrigin( 0, height - title_height ); - title_panel->reshape(width,title_height); - - LLRect sRect; - sRect.setLeftTopAndSize( splitter_margin, height - title_height - splitter_margin, - width - 2*splitter_margin, height - title_height - 2*splitter_margin); - mMainPanel->setShape(sRect); -} - -void LLSideTrayTab::onOpen (const LLSD& key) -{ - LLPanel *panel = getPanel(); - if(panel) - panel->onOpen(key); -} - -// Attempts to get the existing side tray instance. -// Needed to avoid recursive calls of LLSideTray::getInstance(). -LLSideTray* LLSideTrayTab::getSideTray() -{ - // First, check if the side tray is our parent (i.e. we're attached). - LLSideTray* side_tray = dynamic_cast(getParent()); - if (!side_tray) - { - // Detached? Ok, check if the instance exists at all/ - if (LLSideTray::instanceCreated()) - { - side_tray = LLSideTray::getInstance(); - } - else - { - llerrs << "No safe way to get the side tray instance" << llendl; - } - } - - return side_tray; -} - -void LLSideTrayTab::toggleTabDocked(bool toggle_floater /* = true */) -{ - // *FIX: Calling this method twice per frame would crash the viewer. - - std::string tab_name = getName(); - - LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name); - if (!floater_tab) return; - - 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); - getChild("dock")->setVisible(!docking); - - if (docking) - { - dock(floater_tab); - } - else - { - undock(floater_tab); - } - - // Open/close the floater *after* we reparent the tab panel, - // so that it doesn't receive redundant visibility change notifications. - if (toggle_floater) - { - LLFloaterReg::toggleInstance("side_bar_tab", tab_name); - } -} - -// Same as toggleTabDocked() apart from making sure that we do exactly what we want. -void LLSideTrayTab::setDocked(bool dock) -{ - if (isDocked() == dock) - { - llwarns << "Tab " << getName() << " is already " << (dock ? "docked" : "undocked") << llendl; - return; - } - - toggleTabDocked(); -} - -bool LLSideTrayTab::isDocked() const -{ - return dynamic_cast(getParent()) != NULL; -} - -BOOL LLSideTrayTab::handleScrollWheel(S32 x, S32 y, S32 clicks) -{ - // Let children handle the event - LLUICtrl::handleScrollWheel(x, y, clicks); - - // and then eat it to prevent in-world scrolling (STORM-351). - return TRUE; -} - -void LLSideTrayTab::dock(LLFloater* floater_tab) -{ - LLSideTray* side_tray = getSideTray(); - if (!side_tray) return; - - // Before docking the tab, reset its (and its children's) transparency to default (STORM-688). - floater_tab->updateTransparency(TT_DEFAULT); - - if (!side_tray->addTab(this)) - { - llwarns << "Failed to add tab " << getName() << " to side tray" << llendl; - return; - } - - setRect(side_tray->getLocalRect()); - reshape(getRect().getWidth(), getRect().getHeight()); - - // Select the re-docked tab. - side_tray->selectTabByName(getName()); - - if (side_tray->getCollapsed()) - { - side_tray->expandSideBar(false); - } -} - -static void on_minimize(LLSidepanelAppearance* panel, LLSD minimized) -{ - if (!panel) return; - bool visible = !minimized.asBoolean(); - LLSD visibility; - visibility["visible"] = visible; - // Do not reset accordion state on minimize (STORM-375) - visibility["reset_accordion"] = false; - panel->updateToVisibility(visibility); -} - -void LLSideTrayTab::undock(LLFloater* floater_tab) -{ - LLSideTray* side_tray = getSideTray(); - if (!side_tray) return; - - // Remember whether the tab have been active before detaching - // because removeTab() will change active tab. - bool was_active = side_tray->getActiveTab() == this; - - // Remove the tab from Side Tray's tabs list. - // We have to do it despite removing the tab from Side Tray's child view tree - // by addChild(). Otherwise the tab could be accessed by the pointer in LLSideTray::mTabs. - if (!side_tray->removeTab(this)) - { - llwarns << "Failed to remove tab " << getName() << " from side tray" << llendl; - return; - } - - // If we're undocking while side tray is collapsed we need to explicitly show the panel. - if (!getVisible()) - { - setVisible(true); - } - - floater_tab->addChild(this); - floater_tab->setTitle(mTabTitle); - floater_tab->setName(getName()); - - // Resize handles get obscured by added panel so move them to front. - floater_tab->moveResizeHandlesToFront(); - - // Reshape the floater if needed. - LLRect floater_rect; - if (floater_tab->hasSavedRect()) - { - // We've got saved rect for the floater, hence no need to reshape it. - floater_rect = floater_tab->getLocalRect(); - } - else - { - // Detaching for the first time. Reshape the floater. - floater_rect = side_tray->getLocalRect(); - - // Reduce detached floater height by small BOTTOM_BAR_PAD not to make it flush with the bottom bar. - floater_rect.mBottom += LLBottomTray::getInstance()->getRect().getHeight() + BOTTOM_BAR_PAD; - floater_rect.makeValid(); - floater_tab->reshape(floater_rect.getWidth(), floater_rect.getHeight()); - } - - // Reshape the panel. - { - LLRect panel_rect = floater_tab->getLocalRect(); - panel_rect.mTop -= floater_tab->getHeaderHeight(); - panel_rect.makeValid(); - setRect(panel_rect); - reshape(panel_rect.getWidth(), panel_rect.getHeight()); - } - - // Set FOLLOWS_ALL flag for the tab to follow floater dimensions upon resizing. - setFollowsAll(); - - // Camera view may need to be changed for appearance panel(STORM-301) on minimize of floater, - // so setting callback here. - if (getName() == "sidebar_appearance") - { - LLSidepanelAppearance* panel_appearance = dynamic_cast(getPanel()); - if(panel_appearance) - { - floater_tab->setMinimizeCallback(boost::bind(&on_minimize, panel_appearance, _2)); - } - } - - if (!side_tray->getCollapsed()) - { - side_tray->collapseSideBar(); - } - - if (!was_active) - { - // When a tab other then current active tab is detached from Side Tray - // onOpen() should be called as tab visibility is changed. - onOpen(LLSD()); - } -} - -LLPanel* LLSideTrayTab::getPanel() -{ - LLPanel* panel = dynamic_cast(mMainPanel); - return panel; -} - -LLSideTrayTab* LLSideTrayTab::createInstance () -{ - LLSideTrayTab::Params tab_params; - tab_params.tab_title("openclose"); - - LLSideTrayTab* tab = LLUICtrlFactory::create(tab_params); - return tab; -} - -// Now that we know the definition of LLSideTrayTab, we can implement -// tab_cast. -template <> -LLPanel* tab_cast(LLSideTrayTab* tab) { return tab; } - -////////////////////////////////////////////////////////////////////////////// -// LLSideTray -////////////////////////////////////////////////////////////////////////////// - -LLSideTray::Params::Params() -: collapsed("collapsed",false), - tab_btn_image_normal("tab_btn_image",LLUI::getUIImage("taskpanel/TaskPanel_Tab_Off.png")), - tab_btn_image_selected("tab_btn_image_selected",LLUI::getUIImage("taskpanel/TaskPanel_Tab_Selected.png")), - default_button_width("tab_btn_width",32), - default_button_height("tab_btn_height",32), - default_button_margin("tab_btn_margin",0) -{} - -//virtual -LLSideTray::LLSideTray(const Params& params) - : LLPanel(params) - ,mActiveTab(0) - ,mCollapsed(false) - ,mCollapseButton(0) -{ - mCollapsed=params.collapsed; - - LLUICtrl::CommitCallbackRegistry::Registrar& commit = LLUICtrl::CommitCallbackRegistry::currentRegistrar(); - - // register handler function to process data from the xml. - // panel_name should be specified via "parameter" attribute. - commit.add("SideTray.ShowPanel", boost::bind(&LLSideTray::showPanel, this, _2, LLUUID::null)); - commit.add("SideTray.Toggle", boost::bind(&LLSideTray::onToggleCollapse, this)); - commit.add("SideTray.Collapse", boost::bind(&LLSideTray::collapseSideBar, this)); - LLTransientFloaterMgr::getInstance()->addControlView(this); - LLView* side_bar_tabs = gViewerWindow->getRootView()->getChildView("side_bar_tabs"); - if (side_bar_tabs != NULL) - { - LLTransientFloaterMgr::getInstance()->addControlView(side_bar_tabs); - } - - LLPanel::Params p; - p.name = "buttons_panel"; - p.mouse_opaque = false; - mButtonsPanel = LLUICtrlFactory::create(p); -} - - -BOOL LLSideTray::postBuild() -{ - createButtons(); - - arrange(); - selectTabByName("sidebar_home"); - - if(mCollapsed) - collapseSideBar(); - - setMouseOpaque(false); - - LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSideTray::handleLoginComplete, this)); - - // Remember original tabs order, so that we can restore it if user detaches and then re-attaches a tab. - for (child_vector_const_iter_t it = mTabs.begin(); it != mTabs.end(); ++it) - { - std::string tab_name = (*it)->getName(); - mOriginalTabOrder.push_back(tab_name); - } - - //EXT-8045 - //connect all already created channels to reflect sidetray collapse/expand - std::vector& channels = LLChannelManager::getInstance()->getChannelList(); - for(std::vector::iterator it = channels.begin();it!=channels.end();++it) - { - if ((*it).channel) - { - setVisibleWidthChangeCallback(boost::bind(&LLScreenChannelBase::resetPositionAndSize, (*it).channel)); - } - } - - return true; -} - -void LLSideTray::setTabButtonBadgeDriver(std::string tabName, LLSideTrayTabBadgeDriver* driver) -{ - mTabButtonBadgeDrivers[tabName] = driver; -} - -void LLSideTray::handleLoginComplete() -{ - //reset tab to "home" tab if it was changesd during login process - selectTabByName("sidebar_home"); - - for (badge_map_t::iterator it = mTabButtonBadgeDrivers.begin(); it != mTabButtonBadgeDrivers.end(); ++it) - { - LLButton* button = mTabButtons[it->first]; - LLSideTrayButton* side_button = dynamic_cast(button); - - if (side_button) - { - side_button->setBadgeDriver(it->second); - } - else - { - llwarns << "Unable to find button " << it->first << " to set the badge driver. " << llendl; - } - } - - detachTabs(); -} - -LLSideTrayTab* LLSideTray::getTab(const std::string& name) -{ - return findChild(name,false); -} - -bool LLSideTray::isTabAttached(const std::string& name) -{ - LLSideTrayTab* tab = getTab(name); - llassert(tab); - if (!tab) return false; - - return std::find(mTabs.begin(), mTabs.end(), tab) != mTabs.end(); -} - -bool LLSideTray::hasTabs() -{ - // The open/close tab doesn't count. - return mTabs.size() > 1; -} - -void LLSideTray::toggleTabButton(LLSideTrayTab* tab) -{ - if(tab == NULL) - return; - std::string name = tab->getName(); - std::map::iterator it = mTabButtons.find(name); - if(it != mTabButtons.end()) - { - LLButton* btn = it->second; - bool new_state = !btn->getToggleState(); - btn->setToggleState(new_state); - // Only highlight the tab if side tray is expanded (STORM-157). - btn->setImageOverlay( new_state && !getCollapsed() ? tab->mImageSelected : tab->mImage ); - } -} - -LLPanel* LLSideTray::openChildPanel(LLSideTrayTab* tab, const std::string& panel_name, const LLSD& params) -{ - LLView* view = tab->findChildView(panel_name, true); - if (!view) return NULL; - - std::string tab_name = tab->getName(); - - bool tab_attached = isTabAttached(tab_name); - - if (tab_attached && LLUI::sSettingGroups["config"]->getBOOL("OpenSidePanelsInFloaters")) - { - tab->setDocked(false); - tab_attached = false; - } - - // Select tab and expand Side Tray only when a tab is attached. - if (tab_attached) - { - selectTabByName(tab_name); - if (mCollapsed) - expandSideBar(); - } - else - { - LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name); - if (!floater_tab) return NULL; - - floater_tab->openFloater(tab_name); - } - - LLSideTrayPanelContainer* container = dynamic_cast(view->getParent()); - if (container) - { - LLSD new_params = params; - new_params[LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME] = panel_name; - container->onOpen(new_params); - - return container->getCurrentPanel(); - } - - LLPanel* panel = dynamic_cast(view); - if (panel) - { - panel->onOpen(params); - } - - return panel; -} - -bool LLSideTray::selectTabByIndex(size_t index) -{ - if(index>=mTabs.size()) - return false; - - LLSideTrayTab* sidebar_tab = mTabs[index]; - return selectTabByName(sidebar_tab->getName()); -} - -bool LLSideTray::selectTabByName(const std::string& name, bool keep_prev_visible) -{ - LLSideTrayTab* tab_to_keep_visible = NULL; - LLSideTrayTab* new_tab = getTab(name); - if (!new_tab) return false; - - // Bail out if already selected. - if (new_tab == mActiveTab) - return false; - - //deselect old tab - if (mActiveTab) - { - // Keep previously active tab visible if requested. - if (keep_prev_visible) tab_to_keep_visible = mActiveTab; - toggleTabButton(mActiveTab); - } - - //select new tab - mActiveTab = new_tab; - - if (mActiveTab) - { - toggleTabButton(mActiveTab); - LLSD key;//empty - mActiveTab->onOpen(key); - } - - //arrange(); - - //hide all tabs - show active tab - child_vector_const_iter_t child_it; - for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) - { - LLSideTrayTab* sidebar_tab = *child_it; - - bool vis = sidebar_tab == mActiveTab; - - // Force keeping the tab visible if requested. - vis |= sidebar_tab == tab_to_keep_visible; - - // When the last tab gets detached, for a short moment the "Toggle Sidebar" pseudo-tab - // is shown. So, to avoid the flicker we make sure it never gets visible. - vis &= (*child_it)->getName() != "sidebar_openclose"; - - sidebar_tab->setVisible(vis); - } - return true; -} - -bool LLSideTray::addChild(LLView* view, S32 tab_group) -{ - LLSideTrayTab* tab_panel = dynamic_cast(view); - - if (tab_panel) - { - mTabs.push_back(tab_panel); - } - - return LLUICtrl::addChild(view, tab_group); -} - -bool LLSideTray::removeTab(LLSideTrayTab* tab) -{ - if (!tab) return false; - std::string tab_name = tab->getName(); - - // Look up the tab in the list of known tabs. - child_vector_iter_t tab_it = std::find(mTabs.begin(), mTabs.end(), tab); - if (tab_it == mTabs.end()) - { - llwarns << "Cannot find tab named " << tab_name << llendl; - return false; - } - - // Find the button corresponding to the tab. - button_map_t::iterator btn_it = mTabButtons.find(tab_name); - if (btn_it == mTabButtons.end()) - { - llwarns << "Cannot find button for tab named " << tab_name << llendl; - return false; - } - LLButton* btn = btn_it->second; - - // Deselect the tab. - if (mActiveTab == tab) - { - // Select the next tab (or first one, if we're removing the last tab), - // skipping the fake open/close tab (STORM-155). - child_vector_iter_t next_tab_it = tab_it; - do - { - next_tab_it = (next_tab_it < (mTabs.end() - 1)) ? next_tab_it + 1 : mTabs.begin(); - } - while ((*next_tab_it)->getName() == "sidebar_openclose"); - - selectTabByName((*next_tab_it)->getName(), true); // Don't hide the tab being removed. - } - - // Remove the tab. - removeChild(tab); - mTabs.erase(tab_it); - - // Add the tab to detached tabs list. - mDetachedTabs.push_back(tab); - - // Remove the button from the buttons panel so that it isn't drawn anymore. - mButtonsPanel->removeChild(btn); - - // Re-arrange remaining tabs. - arrange(); - - return true; -} - -bool LLSideTray::addTab(LLSideTrayTab* tab) -{ - if (tab == NULL) return false; - - std::string tab_name = tab->getName(); - - // Make sure the tab isn't already in the list. - if (std::find(mTabs.begin(), mTabs.end(), tab) != mTabs.end()) - { - llwarns << "Attempt to re-add existing tab " << tab_name << llendl; - return false; - } - - // Look up the corresponding button. - button_map_t::const_iterator btn_it = mTabButtons.find(tab_name); - if (btn_it == mTabButtons.end()) - { - llwarns << "Tab " << tab_name << " has no associated button" << llendl; - return false; - } - LLButton* btn = btn_it->second; - - // Insert the tab at its original position. - LLUICtrl::addChild(tab); - { - tab_order_vector_const_iter_t new_tab_orig_pos = - std::find(mOriginalTabOrder.begin(), mOriginalTabOrder.end(), tab_name); - llassert(new_tab_orig_pos != mOriginalTabOrder.end()); - child_vector_iter_t insert_pos = mTabs.end(); - - for (child_vector_iter_t tab_it = mTabs.begin(); tab_it != mTabs.end(); ++tab_it) - { - tab_order_vector_const_iter_t cur_tab_orig_pos = - std::find(mOriginalTabOrder.begin(), mOriginalTabOrder.end(), (*tab_it)->getName()); - llassert(cur_tab_orig_pos != mOriginalTabOrder.end()); - - if (new_tab_orig_pos < cur_tab_orig_pos) - { - insert_pos = tab_it; - break; - } - } - - mTabs.insert(insert_pos, tab); - } - - // Add the button to the buttons panel so that it's drawn again. - mButtonsPanel->addChildInBack(btn); - - // Arrange tabs after inserting a new one. - arrange(); - - // Remove the tab from the list of detached tabs. - child_vector_iter_t tab_it = std::find(mDetachedTabs.begin(), mDetachedTabs.end(), tab); - if (tab_it != mDetachedTabs.end()) - { - mDetachedTabs.erase(tab_it); - } - - return true; -} - -LLButton* LLSideTrayTab::createButton(bool allowTearOff, LLUICtrl::commit_callback_t callback) -{ - static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams()); - - LLRect rect; - rect.setOriginAndSize(0, 0, sidetray_params.default_button_width, sidetray_params.default_button_height); - - LLButton::Params bparams; - - // Append "_button" to the side tray tab name - std::string button_name = getName() + "_button"; - bparams.name(button_name); - bparams.follows.flags (FOLLOWS_LEFT | FOLLOWS_TOP); - bparams.rect (rect); - bparams.tab_stop(false); - bparams.image_unselected(sidetray_params.tab_btn_image_normal); - bparams.image_selected(sidetray_params.tab_btn_image_selected); - bparams.image_disabled(sidetray_params.tab_btn_image_normal); - bparams.image_disabled_selected(sidetray_params.tab_btn_image_selected); - - if (mHasBadge) - { - bparams.badge = mBadgeParams; - } - - LLButton* button; - if (allowTearOff) - { - mSideTrayButton = LLUICtrlFactory::create(bparams); - - button = mSideTrayButton; - } - else - { - // "Open/Close" button shouldn't allow "tear off" - // hence it is created as LLButton instance. - button = LLUICtrlFactory::create(bparams); - } - - button->setClickedCallback(callback); - - button->setToolTip(mTabTitle); - - if(mImage.length()) - { - button->setImageOverlay(mImage); - } - - return button; -} - -void LLSideTray::createButtons() -{ - //create buttons for tabs - child_vector_const_iter_t child_it = mTabs.begin(); - for ( ; child_it != mTabs.end(); ++child_it) - { - LLSideTrayTab* sidebar_tab = *child_it; - - std::string name = sidebar_tab->getName(); - - // The "OpenClose" button will open/close the whole panel - if (name == "sidebar_openclose") - { - mCollapseButton = sidebar_tab->createButton(false, boost::bind(&LLSideTray::onToggleCollapse, this)); - - mButtonsPanel->addChildInBack(mCollapseButton); - - LLHints::registerHintTarget("side_panel_btn", mCollapseButton->getHandle()); - } - else - { - LLButton* button = sidebar_tab->createButton(true, boost::bind(&LLSideTray::onTabButtonClick, this, name)); - - mButtonsPanel->addChildInBack(button); - - mTabButtons[name] = button; - } - } - - LLHints::registerHintTarget("inventory_btn", mTabButtons["sidebar_inventory"]->getHandle()); -} - -void LLSideTray::processTriState () -{ - if(mCollapsed) - expandSideBar(); - else - { -#if 0 // *TODO: EXT-2092 - - // Tell the active task panel to switch to its default view - // or collapse side tray if already on the default view. - LLSD info; - info["task-panel-action"] = "handle-tri-state"; - mActiveTab->notifyChildren(info); -#else - collapseSideBar(); -#endif - } -} - -void LLSideTray::onTabButtonClick(string name) -{ - LLSideTrayTab* tab = getTab(name); - if (!tab) return; - - if(tab == mActiveTab) - { - processTriState (); - return; - } - selectTabByName (name); - if(mCollapsed) - expandSideBar(); -} - -void LLSideTray::onToggleCollapse() -{ - LLFirstUse::notUsingSidePanel(false); - if(mCollapsed) - { - expandSideBar(); - //selectTabByName("sidebar_openclose"); - } - else - collapseSideBar(); -} - - -void LLSideTray::reflectCollapseChange() -{ - updateSidetrayVisibility(); - - setFocus(!mCollapsed); - - gFloaterView->refresh(); -} - -void LLSideTray::arrange() -{ - static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams()); - - updateSidetrayVisibility(); - - LLRect ctrl_rect; - ctrl_rect.setLeftTopAndSize(0, - mButtonsPanel->getRect().getHeight() - sidetray_params.default_button_width, - sidetray_params.default_button_width, - sidetray_params.default_button_height); - - mCollapseButton->setRect(ctrl_rect); - - //arrange tab buttons - //arrange tab buttons - child_vector_const_iter_t child_it; - int offset = (sidetray_params.default_button_height+sidetray_params.default_button_margin)*2; - for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) - { - LLSideTrayTab* sidebar_tab = *child_it; - - ctrl_rect.setLeftTopAndSize(0, - mButtonsPanel->getRect().getHeight()-offset, - sidetray_params.default_button_width, - sidetray_params.default_button_height); - - if(mTabButtons.find(sidebar_tab->getName()) == mTabButtons.end()) - continue; - - LLButton* btn = mTabButtons[sidebar_tab->getName()]; - - btn->setRect(ctrl_rect); - offset+=sidetray_params.default_button_height; - offset+=sidetray_params.default_button_margin; - - btn->setVisible(ctrl_rect.mBottom > 0); - } - - //arrange tabs - for ( child_vector_t::iterator child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) - { - LLSideTrayTab* sidebar_tab = *child_it; - sidebar_tab->setShape(getLocalRect()); - } - - // The tab buttons should be shown only if there is at least one non-detached tab. - // Also hide them in mouse-look mode. - mButtonsPanel->setVisible(hasTabs() && !gAgentCamera.cameraMouselook()); -} - -// Detach those tabs that were detached when the viewer exited last time. -void LLSideTray::detachTabs() -{ - // copy mTabs because LLSideTray::toggleTabDocked() modifies it. - child_vector_t tabs = mTabs; - - for (child_vector_const_iter_t it = tabs.begin(); it != tabs.end(); ++it) - { - LLSideTrayTab* tab = *it; - - std::string floater_ctrl_name = LLFloater::getControlName("side_bar_tab", LLSD(tab->getName())); - std::string vis_ctrl_name = LLFloaterReg::getVisibilityControlName(floater_ctrl_name); - if (!LLFloater::getControlGroup()->controlExists(vis_ctrl_name)) continue; - - bool is_visible = LLFloater::getControlGroup()->getBOOL(vis_ctrl_name); - if (!is_visible) continue; - - llassert(isTabAttached(tab->getName())); - tab->setDocked(false); - } -} - -void LLSideTray::collapseSideBar() -{ - mCollapsed = true; - // Reset all overlay images, because there is no "selected" tab when the - // whole side tray is hidden. - child_vector_const_iter_t it = mTabs.begin(); - for ( ; it != mTabs.end(); ++it ) - { - LLSideTrayTab* tab = *it; - std::string name = tab->getName(); - std::map::const_iterator btn_it = - mTabButtons.find(name); - if (btn_it != mTabButtons.end()) - { - LLButton* btn = btn_it->second; - btn->setImageOverlay( tab->mImage ); - } - } - - // OpenClose tab doesn't put its button in mTabButtons - LLSideTrayTab* openclose_tab = getTab("sidebar_openclose"); - if (openclose_tab) - { - mCollapseButton->setImageOverlay( openclose_tab->mImage ); - } - //mActiveTab->setVisible(FALSE); - reflectCollapseChange(); - setFocus( FALSE ); -} - -void LLSideTray::expandSideBar(bool open_active) -{ - mCollapsed = false; - LLSideTrayTab* openclose_tab = getTab("sidebar_openclose"); - if (openclose_tab) - { - mCollapseButton->setImageOverlay( openclose_tab->mImageSelected ); - } - - if (open_active) - { - mActiveTab->onOpen(LLSD()); - } - - reflectCollapseChange(); - - - std::string name = mActiveTab->getName(); - std::map::const_iterator btn_it = - mTabButtons.find(name); - if (btn_it != mTabButtons.end()) - { - LLButton* btn = btn_it->second; - btn->setImageOverlay( mActiveTab->mImageSelected ); - } -} - -void LLSideTray::highlightFocused() -{ - /* uncomment in case something change - if(!mActiveTab) - return; - BOOL dependent_has_focus = gFocusMgr.childHasKeyboardFocus(this); - setBackgroundOpaque( dependent_has_focus ); - mActiveTab->setBackgroundOpaque( dependent_has_focus ); - */ -} - -//virtual -BOOL LLSideTray::handleMouseDown (S32 x, S32 y, MASK mask) -{ - BOOL ret = LLPanel::handleMouseDown(x,y,mask); - if(ret) - setFocus(true); - return ret; -} - -void LLSideTray::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - LLPanel::reshape(width, height, called_from_parent); - if(!mActiveTab) - return; - - arrange(); -} - -// This is just LLView::findChildView specialized to restrict the search to LLPanels. -// Optimization for EXT-4068 to avoid searching down to the individual item level -// when inventories are large. -LLPanel *findChildPanel(LLPanel *panel, const std::string& name, bool recurse) -{ - for (LLView::child_list_const_iter_t child_it = panel->beginChild(); - child_it != panel->endChild(); ++child_it) - { - LLPanel *child_panel = dynamic_cast(*child_it); - if (!child_panel) - continue; - if (child_panel->getName() == name) - return child_panel; - } - if (recurse) - { - for (LLView::child_list_const_iter_t child_it = panel->beginChild(); - child_it != panel->endChild(); ++child_it) - { - LLPanel *child_panel = dynamic_cast(*child_it); - if (!child_panel) - continue; - LLPanel *found_panel = findChildPanel(child_panel,name,recurse); - if (found_panel) - { - return found_panel; - } - } - } - return NULL; -} - -/** - * Activate tab with "panel_name" panel - * if no such tab - return false, otherwise true. - * TODO* In some cases a pointer to a panel of - * a specific class may be needed so this method - * would need to use templates. - */ -LLPanel* LLSideTray::showPanel (const std::string& panel_name, const LLSD& params) -{ - LLPanel* new_panel = NULL; - - // Look up the tab in the list of detached tabs. - child_vector_const_iter_t child_it; - for ( child_it = mDetachedTabs.begin(); child_it != mDetachedTabs.end(); ++child_it) - { - new_panel = openChildPanel(*child_it, panel_name, params); - if (new_panel) break; - } - - // Look up the tab in the list of attached tabs. - for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) - { - new_panel = openChildPanel(*child_it, panel_name, params); - if (new_panel) break; - } - - return new_panel; -} - -bool LLSideTray::hidePanel(const std::string& panel_name) -{ - bool panelHidden = false; - - LLPanel* panelp = getPanel(panel_name); - - if (panelp) - { - LLView* parentp = panelp->getParent(); - - // Collapse the side bar if the panel or the panel's parent is an attached tab - if (isTabAttached(panel_name) || (parentp && isTabAttached(parentp->getName()))) - { - collapseSideBar(); - panelHidden = true; - } - else - { - panelHidden = LLFloaterReg::hideInstance("side_bar_tab", panel_name); - - if (!panelHidden) - { - // Look up the panel in the list of detached tabs. - for (child_vector_const_iter_t child_it = mDetachedTabs.begin(); child_it != mDetachedTabs.end(); ++child_it) - { - LLPanel *detached_panel = dynamic_cast(*child_it); - - if (detached_panel) - { - // Hide this detached panel if it is a parent of our panel - if (findChildPanel(detached_panel, panel_name, true) != NULL) - { - panelHidden = LLFloaterReg::hideInstance("side_bar_tab", detached_panel->getName()); - break; - } - } - } - } - } - } - - return panelHidden; -} - -void LLSideTray::togglePanel(LLPanel* &sub_panel, const std::string& panel_name, const LLSD& params) -{ - if(!sub_panel) - return; - - // If a panel is visible and attached to Side Tray (has LLSideTray among its ancestors) - // it should be toggled off by collapsing Side Tray. - if (sub_panel->isInVisibleChain() && sub_panel->hasAncestor(this)) - { - LLSideTray::getInstance()->collapseSideBar(); - } - else - { - LLSideTray::getInstance()->showPanel(panel_name, params); - } -} - -LLPanel* LLSideTray::getPanel(const std::string& panel_name) -{ - // Look up the panel in the list of detached tabs. - for ( child_vector_const_iter_t child_it = mDetachedTabs.begin(); child_it != mDetachedTabs.end(); ++child_it) - { - LLPanel *panel = findChildPanel(*child_it,panel_name,true); - if(panel) - { - return panel; - } - } - - // Look up the panel in the list of attached tabs. - for ( child_vector_const_iter_t child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) - { - LLPanel *panel = findChildPanel(*child_it,panel_name,true); - if(panel) - { - return panel; - } - } - return NULL; -} - -LLPanel* LLSideTray::getActivePanel() -{ - if (mActiveTab && !mCollapsed) - { - return mActiveTab->getPanel(); - } - return NULL; -} - -bool LLSideTray::isPanelActive(const std::string& panel_name) -{ - LLPanel *panel = getActivePanel(); - if (!panel) return false; - return (panel->getName() == panel_name); -} - -void LLSideTray::setTabDocked(const std::string& tab_name, bool dock, bool toggle_floater /* = true*/) -{ - // Lookup tab by name. - LLSideTrayTab* tab = getTab(tab_name); - if (!tab) - { // not a docked tab, look through detached tabs - for(child_vector_iter_t tab_it = mDetachedTabs.begin(), tab_end_it = mDetachedTabs.end(); - tab_it != tab_end_it; - ++tab_it) - { - if ((*tab_it)->getName() == tab_name) - { - tab = *tab_it; - break; - } - } - - } - - llassert(tab != NULL); - - // Toggle its dock state. - if (tab && tab->isDocked() != dock) - { - tab->toggleTabDocked(toggle_floater); - } -} - - -void LLSideTray::updateSidetrayVisibility() -{ - // set visibility of parent container based on collapsed state - LLView* parent = getParent(); - if (parent) - { - bool old_visibility = parent->getVisible(); - bool new_visibility = !mCollapsed && !gAgentCamera.cameraMouselook(); - - if (old_visibility != new_visibility) - { - parent->setVisible(new_visibility); - - // Signal change of visible width. - //llinfos << "Visible: " << new_visibility << llendl; - mVisibleWidthChangeSignal(this, new_visibility); - } - } -} - -S32 LLSideTray::getVisibleWidth() -{ - return (isInVisibleChain() && !mCollapsed) ? getRect().getWidth() : 0; -} - -void LLSideTray::setVisibleWidthChangeCallback(const commit_signal_t::slot_type& cb) -{ - mVisibleWidthChangeSignal.connect(cb); -} diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h deleted file mode 100644 index 17158329dc..0000000000 --- a/indra/newview/llsidetray.h +++ /dev/null @@ -1,260 +0,0 @@ -/** - * @file LLSideTray.h - * @brief SideBar header file - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLSIDETRAY_H_ -#define LL_LLSIDETRAY_H_ - -#include "llpanel.h" -#include "string" - -class LLAccordionCtrl; -class LLSideTrayTab; - -// Define an interface for side tab button badge values -class LLSideTrayTabBadgeDriver -{ -public: - virtual std::string getBadgeString() const = 0; -}; - -// Deal with LLSideTrayTab being opaque. Generic do-nothing cast... -template -T tab_cast(LLSideTrayTab* tab) { return tab; } -// specialized for implementation in presence of LLSideTrayTab definition -template <> -LLPanel* tab_cast(LLSideTrayTab* tab); - -// added inheritance from LLDestroyClass to enable Side Tray perform necessary actions -// while disconnecting viewer in LLAppViewer::disconnectViewer(). -// LLDestroyClassList::instance().fireCallbacks() calls destroyClass method. See EXT-245. -class LLSideTray : public LLPanel, private LLDestroyClass -{ - friend class LLUICtrlFactory; - friend class LLDestroyClass; - friend class LLSideTrayTab; - friend class LLSideTrayButton; -public: - - LOG_CLASS(LLSideTray); - - struct Params - : public LLInitParam::Block - { - // initial state - Optional collapsed; - Optional tab_btn_image_normal, - tab_btn_image_selected; - - Optional default_button_width, - default_button_height, - default_button_margin; - - Params(); - }; - - static LLSideTray* getInstance (); - static bool instanceCreated (); -protected: - LLSideTray(const Params& params); - typedef std::vector child_vector_t; - typedef child_vector_t::iterator child_vector_iter_t; - typedef child_vector_t::const_iterator child_vector_const_iter_t; - typedef child_vector_t::reverse_iterator child_vector_reverse_iter_t; - typedef child_vector_t::const_reverse_iterator child_vector_const_reverse_iter_t; - typedef std::vector tab_order_vector_t; - typedef tab_order_vector_t::const_iterator tab_order_vector_const_iter_t; - -public: - - // interface functions - - /** - * Select tab with specific name and set it active - * - * @param name Tab to switch to. - * @param keep_prev_visible Whether to keep the previously selected tab visible. - */ - bool selectTabByName (const std::string& name, bool keep_prev_visible = false); - - /** - * Select tab with specific index and set it active - */ - bool selectTabByIndex(size_t index); - - /** - * Activate tab with "panel_name" panel - * if no such tab - return NULL, otherwise a pointer to the panel - * Pass params as array, or they may be overwritten(example - params["name"]="nearby") - */ - LLPanel* showPanel (const std::string& panel_name, const LLSD& params = LLSD()); - - bool hidePanel (const std::string& panel_name); - - /** - * Toggling Side Tray tab which contains "sub_panel" child of "panel_name" panel. - * If "sub_panel" is not visible Side Tray is opened to display it, - * otherwise Side Tray is collapsed. - * params are passed to "panel_name" panel onOpen(). - */ - void togglePanel (LLPanel* &sub_panel, const std::string& panel_name, const LLSD& params = LLSD()); - - /* - * get the panel (don't show it or do anything else with it) - */ - LLPanel* getPanel (const std::string& panel_name); - LLPanel* getActivePanel (); - bool isPanelActive (const std::string& panel_name); - - void setTabDocked(const std::string& tab_name, bool dock, bool toggle_floater = true); - - /* - * get the panel of given type T (don't show it or do anything else with it) - */ - template - T* getPanel(const std::string& panel_name) - { - T* panel = dynamic_cast(getPanel(panel_name)); - if (!panel) - { - llwarns << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << llendl; - return NULL; - } - return panel; - } - - /* - * collapse SideBar, hiding visible tab and moving tab buttons - * to the right corner of the screen - */ - void collapseSideBar (); - - /* - * expand SideBar - * - * @param open_active Whether to call onOpen() for the active tab. - */ - void expandSideBar(bool open_active = true); - - - /** - *hightlight if focused. manly copypaste from highlightFocusedFloater - */ - void highlightFocused(); - - void setVisible(BOOL visible) - { - if (getParent()) getParent()->setVisible(visible); - } - - LLPanel* getButtonsPanel() { return mButtonsPanel; } - - bool getCollapsed() { return mCollapsed; } - - void setTabButtonBadgeDriver(std::string tabName, LLSideTrayTabBadgeDriver* driver); - -public: - virtual ~LLSideTray(){}; - - virtual BOOL postBuild(); - - BOOL handleMouseDown (S32 x, S32 y, MASK mask); - - void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE); - - - /** - * @return side tray width if it's visible and expanded, 0 otherwise. - * - * Not that width of the tab buttons is not included. - * - * @see setVisibleWidthChangeCallback() - */ - S32 getVisibleWidth(); - - void setVisibleWidthChangeCallback(const commit_signal_t::slot_type& cb); - - void updateSidetrayVisibility(); - - void handleLoginComplete(); - - bool isTabAttached (const std::string& name); - -protected: - bool addChild (LLView* view, S32 tab_group); - bool removeTab (LLSideTrayTab* tab); // Used to detach tabs temporarily - bool addTab (LLSideTrayTab* tab); // Used to re-attach tabs - bool hasTabs (); - - const LLSideTrayTab* getActiveTab() const { return mActiveTab; } - LLSideTrayTab* getTab(const std::string& name); - - void createButtons (); - - void arrange (); - void detachTabs (); - void reflectCollapseChange(); - void processTriState (); - - void toggleTabButton (LLSideTrayTab* tab); - - LLPanel* openChildPanel (LLSideTrayTab* tab, const std::string& panel_name, const LLSD& params); - - void onTabButtonClick(std::string name); - void onToggleCollapse(); - -private: - // Implementation of LLDestroyClass - static void destroyClass() - { - // Disable SideTray to avoid crashes. EXT-245 - if (LLSideTray::instanceCreated()) - LLSideTray::getInstance()->setEnabled(FALSE); - } - -private: - // Since we provide no public way to query mTabs and mDetachedTabs, give - // LLSideTrayListener friend access. - friend class LLSideTrayListener; - LLPanel* mButtonsPanel; - typedef std::map button_map_t; - button_map_t mTabButtons; - typedef std::map badge_map_t; - badge_map_t mTabButtonBadgeDrivers; - child_vector_t mTabs; - child_vector_t mDetachedTabs; - tab_order_vector_t mOriginalTabOrder; - LLSideTrayTab* mActiveTab; - - commit_signal_t mVisibleWidthChangeSignal; - - LLButton* mCollapseButton; - bool mCollapsed; - - static LLSideTray* sInstance; -}; - -#endif - diff --git a/indra/newview/llsidetraylistener.cpp b/indra/newview/llsidetraylistener.cpp deleted file mode 100644 index cd6fa28948..0000000000 --- a/indra/newview/llsidetraylistener.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/** - * @file llsidetraylistener.cpp - * @author Nat Goodspeed - * @date 2011-02-15 - * @brief Implementation for llsidetraylistener. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// Precompiled header -#include "llviewerprecompiledheaders.h" -// associated header -#include "llsidetraylistener.h" -// STL headers -// std headers -// external library headers -// other Linden headers -#include "llsidetray.h" -#include "llsdutil.h" - -LLSideTrayListener::LLSideTrayListener(const Getter& getter): - LLEventAPI("LLSideTray", - "Operations on side tray (e.g. query state, query tabs)"), - mGetter(getter) -{ - add("getCollapsed", "Send on [\"reply\"] an [\"open\"] Boolean", - &LLSideTrayListener::getCollapsed, LLSDMap("reply", LLSD())); - add("getTabs", - "Send on [\"reply\"] a map of tab names and info about them", - &LLSideTrayListener::getTabs, LLSDMap("reply", LLSD())); - add("getPanels", - "Send on [\"reply\"] data about panels available with SideTray.ShowPanel", - &LLSideTrayListener::getPanels, LLSDMap("reply", LLSD())); -} - -void LLSideTrayListener::getCollapsed(const LLSD& event) const -{ - sendReply(LLSDMap("open", ! mGetter()->getCollapsed()), event); -} - -void LLSideTrayListener::getTabs(const LLSD& event) const -{ - LLSD reply; - - LLSideTray* tray = mGetter(); - LLSD::Integer ord(0); - for (LLSideTray::child_list_const_iter_t chi(tray->beginChild()), chend(tray->endChild()); - chi != chend; ++chi, ++ord) - { - LLView* child = *chi; - // How much info is important? Toss in as much as seems reasonable for - // each tab. But to me, at least for the moment, the most important - // item is the tab name. - LLSD info; - // I like the idea of returning a map keyed by tab name. But as - // compared to an array of maps, that loses sequence information. - // Address that by indicating the original order in each map entry. - info["ord"] = ord; - info["visible"] = bool(child->getVisible()); - info["enabled"] = bool(child->getEnabled()); - info["available"] = child->isAvailable(); - reply[child->getName()] = info; - } - - sendReply(reply, event); -} - -static LLSD getTabInfo(LLPanel* tab) -{ - LLSD panels; - for (LLPanel::tree_iterator_t ti(tab->beginTreeDFS()), tend(tab->endTreeDFS()); - ti != tend; ++ti) - { - // *ti is actually an LLView*, which had better not be NULL - LLView* view(*ti); - if (! view) - { - LL_ERRS("LLSideTrayListener") << "LLSideTrayTab '" << tab->getName() - << "' has a NULL child LLView*" << LL_ENDL; - } - - // The logic we use to decide what "panel" names to return is heavily - // based on LLSideTray::showPanel(): the function that actually - // implements the "SideTray.ShowPanel" operation. showPanel(), in - // turn, depends on LLSideTray::openChildPanel(): when - // openChildPanel() returns non-NULL, showPanel() stops searching - // attached and detached LLSideTrayTab tabs. - - // For each LLSideTrayTab, openChildPanel() first calls - // findChildView(panel_name, true). In other words, panel_name need - // not be a direct LLSideTrayTab child, it's sought recursively. - // That's why we use (begin|end)TreeDFS() in this loop. - - // But this tree_iterator_t loop will actually traverse every widget - // in every panel. Returning all those names will not help our caller: - // passing most such names to openChildPanel() would not do what we - // want. Even though the code suggests that passing ANY valid - // side-panel widget name to openChildPanel() will open the tab - // containing that widget, results could get confusing since followup - // (onOpen()) logic wouldn't be invoked, and showPanel() wouldn't stop - // searching because openChildPanel() would return NULL. - - // We must filter these LLView items, using logic that (sigh!) mirrors - // openChildPanel()'s own. - - // openChildPanel() returns a non-NULL LLPanel* when either: - // - the LLView is a direct child of an LLSideTrayPanelContainer - // - the LLView is itself an LLPanel. - // But as LLSideTrayPanelContainer can directly contain LLView items - // that are NOT themselves LLPanels (e.g. "sidebar_me" contains an - // LLButton called "Jump Right Arrow"), we'd better focus only on - // LLSideTrayPanelContainer children that are themselves LLPanel - // items. Which means that the second test completely subsumes the - // first. - LLPanel* panel(dynamic_cast(view)); - if (panel) - { - // Maybe it's overkill to construct an LLSD::Map for each panel, but - // the possibility remains that we might want to deliver more info - // about each panel than just its name. - panels.append(LLSDMap("name", panel->getName())); - } - } - - return LLSDMap("panels", panels); -} - -void LLSideTrayListener::getPanels(const LLSD& event) const -{ - LLSD reply; - - LLSideTray* tray = mGetter(); - // Iterate through the attached tabs. - LLSD::Integer ord(0); - for (LLSideTray::child_vector_t::const_iterator - ati(tray->mTabs.begin()), atend(tray->mTabs.end()); - ati != atend; ++ati) - { - // We don't have access to LLSideTrayTab: the class definition is - // hidden in llsidetray.cpp. But as LLSideTrayTab isa LLPanel, use the - // LLPanel API. Unfortunately, without the LLSideTrayTab definition, - // the compiler doesn't even know this LLSideTrayTab* is an LLPanel*. - // Persuade it. - LLPanel* tab(tab_cast(*ati)); - reply[tab->getName()] = getTabInfo(tab).with("attached", true).with("ord", ord); - } - - // Now iterate over the detached tabs. These can also be opened via - // SideTray.ShowPanel. - ord = 0; - for (LLSideTray::child_vector_t::const_iterator - dti(tray->mDetachedTabs.begin()), dtend(tray->mDetachedTabs.end()); - dti != dtend; ++dti) - { - LLPanel* tab(tab_cast(*dti)); - reply[tab->getName()] = getTabInfo(tab).with("attached", false).with("ord", ord); - } - - sendReply(reply, event); -} diff --git a/indra/newview/llsidetraylistener.h b/indra/newview/llsidetraylistener.h deleted file mode 100644 index 51e2137762..0000000000 --- a/indra/newview/llsidetraylistener.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file llsidetraylistener.h - * @author Nat Goodspeed - * @date 2011-02-15 - * @brief - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#if ! defined(LL_LLSIDETRAYLISTENER_H) -#define LL_LLSIDETRAYLISTENER_H - -#include "lleventapi.h" -#include - -class LLSideTray; -class LLSD; - -class LLSideTrayListener: public LLEventAPI -{ - typedef boost::function Getter; - -public: - LLSideTrayListener(const Getter& getter); - -private: - void getCollapsed(const LLSD& event) const; - void getTabs(const LLSD& event) const; - void getPanels(const LLSD& event) const; - - Getter mGetter; -}; - -#endif /* ! defined(LL_LLSIDETRAYLISTENER_H) */ diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 749acea6c1..4511a4806a 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -131,7 +131,6 @@ #include "llsecondlifeurls.h" #include "llselectmgr.h" #include "llsky.h" -#include "llsidetray.h" #include "llstatview.h" #include "llstatusbar.h" // sendMoneyBalanceRequest(), owns L$ balance #include "llsurface.h" diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index 477718d118..f6d7ceeec3 100644 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -36,7 +36,6 @@ #include "llfloaterworldmap.h" #include "llpanellogin.h" #include "llregionhandle.h" -#include "llsidetray.h" #include "llslurl.h" #include "llstartup.h" // gStartupState #include "llweb.h" diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 0b3b8e23a5..174a4d6409 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -95,7 +95,6 @@ #include "llfloatersellland.h" #include "llfloatersettingsdebug.h" #include "llfloatersidepanelcontainer.h" -#include "llfloatersidetraytab.h" #include "llfloatersnapshot.h" #include "llfloatersounddevices.h" #include "llfloatertelehub.h" @@ -276,7 +275,6 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("script_limits", "floater_script_limits.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("sell_land", "floater_sell_land.xml", &LLFloaterSellLand::buildFloater); LLFloaterReg::add("settings_debug", "floater_settings_debug.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("side_bar_tab", "floater_side_bar_tab.xml", &LLFloaterReg::build); LLFloaterReg::add("sound_devices", "floater_sound_devices.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 50fb5a00e4..f8ef81b9f4 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -45,7 +45,6 @@ #include "llinventorymodel.h" #include "llinventorymodelbackgroundfetch.h" #include "llgesturemgr.h" -#include "llsidetray.h" #include "llinventorybridge.h" #include "llinventorypanel.h" diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 5e781e0e4c..fbfde711a9 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -83,7 +83,6 @@ #include "llrootview.h" #include "llsceneview.h" #include "llselectmgr.h" -#include "llsidetray.h" #include "llstatusbar.h" #include "lltextureview.h" #include "lltoolcomp.h" @@ -3348,15 +3347,6 @@ bool enable_sitdown_self() return isAgentAvatarValid() && !gAgentAvatarp->isSitting() && !gAgent.getFlying(); } -// Used from the login screen to aid in UI work on side tray -void handle_show_side_tray() -{ - LLSideTray* side_tray = LLSideTray::getInstance(); - LLView* root = gViewerWindow->getRootView(); - // automatically removes and re-adds if there already - root->addChild(side_tray); -} - // Toggle one of "People" panel tabs in side tray. class LLTogglePanelPeopleTab : public view_listener_t { @@ -3367,21 +3357,11 @@ class LLTogglePanelPeopleTab : public view_listener_t LLSD param; param["people_panel_tab_name"] = panel_name; - static LLPanel* friends_panel = NULL; - static LLPanel* groups_panel = NULL; - static LLPanel* nearby_panel = NULL; - - if (panel_name == "friends_panel") - { - return togglePeoplePanel(friends_panel, panel_name, param); - } - else if (panel_name == "groups_panel") - { - return togglePeoplePanel(groups_panel, panel_name, param); - } - else if (panel_name == "nearby_panel") + if ( panel_name == "friends_panel" + || panel_name == "groups_panel" + || panel_name == "nearby_panel") { - return togglePeoplePanel(nearby_panel, panel_name, param); + return togglePeoplePanel(panel_name, param); } else { @@ -3389,16 +3369,20 @@ class LLTogglePanelPeopleTab : public view_listener_t } } - static bool togglePeoplePanel(LLPanel* &panel, const std::string& panel_name, const LLSD& param) + static bool togglePeoplePanel(const std::string& panel_name, const LLSD& param) { + LLPanel *panel = LLFloaterSidePanelContainer::getPanel("people", panel_name); if(!panel) + return false; + + if (panel->isInVisibleChain()) { - panel = LLSideTray::getInstance()->getPanel(panel_name); - if(!panel) - return false; + LLFloaterReg::hideInstance("people"); + } + else + { + LLFloaterSidePanelContainer::showPanel("people", "panel_people", param) ; } - - LLSideTray::getInstance()->togglePanel(panel, "panel_people", param); return true; } @@ -8067,7 +8051,6 @@ void initialize_menus() view_listener_t::addMenu(new LLAdvancedCheckDebugKeys(), "Advanced.CheckDebugKeys"); view_listener_t::addMenu(new LLAdvancedToggleDebugWindowProc(), "Advanced.ToggleDebugWindowProc"); view_listener_t::addMenu(new LLAdvancedCheckDebugWindowProc(), "Advanced.CheckDebugWindowProc"); - commit.add("Advanced.ShowSideTray", boost::bind(&handle_show_side_tray)); // Advanced > XUI commit.add("Advanced.ReloadColorSettings", boost::bind(&LLUIColorTable::loadFromSettings, LLUIColorTable::getInstance())); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 5665a68add..1c07d36e7e 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -74,7 +74,6 @@ #include "llrecentpeople.h" #include "llscriptfloater.h" #include "llselectmgr.h" -#include "llsidetray.h" #include "llstartup.h" #include "llsky.h" #include "llslurl.h" @@ -6800,7 +6799,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**) LLPanelLandCovenant::updateEstateOwnerName(owner_name); LLFloaterBuyLand::updateEstateOwnerName(owner_name); - LLPanelPlaceProfile* panel = LLSideTray::getInstance()->getPanel("panel_place_profile"); + LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel("places", "panel_place_profile"); if (panel) { panel->updateEstateName(estate_name); @@ -6934,7 +6933,7 @@ void onCovenantLoadComplete(LLVFS *vfs, LLPanelLandCovenant::updateCovenantText(covenant_text); LLFloaterBuyLand::updateCovenantText(covenant_text, asset_uuid); - LLPanelPlaceProfile* panel = LLSideTray::getInstance()->getPanel("panel_place_profile"); + LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel("places", "panel_place_profile"); if (panel) { panel->updateCovenantText(covenant_text); diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index b308e952ad..0a9fae68a6 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -51,7 +51,6 @@ #include "llpreviewtexture.h" #include "llscrollbar.h" #include "llscrollcontainer.h" -#include "llsidetray.h" #include "lltooldraganddrop.h" #include "lltooltip.h" #include "lltrans.h" diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 6c9ee17a76..149f9893d7 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -133,7 +133,6 @@ #include "llpreviewtexture.h" #include "llprogressview.h" #include "llresmgr.h" -#include "llsidetray.h" #include "llselectmgr.h" #include "llrootview.h" #include "llrendersphere.h" @@ -1773,7 +1772,6 @@ void LLViewerWindow::initBase() // placeholder widget that controls where "world" is rendered mWorldViewPlaceholder = main_view->getChildView("world_view_rect")->getHandle(); - mNonSideTrayView = main_view->getChildView("non_side_tray_view")->getHandle(); mFloaterViewHolder = main_view->getChildView("floater_view_holder")->getHandle(); mPopupView = main_view->getChild("popup_holder"); mHintHolder = main_view->getChild("hint_holder")->getHandle(); @@ -1934,22 +1932,6 @@ void LLViewerWindow::initWorldUI() panel_ssf_container->addChild(panel_stand_stop_flying); panel_ssf_container->setVisible(TRUE); - // put sidetray in container - LLPanel* side_tray_container = getRootView()->getChild("side_tray_container"); - LLSideTray* sidetrayp = LLSideTray::getInstance(); - sidetrayp->setShape(side_tray_container->getLocalRect()); - // don't follow right edge to avoid spurious resizes, since we are using a fixed width layout - sidetrayp->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_BOTTOM); - side_tray_container->addChild(sidetrayp); - side_tray_container->setVisible(FALSE); - - // put sidetray buttons in their own panel - LLPanel* buttons_panel = sidetrayp->getButtonsPanel(); - LLPanel* buttons_panel_container = getRootView()->getChild("side_bar_tabs"); - buttons_panel->setShape(buttons_panel_container->getLocalRect()); - buttons_panel->setFollowsAll(); - buttons_panel_container->addChild(buttons_panel); - // Load and make the toolbars visible // Note: we need to load the toolbars only *after* the user is logged in and IW if (gToolBarView) @@ -3310,9 +3292,6 @@ void LLViewerWindow::updateKeyboardFocus() // make sure floater visible order is in sync with tab order gFloaterView->syncFloaterTabOrder(); } - - if(LLSideTray::instanceCreated())//just getInstance will create sidetray. we don't want this - LLSideTray::getInstance()->highlightFocused(); } static LLFastTimer::DeclareTimer FTM_UPDATE_WORLD_VIEW("Update World View"); @@ -3336,12 +3315,6 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window) new_world_rect.mTop = llround((F32)new_world_rect.mTop * mDisplayScale.mV[VY]); } - if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE) - { - // use right edge of window, ignoring sidebar - new_world_rect.mRight = mWindowRectRaw.mRight; - } - if (mWorldViewRectRaw != new_world_rect) { mWorldViewRectRaw = new_world_rect; diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 47e0fdeab1..872eb12753 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -282,7 +282,6 @@ public: void updateKeyboardFocus(); void updateWorldViewRect(bool use_full_window=false); - LLView* getNonSideTrayView() { return mNonSideTrayView.get(); } LLView* getFloaterViewHolder() { return mFloaterViewHolder.get(); } LLView* getToolBarHolder() { return mToolBarHolder.get(); } LLView* getHintHolder() { return mHintHolder.get(); } @@ -445,7 +444,6 @@ protected: std::string mInitAlert; // Window / GL initialization requires an alert LLHandle mWorldViewPlaceholder; // widget that spans the portion of screen dedicated to rendering the 3d world - LLHandle mNonSideTrayView; // parent of world view + bottom bar, etc...everything but the side tray LLHandle mFloaterViewHolder; // container for floater_view LLHandle mToolBarHolder; // container for toolbars LLHandle mHintHolder; // container for hints diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index 276e8f462d..d8aa0b7d5c 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -37,7 +37,6 @@ #include "llinventorymodel.h" #include "llinventoryobserver.h" #include "llsidepanelappearance.h" -#include "llsidetray.h" #include "lltexlayer.h" #include "lltexglobalcolor.h" #include "lltrans.h" diff --git a/indra/newview/llworldview.cpp b/indra/newview/llworldview.cpp deleted file mode 100644 index f5dc2a5290..0000000000 --- a/indra/newview/llworldview.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file llworldview.cpp - * @brief LLWorldView class implementation - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llworldview.h" - -#include "llviewercontrol.h" -#include "llsidetray.h" -///////////////////////////////////////////////////// -// LLFloaterView - -static LLDefaultChildRegistry::Register r("world_view"); - -LLWorldView::LLWorldView(const Params& p) -: LLUICtrl (p) -{ - gSavedSettings.getControl("SidebarCameraMovement")->getSignal()->connect(boost::bind(&LLWorldView::toggleSidebarCameraMovement, this, _2)); -} - -void LLWorldView::reshape(S32 width, S32 height, BOOL called_from_parent) -{ - //if (FALSE == gSavedSettings.getBOOL("SidebarCameraMovement") ) - //{ - // LLView* main_view = LLUI::getRootView()->findChild("main_view"); - // if(main_view) - // { - // width = main_view->getRect().getWidth(); - // } - //} - - LLUICtrl::reshape(width, height, called_from_parent); -} -void LLWorldView::toggleSidebarCameraMovement(const LLSD::Boolean& new_visibility) -{ - reshape(getParent()->getRect().getWidth(),getRect().getHeight()); -} - diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index 6ece01b2ba..d8f593715f 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -90,14 +90,6 @@ top="0" visible="false" width="1024"/> - - - - - Date: Thu, 29 Sep 2011 14:42:30 -0700 Subject: EXP-1278 FIX -- Implement 3-way toolbar button functionality Toolbar buttons now affect their floaters as indicated in the FUI_Button_states wiki page -- https://wiki.lindenlab.com/wiki/FUI_Button_states --- indra/llui/llfloaterreg.cpp | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index bc740dde17..8a0513f246 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -455,12 +455,42 @@ void LLFloaterReg::toggleFloaterInstance(const LLSD& sdname) //static void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname) { - // Do some extra logic here for 3-state toolbar floater toggling madness :) - + // + // Floaters controlled by the toolbar behave a bit differently from others. + // Namely they have 3-4 states as defined in the design wiki page here: + // https://wiki.lindenlab.com/wiki/FUI_Button_states + // + // The basic idea is this: + // * If the target floater is minimized, this button press will un-minimize it. + // * Else if the target floater is closed open it. + // * Else if the target floater does not have focus, give it focus. + // * Also, if it is not on top, bring it forward when focus is given. + // * Else the target floater is open, close it. + // + + // First parse the parameter LLSD key; std::string name = sdname.asString(); parse_name_key(name, key); - toggleInstance(name, key); + + LLFloater* instance = findInstance(name, key); + + if (LLFloater::isMinimized(instance)) + { + instance->setMinimized(FALSE); + } + else if (!LLFloater::isShown(instance)) + { + showInstance(name, key, TRUE); + } + else if (!instance->hasFocus()) + { + instance->setFocus(TRUE); + } + else + { + instance->closeFloater(); + } } //static -- cgit v1.2.3 From b07e7c7198fbc78ca852b3ba48d516ec2901da21 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Thu, 29 Sep 2011 15:01:15 -0700 Subject: EXP-1211, EXP-1257 : Save and load the button type along with the toolbars, add a force default load option, enforce consistency between menus and toolbars --- indra/llui/lltoolbar.cpp | 27 +++++++++---- indra/llui/lltoolbar.h | 8 +++- indra/llui/lltoolbarview.cpp | 45 ++++++++++++++++++++-- indra/llui/lltoolbarview.h | 6 ++- indra/newview/app_settings/toolbars.xml | 6 ++- .../newview/skins/default/xui/en/menu_toolbars.xml | 6 +-- 6 files changed, 79 insertions(+), 19 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 45567d5859..75c7d91f8a 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -213,6 +213,14 @@ bool LLToolBar::addCommand(const LLCommandId& commandId) return add_command; } +void LLToolBar::clearCommandsList() +{ + // Clears the commands list + mButtonCommands.clear(); + // This will clear the buttons + createButtons(); +} + bool LLToolBar::hasCommand(const LLCommandId& commandId) const { bool has_command = false; @@ -278,7 +286,7 @@ BOOL LLToolBar::isSettingChecked(const LLSD& userdata) const std::string setting_name = userdata.asString(); - if (setting_name == "icons_and_labels") + if (setting_name == "icons_with_text") { retval = (mButtonType == BTNTYPE_ICONS_WITH_TEXT); } @@ -296,18 +304,23 @@ void LLToolBar::onSettingEnable(const LLSD& userdata) const std::string setting_name = userdata.asString(); - const ButtonType current_button_type = mButtonType; - - if (setting_name == "icons_and_labels") + if (setting_name == "icons_with_text") { - mButtonType = BTNTYPE_ICONS_WITH_TEXT; + setButtonType(BTNTYPE_ICONS_WITH_TEXT); } else if (setting_name == "icons_only") { - mButtonType = BTNTYPE_ICONS_ONLY; + setButtonType(BTNTYPE_ICONS_ONLY); } +} - if(current_button_type != mButtonType) +void LLToolBar::setButtonType(LLToolBarEnums::ButtonType button_type) +{ + bool regenerate_buttons = (mButtonType != button_type); + + mButtonType = button_type; + + if (regenerate_buttons) { createButtons(); } diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 8e484c7e13..03b1756988 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -123,7 +123,6 @@ public: bool addCommand(const LLCommandId& commandId); bool hasCommand(const LLCommandId& commandId) const; bool enableCommand(const LLCommandId& commandId, bool enabled); - command_id_list_t& getCommandsList() { return mButtonCommands; } protected: friend class LLUICtrlFactory; @@ -132,6 +131,13 @@ protected: void initFromParams(const Params&); +public: + // Methods used in loading and saving toolbar settings + void setButtonType(LLToolBarEnums::ButtonType button_type); + LLToolBarEnums::ButtonType getButtonType() { return mButtonType; } + command_id_list_t& getCommandsList() { return mButtonCommands; } + void clearCommandsList(); + private: void createContextMenu(); void updateLayoutAsNeeded(); diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index f60598edcb..1c6cf3230b 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -41,7 +41,8 @@ LLToolBarView* gToolBarView = NULL; static LLDefaultChildRegistry::Register r("toolbar_view"); LLToolBarView::Toolbar::Toolbar() -: commands("command") +: button_display_mode("button_display_mode"), + commands("command") {} LLToolBarView::ToolbarSet::ToolbarSet() @@ -112,13 +113,17 @@ bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar) return true; } -bool LLToolBarView::loadToolbars() +bool LLToolBarView::loadToolbars(bool force_default) { LLToolBarView::ToolbarSet toolbar_set; - // Load the default toolbars.xml file + // Load the toolbars.xml file std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml"); - if (!gDirUtilp->fileExists(toolbar_file)) + if (force_default) + { + toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); + } + else if (!gDirUtilp->fileExists(toolbar_file)) { llwarns << "User toolbars def not found -> use default" << llendl; toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); @@ -145,9 +150,28 @@ bool LLToolBarView::loadToolbars() return false; } + // Clear the toolbars now before adding the loaded commands and settings + if (mToolbarLeft) + { + mToolbarLeft->clearCommandsList(); + } + if (mToolbarRight) + { + mToolbarRight->clearCommandsList(); + } + if (mToolbarBottom) + { + mToolbarBottom->clearCommandsList(); + } + // Add commands to each toolbar if (toolbar_set.left_toolbar.isProvided() && mToolbarLeft) { + if (toolbar_set.left_toolbar.button_display_mode.isProvided()) + { + U32 button_type = toolbar_set.left_toolbar.button_display_mode; + mToolbarLeft->setButtonType((LLToolBarEnums::ButtonType)(button_type)); + } BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.left_toolbar.commands) { addCommand(LLCommandId(command),mToolbarLeft); @@ -155,6 +179,11 @@ bool LLToolBarView::loadToolbars() } if (toolbar_set.right_toolbar.isProvided() && mToolbarRight) { + if (toolbar_set.right_toolbar.button_display_mode.isProvided()) + { + U32 button_type = toolbar_set.right_toolbar.button_display_mode; + mToolbarRight->setButtonType((LLToolBarEnums::ButtonType)(button_type)); + } BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.right_toolbar.commands) { addCommand(LLCommandId(command),mToolbarRight); @@ -162,6 +191,11 @@ bool LLToolBarView::loadToolbars() } if (toolbar_set.bottom_toolbar.isProvided() && mToolbarBottom) { + if (toolbar_set.bottom_toolbar.button_display_mode.isProvided()) + { + U32 button_type = toolbar_set.bottom_toolbar.button_display_mode; + mToolbarBottom->setButtonType((LLToolBarEnums::ButtonType)(button_type)); + } BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.bottom_toolbar.commands) { addCommand(LLCommandId(command),mToolbarBottom); @@ -176,14 +210,17 @@ void LLToolBarView::saveToolbars() const LLToolBarView::ToolbarSet toolbar_set; if (mToolbarLeft) { + toolbar_set.left_toolbar.button_display_mode = (int)(mToolbarLeft->getButtonType()); addToToolset(mToolbarLeft->getCommandsList(),toolbar_set.left_toolbar); } if (mToolbarRight) { + toolbar_set.right_toolbar.button_display_mode = (int)(mToolbarRight->getButtonType()); addToToolset(mToolbarRight->getCommandsList(),toolbar_set.right_toolbar); } if (mToolbarBottom) { + toolbar_set.bottom_toolbar.button_display_mode = (int)(mToolbarBottom->getButtonType()); addToToolset(mToolbarBottom->getCommandsList(),toolbar_set.bottom_toolbar); } diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index b19841997b..efe6920db8 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -50,7 +50,8 @@ public: // the user folder for the user specific (saved) settings struct Toolbar : public LLInitParam::Block { - Multiple commands; + Mandatory button_display_mode; + Multiple commands; Toolbar(); }; struct ToolbarSet : public LLInitParam::Block @@ -70,7 +71,8 @@ public: // Checks if the commandId is being used somewhere in one of the toolbars bool hasCommand(const LLCommandId& commandId) const; // Loads the toolbars from the existing user or default settings - bool loadToolbars(); // return false if load fails + bool loadToolbars(bool force_default = false); // return false if load fails + bool loadDefaultToolbars() { return loadToolbars(true); } protected: friend class LLUICtrlFactory; diff --git a/indra/newview/app_settings/toolbars.xml b/indra/newview/app_settings/toolbars.xml index 55327ea919..19dec78c63 100644 --- a/indra/newview/app_settings/toolbars.xml +++ b/indra/newview/app_settings/toolbars.xml @@ -1,6 +1,7 @@ - + @@ -10,7 +11,8 @@ - + diff --git a/indra/newview/skins/default/xui/en/menu_toolbars.xml b/indra/newview/skins/default/xui/en/menu_toolbars.xml index de13fec670..59912b5503 100644 --- a/indra/newview/skins/default/xui/en/menu_toolbars.xml +++ b/indra/newview/skins/default/xui/en/menu_toolbars.xml @@ -12,11 +12,11 @@ + name="icons_with_text"> + parameter="icons_with_text" /> + parameter="icons_with_text" /> Date: Thu, 29 Sep 2011 15:25:24 -0700 Subject: * Updated toybox so it will always display buttons in alphabetical order based on the localized button labels. --- indra/newview/llfloatertoybox.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index c3fa322f85..d7f114043d 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -33,6 +33,7 @@ #include "llpanel.h" #include "lltoolbar.h" #include "lltoolbarview.h" +#include "lltrans.h" LLFloaterToybox::LLFloaterToybox(const LLSD& key) @@ -47,6 +48,14 @@ LLFloaterToybox::~LLFloaterToybox() { } +bool compare_localized_command_labels(LLCommand * cmd1, LLCommand * cmd2) +{ + std::string lab1 = LLTrans::getString(cmd1->labelRef()); + std::string lab2 = LLTrans::getString(cmd2->labelRef()); + + return (lab1 < lab2); +} + BOOL LLFloaterToybox::postBuild() { center(); @@ -54,11 +63,13 @@ BOOL LLFloaterToybox::postBuild() mBtnRestoreDefaults = getChild("btn_restore_defaults"); mToolBar = getChild("toybox_toolbar"); + LLCommandManager& cmdMgr = LLCommandManager::instance(); + // - // Create Buttons + // Sort commands by localized labels so they will appear alphabetized in all languages // - LLCommandManager& cmdMgr = LLCommandManager::instance(); + std::list alphabetized_commands; for (U32 i = 0; i < cmdMgr.commandCount(); i++) { @@ -66,10 +77,21 @@ BOOL LLFloaterToybox::postBuild() if (command->availableInToybox()) { - mToolBar->addCommand(command->id()); + alphabetized_commands.push_back(command); } } + alphabetized_commands.sort(compare_localized_command_labels); + + // + // Create Buttons + // + + for (std::list::iterator it = alphabetized_commands.begin(); it != alphabetized_commands.end(); ++it) + { + mToolBar->addCommand((*it)->id()); + } + return TRUE; } -- cgit v1.2.3 From 66e21e0330b2f66b986a1ed76873af9752dcf2e1 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 29 Sep 2011 17:03:36 -0700 Subject: * Added latest set of FUI buttons and labels according to the wiki * Hooked up commands to their respective floaters --- indra/newview/app_settings/commands.xml | 118 ++++++++++++---------- indra/newview/skins/default/textures/textures.xml | 44 ++++---- indra/newview/skins/default/xui/en/strings.xml | 78 +++++++------- 3 files changed, 132 insertions(+), 108 deletions(-) diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 5fbd9248c1..224c1b4b48 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -1,12 +1,28 @@ + + + - + - - - - - - + diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index be68c2873e..57ce7fe57a 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -125,27 +125,29 @@ with the same filename but different name - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index feea555fdc..158e1c711d 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -16,16 +16,16 @@ Detecting hardware... Loading [APP_NAME]... Clearing cache... - Initializing Texture Cache... + Initializing texture cache... Initializing VFS... - Graphics Initialization Failed. Please Update Your Graphics Driver! + Graphics initialization failed. Please update your graphics driver! Restoring... - Changing Resolution... + Changing resolution... - Fullbright (Legacy) + Fullbright (legacy) Logging in. [APP_NAME] may appear frozen. Please wait. @@ -38,8 +38,8 @@ Initializing multimedia... Loading fonts... Verifying cache files (can take 60-90 seconds)... - Processing Response... - Initializing World... + Processing response... + Initializing world... Decoding images... Initializing QuickTime... QuickTime not found - unable to initialize. @@ -56,7 +56,7 @@ Too many certificates were in the servers Certificate chain. Please contact your Grid administrator. The certificate signature returned by the Grid server could not be verified. Please contact your Grid administrator. - Network Error: Could not establish connection, please check your network connection. + Network error: Could not establish connection, please check your network connection. Login failed. Quit http://join.secondlife.com/ @@ -3652,47 +3652,53 @@ Try enclosing path to the editor with double quotes. Hiding Particles + + About land + Appearance Avatar - Change the appearance of your avatar Build - Building, reshaping terrain Chat - Chat with people nearby Compass - + Destinations Gestures - - How To - - Landmarks - + How to + Inventory Map - - Mini Map - + Marketplace + Mini-map Move - - My Land - Information about the land you're visiting - My Stuff - View and use your belongings People - Places - Destination guide + Preferences + Profile Search - Find... - Settings - Preferences - Shop - Snapshot - Take a picture Speak - Speak with people nearby using your microphone - Upload - View - Changing your view of the world + Nearby voice + + Information about the land you're visiting + Change your avatar + Choose a complete avatar + Building objects and reshaping them + Chat with people nearby using text + Compass + Destinations of interest + Gestures for your avatar + How to do common tasks + View and use your belongings + Map of the world + Go shopping + Show nearby people + Moving your avatar + Friends, groups, and nearby people + Places you've saved + Preferences + Edit or view your profile + Find places, events, people + Take a picture + Speak with people nearby using your microphone + Changing camera angle + People nearby with voice capability -- cgit v1.2.3 From 8fa45941b6ce99c462f19628a17d4db2396286b9 Mon Sep 17 00:00:00 2001 From: leyla_linden Date: Fri, 30 Sep 2011 10:00:49 -0700 Subject: EXP-1264 Chat log shows as blank if closing viewer with chat log open and then opening chat floater on next login EXP-1271 Remove UI hints --- indra/llui/llfloater.h | 2 +- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llnearbychatbar.cpp | 17 ++++++++++++++--- indra/newview/llnearbychatbar.h | 4 ++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 58c2d34253..fba59e82e1 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -293,7 +293,7 @@ public: protected: virtual void applySavedVariables(); - void applyRectControl(); + virtual void applyRectControl(); void applyDockState(); void storeRectControl(); void storeVisibilityControl(); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 148b80e817..1abea6c883 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3190,7 +3190,7 @@ Type Boolean Value - 1 + 0 EnableVoiceChat diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 258aa9a8bf..dbe30e1847 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -451,6 +451,16 @@ BOOL LLNearbyChatBar::postBuild() return TRUE; } +void LLNearbyChatBar::applyRectControl() +{ + LLFloater::applyRectControl(); + if (getRect().getHeight() > getMinHeight()) + { + getChildView("nearby_chat")->setVisible(true); + mExpandedHeight = getRect().getHeight(); + } +} + void LLNearbyChatBar::onChatFontChange(LLFontGL* fontp) { // Update things with the new font whohoo @@ -690,14 +700,15 @@ void LLNearbyChatBar::onToggleNearbyChatPanel() if (nearby_chat->getVisible()) { + mExpandedHeight = getRect().getHeight(); nearby_chat->setVisible(FALSE); - reshape(getRect().getWidth(), 60); - mResizeHandle[0]->setMaxHeight(60); + reshape(getRect().getWidth(), getMinHeight()); + mResizeHandle[0]->setMaxHeight(getMinHeight()); } else { nearby_chat->setVisible(TRUE); - reshape(getRect().getWidth(), 360); + reshape(getRect().getWidth(), mExpandedHeight); mResizeHandle[0]->setMaxHeight(S32_MAX); } } diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h index 1d28a21ef3..0415f12a0d 100644 --- a/indra/newview/llnearbychatbar.h +++ b/indra/newview/llnearbychatbar.h @@ -127,6 +127,8 @@ protected: void onChatBoxCommit(); void onChatFontChange(LLFontGL* fontp); + /* virtual */ void applyRectControl(); + void onToggleNearbyChatPanel(); static LLWString stripChannelNumber(const LLWString &mesg, S32* channel); @@ -140,6 +142,8 @@ protected: LLLineEditor* mChatBox; LLOutputMonitorCtrl* mOutputMonitor; LLLocalSpeakerMgr* mSpeakerMgr; + + S32 mExpandedHeight; }; #endif -- cgit v1.2.3 From ccd619013d851b5a63976205ea06002e92d7f468 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 30 Sep 2011 13:37:03 -0700 Subject: Found and removed duplicate command icon definitions. --- indra/newview/skins/default/textures/textures.xml | 68 ++++++++--------------- 1 file changed, 23 insertions(+), 45 deletions(-) diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 57ce7fe57a..4462fb792f 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -125,29 +125,29 @@ with the same filename but different name - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -762,26 +762,4 @@ with the same filename but different name - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3 From cdc80b1dd34ef533d7500bf1ab89abf3c5d81bb3 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 30 Sep 2011 15:25:02 -0700 Subject: EXP-1205 PROGRESS -- As a User, I want a toybox which will contain all buttons that I can d&d into the toolbars EXP-1268 FIX -- The "Restore Defaults" button should reset the left/right/bottom toolbars to their default states * LLToolBarView::loadDefaultToolbars now a static function * Toybox button callback hooked up to properly restore defaults Reviewed by Merov --- indra/llui/lltoolbarview.cpp | 15 ++++++++++++++- indra/llui/lltoolbarview.h | 3 ++- indra/newview/llfloatertoybox.cpp | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index 1c6cf3230b..12247519ad 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -114,7 +114,7 @@ bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar) } bool LLToolBarView::loadToolbars(bool force_default) -{ +{ LLToolBarView::ToolbarSet toolbar_set; // Load the toolbars.xml file @@ -204,6 +204,19 @@ bool LLToolBarView::loadToolbars(bool force_default) return true; } +//static +bool LLToolBarView::loadDefaultToolbars() +{ + bool retval = false; + + if (gToolBarView) + { + retval = gToolBarView->loadToolbars(true); + } + + return retval; +} + void LLToolBarView::saveToolbars() const { // Build the parameter tree from the toolbar data diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index efe6920db8..95c09ece73 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -72,7 +72,8 @@ public: bool hasCommand(const LLCommandId& commandId) const; // Loads the toolbars from the existing user or default settings bool loadToolbars(bool force_default = false); // return false if load fails - bool loadDefaultToolbars() { return loadToolbars(true); } + + static bool loadDefaultToolbars(); protected: friend class LLUICtrlFactory; diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index d7f114043d..7a6afb4e33 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -61,6 +61,8 @@ BOOL LLFloaterToybox::postBuild() center(); mBtnRestoreDefaults = getChild("btn_restore_defaults"); + mBtnRestoreDefaults->setCommitCallback(boost::bind(&LLToolBarView::loadDefaultToolbars)); + mToolBar = getChild("toybox_toolbar"); LLCommandManager& cmdMgr = LLCommandManager::instance(); -- cgit v1.2.3 From 462f6a00285a92701ecba7cf69d5236f337e0781 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 30 Sep 2011 15:25:41 -0700 Subject: * Updated howto and profile windows to point to different buttons. Web content is still problematic for FUI floaters. --- indra/newview/app_settings/commands.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 224c1b4b48..77bf7cace3 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -70,7 +70,7 @@ label_ref="Command_HowTo_Label" tooltip_ref="Command_HowTo_Tooltip" function="Floater.ToolbarToggle" - parameter="floater_help_browser" + parameter="help_browser" /> Date: Fri, 30 Sep 2011 15:26:48 -0700 Subject: Updated FUI floater toggle function to handle closing windows that are initialized with chrome. --- indra/llui/llfloaterreg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index 8a0513f246..27e96856b3 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -483,7 +483,7 @@ void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname) { showInstance(name, key, TRUE); } - else if (!instance->hasFocus()) + else if (!instance->hasFocus() && !instance->getIsChrome()) { instance->setFocus(TRUE); } -- cgit v1.2.3 From 09e179b2381a4db03309839babae664feb9b0886 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 30 Sep 2011 16:57:08 -0700 Subject: param block cleanup added Flag as value type moved Batch to BatchBlock renamed Choice to ChoiceBlock made merging of parameters for ValueParams consistent (fillFrom and overwriteFrom are inverses of each other now) made iteration over Multiple type params easier initial schema param blocks --- indra/llui/lllineeditor.h | 2 +- indra/llui/llloadingindicator.cpp | 7 +- indra/llui/llloadingindicator.h | 4 +- indra/llui/llnotifications.h | 4 +- indra/llui/llnotificationtemplate.h | 4 +- indra/llui/llnotificationvisibilityrule.h | 2 +- indra/llui/llscrolllistcolumn.h | 4 +- indra/llui/llsdparam.cpp | 6 +- indra/llui/llsdparam.h | 4 +- indra/llui/lltextbase.h | 2 +- indra/llui/lltoolbar.cpp | 6 +- indra/llui/lltoolbarview.h | 4 - indra/llui/llui.cpp | 4 +- indra/llui/llui.h | 2 +- indra/llui/lluicolortable.h | 2 +- indra/llui/lluictrl.h | 4 +- indra/llui/lluictrlfactory.h | 6 +- indra/llui/llview.h | 2 +- indra/llxuixml/llinitparam.cpp | 2 +- indra/llxuixml/llinitparam.h | 452 +++++++++------------ indra/llxuixml/llxuiparser.cpp | 140 ++++++- indra/llxuixml/llxuiparser.h | 6 +- indra/newview/llnamelistctrl.h | 2 +- .../skins/default/xui/en/panel_toolbar_view.xml | 3 - .../skins/default/xui/en/widgets/toolbar.xml | 1 + 25 files changed, 377 insertions(+), 298 deletions(-) diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 583bde360a..2518dbe3c7 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -60,7 +60,7 @@ public: typedef boost::function keystroke_callback_t; - struct MaxLength : public LLInitParam::Choice + struct MaxLength : public LLInitParam::ChoiceBlock { Alternative bytes, chars; diff --git a/indra/llui/llloadingindicator.cpp b/indra/llui/llloadingindicator.cpp index c4eec1835c..6ac38f5ad4 100644 --- a/indra/llui/llloadingindicator.cpp +++ b/indra/llui/llloadingindicator.cpp @@ -34,6 +34,7 @@ // Project includes #include "lluictrlfactory.h" #include "lluiimage.h" +#include "boost/foreach.hpp" // registered in llui.cpp to avoid being left out by MS linker //static LLDefaultChildRegistry::Register r("loading_indicator"); @@ -51,11 +52,9 @@ LLLoadingIndicator::LLLoadingIndicator(const Params& p) void LLLoadingIndicator::initFromParams(const Params& p) { - for (LLInitParam::ParamIterator::const_iterator it = p.images().image.begin(), end_it = p.images().image.end(); - it != end_it; - ++it) + BOOST_FOREACH(LLUIImage* image, p.images.image) { - mImages.push_back(it->getValue()); + mImages.push_back(image); } // Start timer for switching images. diff --git a/indra/llui/llloadingindicator.h b/indra/llui/llloadingindicator.h index 7c44478848..c1f979c111 100644 --- a/indra/llui/llloadingindicator.h +++ b/indra/llui/llloadingindicator.h @@ -51,7 +51,7 @@ class LLLoadingIndicator LOG_CLASS(LLLoadingIndicator); public: - struct Images : public LLInitParam::Block + struct Images : public LLInitParam::BatchBlock { Multiple image; @@ -63,7 +63,7 @@ public: struct Params : public LLInitParam::Block { Optional images_per_sec; - Batch images; + Optional images; Params() : images_per_sec("images_per_sec", 1.0f), diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 0c4d4fc897..462d69be2e 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -201,7 +201,7 @@ public: FormInput(); }; - struct FormElement : public LLInitParam::Choice + struct FormElement : public LLInitParam::ChoiceBlock { Alternative button; Alternative input; @@ -312,7 +312,7 @@ public: Optional context; Optional responder; - struct Functor : public LLInitParam::Choice + struct Functor : public LLInitParam::ChoiceBlock { Alternative name; Alternative function; diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index ab777d37a5..fb50c9c123 100644 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -91,7 +91,7 @@ struct LLNotificationTemplate // // as well as // ... - Flag dummy_val; + Optional dummy_val; public: Multiple contexts; @@ -147,7 +147,7 @@ struct LLNotificationTemplate {} }; - struct FormRef : public LLInitParam::Choice + struct FormRef : public LLInitParam::ChoiceBlock { Alternative form; Alternative form_template; diff --git a/indra/llui/llnotificationvisibilityrule.h b/indra/llui/llnotificationvisibilityrule.h index 78bdec2a8f..78788a275c 100644 --- a/indra/llui/llnotificationvisibilityrule.h +++ b/indra/llui/llnotificationvisibilityrule.h @@ -59,7 +59,7 @@ struct LLNotificationVisibilityRule {} }; - struct Rule : public LLInitParam::Choice + struct Rule : public LLInitParam::ChoiceBlock { Alternative show; Alternative hide; diff --git a/indra/llui/llscrolllistcolumn.h b/indra/llui/llscrolllistcolumn.h index 12baea8e0c..b4d4a6d05e 100644 --- a/indra/llui/llscrolllistcolumn.h +++ b/indra/llui/llscrolllistcolumn.h @@ -95,7 +95,7 @@ public: Optional sort_direction; Optional sort_ascending; - struct Width : public LLInitParam::Choice + struct Width : public LLInitParam::ChoiceBlock { Alternative dynamic_width; Alternative pixel_width; @@ -112,7 +112,7 @@ public: Optional width; // either an image or label is used in column header - struct Header : public LLInitParam::Choice
+ struct Header : public LLInitParam::ChoiceBlock
{ Alternative label; Alternative image; diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 04919e6991..4b69360e33 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -45,7 +45,7 @@ LLParamSDParser::LLParamSDParser() if (sReadFuncs.empty()) { - registerParserFuncs(readNoValue, &LLParamSDParser::writeNoValue); + registerParserFuncs(readFlag, &LLParamSDParser::writeFlag); registerParserFuncs(readS32, &LLParamSDParser::writeTypedValue); registerParserFuncs(readU32, &LLParamSDParser::writeU32Param); registerParserFuncs(readF32, &LLParamSDParser::writeTypedValue); @@ -72,7 +72,7 @@ bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const voi return true; } -bool LLParamSDParser::writeNoValue(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack) +bool LLParamSDParser::writeFlag(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack) { LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; @@ -226,7 +226,7 @@ LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack) return sd_to_write; } -bool LLParamSDParser::readNoValue(Parser& parser, void* val_ptr) +bool LLParamSDParser::readFlag(Parser& parser, void* val_ptr) { LLParamSDParser& self = static_cast(parser); return self.mCurReadSD == &NO_VALUE_MARKER; diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h index f776c781b3..a371c28f68 100644 --- a/indra/llui/llsdparam.h +++ b/indra/llui/llsdparam.h @@ -63,9 +63,9 @@ private: LLSD* getSDWriteNode(const parser_t::name_stack_t& name_stack); static bool writeU32Param(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack); - static bool writeNoValue(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack); + static bool writeFlag(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack); - static bool readNoValue(Parser& parser, void* val_ptr); + static bool readFlag(Parser& parser, void* val_ptr); static bool readS32(Parser& parser, void* val_ptr); static bool readU32(Parser& parser, void* val_ptr); static bool readF32(Parser& parser, void* val_ptr); diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 7d545a1ba6..384d9116fc 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -237,7 +237,7 @@ public: friend class LLNormalTextSegment; friend class LLUICtrlFactory; - struct LineSpacingParams : public LLInitParam::Choice + struct LineSpacingParams : public LLInitParam::ChoiceBlock { Alternative multiple; Alternative pixels; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index caad896a06..d940bed905 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -185,7 +185,7 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) LLPanel::Params button_panel_p(p.button_panel); button_panel_p.rect = center_panel->getLocalRect(); - button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT; + button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT; mButtonPanel = LLUICtrlFactory::create(button_panel_p); center_panel->addChild(mButtonPanel); @@ -558,8 +558,8 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) LLToolBar* bar = getParentByType(); if (view) { - view->startDrag(bar->createButton(mId)); - setVisible(FALSE); + //view->startDrag(bar->createButton(mId)); + //setVisible(FALSE); } } } diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index ea3422f04e..dd2bbf0e49 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -65,10 +65,6 @@ public: virtual ~LLToolBarView(); virtual BOOL postBuild(); virtual void draw(); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual void onMouseCaptureLost(); - void startDrag(LLToolBarButton*); // Toolbar view interface with the rest of the world // Checks if the commandId is being used somewhere in one of the toolbars bool hasCommand(const LLCommandId& commandId) const; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 4f129ccfba..76a12e649b 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -2107,7 +2107,7 @@ namespace LLInitParam void ParamValue >::updateValueFromBlock() { - if (control.isProvided()) + if (control.isProvided() && !control().empty()) { updateValue(LLUIColorTable::instance().getColor(control)); } @@ -2264,9 +2264,11 @@ namespace LLInitParam // in this case, that is left+width and bottom+height LLRect& value = getValue(); + right.set(value.mRight, false); left.set(value.mLeft, make_block_authoritative); width.set(value.getWidth(), make_block_authoritative); + top.set(value.mTop, false); bottom.set(value.mBottom, make_block_authoritative); height.set(value.getHeight(), make_block_authoritative); } diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 7801a01ace..3afb7c65a9 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -365,7 +365,7 @@ template LLRegisterWith LLInitClass::sRegister( template LLRegisterWith LLDestroyClass::sRegister(&T::destroyClass); // useful parameter blocks -struct TimeIntervalParam : public LLInitParam::Choice +struct TimeIntervalParam : public LLInitParam::ChoiceBlock { Alternative seconds; Alternative frames; diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h index 76518789ec..6a7a681d57 100644 --- a/indra/llui/lluicolortable.h +++ b/indra/llui/lluicolortable.h @@ -44,7 +44,7 @@ LOG_CLASS(LLUIColorTable); typedef std::map string_color_map_t; public: - struct ColorParams : LLInitParam::Choice + struct ColorParams : LLInitParam::ChoiceBlock { Alternative value; Alternative reference; diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index fc56e5fc35..a8a4e3191d 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -76,14 +76,14 @@ public: Optional function; }; - struct EnableControls : public LLInitParam::Choice + struct EnableControls : public LLInitParam::ChoiceBlock { Alternative enabled; Alternative disabled; EnableControls(); }; - struct ControlVisibility : public LLInitParam::Choice + struct ControlVisibility : public LLInitParam::ChoiceBlock { Alternative visible; Alternative invisible; diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 71c38237c1..d612ad5005 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -125,12 +125,12 @@ private: // base case for recursion, there are NO base classes of LLInitParam::BaseBlock template - class ParamDefaults : public LLSingleton > + class ParamDefaults : public LLSingleton > { public: - const LLInitParam::BaseBlockWithFlags& get() { return mBaseBlock; } + const LLInitParam::BaseBlock& get() { return mBaseBlock; } private: - LLInitParam::BaseBlockWithFlags mBaseBlock; + LLInitParam::BaseBlock mBaseBlock; }; public: diff --git a/indra/llui/llview.h b/indra/llui/llview.h index f4e31b109a..a1c46f3bf3 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -98,7 +98,7 @@ private: class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElement { public: - struct Follows : public LLInitParam::Choice + struct Follows : public LLInitParam::ChoiceBlock { Alternative string; Alternative flags; diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp index c024fd405e..99016205c8 100644 --- a/indra/llxuixml/llinitparam.cpp +++ b/indra/llxuixml/llinitparam.cpp @@ -365,7 +365,7 @@ namespace LLInitParam // verify by calling readValue with NoParamValue type, an inherently unparseable type if (!names_left) { - NoParamValue no_value; + Flag no_value; return p.readValue(no_value); } diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 69dcd474f7..9a6ded47ff 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -38,6 +38,9 @@ namespace LLInitParam { + // used to indicate no matching value to a given name when parsing + struct Flag{}; + template const T& defaultValue() { static T value; return value; } template ::value > @@ -65,6 +68,12 @@ namespace LLInitParam static bool equals(const LLSD &a, const LLSD &b) { return false; } }; + template<> + struct ParamCompare + { + static bool equals(const Flag& a, const Flag& b) { return false; } + }; + // helper functions and classes typedef ptrdiff_t param_handle_t; @@ -275,9 +284,6 @@ namespace LLInitParam static S32 sNextParseGeneration; }; - // used to indicate no matching value to a given name when parsing - struct NoParamValue{}; - class BaseBlock; class Param @@ -385,36 +391,36 @@ namespace LLInitParam // "Multiple" constraint types, put here in root class to avoid ambiguity during use struct AnyAmount { - static U32 minCount() { return 0; } - static U32 maxCount() { return U32_MAX; } + enum { minCount = 0 }; + enum { maxCount = U32_MAX }; }; template struct AtLeast { - static U32 minCount() { return MIN_AMOUNT; } - static U32 maxCount() { return U32_MAX; } + enum { minCount = MIN_AMOUNT }; + enum { maxCount = U32_MAX }; }; template struct AtMost { - static U32 minCount() { return 0; } - static U32 maxCount() { return MAX_AMOUNT; } + enum { minCount = 0 }; + enum { maxCount = MAX_AMOUNT }; }; template struct Between { - static U32 minCount() { return MIN_AMOUNT; } - static U32 maxCount() { return MAX_AMOUNT; } + enum { minCount = MIN_AMOUNT }; + enum { maxCount = MAX_AMOUNT }; }; template struct Exactly { - static U32 minCount() { return EXACT_COUNT; } - static U32 maxCount() { return EXACT_COUNT; } + enum { minCount = EXACT_COUNT }; + enum { maxCount = EXACT_COUNT }; }; // this typedef identifies derived classes as being blocks @@ -477,9 +483,9 @@ namespace LLInitParam void init(BlockDescriptor& descriptor, BlockDescriptor& base_descriptor, size_t block_size); - bool mergeBlockParam(bool param_provided, BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) + bool mergeBlockParam(bool source_provided, bool dst_provided, BlockDescriptor& block_data, const BaseBlock& source, bool overwrite) { - return mergeBlock(block_data, other, overwrite); + return mergeBlock(block_data, source, overwrite); } // take all provided params from other and apply to self bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite); @@ -497,92 +503,6 @@ namespace LLInitParam const std::string& getParamName(const BlockDescriptor& block_data, const Param* paramp) const; }; - class BaseBlockWithFlags : public BaseBlock - { - public: - class FlagBase : public Param - { - public: - typedef FlagBase self_t; - - FlagBase(const char* name, BaseBlock* enclosing_block) : Param(enclosing_block) - { - if (LL_UNLIKELY(enclosing_block->mostDerivedBlockDescriptor().mInitializationState == BlockDescriptor::INITIALIZING)) - { - ParamDescriptorPtr param_descriptor = ParamDescriptorPtr(new ParamDescriptor( - enclosing_block->getHandleFromParam(this), - &mergeWith, - &deserializeParam, - &serializeParam, - NULL, - &inspectParam, - 0, 1)); - BaseBlock::addParam(enclosing_block->mostDerivedBlockDescriptor(), param_descriptor, name); - } - } - - bool isProvided() const { return anyProvided(); } - - private: - static bool mergeWith(Param& dst, const Param& src, bool overwrite) - { - const self_t& src_typed_param = static_cast(src); - self_t& dst_typed_param = static_cast(dst); - - if (src_typed_param.isProvided() - && (overwrite || !dst_typed_param.isProvided())) - { - dst.setProvided(true); - return true; - } - return false; - } - - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) - { - self_t& typed_param = static_cast(param); - - // no further names in stack, parse value now - if (name_stack.first == name_stack.second) - { - typed_param.setProvided(true); - typed_param.enclosingBlock().paramChanged(param, true); - return true; - } - - return false; - } - - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) - { - const self_t& typed_param = static_cast(param); - const self_t* typed_diff_param = static_cast(diff_param); - - if (!typed_param.isProvided()) return; - - if (!name_stack.empty()) - { - name_stack.back().second = parser.newParseGeneration(); - } - - // then try to serialize value directly - if (!typed_diff_param || !typed_diff_param->isProvided()) - { - if (!parser.writeValue(NoParamValue(), name_stack)) - { - return; - } - } - } - - static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) - { - // tell parser about our actual type - parser.inspectValue(name_stack, min_count, max_count, NULL); - } - }; - }; - // these templates allow us to distinguish between template parameters // that derive from BaseBlock and those that don't template @@ -604,7 +524,7 @@ namespace LLInitParam typedef const T& value_assignment_t; ParamValue(): mValue() {} - ParamValue(const T& other) : mValue(other) {} + ParamValue(value_assignment_t other) : mValue(other) {} void setValue(value_assignment_t val) { @@ -621,6 +541,17 @@ namespace LLInitParam return mValue; } + operator value_assignment_t() const + { + return mValue; + } + + value_assignment_t operator()() const + { + return mValue; + } + + private: T mValue; }; @@ -644,7 +575,7 @@ namespace LLInitParam mValidated(false) {} - ParamValue(const T& other) + ParamValue(value_assignment_t other) : T(other), mKeyVersion(0), mValidatedVersion(-1), @@ -666,6 +597,16 @@ namespace LLInitParam { return *this; } + + operator value_assignment_t() const + { + return *this; + } + + value_assignment_t operator()() const + { + return *this; + } }; template > @@ -801,11 +742,6 @@ namespace LLInitParam Param::enclosingBlock().paramChanged(*this, flag_as_provided); } - // implicit conversion - operator value_assignment_t() const { return param_value_t::getValue(); } - // explicit conversion - value_assignment_t operator()() const { return param_value_t::getValue(); } - protected: static bool mergeWith(Param& dst, const Param& src, bool overwrite) @@ -958,11 +894,6 @@ namespace LLInitParam } } - // implicit conversion - operator value_assignment_t() const { return param_value_t::getValue(); } - // explicit conversion - value_assignment_t operator()() const { return param_value_t::getValue(); } - protected: static bool mergeWith(Param& dst, const Param& src, bool overwrite) @@ -972,8 +903,7 @@ namespace LLInitParam if (src_typed_param.anyProvided()) { - bool param_provided = src_typed_param.isProvided() && (overwrite || !dst_typed_param.isProvided()); - if (dst_typed_param.mergeBlockParam(param_provided, param_value_t::selfBlockDescriptor(), src_typed_param, overwrite)) + if (dst_typed_param.mergeBlockParam(src_typed_param.isProvided(), dst_typed_param.isProvided(), param_value_t::selfBlockDescriptor(), src_typed_param, overwrite)) { dst_typed_param.clearValueName(); dst_typed_param.setProvided(true); @@ -992,8 +922,8 @@ namespace LLInitParam { public: typedef TypedParam self_t; - typedef ParamValue param_value_t; - typedef typename std::vector container_t; + typedef ParamValue param_value_t; + typedef typename std::vector container_t; typedef const container_t& value_assignment_t; typedef VALUE_TYPE value_t; @@ -1118,6 +1048,8 @@ namespace LLInitParam // implicit conversion operator value_assignment_t() const { return mValues; } + // explicit conversion + value_assignment_t operator()() const { return mValues; } typedef typename container_t::iterator iterator; typedef typename container_t::const_iterator const_iterator; @@ -1169,7 +1101,7 @@ namespace LLInitParam public: typedef TypedParam self_t; typedef ParamValue param_value_t; - typedef typename std::vector container_t; + typedef typename std::vector container_t; typedef const container_t& value_assignment_t; typedef VALUE_TYPE value_t; typedef NAME_VALUE_LOOKUP name_value_lookup_t; @@ -1308,6 +1240,8 @@ namespace LLInitParam // implicit conversion operator value_assignment_t() const { return mValues; } + // explicit conversion + value_assignment_t operator()() const { return mValues; } typedef typename container_t::iterator iterator; typedef typename container_t::const_iterator const_iterator; @@ -1363,10 +1297,10 @@ namespace LLInitParam }; template - class Choice : public BaseBlock + class ChoiceBlock : public BaseBlock { - typedef Choice self_t; - typedef Choice enclosing_block_t; + typedef ChoiceBlock self_t; + typedef ChoiceBlock enclosing_block_t; LOG_CLASS(self_t); public: @@ -1382,11 +1316,13 @@ namespace LLInitParam return mergeBlock(selfBlockDescriptor(), other, false); } - bool mergeBlockParam(bool param_provided, BlockDescriptor& block_data, const self_t& other, bool overwrite) + bool mergeBlockParam(bool source_provided, bool dest_provided, BlockDescriptor& block_data, const self_t& source, bool overwrite) { - if (param_provided) + bool source_override = source_provided && (overwrite || !dest_provided); + + if (source_override || source.mCurChoice == mCurChoice) { - return mergeBlock(block_data, other, overwrite); + return mergeBlock(block_data, source, overwrite); } return false; } @@ -1420,7 +1356,7 @@ namespace LLInitParam virtual BlockDescriptor& mostDerivedBlockDescriptor() { return selfBlockDescriptor(); } protected: - Choice() + ChoiceBlock() : mCurChoice(0) { BaseBlock::init(selfBlockDescriptor(), BaseBlock::selfBlockDescriptor(), sizeof(DERIVED_BLOCK)); @@ -1433,13 +1369,13 @@ namespace LLInitParam class Alternative : public TypedParam { public: - friend class Choice; + friend class ChoiceBlock; typedef Alternative self_t; typedef TypedParam >::value> super_t; typedef typename super_t::value_assignment_t value_assignment_t; - explicit Alternative(const char* name, value_assignment_t val = defaultValue()) + explicit Alternative(const char* name = "", value_assignment_t val = defaultValue()) : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1), mOriginalValue(val) { @@ -1454,10 +1390,19 @@ namespace LLInitParam } } - Alternative& operator=(value_assignment_t val) + void choose() + { + static_cast(Param::enclosingBlock()).paramChanged(*this, true); + } + + void chooseAs(value_assignment_t val) + { + super_t::set(val); + } + + void operator=(value_assignment_t val) { super_t::set(val); - return *this; } void operator()(typename super_t::value_assignment_t val) @@ -1466,12 +1411,8 @@ namespace LLInitParam } operator value_assignment_t() const - { - if (static_cast(Param::enclosingBlock()).getCurrentChoice() == this) - { - return super_t::getValue(); - } - return mOriginalValue; + { + return (*this)(); } value_assignment_t operator()() const @@ -1508,7 +1449,7 @@ namespace LLInitParam } }; - template + template class Block : public BASE_BLOCK { @@ -1604,13 +1545,6 @@ namespace LLInitParam }; - class Flag : public BaseBlockWithFlags::FlagBase - { - public: - Flag(const char* name) : FlagBase(name, DERIVED_BLOCK::selfBlockDescriptor().mCurrentBlockPtr) - {} - }; - template > class Multiple : public TypedParam { @@ -1623,7 +1557,7 @@ namespace LLInitParam typedef typename super_t::const_iterator const_iterator; explicit Multiple(const char* name = "") - : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, container_t(), &validate, RANGE::minCount(), RANGE::maxCount()) + : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, container_t(), &validate, RANGE::minCount, RANGE::maxCount) {} Multiple& operator=(value_assignment_t val) @@ -1641,100 +1575,10 @@ namespace LLInitParam static bool validate(const Param* paramp) { U32 num_valid = ((super_t*)paramp)->numValidElements(); - return RANGE::minCount() <= num_valid && num_valid <= RANGE::maxCount(); + return RANGE::minCount <= num_valid && num_valid <= RANGE::maxCount; } }; - template > - class Batch : private TypedParam - { - public: - typedef ParamValue param_value_t; - typedef TypedParam::value> super_t; - typedef Batch self_t; - typedef typename super_t::value_assignment_t value_assignment_t; - typedef typename super_t::value_t value_t; - - struct BatchDefaultValue : public ParamDescriptor::UserData - { - BatchDefaultValue(const T& value) - : mValue(value) - {} - - T mValue; - }; - - explicit Batch(const char* name, value_assignment_t val) - : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1), - mLastParseGeneration(-1) - { - BlockDescriptor& block_descriptor = DERIVED_BLOCK::selfBlockDescriptor(); - if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) - { - ParamDescriptorPtr param_descriptorp = block_descriptor.mCurrentBlockPtr->findParamDescriptor(*this); - - if (param_descriptorp) - { - param_descriptorp->mDeserializeFunc = &deserializeParam; - param_descriptorp->mUserData = new BatchDefaultValue(new param_value_t(val)); - } - } - } - - explicit Batch(const char* name = "") - : super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, defaultValue(), NULL, 0, 1), - mLastParseGeneration(-1) - { - BlockDescriptor& block_descriptor = DERIVED_BLOCK::selfBlockDescriptor(); - if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)) - { - ParamDescriptorPtr param_descriptorp = block_descriptor.mCurrentBlockPtr->findParamDescriptor(*this); - - if (param_descriptorp) - { - param_descriptorp->mDeserializeFunc = &deserializeParam; - } - } - } - - Batch& operator=(value_assignment_t val) - { - set(val); - return *this; - } - - DERIVED_BLOCK& operator()(value_assignment_t val) - { - super_t::set(val); - return static_cast(Param::enclosingBlock()); - } - - using super_t::operator(); - - private: - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) - { - self_t& typed_param = static_cast(param); - - if (generation != typed_param.mLastParseGeneration) - { - ParamDescriptorPtr descriptor = typed_param.enclosingBlock().findParamDescriptor(param); - if (descriptor && static_cast(descriptor->mUserData)) - { - static_cast(typed_param) = (static_cast(descriptor->mUserData))->mValue; - } - else - { - static_cast(typed_param) = param_value_t(value_t()); - } - typed_param.mLastParseGeneration = generation; - } - return super_t::deserializeParam(param, parser, name_stack, generation); - } - - S32 mLastParseGeneration; - }; - class Deprecated : public Param { public: @@ -1769,6 +1613,7 @@ namespace LLInitParam } }; + // different semantics for documentation purposes, but functionally identical typedef Deprecated Ignored; protected: @@ -1790,6 +1635,106 @@ namespace LLInitParam }; + template + class BatchBlock + : public Block + { + public: + typedef BatchBlock self_t; + typedef Block super_t; + + BatchBlock() + : mLastParseGeneration(-1) + {} + + bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, S32 generation) + { + if (generation != mLastParseGeneration) + { + // reset block + *static_cast(this) = defaultBatchValue(); + mLastParseGeneration = generation; + } + return super_t::deserializeBlock(p, name_stack, generation); + } + + bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) + { + if (overwrite) + { + *static_cast(this) = defaultBatchValue(); + mLastParseGeneration = -1; + // merge individual parameters into destination + return super_t::mergeBlock(super_t::selfBlockDescriptor(), src_typed_param, overwrite); + } + return false; + } + protected: + static const DERIVED_BLOCK& defaultBatchValue() + { + static DERIVED_BLOCK default_value; + return default_value; + } + + S32 mLastParseGeneration; + }; + + + + template + class ParamValue , + NAME_VALUE_LOOKUP, + true> + : public Param, + protected BatchBlock + { + typedef const BatchBlock& value_assignment_t; + + ParamValue() + : T(), + mKeyVersion(0), + mValidatedVersion(-1), + mValidated(false) + {} + + ParamValue(value_assignment_t other) + : T(other), + mKeyVersion(0), + mValidatedVersion(-1), + mValidated(false) + { + } + + void setValue(value_assignment_t val) + { + *this = val; + mLastParseGeneration = -1; + } + + value_assignment_t getValue() const + { + return *this; + } + + BatchBlock& getValue() + { + return *this; + } + + operator value_assignment_t() const + { + return *this; + } + + value_assignment_t operator()() const + { + return *this; + } + + }; + template class CustomParamValue : public Block > >, @@ -1955,6 +1900,16 @@ namespace LLInitParam return mValue; } + operator value_assignment_t() const + { + return getValue(); + } + + value_assignment_t operator()() const + { + return getValue(); + } + S32 mKeyVersion; protected: @@ -1965,30 +1920,29 @@ namespace LLInitParam mValue = value; } - bool mergeBlockParam(bool param_provided, BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) + bool mergeBlockParam(bool source_provided, bool dst_provided, BlockDescriptor& block_data, const BaseBlock& source, bool overwrite) { - if (param_provided) - { - return mergeBlock(block_data, other, overwrite); - } - return false; - } + bool source_override = source_provided && (overwrite || !dst_provided); - bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) - { - const derived_t& src_typed_param = static_cast(other); + const derived_t& src_typed_param = static_cast(source); - if (src_typed_param.mValueAge == VALUE_AUTHORITATIVE) + if (source_override && src_typed_param.mValueAge == VALUE_AUTHORITATIVE) { // copy value over setValue(src_typed_param.getValue()); return true; } - else + // merge individual parameters into destination + if (mValueAge == VALUE_AUTHORITATIVE) { - // merge individual parameters into destination - return block_t::mergeBlock(block_t::selfBlockDescriptor(), src_typed_param, overwrite); + static_cast(this)->updateBlockFromValue(dst_provided); } + return mergeBlock(block_data, source, overwrite); + } + + bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& source, bool overwrite) + { + return block_t::mergeBlock(block_data, source, overwrite); } mutable S32 mValidatedVersion; diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index 4af077b22c..c60f656c2c 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -51,6 +51,136 @@ static LLInitParam::Parser::parser_read_func_map_t sXSDReadFuncs; static LLInitParam::Parser::parser_write_func_map_t sXSDWriteFuncs; static LLInitParam::Parser::parser_inspect_func_map_t sXSDInspectFuncs; +struct MaxOccur : public LLInitParam::ChoiceBlock +{ + Alternative count; + Alternative unbounded; + + MaxOccur() + : unbounded("", "unbounded") + {} +}; + +struct Occurs : public LLInitParam::Block +{ + Optional minOccurs; + Optional maxOccurs; + + Occurs() + : minOccurs("minOccurs"), + maxOccurs("maxOccurs") + { + minOccurs = 0; + maxOccurs.unbounded.choose(); + } +}; + + +typedef enum +{ + USE_REQUIRED, + USE_OPTIONAL +} EUse; + +namespace LLInitParam +{ + template<> + struct TypeValues : public TypeValuesHelper + { + static void declareValues() + { + declare("required", USE_REQUIRED); + declare("optional", USE_OPTIONAL); + } + }; +} + +struct Name : public LLInitParam::Block +{ + Mandatory name; + + Name() + : name("name") + {} +}; + +struct Attribute : public LLInitParam::Block +{ + Mandatory name; + Mandatory type; + Mandatory use; + + Attribute() + : name("name"), + type("type"), + use("use") + { + } +}; + +struct ComplexType : public LLInitParam::Block +{ + Multiple attribute; + //Multiple elements; + Optional mixed; + + ComplexType() + : attribute("xs:attribute"), + //elements("xs:element"), + mixed("mixed") + { + mixed = true; + } +}; + +struct Element : public LLInitParam::Block +{ + Mandatory complexType; + Mandatory name; + + Element() + : complexType("xs:complexType") + {} +}; + +struct Elements : public LLInitParam::Block +{ + Multiple elements; + + Elements() + : elements("xs:element") + {} +}; + +struct Schema : public LLInitParam::Block +{ +private: + Mandatory targetNamespace, + xmlns; + +public: + Optional attributeFormDefault, + elementFormDefault, + xs; + + Optional elements; + + void setNameSpace(const std::string& ns) {targetNamespace = ns; xmlns = ns;} + + Schema() + : attributeFormDefault("attributeFormDefault"), + elementFormDefault("elementFormDefault"), + xs("xmlns:xs"), + targetNamespace("targetNamespace"), + xmlns("xmlns"), + elements("xs:choice") + { + attributeFormDefault = "unqualified"; + elementFormDefault = "qualified"; + xs = "http://www.w3.org/2001/XMLSchema"; + } + +}; // // LLXSDWriter @@ -388,7 +518,7 @@ LLXUIParser::LLXUIParser() { if (sXUIReadFuncs.empty()) { - registerParserFuncs(readNoValue, writeNoValue); + registerParserFuncs(readFlag, writeFlag); registerParserFuncs(readBoolValue, writeBoolValue); registerParserFuncs(readStringValue, writeStringValue); registerParserFuncs(readU8Value, writeU8Value); @@ -645,13 +775,13 @@ LLXMLNodePtr LLXUIParser::getNode(const name_stack_t& stack) return (out_node == mWriteRootNode ? LLXMLNodePtr(NULL) : out_node); } -bool LLXUIParser::readNoValue(Parser& parser, void* val_ptr) +bool LLXUIParser::readFlag(Parser& parser, void* val_ptr) { LLXUIParser& self = static_cast(parser); return self.mCurReadNode == DUMMY_NODE; } -bool LLXUIParser::writeNoValue(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeFlag(Parser& parser, const void* val_ptr, const name_stack_t& stack) { // just create node LLXUIParser& self = static_cast(parser); @@ -1083,7 +1213,7 @@ LLSimpleXUIParser::LLSimpleXUIParser(LLSimpleXUIParser::element_start_callback_t { if (sSimpleXUIReadFuncs.empty()) { - registerParserFuncs(readNoValue); + registerParserFuncs(readFlag); registerParserFuncs(readBoolValue); registerParserFuncs(readStringValue); registerParserFuncs(readU8Value); @@ -1376,7 +1506,7 @@ void LLSimpleXUIParser::parserError(const std::string& message) #endif } -bool LLSimpleXUIParser::readNoValue(Parser& parser, void* val_ptr) +bool LLSimpleXUIParser::readFlag(Parser& parser, void* val_ptr) { LLSimpleXUIParser& self = static_cast(parser); return self.mCurAttributeValueBegin == NO_VALUE_MARKER; diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h index 0c38c4da93..42a79b4100 100644 --- a/indra/llxuixml/llxuiparser.h +++ b/indra/llxuixml/llxuiparser.h @@ -116,7 +116,7 @@ private: bool readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block); //reader helper functions - static bool readNoValue(Parser& parser, void* val_ptr); + static bool readFlag(Parser& parser, void* val_ptr); static bool readBoolValue(Parser& parser, void* val_ptr); static bool readStringValue(Parser& parser, void* val_ptr); static bool readU8Value(Parser& parser, void* val_ptr); @@ -133,7 +133,7 @@ private: static bool readSDValue(Parser& parser, void* val_ptr); //writer helper functions - static bool writeNoValue(Parser& parser, const void* val_ptr, const name_stack_t&); + static bool writeFlag(Parser& parser, const void* val_ptr, const name_stack_t&); static bool writeBoolValue(Parser& parser, const void* val_ptr, const name_stack_t&); static bool writeStringValue(Parser& parser, const void* val_ptr, const name_stack_t&); static bool writeU8Value(Parser& parser, const void* val_ptr, const name_stack_t&); @@ -197,7 +197,7 @@ public: private: //reader helper functions - static bool readNoValue(Parser&, void* val_ptr); + static bool readFlag(Parser&, void* val_ptr); static bool readBoolValue(Parser&, void* val_ptr); static bool readStringValue(Parser&, void* val_ptr); static bool readU8Value(Parser&, void* val_ptr); diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index d64fdbe6a5..ca9956dc53 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -61,7 +61,7 @@ public: {} }; - struct NameColumn : public LLInitParam::Choice + struct NameColumn : public LLInitParam::ChoiceBlock { Alternative column_index; Alternative column_name; diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml index fa7632920b..7bbacc0152 100644 --- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml @@ -33,7 +33,6 @@ follows="all" mouse_opaque="false"> Date: Fri, 30 Sep 2011 17:09:16 -0700 Subject: fix for merge --- indra/llui/lltoolbarview.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index 0996577114..12247519ad 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -114,7 +114,7 @@ bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar) } bool LLToolBarView::loadToolbars(bool force_default) -{ +{ LLToolBarView::ToolbarSet toolbar_set; // Load the toolbars.xml file @@ -221,18 +221,19 @@ void LLToolBarView::saveToolbars() const { // Build the parameter tree from the toolbar data LLToolBarView::ToolbarSet toolbar_set; - - // *TODO : factorize that code a bit... if (mToolbarLeft) { + toolbar_set.left_toolbar.button_display_mode = (int)(mToolbarLeft->getButtonType()); addToToolset(mToolbarLeft->getCommandsList(),toolbar_set.left_toolbar); } if (mToolbarRight) { + toolbar_set.right_toolbar.button_display_mode = (int)(mToolbarRight->getButtonType()); addToToolset(mToolbarRight->getCommandsList(),toolbar_set.right_toolbar); } if (mToolbarBottom) { + toolbar_set.bottom_toolbar.button_display_mode = (int)(mToolbarBottom->getButtonType()); addToToolset(mToolbarBottom->getCommandsList(),toolbar_set.bottom_toolbar); } @@ -255,6 +256,19 @@ void LLToolBarView::saveToolbars() const } } +// Enumerate the commands in command_list and add them as Params to the toolbar +void LLToolBarView::addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const +{ + for (command_id_list_t::const_iterator it = command_list.begin(); + it != command_list.end(); + ++it) + { + LLCommandId::Params command; + command.name = it->name(); + toolbar.commands.add(command); + } +} + void LLToolBarView::draw() { static bool debug_print = true; -- cgit v1.2.3 From 63a8fce12b1e1c0d40d97e2f029776fed6e300fb Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 30 Sep 2011 18:51:17 -0700 Subject: made toolbars conform to visual specs added ability to specify clip rects in textures.xml --- indra/llui/lltoolbar.cpp | 17 ++++----- indra/llui/lltoolbar.h | 23 +++++++---- indra/newview/llviewertexturelist.cpp | 44 +++++++++++++++------- indra/newview/llviewertexturelist.h | 7 +++- indra/newview/skins/default/textures/textures.xml | 6 ++- indra/newview/skins/default/xui/en/main_view.xml | 4 +- .../skins/default/xui/en/panel_toolbar_view.xml | 3 ++ .../skins/default/xui/en/widgets/toolbar.xml | 28 +++++++++----- 8 files changed, 87 insertions(+), 45 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 2592fd1229..c62bbe4e71 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -82,9 +82,6 @@ LLToolBar::Params::Params() button_icon_and_text("button_icon_and_text"), read_only("read_only", false), wrap("wrap", true), - min_button_width("min_button_width", 0), - max_button_width("max_button_width", S32_MAX), - button_height("button_height"), pad_left("pad_left"), pad_top("pad_top"), pad_right("pad_right"), @@ -102,9 +99,6 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) mNeedsLayout(false), mButtonPanel(NULL), mCenteringStack(NULL), - mMinButtonWidth(llmin(p.min_button_width(), p.max_button_width())), - mMaxButtonWidth(llmax(p.max_button_width(), p.min_button_width())), - mButtonHeight(p.button_height), mPadLeft(p.pad_left), mPadRight(p.pad_right), mPadTop(p.pad_top), @@ -325,7 +319,7 @@ void LLToolBar::resizeButtonsInRow(std::vector& buttons_in_row { if (getOrientation(mSideType) == LLLayoutStack::HORIZONTAL) { - button->reshape(llclamp(button->getRect().getWidth(), mMinButtonWidth, mMaxButtonWidth), max_row_girth); + button->reshape(llclamp(button->getRect().getWidth(), button->mMinWidth, button->mMaxWidth), max_row_girth); } else // VERTICAL { @@ -384,10 +378,10 @@ void LLToolBar::updateLayoutAsNeeded() BOOST_FOREACH(LLToolBarButton* button, mButtons) { - button->reshape(mMinButtonWidth, mButtonHeight); + button->reshape(button->mMinWidth, button->mDesiredHeight); button->autoResize(); - S32 button_clamped_width = llclamp(button->getRect().getWidth(), mMinButtonWidth, mMaxButtonWidth); + S32 button_clamped_width = llclamp(button->getRect().getWidth(), button->mMinWidth, button->mMaxWidth); S32 button_length = (orientation == LLLayoutStack::HORIZONTAL) ? button_clamped_width : button->getRect().getHeight(); @@ -402,7 +396,7 @@ void LLToolBar::updateLayoutAsNeeded() { if (orientation == LLLayoutStack::VERTICAL) { // row girth (width in this case) is clamped to allowable button widths - max_row_girth = llclamp(max_row_girth, mMinButtonWidth, mMaxButtonWidth); + max_row_girth = llclamp(max_row_girth, button->mMinWidth, button->mMaxWidth); } // make buttons in current row all same girth @@ -546,6 +540,9 @@ LLToolBarButton::LLToolBarButton(const Params& p) : LLButton(p), mMouseDownX(0), mMouseDownY(0), + mMinWidth(p.min_button_width), + mMaxWidth(p.max_button_width), + mDesiredHeight(p.desired_height), mId("") {} diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 0bb95f4e9c..5d64630fa6 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -37,9 +37,20 @@ class LLToolBarButton : public LLButton { + friend class LLToolBar; public: struct Params : public LLInitParam::Block { + Optional min_button_width, + max_button_width, + desired_height; + + Params() + : min_button_width("min_button_width", 0), + max_button_width("max_button_width", S32_MAX), + desired_height("desired_height", 20) + {} + }; LLToolBarButton(const Params& p); @@ -51,6 +62,9 @@ private: LLCommandId mId; S32 mMouseDownX; S32 mMouseDownY; + S32 mMinWidth; + S32 mMaxWidth; + S32 mDesiredHeight; }; @@ -106,10 +120,6 @@ public: Optional read_only, wrap; - Optional min_button_width, - max_button_width, - button_height; - Optional pad_left, pad_top, pad_right, @@ -171,10 +181,7 @@ private: bool mWrap; bool mNeedsLayout; - S32 mMinButtonWidth, - mMaxButtonWidth, - mButtonHeight, - mPadLeft, + S32 mPadLeft, mPadRight, mPadTop, mPadBottom, diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 30ef8b8a29..c64488251a 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1342,7 +1342,8 @@ LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id, S32 priority) const BOOL use_mips = FALSE; const LLRect scale_rect = LLRect::null; - return loadUIImageByID(image_id, use_mips, scale_rect, (LLViewerTexture::EBoostLevel)priority); + const LLRect clip_rect = LLRect::null; + return loadUIImageByID(image_id, use_mips, scale_rect, clip_rect, (LLViewerTexture::EBoostLevel)priority); } LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priority) @@ -1356,32 +1357,33 @@ LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priori const BOOL use_mips = FALSE; const LLRect scale_rect = LLRect::null; - return loadUIImageByName(image_name, image_name, use_mips, scale_rect, (LLViewerTexture::EBoostLevel)priority); + const LLRect clip_rect = LLRect::null; + return loadUIImageByName(image_name, image_name, use_mips, scale_rect, clip_rect, (LLViewerTexture::EBoostLevel)priority); } LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename, - BOOL use_mips, const LLRect& scale_rect, LLViewerTexture::EBoostLevel boost_priority ) + BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority ) { if (boost_priority == LLViewerTexture::BOOST_NONE) { boost_priority = LLViewerTexture::BOOST_UI; } LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, MIPMAP_NO, boost_priority); - return loadUIImage(imagep, name, use_mips, scale_rect); + return loadUIImage(imagep, name, use_mips, scale_rect, clip_rect); } LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, - BOOL use_mips, const LLRect& scale_rect, LLViewerTexture::EBoostLevel boost_priority) + BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority) { if (boost_priority == LLViewerTexture::BOOST_NONE) { boost_priority = LLViewerTexture::BOOST_UI; } LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, MIPMAP_NO, boost_priority); - return loadUIImage(imagep, id.asString(), use_mips, scale_rect); + return loadUIImage(imagep, id.asString(), use_mips, scale_rect, clip_rect); } -LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect) +LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect) { if (!imagep) return NULL; @@ -1402,13 +1404,14 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st LLUIImageLoadData* datap = new LLUIImageLoadData; datap->mImageName = name; datap->mImageScaleRegion = scale_rect; + datap->mImageClipRegion = clip_rect; imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap, NULL); } return new_imagep; } -LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect) +LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect) { // look for existing image uuid_ui_image_map_t::iterator found_it = mUIImages.find(name); @@ -1418,7 +1421,7 @@ LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::s llerrs << "UI Image " << name << " already loaded." << llendl; } - return loadUIImageByName(name, filename, use_mips, scale_rect); + return loadUIImageByName(name, filename, use_mips, scale_rect, clip_rect); } //static @@ -1432,6 +1435,7 @@ void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_v LLUIImageLoadData* image_datap = (LLUIImageLoadData*)user_data; std::string ui_image_name = image_datap->mImageName; LLRect scale_rect = image_datap->mImageScaleRegion; + LLRect clip_rect = image_datap->mImageClipRegion; if (final) { delete image_datap; @@ -1448,9 +1452,21 @@ void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_v // from power-of-2 gl image if (success && imagep.notNull() && src_vi && (src_vi->getUrl().compare(0, 7, "file://")==0)) { - F32 clip_x = (F32)src_vi->getOriginalWidth() / (F32)src_vi->getFullWidth(); - F32 clip_y = (F32)src_vi->getOriginalHeight() / (F32)src_vi->getFullHeight(); - imagep->setClipRegion(LLRectf(0.f, clip_y, clip_x, 0.f)); + F32 full_width = (F32)src_vi->getFullWidth(); + F32 full_height = (F32)src_vi->getFullHeight(); + F32 clip_x = (F32)src_vi->getOriginalWidth() / full_width; + F32 clip_y = (F32)src_vi->getOriginalHeight() / full_height; + if (clip_rect != LLRect::null) + { + imagep->setClipRegion(LLRectf(llclamp((F32)clip_rect.mLeft / full_width, 0.f, 1.f), + llclamp((F32)clip_rect.mTop / full_height, 0.f, 1.f), + llclamp((F32)clip_rect.mRight / full_width, 0.f, 1.f), + llclamp((F32)clip_rect.mBottom / full_height, 0.f, 1.f))); + } + else + { + imagep->setClipRegion(LLRectf(0.f, clip_y, clip_x, 0.f)); + } if (scale_rect != LLRect::null) { imagep->setScaleRegion( @@ -1471,6 +1487,7 @@ struct UIImageDeclaration : public LLInitParam::Block Optional file_name; Optional preload; Optional scale; + Optional clip; Optional use_mips; UIImageDeclaration() @@ -1478,6 +1495,7 @@ struct UIImageDeclaration : public LLInitParam::Block file_name("file_name"), preload("preload", false), scale("scale"), + clip("clip"), use_mips("use_mips", false) {} }; @@ -1572,7 +1590,7 @@ bool LLUIImageList::initFromFile() { continue; } - preloadUIImage(image.name, file_name, image.use_mips, image.scale); + preloadUIImage(image.name, file_name, image.use_mips, image.scale, image.clip); } if (cur_pass == PASS_DECODE_NOW && !gSavedSettings.getBOOL("NoPreload")) diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 7f4dd0ae88..e0a362596d 100644 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -220,24 +220,27 @@ public: bool initFromFile(); - LLPointer preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect); + LLPointer preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect); static void onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); private: LLPointer loadUIImageByName(const std::string& name, const std::string& filename, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, + const LLRect& clip_rect = LLRect::null, LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_UI); LLPointer loadUIImageByID(const LLUUID& id, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, + const LLRect& clip_rect = LLRect::null, LLViewerTexture::EBoostLevel boost_priority = LLViewerTexture::BOOST_UI); - LLPointer loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null); + LLPointer loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null); struct LLUIImageLoadData { std::string mImageName; LLRect mImageScaleRegion; + LLRect mImageClipRegion; }; typedef std::map< std::string, LLPointer > uuid_ui_image_map_t; diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 4462fb792f..68773947ec 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -473,7 +473,11 @@ with the same filename but different name - + + + + + diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index d8f593715f..cf566d7d23 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -100,12 +100,12 @@ visible="false" width="500"/> - + visible="false"/>--> diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml index 7bbacc0152..44da813f61 100644 --- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml @@ -39,6 +39,7 @@ width="30" mouse_opaque="false"> - - - Date: Mon, 3 Oct 2011 11:28:22 -0700 Subject: updated xui for toybox to reflect changes to param blocks --- indra/newview/skins/default/xui/en/floater_toybox.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index feb19571b2..de39032cbf 100644 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -48,8 +48,8 @@ button_display_mode="icons_with_text" follows="all" left="20" - max_button_width="140" - min_button_width="70" + button_icon_and_text.max_button_width="140" + button_icon_and_text.min_button_width="70" name="toybox_toolbar" pad_left="5" pad_right="5" -- cgit v1.2.3 From cd467cc34f876920b35d3570f50dbad54ce4a42c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 3 Oct 2011 16:27:24 -0700 Subject: EXP-1286 : First pass at Drag and Drop of tools. Not functional. Most hooks into the LLToolDragAndDrop system in to support the new AT_WIDGET and SOURCE_VIEWER --- indra/llcommon/llassettype.cpp | 3 +- indra/llcommon/llassettype.h | 8 +- indra/llcommon/stdenums.h | 5 +- indra/llinventory/llinventorytype.cpp | 5 +- indra/llinventory/llinventorytype.h | 3 +- indra/llui/CMakeLists.txt | 5 +- indra/llui/llclipboard.cpp | 6 + indra/llui/llclipboard.h | 9 +- indra/llui/lltoolbar.cpp | 55 +++++ indra/llui/lltoolbar.h | 32 ++- indra/llui/lltoolbarview.cpp | 311 --------------------------- indra/llui/lltoolbarview.h | 96 --------- indra/newview/CMakeLists.txt | 2 + indra/newview/lltoolbarview.cpp | 390 ++++++++++++++++++++++++++++++++++ indra/newview/lltoolbarview.h | 102 +++++++++ indra/newview/lltooldraganddrop.cpp | 5 + indra/newview/lltooldraganddrop.h | 3 +- indra/newview/llviewerassettype.cpp | 4 +- 18 files changed, 621 insertions(+), 423 deletions(-) delete mode 100644 indra/llui/lltoolbarview.cpp delete mode 100644 indra/llui/lltoolbarview.h create mode 100644 indra/newview/lltoolbarview.cpp create mode 100644 indra/newview/lltoolbarview.h diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp index 145dddd543..5e566d6c7c 100644 --- a/indra/llcommon/llassettype.cpp +++ b/indra/llcommon/llassettype.cpp @@ -93,7 +93,8 @@ LLAssetDictionary::LLAssetDictionary() addEntry(LLAssetType::AT_LINK, new AssetEntry("LINK", "link", "sym link", false, false, true)); addEntry(LLAssetType::AT_LINK_FOLDER, new AssetEntry("FOLDER_LINK", "link_f", "sym folder link", false, false, true)); - addEntry(LLAssetType::AT_MESH, new AssetEntry("MESH", "mesh", "mesh", false, false, false)); + addEntry(LLAssetType::AT_MESH, new AssetEntry("MESH", "mesh", "mesh", false, false, false)); + addEntry(LLAssetType::AT_WIDGET, new AssetEntry("WIDGET", "widget", "widget", false, false, false)); addEntry(LLAssetType::AT_NONE, new AssetEntry("NONE", "-1", NULL, FALSE, FALSE, FALSE)); }; diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index 74ccd00324..d538accbf7 100644 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -108,9 +108,13 @@ public: AT_LINK_FOLDER = 25, // Inventory folder link + + AT_WIDGET = 40, + // UI Widget: this is *not* an inventory asset type, only a viewer side asset (e.g. button, other ui items...) + AT_MESH = 49, - // Mesh data in our proprietary SLM format - + // Mesh data in our proprietary SLM format + AT_COUNT = 50, // +*********************************************************+ diff --git a/indra/llcommon/stdenums.h b/indra/llcommon/stdenums.h index 556eff8370..40b3364b36 100644 --- a/indra/llcommon/stdenums.h +++ b/indra/llcommon/stdenums.h @@ -49,8 +49,9 @@ enum EDragAndDropType DAD_ANIMATION = 12, DAD_GESTURE = 13, DAD_LINK = 14, - DAD_MESH = 15, - DAD_COUNT = 16, // number of types in this enum + DAD_MESH = 15, + DAD_WIDGET = 16, + DAD_COUNT = 17, // number of types in this enum }; // Reasons for drags to be denied. diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp index d2bba21648..8282d79b67 100644 --- a/indra/llinventory/llinventorytype.cpp +++ b/indra/llinventory/llinventorytype.cpp @@ -84,6 +84,7 @@ LLInventoryDictionary::LLInventoryDictionary() addEntry(LLInventoryType::IT_ANIMATION, new InventoryEntry("animation", "animation", 1, LLAssetType::AT_ANIMATION)); addEntry(LLInventoryType::IT_GESTURE, new InventoryEntry("gesture", "gesture", 1, LLAssetType::AT_GESTURE)); addEntry(LLInventoryType::IT_MESH, new InventoryEntry("mesh", "mesh", 1, LLAssetType::AT_MESH)); + addEntry(LLInventoryType::IT_WIDGET, new InventoryEntry("widget", "widget", 1, LLAssetType::AT_WIDGET)); } @@ -134,7 +135,7 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] = LLInventoryType::IT_NONE, // 37 AT_NONE LLInventoryType::IT_NONE, // 38 AT_NONE LLInventoryType::IT_NONE, // 39 AT_NONE - LLInventoryType::IT_NONE, // 40 AT_NONE + LLInventoryType::IT_WIDGET, // 40 AT_WIDGET LLInventoryType::IT_NONE, // 41 AT_NONE LLInventoryType::IT_NONE, // 42 AT_NONE LLInventoryType::IT_NONE, // 43 AT_NONE @@ -143,7 +144,7 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] = LLInventoryType::IT_NONE, // 46 AT_NONE LLInventoryType::IT_NONE, // 47 AT_NONE LLInventoryType::IT_NONE, // 48 AT_NONE - LLInventoryType::IT_MESH // 49 AT_MESH + LLInventoryType::IT_MESH, // 49 AT_MESH }; // static diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h index 1a24e351ad..4d1e0db040 100644 --- a/indra/llinventory/llinventorytype.h +++ b/indra/llinventory/llinventorytype.h @@ -62,7 +62,8 @@ public: IT_ANIMATION = 19, IT_GESTURE = 20, IT_MESH = 22, - IT_COUNT = 23, + IT_WIDGET = 23, + IT_COUNT = 24, IT_NONE = -1 }; diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 4212812558..dded8ab661 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -5,6 +5,7 @@ project(llui) include(00-Common) include(LLCommon) include(LLImage) +include(LLInventory) include(LLMath) include(LLMessage) include(LLRender) @@ -16,6 +17,7 @@ include(LLXUIXML) include_directories( ${LLCOMMON_INCLUDE_DIRS} ${LLIMAGE_INCLUDE_DIRS} + ${LLINVENTORY_INCLUDE_DIRS} ${LLMATH_INCLUDE_DIRS} ${LLMESSAGE_INCLUDE_DIRS} ${LLRENDER_INCLUDE_DIRS} @@ -101,7 +103,6 @@ set(llui_SOURCE_FILES lltransutil.cpp lltoggleablemenu.cpp lltoolbar.cpp - lltoolbarview.cpp lltooltip.cpp llui.cpp lluicolortable.cpp @@ -205,7 +206,6 @@ set(llui_HEADER_FILES lltimectrl.h lltoggleablemenu.h lltoolbar.h - lltoolbarview.h lltooltip.h lltransutil.h lluicolortable.h @@ -251,6 +251,7 @@ target_link_libraries(llui ${LLRENDER_LIBRARIES} ${LLWINDOW_LIBRARIES} ${LLIMAGE_LIBRARIES} + ${LLINVENTORY_LIBRARIES} ${LLVFS_LIBRARIES} # ugh, just for LLDir ${LLXUIXML_LIBRARIES} ${LLXML_LIBRARIES} diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 984c4ec5fb..6910b962a1 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -40,6 +40,7 @@ LLClipboard gClipboard; LLClipboard::LLClipboard() { + mSourceItem = NULL; } @@ -134,3 +135,8 @@ BOOL LLClipboard::canPastePrimaryString() const { return LLView::getWindow()->isPrimaryTextAvailable(); } + +void LLClipboard::setSourceObject(const LLUUID& source_id, LLAssetType::EType type) +{ + mSourceItem = new LLInventoryObject (source_id, LLUUID::null, type, ""); +} diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 24cb46c3f4..9371b94284 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -30,6 +30,8 @@ #include "llstring.h" #include "lluuid.h" +#include "stdenums.h" +#include "llinventory.h" class LLClipboard @@ -52,9 +54,14 @@ public: BOOL canPastePrimaryString() const; const LLWString& getPastePrimaryWString(LLUUID* source_id = NULL); + // Support clipboard for object known only by their uuid and asset type + void setSourceObject(const LLUUID& source_id, LLAssetType::EType type); + const LLInventoryObject* getSourceObject() { return mSourceItem; } + private: - LLUUID mSourceID; + LLUUID mSourceID; LLWString mString; + LLInventoryObject* mSourceItem; }; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 75c7d91f8a..5300de38a0 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -113,6 +113,7 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) { mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text; mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon; + mUUID = LLUUID::LLUUID::generateNewID(p.name); } LLToolBar::~LLToolBar() @@ -534,6 +535,8 @@ void LLToolBar::createButton(const LLCommandId& id) cbParam.function_name = commandp->functionName(); cbParam.parameter = commandp->parameter(); button->setCommitCallback(cbParam); + button->setStartDragCallback(mStartDragItemCallback); + button->setHandleDragCallback(mHandleDragItemCallback); } mButtons.push_back(button); @@ -541,3 +544,55 @@ void LLToolBar::createButton(const LLCommandId& id) mNeedsLayout = true; } + +BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + llinfos << "Merov debug : handleDragAndDrop. drop = " << drop << ", tooltip = " << tooltip_msg << llendl; + // If we have a drop callback, that means that we can handle the drop + BOOL handled = (mHandleDropCallback ? TRUE : FALSE); + + // if drop, time to call the drop callback to get the operation done + if (handled && drop) + { + handled = mHandleDropCallback(cargo_type,cargo_data,mUUID); + } + + // We accept multi drop by default + *accept = (handled ? ACCEPT_YES_MULTI : ACCEPT_NO); + + // We'll use that flag to change the visual aspect of the target on draw() + mDragAndDropTarget = handled; + + return handled; +} + +LLToolBarButton::LLToolBarButton(const Params& p) : LLButton(p) +{ + mUUID = LLUUID::LLUUID::generateNewID(p.name); +} + +BOOL LLToolBarButton::handleHover( S32 x, S32 y, MASK mask ) +{ +// llinfos << "Merov debug: handleHover, x = " << x << ", y = " << y << ", mouse = " << hasMouseCapture() << llendl; + BOOL handled = FALSE; + + if (hasMouseCapture() && mStartDragItemCallback && mHandleDragItemCallback) + { + if (!mIsDragged) + { + mStartDragItemCallback(x,y,mUUID); + mIsDragged = true; + handled = TRUE; + } + else + { + handled = mHandleDragItemCallback(x,y,mUUID,LLAssetType::AT_WIDGET); + } + } + return handled; +} + diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 03b1756988..6dcf620861 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -33,7 +33,11 @@ #include "lllayoutstack.h" #include "lluictrl.h" #include "llcommandmanager.h" +#include "llassettype.h" +typedef boost::function startdrag_callback_t; +typedef boost::function handledrag_callback_t; +typedef boost::function handledrop_callback_t; class LLToolBarButton : public LLButton { @@ -42,7 +46,17 @@ public: { }; - LLToolBarButton(const Params& p) : LLButton(p) {} + LLToolBarButton(const Params& p); + + virtual BOOL handleHover( S32 x, S32 y, MASK mask ); + + void setStartDragCallback(startdrag_callback_t cb) { mStartDragItemCallback = cb; } + void setHandleDragCallback(handledrag_callback_t cb) { mHandleDragItemCallback = cb; } +protected: + bool mIsDragged; + startdrag_callback_t mStartDragItemCallback; + handledrag_callback_t mHandleDragItemCallback; + LLUUID mUUID; }; @@ -86,7 +100,6 @@ class LLToolBar : public LLUICtrl { public: - struct Params : public LLInitParam::Block { Mandatory button_display_mode; @@ -119,10 +132,18 @@ public: void draw(); void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - + virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); + bool addCommand(const LLCommandId& commandId); bool hasCommand(const LLCommandId& commandId) const; bool enableCommand(const LLCommandId& commandId, bool enabled); + void setStartDragCallback(startdrag_callback_t cb) { mStartDragItemCallback = cb; } + void setHandleDragCallback(handledrag_callback_t cb) { mHandleDragItemCallback = cb; } + void setHandleDropCallback(handledrop_callback_t cb) { mHandleDropCallback = cb; } protected: friend class LLUICtrlFactory; @@ -130,6 +151,10 @@ protected: ~LLToolBar(); void initFromParams(const Params&); + startdrag_callback_t mStartDragItemCallback; + handledrag_callback_t mHandleDragItemCallback; + handledrop_callback_t mHandleDropCallback; + bool mDragAndDropTarget; public: // Methods used in loading and saving toolbar settings @@ -147,6 +172,7 @@ private: BOOL isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); + LLUUID mUUID; const bool mReadOnly; std::list mButtons; diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp deleted file mode 100644 index 1c6cf3230b..0000000000 --- a/indra/llui/lltoolbarview.cpp +++ /dev/null @@ -1,311 +0,0 @@ -/** - * @file lltoolbarview.cpp - * @author Merov Linden - * @brief User customizable toolbar class - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "lltoolbarview.h" - -#include "lldir.h" -#include "llxmlnode.h" -#include "lltoolbar.h" -#include "llbutton.h" - -#include - -LLToolBarView* gToolBarView = NULL; - -static LLDefaultChildRegistry::Register r("toolbar_view"); - -LLToolBarView::Toolbar::Toolbar() -: button_display_mode("button_display_mode"), - commands("command") -{} - -LLToolBarView::ToolbarSet::ToolbarSet() -: left_toolbar("left_toolbar"), - right_toolbar("right_toolbar"), - bottom_toolbar("bottom_toolbar") -{} - - -LLToolBarView::LLToolBarView(const LLToolBarView::Params& p) -: LLUICtrl(p), - mToolbarLeft(NULL), - mToolbarRight(NULL), - mToolbarBottom(NULL) -{ -} - -void LLToolBarView::initFromParams(const LLToolBarView::Params& p) -{ - // Initialize the base object - LLUICtrl::initFromParams(p); -} - -LLToolBarView::~LLToolBarView() -{ - saveToolbars(); -} - -BOOL LLToolBarView::postBuild() -{ - mToolbarLeft = getChild("toolbar_left"); - mToolbarRight = getChild("toolbar_right"); - mToolbarBottom = getChild("toolbar_bottom"); - - return TRUE; -} - -bool LLToolBarView::hasCommand(const LLCommandId& commandId) const -{ - bool has_command = false; - if (mToolbarLeft && !has_command) - { - has_command = mToolbarLeft->hasCommand(commandId); - } - if (mToolbarRight && !has_command) - { - has_command = mToolbarRight->hasCommand(commandId); - } - if (mToolbarBottom && !has_command) - { - has_command = mToolbarBottom->hasCommand(commandId); - } - return has_command; -} - -bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar) -{ - LLCommandManager& mgr = LLCommandManager::instance(); - if (mgr.getCommand(command)) - { - toolbar->addCommand(command); - } - else - { - llwarns << "Toolbars creation : the command " << command.name() << " cannot be found in the command manager" << llendl; - return false; - } - return true; -} - -bool LLToolBarView::loadToolbars(bool force_default) -{ - LLToolBarView::ToolbarSet toolbar_set; - - // Load the toolbars.xml file - std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml"); - if (force_default) - { - toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); - } - else if (!gDirUtilp->fileExists(toolbar_file)) - { - llwarns << "User toolbars def not found -> use default" << llendl; - toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); - } - - LLXMLNodePtr root; - if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) - { - llerrs << "Unable to load toolbars from file: " << toolbar_file << llendl; - return false; - } - if(!root->hasName("toolbars")) - { - llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl; - return false; - } - - // Parse the toolbar settings - LLXUIParser parser; - parser.readXUI(root, toolbar_set, toolbar_file); - if (!toolbar_set.validateBlock()) - { - llerrs << "Unable to validate toolbars from file: " << toolbar_file << llendl; - return false; - } - - // Clear the toolbars now before adding the loaded commands and settings - if (mToolbarLeft) - { - mToolbarLeft->clearCommandsList(); - } - if (mToolbarRight) - { - mToolbarRight->clearCommandsList(); - } - if (mToolbarBottom) - { - mToolbarBottom->clearCommandsList(); - } - - // Add commands to each toolbar - if (toolbar_set.left_toolbar.isProvided() && mToolbarLeft) - { - if (toolbar_set.left_toolbar.button_display_mode.isProvided()) - { - U32 button_type = toolbar_set.left_toolbar.button_display_mode; - mToolbarLeft->setButtonType((LLToolBarEnums::ButtonType)(button_type)); - } - BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.left_toolbar.commands) - { - addCommand(LLCommandId(command),mToolbarLeft); - } - } - if (toolbar_set.right_toolbar.isProvided() && mToolbarRight) - { - if (toolbar_set.right_toolbar.button_display_mode.isProvided()) - { - U32 button_type = toolbar_set.right_toolbar.button_display_mode; - mToolbarRight->setButtonType((LLToolBarEnums::ButtonType)(button_type)); - } - BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.right_toolbar.commands) - { - addCommand(LLCommandId(command),mToolbarRight); - } - } - if (toolbar_set.bottom_toolbar.isProvided() && mToolbarBottom) - { - if (toolbar_set.bottom_toolbar.button_display_mode.isProvided()) - { - U32 button_type = toolbar_set.bottom_toolbar.button_display_mode; - mToolbarBottom->setButtonType((LLToolBarEnums::ButtonType)(button_type)); - } - BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.bottom_toolbar.commands) - { - addCommand(LLCommandId(command),mToolbarBottom); - } - } - return true; -} - -void LLToolBarView::saveToolbars() const -{ - // Build the parameter tree from the toolbar data - LLToolBarView::ToolbarSet toolbar_set; - if (mToolbarLeft) - { - toolbar_set.left_toolbar.button_display_mode = (int)(mToolbarLeft->getButtonType()); - addToToolset(mToolbarLeft->getCommandsList(),toolbar_set.left_toolbar); - } - if (mToolbarRight) - { - toolbar_set.right_toolbar.button_display_mode = (int)(mToolbarRight->getButtonType()); - addToToolset(mToolbarRight->getCommandsList(),toolbar_set.right_toolbar); - } - if (mToolbarBottom) - { - toolbar_set.bottom_toolbar.button_display_mode = (int)(mToolbarBottom->getButtonType()); - addToToolset(mToolbarBottom->getCommandsList(),toolbar_set.bottom_toolbar); - } - - // Serialize the parameter tree - LLXMLNodePtr output_node = new LLXMLNode("toolbars", false); - LLXUIParser parser; - parser.writeXUI(output_node, toolbar_set); - - // Write the resulting XML to file - if(!output_node->isNull()) - { - const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml"); - LLFILE *fp = LLFile::fopen(filename, "w"); - if (fp != NULL) - { - LLXMLNode::writeHeaderToFile(fp); - output_node->writeToFile(fp); - fclose(fp); - } - } -} - -// Enumerate the commands in command_list and add them as Params to the toolbar -void LLToolBarView::addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const -{ - for (command_id_list_t::const_iterator it = command_list.begin(); - it != command_list.end(); - ++it) - { - LLCommandId::Params command; - command.name = it->name(); - toolbar.commands.add(command); - } -} - -void LLToolBarView::draw() -{ - static bool debug_print = true; - static S32 old_width = 0; - static S32 old_height = 0; - - //LLPanel* sizer_left = getChild("sizer_left"); - - LLRect bottom_rect, left_rect, right_rect; - - if (mToolbarBottom) - { - mToolbarBottom->getParent()->reshape(mToolbarBottom->getParent()->getRect().getWidth(), mToolbarBottom->getRect().getHeight()); - mToolbarBottom->localRectToOtherView(mToolbarBottom->getLocalRect(), &bottom_rect, this); - } - if (mToolbarLeft) - { - mToolbarLeft->getParent()->reshape(mToolbarLeft->getRect().getWidth(), mToolbarLeft->getParent()->getRect().getHeight()); - mToolbarLeft->localRectToOtherView(mToolbarLeft->getLocalRect(), &left_rect, this); - } - if (mToolbarRight) - { - mToolbarRight->getParent()->reshape(mToolbarRight->getRect().getWidth(), mToolbarRight->getParent()->getRect().getHeight()); - mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this); - } - - if ((old_width != getRect().getWidth()) || (old_height != getRect().getHeight())) - debug_print = true; - if (debug_print) - { - LLRect ctrl_rect = getRect(); - llinfos << "Merov debug : draw control rect = " << ctrl_rect.mLeft << ", " << ctrl_rect.mTop << ", " << ctrl_rect.mRight << ", " << ctrl_rect.mBottom << llendl; - llinfos << "Merov debug : draw bottom rect = " << bottom_rect.mLeft << ", " << bottom_rect.mTop << ", " << bottom_rect.mRight << ", " << bottom_rect.mBottom << llendl; - llinfos << "Merov debug : draw left rect = " << left_rect.mLeft << ", " << left_rect.mTop << ", " << left_rect.mRight << ", " << left_rect.mBottom << llendl; - llinfos << "Merov debug : draw right rect = " << right_rect.mLeft << ", " << right_rect.mTop << ", " << right_rect.mRight << ", " << right_rect.mBottom << llendl; - old_width = ctrl_rect.getWidth(); - old_height = ctrl_rect.getHeight(); - debug_print = false; - } - // Debug draw - LLColor4 back_color = LLColor4::blue; - LLColor4 back_color_vert = LLColor4::red; - LLColor4 back_color_hori = LLColor4::yellow; - back_color[VALPHA] = 0.5f; - back_color_hori[VALPHA] = 0.5f; - back_color_vert[VALPHA] = 0.5f; - //gl_rect_2d(getLocalRect(), back_color, TRUE); - //gl_rect_2d(bottom_rect, back_color_hori, TRUE); - //gl_rect_2d(left_rect, back_color_vert, TRUE); - //gl_rect_2d(right_rect, back_color_vert, TRUE); - - LLUICtrl::draw(); -} diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h deleted file mode 100644 index efe6920db8..0000000000 --- a/indra/llui/lltoolbarview.h +++ /dev/null @@ -1,96 +0,0 @@ -/** - * @file lltoolbarview.h - * @author Merov Linden - * @brief User customizable toolbar class - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLTOOLBARVIEW_H -#define LL_LLTOOLBARVIEW_H - -#include "lluictrl.h" -#include "lltoolbar.h" -#include "llcommandmanager.h" - -class LLUICtrlFactory; - -// Parent of all LLToolBar - -class LLToolBarView : public LLUICtrl -{ -public: - // Xui structure of the toolbar panel - struct Params : public LLInitParam::Block {}; - - // Note: valid children for LLToolBarView are stored in this registry - typedef LLDefaultChildRegistry child_registry_t; - - // Xml structure of the toolbars.xml setting - // Those live in a toolbars.xml found in app_settings (for the default) and in - // the user folder for the user specific (saved) settings - struct Toolbar : public LLInitParam::Block - { - Mandatory button_display_mode; - Multiple commands; - Toolbar(); - }; - struct ToolbarSet : public LLInitParam::Block - { - Optional left_toolbar, - right_toolbar, - bottom_toolbar; - ToolbarSet(); - }; - - // Derived methods - virtual ~LLToolBarView(); - virtual BOOL postBuild(); - virtual void draw(); - - // Toolbar view interface with the rest of the world - // Checks if the commandId is being used somewhere in one of the toolbars - bool hasCommand(const LLCommandId& commandId) const; - // Loads the toolbars from the existing user or default settings - bool loadToolbars(bool force_default = false); // return false if load fails - bool loadDefaultToolbars() { return loadToolbars(true); } - -protected: - friend class LLUICtrlFactory; - LLToolBarView(const Params&); - - void initFromParams(const Params&); - -private: - void saveToolbars() const; - bool addCommand(const LLCommandId& commandId, LLToolBar* toolbar); - void addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const; - - // Pointers to the toolbars handled by the toolbar view - LLToolBar* mToolbarLeft; - LLToolBar* mToolbarRight; - LLToolBar* mToolbarBottom; -}; - -extern LLToolBarView* gToolBarView; - -#endif // LL_LLTOOLBARVIEW_H diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index c488d51ba5..ce47cca16f 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -481,6 +481,7 @@ set(viewer_SOURCE_FILES lltoastpanel.cpp lltoastscripttextbox.cpp lltool.cpp + lltoolbarview.cpp lltoolbrush.cpp lltoolcomp.cpp lltooldraganddrop.cpp @@ -1039,6 +1040,7 @@ set(viewer_HEADER_FILES lltoastpanel.h lltoastscripttextbox.h lltool.h + lltoolbarview.h lltoolbrush.h lltoolcomp.h lltooldraganddrop.h diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp new file mode 100644 index 0000000000..929486a185 --- /dev/null +++ b/indra/newview/lltoolbarview.cpp @@ -0,0 +1,390 @@ +/** + * @file lltoolbarview.cpp + * @author Merov Linden + * @brief User customizable toolbar class + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "lltoolbarview.h" + +#include "lldir.h" +#include "llxmlnode.h" +#include "lltoolbar.h" +#include "llbutton.h" +#include "lltooldraganddrop.h" +#include "llclipboard.h" + +#include + +LLToolBarView* gToolBarView = NULL; + +static LLDefaultChildRegistry::Register r("toolbar_view"); +bool LLToolBarView::sDragStarted = false; + +LLToolBarView::Toolbar::Toolbar() +: button_display_mode("button_display_mode"), + commands("command") +{} + +LLToolBarView::ToolbarSet::ToolbarSet() +: left_toolbar("left_toolbar"), + right_toolbar("right_toolbar"), + bottom_toolbar("bottom_toolbar") +{} + + +LLToolBarView::LLToolBarView(const LLToolBarView::Params& p) +: LLUICtrl(p), + mToolbarLeft(NULL), + mToolbarRight(NULL), + mToolbarBottom(NULL) +{ +} + +void LLToolBarView::initFromParams(const LLToolBarView::Params& p) +{ + // Initialize the base object + LLUICtrl::initFromParams(p); +} + +LLToolBarView::~LLToolBarView() +{ + saveToolbars(); +} + +BOOL LLToolBarView::postBuild() +{ + mToolbarLeft = getChild("toolbar_left"); + mToolbarRight = getChild("toolbar_right"); + mToolbarBottom = getChild("toolbar_bottom"); + + mToolbarLeft->setStartDragCallback(boost::bind(LLToolBarView::startDragItem,_1,_2,_3)); + mToolbarLeft->setHandleDragCallback(boost::bind(LLToolBarView::handleDragItem,_1,_2,_3,_4)); + mToolbarLeft->setHandleDropCallback(boost::bind(LLToolBarView::handleDrop,_1,_2,_3)); + + mToolbarRight->setStartDragCallback(boost::bind(LLToolBarView::startDragItem,_1,_2,_3)); + mToolbarRight->setHandleDragCallback(boost::bind(LLToolBarView::handleDragItem,_1,_2,_3,_4)); + mToolbarRight->setHandleDropCallback(boost::bind(LLToolBarView::handleDrop,_1,_2,_3)); + + mToolbarBottom->setStartDragCallback(boost::bind(LLToolBarView::startDragItem,_1,_2,_3)); + mToolbarBottom->setHandleDragCallback(boost::bind(LLToolBarView::handleDragItem,_1,_2,_3,_4)); + mToolbarBottom->setHandleDropCallback(boost::bind(LLToolBarView::handleDrop,_1,_2,_3)); + + return TRUE; +} + +bool LLToolBarView::hasCommand(const LLCommandId& commandId) const +{ + bool has_command = false; + if (mToolbarLeft && !has_command) + { + has_command = mToolbarLeft->hasCommand(commandId); + } + if (mToolbarRight && !has_command) + { + has_command = mToolbarRight->hasCommand(commandId); + } + if (mToolbarBottom && !has_command) + { + has_command = mToolbarBottom->hasCommand(commandId); + } + return has_command; +} + +bool LLToolBarView::addCommand(const LLCommandId& command, LLToolBar* toolbar) +{ + LLCommandManager& mgr = LLCommandManager::instance(); + if (mgr.getCommand(command)) + { + toolbar->addCommand(command); + } + else + { + llwarns << "Toolbars creation : the command " << command.name() << " cannot be found in the command manager" << llendl; + return false; + } + return true; +} + +bool LLToolBarView::loadToolbars(bool force_default) +{ + LLToolBarView::ToolbarSet toolbar_set; + + // Load the toolbars.xml file + std::string toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml"); + if (force_default) + { + toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); + } + else if (!gDirUtilp->fileExists(toolbar_file)) + { + llwarns << "User toolbars def not found -> use default" << llendl; + toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); + } + + LLXMLNodePtr root; + if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) + { + llerrs << "Unable to load toolbars from file: " << toolbar_file << llendl; + return false; + } + if(!root->hasName("toolbars")) + { + llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl; + return false; + } + + // Parse the toolbar settings + LLXUIParser parser; + parser.readXUI(root, toolbar_set, toolbar_file); + if (!toolbar_set.validateBlock()) + { + llerrs << "Unable to validate toolbars from file: " << toolbar_file << llendl; + return false; + } + + // Clear the toolbars now before adding the loaded commands and settings + if (mToolbarLeft) + { + mToolbarLeft->clearCommandsList(); + } + if (mToolbarRight) + { + mToolbarRight->clearCommandsList(); + } + if (mToolbarBottom) + { + mToolbarBottom->clearCommandsList(); + } + + // Add commands to each toolbar + if (toolbar_set.left_toolbar.isProvided() && mToolbarLeft) + { + if (toolbar_set.left_toolbar.button_display_mode.isProvided()) + { + U32 button_type = toolbar_set.left_toolbar.button_display_mode; + mToolbarLeft->setButtonType((LLToolBarEnums::ButtonType)(button_type)); + } + BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.left_toolbar.commands) + { + addCommand(LLCommandId(command),mToolbarLeft); + } + } + if (toolbar_set.right_toolbar.isProvided() && mToolbarRight) + { + if (toolbar_set.right_toolbar.button_display_mode.isProvided()) + { + U32 button_type = toolbar_set.right_toolbar.button_display_mode; + mToolbarRight->setButtonType((LLToolBarEnums::ButtonType)(button_type)); + } + BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.right_toolbar.commands) + { + addCommand(LLCommandId(command),mToolbarRight); + } + } + if (toolbar_set.bottom_toolbar.isProvided() && mToolbarBottom) + { + if (toolbar_set.bottom_toolbar.button_display_mode.isProvided()) + { + U32 button_type = toolbar_set.bottom_toolbar.button_display_mode; + mToolbarBottom->setButtonType((LLToolBarEnums::ButtonType)(button_type)); + } + BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.bottom_toolbar.commands) + { + addCommand(LLCommandId(command),mToolbarBottom); + } + } + return true; +} + +void LLToolBarView::saveToolbars() const +{ + // Build the parameter tree from the toolbar data + LLToolBarView::ToolbarSet toolbar_set; + if (mToolbarLeft) + { + toolbar_set.left_toolbar.button_display_mode = (int)(mToolbarLeft->getButtonType()); + addToToolset(mToolbarLeft->getCommandsList(),toolbar_set.left_toolbar); + } + if (mToolbarRight) + { + toolbar_set.right_toolbar.button_display_mode = (int)(mToolbarRight->getButtonType()); + addToToolset(mToolbarRight->getCommandsList(),toolbar_set.right_toolbar); + } + if (mToolbarBottom) + { + toolbar_set.bottom_toolbar.button_display_mode = (int)(mToolbarBottom->getButtonType()); + addToToolset(mToolbarBottom->getCommandsList(),toolbar_set.bottom_toolbar); + } + + // Serialize the parameter tree + LLXMLNodePtr output_node = new LLXMLNode("toolbars", false); + LLXUIParser parser; + parser.writeXUI(output_node, toolbar_set); + + // Write the resulting XML to file + if(!output_node->isNull()) + { + const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml"); + LLFILE *fp = LLFile::fopen(filename, "w"); + if (fp != NULL) + { + LLXMLNode::writeHeaderToFile(fp); + output_node->writeToFile(fp); + fclose(fp); + } + } +} + +// Enumerate the commands in command_list and add them as Params to the toolbar +void LLToolBarView::addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const +{ + for (command_id_list_t::const_iterator it = command_list.begin(); + it != command_list.end(); + ++it) + { + LLCommandId::Params command; + command.name = it->name(); + toolbar.commands.add(command); + } +} + +void LLToolBarView::draw() +{ + static bool debug_print = true; + static S32 old_width = 0; + static S32 old_height = 0; + + //LLPanel* sizer_left = getChild("sizer_left"); + + LLRect bottom_rect, left_rect, right_rect; + + if (mToolbarBottom) + { + mToolbarBottom->getParent()->reshape(mToolbarBottom->getParent()->getRect().getWidth(), mToolbarBottom->getRect().getHeight()); + mToolbarBottom->localRectToOtherView(mToolbarBottom->getLocalRect(), &bottom_rect, this); + } + if (mToolbarLeft) + { + mToolbarLeft->getParent()->reshape(mToolbarLeft->getRect().getWidth(), mToolbarLeft->getParent()->getRect().getHeight()); + mToolbarLeft->localRectToOtherView(mToolbarLeft->getLocalRect(), &left_rect, this); + } + if (mToolbarRight) + { + mToolbarRight->getParent()->reshape(mToolbarRight->getRect().getWidth(), mToolbarRight->getParent()->getRect().getHeight()); + mToolbarRight->localRectToOtherView(mToolbarRight->getLocalRect(), &right_rect, this); + } + + if ((old_width != getRect().getWidth()) || (old_height != getRect().getHeight())) + debug_print = true; + if (debug_print) + { + LLRect ctrl_rect = getRect(); + llinfos << "Merov debug : draw control rect = " << ctrl_rect.mLeft << ", " << ctrl_rect.mTop << ", " << ctrl_rect.mRight << ", " << ctrl_rect.mBottom << llendl; + llinfos << "Merov debug : draw bottom rect = " << bottom_rect.mLeft << ", " << bottom_rect.mTop << ", " << bottom_rect.mRight << ", " << bottom_rect.mBottom << llendl; + llinfos << "Merov debug : draw left rect = " << left_rect.mLeft << ", " << left_rect.mTop << ", " << left_rect.mRight << ", " << left_rect.mBottom << llendl; + llinfos << "Merov debug : draw right rect = " << right_rect.mLeft << ", " << right_rect.mTop << ", " << right_rect.mRight << ", " << right_rect.mBottom << llendl; + old_width = ctrl_rect.getWidth(); + old_height = ctrl_rect.getHeight(); + debug_print = false; + } + // Debug draw + LLColor4 back_color = LLColor4::blue; + LLColor4 back_color_vert = LLColor4::red; + LLColor4 back_color_hori = LLColor4::yellow; + back_color[VALPHA] = 0.5f; + back_color_hori[VALPHA] = 0.5f; + back_color_vert[VALPHA] = 0.5f; + //gl_rect_2d(getLocalRect(), back_color, TRUE); + //gl_rect_2d(bottom_rect, back_color_hori, TRUE); + //gl_rect_2d(left_rect, back_color_vert, TRUE); + //gl_rect_2d(right_rect, back_color_vert, TRUE); + + LLUICtrl::draw(); +} + + +// ---------------------------------------- +// Drag and Drop hacks (under construction) +// ---------------------------------------- + + +void LLToolBarView::startDragItem( S32 x, S32 y, const LLUUID& uuid) +{ + llinfos << "Merov debug: startDragItem() : x = " << x << ", y = " << y << llendl; + LLToolDragAndDrop::getInstance()->setDragStart( x, y ); + sDragStarted = false; +} + +BOOL LLToolBarView::handleDragItem( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type) +{ +// llinfos << "Merov debug: handleDragItem() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl; + if (LLToolDragAndDrop::getInstance()->isOverThreshold( x, y )) + { + if (!sDragStarted) + { + std::vector types; + uuid_vec_t cargo_ids; + types.push_back(DAD_WIDGET); + cargo_ids.push_back(uuid); + gClipboard.setSourceObject(uuid,LLAssetType::AT_WIDGET); + LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_VIEWER; + LLUUID srcID; + llinfos << "Merov debug: handleDragItem() : beginMultiDrag()" << llendl; + LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src, srcID); + sDragStarted = true; + return TRUE; + } + else + { + MASK mask = 0; + return LLToolDragAndDrop::getInstance()->handleHover( x, y, mask ); + } + } + return FALSE; +} + +BOOL LLToolBarView::handleDrop( EDragAndDropType cargo_type, void* cargo_data, const LLUUID& toolbar_id) +{ + LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data; + llinfos << "Merov debug : handleDrop. Drop " << inv_item->getUUID() << " named " << inv_item->getName() << " of type " << inv_item->getType() << " to toolbar " << toolbar_id << " under cargo type " << cargo_type << llendl; + + LLAssetType::EType type = inv_item->getType(); + if (type == LLAssetType::AT_WIDGET) + { + llinfos << "Merov debug : handleDrop. Drop source is a widget -> that's where we'll get code in..." << llendl; + // Find out if he command is in one of the toolbar + // If it is, pull it out of the toolbar + // Now insert it in the toolbar in the correct spot... + } + else + { + llinfos << "Merov debug : handleDrop. Drop source is not a widget -> nothing to do" << llendl; + } + + return TRUE; +} + + diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h new file mode 100644 index 0000000000..4e1b855e3d --- /dev/null +++ b/indra/newview/lltoolbarview.h @@ -0,0 +1,102 @@ +/** + * @file lltoolbarview.h + * @author Merov Linden + * @brief User customizable toolbar class + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLTOOLBARVIEW_H +#define LL_LLTOOLBARVIEW_H + +#include "lluictrl.h" +#include "lltoolbar.h" +#include "llcommandmanager.h" + +class LLUICtrlFactory; + +// Parent of all LLToolBar + +class LLToolBarView : public LLUICtrl +{ +public: + // Xui structure of the toolbar panel + struct Params : public LLInitParam::Block {}; + + // Note: valid children for LLToolBarView are stored in this registry + typedef LLDefaultChildRegistry child_registry_t; + + // Xml structure of the toolbars.xml setting + // Those live in a toolbars.xml found in app_settings (for the default) and in + // the user folder for the user specific (saved) settings + struct Toolbar : public LLInitParam::Block + { + Mandatory button_display_mode; + Multiple commands; + Toolbar(); + }; + struct ToolbarSet : public LLInitParam::Block + { + Optional left_toolbar, + right_toolbar, + bottom_toolbar; + ToolbarSet(); + }; + + // Derived methods + virtual ~LLToolBarView(); + virtual BOOL postBuild(); + virtual void draw(); + + // Toolbar view interface with the rest of the world + // Checks if the commandId is being used somewhere in one of the toolbars + bool hasCommand(const LLCommandId& commandId) const; + // Loads the toolbars from the existing user or default settings + bool loadToolbars(bool force_default = false); // return false if load fails + bool loadDefaultToolbars() { return loadToolbars(true); } + + static void startDragItem( S32 x, S32 y, const LLUUID& uuid); + static BOOL handleDragItem( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type); + static BOOL handleDrop( EDragAndDropType cargo_type, void* cargo_data, const LLUUID& folder_id); + +protected: + friend class LLUICtrlFactory; + LLToolBarView(const Params&); + + void initFromParams(const Params&); + +private: + void saveToolbars() const; + bool addCommand(const LLCommandId& commandId, LLToolBar* toolbar); + void addToToolset(command_id_list_t& command_list, Toolbar& toolbar) const; + + // Pointers to the toolbars handled by the toolbar view + LLToolBar* mToolbarLeft; + LLToolBar* mToolbarRight; + LLToolBar* mToolbarBottom; + + static bool sDragStarted; +}; + +extern LLToolBarView* gToolBarView; + +#endif // LL_LLTOOLBARVIEW_H diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 3e5ce427a8..a8014b8cde 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -57,6 +57,7 @@ #include "llviewerwindow.h" #include "llvoavatarself.h" #include "llworld.h" +#include "llclipboard.h" // syntactic sugar #define callMemberFunction(object,ptrToMember) ((object).*(ptrToMember)) @@ -2495,6 +2496,10 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory( item = (LLViewerInventoryItem*)preview->getDragItem(); } } + else if(mSource == SOURCE_VIEWER) + { + item = (LLViewerInventoryItem*)gClipboard.getSourceObject(); + } if(item) return item; if(cat) return cat; return NULL; diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 7b8cce3dc7..92f007a251 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -66,7 +66,8 @@ public: SOURCE_AGENT, SOURCE_WORLD, SOURCE_NOTECARD, - SOURCE_LIBRARY + SOURCE_LIBRARY, + SOURCE_VIEWER }; void beginDrag(EDragAndDropType type, diff --git a/indra/newview/llviewerassettype.cpp b/indra/newview/llviewerassettype.cpp index b103f11597..a4b1c2155f 100644 --- a/indra/newview/llviewerassettype.cpp +++ b/indra/newview/llviewerassettype.cpp @@ -80,7 +80,9 @@ LLViewerAssetDictionary::LLViewerAssetDictionary() addEntry(LLViewerAssetType::AT_LINK_FOLDER, new ViewerAssetEntry(DAD_LINK)); addEntry(LLViewerAssetType::AT_MESH, new ViewerAssetEntry(DAD_MESH)); - + + addEntry(LLViewerAssetType::AT_WIDGET, new ViewerAssetEntry(DAD_WIDGET)); + addEntry(LLViewerAssetType::AT_NONE, new ViewerAssetEntry(DAD_NONE)); }; -- cgit v1.2.3 From 2d0dfbca99ffa442025358ece6340b894245d3b0 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 3 Oct 2011 16:37:07 -0700 Subject: * Added tooltips to the toolbar buttons. Reviewed by Richard. --- indra/llui/lltoolbar.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index c62bbe4e71..c0058d534d 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -511,10 +511,13 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) LLCommand* commandp = LLCommandManager::instance().getCommand(id); if (!commandp) return NULL; + std::string label = LLTrans::getString(commandp->labelRef()); + std::string tooltip = label + "\n" + LLTrans::getString(commandp->tooltipRef()); + LLToolBarButton::Params button_p; button_p.name = id.name(); - button_p.label = LLTrans::getString(commandp->labelRef()); - button_p.tool_tip = button_p.label(); + button_p.label = label; + button_p.tool_tip = tooltip; button_p.image_overlay = LLUI::getUIImage(commandp->icon()); button_p.overwriteFrom(mButtonParams[mButtonType]); LLToolBarButton* button = LLUICtrlFactory::create(button_p); -- cgit v1.2.3 From 13165e909a5ba35df864ace97206da1242f41265 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 3 Oct 2011 17:11:09 -0700 Subject: fixed build --- indra/llxuixml/llinitparam.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 9a6ded47ff..3dce7a939f 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -564,10 +564,6 @@ namespace LLInitParam public: typedef const T& value_assignment_t; - S32 mKeyVersion; - mutable S32 mValidatedVersion; - mutable bool mValidated; // lazy validation flag - ParamValue() : T(), mKeyVersion(0), @@ -607,6 +603,12 @@ namespace LLInitParam { return *this; } + + S32 mKeyVersion; + + protected: + mutable S32 mValidatedVersion; + mutable bool mValidated; // lazy validation flag }; template > @@ -1679,8 +1681,6 @@ namespace LLInitParam S32 mLastParseGeneration; }; - - template @@ -1690,17 +1690,18 @@ namespace LLInitParam : public Param, protected BatchBlock { + typedef BatchBlock block_t; typedef const BatchBlock& value_assignment_t; ParamValue() - : T(), + : block_t(), mKeyVersion(0), mValidatedVersion(-1), mValidated(false) {} ParamValue(value_assignment_t other) - : T(other), + : block_t(other), mKeyVersion(0), mValidatedVersion(-1), mValidated(false) @@ -1710,7 +1711,7 @@ namespace LLInitParam void setValue(value_assignment_t val) { *this = val; - mLastParseGeneration = -1; + block_t::mLastParseGeneration = -1; } value_assignment_t getValue() const @@ -1733,6 +1734,11 @@ namespace LLInitParam return *this; } + S32 mKeyVersion; + + protected: + mutable S32 mValidatedVersion; + mutable bool mValidated; // lazy validation flag }; template -- cgit v1.2.3 From edacb7b3363dca6cd28a4ff7ea27154d6a30702f Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 3 Oct 2011 18:52:22 -0700 Subject: implemented Range and ClampedValue classes to standardize min/max settings fixed not serializing named values when values provided from code --- indra/llui/lltoolbar.cpp | 11 +- indra/llui/lltoolbar.h | 11 +- indra/llui/lltoolbarview.cpp | 18 +-- indra/llui/lltoolbarview.h | 4 +- indra/llui/llui.h | 126 +++++++++++++++++++++ indra/llxuixml/llinitparam.h | 39 +++++-- indra/newview/app_settings/toolbars.xml | 4 +- .../skins/default/xui/en/floater_toybox.xml | 4 +- .../skins/default/xui/en/widgets/toolbar.xml | 8 +- 9 files changed, 185 insertions(+), 40 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index c0058d534d..66c2d7ab0b 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -319,7 +319,7 @@ void LLToolBar::resizeButtonsInRow(std::vector& buttons_in_row { if (getOrientation(mSideType) == LLLayoutStack::HORIZONTAL) { - button->reshape(llclamp(button->getRect().getWidth(), button->mMinWidth, button->mMaxWidth), max_row_girth); + button->reshape(button->mWidthRange.clamp(button->getRect().getWidth()), max_row_girth); } else // VERTICAL { @@ -378,10 +378,10 @@ void LLToolBar::updateLayoutAsNeeded() BOOST_FOREACH(LLToolBarButton* button, mButtons) { - button->reshape(button->mMinWidth, button->mDesiredHeight); + button->reshape(button->mWidthRange.getMin(), button->mDesiredHeight); button->autoResize(); - S32 button_clamped_width = llclamp(button->getRect().getWidth(), button->mMinWidth, button->mMaxWidth); + S32 button_clamped_width = button->mWidthRange.clamp(button->getRect().getWidth()); S32 button_length = (orientation == LLLayoutStack::HORIZONTAL) ? button_clamped_width : button->getRect().getHeight(); @@ -396,7 +396,7 @@ void LLToolBar::updateLayoutAsNeeded() { if (orientation == LLLayoutStack::VERTICAL) { // row girth (width in this case) is clamped to allowable button widths - max_row_girth = llclamp(max_row_girth, button->mMinWidth, button->mMaxWidth); + max_row_girth = button->mWidthRange.clamp(max_row_girth); } // make buttons in current row all same girth @@ -543,8 +543,7 @@ LLToolBarButton::LLToolBarButton(const Params& p) : LLButton(p), mMouseDownX(0), mMouseDownY(0), - mMinWidth(p.min_button_width), - mMaxWidth(p.max_button_width), + mWidthRange(p.button_width), mDesiredHeight(p.desired_height), mId("") {} diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 5d64630fa6..48ca6c62b3 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -41,13 +41,11 @@ class LLToolBarButton : public LLButton public: struct Params : public LLInitParam::Block { - Optional min_button_width, - max_button_width, - desired_height; + Optional > button_width; + Optional desired_height; Params() - : min_button_width("min_button_width", 0), - max_button_width("max_button_width", S32_MAX), + : button_width("button_width"), desired_height("desired_height", 20) {} @@ -62,8 +60,7 @@ private: LLCommandId mId; S32 mMouseDownX; S32 mMouseDownY; - S32 mMinWidth; - S32 mMaxWidth; + LLUI::Range mWidthRange; S32 mDesiredHeight; }; diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index 12247519ad..49d4bfdc3c 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -169,8 +169,8 @@ bool LLToolBarView::loadToolbars(bool force_default) { if (toolbar_set.left_toolbar.button_display_mode.isProvided()) { - U32 button_type = toolbar_set.left_toolbar.button_display_mode; - mToolbarLeft->setButtonType((LLToolBarEnums::ButtonType)(button_type)); + LLToolBarEnums::ButtonType button_type = toolbar_set.left_toolbar.button_display_mode; + mToolbarLeft->setButtonType(button_type); } BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.left_toolbar.commands) { @@ -181,8 +181,8 @@ bool LLToolBarView::loadToolbars(bool force_default) { if (toolbar_set.right_toolbar.button_display_mode.isProvided()) { - U32 button_type = toolbar_set.right_toolbar.button_display_mode; - mToolbarRight->setButtonType((LLToolBarEnums::ButtonType)(button_type)); + LLToolBarEnums::ButtonType button_type = toolbar_set.right_toolbar.button_display_mode; + mToolbarRight->setButtonType(button_type); } BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.right_toolbar.commands) { @@ -193,8 +193,8 @@ bool LLToolBarView::loadToolbars(bool force_default) { if (toolbar_set.bottom_toolbar.button_display_mode.isProvided()) { - U32 button_type = toolbar_set.bottom_toolbar.button_display_mode; - mToolbarBottom->setButtonType((LLToolBarEnums::ButtonType)(button_type)); + LLToolBarEnums::ButtonType button_type = toolbar_set.bottom_toolbar.button_display_mode; + mToolbarBottom->setButtonType(button_type); } BOOST_FOREACH(LLCommandId::Params& command, toolbar_set.bottom_toolbar.commands) { @@ -223,17 +223,17 @@ void LLToolBarView::saveToolbars() const LLToolBarView::ToolbarSet toolbar_set; if (mToolbarLeft) { - toolbar_set.left_toolbar.button_display_mode = (int)(mToolbarLeft->getButtonType()); + toolbar_set.left_toolbar.button_display_mode = mToolbarLeft->getButtonType(); addToToolset(mToolbarLeft->getCommandsList(),toolbar_set.left_toolbar); } if (mToolbarRight) { - toolbar_set.right_toolbar.button_display_mode = (int)(mToolbarRight->getButtonType()); + toolbar_set.right_toolbar.button_display_mode = mToolbarRight->getButtonType(); addToToolset(mToolbarRight->getCommandsList(),toolbar_set.right_toolbar); } if (mToolbarBottom) { - toolbar_set.bottom_toolbar.button_display_mode = (int)(mToolbarBottom->getButtonType()); + toolbar_set.bottom_toolbar.button_display_mode = mToolbarBottom->getButtonType(); addToToolset(mToolbarBottom->getCommandsList(),toolbar_set.bottom_toolbar); } diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h index 20525a22ac..c67b8d9d64 100644 --- a/indra/llui/lltoolbarview.h +++ b/indra/llui/lltoolbarview.h @@ -50,8 +50,8 @@ public: // the user folder for the user specific (saved) settings struct Toolbar : public LLInitParam::Block { - Mandatory button_display_mode; - Multiple commands; + Mandatory button_display_mode; + Multiple commands; Toolbar(); }; struct ToolbarSet : public LLInitParam::Block diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 3afb7c65a9..9f6fccfef6 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -147,6 +147,132 @@ class LLUI { LOG_CLASS(LLUI); public: + // + // Classes + // + + template + struct Range + { + typedef Range self_t; + + struct Params : public LLInitParam::Block + { + Optional minimum, + maximum; + + Params() + : minimum("min", 0), + maximum("max", S32_MAX) + { + + } + }; + + // correct for inverted params + Range(const Params& p = Params()) + : mMin(p.minimum), + mMax(p.maximum) + { + sanitizeRange(); + } + + Range(T minimum, T maximum) + : mMin(minimum), + mMax(maximum) + { + sanitizeRange(); + } + + S32 clamp(T input) + { + if (input < mMin) return mMin; + if (input > mMax) return mMax; + return input; + } + + void setRange(T minimum, T maximum) + { + mMin = minimum; + mMax = maximum; + sanitizeRange(); + } + + S32 getMin() { return mMin; } + S32 getMax() { return mMax; } + + bool operator==(const self_t& other) const + { + return mMin == other.mMin + && mMax == other.mMax; + } + private: + void sanitizeRange() + { + if (mMin > mMax) + { + llwarns << "Bad interval range (" << mMin << ", " << mMax << ")" << llendl; + // since max is usually the most dangerous one to ignore (buffer overflow, etc), prefer it + // in the case of a malformed range + mMin = mMax; + } + } + + + T mMin, + mMax; + }; + + template + struct ClampedValue : public Range + { + typedef Range range_t; + + struct Params : public LLInitParam::Block + { + Mandatory value; + + Params() + : value("", 0) + { + addSynonym(value, "value"); + } + }; + + ClampedValue(const Params& p) + : range_t(p) + {} + + ClampedValue(const range_t& range) + : range_t(range) + { + // set value here, after range has been sanitized + mValue = clamp(0); + } + + ClampedValue(T value, const range_t& range = range_t()) + : range_t(range) + { + mValue = clamp(value); + } + + T get() + { + return mValue; + } + + void set(T value) + { + mValue = clamp(value); + } + + + private: + T mValue; + }; + + typedef ClampedValue ClampedS32; + // // Methods // diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 3dce7a939f..9db67a15c8 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -87,6 +87,7 @@ namespace LLInitParam void setValueName(const std::string& key) {} std::string getValueName() const { return ""; } + std::string calcValueName(const T& value) const { return ""; } void clearValueName() const {} static bool getValueFromName(const std::string& name, T& value) @@ -124,6 +125,22 @@ namespace LLInitParam return mValueName; } + std::string calcValueName(const T& value) const + { + value_name_map_t* map = getValueNames(); + for (value_name_map_t::iterator it = map->begin(), end_it = map->end(); + it != end_it; + ++it) + { + if (ParamCompare::equals(it->second, value)) + { + return it->first; + } + } + + return ""; + } + void clearValueName() const { mValueName.clear(); @@ -709,18 +726,19 @@ namespace LLInitParam { if (!diff_param || !ParamCompare::equals(static_cast(diff_param)->getValueName(), key)) { - if (!parser.writeValue(key, name_stack)) - { - return; - } + parser.writeValue(key, name_stack); } } // then try to serialize value directly else if (!diff_param || !ParamCompare::equals(typed_param.getValue(), static_cast(diff_param)->getValue())) { - if (!parser.writeValue(typed_param.getValue(), name_stack)) + if (!parser.writeValue(typed_param.getValue(), name_stack)) { - return; + std::string calculated_key = typed_param.calcValueName(typed_param.getValue()); + if (!diff_param || !ParamCompare::equals(static_cast(diff_param)->getValueName(), calculated_key)) + { + parser.writeValue(calculated_key, name_stack); + } } } } @@ -1002,9 +1020,14 @@ namespace LLInitParam if(key.empty()) // not parsed via name values, write out value directly { - if (!parser.writeValue(*it, name_stack)) + bool value_written == parser.writeValue(*it, name_stack); + if (!value_written) { - break; + std::string calculated_key = typed_param.calcValueName(typed_param.getValue()); + if (!parser.writeValue(calculated_key, name_stack)) + { + break; + } } } else diff --git a/indra/newview/app_settings/toolbars.xml b/indra/newview/app_settings/toolbars.xml index 19dec78c63..a9345b3b0a 100644 --- a/indra/newview/app_settings/toolbars.xml +++ b/indra/newview/app_settings/toolbars.xml @@ -1,7 +1,7 @@ + button_display_mode="icons_with_text"> @@ -12,7 +12,7 @@ + button_display_mode="icons_only"> diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index de39032cbf..972ae1487a 100644 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -48,8 +48,8 @@ button_display_mode="icons_with_text" follows="all" left="20" - button_icon_and_text.max_button_width="140" - button_icon_and_text.min_button_width="70" + button_icon_and_text.button_width.max="140" + button_icon_and_text.button_width.min="70" name="toybox_toolbar" pad_left="5" pad_right="5" diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 8422e3943d..0c7e7cff56 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -12,8 +12,8 @@ bg_opaque_image_overlay="MouseGray" background_opaque="true"/> Date: Mon, 3 Oct 2011 18:57:23 -0700 Subject: fixed build --- indra/llui/lltoolbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 4b7e04b682..71f4e09a24 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -107,7 +107,7 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) { mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text; mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon; - mUUID = LLUUID::LLUUID::generateNewID(p.name); + mUUID = LLUUID::generateNewID(p.name); } LLToolBar::~LLToolBar() -- cgit v1.2.3 From 3689995fcfca3a99038b2aadec638819a63a02c8 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 3 Oct 2011 18:58:30 -0700 Subject: fixed build --- indra/llui/lltoolbar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 4b7e04b682..efa077ffa1 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -107,7 +107,7 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) { mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text; mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon; - mUUID = LLUUID::LLUUID::generateNewID(p.name); + mUUID = LLUUID::generateNewID(p.name); } LLToolBar::~LLToolBar() @@ -570,7 +570,7 @@ LLToolBarButton::LLToolBarButton(const Params& p) mDesiredHeight(p.desired_height), mId("") { - mUUID = LLUUID::LLUUID::generateNewID(p.name); + mUUID = LLUUID::generateNewID(p.name); } BOOL LLToolBarButton::handleMouseDown(S32 x, S32 y, MASK mask) -- cgit v1.2.3 From 9f6307277bf02753b55c7819626318f717224cc6 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 4 Oct 2011 10:50:10 -0700 Subject: potential fix for build --- indra/newview/lltoolbarview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 2ea2f608cc..65f63926b6 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -25,7 +25,7 @@ * $/LicenseInfo$ */ -#include "linden_common.h" +#include "llviewerprecompiledheaders.h" #include "lltoolbarview.h" -- cgit v1.2.3 From cfbb5aad37418af614a491e278083bc95bb820a2 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 4 Oct 2011 11:32:00 -0700 Subject: another potential gcc fix --- indra/llxuixml/llinitparam.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 0f17fb61da..1a131d15a3 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -128,7 +128,7 @@ namespace LLInitParam std::string calcValueName(const T& value) const { value_name_map_t* map = getValueNames(); - for (value_name_map_t::iterator it = map->begin(), end_it = map->end(); + for (typename value_name_map_t::iterator it = map->begin(), end_it = map->end(); it != end_it; ++it) { @@ -1020,16 +1020,16 @@ namespace LLInitParam if(key.empty()) // not parsed via name values, write out value directly { - bool value_written == parser.writeValue(*it, name_stack); + bool value_written = parser.writeValue(*it, name_stack); if (!value_written) { std::string calculated_key = typed_param.calcValueName(typed_param.getValue()); if (!parser.writeValue(calculated_key, name_stack)) - { - break; + { + break; + } } } - } else { if(!parser.writeValue(key, name_stack)) -- cgit v1.2.3 From 44e9fb446f3c92c3dfd9b5be8a3e02ec5a44ba00 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 4 Oct 2011 12:04:29 -0700 Subject: another potential gcc fix --- indra/llui/llui.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 9f6fccfef6..8cec1a16f4 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -158,8 +158,8 @@ public: struct Params : public LLInitParam::Block { - Optional minimum, - maximum; + typename Optional minimum, + maximum; Params() : minimum("min", 0), -- cgit v1.2.3 From 530d5af4073f4dda4003005c9c117af53b84aa9d Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 4 Oct 2011 12:05:27 -0700 Subject: EXP-1204 PROGRESS -- As a User I want flexible floater management with no sidetray EXP-1292 FIX -- Mini-map floater can't be closed by clicking the sidebar button again. * Mini-map floater text updated * Mini-map floater behavior now acts more like other windows, has a title, etc. --- indra/newview/llfloatermap.cpp | 50 +--------------------- indra/newview/llfloatermap.h | 6 --- indra/newview/skins/default/xui/en/floater_map.xml | 28 ++++++------ .../skins/default/xui/en/menu_bottomtray.xml | 2 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 2 +- .../skins/default/xui/en/panel_bottomtray.xml | 4 +- 6 files changed, 18 insertions(+), 74 deletions(-) diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index 641e64247b..8713513054 100644 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -100,16 +100,13 @@ BOOL LLFloaterMap::postBuild() mTextBoxSouthWest = getChild ("floater_map_southwest"); mTextBoxNorthWest = getChild ("floater_map_northwest"); - stretchMiniMap(getRect().getWidth() - MAP_PADDING_LEFT - MAP_PADDING_RIGHT - ,getRect().getHeight() - MAP_PADDING_TOP - MAP_PADDING_BOTTOM); - updateMinorDirections(); // Get the drag handle all the way in back sendChildToBack(getDragHandle()); - setIsChrome(TRUE); - getDragHandle()->setTitleVisible(TRUE); + //setIsChrome(TRUE); + //getDragHandle()->setTitleVisible(TRUE); // keep onscreen gFloaterView->adjustToFitScreen(this, FALSE); @@ -223,40 +220,10 @@ void LLFloaterMap::draw() LLFloater::draw(); } -// virtual -void LLFloaterMap::onFocusReceived() -{ - setBackgroundOpaque(true); - LLPanel::onFocusReceived(); -} - -// virtual -void LLFloaterMap::onFocusLost() -{ - setBackgroundOpaque(false); - LLPanel::onFocusLost(); -} - -void LLFloaterMap::stretchMiniMap(S32 width,S32 height) -{ - //fix for ext-7112 - //by default ctrl can't overlap caption area - if(mMap) - { - LLRect map_rect; - map_rect.setLeftTopAndSize( MAP_PADDING_LEFT, getRect().getHeight() - MAP_PADDING_TOP, width, height); - mMap->reshape( width, height, 1); - mMap->setRect(map_rect); - } -} - void LLFloaterMap::reshape(S32 width, S32 height, BOOL called_from_parent) { LLFloater::reshape(width, height, called_from_parent); - stretchMiniMap(width - MAP_PADDING_LEFT - MAP_PADDING_RIGHT - ,height - MAP_PADDING_TOP - MAP_PADDING_BOTTOM); - updateMinorDirections(); } @@ -285,16 +252,3 @@ void LLFloaterMap::handleZoom(const LLSD& userdata) mMap->setScale(scale); } } - -void LLFloaterMap::setMinimized(BOOL b) -{ - LLFloater::setMinimized(b); - if(b) - { - setTitle(getString("mini_map_caption")); - } - else - { - setTitle(""); - } -} diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h index 5cf66a594b..8a1b965e62 100644 --- a/indra/newview/llfloatermap.h +++ b/indra/newview/llfloatermap.h @@ -45,18 +45,12 @@ public: /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); /*virtual*/ void draw(); - /*virtual*/ void onFocusLost(); - /*virtual*/ void onFocusReceived(); - /*virtual*/ void setMinimized(BOOL b); - private: void handleZoom(const LLSD& userdata); void setDirectionPos( LLTextBox* text_box, F32 rotation ); void updateMinorDirections(); - void stretchMiniMap(S32 width,S32 height); - LLTextBox* mTextBoxEast; LLTextBox* mTextBoxNorth; LLTextBox* mTextBoxWest; diff --git a/indra/newview/skins/default/xui/en/floater_map.xml b/indra/newview/skins/default/xui/en/floater_map.xml index ae99fa8dd5..51f63edc31 100644 --- a/indra/newview/skins/default/xui/en/floater_map.xml +++ b/indra/newview/skins/default/xui/en/floater_map.xml @@ -1,20 +1,17 @@ @@ -27,17 +24,16 @@ [REGION](Double-click to teleport, shift-drag to pan) - MINIMAP + Mini-map + top="189"> N + top="189"> E + top="175"> W + top="189"> S + top="189"> SE + top="189"> NE + top="189"> SW + top="189"> NW diff --git a/indra/newview/skins/default/xui/en/menu_bottomtray.xml b/indra/newview/skins/default/xui/en/menu_bottomtray.xml index 07dabe1909..1a102c21bb 100644 --- a/indra/newview/skins/default/xui/en/menu_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/menu_bottomtray.xml @@ -97,7 +97,7 @@ parameter="ShowWorldMapButton" /> -- cgit v1.2.3 From 29987ec5949d22c462566d453ce1de2c76c154e8 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 4 Oct 2011 12:08:48 -0700 Subject: * Updated strings for FUI crusade --- indra/newview/app_settings/settings.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ad07af5e87..07799d4eee 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9671,7 +9671,7 @@ ShowBuildButton Comment - Shows/Hides Build button in the bottom tray. + Shows/hides build button in the bottom tray. Persist 1 Type @@ -9682,7 +9682,7 @@ ShowCameraButton Comment - Show/Hide View button in the bottom tray. + Show/hide view button in the bottom tray. Persist 1 Type @@ -9770,7 +9770,7 @@ ShowGestureButton Comment - Shows/Hides Gesture button in the bottom tray. + Shows/hides gesture button in the bottom tray. Persist 1 Type @@ -9803,7 +9803,7 @@ ShowMiniMapButton Comment - Shows/Hides Mini-Map button in the bottom tray. + Shows/hides mini-map button in the bottom tray. Persist 1 Type @@ -9814,7 +9814,7 @@ ShowMoveButton Comment - Shows/Hides Move button in the bottom tray. + Shows/hides move button in the bottom tray. Persist 1 Type @@ -9847,7 +9847,7 @@ ShowSearchButton Comment - Shows/Hides Search button in the bottom tray. + Shows/hides search button in the bottom tray. Persist 1 Type @@ -9858,7 +9858,7 @@ ShowSnapshotButton Comment - Shows/Hides Snapshot button button in the bottom tray. + Shows/hides snapshot button button in the bottom tray. Persist 1 Type @@ -9880,7 +9880,7 @@ ShowNavbarFavoritesPanel Comment - Show/Hide Navigation Bar Favorites Panel + Show/hide navigation bar favorites panel Persist 1 Type @@ -9891,7 +9891,7 @@ ShowNavbarNavigationPanel Comment - Show/Hide Navigation Bar Navigation Panel + Show/hide navigation bar navigation panel Persist 1 Type @@ -9902,7 +9902,7 @@ ShowWorldMapButton Comment - Shows/Hides Map button in the bottom tray. + Shows/hides map button in the bottom tray. Persist 1 Type @@ -9913,7 +9913,7 @@ ShowMiniLocationPanel Comment - Show/Hide Mini-Location Panel + Show/hide mini-location panel Persist 1 Type -- cgit v1.2.3 From f3aac4c8ab45d52c4f038ad1a16768d9d8e0b201 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 4 Oct 2011 12:15:41 -0700 Subject: EXP-1289 FIX -- Default bottom bar is showing "Places" button instead of "Destinations" EXP-1290 FIX -- Snapshot button to be removed from the default left sidebar EXP-1291 FIX -- Places command is missing on the default left sidebar * Updated to new default buttons based on the wiki. * Updated button_display_mode to text rather than numbers. --- indra/newview/app_settings/toolbars.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/indra/newview/app_settings/toolbars.xml b/indra/newview/app_settings/toolbars.xml index 19dec78c63..21084d2c8d 100644 --- a/indra/newview/app_settings/toolbars.xml +++ b/indra/newview/app_settings/toolbars.xml @@ -1,10 +1,10 @@ + button_display_mode="icons_with_text"> - + @@ -12,14 +12,14 @@ + button_display_mode="icons_only"> + - - - + + + - - \ No newline at end of file + -- cgit v1.2.3 From 50c0447808f7041d5af5017c847a462e9599bdb5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 4 Oct 2011 13:26:54 -0700 Subject: disabled min and max windows macros another attempt at fixing gcc builds --- indra/llcommon/llapr.h | 3 +++ indra/llcommon/llprocesslauncher.h | 1 + indra/llrender/llglheaders.h | 1 + indra/llui/llui.h | 33 ++++++++++++++++----------------- indra/llwindow/lldragdropwin32.h | 2 ++ indra/llwindow/llwindowwin32.h | 1 + indra/win_crash_logger/StdAfx.h | 2 +- 7 files changed, 25 insertions(+), 18 deletions(-) diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 3f846f1314..286fc43a77 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -37,6 +37,9 @@ // If you get undefined symbols, find the appropriate // Windows header file and include that in your .cpp file. #define WIN32_LEAN_AND_MEAN + // do not define min() and max() macros, which collide with + // things like numeric_limits + #define NOMINMAX #include #include #endif diff --git a/indra/llcommon/llprocesslauncher.h b/indra/llcommon/llprocesslauncher.h index 954c249147..23e48b1823 100644 --- a/indra/llcommon/llprocesslauncher.h +++ b/indra/llcommon/llprocesslauncher.h @@ -28,6 +28,7 @@ #define LL_LLPROCESSLAUNCHER_H #if LL_WINDOWS +#define NOMINMAX #include #endif diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 851a75629e..b936fd30f8 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -520,6 +520,7 @@ extern PFNGLSAMPLEMASKIPROC glSampleMaski; // windows gl headers depend on things like APIENTRY, so include windows. #define WIN32_LEAN_AND_MEAN +#define NOMINMAX #include #include diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 8cec1a16f4..af8f239657 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -41,6 +41,7 @@ #include #include "lllazyvalue.h" #include "llframetimer.h" +#include // LLUIFactory #include "llsd.h" @@ -150,27 +151,25 @@ public: // // Classes // + template + struct RangeParams : public LLInitParam::Block > + { + Optional minimum, + maximum; + + RangeParams() + : minimum("min", T()), + maximum("max", std::numeric_limits::max()) + {} + }; template struct Range { typedef Range self_t; - struct Params : public LLInitParam::Block - { - typename Optional minimum, - maximum; - - Params() - : minimum("min", 0), - maximum("max", S32_MAX) - { - - } - }; - // correct for inverted params - Range(const Params& p = Params()) + Range(const RangeParams& p = RangeParams()) : mMin(p.minimum), mMax(p.maximum) { @@ -228,12 +227,12 @@ public: { typedef Range range_t; - struct Params : public LLInitParam::Block + struct Params : public LLInitParam::Block > { - Mandatory value; + Mandatory value; Params() - : value("", 0) + : value("", T()) { addSynonym(value, "value"); } diff --git a/indra/llwindow/lldragdropwin32.h b/indra/llwindow/lldragdropwin32.h index 929e7f9e37..63054bffec 100644 --- a/indra/llwindow/lldragdropwin32.h +++ b/indra/llwindow/lldragdropwin32.h @@ -31,6 +31,7 @@ #ifndef LL_LLDRAGDROP32_H #define LL_LLDRAGDROP32_H +#define NOMINMAX #include #include @@ -54,6 +55,7 @@ class LLDragDropWin32 #ifndef LL_LLDRAGDROP32_H #define LL_LLDRAGDROP32_H +#define NOMINMAX #include #include diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 387e4cbdb6..dc1950fb31 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -29,6 +29,7 @@ // Limit Windows API to small and manageable set. #define WIN32_LEAN_AND_MEAN +#define NOMINMAX #include #include diff --git a/indra/win_crash_logger/StdAfx.h b/indra/win_crash_logger/StdAfx.h index ce70fe2994..71faf88bad 100644 --- a/indra/win_crash_logger/StdAfx.h +++ b/indra/win_crash_logger/StdAfx.h @@ -37,7 +37,7 @@ #endif // _MSC_VER > 1000 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - +#define NOMINMAX // don't define min and max macros // Windows Header Files: #include -- cgit v1.2.3 From db2e763ff0537785336a330d03bb9307478cb79a Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 4 Oct 2011 14:09:03 -0700 Subject: * Modified commands to add functions for is_enabled, is_running and is_starting, currently not hooked to any functionality. --- indra/llui/llcommandmanager.cpp | 24 ++++++--- indra/llui/llcommandmanager.h | 43 ++++++++++++--- indra/llui/lltoolbar.cpp | 4 +- indra/newview/app_settings/commands.xml | 92 ++++++++++++++++----------------- indra/newview/llfloatertoybox.cpp | 34 +++--------- indra/newview/llfloatertoybox.h | 4 -- 6 files changed, 109 insertions(+), 92 deletions(-) diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index b1147134c2..922f243806 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -48,24 +48,36 @@ const LLCommandId LLCommandId::null("null command"); // LLCommand::Params::Params() - : function("function") - , available_in_toybox("available_in_toybox", false) + : available_in_toybox("available_in_toybox", false) , icon("icon") , label_ref("label_ref") , name("name") - , parameter("parameter") , tooltip_ref("tooltip_ref") + , execute_function("execute_function") + , execute_parameters("execute_parameters") + , is_enabled_function("is_enabled_function") + , is_enabled_parameters("is_enabled_parameters") + , is_running_function("is_running_function") + , is_running_parameters("is_running_parameters") + , is_starting_function("is_starting_function") + , is_starting_parameters("is_starting_parameters") { } LLCommand::LLCommand(const LLCommand::Params& p) - : mFunction(p.function) - , mAvailableInToybox(p.available_in_toybox) + : mAvailableInToybox(p.available_in_toybox) , mIcon(p.icon) , mIdentifier(p.name) , mLabelRef(p.label_ref) - , mParameter(p.parameter) , mTooltipRef(p.tooltip_ref) + , mExecuteFunction(p.execute_function) + , mExecuteParameters(p.execute_parameters) + , mIsEnabledFunction(p.is_enabled_function) + , mIsEnabledParameters(p.is_enabled_parameters) + , mIsRunningFunction(p.is_running_function) + , mIsRunningParameters(p.is_running_parameters) + , mIsStartingFunction(p.is_starting_function) + , mIsStartingParameters(p.is_starting_parameters) { } diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 6481a05689..3ac5548a0d 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -83,41 +83,72 @@ private: typedef std::list command_id_list_t; + class LLCommand { public: struct Params : public LLInitParam::Block { Mandatory available_in_toybox; - Mandatory function; Mandatory icon; Mandatory label_ref; Mandatory name; - Optional parameter; Mandatory tooltip_ref; + Mandatory execute_function; + Optional execute_parameters; + + Optional is_enabled_function; + Optional is_enabled_parameters; + + Optional is_running_function; + Optional is_running_parameters; + + Optional is_starting_function; + Optional is_starting_parameters; + Params(); }; LLCommand(const LLCommand::Params& p); const bool availableInToybox() const { return mAvailableInToybox; } - const std::string& functionName() const { return mFunction; } const std::string& icon() const { return mIcon; } const LLCommandId& id() const { return mIdentifier; } const std::string& labelRef() const { return mLabelRef; } - const LLSD& parameter() const { return mParameter; } const std::string& tooltipRef() const { return mTooltipRef; } + const std::string& executeFunctionName() const { return mExecuteFunction; } + const LLSD& executeParameters() const { return mExecuteParameters; } + + const std::string& isEnabledFunctionName() const { return mIsEnabledFunction; } + const LLSD& isEnabledParameters() const { return mIsEnabledParameters; } + + const std::string& isRunningFunctionName() const { return mIsRunningFunction; } + const LLSD& isRunningParameters() const { return mIsRunningParameters; } + + const std::string& isStartingFunctionName() const { return mIsStartingFunction; } + const LLSD& isStartingParameters() const { return mIsStartingParameters; } + private: LLCommandId mIdentifier; bool mAvailableInToybox; - std::string mFunction; std::string mIcon; std::string mLabelRef; - LLSD mParameter; std::string mTooltipRef; + + std::string mExecuteFunction; + LLSD mExecuteParameters; + + std::string mIsEnabledFunction; + LLSD mIsEnabledParameters; + + std::string mIsRunningFunction; + LLSD mIsRunningParameters; + + std::string mIsStartingFunction; + LLSD mIsStartingParameters; }; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index efa077ffa1..a544aa9ec7 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -525,8 +525,8 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) if (!mReadOnly) { LLUICtrl::CommitCallbackParam cbParam; - cbParam.function_name = commandp->functionName(); - cbParam.parameter = commandp->parameter(); + cbParam.function_name = commandp->executeFunctionName(); + cbParam.parameter = commandp->executeParameters(); button->setCommitCallback(cbParam); button->setStartDragCallback(mStartDragItemCallback); button->setHandleDragCallback(mHandleDragItemCallback); diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 77bf7cace3..3a91ef490d 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -5,183 +5,183 @@ icon="Command_AboutLand_Icon" label_ref="Command_AboutLand_Label" tooltip_ref="Command_AboutLand_Tooltip" - function="Floater.ToolbarToggle" - parameter="about_land" + execute_function="Floater.ToolbarToggle" + execute_parameters="about_land" /> diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index 7a6afb4e33..cf22e071aa 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -61,8 +61,6 @@ BOOL LLFloaterToybox::postBuild() center(); mBtnRestoreDefaults = getChild("btn_restore_defaults"); - mBtnRestoreDefaults->setCommitCallback(boost::bind(&LLToolBarView::loadDefaultToolbars)); - mToolBar = getChild("toybox_toolbar"); LLCommandManager& cmdMgr = LLCommandManager::instance(); @@ -97,46 +95,26 @@ BOOL LLFloaterToybox::postBuild() return TRUE; } -void LLFloaterToybox::onOpen(const LLSD& key) -{ - -} - -BOOL LLFloaterToybox::canClose() -{ - return TRUE; -} - -void LLFloaterToybox::onClose(bool app_quitting) -{ - -} - void LLFloaterToybox::draw() { llassert(gToolBarView != NULL); - LLCommandManager& cmdMgr = LLCommandManager::instance(); + const command_id_list_t& command_list = mToolBar->getCommandsList(); - for (U32 i = 0; i < cmdMgr.commandCount(); i++) + for (command_id_list_t::const_iterator it = command_list.begin(); it != command_list.end(); ++it) { - LLCommand * command = cmdMgr.getCommand(i); + const LLCommandId& id = *it; - if (command->availableInToybox()) - { - mToolBar->enableCommand(command->id(), !gToolBarView->hasCommand(command->id())); - } + const bool commandOnToolbar = gToolBarView->hasCommand(id); + mToolBar->enableCommand(id, !commandOnToolbar); } LLFloater::draw(); } -void LLFloaterToybox::onFocusReceived() -{ -} - void LLFloaterToybox::onBtnRestoreDefaults() { + LLToolBarView::loadDefaultToolbars(); } diff --git a/indra/newview/llfloatertoybox.h b/indra/newview/llfloatertoybox.h index 3574e060bf..f7245506c5 100644 --- a/indra/newview/llfloatertoybox.h +++ b/indra/newview/llfloatertoybox.h @@ -42,11 +42,7 @@ public: // virtuals BOOL postBuild(); - void onOpen(const LLSD& key); - BOOL canClose(); - void onClose(bool app_quitting); void draw(); - void onFocusReceived(); protected: void onBtnRestoreDefaults(); -- cgit v1.2.3 From a8fcfc5e19811ce579799d415a9ad63a0f1f6dc7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 4 Oct 2011 14:11:45 -0700 Subject: removed attempt at templating LLUI::Clamp values in order to get build working again --- indra/llcommon/llapr.h | 3 -- indra/llcommon/llprocesslauncher.h | 1 - indra/llrender/llglheaders.h | 1 - indra/llui/lltoolbar.h | 4 +-- indra/llui/llui.h | 72 +++++++++++++++++--------------------- indra/llwindow/lldragdropwin32.h | 2 -- indra/llwindow/llwindowwin32.h | 1 - indra/win_crash_logger/StdAfx.h | 1 - 8 files changed, 34 insertions(+), 51 deletions(-) diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 286fc43a77..3f846f1314 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -37,9 +37,6 @@ // If you get undefined symbols, find the appropriate // Windows header file and include that in your .cpp file. #define WIN32_LEAN_AND_MEAN - // do not define min() and max() macros, which collide with - // things like numeric_limits - #define NOMINMAX #include #include #endif diff --git a/indra/llcommon/llprocesslauncher.h b/indra/llcommon/llprocesslauncher.h index 23e48b1823..954c249147 100644 --- a/indra/llcommon/llprocesslauncher.h +++ b/indra/llcommon/llprocesslauncher.h @@ -28,7 +28,6 @@ #define LL_LLPROCESSLAUNCHER_H #if LL_WINDOWS -#define NOMINMAX #include #endif diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index b936fd30f8..851a75629e 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -520,7 +520,6 @@ extern PFNGLSAMPLEMASKIPROC glSampleMaski; // windows gl headers depend on things like APIENTRY, so include windows. #define WIN32_LEAN_AND_MEAN -#define NOMINMAX #include #include diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 407cbde7d2..3c317e10a2 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -45,7 +45,7 @@ class LLToolBarButton : public LLButton public: struct Params : public LLInitParam::Block { - Optional > button_width; + Optional button_width; Optional desired_height; Params() @@ -67,7 +67,7 @@ private: LLCommandId mId; S32 mMouseDownX; S32 mMouseDownY; - LLUI::Range mWidthRange; + LLUI::RangeS32 mWidthRange; S32 mDesiredHeight; bool mIsDragged; startdrag_callback_t mStartDragItemCallback; diff --git a/indra/llui/llui.h b/indra/llui/llui.h index af8f239657..28e84fa444 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -151,46 +151,43 @@ public: // // Classes // - template - struct RangeParams : public LLInitParam::Block > - { - Optional minimum, - maximum; - RangeParams() - : minimum("min", T()), - maximum("max", std::numeric_limits::max()) - {} - }; - - template - struct Range + struct RangeS32 { - typedef Range self_t; + struct Params : public LLInitParam::Block + { + Optional minimum, + maximum; + + Params() + : minimum("min", 0), + maximum("max", S32_MAX) + {} + }; // correct for inverted params - Range(const RangeParams& p = RangeParams()) - : mMin(p.minimum), + RangeS32(const Params& p = Params()) + : mMin(p.minimum), mMax(p.maximum) { sanitizeRange(); } - Range(T minimum, T maximum) - : mMin(minimum), + RangeS32(S32 minimum, S32 maximum) + : mMin(minimum), mMax(maximum) { sanitizeRange(); } - S32 clamp(T input) + S32 clamp(S32 input) { if (input < mMin) return mMin; if (input > mMax) return mMax; return input; } - void setRange(T minimum, T maximum) + void setRange(S32 minimum, S32 maximum) { mMin = minimum; mMax = maximum; @@ -200,7 +197,7 @@ public: S32 getMin() { return mMin; } S32 getMax() { return mMax; } - bool operator==(const self_t& other) const + bool operator==(const RangeS32& other) const { return mMin == other.mMin && mMax == other.mMax; @@ -218,60 +215,55 @@ public: } - T mMin, + S32 mMin, mMax; }; - template - struct ClampedValue : public Range + struct ClampedS32 : public RangeS32 { - typedef Range range_t; - - struct Params : public LLInitParam::Block > + struct Params : public LLInitParam::Block { - Mandatory value; + Mandatory value; Params() - : value("", T()) + : value("", 0) { addSynonym(value, "value"); } }; - ClampedValue(const Params& p) - : range_t(p) + ClampedS32(const Params& p) + : RangeS32(p) {} - ClampedValue(const range_t& range) - : range_t(range) + ClampedS32(const RangeS32& range) + : RangeS32(range) { // set value here, after range has been sanitized mValue = clamp(0); } - ClampedValue(T value, const range_t& range = range_t()) - : range_t(range) + ClampedS32(S32 value, const RangeS32& range = RangeS32()) + : RangeS32(range) { mValue = clamp(value); } - T get() + S32 get() { return mValue; } - void set(T value) + void set(S32 value) { mValue = clamp(value); } private: - T mValue; + S32 mValue; }; - typedef ClampedValue ClampedS32; - // // Methods // diff --git a/indra/llwindow/lldragdropwin32.h b/indra/llwindow/lldragdropwin32.h index 63054bffec..929e7f9e37 100644 --- a/indra/llwindow/lldragdropwin32.h +++ b/indra/llwindow/lldragdropwin32.h @@ -31,7 +31,6 @@ #ifndef LL_LLDRAGDROP32_H #define LL_LLDRAGDROP32_H -#define NOMINMAX #include #include @@ -55,7 +54,6 @@ class LLDragDropWin32 #ifndef LL_LLDRAGDROP32_H #define LL_LLDRAGDROP32_H -#define NOMINMAX #include #include diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index dc1950fb31..387e4cbdb6 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -29,7 +29,6 @@ // Limit Windows API to small and manageable set. #define WIN32_LEAN_AND_MEAN -#define NOMINMAX #include #include diff --git a/indra/win_crash_logger/StdAfx.h b/indra/win_crash_logger/StdAfx.h index 71faf88bad..35976658ac 100644 --- a/indra/win_crash_logger/StdAfx.h +++ b/indra/win_crash_logger/StdAfx.h @@ -37,7 +37,6 @@ #endif // _MSC_VER > 1000 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define NOMINMAX // don't define min and max macros // Windows Header Files: #include -- cgit v1.2.3 From 05879242832607795040573791b0790891367b81 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 4 Oct 2011 14:55:55 -0700 Subject: * Updating "Move" floater to be more FUI-like --- indra/newview/llmoveview.cpp | 2 -- indra/newview/skins/default/xui/en/floater_moveview.xml | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 142ee40cc8..a29526777a 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -92,8 +92,6 @@ LLFloaterMove::~LLFloaterMove() // virtual BOOL LLFloaterMove::postBuild() { - setIsChrome(TRUE); - setTitleVisible(TRUE); // restore title visibility after chrome applying updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730) LLDockableFloater::postBuild(); diff --git a/indra/newview/skins/default/xui/en/floater_moveview.xml b/indra/newview/skins/default/xui/en/floater_moveview.xml index 6f29255a6b..3c0905a2a5 100644 --- a/indra/newview/skins/default/xui/en/floater_moveview.xml +++ b/indra/newview/skins/default/xui/en/floater_moveview.xml @@ -1,9 +1,9 @@ -- cgit v1.2.3 From 4716969716245ea832400dd087c93a514770cd63 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 4 Oct 2011 15:10:12 -0700 Subject: EXP-1293 Nearby chat toasts no longer appear EXP-1294 Nearby chat floater doesn't accommodate existing chat history when expanded --- indra/newview/llnearbychatbar.cpp | 6 +++++- indra/newview/skins/default/xui/en/floater_chat_bar.xml | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index dbe30e1847..cba4fafe42 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -53,6 +53,8 @@ S32 LLNearbyChatBar::sLastSpecialChatChannel = 0; +const S32 EXPANDED_HEIGHT = 300; + // legacy callback glue void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); @@ -448,13 +450,15 @@ BOOL LLNearbyChatBar::postBuild() // Register for font change notifications LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChatBar::onChatFontChange, this, _1)); + mExpandedHeight = getMinHeight() + EXPANDED_HEIGHT; + return TRUE; } void LLNearbyChatBar::applyRectControl() { LLFloater::applyRectControl(); - if (getRect().getHeight() > getMinHeight()) + if (getRect().getHeight() > getMinHeight()) { getChildView("nearby_chat")->setVisible(true); mExpandedHeight = getRect().getHeight(); diff --git a/indra/newview/skins/default/xui/en/floater_chat_bar.xml b/indra/newview/skins/default/xui/en/floater_chat_bar.xml index 9d61c94eb1..6977e29b78 100644 --- a/indra/newview/skins/default/xui/en/floater_chat_bar.xml +++ b/indra/newview/skins/default/xui/en/floater_chat_bar.xml @@ -2,7 +2,7 @@ diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 0c7e7cff56..1585166114 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -21,7 +21,8 @@ chrome="true" image_overlay_alignment="left" use_ellipses="true" - auto_resize="true"/> + auto_resize="true" + flash_color="EmphasisColor"/> + auto_resize="true" + flash_color="EmphasisColor"/> -- cgit v1.2.3 From 17c699e4281ffff58e24c5db960a5c33018f1747 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 5 Oct 2011 16:29:12 -0700 Subject: * Updated flash_color to use old LLButton highlight_color default. --- indra/llui/lltooltip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index bc6461a0c2..23cdd9ad9a 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -200,7 +200,7 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) icon_params.image_selected(imagep); icon_params.scale_image(true); - icon_params.flash_color(icon_params.highlight_color()); + icon_params.flash_color.control = "ButtonUnselectedFgColor"; mInfoButton = LLUICtrlFactory::create(icon_params); if (p.click_callback.isProvided()) { -- cgit v1.2.3 From 352ae994480a960541050c82f83a25262f8b44e0 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 5 Oct 2011 16:39:00 -0700 Subject: adding floater_destinations.xml --- .../skins/default/xui/en/floater_destinations.xml | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 indra/newview/skins/default/xui/en/floater_destinations.xml diff --git a/indra/newview/skins/default/xui/en/floater_destinations.xml b/indra/newview/skins/default/xui/en/floater_destinations.xml new file mode 100644 index 0000000000..50a279c046 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_destinations.xml @@ -0,0 +1,25 @@ + + + + -- cgit v1.2.3 From 70495f6f2f61687717135f027c224003f5c5360a Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 5 Oct 2011 16:56:49 -0700 Subject: Fixing merge mistakes! --- indra/llui/lltoolbar.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 62217a664a..392e26f496 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -712,8 +712,6 @@ LLToolBarButton::LLToolBarButton(const Params& p) mIsRunningSignal(NULL), mIsStartingSignal(NULL) { - mUUID = LLUUID::generateNewID(p.name); - mButtonFlashRate = 0.0; mButtonFlashCount = 0; } -- cgit v1.2.3 From 64d005bfed6c5adcd29df3ae0774747480a0d839 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 5 Oct 2011 17:04:07 -0700 Subject: EXP-1286 : Add DaD to toybox --- indra/llui/lltoolbar.cpp | 11 ++++++++--- indra/llui/lltoolbar.h | 1 + indra/newview/llfloatertoybox.cpp | 5 ++++- indra/newview/lltoolbarview.cpp | 16 +++++++++------- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 9ffb859053..ef36f426fa 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -103,7 +103,11 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) mPadTop(p.pad_top), mPadBottom(p.pad_bottom), mPadBetween(p.pad_between), - mPopupMenuHandle() + mPopupMenuHandle(), + mStartDragItemCallback(NULL), + mHandleDragItemCallback(NULL), + mHandleDropCallback(NULL), + mDragAndDropTarget(false) { mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text; mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon; @@ -608,9 +612,10 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) cbParam.function_name = commandp->executeFunctionName(); cbParam.parameter = commandp->executeParameters(); button->setCommitCallback(cbParam); - button->setStartDragCallback(mStartDragItemCallback); - button->setHandleDragCallback(mHandleDragItemCallback); } + // Drag and drop behavior must work also if provided in the Toybox and, potentially, any read-only toolbar + button->setStartDragCallback(mStartDragItemCallback); + button->setHandleDragCallback(mHandleDragItemCallback); button->setCommandId(id); return button; diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index a35f6d9db1..b630b82d0f 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -159,6 +159,7 @@ public: void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; } void setHandleDropCallback(tool_handledrop_callback_t cb) { mHandleDropCallback = cb; } + bool isReadOnly() const { return mReadOnly; } LLToolBarButton* createButton(const LLCommandId& id); diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index cf22e071aa..58bb417b71 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -62,7 +62,10 @@ BOOL LLFloaterToybox::postBuild() mBtnRestoreDefaults = getChild("btn_restore_defaults"); mToolBar = getChild("toybox_toolbar"); - + mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragItem,_1,_2,_3)); + mToolBar->setHandleDragCallback(boost::bind(LLToolBarView::handleDragItem,_1,_2,_3,_4)); + mToolBar->setHandleDropCallback(boost::bind(LLToolBarView::handleDrop,_1,_2,_3,_4)); + LLCommandManager& cmdMgr = LLCommandManager::instance(); // diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 5f3e386035..c0408e4850 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -377,24 +377,26 @@ BOOL LLToolBarView::handleDrop( void* cargo_data, S32 x, S32 y, LLToolBar* toolb if (command) { // Convert the (x,y) position in rank in toolbar - int rank = toolbar->getRankFromPosition(x,y); + int rank = 0; + if (!toolbar->isReadOnly()) + { + rank = toolbar->getRankFromPosition(x,y); + } // Suppress the command from the toolbars (including the one it's dropped in, // this will handle move position). gToolBarView->mToolbarLeft->removeCommand(command->id()); gToolBarView->mToolbarRight->removeCommand(command->id()); gToolBarView->mToolbarBottom->removeCommand(command->id()); // Now insert it in the toolbar at the detected rank - toolbar->addCommand(command->id(),rank); + if (!toolbar->isReadOnly()) + { + toolbar->addCommand(command->id(),rank); + } } else { llwarns << "Command couldn't be found in command manager" << llendl; } - - } - else - { - llinfos << "Merov debug : handleDrop. Drop source is not a widget -> nothing to do" << llendl; } return TRUE; -- cgit v1.2.3 From fc5030fcfe9d3ffcbb2ad1ae0b1dacd1699a54ce Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 5 Oct 2011 22:46:30 -0700 Subject: EXP-1286 : Clean-up the mess I added to llcommandmanager. All CommandId now have a trusted UUID which is the base for indexing and comparison. --- indra/llui/llcommandmanager.cpp | 19 ++----------------- indra/llui/llcommandmanager.h | 16 ++++++++++------ indra/newview/lltoolbarview.cpp | 3 ++- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 2bd50af7af..9ce7533e1b 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -114,7 +114,7 @@ LLCommand * LLCommandManager::getCommand(const LLCommandId& commandId) { LLCommand * command_match = NULL; - CommandIndexMap::const_iterator found = mCommandIndices.find(commandId); + CommandIndexMap::const_iterator found = mCommandIndices.find(commandId.uuid()); if (found != mCommandIndices.end()) { @@ -124,25 +124,10 @@ LLCommand * LLCommandManager::getCommand(const LLCommandId& commandId) return command_match; } -LLCommand * LLCommandManager::getCommand(const LLUUID& commandUUID) -{ - LLCommand * command_match = NULL; - - CommandUUIDMap::const_iterator found = mCommandUUIDs.find(commandUUID); - - if (found != mCommandUUIDs.end()) - { - command_match = mCommands[found->second]; - } - - return command_match; -} - void LLCommandManager::addCommand(LLCommand * command) { LLCommandId command_id = command->id(); - mCommandIndices[command_id] = mCommands.size(); - mCommandUUIDs[command_id.uuid()] = mCommands.size(); + mCommandIndices[command_id.uuid()] = mCommands.size(); mCommands.push_back(command); lldebugs << "Successfully added command: " << command->id().name() << llendl; diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 8e5abd6461..8f9f956ec7 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -62,17 +62,24 @@ public: mUUID = LLUUID::generateNewID(p.name); } + LLCommandId(const LLUUID& uuid) + : mName(""), + mUUID(uuid) + + { + } + const std::string& name() const { return mName; } const LLUUID& uuid() const { return mUUID; } bool operator!=(const LLCommandId& command) const { - return (mName != command.mName); + return (mUUID != command.mUUID); } bool operator==(const LLCommandId& command) const { - return (mName == command.mName); + return (mUUID == command.mUUID); } bool operator<(const LLCommandId& command) const @@ -178,7 +185,6 @@ public: U32 commandCount() const; LLCommand * getCommand(U32 commandIndex); LLCommand * getCommand(const LLCommandId& commandId); - LLCommand * getCommand(const LLUUID& commandUUID); static bool load(); @@ -186,13 +192,11 @@ protected: void addCommand(LLCommand * command); private: - typedef std::map CommandUUIDMap; - typedef std::map CommandIndexMap; + typedef std::map CommandIndexMap; typedef std::vector CommandVector; CommandVector mCommands; CommandIndexMap mCommandIndices; - CommandUUIDMap mCommandUUIDs; }; diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index c0408e4850..95ed603bbf 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -373,7 +373,8 @@ BOOL LLToolBarView::handleDrop( void* cargo_data, S32 x, S32 y, LLToolBar* toolb //llinfos << "Merov debug : handleDrop. Drop source is a widget -> drop it in place..." << llendl; // Get the command from its uuid LLCommandManager& mgr = LLCommandManager::instance(); - LLCommand* command = mgr.getCommand(inv_item->getUUID()); + LLCommandId command_id(inv_item->getUUID()); + LLCommand* command = mgr.getCommand(command_id); if (command) { // Convert the (x,y) position in rank in toolbar -- cgit v1.2.3 From 5d414d6decbf05feae154c992291deab34ed8b92 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 6 Oct 2011 09:40:05 +0300 Subject: Linux build fix. --- indra/integration_tests/llui_libtest/CMakeLists.txt | 1 + indra/newview/llfloaterdestinations.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/integration_tests/llui_libtest/CMakeLists.txt b/indra/integration_tests/llui_libtest/CMakeLists.txt index df47167154..1180460f4b 100644 --- a/indra/integration_tests/llui_libtest/CMakeLists.txt +++ b/indra/integration_tests/llui_libtest/CMakeLists.txt @@ -71,6 +71,7 @@ endif (DARWIN) # Sort by high-level to low-level target_link_libraries(llui_libtest llui + llinventory llmessage ${LLRENDER_LIBRARIES} ${LLIMAGE_LIBRARIES} diff --git a/indra/newview/llfloaterdestinations.cpp b/indra/newview/llfloaterdestinations.cpp index fa7e2a742c..647b3b5046 100644 --- a/indra/newview/llfloaterdestinations.cpp +++ b/indra/newview/llfloaterdestinations.cpp @@ -48,4 +48,4 @@ LLFloaterDestinations::~LLFloaterDestinations() BOOL LLFloaterDestinations::postBuild() { return TRUE; -} \ No newline at end of file +} -- cgit v1.2.3 From fc489b12c99abab8a61fb3c7546fe802065fe2b0 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 6 Oct 2011 10:37:22 -0700 Subject: Updated to pass coding policy checks --- indra/newview/llfloaterdestinations.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfloaterdestinations.cpp b/indra/newview/llfloaterdestinations.cpp index fa7e2a742c..ce36f7759c 100644 --- a/indra/newview/llfloaterdestinations.cpp +++ b/indra/newview/llfloaterdestinations.cpp @@ -48,4 +48,5 @@ LLFloaterDestinations::~LLFloaterDestinations() BOOL LLFloaterDestinations::postBuild() { return TRUE; -} \ No newline at end of file +} + -- cgit v1.2.3 From 63b357758ea83dce34d8bc3e2f8ee7246b5aced5 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 6 Oct 2011 14:38:02 -0700 Subject: EXP-1205 FIX -- Some characters in description of toybox dialog is cut off at the bottom --- indra/newview/skins/default/xui/en/floater_toybox.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index 5c6fa5bc86..653788bd3c 100644 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -18,6 +18,7 @@ Date: Thu, 6 Oct 2011 15:19:15 -0700 Subject: EXP-1300 WIP Visual feedback for Drag and Drop removed hover highlighting of buttons when dragging over them also updated toolbar button art to match spec --- indra/llui/llbutton.cpp | 13 ++++--------- indra/llui/llbutton.h | 1 - indra/llui/lltoolbar.cpp | 2 +- indra/newview/skins/default/xui/en/widgets/toolbar.xml | 7 +++++++ 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index c9ee62296f..68cb5164b6 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -515,15 +515,6 @@ BOOL LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) return TRUE; } - -void LLButton::onMouseEnter(S32 x, S32 y, MASK mask) -{ - LLUICtrl::onMouseEnter(x, y, mask); - - if (isInEnabledChain()) - mNeedsHighlight = TRUE; -} - void LLButton::onMouseLeave(S32 x, S32 y, MASK mask) { LLUICtrl::onMouseLeave(x, y, mask); @@ -538,6 +529,10 @@ void LLButton::setHighlight(bool b) BOOL LLButton::handleHover(S32 x, S32 y, MASK mask) { + if (isInEnabledChain() + && (!gFocusMgr.getMouseCapture() || gFocusMgr.getMouseCapture() != this)) + mNeedsHighlight = TRUE; + if (!childrenHandleHover(x, y, mask)) { if (mMouseDownTimer.getStarted()) diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 14c1d01c7e..a0a7b4e372 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -160,7 +160,6 @@ public: virtual void draw(); /*virtual*/ BOOL postBuild(); - virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); virtual void onMouseCaptureLost(); diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 7fc6a6de8d..63a1706fe4 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -577,7 +577,7 @@ void LLToolBar::draw() if (command && btn->mIsRunningSignal) { const bool button_command_running = (*btn->mIsRunningSignal)(btn, command->isRunningParameters()); - btn->setFlashing(button_command_running); + btn->setToggleState(button_command_running); } } } diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 1585166114..613dc66762 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -12,6 +12,10 @@ bg_opaque_image_overlay="MouseGray" background_opaque="true"/> Date: Thu, 6 Oct 2011 16:42:19 -0700 Subject: Updated FUI toolbar buttons and corresponding floaters including: * About land * Appearance * Gestures * Inventory * Map * Nearby voice * Snapshot --- indra/newview/app_settings/commands.xml | 4 ++-- indra/newview/skins/default/xui/en/floater_about_land.xml | 2 +- indra/newview/skins/default/xui/en/floater_gesture.xml | 2 +- .../newview/skins/default/xui/en/floater_my_appearance.xml | 3 ++- .../newview/skins/default/xui/en/floater_my_inventory.xml | 2 +- indra/newview/skins/default/xui/en/floater_snapshot.xml | 4 ++-- .../skins/default/xui/en/floater_voice_controls.xml | 10 +++++----- indra/newview/skins/default/xui/en/floater_world_map.xml | 2 +- indra/newview/skins/default/xui/en/sidepanel_inventory.xml | 14 +++++++------- 9 files changed, 22 insertions(+), 21 deletions(-) diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 1fff95417b..8ee4b7d075 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -96,9 +96,9 @@ label_ref="Command_Inventory_Label" tooltip_ref="Command_Inventory_Tooltip" execute_function="Floater.ToolbarToggle" - execute_parameters="inventory" + execute_parameters="my_inventory" is_running_function="Floater.IsOpen" - is_running_parameters="inventory" + is_running_parameters="my_inventory" /> diff --git a/indra/newview/skins/default/xui/en/floater_gesture.xml b/indra/newview/skins/default/xui/en/floater_gesture.xml index 9f5e6828d2..c0424f4de3 100644 --- a/indra/newview/skins/default/xui/en/floater_gesture.xml +++ b/indra/newview/skins/default/xui/en/floater_gesture.xml @@ -5,7 +5,7 @@ height="465" name="gestures" help_topic="gestures" - title="GESTURES" + title="Gestures" background_visible="true" follows="all" label="Places" diff --git a/indra/newview/skins/default/xui/en/floater_my_appearance.xml b/indra/newview/skins/default/xui/en/floater_my_appearance.xml index 8f97887b3f..de2aa49c0c 100644 --- a/indra/newview/skins/default/xui/en/floater_my_appearance.xml +++ b/indra/newview/skins/default/xui/en/floater_my_appearance.xml @@ -6,9 +6,10 @@ height="588" layout="topleft" name="floater_my_appearance" + help_topic="appearance" save_rect="true" single_instance="true" - title="MY APPEARANCE" + title="Appearance" width="333"> diff --git a/indra/newview/skins/default/xui/en/floater_voice_controls.xml b/indra/newview/skins/default/xui/en/floater_voice_controls.xml index f017a7ace6..447549db44 100644 --- a/indra/newview/skins/default/xui/en/floater_voice_controls.xml +++ b/indra/newview/skins/default/xui/en/floater_voice_controls.xml @@ -2,14 +2,14 @@ - NEARBY VOICE + Nearby voice - Group Call with [GROUP] + Group call with [GROUP] - Conference Call + Conference call diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml index 019e7cd032..3d997a17f7 100644 --- a/indra/newview/skins/default/xui/en/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en/floater_world_map.xml @@ -12,7 +12,7 @@ save_rect="true" save_visibility="true" single_instance="true" - title="WORLD MAP" + title="World map" width="650"> - Received Items ([NUM]) - Received Items + Received items ([NUM]) + Received items + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml index 5475fcd245..3c69a0cb6c 100644 --- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml @@ -64,14 +64,32 @@ user_resize="false" mouse_opaque="false" height="100" - width="100"> + width="200"> + width="200"/> + + + + width="200"/> Date: Mon, 10 Oct 2011 12:16:12 -0700 Subject: sync with viewer-development --- .../newview/skins/default/xui/en/floater_stats.xml | 339 ++++++++++++++------- 1 file changed, 237 insertions(+), 102 deletions(-) diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml index b87cb9a433..406114294d 100644 --- a/indra/newview/skins/default/xui/en/floater_stats.xml +++ b/indra/newview/skins/default/xui/en/floater_stats.xml @@ -10,7 +10,7 @@ save_rect="true" save_visibility="true" title="STATISTICS" - width="250"> + width="260"> - + width="260"> + + @@ -52,9 +53,10 @@ unit_label="kbps" stat="kbitstat" bar_min="0" - bar_max="900" - tick_spacing="100" - label_spacing="300" + bar_max="5000" + tick_spacing="500" + label_spacing="1000" + precision="0" show_bar="true" show_history="false"> @@ -65,9 +67,9 @@ stat="packetslostpercentstat" bar_min="0" bar_max="5" - tick_spacing="1" + tick_spacing="0.5" label_spacing="1" - precision="1" + precision="3" show_per_sec="false" show_bar="false" show_mean="true"> @@ -78,15 +80,17 @@ unit_label="msec" stat="simpingstat" bar_min="0" - bar_max="1000" - tick_spacing="100" - label_spacing="200" + bar_max="5000" + tick_spacing="500" + label_spacing="1000" + precision="0" show_bar="false" show_per_sec="false" show_mean="false"> - + - + bar_max="10000" + tick_spacing="1000" + label_spacing="2000" + precision="0" + show_per_sec="false" + show_bar="false"> + - + bar_max="200000" + tick_spacing="25000" + label_spacing="50000" + precision="0" + show_bar="false"> + @@ -138,13 +144,14 @@ unit_label="/sec" stat="numnewobjectsstat" bar_min="0" - bar_max="1000" - tick_spacing="100" - label_spacing="500" + bar_max="2000" + tick_spacing="200" + label_spacing="400" show_per_sec="true" show_bar="false"> + - + show_per_sec="false" + show_bar="false"> + - + show_per_sec="false" + show_bar="false"> + - + show_per_sec="false" + show_bar="false"> + - + show_per_sec="false" + show_bar="false"> + - + @@ -239,7 +255,12 @@ name="packetsoutstat" label="Packets Out" stat="packetsoutstat" - unit_label="/sec" + unit_label="/sec" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" show_bar="false" > @@ -247,7 +268,12 @@ name="objectkbitstat" label="Objects" stat="objectkbitstat" - unit_label="kbps" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" show_bar="false" > @@ -255,7 +281,12 @@ name="texturekbitstat" label="Texture" stat="texturekbitstat" - unit_label="kbps" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" show_bar="false" > @@ -263,7 +294,12 @@ name="assetkbitstat" label="Asset" stat="assetkbitstat" - unit_label="kbps" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" show_bar="false" > @@ -271,7 +307,12 @@ name="layerskbitstat" label="Layers" stat="layerskbitstat" - unit_label="kbps" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" show_bar="false" > @@ -279,12 +320,13 @@ name="actualinkbitstat" label="Actual In" stat="actualinkbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - show_bar="true" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false" show_history="false" > @@ -292,26 +334,27 @@ name="actualoutkbitstat" label="Actual Out" stat="actualoutkbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="512.f" - tick_spacing="128.f" - label_spacing="256.f" - show_bar="true" + unit_label="kbps" + bar_min="0.f" + bar_max="1024.f" + tick_spacing="128.f" + label_spacing="256.f" + precision="1" + show_bar="false" show_history="false"> - + @@ -335,10 +378,11 @@ name="simfps" label="Sim FPS" stat="simfps" + precision="1" bar_min="0.f" - bar_max="200.f" - tick_spacing="20.f" - label_spacing="100.f" + bar_max="45.f" + tick_spacing="7.5f" + label_spacing="15.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -350,9 +394,9 @@ stat="simphysicsfps" precision="1" bar_min="0.f" - bar_max="66.f" - tick_spacing="33.f" - label_spacing="33.f" + bar_max="45.f" + tick_spacing="7.5.f" + label_spacing="15.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -369,8 +413,8 @@ precision="0" bar_min="0.f" bar_max="500.f" - tick_spacing="10.f" - label_spacing="40.f" + tick_spacing="50.f" + label_spacing="100.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -383,8 +427,8 @@ precision="0" bar_min="0.f" bar_max="500.f" - tick_spacing="10.f" - label_spacing="40.f" + tick_spacing="50.f" + label_spacing="100.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -395,7 +439,7 @@ label="Memory Allocated" stat="physicsmemoryallocated" unit_label="MB" - precision="0" + precision="1" bar_min="0.f" bar_max="1024.f" tick_spacing="128.f" @@ -468,9 +512,9 @@ stat="simactiveobjects" precision="0" bar_min="0.f" - bar_max="800.f" - tick_spacing="100.f" - label_spacing="200.f" + bar_max="5000.f" + tick_spacing="750.f" + label_spacing="1250.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -482,9 +526,9 @@ stat="simactivescripts" precision="0" bar_min="0.f" - bar_max="800.f" - tick_spacing="100.f" - label_spacing="200.f" + bar_max="15000.f" + tick_spacing="1875.f" + label_spacing="3750.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -497,9 +541,9 @@ unit_label="eps" precision="0" bar_min="0.f" - bar_max="20000.f" - tick_spacing="2500.f" - label_spacing="5000.f" + bar_max="5000.f" + tick_spacing="750.f" + label_spacing="1250.f" show_per_sec="false" show_bar="false" show_mean="false" > @@ -568,7 +612,7 @@ label="Total Unacked Bytes" stat="simtotalunackedbytes" unit_label="kb" - precision="0" + precision="1" bar_min="0.f" bar_max="100000.f" tick_spacing="25000.f" @@ -587,7 +631,7 @@ label="Total Frame Time" stat="simframemsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -602,7 +646,7 @@ label="Net Time" stat="simnetmsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -617,7 +661,7 @@ label="Physics Time" stat="simsimphysicsmsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -632,7 +676,7 @@ label="Simulation Time" stat="simsimothermsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -647,7 +691,7 @@ label="Agent Time" stat="simagentmsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -662,7 +706,7 @@ label="Images Time" stat="simimagesmsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -677,7 +721,7 @@ label="Script Time" stat="simscriptmsec" unit_label="ms" - precision="1" + precision="3" bar_min="0.f" bar_max="40.f" tick_spacing="10.f" @@ -686,6 +730,97 @@ show_bar="false" show_mean="false" > + + + + + + + + + + + + + + + + -- cgit v1.2.3 From e61569d71422931e0d1f8d7e2f6e4db13d8b03ba Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 14:08:14 -0700 Subject: added compound LLSD parsing to param blocks reviewed by Leslie --- indra/llui/llnotifications.cpp | 72 ++++------ indra/llui/llsdparam.cpp | 255 ++++++++++++++++++----------------- indra/llui/llsdparam.h | 66 ++++----- indra/llui/tests/llurlentry_stub.cpp | 2 +- indra/llui/tests/llurlentry_test.cpp | 1 - indra/llui/tests/llurlmatch_test.cpp | 4 +- indra/llxuixml/llinitparam.cpp | 52 ++++--- indra/llxuixml/llinitparam.h | 155 ++++++++++++--------- indra/llxuixml/llxuiparser.cpp | 50 ++++--- indra/llxuixml/llxuiparser.h | 36 +++-- indra/newview/llappviewer.cpp | 47 +++---- 11 files changed, 376 insertions(+), 364 deletions(-) diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index ffe5908a9d..8f7025a9a6 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -46,6 +46,7 @@ #include #include +#include const std::string NOTIFICATION_PERSIST_VERSION = "0.93"; @@ -416,23 +417,17 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mSoundEffect = LLUUID(LLUI::sSettingGroups["config"]->getString(p.sound)); } - for(LLInitParam::ParamIterator::const_iterator it = p.unique.contexts.begin(), - end_it = p.unique.contexts.end(); - it != end_it; - ++it) + BOOST_FOREACH(const LLNotificationTemplate::UniquenessContext& context, p.unique.contexts) { - mUniqueContext.push_back(it->value); + mUniqueContext.push_back(context.value); } lldebugs << "notification \"" << mName << "\": tag count is " << p.tags.size() << llendl; - for(LLInitParam::ParamIterator::const_iterator it = p.tags.begin(), - end_it = p.tags.end(); - it != end_it; - ++it) + BOOST_FOREACH(const LLNotificationTemplate::Tag& tag, p.tags) { - lldebugs << " tag \"" << std::string(it->value) << "\"" << llendl; - mTags.push_back(it->value); + lldebugs << " tag \"" << std::string(tag.value) << "\"" << llendl; + mTags.push_back(tag.value); } mForm = LLNotificationFormPtr(new LLNotificationForm(p.name, p.form_ref.form)); @@ -1397,14 +1392,12 @@ void replaceFormText(LLNotificationForm::Params& form, const std::string& patter { form.ignore.text = replace; } - for (LLInitParam::ParamIterator::iterator it = form.form_elements.elements.begin(), - end_it = form.form_elements.elements.end(); - it != end_it; - ++it) + + BOOST_FOREACH(LLNotificationForm::FormElement& element, form.form_elements.elements) { - if (it->button.isChosen() && it->button.text() == pattern) + if (element.button.isChosen() && element.button.text() == pattern) { - it->button.text = replace; + element.button.text = replace; } } } @@ -1453,48 +1446,42 @@ bool LLNotifications::loadTemplates() mTemplates.clear(); - for(LLInitParam::ParamIterator::const_iterator it = params.strings.begin(), end_it = params.strings.end(); - it != end_it; - ++it) + BOOST_FOREACH(LLNotificationTemplate::GlobalString& string, params.strings) { - mGlobalStrings[it->name] = it->value; + mGlobalStrings[string.name] = string.value; } std::map form_templates; - for(LLInitParam::ParamIterator::const_iterator it = params.templates.begin(), end_it = params.templates.end(); - it != end_it; - ++it) + BOOST_FOREACH(LLNotificationTemplate::Template& notification_template, params.templates) { - form_templates[it->name] = it->form; + form_templates[notification_template.name] = notification_template.form; } - for(LLInitParam::ParamIterator::iterator it = params.notifications.begin(), end_it = params.notifications.end(); - it != end_it; - ++it) + BOOST_FOREACH(LLNotificationTemplate::Params& notification, params.notifications) { - if (it->form_ref.form_template.isChosen()) + if (notification.form_ref.form_template.isChosen()) { // replace form contents from template - it->form_ref.form = form_templates[it->form_ref.form_template.name]; - if(it->form_ref.form_template.yes_text.isProvided()) + notification.form_ref.form = form_templates[notification.form_ref.form_template.name]; + if(notification.form_ref.form_template.yes_text.isProvided()) { - replaceFormText(it->form_ref.form, "$yestext", it->form_ref.form_template.yes_text); + replaceFormText(notification.form_ref.form, "$yestext", notification.form_ref.form_template.yes_text); } - if(it->form_ref.form_template.no_text.isProvided()) + if(notification.form_ref.form_template.no_text.isProvided()) { - replaceFormText(it->form_ref.form, "$notext", it->form_ref.form_template.no_text); + replaceFormText(notification.form_ref.form, "$notext", notification.form_ref.form_template.no_text); } - if(it->form_ref.form_template.cancel_text.isProvided()) + if(notification.form_ref.form_template.cancel_text.isProvided()) { - replaceFormText(it->form_ref.form, "$canceltext", it->form_ref.form_template.cancel_text); + replaceFormText(notification.form_ref.form, "$canceltext", notification.form_ref.form_template.cancel_text); } - if(it->form_ref.form_template.ignore_text.isProvided()) + if(notification.form_ref.form_template.ignore_text.isProvided()) { - replaceFormText(it->form_ref.form, "$ignoretext", it->form_ref.form_template.ignore_text); + replaceFormText(notification.form_ref.form, "$ignoretext", notification.form_ref.form_template.ignore_text); } } - mTemplates[it->name] = LLNotificationTemplatePtr(new LLNotificationTemplate(*it)); + mTemplates[notification.name] = LLNotificationTemplatePtr(new LLNotificationTemplate(notification)); } return true; @@ -1517,12 +1504,9 @@ bool LLNotifications::loadVisibilityRules() mVisibilityRules.clear(); - for(LLInitParam::ParamIterator::iterator it = params.rules.begin(), - end_it = params.rules.end(); - it != end_it; - ++it) + BOOST_FOREACH(LLNotificationVisibilityRule::Rule& rule, params.rules) { - mVisibilityRules.push_back(LLNotificationVisibilityRulePtr(new LLNotificationVisibilityRule(*it))); + mVisibilityRules.push_back(LLNotificationVisibilityRulePtr(new LLNotificationVisibilityRule(rule))); } return true; diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 4b69360e33..83bed3e745 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -34,6 +34,7 @@ static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; static LLInitParam::Parser::parser_inspect_func_map_t sInspectFuncs; +static const LLSD NO_VALUE_MARKER; // // LLParamSDParser @@ -60,29 +61,32 @@ LLParamSDParser::LLParamSDParser() } // special case handling of U32 due to ambiguous LLSD::assign overload -bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack) +bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const void* val_ptr, parser_t::name_stack_t& name_stack) { LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; - LLSD* sd_to_write = sdparser.getSDWriteNode(name_stack); - if (!sd_to_write) return false; + LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, std::make_pair(name_stack.begin(), name_stack.end())); + sd_to_write.assign((S32)*((const U32*)val_ptr)); - sd_to_write->assign((S32)*((const U32*)val_ptr)); return true; } -bool LLParamSDParser::writeFlag(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack) +bool LLParamSDParser::writeFlag(LLParamSDParser::parser_t& parser, const void* val_ptr, parser_t::name_stack_t& name_stack) { LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; - LLSD* sd_to_write = sdparser.getSDWriteNode(name_stack); - if (!sd_to_write) return false; + LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, std::make_pair(name_stack.begin(), name_stack.end())); return true; } +void LLParamSDParser::submit(LLInitParam::BaseBlock& block, const LLSD& sd, LLInitParam::Parser::name_stack_t& name_stack) +{ + mCurReadSD = &sd; + block.submitValue(name_stack, *this); +} void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent) { @@ -90,7 +94,8 @@ void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool mNameStack.clear(); setParseSilently(silent); - readSDValues(sd, block); + LLParamSDParserUtilities::readSDValues(boost::bind(&LLParamSDParser::submit, this, boost::ref(block), _1, _2), sd, mNameStack); + //readSDValues(sd, block); } void LLParamSDParser::writeSD(LLSD& sd, const LLInitParam::BaseBlock& block) @@ -100,43 +105,6 @@ void LLParamSDParser::writeSD(LLSD& sd, const LLInitParam::BaseBlock& block) block.serializeBlock(*this); } -const LLSD NO_VALUE_MARKER; - -void LLParamSDParser::readSDValues(const LLSD& sd, LLInitParam::BaseBlock& block) -{ - if (sd.isMap()) - { - for (LLSD::map_const_iterator it = sd.beginMap(); - it != sd.endMap(); - ++it) - { - mNameStack.push_back(make_pair(it->first, newParseGeneration())); - readSDValues(it->second, block); - mNameStack.pop_back(); - } - } - else if (sd.isArray()) - { - for (LLSD::array_const_iterator it = sd.beginArray(); - it != sd.endArray(); - ++it) - { - mNameStack.back().second = newParseGeneration(); - readSDValues(*it, block); - } - } - else if (sd.isUndefined()) - { - mCurReadSD = &NO_VALUE_MARKER; - block.submitValue(mNameStack, *this); - } - else - { - mCurReadSD = &sd; - block.submitValue(mNameStack, *this); - } -} - /*virtual*/ std::string LLParamSDParser::getCurrentElementName() { std::string full_name = "sd"; @@ -150,81 +118,6 @@ void LLParamSDParser::readSDValues(const LLSD& sd, LLInitParam::BaseBlock& block return full_name; } -LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack) -{ - //TODO: implement nested LLSD writing - LLSD* sd_to_write = mWriteRootSD; - bool new_traversal = false; - for (name_stack_t::const_iterator it = name_stack.begin(), prev_it = mNameStack.begin(); - it != name_stack.end(); - ++it) - { - bool new_array_entry = false; - if (prev_it == mNameStack.end()) - { - new_traversal = true; - } - else - { - if (!new_traversal // have not diverged yet from previous trace - && prev_it->first == it->first // names match - && prev_it->second != it->second) // versions differ - { - // name stacks match, but version numbers differ in last place. - // create a different entry at this point using an LLSD array - new_array_entry = true; - } - if (prev_it->first != it->first // names differ - || prev_it->second != it->second) // versions differ - { - // at this point we have diverged from our last trace - // so any elements referenced here are new - new_traversal = true; - } - } - - LLSD* child_sd = it->first.empty() ? sd_to_write : &(*sd_to_write)[it->first]; - - if (child_sd->isArray()) - { - if (new_traversal) - { - // write to new element at end - sd_to_write = &(*child_sd)[child_sd->size()]; - } - else - { - // write to last of existing elements, or first element if empty - sd_to_write = &(*child_sd)[llmax(0, child_sd->size() - 1)]; - } - } - else - { - if (new_array_entry && !child_sd->isArray()) - { - // copy child contents into first element of an array - LLSD new_array = LLSD::emptyArray(); - new_array.append(*child_sd); - // assign array to slot that previously held the single value - *child_sd = new_array; - // return next element in that array - sd_to_write = &((*child_sd)[1]); - } - else - { - sd_to_write = child_sd; - } - } - if (prev_it != mNameStack.end()) - { - ++prev_it; - } - } - mNameStack = name_stack; - - //llinfos << ll_pretty_print_sd(*mWriteRootSD) << llendl; - return sd_to_write; -} bool LLParamSDParser::readFlag(Parser& parser, void* val_ptr) { @@ -312,3 +205,125 @@ bool LLParamSDParser::readSD(Parser& parser, void* val_ptr) *((LLSD*)val_ptr) = *self.mCurReadSD; return true; } + +// static +LLSD& LLParamSDParserUtilities::getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range) +{ + LLSD* sd_to_write = &input; + + for (LLInitParam::Parser::name_stack_t::iterator it = name_stack_range.first; + it != name_stack_range.second; + ++it) + { + bool new_traversal = it->second; + + LLSD* child_sd = it->first.empty() ? sd_to_write : &(*sd_to_write)[it->first]; + + if (child_sd->isArray()) + { + if (new_traversal) + { + // write to new element at end + sd_to_write = &(*child_sd)[child_sd->size()]; + } + else + { + // write to last of existing elements, or first element if empty + sd_to_write = &(*child_sd)[llmax(0, child_sd->size() - 1)]; + } + } + else + { + if (new_traversal + && child_sd->isDefined() + && !child_sd->isArray()) + { + // copy child contents into first element of an array + LLSD new_array = LLSD::emptyArray(); + new_array.append(*child_sd); + // assign array to slot that previously held the single value + *child_sd = new_array; + // return next element in that array + sd_to_write = &((*child_sd)[1]); + } + else + { + sd_to_write = child_sd; + } + } + it->second = false; + } + + return *sd_to_write; +} + +//static +void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack) +{ + if (sd.isMap()) + { + for (LLSD::map_const_iterator it = sd.beginMap(); + it != sd.endMap(); + ++it) + { + stack.push_back(make_pair(it->first, true)); + readSDValues(cb, it->second, stack); + stack.pop_back(); + } + } + else if (sd.isArray()) + { + for (LLSD::array_const_iterator it = sd.beginArray(); + it != sd.endArray(); + ++it) + { + stack.back().second = true; + readSDValues(cb, *it, stack); + } + } + else if (sd.isUndefined()) + { + if (!cb.empty()) + { + cb(NO_VALUE_MARKER, stack); + } + } + else + { + if (!cb.empty()) + { + cb(sd, stack); + } + } +} + +namespace LLInitParam +{ + // LLSD specialization + // block param interface + bool ParamValue, false>::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name) + { + LLSD& sd = LLParamSDParserUtilities::getSDWriteNode(mValue, name_stack); + + LLSD::String string; + + if (p.readValue(string)) + { + sd = string; + return true; + } + return false; + } + + //static + void ParamValue, false>::serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack) + { + p.writeValue(sd.asString(), name_stack); + } + + void ParamValue, false>::serializeBlock(Parser& p, Parser::name_stack_t name_stack, const BaseBlock* diff_block) const + { + // read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) + LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue); + } +} diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h index a371c28f68..265993ffb5 100644 --- a/indra/llui/llsdparam.h +++ b/indra/llui/llsdparam.h @@ -29,6 +29,15 @@ #define LL_LLSDPARAM_H #include "llinitparam.h" +#include "boost/function.hpp" + +struct LLParamSDParserUtilities +{ + static LLSD& getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range); + + typedef boost::function read_sd_cb_t; + static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack = LLInitParam::Parser::name_stack_t()); +}; class LLParamSDParser : public LLInitParam::Parser @@ -45,25 +54,22 @@ public: /*virtual*/ std::string getCurrentElementName(); private: - void readSDValues(const LLSD& sd, LLInitParam::BaseBlock& block); + void submit(LLInitParam::BaseBlock& block, const LLSD& sd, LLInitParam::Parser::name_stack_t& name_stack); template - static bool writeTypedValue(Parser& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack) + static bool writeTypedValue(Parser& parser, const void* val_ptr, parser_t::name_stack_t& name_stack) { LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; - LLSD* sd_to_write = sdparser.getSDWriteNode(name_stack); - if (!sd_to_write) return false; + LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, std::make_pair(name_stack.begin(), name_stack.end())); - sd_to_write->assign(*((const T*)val_ptr)); + sd_to_write.assign(*((const T*)val_ptr)); return true; } - LLSD* getSDWriteNode(const parser_t::name_stack_t& name_stack); - - static bool writeU32Param(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack); - static bool writeFlag(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack); + static bool writeU32Param(Parser& parser, const void* value_ptr, parser_t::name_stack_t& name_stack); + static bool writeFlag(Parser& parser, const void* value_ptr, parser_t::name_stack_t& name_stack); static bool readFlag(Parser& parser, void* val_ptr); static bool readS32(Parser& parser, void* val_ptr); @@ -85,29 +91,29 @@ private: template class LLSDParamAdapter : public T +{ +public: + LLSDParamAdapter() {} + LLSDParamAdapter(const LLSD& sd) { - public: - LLSDParamAdapter() {} - LLSDParamAdapter(const LLSD& sd) - { - LLParamSDParser parser; - parser.readSD(sd, *this); - } - - operator LLSD() const - { - LLParamSDParser parser; - LLSD sd; - parser.writeSD(sd, *this); - return sd; - } + LLParamSDParser parser; + parser.readSD(sd, *this); + } + + operator LLSD() const + { + LLParamSDParser parser; + LLSD sd; + parser.writeSD(sd, *this); + return sd; + } - LLSDParamAdapter(const T& val) - : T(val) - { - T::operator=(val); - } - }; + LLSDParamAdapter(const T& val) + : T(val) + { + T::operator=(val); + } +}; #endif // LL_LLSDPARAM_H diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index d522123260..c8303bfc89 100644 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -124,7 +124,7 @@ namespace LLInitParam { descriptor.mCurrentBlockPtr = this; } - bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, S32 generation){ return true; } + bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name){ return true; } void BaseBlock::serializeBlock(Parser& parser, Parser::name_stack_t name_stack, const LLInitParam::BaseBlock* diff_block) const {} bool BaseBlock::inspectBlock(Parser& parser, Parser::name_stack_t name_stack, S32 min_value, S32 max_value) const { return true; } bool BaseBlock::mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) { return true; } diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index 2f814f4200..c1fb050206 100644 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -72,7 +72,6 @@ S32 LLUIImage::getHeight() const namespace LLInitParam { - S32 Parser::sNextParseGeneration = 0; BlockDescriptor::BlockDescriptor() {} ParamDescriptor::ParamDescriptor(param_handle_t p, merge_func_t merge_func, diff --git a/indra/llui/tests/llurlmatch_test.cpp b/indra/llui/tests/llurlmatch_test.cpp index fb6a2eabf1..9dbccf125a 100644 --- a/indra/llui/tests/llurlmatch_test.cpp +++ b/indra/llui/tests/llurlmatch_test.cpp @@ -66,8 +66,6 @@ namespace LLInitParam BaseBlock::BaseBlock() {} BaseBlock::~BaseBlock() {} - S32 Parser::sNextParseGeneration = 0; - BlockDescriptor::BlockDescriptor() {} ParamDescriptor::ParamDescriptor(param_handle_t p, merge_func_t merge_func, @@ -98,7 +96,7 @@ namespace LLInitParam mEnclosingBlockOffset = 0x7FFFffff & ((U32)(my_addr - block_addr)); } - bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, S32 generation){ return true; } + bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, bool new_name){ return true; } void BaseBlock::serializeBlock(Parser& parser, Parser::name_stack_t name_stack, const LLInitParam::BaseBlock* diff_block) const {} bool BaseBlock::inspectBlock(Parser& parser, Parser::name_stack_t name_stack, S32 min_count, S32 max_count) const { return true; } bool BaseBlock::mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) { return true; } diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp index 99016205c8..2520502cf1 100644 --- a/indra/llxuixml/llinitparam.cpp +++ b/indra/llxuixml/llinitparam.cpp @@ -62,7 +62,6 @@ namespace LLInitParam mInspectFunc(inspect_func), mMinCount(min_count), mMaxCount(max_count), - mGeneration(0), mUserData(NULL) {} @@ -75,7 +74,6 @@ namespace LLInitParam mInspectFunc(NULL), mMinCount(0), mMaxCount(0), - mGeneration(0), mUserData(NULL) {} @@ -87,8 +85,6 @@ namespace LLInitParam // // Parser // - S32 Parser::sNextParseGeneration = 0; - Parser::~Parser() {} @@ -162,9 +158,9 @@ namespace LLInitParam return (param_address - baseblock_address); } - bool BaseBlock::submitValue(const Parser::name_stack_t& name_stack, Parser& p, bool silent) + bool BaseBlock::submitValue(Parser::name_stack_t& name_stack, Parser& p, bool silent) { - if (!deserializeBlock(p, std::make_pair(name_stack.begin(), name_stack.end()), -1)) + if (!deserializeBlock(p, std::make_pair(name_stack.begin(), name_stack.end()), true)) { if (!silent) { @@ -213,8 +209,7 @@ namespace LLInitParam // each param descriptor remembers its serial number // so we can inspect the same param under different names // and see that it has the same number - (*it)->mGeneration = parser.newParseGeneration(); - name_stack.push_back(std::make_pair("", (*it)->mGeneration)); + name_stack.push_back(std::make_pair("", true)); serialize_func(*param, parser, name_stack, diff_param); name_stack.pop_back(); } @@ -250,12 +245,7 @@ namespace LLInitParam continue; } - if (!duplicate) - { - it->second->mGeneration = parser.newParseGeneration(); - } - - name_stack.push_back(std::make_pair(it->first, it->second->mGeneration)); + name_stack.push_back(std::make_pair(it->first, !duplicate)); const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL; serialize_func(*param, parser, name_stack, diff_param); name_stack.pop_back(); @@ -278,8 +268,7 @@ namespace LLInitParam ParamDescriptor::inspect_func_t inspect_func = (*it)->mInspectFunc; if (inspect_func) { - (*it)->mGeneration = parser.newParseGeneration(); - name_stack.push_back(std::make_pair("", (*it)->mGeneration)); + name_stack.push_back(std::make_pair("", true)); inspect_func(*param, parser, name_stack, (*it)->mMinCount, (*it)->mMaxCount); name_stack.pop_back(); } @@ -307,11 +296,7 @@ namespace LLInitParam } } - if (!duplicate) - { - it->second->mGeneration = parser.newParseGeneration(); - } - name_stack.push_back(std::make_pair(it->first, it->second->mGeneration)); + name_stack.push_back(std::make_pair(it->first, !duplicate)); inspect_func(*param, parser, name_stack, it->second->mMinCount, it->second->mMaxCount); name_stack.pop_back(); } @@ -320,16 +305,18 @@ namespace LLInitParam return true; } - bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, S32 parent_generation) + bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool ignored) { BlockDescriptor& block_data = mostDerivedBlockDescriptor(); - bool names_left = name_stack.first != name_stack.second; + bool names_left = name_stack_range.first != name_stack_range.second; - S32 parse_generation = name_stack.first == name_stack.second ? -1 : name_stack.first->second; + bool new_name = names_left + ? name_stack_range.first->second + : true; if (names_left) { - const std::string& top_name = name_stack.first->first; + const std::string& top_name = name_stack_range.first->first; ParamDescriptor::deserialize_func_t deserialize_func = NULL; Param* paramp = NULL; @@ -341,9 +328,18 @@ namespace LLInitParam paramp = getParamFromHandle(found_it->second->mParamHandle); deserialize_func = found_it->second->mDeserializeFunc; - Parser::name_stack_range_t new_name_stack(name_stack.first, name_stack.second); + Parser::name_stack_range_t new_name_stack(name_stack_range.first, name_stack_range.second); ++new_name_stack.first; - return deserialize_func(*paramp, p, new_name_stack, parse_generation); + if (deserialize_func(*paramp, p, new_name_stack, new_name)) + { + // value is no longer new, we know about it now + name_stack_range.first->second = false; + return true; + } + else + { + return false; + } } } @@ -355,7 +351,7 @@ namespace LLInitParam Param* paramp = getParamFromHandle((*it)->mParamHandle); ParamDescriptor::deserialize_func_t deserialize_func = (*it)->mDeserializeFunc; - if (deserialize_func && deserialize_func(*paramp, p, name_stack, parse_generation)) + if (deserialize_func && deserialize_func(*paramp, p, name_stack_range, new_name)) { return true; } diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 1a131d15a3..9245f588d9 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -214,13 +214,13 @@ namespace LLInitParam } }; - typedef std::vector > name_stack_t; - typedef std::pair name_stack_range_t; - typedef std::vector possible_values_t; + typedef std::vector > name_stack_t; + typedef std::pair name_stack_range_t; + typedef std::vector possible_values_t; typedef bool (*parser_read_func_t)(Parser& parser, void* output); - typedef bool (*parser_write_func_t)(Parser& parser, const void*, const name_stack_t&); - typedef boost::function parser_inspect_func_t; + typedef bool (*parser_write_func_t)(Parser& parser, const void*, name_stack_t&); + typedef boost::function parser_inspect_func_t; typedef std::map parser_read_func_map_t; typedef std::map parser_write_func_map_t; @@ -228,7 +228,6 @@ namespace LLInitParam Parser(parser_read_func_map_t& read_map, parser_write_func_map_t& write_map, parser_inspect_func_map_t& inspect_map) : mParseSilently(false), - mParseGeneration(sNextParseGeneration), mParserReadFuncs(&read_map), mParserWriteFuncs(&write_map), mParserInspectFuncs(&inspect_map) @@ -245,7 +244,7 @@ namespace LLInitParam return false; } - template bool writeValue(const T& param, const name_stack_t& name_stack) + template bool writeValue(const T& param, name_stack_t& name_stack) { parser_write_func_map_t::iterator found_it = mParserWriteFuncs->find(&typeid(T)); if (found_it != mParserWriteFuncs->end()) @@ -256,7 +255,7 @@ namespace LLInitParam } // dispatch inspection to registered inspection functions, for each parameter in a param block - template bool inspectValue(const name_stack_t& name_stack, S32 min_count, S32 max_count, const possible_values_t* possible_values) + template bool inspectValue(name_stack_t& name_stack, S32 min_count, S32 max_count, const possible_values_t* possible_values) { parser_inspect_func_map_t::iterator found_it = mParserInspectFuncs->find(&typeid(T)); if (found_it != mParserInspectFuncs->end()) @@ -272,10 +271,6 @@ namespace LLInitParam virtual void parserError(const std::string& message); void setParseSilently(bool silent) { mParseSilently = silent; } - S32 getParseGeneration() { return mParseGeneration; } - S32 newParseGeneration() { return mParseGeneration = ++sNextParseGeneration; } - - protected: template void registerParserFuncs(parser_read_func_t read_func, parser_write_func_t write_func = NULL) @@ -296,9 +291,6 @@ namespace LLInitParam parser_read_func_map_t* mParserReadFuncs; parser_write_func_map_t* mParserWriteFuncs; parser_inspect_func_map_t* mParserInspectFuncs; - S32 mParseGeneration; - - static S32 sNextParseGeneration; }; class BaseBlock; @@ -341,7 +333,7 @@ namespace LLInitParam }; typedef bool(*merge_func_t)(Param&, const Param&, bool); - typedef bool(*deserialize_func_t)(Param&, Parser&, const Parser::name_stack_range_t&, S32); + typedef bool(*deserialize_func_t)(Param&, Parser&, const Parser::name_stack_range_t&, bool); typedef void(*serialize_func_t)(const Param&, Parser&, Parser::name_stack_t&, const Param* diff_param); typedef void(*inspect_func_t)(const Param&, Parser&, Parser::name_stack_t&, S32 min_count, S32 max_count); typedef bool(*validation_func_t)(const Param*); @@ -366,7 +358,6 @@ namespace LLInitParam validation_func_t mValidationFunc; S32 mMinCount; S32 mMaxCount; - S32 mGeneration; S32 mNumRefs; UserData* mUserData; }; @@ -447,7 +438,7 @@ namespace LLInitParam BaseBlock(); virtual ~BaseBlock(); - bool submitValue(const Parser::name_stack_t& name_stack, Parser& p, bool silent=false); + bool submitValue(Parser::name_stack_t& name_stack, Parser& p, bool silent=false); param_handle_t getHandleFromParam(const Param* param) const; bool validateBlock(bool emit_errors = true) const; @@ -473,7 +464,7 @@ namespace LLInitParam S32 getLastChangeVersion() const { return mChangeVersion; } - bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, S32 generation); + bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); void serializeBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), const BaseBlock* diff_block = NULL) const; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const; @@ -593,8 +584,7 @@ namespace LLInitParam mKeyVersion(0), mValidatedVersion(-1), mValidated(false) - { - } + {} void setValue(value_assignment_t val) { @@ -672,11 +662,11 @@ namespace LLInitParam bool isProvided() const { return Param::anyProvided(); } - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) { self_t& typed_param = static_cast(param); // no further names in stack, attempt to parse value now - if (name_stack.first == name_stack.second) + if (name_stack_range.first == name_stack_range.second) { if (parser.readValue(typed_param.getValue())) { @@ -715,7 +705,7 @@ namespace LLInitParam if (!name_stack.empty()) { - name_stack.back().second = parser.newParseGeneration(); + name_stack.back().second = true; } std::string key = typed_param.getValueName(); @@ -811,11 +801,11 @@ namespace LLInitParam } } - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) { self_t& typed_param = static_cast(param); // attempt to parse block... - if(typed_param.deserializeBlock(parser, name_stack, generation)) + if(typed_param.deserializeBlock(parser, name_stack_range, new_name)) { typed_param.clearValueName(); typed_param.enclosingBlock().paramChanged(param, true); @@ -851,7 +841,7 @@ namespace LLInitParam if (!name_stack.empty()) { - name_stack.back().second = parser.newParseGeneration(); + name_stack.back().second = true; } std::string key = typed_param.getValueName(); @@ -943,7 +933,7 @@ namespace LLInitParam public: typedef TypedParam self_t; typedef ParamValue param_value_t; - typedef typename std::vector container_t; + typedef typename std::vector container_t; typedef const container_t& value_assignment_t; typedef VALUE_TYPE value_t; @@ -970,12 +960,12 @@ namespace LLInitParam bool isProvided() const { return Param::anyProvided(); } - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, bool new_name) { self_t& typed_param = static_cast(param); value_t value; // no further names in stack, attempt to parse value now - if (name_stack.first == name_stack.second) + if (name_stack_range.first == name_stack_range.second) { // attempt to read value directly if (parser.readValue(value)) @@ -1015,7 +1005,7 @@ namespace LLInitParam ++it) { std::string key = it->getValue(); - name_stack.back().second = parser.newParseGeneration(); + name_stack.back().second = true; if(key.empty()) // not parsed via name values, write out value directly @@ -1132,8 +1122,7 @@ namespace LLInitParam typedef NAME_VALUE_LOOKUP name_value_lookup_t; TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) - : Param(block_descriptor.mCurrentBlockPtr), - mLastParseGeneration(0) + : Param(block_descriptor.mCurrentBlockPtr) { std::copy(value.begin(), value.end(), back_inserter(mValues)); @@ -1153,13 +1142,12 @@ namespace LLInitParam bool isProvided() const { return Param::anyProvided(); } - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) { self_t& typed_param = static_cast(param); bool new_value = false; - if (generation != typed_param.mLastParseGeneration - || typed_param.mValues.empty()) + if (new_name || typed_param.mValues.empty()) { new_value = true; typed_param.mValues.push_back(value_t()); @@ -1168,12 +1156,8 @@ namespace LLInitParam param_value_t& value = typed_param.mValues.back(); // attempt to parse block... - if(value.deserializeBlock(parser, name_stack, generation)) + if(value.deserializeBlock(parser, name_stack_range, new_name)) { - if (new_value) - { // successfully parsed new value, let's keep it - typed_param.mLastParseGeneration = generation; - } typed_param.enclosingBlock().paramChanged(param, true); typed_param.setProvided(true); return true; @@ -1187,11 +1171,6 @@ namespace LLInitParam // try to parse a per type named value if (name_value_lookup_t::getValueFromName(name, value.getValue())) { - if (new_value) - { // successfully parsed new value, let's keep it - typed_param.mLastParseGeneration = generation; - } - typed_param.mValues.back().setValueName(name); typed_param.mValues.back().mKeyVersion = value.getLastChangeVersion(); typed_param.enclosingBlock().paramChanged(param, true); @@ -1219,7 +1198,7 @@ namespace LLInitParam it != end_it; ++it) { - name_stack.back().second = parser.newParseGeneration(); + name_stack.back().second = true; std::string key = it->getValueName(); if (!key.empty() && it->mKeyVersion == it->getLastChangeVersion()) @@ -1317,8 +1296,6 @@ namespace LLInitParam } container_t mValues; - - S32 mLastParseGeneration; }; template @@ -1625,9 +1602,9 @@ namespace LLInitParam } } - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation) + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) { - if (name_stack.first == name_stack.second) + if (name_stack_range.first == name_stack_range.second) { //std::string message = llformat("Deprecated value %s ignored", getName().c_str()); //parser.parserWarning(message); @@ -1669,18 +1646,16 @@ namespace LLInitParam typedef Block super_t; BatchBlock() - : mLastParseGeneration(-1) {} - bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, S32 generation) + bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name) { - if (generation != mLastParseGeneration) + if (new_name) { // reset block *static_cast(this) = defaultBatchValue(); - mLastParseGeneration = generation; } - return super_t::deserializeBlock(p, name_stack, generation); + return super_t::deserializeBlock(p, name_stack_range, new_name); } bool mergeBlock(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite) @@ -1688,7 +1663,6 @@ namespace LLInitParam if (overwrite) { *static_cast(this) = defaultBatchValue(); - mLastParseGeneration = -1; // merge individual parameters into destination return super_t::mergeBlock(super_t::selfBlockDescriptor(), other, overwrite); } @@ -1700,19 +1674,20 @@ namespace LLInitParam static DERIVED_BLOCK default_value; return default_value; } - - S32 mLastParseGeneration; }; + // FIXME: this specialization is not currently used, as it only matches against the BatchBlock base class + // and not the derived class with the actual params template class ParamValue , NAME_VALUE_LOOKUP, true> - : public Param, + : public NAME_VALUE_LOOKUP, protected BatchBlock { + public: typedef BatchBlock block_t; typedef const BatchBlock& value_assignment_t; @@ -1734,7 +1709,6 @@ namespace LLInitParam void setValue(value_assignment_t val) { *this = val; - block_t::mLastParseGeneration = -1; } value_assignment_t getValue() const @@ -1764,6 +1738,59 @@ namespace LLInitParam mutable bool mValidated; // lazy validation flag }; + template <> + class ParamValue , + false> + : public TypeValues, + public BaseBlock + { + public: + typedef ParamValue, false> self_t; + typedef const LLSD& value_assignment_t; + + ParamValue() + : mKeyVersion(0), + mValidatedVersion(-1), + mValidated(false) + {} + + ParamValue(value_assignment_t other) + : mValue(other), + mKeyVersion(0), + mValidatedVersion(-1), + mValidated(false) + {} + + void setValue(value_assignment_t val) { mValue = val; } + + value_assignment_t getValue() const { return mValue; } + LLSD& getValue() { return mValue; } + + operator value_assignment_t() const { return mValue; } + value_assignment_t operator()() const { return mValue; } + + S32 mKeyVersion; + + // block param interface + bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack_range, bool new_name); + void serializeBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), const BaseBlock* diff_block = NULL) const; + bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const + { + //TODO: implement LLSD params as schema type Any + return true; + } + + protected: + mutable S32 mValidatedVersion; + mutable bool mValidated; // lazy validation flag + + private: + static void serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack); + + LLSD mValue; + }; + template class CustomParamValue : public Block > >, @@ -1790,11 +1817,11 @@ namespace LLInitParam mValidated(false) {} - bool deserializeBlock(Parser& parser, Parser::name_stack_range_t name_stack, S32 generation) + bool deserializeBlock(Parser& parser, Parser::name_stack_range_t name_stack_range, bool new_name) { derived_t& typed_param = static_cast(*this); // try to parse direct value T - if (name_stack.first == name_stack.second) + if (name_stack_range.first == name_stack_range.second) { if(parser.readValue(typed_param.mValue)) { @@ -1808,7 +1835,7 @@ namespace LLInitParam } // fall back on parsing block components for T - return typed_param.BaseBlock::deserializeBlock(parser, name_stack, generation); + return typed_param.BaseBlock::deserializeBlock(parser, name_stack_range, new_name); } void serializeBlock(Parser& parser, Parser::name_stack_t name_stack = Parser::name_stack_t(), const BaseBlock* diff_block = NULL) const diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index c60f656c2c..1bb550d98f 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -513,7 +513,6 @@ static LLInitParam::Parser::parser_inspect_func_map_t sXUIInspectFuncs; // LLXUIParser::LLXUIParser() : Parser(sXUIReadFuncs, sXUIWriteFuncs, sXUIInspectFuncs), - mLastWriteGeneration(-1), mCurReadDepth(0) { if (sXUIReadFuncs.empty()) @@ -583,7 +582,7 @@ bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block) if (!text_contents.empty()) { mCurReadNode = nodep; - mNameStack.push_back(std::make_pair(std::string("value"), newParseGeneration())); + mNameStack.push_back(std::make_pair(std::string("value"), true)); // child nodes are not necessarily valid parameters (could be a child widget) // so don't complain once we've recursed if (!block.submitValue(mNameStack, *this, true)) @@ -618,7 +617,7 @@ bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block) // since there is no widget named "rect" if (child_name.find(".") == std::string::npos) { - mNameStack.push_back(std::make_pair(child_name, newParseGeneration())); + mNameStack.push_back(std::make_pair(child_name, true)); num_tokens_pushed++; } else @@ -654,7 +653,7 @@ bool LLXUIParser::readXUIImpl(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block) // copy remaining tokens on to our running token list for(tokenizer::iterator token_to_push = name_token_it; token_to_push != name_tokens.end(); ++token_to_push) { - mNameStack.push_back(std::make_pair(*token_to_push, newParseGeneration())); + mNameStack.push_back(std::make_pair(*token_to_push, true)); num_tokens_pushed++; } } @@ -704,7 +703,7 @@ bool LLXUIParser::readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& blo // copy remaining tokens on to our running token list for(tokenizer::iterator token_to_push = name_tokens.begin(); token_to_push != name_tokens.end(); ++token_to_push) { - mNameStack.push_back(std::make_pair(*token_to_push, newParseGeneration())); + mNameStack.push_back(std::make_pair(*token_to_push, true)); num_tokens_pushed++; } @@ -728,7 +727,7 @@ void LLXUIParser::writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock &bloc } // go from a stack of names to a specific XML node -LLXMLNodePtr LLXUIParser::getNode(const name_stack_t& stack) +LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack) { name_stack_t name_stack; for (name_stack_t::const_iterator it = stack.begin(); @@ -781,7 +780,7 @@ bool LLXUIParser::readFlag(Parser& parser, void* val_ptr) return self.mCurReadNode == DUMMY_NODE; } -bool LLXUIParser::writeFlag(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeFlag(Parser& parser, const void* val_ptr, name_stack_t& stack) { // just create node LLXUIParser& self = static_cast(parser); @@ -798,7 +797,7 @@ bool LLXUIParser::readBoolValue(Parser& parser, void* val_ptr) return success; } -bool LLXUIParser::writeBoolValue(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeBoolValue(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -817,7 +816,7 @@ bool LLXUIParser::readStringValue(Parser& parser, void* val_ptr) return true; } -bool LLXUIParser::writeStringValue(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeStringValue(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -855,7 +854,7 @@ bool LLXUIParser::readU8Value(Parser& parser, void* val_ptr) return self.mCurReadNode->getByteValue(1, (U8*)val_ptr); } -bool LLXUIParser::writeU8Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeU8Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -879,7 +878,7 @@ bool LLXUIParser::readS8Value(Parser& parser, void* val_ptr) return false; } -bool LLXUIParser::writeS8Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeS8Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -903,7 +902,7 @@ bool LLXUIParser::readU16Value(Parser& parser, void* val_ptr) return false; } -bool LLXUIParser::writeU16Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeU16Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -927,7 +926,7 @@ bool LLXUIParser::readS16Value(Parser& parser, void* val_ptr) return false; } -bool LLXUIParser::writeS16Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeS16Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -945,7 +944,7 @@ bool LLXUIParser::readU32Value(Parser& parser, void* val_ptr) return self.mCurReadNode->getUnsignedValue(1, (U32*)val_ptr); } -bool LLXUIParser::writeU32Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeU32Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -963,7 +962,7 @@ bool LLXUIParser::readS32Value(Parser& parser, void* val_ptr) return self.mCurReadNode->getIntValue(1, (S32*)val_ptr); } -bool LLXUIParser::writeS32Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeS32Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -981,7 +980,7 @@ bool LLXUIParser::readF32Value(Parser& parser, void* val_ptr) return self.mCurReadNode->getFloatValue(1, (F32*)val_ptr); } -bool LLXUIParser::writeF32Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeF32Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -999,7 +998,7 @@ bool LLXUIParser::readF64Value(Parser& parser, void* val_ptr) return self.mCurReadNode->getDoubleValue(1, (F64*)val_ptr); } -bool LLXUIParser::writeF64Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeF64Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -1023,7 +1022,7 @@ bool LLXUIParser::readColor4Value(Parser& parser, void* val_ptr) return false; } -bool LLXUIParser::writeColor4Value(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeColor4Value(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -1050,7 +1049,7 @@ bool LLXUIParser::readUIColorValue(Parser& parser, void* val_ptr) return false; } -bool LLXUIParser::writeUIColorValue(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeUIColorValue(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -1079,7 +1078,7 @@ bool LLXUIParser::readUUIDValue(Parser& parser, void* val_ptr) return false; } -bool LLXUIParser::writeUUIDValue(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeUUIDValue(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); LLXMLNodePtr node = self.getNode(stack); @@ -1098,7 +1097,7 @@ bool LLXUIParser::readSDValue(Parser& parser, void* val_ptr) return true; } -bool LLXUIParser::writeSDValue(Parser& parser, const void* val_ptr, const name_stack_t& stack) +bool LLXUIParser::writeSDValue(Parser& parser, const void* val_ptr, name_stack_t& stack) { LLXUIParser& self = static_cast(parser); @@ -1207,7 +1206,6 @@ const char* NO_VALUE_MARKER = "no_value"; LLSimpleXUIParser::LLSimpleXUIParser(LLSimpleXUIParser::element_start_callback_t element_cb) : Parser(sSimpleXUIReadFuncs, sSimpleXUIWriteFuncs, sSimpleXUIInspectFuncs), - mLastWriteGeneration(-1), mCurReadDepth(0), mElementCB(element_cb) { @@ -1338,7 +1336,7 @@ void LLSimpleXUIParser::startElement(const char *name, const char **atts) { // compound attribute if (child_name.find(".") == std::string::npos) { - mNameStack.push_back(std::make_pair(child_name, newParseGeneration())); + mNameStack.push_back(std::make_pair(child_name, true)); num_tokens_pushed++; mScope.push_back(child_name); } @@ -1365,7 +1363,7 @@ void LLSimpleXUIParser::startElement(const char *name, const char **atts) // copy remaining tokens on to our running token list for(tokenizer::iterator token_to_push = name_token_it; token_to_push != name_tokens.end(); ++token_to_push) { - mNameStack.push_back(std::make_pair(*token_to_push, newParseGeneration())); + mNameStack.push_back(std::make_pair(*token_to_push, true)); num_tokens_pushed++; } mScope.push_back(mNameStack.back().first); @@ -1398,7 +1396,7 @@ bool LLSimpleXUIParser::readAttributes(const char **atts) // copy remaining tokens on to our running token list for(tokenizer::iterator token_to_push = name_tokens.begin(); token_to_push != name_tokens.end(); ++token_to_push) { - mNameStack.push_back(std::make_pair(*token_to_push, newParseGeneration())); + mNameStack.push_back(std::make_pair(*token_to_push, true)); num_tokens_pushed++; } @@ -1420,7 +1418,7 @@ bool LLSimpleXUIParser::processText() LLStringUtil::trim(mTextContents); if (!mTextContents.empty()) { - mNameStack.push_back(std::make_pair(std::string("value"), newParseGeneration())); + mNameStack.push_back(std::make_pair(std::string("value"), true)); mCurAttributeValueBegin = mTextContents.c_str(); mOutputStack.back().first->submitValue(mNameStack, *this, mParseSilently); mNameStack.pop_back(); diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h index 42a79b4100..e0402523da 100644 --- a/indra/llxuixml/llxuiparser.h +++ b/indra/llxuixml/llxuiparser.h @@ -133,23 +133,23 @@ private: static bool readSDValue(Parser& parser, void* val_ptr); //writer helper functions - static bool writeFlag(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeBoolValue(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeStringValue(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeU8Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeS8Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeU16Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeS16Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeU32Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeS32Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeF32Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeF64Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeColor4Value(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeUIColorValue(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeUUIDValue(Parser& parser, const void* val_ptr, const name_stack_t&); - static bool writeSDValue(Parser& parser, const void* val_ptr, const name_stack_t&); - - LLXMLNodePtr getNode(const name_stack_t& stack); + static bool writeFlag(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeBoolValue(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeStringValue(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeU8Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeS8Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeU16Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeS16Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeU32Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeS32Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeF32Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeF64Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeColor4Value(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeUIColorValue(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeUUIDValue(Parser& parser, const void* val_ptr, name_stack_t&); + static bool writeSDValue(Parser& parser, const void* val_ptr, name_stack_t&); + + LLXMLNodePtr getNode(name_stack_t& stack); private: Parser::name_stack_t mNameStack; @@ -159,7 +159,6 @@ private: typedef std::map out_nodes_t; out_nodes_t mOutNodes; - S32 mLastWriteGeneration; LLXMLNodePtr mLastWrittenChild; S32 mCurReadDepth; std::string mCurFileName; @@ -226,7 +225,6 @@ private: Parser::name_stack_t mNameStack; struct XML_ParserStruct* mParser; - S32 mLastWriteGeneration; LLXMLNodePtr mLastWrittenChild; S32 mCurReadDepth; std::string mCurFileName; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index fa0b392f1b..5077a0a596 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -109,6 +109,7 @@ // Third party library includes #include +#include #if LL_WINDOWS @@ -2041,42 +2042,37 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, llerrs << "Invalid settings location list" << llendl; } - for(LLInitParam::ParamIterator::const_iterator it = mSettingsLocationList->groups.begin(), end_it = mSettingsLocationList->groups.end(); - it != end_it; - ++it) + BOOST_FOREACH(const SettingsGroup& group, mSettingsLocationList->groups) { // skip settings groups that aren't the one we requested - if (it->name() != location_key) continue; + if (group.name() != location_key) continue; - ELLPath path_index = (ELLPath)it->path_index(); + ELLPath path_index = (ELLPath)group.path_index(); if(path_index <= LL_PATH_NONE || path_index >= LL_PATH_LAST) { llerrs << "Out of range path index in app_settings/settings_files.xml" << llendl; return false; } - LLInitParam::ParamIterator::const_iterator file_it, end_file_it; - for (file_it = it->files.begin(), end_file_it = it->files.end(); - file_it != end_file_it; - ++file_it) + BOOST_FOREACH(const SettingsFile& file, group.files) { - llinfos << "Attempting to load settings for the group " << file_it->name() + llinfos << "Attempting to load settings for the group " << file.name() << " - from location " << location_key << llendl; - LLControlGroup* settings_group = LLControlGroup::getInstance(file_it->name); + LLControlGroup* settings_group = LLControlGroup::getInstance(file.name); if(!settings_group) { - llwarns << "No matching settings group for name " << file_it->name() << llendl; + llwarns << "No matching settings group for name " << file.name() << llendl; continue; } std::string full_settings_path; - if (file_it->file_name_setting.isProvided() - && gSavedSettings.controlExists(file_it->file_name_setting)) + if (file.file_name_setting.isProvided() + && gSavedSettings.controlExists(file.file_name_setting)) { // try to find filename stored in file_name_setting control - full_settings_path = gSavedSettings.getString(file_it->file_name_setting); + full_settings_path = gSavedSettings.getString(file.file_name_setting); if (full_settings_path.empty()) { continue; @@ -2090,16 +2086,16 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, else { // by default, use specified file name - full_settings_path = gDirUtilp->getExpandedFilename((ELLPath)path_index, file_it->file_name()); + full_settings_path = gDirUtilp->getExpandedFilename((ELLPath)path_index, file.file_name()); } - if(settings_group->loadFromFile(full_settings_path, set_defaults, file_it->persistent)) + if(settings_group->loadFromFile(full_settings_path, set_defaults, file.persistent)) { // success! llinfos << "Loaded settings file " << full_settings_path << llendl; } else { // failed to load - if(file_it->required) + if(file.required) { llerrs << "Error: Cannot load required settings file from: " << full_settings_path << llendl; return false; @@ -2122,20 +2118,15 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, std::string LLAppViewer::getSettingsFilename(const std::string& location_key, const std::string& file) { - for(LLInitParam::ParamIterator::const_iterator it = mSettingsLocationList->groups.begin(), end_it = mSettingsLocationList->groups.end(); - it != end_it; - ++it) + BOOST_FOREACH(const SettingsGroup& group, mSettingsLocationList->groups) { - if (it->name() == location_key) + if (group.name() == location_key) { - LLInitParam::ParamIterator::const_iterator file_it, end_file_it; - for (file_it = it->files.begin(), end_file_it = it->files.end(); - file_it != end_file_it; - ++file_it) + BOOST_FOREACH(const SettingsFile& settings_file, group.files) { - if (file_it->name() == file) + if (settings_file.name() == file) { - return file_it->file_name; + return settings_file.file_name; } } } -- cgit v1.2.3 From da3c7da7a585ea14a5a494ac7f36e7714bc86ab8 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 15:04:00 -0700 Subject: side toolbar buttons are now squares again --- indra/llui/lltoolbar.h | 4 ++-- indra/newview/skins/default/xui/en/widgets/toolbar.xml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 9e48dee608..84fa7ec0df 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -47,8 +47,8 @@ class LLToolBarButton : public LLButton public: struct Params : public LLInitParam::Block { - Optional button_width; - Optional desired_height; + Optional button_width; + Optional desired_height; Params() : button_width("button_width"), diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index d36b015005..60e7c34d84 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -33,9 +33,9 @@ image_pressed="PushButton_Press" image_pressed_selected="PushButton_Selected_Press" image_selected="PushButton_Selected_Press" - desired_height="35" - button_width.min="35" - button_width.max="35" + desired_height="38" + button_width.min="38" + button_width.max="38" follows="left|top" label="" chrome="true" -- cgit v1.2.3 From 0526d673093b2279777dc8be5aae9cc33cb1c822 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 15:31:25 -0700 Subject: EXP-1312 FIX Floaters should appear in region not covered by toolbars moved floater snap region to middle of toolbars and constrained floaters to that snap region also made toybox floater pass all drag and drop events along to toolbar --- indra/llui/llfloater.cpp | 2 +- indra/newview/llfloatertoybox.cpp | 11 +++++++++++ indra/newview/llfloatertoybox.h | 5 +++++ indra/newview/skins/default/xui/en/main_view.xml | 7 ------- indra/newview/skins/default/xui/en/panel_toolbar_view.xml | 7 +++++++ 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index cc49238a0b..cba14e21c3 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2549,7 +2549,7 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out } // move window fully onscreen - if (floater->translateIntoRect( getLocalRect(), allow_partial_outside )) + if (floater->translateIntoRect( getSnapRect(), allow_partial_outside )) { floater->clearSnapTarget(); } diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index 609041803a..fa60022911 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -120,5 +120,16 @@ void LLFloaterToybox::onBtnRestoreDefaults() LLToolBarView::loadDefaultToolbars(); } +BOOL LLFloaterToybox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + S32 local_x = x - mToolBar->getRect().mLeft; + S32 local_y = y - mToolBar->getRect().mBottom; + return mToolBar->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); +} + // eof diff --git a/indra/newview/llfloatertoybox.h b/indra/newview/llfloatertoybox.h index f7245506c5..f0a6cf1a8b 100644 --- a/indra/newview/llfloatertoybox.h +++ b/indra/newview/llfloatertoybox.h @@ -43,6 +43,11 @@ public: // virtuals BOOL postBuild(); void draw(); + /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); protected: void onBtnRestoreDefaults(); diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index 57baa7cdd3..96d070ae50 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -74,13 +74,6 @@ user_resize="false" name="hud container" width="500"> - + Date: Mon, 10 Oct 2011 16:31:56 -0600 Subject: fix for SH-2464: Crash on exit in LLPrivateMemoryPoolManager::freeMem --- indra/llcommon/llmemory.cpp | 41 +++++++++++++++++++++++++++++++++++++++-- indra/llcommon/llmemory.h | 1 + 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 8c02ad8290..7d340483b7 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -1773,6 +1773,7 @@ void LLPrivateMemoryPool::LLChunkHashElement::remove(LLPrivateMemoryPool::LLMemo //class LLPrivateMemoryPoolManager //-------------------------------------------------------------------- LLPrivateMemoryPoolManager* LLPrivateMemoryPoolManager::sInstance = NULL ; +std::vector LLPrivateMemoryPoolManager::sDanglingPoolList ; LLPrivateMemoryPoolManager::LLPrivateMemoryPoolManager(BOOL enabled) { @@ -1797,7 +1798,7 @@ LLPrivateMemoryPoolManager::~LLPrivateMemoryPoolManager() S32 k = 0 ; for(mem_allocation_info_t::iterator iter = sMemAllocationTracker.begin() ; iter != sMemAllocationTracker.end() ; ++iter) { - llinfos << k++ << ", " << iter->second << llendl ; + llinfos << k++ << ", " << (U32)iter->first << " : " << iter->second << llendl ; } sMemAllocationTracker.clear() ; } @@ -1817,7 +1818,17 @@ LLPrivateMemoryPoolManager::~LLPrivateMemoryPoolManager() { if(mPoolList[i]) { - delete mPoolList[i] ; + if(mPoolList[i]->isEmpty()) + { + delete mPoolList[i] ; + } + else + { + //can not delete this pool because it has alloacted memory to be freed. + //move it to the dangling list. + sDanglingPoolList.push_back(mPoolList[i]) ; + } + mPoolList[i] = NULL ; } } @@ -1953,6 +1964,32 @@ void LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr } else { + if(!sInstance) //the private memory manager is destroyed, try the dangling list + { + for(S32 i = 0 ; i < sDanglingPoolList.size(); i++) + { + if(sDanglingPoolList[i]->findChunk((char*)addr)) + { + sDanglingPoolList[i]->freeMem(addr) ; + if(sDanglingPoolList[i]->isEmpty()) + { + delete sDanglingPoolList[i] ; + + if(i < sDanglingPoolList.size() - 1) + { + sDanglingPoolList[i] = sDanglingPoolList[sDanglingPoolList.size() - 1] ; + } + sDanglingPoolList.pop_back() ; + } + + addr = NULL ; + break ; + } + } + } + + llassert_always(!addr) ; //addr should be release before hitting here! + free(addr) ; } } diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index db753f0d8b..25e6c68e88 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -399,6 +399,7 @@ private: std::vector mPoolList ; BOOL mPrivatePoolEnabled; + static std::vector sDanglingPoolList ; public: //debug and statistics info. void updateStatistics() ; -- cgit v1.2.3 From fba3f5dfd6ab51debd97c2c0e635ddcad388bcfe Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 10 Oct 2011 15:44:31 -0700 Subject: Added picks command and icon. Changed toolbar button text layout to halign left. --- indra/newview/app_settings/commands.xml | 10 +++++ indra/newview/skins/default/textures/textures.xml | 45 +++++++++++---------- .../skins/default/textures/toolbar_icons/picks.png | Bin 0 -> 1368 bytes .../skins/default/xui/en/floater_toybox.xml | 1 + indra/newview/skins/default/xui/en/strings.xml | 2 + .../skins/default/xui/en/widgets/toolbar.xml | 2 + 6 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 indra/newview/skins/default/textures/toolbar_icons/picks.png diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index dab57d44bd..f5581baa19 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -152,6 +152,16 @@ is_running_function="Floater.IsOpen" is_running_parameters="people" /> + - - - - - - + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/textures/toolbar_icons/picks.png b/indra/newview/skins/default/textures/toolbar_icons/picks.png new file mode 100644 index 0000000000..4499bf562b Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/picks.png differ diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index 653788bd3c..90b7e906a5 100644 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -74,6 +74,7 @@ image_color="ButtonImageColor" image_color_disabled="ButtonImageColor" flash_color="ButtonUnselectedFgColor" + halign="left" hover_glow_amount="0.15" display_pressed_state="false" /> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index f021fdd6a1..d12dda88be 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3668,6 +3668,7 @@ Try enclosing path to the editor with double quotes. Mini-map Move People + Picks Places Preferences Profile @@ -3692,6 +3693,7 @@ Try enclosing path to the editor with double quotes. Show nearby people Moving your avatar Friends, groups, and nearby people + Favorite places Places you've saved Preferences Edit or view your profile diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 60e7c34d84..09967de7cc 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -14,6 +14,7 @@ background_opaque="true"/> Date: Mon, 10 Oct 2011 15:53:44 -0700 Subject: Mac build fix --- indra/llui/llsdparam.cpp | 9 ++++++--- indra/llui/llsdparam.h | 3 ++- indra/llxuixml/llinitparam.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 83bed3e745..da50c0ff39 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -66,7 +66,8 @@ bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const voi LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; - LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, std::make_pair(name_stack.begin(), name_stack.end())); + parser_t::name_stack_range_t range(name_stack.begin(), name_stack.end()); + LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, range); sd_to_write.assign((S32)*((const U32*)val_ptr)); return true; @@ -77,7 +78,8 @@ bool LLParamSDParser::writeFlag(LLParamSDParser::parser_t& parser, const void* v LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; - LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, std::make_pair(name_stack.begin(), name_stack.end())); + parser_t::name_stack_range_t range(name_stack.begin(), name_stack.end()); + LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, range); return true; } @@ -324,6 +326,7 @@ namespace LLInitParam void ParamValue, false>::serializeBlock(Parser& p, Parser::name_stack_t name_stack, const BaseBlock* diff_block) const { // read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) - LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue); + Parser::name_stack_t stack; + LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, stack); } } diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h index 265993ffb5..784358d038 100644 --- a/indra/llui/llsdparam.h +++ b/indra/llui/llsdparam.h @@ -62,7 +62,8 @@ private: LLParamSDParser& sdparser = static_cast(parser); if (!sdparser.mWriteRootSD) return false; - LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, std::make_pair(name_stack.begin(), name_stack.end())); + LLInitParam::Parser::name_stack_range_t range(name_stack.begin(), name_stack.end()); + LLSD& sd_to_write = LLParamSDParserUtilities::getSDWriteNode(*sdparser.mWriteRootSD, range); sd_to_write.assign(*((const T*)val_ptr)); return true; diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 9245f588d9..06140d0931 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -960,7 +960,7 @@ namespace LLInitParam bool isProvided() const { return Param::anyProvided(); } - static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, bool new_name) + static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack_range, bool new_name) { self_t& typed_param = static_cast(param); value_t value; -- cgit v1.2.3 From 2d34dab6a3d3f4b8ad78aee941800fe8f5f27bd1 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 16:54:55 -0700 Subject: fixed toolbar serialization --- indra/llxuixml/llxuiparser.cpp | 26 ++++++++------------------ indra/llxuixml/llxuiparser.h | 2 +- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/indra/llxuixml/llxuiparser.cpp b/indra/llxuixml/llxuiparser.cpp index 1bb550d98f..aee8fa8d8f 100644 --- a/indra/llxuixml/llxuiparser.cpp +++ b/indra/llxuixml/llxuiparser.cpp @@ -729,22 +729,11 @@ void LLXUIParser::writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock &bloc // go from a stack of names to a specific XML node LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack) { - name_stack_t name_stack; - for (name_stack_t::const_iterator it = stack.begin(); - it != stack.end(); - ++it) - { - if (!it->first.empty()) - { - name_stack.push_back(*it); - } - } - LLXMLNodePtr out_node = mWriteRootNode; - name_stack_t::const_iterator next_it = name_stack.begin(); - for (name_stack_t::const_iterator it = name_stack.begin(); - it != name_stack.end(); + name_stack_t::iterator next_it = stack.begin(); + for (name_stack_t::iterator it = stack.begin(); + it != stack.end(); it = next_it) { ++next_it; @@ -753,17 +742,18 @@ LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack) continue; } - out_nodes_t::iterator found_it = mOutNodes.lower_bound(it->second); + out_nodes_t::iterator found_it = mOutNodes.find(it->first); // node with this name not yet written - if (found_it == mOutNodes.end() || mOutNodes.key_comp()(found_it->first, it->second)) + if (found_it == mOutNodes.end() || it->second) { // make an attribute if we are the last element on the name stack - bool is_attribute = next_it == name_stack.end(); + bool is_attribute = next_it == stack.end(); LLXMLNodePtr new_node = new LLXMLNode(it->first.c_str(), is_attribute); out_node->addChild(new_node); - mOutNodes.insert(found_it, std::make_pair(it->second, new_node)); + mOutNodes[it->first] = new_node; out_node = new_node; + it->second = false; } else { diff --git a/indra/llxuixml/llxuiparser.h b/indra/llxuixml/llxuiparser.h index e0402523da..d7cd256967 100644 --- a/indra/llxuixml/llxuiparser.h +++ b/indra/llxuixml/llxuiparser.h @@ -157,7 +157,7 @@ private: // Root of the widget XML sub-tree, for example, "line_editor" LLXMLNodePtr mWriteRootNode; - typedef std::map out_nodes_t; + typedef std::map out_nodes_t; out_nodes_t mOutNodes; LLXMLNodePtr mLastWrittenChild; S32 mCurReadDepth; -- cgit v1.2.3 From 068035959804d6a16a41ddb2ef62da00dceb2689 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 17:03:12 -0700 Subject: converted bad toolbars.xml file from error to warning --- indra/newview/lltoolbarview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 44b244f163..a0e080b783 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -152,7 +152,7 @@ bool LLToolBarView::loadToolbars(bool force_default) LLXMLNodePtr root; if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) { - llerrs << "Unable to load toolbars from file: " << toolbar_file << llendl; + llwarns << "Unable to load toolbars from file: " << toolbar_file << llendl; return false; } if(!root->hasName("toolbars")) -- cgit v1.2.3 From fd03ae299bfaf83789e511912d99d204c0833e7f Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Mon, 10 Oct 2011 17:08:51 -0700 Subject: EXP-1274 Create floater for "Avatar Picker" content EXP-1299 Nearby Voice floater can't be closed by clicking the sidebar button again. EXP-1306 Prompt text to "Change your avatar" and "Destinations" floaters get pushed down one line when the floater dialog gets resized to minimum width --- indra/llui/llfloater.cpp | 21 ++++++--- indra/llui/llfloater.h | 2 +- indra/llui/llresizehandle.cpp | 12 ----- indra/llui/llresizehandle.h | 7 +-- indra/newview/CMakeLists.txt | 2 + indra/newview/llcallfloater.cpp | 19 ++------ indra/newview/llcallfloater.h | 2 +- indra/newview/llfloateravatar.cpp | 54 ++++++++++++++++++++++ indra/newview/llfloateravatar.h | 43 +++++++++++++++++ indra/newview/llfloaterdestinations.cpp | 1 + indra/newview/llnearbychatbar.cpp | 7 ++- indra/newview/llviewerfloaterreg.cpp | 3 +- .../skins/default/xui/en/floater_avatar.xml | 6 +-- .../skins/default/xui/en/floater_destinations.xml | 5 +- 14 files changed, 132 insertions(+), 52 deletions(-) create mode 100644 indra/newview/llfloateravatar.cpp create mode 100644 indra/newview/llfloateravatar.h diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index c28bcc2ec9..f85e46e28d 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -459,15 +459,24 @@ void LLFloater::layoutResizeCtrls() mResizeHandle[3]->setRect(rect); } -void LLFloater::enableResizeCtrls(bool enable) +void LLFloater::enableResizeCtrls(bool enable, bool width, bool height) { + mResizeBar[LLResizeBar::LEFT]->setVisible(enable && width); + mResizeBar[LLResizeBar::LEFT]->setEnabled(enable && width); + + mResizeBar[LLResizeBar::TOP]->setVisible(enable && height); + mResizeBar[LLResizeBar::TOP]->setEnabled(enable && height); + + mResizeBar[LLResizeBar::RIGHT]->setVisible(enable && width); + mResizeBar[LLResizeBar::RIGHT]->setEnabled(enable && width); + + mResizeBar[LLResizeBar::BOTTOM]->setVisible(enable && height); + mResizeBar[LLResizeBar::BOTTOM]->setEnabled(enable && height); + for (S32 i = 0; i < 4; ++i) { - mResizeBar[i]->setVisible(enable); - mResizeBar[i]->setEnabled(enable); - - mResizeHandle[i]->setVisible(enable); - mResizeHandle[i]->setEnabled(enable); + mResizeHandle[i]->setVisible(enable && width && height); + mResizeHandle[i]->setEnabled(enable && width && height); } } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 5aff542049..af9665e599 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -291,6 +291,7 @@ public: void updateTransparency(ETypeTransparency transparency_type); + void enableResizeCtrls(bool enable, bool width = true, bool height = true); protected: virtual void applySavedVariables(); @@ -340,7 +341,6 @@ private: BOOL offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index); void addResizeCtrls(); void layoutResizeCtrls(); - void enableResizeCtrls(bool enable); void addDragHandle(); void layoutDragHandle(); // repair layout diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp index 942e84eeb6..c3a51c36c9 100644 --- a/indra/llui/llresizehandle.cpp +++ b/indra/llui/llresizehandle.cpp @@ -55,8 +55,6 @@ LLResizeHandle::LLResizeHandle(const LLResizeHandle::Params& p) mImage( NULL ), mMinWidth( p.min_width ), mMinHeight( p.min_height ), - mMaxWidth(S32_MAX), - mMaxHeight(S32_MAX), mCorner( p.corner ) { if( RIGHT_BOTTOM == mCorner) @@ -179,11 +177,6 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) new_width = mMinWidth; delta_x = x_multiple * (mMinWidth - orig_rect.getWidth()); } - else if (new_width > mMaxWidth) - { - new_width = mMaxWidth; - delta_x = x_multiple * (mMaxWidth - orig_rect.getWidth()); - } S32 new_height = orig_rect.getHeight() + y_multiple * delta_y; if( new_height < mMinHeight ) @@ -191,11 +184,6 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask) new_height = mMinHeight; delta_y = y_multiple * (mMinHeight - orig_rect.getHeight()); } - else if (new_height > mMaxHeight) - { - new_height = mMaxHeight; - delta_y = y_multiple * (mMaxHeight - orig_rect.getHeight()); - } switch( mCorner ) { diff --git a/indra/llui/llresizehandle.h b/indra/llui/llresizehandle.h index 5cfe3fb63c..7541b9e6c0 100644 --- a/indra/llui/llresizehandle.h +++ b/indra/llui/llresizehandle.h @@ -55,10 +55,7 @@ public: virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); void setResizeLimits( S32 min_width, S32 min_height ) { mMinWidth = min_width; mMinHeight = min_height; } - - void setMaxWidth(S32 width) { mMaxWidth = width;} - void setMaxHeight(S32 height) { mMaxHeight = height;} - + private: BOOL pointInHandle( S32 x, S32 y ); @@ -69,9 +66,7 @@ private: LLCoordGL mLastMouseDir; LLPointer mImage; S32 mMinWidth; - S32 mMaxWidth; S32 mMinHeight; - S32 mMaxHeight; const ECorner mCorner; }; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 941cb6b9f9..97ccfeac29 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -168,6 +168,7 @@ set(viewer_SOURCE_FILES llfloaterabout.cpp llfloateranimpreview.cpp llfloaterauction.cpp + llfloateravatar.cpp llfloateravatarpicker.cpp llfloateravatartextures.cpp llfloaterbeacons.cpp @@ -733,6 +734,7 @@ set(viewer_HEADER_FILES llfloaterabout.h llfloateranimpreview.h llfloaterauction.h + llfloateravatar.h llfloateravatarpicker.h llfloateravatartextures.h llfloaterbeacons.h diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index 945a760d05..4c6ddc8be7 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -44,7 +44,6 @@ #include "llparticipantlist.h" #include "llspeakers.h" #include "lltextutil.h" -#include "lltransientfloatermgr.h" #include "llviewercontrol.h" #include "llviewerdisplayname.h" #include "llviewerwindow.h" @@ -97,7 +96,7 @@ static void* create_non_avatar_caller(void*) LLVoiceChannel* LLCallFloater::sCurrentVoiceChannel = NULL; LLCallFloater::LLCallFloater(const LLSD& key) -: LLTransientDockableFloater(NULL, false, key) +: LLFloater(key) , mSpeakerManager(NULL) , mParticipants(NULL) , mAvatarList(NULL) @@ -113,10 +112,6 @@ LLCallFloater::LLCallFloater(const LLSD& key) mFactoryMap["non_avatar_caller"] = LLCallbackMap(create_non_avatar_caller, NULL); LLVoiceClient::instance().addObserver(this); - LLTransientFloaterMgr::getInstance()->addControlView(this); - - // force docked state since this floater doesn't save it between recreations - setDocked(true); // update the agent's name if display name setting change LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLCallFloater::updateAgentModeratorState, this)); @@ -139,13 +134,11 @@ LLCallFloater::~LLCallFloater() { LLVoiceClient::getInstance()->removeObserver(this); } - LLTransientFloaterMgr::getInstance()->removeControlView(this); } // virtual BOOL LLCallFloater::postBuild() { - LLTransientDockableFloater::postBuild(); mAvatarList = getChild("speakers_list"); mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&LLCallFloater::onAvatarListRefreshed, this)); @@ -154,12 +147,6 @@ BOOL LLCallFloater::postBuild() mNonAvatarCaller = findChild("non_avatar_caller"); mNonAvatarCaller->setVisible(FALSE); - LLView *anchor_panel = LLBottomTray::getInstance()->getChild("speak_flyout_btn"); - - setDockControl(new LLDockControl( - anchor_panel, this, - getDockTongue(), LLDockControl::TOP)); - initAgentData(); connectToChannel(LLVoiceChannel::getCurrentVoiceChannel()); @@ -204,13 +191,13 @@ void LLCallFloater::draw() if (mParticipants) mParticipants->updateRecentSpeakersOrder(); - LLTransientDockableFloater::draw(); + LLFloater::draw(); } // virtual void LLCallFloater::setFocus( BOOL b ) { - LLTransientDockableFloater::setFocus(b); + LLFloater::setFocus(b); // Force using active floater transparency (STORM-730). // We have to override setFocus() for LLCallFloater because selecting an item diff --git a/indra/newview/llcallfloater.h b/indra/newview/llcallfloater.h index 00a3f76e56..ea78cd53b7 100644 --- a/indra/newview/llcallfloater.h +++ b/indra/newview/llcallfloater.h @@ -52,7 +52,7 @@ class LLSpeakersDelayActionsStorage; * When the Resident is engaged in any chat except Nearby Chat, the Voice Control Panel * also provides a 'Leave Call' button to allow the Resident to leave that voice channel. */ -class LLCallFloater : public LLTransientDockableFloater, LLVoiceClientParticipantObserver +class LLCallFloater : public LLFloater, LLVoiceClientParticipantObserver { public: diff --git a/indra/newview/llfloateravatar.cpp b/indra/newview/llfloateravatar.cpp new file mode 100644 index 0000000000..bdc5b581a9 --- /dev/null +++ b/indra/newview/llfloateravatar.cpp @@ -0,0 +1,54 @@ +/** + * @file llfloateravatar.h + * @author Leyla Farazha + * @brief floater for the avatar changer + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +/** + * Floater that appears when buying an object, giving a preview + * of its contents and their permissions. + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloateravatar.h" +#include "lluictrlfactory.h" + + +LLFloaterAvatar::LLFloaterAvatar(const LLSD& key) + : LLFloater(key) +{ +} + +LLFloaterAvatar::~LLFloaterAvatar() +{ +} + +BOOL LLFloaterAvatar::postBuild() +{ + enableResizeCtrls(true, true, false); + return TRUE; +} + + diff --git a/indra/newview/llfloateravatar.h b/indra/newview/llfloateravatar.h new file mode 100644 index 0000000000..cadc5e4028 --- /dev/null +++ b/indra/newview/llfloateravatar.h @@ -0,0 +1,43 @@ +/** + * @file llfloateravatar.h + * @author Leyla Farazha + * @brief floater for the avatar changer + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_FLOATER_AVATAR_H +#define LL_FLOATER_AVATAR_H + +#include "llfloater.h" + +class LLFloaterAvatar: + public LLFloater +{ + friend class LLFloaterReg; +private: + LLFloaterAvatar(const LLSD& key); + /*virtual*/ ~LLFloaterAvatar(); + /*virtual*/ BOOL postBuild(); +}; + +#endif diff --git a/indra/newview/llfloaterdestinations.cpp b/indra/newview/llfloaterdestinations.cpp index 52d1f67c36..af21cb593f 100644 --- a/indra/newview/llfloaterdestinations.cpp +++ b/indra/newview/llfloaterdestinations.cpp @@ -47,6 +47,7 @@ LLFloaterDestinations::~LLFloaterDestinations() BOOL LLFloaterDestinations::postBuild() { + enableResizeCtrls(true, true, false); return TRUE; } diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index cba4fafe42..caa20b767c 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -452,6 +452,8 @@ BOOL LLNearbyChatBar::postBuild() mExpandedHeight = getMinHeight() + EXPANDED_HEIGHT; + enableResizeCtrls(true, true, false); + return TRUE; } @@ -462,6 +464,7 @@ void LLNearbyChatBar::applyRectControl() { getChildView("nearby_chat")->setVisible(true); mExpandedHeight = getRect().getHeight(); + enableResizeCtrls(true); } } @@ -707,13 +710,13 @@ void LLNearbyChatBar::onToggleNearbyChatPanel() mExpandedHeight = getRect().getHeight(); nearby_chat->setVisible(FALSE); reshape(getRect().getWidth(), getMinHeight()); - mResizeHandle[0]->setMaxHeight(getMinHeight()); + enableResizeCtrls(true, true, false); } else { nearby_chat->setVisible(TRUE); reshape(getRect().getWidth(), mExpandedHeight); - mResizeHandle[0]->setMaxHeight(S32_MAX); + enableResizeCtrls(true); } } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index b0daf9f3c2..619d74e7ac 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -37,6 +37,7 @@ #include "llfloaterabout.h" #include "llfloateranimpreview.h" #include "llfloaterauction.h" +#include "llfloateravatar.h" #include "llfloateravatarpicker.h" #include "llfloateravatartextures.h" #include "llfloaterbeacons.h" @@ -168,7 +169,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("avatar", "floater_avatar.xml", &LLFloaterReg::build); + LLFloaterReg::add("avatar", "floater_avatar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("avatar_textures", "floater_avatar_textures.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_avatar.xml b/indra/newview/skins/default/xui/en/floater_avatar.xml index a0c1f4c021..666aa2d164 100644 --- a/indra/newview/skins/default/xui/en/floater_avatar.xml +++ b/indra/newview/skins/default/xui/en/floater_avatar.xml @@ -3,11 +3,9 @@ legacy_header_height="225" can_minimize="true" can_close="true" - user_resize="true" can_resize="true" min_height="230" - min_width="455" - max_height="230" + min_width="445" height="230" layout="topleft" name="Avatar" @@ -19,7 +17,7 @@ diff --git a/indra/newview/skins/default/xui/en/floater_destinations.xml b/indra/newview/skins/default/xui/en/floater_destinations.xml index 9dd9338f37..669b7eb15a 100644 --- a/indra/newview/skins/default/xui/en/floater_destinations.xml +++ b/indra/newview/skins/default/xui/en/floater_destinations.xml @@ -7,7 +7,6 @@ can_resize="true" min_height="230" min_width="525" - max_height="230" height="230" layout="topleft" name="Destinations" @@ -15,11 +14,11 @@ help_topic="destinations" save_rect="true" title="Destinations" - width="445"> + width="525"> Date: Mon, 10 Oct 2011 17:29:04 -0700 Subject: EXP-1302 PARTIAL Make the Speak button work as a toolbar button First pass - no Push-To-Talk functionality. --- indra/newview/app_settings/commands.xml | 4 ++-- indra/newview/llagent.cpp | 38 ++++++++++++++++++++++++++++++++- indra/newview/llagent.h | 16 +++++++++++++- indra/newview/llbottomtray.cpp | 3 +++ 4 files changed, 57 insertions(+), 4 deletions(-) diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index dab57d44bd..139eabcae4 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -207,11 +207,11 @@ icon="Command_Speak_Icon" label_ref="Command_Speak_Label" tooltip_ref="Command_Speak_Tooltip" - execute_function="Floater.ToolbarToggle" + execute_function="Agent.ToggleMicrophone" execute_parameters="speak" is_enabled_function="Agent.IsActionAllowed" is_enabled_parameters="speak" - is_running_function="Floater.IsOpen" + is_running_function="Agent.IsMicrophoneOn" is_running_parameters="speak" /> inputUserControlState(true); + LLVoiceClient::getInstance()->inputUserControlState(false); + } + else + { + LLVoiceClient::getInstance()->inputUserControlState(false); + LLVoiceClient::getInstance()->inputUserControlState(true); + } +} + +// static +bool LLAgent::isMicrophoneOn(const LLSD& sdname) +{ + return gAgent.mMicrophoneOn; +} // ************************************************************ // Enabled this definition to compile a 'hacked' viewer that @@ -261,6 +292,9 @@ LLAgent::LLAgent() : mCurrentFidget(0), mFirstLogin(FALSE), mGenderChosen(FALSE), + + mVoiceConnected(false), + mMicrophoneOn(false), mAppearanceSerialNum(0), @@ -280,6 +314,8 @@ LLAgent::LLAgent() : LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&LLAgent::parcelChangedCallback)); LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2)); + LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2)); + LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2)); } // Requires gSavedSettings to be initialized. diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 1775a0235c..0355e68b6e 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -282,7 +282,21 @@ public: static void toggleFlying(); static bool enableFlying(); BOOL canFly(); // Does this parcel allow you to fly? - + + //-------------------------------------------------------------------- + // Voice + //-------------------------------------------------------------------- +public: + bool isVoiceConnected() const { return mVoiceConnected; } + void setVoiceConnected(const bool b) { mVoiceConnected = b; } + + static void toggleMicrophone(const LLSD& name); + static bool isMicrophoneOn(const LLSD& sdname); + +private: + bool mVoiceConnected; + bool mMicrophoneOn; + //-------------------------------------------------------------------- // Chat //-------------------------------------------------------------------- diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 98712f1334..af91702f9b 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -387,6 +387,9 @@ void LLBottomTray::onChange(EStatusType status, const std::string &channelURI, b if (status != STATUS_JOINING && status!= STATUS_LEFT_CHANNEL) { bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); + + gAgent.setVoiceConnected(voice_status); + getChild("speak_flyout_btn")->setEnabled(voice_status); gMenuBarView->getChild("Nearby Voice")->setEnabled(voice_status); if (voice_status) -- cgit v1.2.3 From 6a570a9bdc2660e4db87e8e7a65b724e1ad8d1b2 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 17:52:37 -0700 Subject: fixed icons moving when clicking on icon-only toolbars --- indra/llui/llbutton.cpp | 2 +- indra/llui/lltoolbar.cpp | 5 +++++ indra/llui/lltoolbar.h | 2 ++ indra/newview/skins/default/xui/en/widgets/toolbar.xml | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 68cb5164b6..ba3748a573 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -1002,7 +1002,7 @@ void LLButton::resize(LLUIString label) if (mImageOverlay) { S32 overlay_width = mImageOverlay->getWidth(); - F32 scale_factor = getRect().getHeight() / (F32)mImageOverlay->getHeight(); + F32 scale_factor = (getRect().getHeight() - (mImageOverlayBottomPad + mImageOverlayTopPad)) / (F32)mImageOverlay->getHeight(); overlay_width = llround((F32)overlay_width * scale_factor); switch(mImageOverlayAlignment) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 6332b2674a..5ba54edf1c 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -852,3 +852,8 @@ void LLToolBarButton::onMouseCaptureLost() { mIsDragged = false; } + +void LLToolBarButton::reshape(S32 width, S32 height, BOOL called_from_parent) +{ + LLButton::reshape(mWidthRange.clamp(width), height, called_from_parent); +} diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 84fa7ec0df..a81a5fdb39 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -62,6 +62,8 @@ public: BOOL handleMouseDown(S32 x, S32 y, MASK mask); BOOL handleHover(S32 x, S32 y, MASK mask); + void reshape(S32 width, S32 height, BOOL called_from_parent = true); + void setCommandId(const LLCommandId& id) { mId = id; } void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 09967de7cc..be5dfaf18c 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -31,6 +31,8 @@ flash_color="EmphasisColor"/> Date: Mon, 10 Oct 2011 18:00:24 -0700 Subject: EXP-1300 : Simplify and clean up of the DaD which now doesn't duplicate the dragged tool. --- indra/llui/llcommandmanager.h | 4 +- indra/llui/lltoolbar.cpp | 83 ++++++++++++++--------------------------- indra/llui/lltoolbar.h | 12 +++--- indra/newview/lltoolbarview.cpp | 64 ++++++++++++++++++++++++++----- indra/newview/lltoolbarview.h | 10 ++--- 5 files changed, 95 insertions(+), 78 deletions(-) diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index fdad7cd1b5..46e0fe6e69 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -68,8 +68,8 @@ public: mUUID = LLUUID::generateNewID(p.name); } - LLCommandId(const std::string& name, const LLUUID& uuid) - : mName(name), + LLCommandId(const LLUUID& uuid) + : mName(""), mUUID(uuid) { } diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 6332b2674a..776e91b7e5 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -114,8 +114,6 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p) { mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_WITH_TEXT] = p.button_icon_and_text; mButtonParams[LLToolBarEnums::BTNTYPE_ICONS_ONLY] = p.button_icon; - mDraggedCommand = LLCommandId::null; - mRank = 0; } LLToolBar::~LLToolBar() @@ -211,19 +209,14 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank) // Create the button and do the things that don't need ordering LLToolBarButton* button = createButton(commandId); mButtonPanel->addChild(button); - LLCommandId temp_command = commandId; - if (commandId.name() == "Drag Tool") - { - temp_command = LLCommandId("Drag Tool"); - } - mButtonMap.insert(std::make_pair(temp_command.uuid(), button)); + mButtonMap.insert(std::make_pair(commandId.uuid(), button)); // Insert the command and button in the right place in their respective lists - if ((rank >= mButtonCommands.size()) || (rank < 0)) + if ((rank >= mButtonCommands.size()) || (rank == RANK_NONE)) { // In that case, back load - mButtonCommands.push_back(temp_command); + mButtonCommands.push_back(commandId); mButtons.push_back(button); } else @@ -238,7 +231,7 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank) rank--; } // ...then insert - mButtonCommands.insert(it_command,temp_command); + mButtonCommands.insert(it_command,commandId); mButtons.insert(it_button,button); } @@ -247,27 +240,28 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank) return true; } -bool LLToolBar::removeCommand(const LLCommandId& commandId) +// Remove a command from the list +// Returns the rank of the command in the original list so that doing addCommand(id,rank) right after +// a removeCommand(id) would leave the list unchanged. +// Returns RANK_NONE if the command is not found in the list +int LLToolBar::removeCommand(const LLCommandId& commandId) { - if (!hasCommand(commandId)) return false; + if (!hasCommand(commandId)) return RANK_NONE; llinfos << "Merov debug : removeCommand, " << commandId.name() << ", " << commandId.uuid() << llendl; // First erase the map record - LLCommandId temp_command = commandId; - if (commandId.name() == "Drag Tool") - { - temp_command = LLCommandId("Drag Tool"); - } - command_id_map::iterator it = mButtonMap.find(temp_command.uuid()); + command_id_map::iterator it = mButtonMap.find(commandId.uuid()); mButtonMap.erase(it); // Now iterate on the commands and buttons to identify the relevant records + int rank = 0; std::list::iterator it_button = mButtons.begin(); command_id_list_t::iterator it_command = mButtonCommands.begin(); - while (*it_command != temp_command) + while (*it_command != commandId) { ++it_button; ++it_command; + ++rank; } // Delete the button and erase the command and button records @@ -277,7 +271,7 @@ bool LLToolBar::removeCommand(const LLCommandId& commandId) mNeedsLayout = true; - return true; + return rank; } void LLToolBar::clearCommandsList() @@ -292,12 +286,7 @@ bool LLToolBar::hasCommand(const LLCommandId& commandId) const { if (commandId != LLCommandId::null) { - LLCommandId temp_command = commandId; - if (commandId.name() == "Drag Tool") - { - temp_command = LLCommandId("Drag Tool"); - } - command_id_map::const_iterator it = mButtonMap.find(temp_command.uuid()); + command_id_map::const_iterator it = mButtonMap.find(commandId.uuid()); return (it != mButtonMap.end()); } @@ -310,12 +299,7 @@ bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled) if (commandId != LLCommandId::null) { - LLCommandId temp_command = commandId; - if (commandId.name() == "Drag Tool") - { - temp_command = LLCommandId("Drag Tool"); - } - command_id_map::iterator it = mButtonMap.find(temp_command.uuid()); + command_id_map::iterator it = mButtonMap.find(commandId.uuid()); if (it != mButtonMap.end()) { it->second->setEnabled(enabled); @@ -410,6 +394,10 @@ void LLToolBar::resizeButtonsInRow(std::vector& buttons_in_row } } +// Returns the position of the coordinates as a rank in the button list. +// The rank is the position a tool dropped in (x,y) would assume in the button list. +// The value returned is between 0 and mButtons.size(), 0 being the first element to the left +// (or top) and mButtons.size() the last one to the right (or bottom). int LLToolBar::getRankFromPosition(S32 x, S32 y) { int rank = 0; @@ -618,12 +606,6 @@ void LLToolBar::draw() } } } - // HACK!!! - if (!mDragAndDropTarget) - { - removeCommand(mDraggedCommand); - mDraggedCommand = LLCommandId::null; - } updateLayoutAsNeeded(); // rect may have shifted during layout @@ -654,12 +636,7 @@ void LLToolBar::createButtons() LLToolBarButton* button = createButton(command_id); mButtons.push_back(button); mButtonPanel->addChild(button); - LLCommandId temp_command = command_id; - if (command_id.name() == "Drag Tool") - { - temp_command = LLCommandId("Drag Tool"); - } - mButtonMap.insert(std::make_pair(temp_command.uuid(), button)); + mButtonMap.insert(std::make_pair(command_id.uuid(), button)); } mNeedsLayout = true; } @@ -736,7 +713,7 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EAcceptance* accept, std::string& tooltip_msg) { - //llinfos << "Merov debug : handleDragAndDrop. drop = " << drop << ", x = " << x << ", y = " << y << llendl; + llinfos << "Merov debug : handleDragAndDrop. drop = " << drop << ", x = " << x << ", y = " << y << llendl; // If we have a drop callback, that means that we can handle the drop BOOL handled = (mHandleDropCallback ? TRUE : FALSE); @@ -761,19 +738,13 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, LLAssetType::EType type = inv_item->getType(); if (type == LLAssetType::AT_WIDGET) { - mRank = getRankFromPosition(x, y); - mDraggedCommand = LLCommandId("Drag Tool",inv_item->getUUID()); - removeCommand(mDraggedCommand); - addCommand(mDraggedCommand,mRank); + LLCommandId dragged_command(inv_item->getUUID()); + int rank = getRankFromPosition(x, y); + removeCommand(dragged_command); + addCommand(dragged_command,rank); mDragAndDropTarget = true; } } - else - { - removeCommand(mDraggedCommand); - mDraggedCommand = LLCommandId::null; - } - } return handled; diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 84fa7ec0df..56bc8b9bb3 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -47,8 +47,8 @@ class LLToolBarButton : public LLButton public: struct Params : public LLInitParam::Block { - Optional button_width; - Optional desired_height; + Optional button_width; + Optional desired_height; Params() : button_width("button_width"), @@ -161,9 +161,11 @@ public: void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); + + static const int RANK_NONE = -1; - bool addCommand(const LLCommandId& commandId, int rank = -1); - bool removeCommand(const LLCommandId& commandId); + bool addCommand(const LLCommandId& commandId, int rank = RANK_NONE); + int removeCommand(const LLCommandId& commandId); // Returns the rank the removed command was at, RANK_NONE if not found bool hasCommand(const LLCommandId& commandId) const; bool enableCommand(const LLCommandId& commandId, bool enabled); @@ -184,8 +186,6 @@ protected: tool_handledrag_callback_t mHandleDragItemCallback; tool_handledrop_callback_t mHandleDropCallback; bool mDragAndDropTarget; - int mRank; - LLCommandId mDraggedCommand; public: // Methods used in loading and saving toolbar settings diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 44b244f163..8273d1491d 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -41,7 +41,6 @@ LLToolBarView* gToolBarView = NULL; static LLDefaultChildRegistry::Register r("toolbar_view"); -bool LLToolBarView::sDragStarted = false; bool isToolDragged() { @@ -331,18 +330,25 @@ void LLToolBarView::draw() void LLToolBarView::startDragTool( S32 x, S32 y, const LLUUID& uuid) { - //llinfos << "Merov debug: startDragTool() : x = " << x << ", y = " << y << llendl; + llinfos << "Merov debug: startDragTool() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl; + // Flag the tool dragging but don't start it yet + gToolBarView->mDragStarted = false; + gToolBarView->mDragCommand = LLCommandId::null; + gToolBarView->mDragRank = LLToolBar::RANK_NONE; + gToolBarView->mDragToolbar = NULL; LLToolDragAndDrop::getInstance()->setDragStart( x, y ); - sDragStarted = false; } BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type) { -// llinfos << "Merov debug: handleDragTool() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl; if (LLToolDragAndDrop::getInstance()->isOverThreshold( x, y )) { - if (!sDragStarted) + if (!gToolBarView->mDragStarted) { + llinfos << "Merov debug: handleDragTool() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl; + // Start the tool dragging: + + // First, create the global drag and drop object std::vector types; uuid_vec_t cargo_ids; types.push_back(DAD_WIDGET); @@ -350,9 +356,35 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp gClipboard.setSourceObject(uuid,LLAssetType::AT_WIDGET); LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_VIEWER; LLUUID srcID; - //llinfos << "Merov debug: handleDragTool() : beginMultiDrag()" << llendl; LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src, srcID); - sDragStarted = true; + llinfos << "Merov debug: beginMultiDrag() launched" << llendl; + + // Second, check if the command is present in one of the 3 toolbars + // If it is, store the command, the toolbar and the rank in the toolbar and + // set a callback on end drag so that we reinsert the command if no drop happened + /* + gToolBarView->mDragCommand = LLCommandId(uuid); + if ((gToolBarView->mDragRank = gToolBarView->mToolbarLeft->removeCommand(gToolBarView->mDragCommand)) != LLToolBar::RANK_NONE) + { + gToolBarView->mDragToolbar = gToolBarView->mToolbarLeft; + } + else if ((gToolBarView->mDragRank = gToolBarView->mToolbarRight->removeCommand(gToolBarView->mDragCommand)) != LLToolBar::RANK_NONE) + { + gToolBarView->mDragToolbar = gToolBarView->mToolbarRight; + } + else if ((gToolBarView->mDragRank = gToolBarView->mToolbarBottom->removeCommand(gToolBarView->mDragCommand)) != LLToolBar::RANK_NONE) + { + gToolBarView->mDragToolbar = gToolBarView->mToolbarBottom; + } + if (gToolBarView->mDragRank != LLToolBar::RANK_NONE) + { + llinfos << "Merov debug: rank of dragged tool = " << gToolBarView->mDragRank << llendl; + LLToolDragAndDrop::getInstance()->setEndDragCallback(boost::bind(&LLToolBarView::onEndDrag, gToolBarView)); + } + */ + + llinfos << "Merov debug: Drag started cleanly" << llendl; + gToolBarView->mDragStarted = true; return TRUE; } else @@ -375,7 +407,7 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t //llinfos << "Merov debug : handleDropTool. Drop source is a widget -> drop it in place..." << llendl; // Get the command from its uuid LLCommandManager& mgr = LLCommandManager::instance(); - LLCommandId command_id("",inv_item->getUUID()); + LLCommandId command_id(inv_item->getUUID()); LLCommand* command = mgr.getCommand(command_id); if (command) { @@ -408,5 +440,19 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t void LLToolBarView::stopDragTool() { - sDragStarted = false; + // Clear the saved command, toolbar and rank + gToolBarView->mDragStarted = false; + gToolBarView->mDragCommand = LLCommandId::null; + gToolBarView->mDragRank = LLToolBar::RANK_NONE; + gToolBarView->mDragToolbar = NULL; } + +void LLToolBarView::onEndDrag() +{ + // If there's a saved command, reinsert it in the saved toolbar + if (gToolBarView->mDragRank != LLToolBar::RANK_NONE) + { + gToolBarView->mDragToolbar->addCommand(gToolBarView->mDragCommand,gToolBarView->mDragRank); + } + stopDragTool(); +} \ No newline at end of file diff --git a/indra/newview/lltoolbarview.h b/indra/newview/lltoolbarview.h index a0c526ac54..6623e63f8a 100644 --- a/indra/newview/lltoolbarview.h +++ b/indra/newview/lltoolbarview.h @@ -78,6 +78,7 @@ public: static BOOL handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetType::EType type); static BOOL handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar); static void stopDragTool(); + void onEndDrag(); protected: friend class LLUICtrlFactory; @@ -94,12 +95,11 @@ private: LLToolBar* mToolbarLeft; LLToolBar* mToolbarRight; LLToolBar* mToolbarBottom; - bool mDragging; - LLToolBarButton* mDragButton; - S32 mMouseX; - S32 mMouseY; - static bool sDragStarted; + LLCommandId mDragCommand; + int mDragRank; + LLToolBar* mDragToolbar; + bool mDragStarted; }; extern LLToolBarView* gToolBarView; -- cgit v1.2.3 From 71879916428e9e15081d73696f46bb4a32877265 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 10 Oct 2011 19:03:40 -0700 Subject: EXP-1300 : Add the caret images and xml (no code yet) --- indra/newview/skins/default/textures/textures.xml | 3 +++ .../textures/toolbar_icons/caret_bottom.png | Bin 0 -> 139 bytes .../default/textures/toolbar_icons/caret_left.png | Bin 0 -> 893 bytes .../default/textures/toolbar_icons/caret_right.png | Bin 0 -> 892 bytes .../skins/default/xui/en/panel_toolbar_view.xml | 30 +++++++++++++++++++++ 5 files changed, 33 insertions(+) create mode 100644 indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png create mode 100644 indra/newview/skins/default/textures/toolbar_icons/caret_left.png create mode 100644 indra/newview/skins/default/textures/toolbar_icons/caret_right.png diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index e7fb836f45..27577d42ea 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -149,6 +149,9 @@ with the same filename but different name + + + diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png b/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png new file mode 100644 index 0000000000..82f58b22b9 Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png differ diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_left.png b/indra/newview/skins/default/textures/toolbar_icons/caret_left.png new file mode 100644 index 0000000000..75eecc84ed Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/caret_left.png differ diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_right.png b/indra/newview/skins/default/textures/toolbar_icons/caret_right.png new file mode 100644 index 0000000000..677459ae1c Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/caret_right.png differ diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml index bc96bfbab5..5d6967ed32 100644 --- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml @@ -47,6 +47,16 @@ bottom="-10" side="left" button_display_mode="icons_only"> + + @@ -109,6 +129,16 @@ follows="left|right|bottom" button_display_mode="icons_with_text" visible="true"> + -- cgit v1.2.3 From ec23ec68ea8835e4155e083ec5570245b0aef1ec Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 19:17:38 -0700 Subject: EXP-1310 FIX Profile button should open Web Profile floater removed unused LLWeb functions for opening non-web media moved logic inside floaters and away from auxiliary functions --- indra/llui/llfloaterreg.cpp | 6 ++++- indra/llui/llhelp.h | 1 + indra/newview/app_settings/commands.xml | 6 ++--- indra/newview/llavataractions.cpp | 19 +++++++++++----- indra/newview/llavataractions.h | 3 ++- indra/newview/llfloaterhelpbrowser.cpp | 17 +++++++++----- indra/newview/llfloaterhelpbrowser.h | 2 -- indra/newview/llfloaterwebcontent.cpp | 39 ++++++++++++++------------------- indra/newview/llmediactrl.cpp | 11 +--------- indra/newview/llpanelprofile.cpp | 2 +- indra/newview/llviewerfloaterreg.cpp | 4 ++-- indra/newview/llviewerhelp.cpp | 37 +++++++------------------------ indra/newview/llviewerhelp.h | 6 ++--- indra/newview/llviewermenu.cpp | 32 ++++++++++++++++++++++++++- indra/newview/llweb.cpp | 4 +++- indra/newview/llweb.h | 10 ++++----- 16 files changed, 103 insertions(+), 96 deletions(-) diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index d0ae9413a3..ae06eb74ac 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -110,7 +110,11 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) int index = list.size(); res = build_func(key); - + if (!res) + { + llwarns << "Failed to build floater type: '" << name << "'." << llendl; + return NULL; + } bool success = res->buildFromFile(xui_file, NULL); if (!success) { diff --git a/indra/llui/llhelp.h b/indra/llui/llhelp.h index 83317bd03c..1726347a78 100644 --- a/indra/llui/llhelp.h +++ b/indra/llui/llhelp.h @@ -32,6 +32,7 @@ class LLHelp { public: virtual void showTopic(const std::string &topic) = 0; + virtual std::string getURL(const std::string &topic) = 0; // return default (fallback) topic name suitable for showTopic() virtual std::string defaultTopic() = 0; // return topic to use before the user logs in diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 881bc22144..d758647d3a 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -187,10 +187,8 @@ icon="Command_Profile_Icon" label_ref="Command_Profile_Label" tooltip_ref="Command_Profile_Tooltip" - execute_function="Floater.ToolbarToggle" - execute_parameters="my_profile" - is_running_function="Floater.IsOpen" - is_running_parameters="my_profile" + execute_function="Avatar.ToggleMyProfile" + is_running_function="Avatar.IsMyProfileOpen" /> profile_rect(gSavedSettings, "WebProfileRect"); - LLFloaterWebContent::create(LLFloaterWebContent::Params(). - url(url). - id(agent_id.asString()). - show_chrome(show_chrome). - window_class("profile"). - preferred_media_size(profile_rect)); + LLFloaterWebContent::Params p; + p.url(url). + id(agent_id.asString()). + show_chrome(show_chrome). + window_class("profile"). + preferred_media_size(profile_rect); + LLFloaterReg::showInstance("profile", p); } // static @@ -342,6 +343,12 @@ bool LLAvatarActions::profileVisible(const LLUUID& id) return browser && browser->isShown(); } +//static +LLFloater* LLAvatarActions::getProfileFloater(const LLUUID& id) +{ + LLFloaterWebContent *browser = dynamic_cast (LLFloaterReg::findInstance("profile", LLSD().with("id", id))); + return browser; +} //static void LLAvatarActions::hideProfile(const LLUUID& id) diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index fbfd815f41..748b7cb3d1 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -35,7 +35,7 @@ #include class LLInventoryPanel; - +class LLFloater; /** * Friend-related actions (add, remove, offer teleport, etc) @@ -96,6 +96,7 @@ public: static void showProfile(const LLUUID& id); static void hideProfile(const LLUUID& id); static bool profileVisible(const LLUUID& id); + static LLFloater* getProfileFloater(const LLUUID& id); /** * Show avatar on world map. diff --git a/indra/newview/llfloaterhelpbrowser.cpp b/indra/newview/llfloaterhelpbrowser.cpp index 3012638d44..fd9c37ae73 100644 --- a/indra/newview/llfloaterhelpbrowser.cpp +++ b/indra/newview/llfloaterhelpbrowser.cpp @@ -39,6 +39,7 @@ #include "llurlhistory.h" #include "llmediactrl.h" #include "llviewermedia.h" +#include "llviewerhelp.h" LLFloaterHelpBrowser::LLFloaterHelpBrowser(const LLSD& key) @@ -74,6 +75,17 @@ void LLFloaterHelpBrowser::buildURLHistory() void LLFloaterHelpBrowser::onOpen(const LLSD& key) { gSavedSettings.setBOOL("HelpFloaterOpen", TRUE); + + std::string topic = key.asString(); + + if (topic == "__local") + { + mBrowser->navigateToLocalPage( "help-offline" , "index.html" ); + } + else + { + mBrowser->navigateTo(LLViewerHelp::instance().getURL(topic)); + } } //virtual @@ -148,8 +160,3 @@ void LLFloaterHelpBrowser::openMedia(const std::string& media_url) mBrowser->navigateTo(media_url, "text/html"); setCurrentURL(media_url); } - -void LLFloaterHelpBrowser::navigateToLocalPage( const std::string& subdir, const std::string& filename_in ) -{ - mBrowser->navigateToLocalPage(subdir, filename_in); -} diff --git a/indra/newview/llfloaterhelpbrowser.h b/indra/newview/llfloaterhelpbrowser.h index afe0f4df69..80b0ecc06b 100644 --- a/indra/newview/llfloaterhelpbrowser.h +++ b/indra/newview/llfloaterhelpbrowser.h @@ -48,8 +48,6 @@ class LLFloaterHelpBrowser : /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); void openMedia(const std::string& media_url); - - void navigateToLocalPage( const std::string& subdir, const std::string& filename_in ); private: void buildURLHistory(); diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index 2c9a736aff..c76aeb0498 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -88,20 +88,6 @@ BOOL LLFloaterWebContent::postBuild() return TRUE; } -bool LLFloaterWebContent::matchesKey(const LLSD& key) -{ - LLUUID id = key["id"]; - if (id.notNull()) - { - return id == mKey["id"].asUUID(); - } - else - { - return key["target"].asString() == mKey["target"].asString(); - } -} - - void LLFloaterWebContent::initializeURLHistory() { // start with an empty list @@ -123,6 +109,20 @@ void LLFloaterWebContent::initializeURLHistory() } } +bool LLFloaterWebContent::matchesKey(const LLSD& key) +{ + Params p(mKey); + Params other_p(key); + if (!other_p.target().empty() && other_p.target() != "_blank") + { + return other_p.target() == p.target(); + } + else + { + return other_p.id() == p.id(); + } +} + //static LLFloater* LLFloaterWebContent::create( Params p) { @@ -139,14 +139,7 @@ LLFloater* LLFloaterWebContent::create( Params p) } S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit"); - - LLSD sd; - sd["target"] = p.target; - if(LLFloaterReg::findInstance(p.window_class, sd) != NULL) - { - // There's already a web browser for this tag, so we won't be opening a new window. - } - else if(browser_window_limit != 0) + if(browser_window_limit != 0) { // showInstance will open a new window. Figure out how many web browsers are already open, // and close the least recently opened one if this will put us over the limit. @@ -166,7 +159,7 @@ LLFloater* LLFloaterWebContent::create( Params p) } } - return LLFloaterReg::showInstance(p.window_class, p); + return new LLFloaterWebContent(p); } //static diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 0bdeb114f5..1f1e49726d 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1122,16 +1122,7 @@ void LLMediaCtrl::onPopup(const LLSD& notification, const LLSD& response) lldebugs << "No gFloaterView for onPopuup()" << llendl; }; - // (for now) open web content floater if that's our parent, otherwise, open the current media floater - // (this will change soon) - if ( floater_name == "web_content" ) - { - LLWeb::loadWebURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); - } - else - { - LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); - } + LLWeb::loadURL(notification["payload"]["url"], notification["payload"]["target"], notification["payload"]["uuid"]); } else { diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index fd5c3362bb..27390fca78 100755 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -72,7 +72,7 @@ public: std::string agent_name = params[0]; llinfos << "Profile, agent_name " << agent_name << llendl; std::string url = getProfileURL(agent_name); - LLWeb::loadWebURLInternal(url); + LLWeb::loadURLInternal(url); return true; } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 619d74e7ac..3463eec5d8 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -288,7 +288,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("profile", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("profile", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); LLFloaterUIPreviewUtil::registerFloater(); @@ -301,7 +301,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("voice_controls", "floater_voice_controls.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); LLFloaterReg::add("whitelist_entry", "floater_whitelist_entry.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterWindowSizeUtil::registerFloater(); LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewerhelp.cpp b/indra/newview/llviewerhelp.cpp index 3a3d4f3881..d1120b6269 100644 --- a/indra/newview/llviewerhelp.cpp +++ b/indra/newview/llviewerhelp.cpp @@ -69,15 +69,12 @@ LLHelpHandler gHelpHandler; ////////////////////////////// // implement LLHelp interface -void LLViewerHelp::showTopic(const std::string &topic) +std::string LLViewerHelp::getURL(const std::string &topic) { // allow overriding the help server with a local help file if( gSavedSettings.getBOOL("HelpUseLocal") ) { - showHelp(); - LLFloaterHelpBrowser* helpbrowser = dynamic_cast(LLFloaterReg::getInstance("help_browser")); - helpbrowser->navigateToLocalPage( "help-offline" , "index.html" ); - return; + return "__local"; } // if the help topic is empty, use the default topic @@ -99,11 +96,12 @@ void LLViewerHelp::showTopic(const std::string &topic) } } - // work out the URL for this topic and display it - showHelp(); - - std::string helpURL = LLViewerHelpUtil::buildHelpURL( help_topic ); - setRawURL(helpURL); + return LLViewerHelpUtil::buildHelpURL( help_topic ); +} + +void LLViewerHelp::showTopic(const std::string& topic) +{ + LLFloaterReg::showInstance("help_browser", topic); } std::string LLViewerHelp::defaultTopic() @@ -146,23 +144,4 @@ std::string LLViewerHelp::getTopicFromFocus() return defaultTopic(); } -// static -void LLViewerHelp::showHelp() -{ - LLFloaterReg::showInstance("help_browser"); -} - -// static -void LLViewerHelp::setRawURL(std::string url) -{ - LLFloaterHelpBrowser* helpbrowser = dynamic_cast(LLFloaterReg::getInstance("help_browser")); - if (helpbrowser) - { - helpbrowser->openMedia(url); - } - else - { - llwarns << "Eep, help_browser floater not found" << llendl; - } -} diff --git a/indra/newview/llviewerhelp.h b/indra/newview/llviewerhelp.h index 7612986227..a983012e2e 100644 --- a/indra/newview/llviewerhelp.h +++ b/indra/newview/llviewerhelp.h @@ -45,6 +45,8 @@ class LLViewerHelp : public LLHelp, public LLSingleton /// display the specified help topic in the help viewer /*virtual*/ void showTopic(const std::string &topic); + std::string getURL(const std::string& topic); + // return topic derived from viewer UI focus, else default topic std::string getTopicFromFocus(); @@ -56,10 +58,6 @@ class LLViewerHelp : public LLHelp, public LLSingleton // return topic to use for the top-level help, invoked by F1 /*virtual*/ std::string f1HelpTopic(); - - private: - static void showHelp(); // make sure help UI is visible & raised - static void setRawURL(std::string url); // send URL to help UI }; #endif // header guard diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index fbfde711a9..bc0f38dd77 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -5370,6 +5370,34 @@ class LLAvatarAddFriend : public view_listener_t } }; + +class LLAvatarToggleMyProfile : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLFloater* instance = LLAvatarActions::getProfileFloater(gAgent.getID()); + if (LLFloater::isMinimized(instance)) + { + instance->setMinimized(FALSE); + instance->setFocus(TRUE); + } + else if (!LLFloater::isShown(instance)) + { + LLAvatarActions::showProfile(gAgent.getID()); + } + else if (!instance->hasFocus() && !instance->getIsChrome()) + { + instance->setFocus(TRUE); + } + else + { + instance->closeFloater(); + } + return true; + } +}; + + class LLAvatarAddContact : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -7229,7 +7257,7 @@ void handle_web_browser_test(const LLSD& param) void handle_web_content_test(const LLSD& param) { std::string url = param.asString(); - LLWeb::loadWebURLInternal(url); + LLWeb::loadURLInternal(url); } void handle_buy_currency_test(void*) @@ -8165,6 +8193,8 @@ void initialize_menus() view_listener_t::addMenu(new LLAvatarCall(), "Avatar.Call"); enable.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall)); view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse"); + view_listener_t::addMenu(new LLAvatarToggleMyProfile(), "Avatar.ToggleMyProfile"); + enable.add("Avatar.IsMyProfileOpen", boost::bind(&LLAvatarActions::profileVisible, gAgent.getID())); view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend"); enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2)); diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 6f7115ff6d..7bc5453688 100644 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -125,7 +125,9 @@ void LLWeb::loadURLInternal(const std::string &url, const std::string& target, c // Explicitly open a Web URL using the Web content floater void LLWeb::loadWebURLInternal(const std::string &url, const std::string& target, const std::string& uuid) { - LLFloaterWebContent::create(LLFloaterWebContent::Params().url(url).target(target).id(uuid)); + LLFloaterWebContent::Params p; + p.url(url).target(target).id(uuid); + LLFloaterReg::showInstance("web_content", p); } // static diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h index dc5958e57f..376abc0ece 100644 --- a/indra/newview/llweb.h +++ b/indra/newview/llweb.h @@ -46,21 +46,19 @@ public: static void loadURL(const std::string& url, const std::string& target, const std::string& uuid = LLStringUtil::null); static void loadURL(const std::string& url) { loadURL(url, LLStringUtil::null); } /// Load the given url in the user's preferred web browser - static void loadURL(const char* url, const std::string& target) { loadURL( ll_safe_string(url), target); } - static void loadURL(const char* url) { loadURL( ll_safe_string(url), LLStringUtil::null ); } + static void loadURL(const char* url, const std::string& target = LLStringUtil::null) { loadURL( ll_safe_string(url), target); } /// Load the given url in the Second Life internal web browser static void loadURLInternal(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null); - static void loadURLInternal(const std::string &url) { loadURLInternal(url, LLStringUtil::null); } + static void loadURLInternal(const std::string &url) { loadURLInternal(url, LLStringUtil::null, LLStringUtil::null);} /// Load the given url in the operating system's web browser, async if we want to return immediately /// before browser has spawned - static void loadURLExternal(const std::string& url) { loadURLExternal(url, LLStringUtil::null); }; + static void loadURLExternal(const std::string& url) {loadURLExternal(url, LLStringUtil::null);} static void loadURLExternal(const std::string& url, const std::string& uuid); static void loadURLExternal(const std::string& url, bool async, const std::string& uuid = LLStringUtil::null); // Explicitly open a Web URL using the Web content floater vs. the more general media browser static void loadWebURL(const std::string& url, const std::string& target, const std::string& uuid); - static void loadWebURLInternal(const std::string &url, const std::string& target, const std::string& uuid); - static void loadWebURLInternal(const std::string &url) { loadWebURLInternal(url, LLStringUtil::null, LLStringUtil::null); } + static void loadWebURLInternal(const std::string &url, const std::string& target = LLStringUtil::null, const std::string& uuid = LLStringUtil::null); /// Returns escaped url (eg, " " to "%20") - used by all loadURL methods static std::string escapeURL(const std::string& url); -- cgit v1.2.3 From a530382c257809c6ee4371156f332efaaa0e23d9 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 19:19:16 -0700 Subject: added newline --- indra/newview/lltoolbarview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 318bede6f0..7977faeab7 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -455,4 +455,4 @@ void LLToolBarView::onEndDrag() gToolBarView->mDragToolbar->addCommand(gToolBarView->mDragCommand,gToolBarView->mDragRank); } stopDragTool(); -} \ No newline at end of file +} -- cgit v1.2.3 From fd1a688f463703ec78a399b35fed19b3d907c91b Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 19:21:01 -0700 Subject: fixed bad merge --- indra/llui/lltoolbar.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index ca04a0e5d5..321064a0fd 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -47,8 +47,8 @@ class LLToolBarButton : public LLButton public: struct Params : public LLInitParam::Block { - Optional button_width; - Optional desired_height; + Optional button_width; + Optional desired_height; Params() : button_width("button_width"), -- cgit v1.2.3 From 767cb5df09cc5053c67fd4b9e2e6e5e276bacb7c Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 11 Oct 2011 14:13:26 +0200 Subject: STORM-1615 WIP Added Russian and Turkish to the list of languages supported by viewer. Changes: * Added the new languages to the list in Preferences / General. * Added a couple of "translated" XUI files for each language. --- .../newview/skins/default/xui/en/panel_preferences_general.xml | 10 ++++++++++ .../newview/skins/default/xui/ru/floater_buy_currency_html.xml | 2 ++ .../newview/skins/default/xui/tr/floater_buy_currency_html.xml | 2 ++ indra/newview/skins/minimal/xui/ru/menu_script_chiclet.xml | 4 ++++ indra/newview/skins/minimal/xui/tr/menu_script_chiclet.xml | 4 ++++ 5 files changed, 22 insertions(+) create mode 100644 indra/newview/skins/default/xui/ru/floater_buy_currency_html.xml create mode 100644 indra/newview/skins/default/xui/tr/floater_buy_currency_html.xml create mode 100644 indra/newview/skins/minimal/xui/ru/menu_script_chiclet.xml create mode 100644 indra/newview/skins/minimal/xui/tr/menu_script_chiclet.xml diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml index 9c718fdb87..ab7e1e7cd9 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml @@ -80,6 +80,16 @@ label="Português (Portuguese) - Beta" name="Portugese" value="pt" /> + + + diff --git a/indra/newview/skins/default/xui/tr/floater_buy_currency_html.xml b/indra/newview/skins/default/xui/tr/floater_buy_currency_html.xml new file mode 100644 index 0000000000..77d69aa81d --- /dev/null +++ b/indra/newview/skins/default/xui/tr/floater_buy_currency_html.xml @@ -0,0 +1,2 @@ + + diff --git a/indra/newview/skins/minimal/xui/ru/menu_script_chiclet.xml b/indra/newview/skins/minimal/xui/ru/menu_script_chiclet.xml new file mode 100644 index 0000000000..f95913ef2b --- /dev/null +++ b/indra/newview/skins/minimal/xui/ru/menu_script_chiclet.xml @@ -0,0 +1,4 @@ + + + + diff --git a/indra/newview/skins/minimal/xui/tr/menu_script_chiclet.xml b/indra/newview/skins/minimal/xui/tr/menu_script_chiclet.xml new file mode 100644 index 0000000000..2efe6d7e71 --- /dev/null +++ b/indra/newview/skins/minimal/xui/tr/menu_script_chiclet.xml @@ -0,0 +1,4 @@ + + + + -- cgit v1.2.3 From 70a4936736187bc00fb134e135de4fee75cff664 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 11 Oct 2011 14:45:44 +0200 Subject: STORM-1615 WIP Removed Dutch from the available languages list. --- indra/newview/skins/default/xui/de/panel_preferences_general.xml | 1 - indra/newview/skins/default/xui/en/panel_preferences_general.xml | 5 ----- indra/newview/skins/default/xui/es/panel_preferences_general.xml | 1 - indra/newview/skins/default/xui/fr/panel_preferences_general.xml | 1 - indra/newview/skins/default/xui/it/panel_preferences_general.xml | 1 - indra/newview/skins/default/xui/ja/panel_preferences_general.xml | 1 - indra/newview/skins/default/xui/nl/panel_preferences_general.xml | 1 - indra/newview/skins/default/xui/pl/panel_preferences_general.xml | 1 - indra/newview/skins/default/xui/pt/panel_preferences_general.xml | 1 - indra/newview/skins/default/xui/zh/panel_preferences_general.xml | 1 - 10 files changed, 14 deletions(-) diff --git a/indra/newview/skins/default/xui/de/panel_preferences_general.xml b/indra/newview/skins/default/xui/de/panel_preferences_general.xml index 79b2a544f9..ed22e05a7c 100644 --- a/indra/newview/skins/default/xui/de/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/de/panel_preferences_general.xml @@ -11,7 +11,6 @@ - diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml index ab7e1e7cd9..ddef9a853b 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml @@ -65,11 +65,6 @@ label="Italiano (Italian) - Beta" name="Italian" value="it" /> - - diff --git a/indra/newview/skins/default/xui/fr/panel_preferences_general.xml b/indra/newview/skins/default/xui/fr/panel_preferences_general.xml index 2786798173..5ccf07f7b4 100644 --- a/indra/newview/skins/default/xui/fr/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/fr/panel_preferences_general.xml @@ -11,7 +11,6 @@ - diff --git a/indra/newview/skins/default/xui/it/panel_preferences_general.xml b/indra/newview/skins/default/xui/it/panel_preferences_general.xml index c576b5f9d8..ee52ee7cb1 100644 --- a/indra/newview/skins/default/xui/it/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/it/panel_preferences_general.xml @@ -11,7 +11,6 @@ - diff --git a/indra/newview/skins/default/xui/ja/panel_preferences_general.xml b/indra/newview/skins/default/xui/ja/panel_preferences_general.xml index e4091972d6..4356f3d47f 100644 --- a/indra/newview/skins/default/xui/ja/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/ja/panel_preferences_general.xml @@ -11,7 +11,6 @@ - diff --git a/indra/newview/skins/default/xui/nl/panel_preferences_general.xml b/indra/newview/skins/default/xui/nl/panel_preferences_general.xml index 7be570b27f..d193fb8724 100644 --- a/indra/newview/skins/default/xui/nl/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/nl/panel_preferences_general.xml @@ -76,7 +76,6 @@ - diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_general.xml b/indra/newview/skins/default/xui/pl/panel_preferences_general.xml index 44dcb2112c..fff56eab6e 100644 --- a/indra/newview/skins/default/xui/pl/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/pl/panel_preferences_general.xml @@ -11,7 +11,6 @@ - diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_general.xml b/indra/newview/skins/default/xui/pt/panel_preferences_general.xml index deeb917e82..e42a8af962 100644 --- a/indra/newview/skins/default/xui/pt/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/pt/panel_preferences_general.xml @@ -11,7 +11,6 @@ - diff --git a/indra/newview/skins/default/xui/zh/panel_preferences_general.xml b/indra/newview/skins/default/xui/zh/panel_preferences_general.xml index cabe13adb8..29f9599c97 100644 --- a/indra/newview/skins/default/xui/zh/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/zh/panel_preferences_general.xml @@ -11,7 +11,6 @@ - -- cgit v1.2.3 From fce6c0924117a39a4683bccdc127680739abb16f Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 11 Oct 2011 16:51:20 +0200 Subject: STORM-1615 WIP Added Simplified Chinese and Traditional Chinese to the list of languages supported by viewer. Language codes: zh (Traditional Chinese), zh_CN (Simplified Chinese). Changes: * Added both languages to the dropdown menu in Preferences / General. * Added a couple of "translated" XUI files for zh_CN to create the necessary folders. --- .../newview/skins/default/xui/en/panel_preferences_general.xml | 10 ++++++++++ .../skins/default/xui/zh_CN/floater_buy_currency_html.xml | 2 ++ indra/newview/skins/minimal/xui/zh/menu_script_chiclet.xml | 4 ++++ indra/newview/skins/minimal/xui/zh_CN/menu_script_chiclet.xml | 4 ++++ 4 files changed, 20 insertions(+) create mode 100644 indra/newview/skins/default/xui/zh_CN/floater_buy_currency_html.xml create mode 100644 indra/newview/skins/minimal/xui/zh/menu_script_chiclet.xml create mode 100644 indra/newview/skins/minimal/xui/zh_CN/menu_script_chiclet.xml diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml index ddef9a853b..34c4fdf97c 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml @@ -90,6 +90,16 @@ label="日本語 (Japanese) - Beta" name="(Japanese)" value="ja" /> + + + diff --git a/indra/newview/skins/minimal/xui/zh/menu_script_chiclet.xml b/indra/newview/skins/minimal/xui/zh/menu_script_chiclet.xml new file mode 100644 index 0000000000..a0a8520650 --- /dev/null +++ b/indra/newview/skins/minimal/xui/zh/menu_script_chiclet.xml @@ -0,0 +1,4 @@ + + + + diff --git a/indra/newview/skins/minimal/xui/zh_CN/menu_script_chiclet.xml b/indra/newview/skins/minimal/xui/zh_CN/menu_script_chiclet.xml new file mode 100644 index 0000000000..371086c374 --- /dev/null +++ b/indra/newview/skins/minimal/xui/zh_CN/menu_script_chiclet.xml @@ -0,0 +1,4 @@ + + + + -- cgit v1.2.3 From c845925eebb5cad3049ee0f3b1d0adea3e3a46b5 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Tue, 11 Oct 2011 17:50:28 +0200 Subject: Fixed Linux build --- indra/llui/llsdparam.cpp | 6 ++++++ indra/llui/llsdparam.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index da50c0ff39..242b1fca7f 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -299,6 +299,12 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI } } +//static +void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd) +{ + LLInitParam::Parser::name_stack_t stack = LLInitParam::Parser::name_stack_t(); + readSDValues(cb, sd, stack); +} namespace LLInitParam { // LLSD specialization diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h index 784358d038..c1cfa98399 100644 --- a/indra/llui/llsdparam.h +++ b/indra/llui/llsdparam.h @@ -36,7 +36,8 @@ struct LLParamSDParserUtilities static LLSD& getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range); typedef boost::function read_sd_cb_t; - static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack = LLInitParam::Parser::name_stack_t()); + static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack); + static void readSDValues(read_sd_cb_t cb, const LLSD& sd); }; class LLParamSDParser -- cgit v1.2.3 From 0620e6a79149e455744131703e8bdb74864b69be Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 11 Oct 2011 09:10:08 -0700 Subject: New picks icon --- .../skins/default/textures/toolbar_icons/picks.png | Bin 1368 -> 1396 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/indra/newview/skins/default/textures/toolbar_icons/picks.png b/indra/newview/skins/default/textures/toolbar_icons/picks.png index 4499bf562b..befda04b42 100644 Binary files a/indra/newview/skins/default/textures/toolbar_icons/picks.png and b/indra/newview/skins/default/textures/toolbar_icons/picks.png differ -- cgit v1.2.3 From 8154c245dd2f7aaee390e0206f460b9dd5b9f693 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Tue, 11 Oct 2011 18:14:37 +0200 Subject: EXP-1281 FIXED (As a FUI user, I want all bottom bar floaters to become independent) Made bottom bar dependent floaters independent from it. Also some LLTransientDockableFloaters are just LLFLoaters now. Note: IM Floater and SysWellWindow will be made independent within EXP-1276 --- indra/newview/llcallfloater.cpp | 2 +- indra/newview/llcallfloater.h | 5 +- indra/newview/llfloatercamera.cpp | 14 +- indra/newview/llfloatercamera.h | 5 +- indra/newview/llmoveview.cpp | 76 ++--- indra/newview/llmoveview.h | 6 +- indra/newview/llnearbychat.cpp | 2 +- indra/newview/llnearbychatbar.cpp | 353 --------------------- indra/newview/llnearbychatbar.h | 62 +--- .../skins/default/xui/en/floater_camera.xml | 4 +- 10 files changed, 32 insertions(+), 497 deletions(-) diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index 4c6ddc8be7..cc2a189b76 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -37,9 +37,9 @@ #include "llavatarnamecache.h" #include "llavatariconctrl.h" #include "llavatarlist.h" -#include "llbottomtray.h" #include "lldraghandle.h" #include "llimfloater.h" +#include "llimview.h" #include "llfloaterreg.h" #include "llparticipantlist.h" #include "llspeakers.h" diff --git a/indra/newview/llcallfloater.h b/indra/newview/llcallfloater.h index ea78cd53b7..7282f7a8be 100644 --- a/indra/newview/llcallfloater.h +++ b/indra/newview/llcallfloater.h @@ -28,7 +28,7 @@ #ifndef LL_LLCALLFLOATER_H #define LL_LLCALLFLOATER_H -#include "lltransientdockablefloater.h" +#include "llfloater.h" #include "llvoicechannel.h" #include "llvoiceclient.h" @@ -262,9 +262,6 @@ private: */ static LLVoiceChannel* sCurrentVoiceChannel; - /* virtual */ - LLTransientFloaterMgr::ETransientGroup getGroup() { return LLTransientFloaterMgr::IM; } - boost::signals2::connection mVoiceChannelStateChangeConnection; }; diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 1dfa904a19..b4658b1edb 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -36,7 +36,6 @@ #include "lljoystickbutton.h" #include "llviewercontrol.h" #include "llviewercamera.h" -#include "llbottomtray.h" #include "lltoolmgr.h" #include "lltoolfocus.h" #include "llslider.h" @@ -314,12 +313,6 @@ void LLFloaterCamera::onOpen(const LLSD& key) { LLFirstUse::viewPopup(); - LLButton *anchor_panel = LLBottomTray::getInstance()->getChild("camera_btn"); - - setDockControl(new LLDockControl( - anchor_panel, this, - getDockTongue(), LLDockControl::TOP)); - mZoom->onOpen(key); // Returns to previous mode, see EXT-2727(View tool should remember state). @@ -343,15 +336,12 @@ void LLFloaterCamera::onClose(bool app_quitting) if (mCurrMode == CAMERA_CTRL_MODE_PAN) mPrevMode = CAMERA_CTRL_MODE_PAN; - // HACK: Should always close as docked to prevent toggleInstance without calling onOpen. - if ( !isDocked() ) - setDocked(true); switchMode(CAMERA_CTRL_MODE_PAN); mClosed = TRUE; } LLFloaterCamera::LLFloaterCamera(const LLSD& val) -: LLTransientDockableFloater(NULL, true, val), +: LLFloater(val), mClosed(FALSE), mCurrMode(CAMERA_CTRL_MODE_PAN), mPrevMode(CAMERA_CTRL_MODE_PAN) @@ -379,7 +369,7 @@ BOOL LLFloaterCamera::postBuild() // ensure that appearance mode is handled while building. See EXT-7796. handleAvatarEditingAppearance(sAppearanceEditing); - return LLDockableFloater::postBuild(); + return TRUE; } void LLFloaterCamera::fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel) diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 424191ef26..4572932853 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -27,7 +27,7 @@ #ifndef LLFLOATERCAMERA_H #define LLFLOATERCAMERA_H -#include "lltransientdockablefloater.h" +#include "llfloater.h" #include "lliconctrl.h" #include "lltextbox.h" #include "llflatlistview.h" @@ -45,8 +45,7 @@ enum ECameraControlMode CAMERA_CTRL_MODE_PRESETS }; -class LLFloaterCamera - : public LLTransientDockableFloater +class LLFloaterCamera : public LLFloater { friend class LLFloaterReg; diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index a29526777a..2af01d06c1 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -37,7 +37,6 @@ #include "llagent.h" #include "llagentcamera.h" #include "llvoavatarself.h" // to check gAgentAvatarp->isSitting() -#include "llbottomtray.h" #include "llbutton.h" #include "llfirstuse.h" #include "llfloaterreg.h" @@ -46,7 +45,8 @@ #include "lluictrlfactory.h" #include "llviewerwindow.h" #include "llviewercontrol.h" -#include "llselectmgr.h" +#include "llselectmgr.h" +#include "lltoolbarview.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" #include "lltooltip.h" @@ -59,15 +59,13 @@ const F32 MOVE_BUTTON_DELAY = 0.0f; const F32 YAW_NUDGE_RATE = 0.05f; // fraction of normal speed const F32 NUDGE_TIME = 0.25f; // in seconds -const std::string BOTTOM_TRAY_BUTTON_NAME = "movement_btn"; - // // Member functions // // protected LLFloaterMove::LLFloaterMove(const LLSD& key) -: LLTransientDockableFloater(NULL, true, key), +: LLFloater(key), mForwardButton(NULL), mBackwardButton(NULL), mTurnLeftButton(NULL), @@ -94,8 +92,6 @@ BOOL LLFloaterMove::postBuild() { updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730) - LLDockableFloater::postBuild(); - // Code that implements floater buttons toggling when user moves via keyboard is located in LLAgent::propagate() mForwardButton = getChild("forward btn"); @@ -153,10 +149,10 @@ BOOL LLFloaterMove::postBuild() // virtual void LLFloaterMove::setVisible(BOOL visible) { - // Do nothing with Stand/Stop Flying panel in excessive calls of this method (from LLTransientFloaterMgr?). + // Do nothing with Stand/Stop Flying panel in excessive calls of this method. if (getVisible() == visible) { - LLTransientDockableFloater::setVisible(visible); + LLFloater::setVisible(visible); return; } @@ -175,7 +171,7 @@ void LLFloaterMove::setVisible(BOOL visible) LLPanelStandStopFlying::getInstance()->reparent(NULL); } - LLTransientDockableFloater::setVisible(visible); + LLFloater::setVisible(visible); } // static @@ -439,30 +435,6 @@ void LLFloaterMove::setModeTitle(const EMovementMode mode) setTitle(title); } -/** - * Updates position of the floater to be center aligned with Move button. - */ -void LLFloaterMove::updatePosition() -{ - LLBottomTray* tray = LLBottomTray::getInstance(); - if (!tray) return; - - LLButton* movement_btn = tray->findChild(BOTTOM_TRAY_BUTTON_NAME); - - if (movement_btn) - { - //align centers of a button and a floater - S32 x = movement_btn->calcScreenRect().getCenterX() - getRect().getWidth()/2; - - S32 y = 0; - if (!mModeActionsPanel->getVisible()) - { - y = mModeActionsPanel->getRect().getHeight(); - } - setOrigin(x, y); - } -} - //static void LLFloaterMove::sUpdateFlyingStatus() { @@ -497,8 +469,6 @@ void LLFloaterMove::enableInstance(BOOL bEnable) void LLFloaterMove::onOpen(const LLSD& key) { - LLButton *anchor_panel = LLBottomTray::getInstance()->getChild("movement_btn"); - if (gAgent.getFlying()) { setFlyingMode(TRUE); @@ -511,19 +481,9 @@ void LLFloaterMove::onOpen(const LLSD& key) showModeButtons(FALSE); } - setDockControl(new LLDockControl( - anchor_panel, this, - getDockTongue(), LLDockControl::TOP)); - sUpdateFlyingStatus(); } -//virtual -void LLFloaterMove::setDocked(bool docked, bool pop_on_undock/* = true*/) -{ - LLTransientDockableFloater::setDocked(docked, pop_on_undock); -} - void LLFloaterMove::setModeButtonToggleState(const EMovementMode mode) { llassert_always(mModeControlButtonMap.end() != mModeControlButtonMap.find(mode)); @@ -734,23 +694,27 @@ void LLPanelStandStopFlying::onStopFlyingButtonClick() */ void LLPanelStandStopFlying::updatePosition() { - LLBottomTray* tray = LLBottomTray::getInstance(); - if (!tray || mAttached) return; - - LLButton* movement_btn = tray->findChild(BOTTOM_TRAY_BUTTON_NAME); + if (mAttached) return; S32 x = 0; - if (movement_btn) + S32 y = 0; + + if(LLView* root = getRootView()) { - // Align centers of the button and the panel. - x = movement_btn->calcScreenRect().getCenterX() - getRect().getWidth()/2; + x = root->calcScreenRect().getCenterX() - getRect().getWidth()/2; } - else + + if (LLToolBar* toolbar_bottom = gToolBarView->getChild("toolbar_bottom")) { - x = tray->calcScreenRect().getCenterX() - getRect().getWidth()/2; + y = toolbar_bottom->getRect().getHeight(); } + + if(LLPanel* panel_ssf_container = getRootView()->getChild("stand_stop_flying_container")) + { + panel_ssf_container->setOrigin(0, y); + } + setOrigin(x, 0); } - // EOF diff --git a/indra/newview/llmoveview.h b/indra/newview/llmoveview.h index 1b87864651..744dd866d4 100644 --- a/indra/newview/llmoveview.h +++ b/indra/newview/llmoveview.h @@ -28,7 +28,7 @@ #define LL_LLMOVEVIEW_H // Library includes -#include "lltransientdockablefloater.h" +#include "llfloater.h" class LLButton; class LLJoystickAgentTurn; @@ -38,7 +38,7 @@ class LLJoystickAgentSlide; // Classes // class LLFloaterMove -: public LLTransientDockableFloater +: public LLFloater { LOG_CLASS(LLFloaterMove); friend class LLFloaterReg; @@ -58,7 +58,6 @@ public: static void setSittingMode(BOOL bSitting); static void enableInstance(BOOL bEnable); /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true); static void sUpdateFlyingStatus(); @@ -87,7 +86,6 @@ private: void initModeButtonMap(); void setModeButtonToggleState(const EMovementMode mode); void updateButtonsWithMovementMode(const EMovementMode newMode); - void updatePosition(); void showModeButtons(BOOL bShow); public: diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 9eaa64a124..67d745248f 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -34,6 +34,7 @@ #include "lliconctrl.h" #include "llfloatersidepanelcontainer.h" #include "llfocusmgr.h" +#include "lllogchat.h" #include "llresizebar.h" #include "llresizehandle.h" #include "llmenugl.h" @@ -50,7 +51,6 @@ #include "lldraghandle.h" -#include "llbottomtray.h" #include "llnearbychatbar.h" #include "llfloaterreg.h" #include "lltrans.h" diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index caa20b767c..3073a19d83 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -34,7 +34,6 @@ #include "llfirstuse.h" #include "llnearbychatbar.h" -#include "llbottomtray.h" #include "llagent.h" #include "llgesturemgr.h" #include "llmultigesture.h" @@ -58,8 +57,6 @@ const S32 EXPANDED_HEIGHT = 300; // legacy callback glue void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); -static LLDefaultChildRegistry::Register r("gesture_combo_list"); - struct LLChatTypeTrigger { std::string name; EChatType type; @@ -70,351 +67,6 @@ static LLChatTypeTrigger sChatTypeTriggers[] = { { "/shout" , CHAT_TYPE_SHOUT} }; -//ext-7367 -//Problem: gesture list control (actually LLScrollListCtrl) didn't actually process mouse wheel message. -// introduce new gesture list subclass to "eat" mouse wheel messages (and probably some other messages) -class LLGestureScrollListCtrl: public LLScrollListCtrl -{ -protected: - friend class LLUICtrlFactory; - LLGestureScrollListCtrl(const LLScrollListCtrl::Params& params) - :LLScrollListCtrl(params) - { - } -public: - BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) - { - LLScrollListCtrl::handleScrollWheel( x, y, clicks ); - return TRUE; - } - //See EXT-6598 - //Mouse hover over separator will result in not processing tooltip message - //So eat this message - BOOL handleToolTip(S32 x, S32 y, MASK mask) - { - LLScrollListCtrl::handleToolTip( x, y, mask ); - return TRUE; - } -}; - -LLGestureComboList::Params::Params() -: combo_button("combo_button"), - combo_list("combo_list"), - get_more("get_more", true), - view_all("view_all", true) -{ -} - -LLGestureComboList::LLGestureComboList(const LLGestureComboList::Params& p) -: LLUICtrl(p), - mLabel(p.label), - mViewAllItemIndex(-1), - mGetMoreItemIndex(-1), - mShowViewAll(p.view_all), - mShowGetMore(p.get_more) -{ - LLBottomtrayButton::Params button_params = p.combo_button; - button_params.follows.flags(FOLLOWS_LEFT|FOLLOWS_BOTTOM|FOLLOWS_RIGHT); - - mButton = LLUICtrlFactory::create(button_params); - mButton->reshape(getRect().getWidth(),getRect().getHeight()); - mButton->setCommitCallback(boost::bind(&LLGestureComboList::onButtonCommit, this)); - - addChild(mButton); - - LLGestureScrollListCtrl::Params params(p.combo_list); - - params.name("GestureComboList"); - params.commit_callback.function(boost::bind(&LLGestureComboList::onItemSelected, this, _2)); - params.visible(false); - params.commit_on_keyboard_movement(false); - - mList = LLUICtrlFactory::create(params); - addChild(mList); - - //****************************Gesture Part********************************/ - - setCommitCallback(boost::bind(&LLGestureComboList::onCommitGesture, this)); - - // now register us as observer since we have a place to put the results - LLGestureMgr::instance().addObserver(this); - - // refresh list from current active gestures - refreshGestures(); - - setFocusLostCallback(boost::bind(&LLGestureComboList::hideList, this)); -} - -BOOL LLGestureComboList::handleKeyHere(KEY key, MASK mask) -{ - BOOL handled = FALSE; - - if (key == KEY_ESCAPE && mask == MASK_NONE ) - { - hideList(); - handled = TRUE; - } - else - { - handled = mList->handleKeyHere(key, mask); - } - - return handled; -} - -void LLGestureComboList::draw() -{ - LLUICtrl::draw(); - - if(mButton->getToggleState()) - { - showList(); - } -} - -void LLGestureComboList::showList() -{ - LLRect rect = mList->getRect(); - LLRect button_rect = mButton->getRect(); - - // Calculating amount of space between the navigation bar and gestures combo - LLNavigationBar* nb = LLNavigationBar::getInstance(); - - S32 x, nb_bottom; - nb->localPointToOtherView(0, 0, &x, &nb_bottom, this); - - S32 max_height = nb_bottom - button_rect.mTop; - mList->calcColumnWidths(); - rect.setOriginAndSize(button_rect.mLeft, button_rect.mTop, llmax(mList->getMaxContentWidth(),mButton->getRect().getWidth()), max_height); - - mList->setRect(rect); - mList->fitContents( llmax(mList->getMaxContentWidth(),mButton->getRect().getWidth()), max_height); - - gFocusMgr.setKeyboardFocus(this); - - // Show the list and push the button down - mButton->setToggleState(TRUE); - mList->setVisible(TRUE); - sendChildToFront(mList); - LLUI::addPopup(mList); -} - -void LLGestureComboList::onButtonCommit() -{ - if (!mList->getVisible()) - { - // highlight the last selected item from the original selection before potentially selecting a new item - // as visual cue to original value of combo box - LLScrollListItem* last_selected_item = mList->getLastSelectedItem(); - if (last_selected_item) - { - mList->mouseOverHighlightNthItem(mList->getItemIndex(last_selected_item)); - } - - if (mList->getItemCount() != 0) - { - showList(); - } - } - else - { - hideList(); - } -} - -void LLGestureComboList::hideList() -{ - if (mList->getVisible()) - { - mButton->setToggleState(FALSE); - mList->setVisible(FALSE); - mList->mouseOverHighlightNthItem(-1); - LLUI::removePopup(mList); - gFocusMgr.setKeyboardFocus(NULL); - } -} - -S32 LLGestureComboList::getCurrentIndex() const -{ - LLScrollListItem* item = mList->getFirstSelected(); - if( item ) - { - return mList->getItemIndex( item ); - } - return -1; -} - -void LLGestureComboList::onItemSelected(const LLSD& data) -{ - const std::string name = mList->getSelectedItemLabel(); - - S32 cur_id = getCurrentIndex(); - mLastSelectedIndex = cur_id; - if (cur_id != mList->getItemCount()-1 && cur_id != -1) - { - mButton->setLabel(name); - } - - // hiding the list reasserts the old value stored in the text editor/dropdown button - hideList(); - - // commit does the reverse, asserting the value in the list - onCommit(); -} - -void LLGestureComboList::sortByName(bool ascending) -{ - mList->sortOnce(0, ascending); -} - -LLSD LLGestureComboList::getValue() const -{ - LLScrollListItem* item = mList->getFirstSelected(); - if( item ) - { - return item->getValue(); - } - else - { - return LLSD(); - } -} - -void LLGestureComboList::refreshGestures() -{ - //store current selection so we can maintain it - LLSD cur_gesture = getValue(); - - mList->selectFirstItem(); - mList->clearRows(); - mGestures.clear(); - - LLGestureMgr::item_map_t::const_iterator it; - const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures(); - LLSD::Integer idx(0); - for (it = active_gestures.begin(); it != active_gestures.end(); ++it) - { - LLMultiGesture* gesture = (*it).second; - if (gesture) - { - mList->addSimpleElement(gesture->mName, ADD_BOTTOM, LLSD(idx)); - mGestures.push_back(gesture); - idx++; - } - } - - sortByName(); - - // store indices for Get More and View All items (idx is the index followed by the last added Gesture) - if (mShowGetMore) - { - mGetMoreItemIndex = idx; - mList->addSimpleElement(LLTrans::getString("GetMoreGestures"), ADD_BOTTOM, LLSD(mGetMoreItemIndex)); - } - if (mShowViewAll) - { - mViewAllItemIndex = idx + 1; - mList->addSimpleElement(LLTrans::getString("ViewAllGestures"), ADD_BOTTOM, LLSD(mViewAllItemIndex)); - } - - // Insert label after sorting, at top, with separator below it - mList->addSeparator(ADD_TOP); - mList->addSimpleElement(mLabel, ADD_TOP); - - if (cur_gesture.isDefined()) - { - mList->selectByValue(cur_gesture); - - } - else - { - mList->selectFirstItem(); - } - - LLCtrlListInterface* gestures = getListInterface(); - LLMultiGesture* gesture = NULL; - - if (gestures) - { - S32 sel_index = gestures->getFirstSelectedIndex(); - if (sel_index != 0) - { - S32 index = gestures->getSelectedValue().asInteger(); - if (index<0 || index >= (S32)mGestures.size()) - { - llwarns << "out of range gesture access" << llendl; - } - else - { - gesture = mGestures.at(index); - } - } - } - - if(gesture && LLGestureMgr::instance().isGesturePlaying(gesture)) - { - return; - } - - mButton->setLabel(mLabel); -} - -void LLGestureComboList::onCommitGesture() -{ - LLCtrlListInterface* gestures = getListInterface(); - if (gestures) - { - S32 sel_index = gestures->getFirstSelectedIndex(); - if (sel_index == 0) - { - return; - } - - S32 index = gestures->getSelectedValue().asInteger(); - - if (mViewAllItemIndex == index) - { - // The same behavior as Ctrl+G. EXT-823 - LLFloaterReg::toggleInstance("gestures"); - gestures->selectFirstItem(); - return; - } - - if (mGetMoreItemIndex == index) - { - LLWeb::loadURLExternal(gSavedSettings.getString("GesturesMarketplaceURL")); - return; - } - - if (index<0 || index >= (S32)mGestures.size()) - { - llwarns << "out of range gesture index" << llendl; - } - else - { - LLMultiGesture* gesture = mGestures.at(index); - if(gesture) - { - LLGestureMgr::instance().playGesture(gesture); - if(!gesture->mReplaceText.empty()) - { - LLNearbyChatBar::sendChatFromViewer(gesture->mReplaceText, CHAT_TYPE_NORMAL, FALSE); - } - } - } - } -} - -LLGestureComboList::~LLGestureComboList() -{ - LLGestureMgr::instance().removeObserver(this); -} - -LLCtrlListInterface* LLGestureComboList::getListInterface() -{ - return mList; -} - LLNearbyChatBar::LLNearbyChatBar(const LLSD& key) : LLFloater(key), mChatBox(NULL) @@ -839,11 +491,6 @@ void LLNearbyChatBar::startChat(const char* line) // static void LLNearbyChatBar::stopChat() { - LLBottomTray *bt = LLBottomTray::getInstance(); - - if (!bt) - return; - LLNearbyChatBar* cb = LLNearbyChatBar::getInstance(); if (!cb) diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h index 0415f12a0d..a6fd6e5665 100644 --- a/indra/newview/llnearbychatbar.h +++ b/indra/newview/llnearbychatbar.h @@ -27,73 +27,15 @@ #ifndef LL_LLNEARBYCHATBAR_H #define LL_LLNEARBYCHATBAR_H -#include "llpanel.h" +#include "llfloater.h" #include "llcombobox.h" #include "llgesturemgr.h" #include "llchat.h" #include "llvoiceclient.h" #include "lloutputmonitorctrl.h" #include "llspeakers.h" -#include "llbottomtray.h" - -class LLGestureComboList - : public LLGestureManagerObserver - , public LLUICtrl -{ -public: - struct Params : public LLInitParam::Block - { - Optional combo_button; - Optional combo_list; - Optional get_more, - view_all; - - Params(); - }; - -protected: - - friend class LLUICtrlFactory; - LLGestureComboList(const Params&); - std::vector mGestures; - std::string mLabel; - bool mShowViewAll; - bool mShowGetMore; - LLSD::Integer mViewAllItemIndex; - LLSD::Integer mGetMoreItemIndex; - -public: - - ~LLGestureComboList(); - - LLCtrlListInterface* getListInterface(); - virtual void showList(); - virtual void hideList(); - virtual BOOL handleKeyHere(KEY key, MASK mask); - - virtual void draw(); - - S32 getCurrentIndex() const; - void onItemSelected(const LLSD& data); - void sortByName(bool ascending = true); - void refreshGestures(); - void onCommitGesture(); - void onButtonCommit(); - virtual LLSD getValue() const; - - // LLGestureManagerObserver trigger - virtual void changed() { refreshGestures(); } - -private: - - LLButton* mButton; - LLScrollListCtrl* mList; - S32 mLastSelectedIndex; -}; - -class LLNearbyChatBar -: public LLFloater +class LLNearbyChatBar : public LLFloater { public: // constructor for inline chat-bars (e.g. hosted in chat history window) diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml index da2be18db6..125ca81cde 100644 --- a/indra/newview/skins/default/xui/en/floater_camera.xml +++ b/indra/newview/skins/default/xui/en/floater_camera.xml @@ -1,9 +1,8 @@ Date: Tue, 11 Oct 2011 10:07:19 -0700 Subject: Added 'execute_stop_function' command parameter to handle mouse down/up actions on toolbar buttons --- indra/llui/llbutton.cpp | 18 ++++++++++++++++++ indra/llui/llbutton.h | 5 +++++ indra/llui/llcommandmanager.cpp | 4 ++++ indra/llui/llcommandmanager.h | 9 +++++++++ indra/llui/lltoolbar.cpp | 22 ++++++++++++++++++---- indra/newview/app_settings/commands.xml | 2 ++ 6 files changed, 56 insertions(+), 4 deletions(-) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index ba3748a573..2e9c7a5d3d 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -296,6 +296,24 @@ void LLButton::onCommit() LLUICtrl::onCommit(); } +boost::signals2::connection LLButton::setClickedCallback(const CommitCallbackParam& cb) +{ + return setClickedCallback(initCommitCallback(cb)); +} +boost::signals2::connection LLButton::setMouseDownCallback(const CommitCallbackParam& cb) +{ + return setMouseDownCallback(initCommitCallback(cb)); +} +boost::signals2::connection LLButton::setMouseUpCallback(const CommitCallbackParam& cb) +{ + return setMouseUpCallback(initCommitCallback(cb)); +} +boost::signals2::connection LLButton::setHeldDownCallback(const CommitCallbackParam& cb) +{ + return setHeldDownCallback(initCommitCallback(cb)); +} + + boost::signals2::connection LLButton::setClickedCallback( const commit_signal_t::slot_type& cb ) { if (!mCommitSignal) mCommitSignal = new commit_signal_t(); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index a0a7b4e372..ba0345f610 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -170,6 +170,11 @@ public: void setUseEllipses( BOOL use_ellipses ) { mUseEllipses = use_ellipses; } + boost::signals2::connection setClickedCallback(const CommitCallbackParam& cb); + boost::signals2::connection setMouseDownCallback(const CommitCallbackParam& cb); + boost::signals2::connection setMouseUpCallback(const CommitCallbackParam& cb); + boost::signals2::connection setHeldDownCallback(const CommitCallbackParam& cb); + boost::signals2::connection setClickedCallback( const commit_signal_t::slot_type& cb ); // mouse down and up within button boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ); // mouse up, EVEN IF NOT IN BUTTON diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index d8e035a320..128ba609cb 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -55,6 +55,8 @@ LLCommand::Params::Params() , tooltip_ref("tooltip_ref") , execute_function("execute_function") , execute_parameters("execute_parameters") + , execute_stop_function("execute_stop_function") + , execute_stop_parameters("execute_stop_parameters") , is_enabled_function("is_enabled_function") , is_enabled_parameters("is_enabled_parameters") , is_running_function("is_running_function") @@ -72,6 +74,8 @@ LLCommand::LLCommand(const LLCommand::Params& p) , mTooltipRef(p.tooltip_ref) , mExecuteFunction(p.execute_function) , mExecuteParameters(p.execute_parameters) + , mExecuteStopFunction(p.execute_stop_function) + , mExecuteStopParameters(p.execute_stop_parameters) , mIsEnabledFunction(p.is_enabled_function) , mIsEnabledParameters(p.is_enabled_parameters) , mIsRunningFunction(p.is_running_function) diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index 46e0fe6e69..9b93ab735a 100644 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -116,6 +116,9 @@ public: Mandatory execute_function; Optional execute_parameters; + Optional execute_stop_function; + Optional execute_stop_parameters; + Optional is_enabled_function; Optional is_enabled_parameters; @@ -139,6 +142,9 @@ public: const std::string& executeFunctionName() const { return mExecuteFunction; } const LLSD& executeParameters() const { return mExecuteParameters; } + const std::string& executeStopFunctionName() const { return mExecuteStopFunction; } + const LLSD& executeStopParameters() const { return mExecuteStopParameters; } + const std::string& isEnabledFunctionName() const { return mIsEnabledFunction; } const LLSD& isEnabledParameters() const { return mIsEnabledParameters; } @@ -159,6 +165,9 @@ private: std::string mExecuteFunction; LLSD mExecuteParameters; + std::string mExecuteStopFunction; + LLSD mExecuteStopParameters; + std::string mIsEnabledFunction; LLSD mIsEnabledParameters; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 89184f781f..e74aab6e21 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -659,11 +659,25 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) if (!mReadOnly) { - LLUICtrl::CommitCallbackParam cbParam; - cbParam.function_name = commandp->executeFunctionName(); - cbParam.parameter = commandp->executeParameters(); + LLUICtrl::CommitCallbackParam executeParam; + executeParam.function_name = commandp->executeFunctionName(); + executeParam.parameter = commandp->executeParameters(); - button->setCommitCallback(cbParam); + // If we have a "stop" function then we map the command to mouse down / mouse up otherwise commit + const std::string& executeStopFunction = commandp->executeStopFunctionName(); + if (executeStopFunction.length() > 0) + { + LLUICtrl::CommitCallbackParam executeStopParam; + executeStopParam.function_name = executeStopFunction; + executeStopParam.parameter = commandp->executeStopParameters(); + + button->setMouseDownCallback(executeParam); + button->setMouseUpCallback(executeStopParam); + } + else + { + button->setCommitCallback(executeParam); + } const std::string& isEnabledFunction = commandp->isEnabledFunctionName(); if (isEnabledFunction.length() > 0) diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index d758647d3a..296d992b34 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -217,6 +217,8 @@ tooltip_ref="Command_Speak_Tooltip" execute_function="Agent.ToggleMicrophone" execute_parameters="speak" + execute_stop_function="" + execute_stop_parameters="speak" is_enabled_function="Agent.IsActionAllowed" is_enabled_parameters="speak" is_running_function="Agent.IsMicrophoneOn" -- cgit v1.2.3 From 3596c0f7e139724f31258ffb96157146aeba77b1 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 11 Oct 2011 15:06:16 -0700 Subject: EXP-1300 : Implemented carets for DaD. Works with small bugs but OK for demo. Still in need of some cleanup --- indra/llui/lltoolbar.cpp | 86 +++++++++++++++------ indra/llui/lltoolbar.h | 7 +- indra/newview/lltoolbarview.cpp | 7 -- .../textures/toolbar_icons/caret_bottom.png | Bin 139 -> 169 bytes .../default/textures/toolbar_icons/caret_left.png | Bin 893 -> 913 bytes .../default/textures/toolbar_icons/caret_right.png | Bin 892 -> 911 bytes .../skins/default/xui/en/panel_toolbar_view.xml | 13 ++-- 7 files changed, 75 insertions(+), 38 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 89184f781f..7c1e2017c0 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -34,6 +34,7 @@ #include "llmenugl.h" #include "lltrans.h" #include "llinventory.h" +#include "lliconctrl.h" // uncomment this and remove the one in llui.cpp when there is an external reference to this translation unit // thanks, MSVC! @@ -204,7 +205,6 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank) { LLCommand * command = LLCommandManager::instance().getCommand(commandId); if (!command) return false; - llinfos << "Merov debug : addCommand, " << commandId.name() << ", " << commandId.uuid() << llendl; // Create the button and do the things that don't need ordering LLToolBarButton* button = createButton(commandId); @@ -248,7 +248,6 @@ int LLToolBar::removeCommand(const LLCommandId& commandId) { if (!hasCommand(commandId)) return RANK_NONE; - llinfos << "Merov debug : removeCommand, " << commandId.name() << ", " << commandId.uuid() << llendl; // First erase the map record command_id_map::iterator it = mButtonMap.find(commandId.uuid()); mButtonMap.erase(it); @@ -398,7 +397,7 @@ void LLToolBar::resizeButtonsInRow(std::vector& buttons_in_row // The rank is the position a tool dropped in (x,y) would assume in the button list. // The value returned is between 0 and mButtons.size(), 0 being the first element to the left // (or top) and mButtons.size() the last one to the right (or bottom). -int LLToolBar::getRankFromPosition(S32 x, S32 y) +int LLToolBar::getRankFromPosition(S32& x, S32& y) { int rank = 0; @@ -406,16 +405,16 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y) S32 button_panel_x = 0; S32 button_panel_y = 0; localPointToOtherView(x, y, &button_panel_x, &button_panel_y, mButtonPanel); + S32 dx = x - button_panel_x; + S32 dy = y - button_panel_y; - //llinfos << "Merov debug : rank compute: orientation = " << orientation << ", x = " << button_panel_x << ", y = " << button_panel_y << llendl; - // Simply compare the passed coord with the buttons outbound box std::list::iterator it_button = mButtons.begin(); std::list::iterator end_button = mButtons.end(); + LLRect button_rect; while (it_button != end_button) { - LLRect button_rect = (*it_button)->getRect(); - //llinfos << "Merov debug : rank compute: rect = " << button_rect.mLeft << ", " << button_rect.mTop << ", " << button_rect.mRight << ", " << button_rect.mBottom << llendl; + button_rect = (*it_button)->getRect(); if (((orientation == LLLayoutStack::HORIZONTAL) && (button_rect.mRight > button_panel_x)) || ((orientation == LLLayoutStack::VERTICAL) && (button_rect.mBottom < button_panel_y)) ) { @@ -424,7 +423,16 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y) rank++; ++it_button; } - //llinfos << "Merov debug : rank = " << rank << llendl; + if (it_button != end_button) + { + x = button_rect.mRight + dx; + y = button_rect.mTop + dy; + } + else + { + x = button_rect.mLeft + dx; + y = button_rect.mBottom + dy; + } return rank; } @@ -613,7 +621,40 @@ void LLToolBar::draw() LLUI::pushMatrix(); LLUI::translate((F32)getRect().mLeft, (F32)getRect().mBottom, 0.f); + // Position the caret + LLIconCtrl* caret = getChild("caret"); + caret->setVisible(FALSE); + if (mDragAndDropTarget && !mButtonCommands.empty()) + { + LLRect caret_rect = caret->getRect(); + LLRect toolbar_rect = getRect(); + if (mSideType == SIDE_BOTTOM) + { + caret->setRect(LLRect(mDragx-caret_rect.getWidth()/2+1, + toolbar_rect.getHeight()+3, + mDragx+caret_rect.getWidth()/2+1, + toolbar_rect.getHeight()-caret_rect.getHeight()+3)); + } + else if (mSideType == SIDE_LEFT) + { + + caret->setRect(LLRect(toolbar_rect.getWidth()-caret_rect.getWidth()+3, + mDragy+caret_rect.getHeight()/2, + toolbar_rect.getWidth()+3, + mDragy-caret_rect.getHeight()/2)); + } + else + { + caret->setRect(LLRect(-3, + mDragy+caret_rect.getHeight()/2, + caret_rect.getWidth()-3, + mDragy-caret_rect.getHeight()/2)); + } + caret->setVisible(TRUE); + } + LLUICtrl::draw(); + caret->setVisible(FALSE); } void LLToolBar::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -713,7 +754,6 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EAcceptance* accept, std::string& tooltip_msg) { - llinfos << "Merov debug : handleDragAndDrop. drop = " << drop << ", x = " << x << ", y = " << y << llendl; // If we have a drop callback, that means that we can handle the drop BOOL handled = (mHandleDropCallback ? TRUE : FALSE); @@ -729,21 +769,22 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, // We'll use that flag to change the visual aspect of the toolbar target on draw() mDragAndDropTarget = false; - // HACK!!! - if (!isReadOnly() && handled) + // Convert drag position into insert position and rank + if (!isReadOnly() && handled && !drop) { - if (!drop) + LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data; + LLAssetType::EType type = inv_item->getType(); + if (type == LLAssetType::AT_WIDGET) { - LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data; - LLAssetType::EType type = inv_item->getType(); - if (type == LLAssetType::AT_WIDGET) - { - LLCommandId dragged_command(inv_item->getUUID()); - int rank = getRankFromPosition(x, y); - removeCommand(dragged_command); - addCommand(dragged_command,rank); - mDragAndDropTarget = true; - } + mDragx = x; + mDragy = y; + mDragRank = getRankFromPosition(mDragx, mDragy); + mDragAndDropTarget = true; + /* Do the following if you want to animate the button itself + LLCommandId dragged_command(inv_item->getUUID()); + removeCommand(dragged_command); + addCommand(dragged_command,rank); + */ } } @@ -784,7 +825,6 @@ BOOL LLToolBarButton::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) { -// llinfos << "Merov debug: handleHover, x = " << x << ", y = " << y << ", mouse = " << hasMouseCapture() << llendl; BOOL handled = FALSE; S32 mouse_distance_squared = (x - mMouseDownX) * (x - mMouseDownX) + (y - mMouseDownY) * (y - mMouseDownY); diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index ca04a0e5d5..f3457028e7 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -156,7 +156,7 @@ public: // virtuals void draw(); void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - int getRankFromPosition(S32 x, S32 y); + int getRankFromPosition(S32& x, S32& y); BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, @@ -188,6 +188,9 @@ protected: tool_handledrag_callback_t mHandleDragItemCallback; tool_handledrop_callback_t mHandleDropCallback; bool mDragAndDropTarget; + int mDragRank; + S32 mDragx, + mDragy; public: // Methods used in loading and saving toolbar settings @@ -217,7 +220,7 @@ private: LLLayoutStack* mWrapStack; LLPanel* mButtonPanel; LLToolBarEnums::SideType mSideType; - + bool mWrap; bool mNeedsLayout; S32 mPadLeft, diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 318bede6f0..164a1c0ca6 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -330,7 +330,6 @@ void LLToolBarView::draw() void LLToolBarView::startDragTool( S32 x, S32 y, const LLUUID& uuid) { - llinfos << "Merov debug: startDragTool() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl; // Flag the tool dragging but don't start it yet gToolBarView->mDragStarted = false; gToolBarView->mDragCommand = LLCommandId::null; @@ -345,7 +344,6 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp { if (!gToolBarView->mDragStarted) { - llinfos << "Merov debug: handleDragTool() : x = " << x << ", y = " << y << ", uuid = " << uuid << llendl; // Start the tool dragging: // First, create the global drag and drop object @@ -357,7 +355,6 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp LLToolDragAndDrop::ESource src = LLToolDragAndDrop::SOURCE_VIEWER; LLUUID srcID; LLToolDragAndDrop::getInstance()->beginMultiDrag(types, cargo_ids, src, srcID); - llinfos << "Merov debug: beginMultiDrag() launched" << llendl; // Second, check if the command is present in one of the 3 toolbars // If it is, store the command, the toolbar and the rank in the toolbar and @@ -383,7 +380,6 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp } */ - llinfos << "Merov debug: Drag started cleanly" << llendl; gToolBarView->mDragStarted = true; return TRUE; } @@ -399,12 +395,10 @@ BOOL LLToolBarView::handleDragTool( S32 x, S32 y, const LLUUID& uuid, LLAssetTyp BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* toolbar) { LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data; - //llinfos << "Merov debug : handleDropTool. Drop " << inv_item->getUUID() << " named " << inv_item->getName() << " of type " << inv_item->getType() << llendl; LLAssetType::EType type = inv_item->getType(); if (type == LLAssetType::AT_WIDGET) { - //llinfos << "Merov debug : handleDropTool. Drop source is a widget -> drop it in place..." << llendl; // Get the command from its uuid LLCommandManager& mgr = LLCommandManager::instance(); LLCommandId command_id(inv_item->getUUID()); @@ -419,7 +413,6 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t } // Suppress the command from the toolbars (including the one it's dropped in, // this will handle move position). - llinfos << "Merov debug : handleDropTool, " << command_id.name() << ", " << command_id.uuid() << llendl; gToolBarView->mToolbarLeft->removeCommand(command_id); gToolBarView->mToolbarRight->removeCommand(command_id); gToolBarView->mToolbarBottom->removeCommand(command_id); diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png b/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png index 82f58b22b9..d506cda5c9 100644 Binary files a/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png and b/indra/newview/skins/default/textures/toolbar_icons/caret_bottom.png differ diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_left.png b/indra/newview/skins/default/textures/toolbar_icons/caret_left.png index 75eecc84ed..b1284aaf79 100644 Binary files a/indra/newview/skins/default/textures/toolbar_icons/caret_left.png and b/indra/newview/skins/default/textures/toolbar_icons/caret_left.png differ diff --git a/indra/newview/skins/default/textures/toolbar_icons/caret_right.png b/indra/newview/skins/default/textures/toolbar_icons/caret_right.png index 677459ae1c..bf6a4ed66c 100644 Binary files a/indra/newview/skins/default/textures/toolbar_icons/caret_right.png and b/indra/newview/skins/default/textures/toolbar_icons/caret_right.png differ diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml index 5d6967ed32..9ffd62f7a9 100644 --- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml @@ -48,8 +48,8 @@ side="left" button_display_mode="icons_only"> -- cgit v1.2.3 From 5cfd34df908572045fe3ff193e2f9242b9f2025b Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 11 Oct 2011 18:18:02 -0400 Subject: STORM-976 Object muted by name still displays notification message when clicked --- doc/contributions.txt | 1 + indra/newview/llviewermessage.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index 693d4c37b8..c60e91c9e7 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -576,6 +576,7 @@ Jonathan Yap STORM-1567 STORM-1572 STORM-1574 + STORM-976 Kadah Coba STORM-1060 Jondan Lundquist diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 74ee918bfe..8f3163c0cf 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1809,8 +1809,11 @@ void LLOfferInfo::initRespondFunctionMap() void inventory_offer_handler(LLOfferInfo* info) { - //If muted, don't even go through the messaging stuff. Just curtail the offer here. - if (LLMuteList::getInstance()->isMuted(info->mFromID, info->mFromName)) + // If muted, don't even go through the messaging stuff. Just curtail the offer here. + // Passing in a null UUID handles the case of where you have muted one of your own objects by_name. + // The solution for STORM-1297 seems to handle the cases where the object is owned by someone else. + if (LLMuteList::getInstance()->isMuted(info->mFromID, info->mFromName) || + LLMuteList::getInstance()->isMuted(LLUUID::null, info->mFromName)) { info->forceResponse(IOR_MUTE); return; -- cgit v1.2.3 From ecdcaf149b7def0e40898ac202539376a673c7b1 Mon Sep 17 00:00:00 2001 From: callum Date: Tue, 11 Oct 2011 15:33:43 -0700 Subject: FIX EXP-1302 Make the Speak button work as a toolbar button and EXP-1324 Push to talk hot key doesn't change button state of speak button --- indra/newview/app_settings/commands.xml | 4 ++-- indra/newview/llagent.cpp | 27 +++++++++++---------------- indra/newview/llagent.h | 4 ++-- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 296d992b34..3625ce5088 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -215,9 +215,9 @@ icon="Command_Speak_Icon" label_ref="Command_Speak_Label" tooltip_ref="Command_Speak_Tooltip" - execute_function="Agent.ToggleMicrophone" + execute_function="Agent.PressMicrophone" execute_parameters="speak" - execute_stop_function="" + execute_stop_function="Agent.ReleaseMicrophone" execute_stop_parameters="speak" is_enabled_function="Agent.IsActionAllowed" is_enabled_parameters="speak" diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 8303a5942d..31a73c8c31 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -188,28 +188,23 @@ bool LLAgent::isActionAllowed(const LLSD& sdname) } // static -void LLAgent::toggleMicrophone(const LLSD& name) +void LLAgent::pressMicrophone(const LLSD& name) { - gAgent.mMicrophoneOn = ! gAgent.mMicrophoneOn; + LLFirstUse::speak(false); - if ( gAgent.mMicrophoneOn ) - { - LLFirstUse::speak(false); + LLVoiceClient::getInstance()->inputUserControlState(true); +} - LLVoiceClient::getInstance()->inputUserControlState(true); - LLVoiceClient::getInstance()->inputUserControlState(false); - } - else - { - LLVoiceClient::getInstance()->inputUserControlState(false); - LLVoiceClient::getInstance()->inputUserControlState(true); - } +// static +void LLAgent::releaseMicrophone(const LLSD& name) +{ + LLVoiceClient::getInstance()->inputUserControlState(false); } // static bool LLAgent::isMicrophoneOn(const LLSD& sdname) { - return gAgent.mMicrophoneOn; + return LLVoiceClient::getInstance()->getUserPTTState(); } // ************************************************************ @@ -294,7 +289,6 @@ LLAgent::LLAgent() : mGenderChosen(FALSE), mVoiceConnected(false), - mMicrophoneOn(false), mAppearanceSerialNum(0), @@ -314,7 +308,8 @@ LLAgent::LLAgent() : LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&LLAgent::parcelChangedCallback)); LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2)); - LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2)); + LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Agent.PressMicrophone", boost::bind(&LLAgent::pressMicrophone, _2)); + LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Agent.ReleaseMicrophone", boost::bind(&LLAgent::releaseMicrophone, _2)); LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2)); } diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 0355e68b6e..0f7ed9ce68 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -290,12 +290,12 @@ public: bool isVoiceConnected() const { return mVoiceConnected; } void setVoiceConnected(const bool b) { mVoiceConnected = b; } - static void toggleMicrophone(const LLSD& name); + static void pressMicrophone(const LLSD& name); + static void releaseMicrophone(const LLSD& name); static bool isMicrophoneOn(const LLSD& sdname); private: bool mVoiceConnected; - bool mMicrophoneOn; //-------------------------------------------------------------------- // Chat -- cgit v1.2.3 From ca9ea840951bcfeaf46f07c9ee0974408c21792a Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 11 Oct 2011 15:54:56 -0700 Subject: * Dimmed overlay color on button image overlays to 0.75*alpha when buttons are unselected. --- indra/llui/llbutton.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 2e9c7a5d3d..0a7584a576 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -828,6 +828,10 @@ void LLButton::draw() { overlay_color.mV[VALPHA] = 0.5f; } + else if (!getToggleState()) + { + overlay_color.mV[VALPHA] = 0.75f; + } overlay_color.mV[VALPHA] *= alpha; switch(mImageOverlayAlignment) -- cgit v1.2.3 From 9f0890fc3a6931562843e4597c009778424ee5bc Mon Sep 17 00:00:00 2001 From: leyla_linden Date: Tue, 11 Oct 2011 16:17:23 -0700 Subject: EXP-1293 Nearby chat toasts no longer appear. EXP-1316 Minimized Snapshot floater has a snapshot preview image attached below. EXP-1318 Clicking on nearby chat toasts should bring up Nearby Chat history --- indra/newview/llchatitemscontainerctrl.cpp | 5 +++-- indra/newview/llfloatersnapshot.cpp | 2 +- indra/newview/llnearbychatbar.cpp | 10 ++++++++++ indra/newview/llnearbychatbar.h | 2 ++ indra/newview/llnearbychathandler.cpp | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index 8584885bc9..9a84280f25 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -35,6 +35,7 @@ #include "llfloaterreg.h" #include "lllocalcliprect.h" #include "lltrans.h" +#include "llnearbychatbar.h" #include "llviewercontrol.h" #include "llagentdata.h" @@ -315,12 +316,12 @@ BOOL LLNearbyChatToastPanel::handleMouseUp (S32 x, S32 y, MASK mask) return TRUE; else { - LLFloaterReg::showInstance("nearby_chat",LLSD()); + LLNearbyChatBar::getInstance()->showHistory(); return FALSE; } } - LLFloaterReg::showInstance("nearby_chat",LLSD()); + LLNearbyChatBar::getInstance()->showHistory(); return LLPanel::handleMouseUp(x,y,mask); } diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 9d020517d8..8105844b0d 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -2217,7 +2217,7 @@ void LLFloaterSnapshot::draw() LLFloater::draw(); - if (previewp) + if (previewp && !isMinimized()) { if(previewp->getThumbnailImage()) { diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 3073a19d83..cd84275ef0 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -135,6 +135,16 @@ LLNearbyChatBar* LLNearbyChatBar::getInstance() return LLFloaterReg::getTypedInstance("chat_bar"); } +void LLNearbyChatBar::showHistory() +{ + if (!getChildView("nearby_chat")->getVisible()) + { + onToggleNearbyChatPanel(); + } + + openFloater(); +} + void LLNearbyChatBar::draw() { displaySpeakingIndicator(); diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h index a6fd6e5665..5a7edac1bb 100644 --- a/indra/newview/llnearbychatbar.h +++ b/indra/newview/llnearbychatbar.h @@ -59,6 +59,8 @@ public: static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate); static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); + void showHistory(); + protected: static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str); static void onChatBoxKeystroke(LLLineEditor* caller, void* userdata); diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index dcf444b048..7503164fe6 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -581,7 +581,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, // WARNING - not sChatWatcher->post(notification); - if( nearby_chat->getVisible() + if( chat_bar->getVisible() && nearby_chat->getVisible() || ( chat_msg.mSourceType == CHAT_SOURCE_AGENT && gSavedSettings.getBOOL("UseChatBubbles") ) || !mChannel->getShowToasts() ) // to prevent toasts in Busy mode -- cgit v1.2.3 From dacfe7b2bdc845640f18db33992924033494e470 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 11 Oct 2011 16:20:02 -0700 Subject: EXP-1300 : Fix caret position in bottom bar, fix misplacement when moving within same toolbar, suppress visible caret in some situations, no caret if toolbar empty --- indra/llui/lltoolbar.cpp | 5 +++-- indra/newview/lltoolbarview.cpp | 27 +++++++++++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index d4633d7c3b..a1ea4ba18b 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -425,12 +425,12 @@ int LLToolBar::getRankFromPosition(S32& x, S32& y) } if (it_button != end_button) { - x = button_rect.mRight + dx; + x = button_rect.mLeft + dx; y = button_rect.mTop + dy; } else { - x = button_rect.mLeft + dx; + x = button_rect.mRight + dx; y = button_rect.mBottom + dy; } @@ -655,6 +655,7 @@ void LLToolBar::draw() LLUICtrl::draw(); caret->setVisible(FALSE); + mDragAndDropTarget = false; } void LLToolBar::reshape(S32 width, S32 height, BOOL called_from_parent) diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 8ae9328f6d..86f6477710 100644 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -406,20 +406,35 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t if (command) { // Convert the (x,y) position in rank in toolbar - int rank = 0; + int new_rank = LLToolBar::RANK_NONE; if (!toolbar->isReadOnly()) { - rank = toolbar->getRankFromPosition(x,y); + new_rank = toolbar->getRankFromPosition(x,y); } // Suppress the command from the toolbars (including the one it's dropped in, // this will handle move position). - gToolBarView->mToolbarLeft->removeCommand(command_id); - gToolBarView->mToolbarRight->removeCommand(command_id); - gToolBarView->mToolbarBottom->removeCommand(command_id); + int old_rank = LLToolBar::RANK_NONE; + int rank; + if ((rank = gToolBarView->mToolbarLeft->removeCommand(command_id)) != LLToolBar::RANK_NONE) + { + old_rank = rank; + } + if ((rank = gToolBarView->mToolbarRight->removeCommand(command_id)) != LLToolBar::RANK_NONE) + { + old_rank = rank; + } + if ((rank = gToolBarView->mToolbarBottom->removeCommand(command_id)) != LLToolBar::RANK_NONE) + { + old_rank = rank; + } // Now insert it in the toolbar at the detected rank if (!toolbar->isReadOnly()) { - toolbar->addCommand(command->id(),rank); + if ((old_rank != LLToolBar::RANK_NONE) && (old_rank < new_rank)) + { + new_rank -= 1; + } + toolbar->addCommand(command->id(),new_rank); } } else -- cgit v1.2.3 From 3c06bb26b0fc4204945020c37f00dbdf0ff9338b Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 11 Oct 2011 17:19:14 -0700 Subject: New icons with 10% more opacity --- .../skins/default/textures/toolbar_icons/move.png | Bin 1322 -> 1328 bytes .../default/textures/toolbar_icons/nearbyvoice.png | Bin 1280 -> 3160 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/indra/newview/skins/default/textures/toolbar_icons/move.png b/indra/newview/skins/default/textures/toolbar_icons/move.png index 5854110782..5c2ced7375 100644 Binary files a/indra/newview/skins/default/textures/toolbar_icons/move.png and b/indra/newview/skins/default/textures/toolbar_icons/move.png differ diff --git a/indra/newview/skins/default/textures/toolbar_icons/nearbyvoice.png b/indra/newview/skins/default/textures/toolbar_icons/nearbyvoice.png index 5bdcb22aa5..46e299cb94 100644 Binary files a/indra/newview/skins/default/textures/toolbar_icons/nearbyvoice.png and b/indra/newview/skins/default/textures/toolbar_icons/nearbyvoice.png differ -- cgit v1.2.3 From f9e900f5ac9002f5ef3b44b02ac300971288e89b Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 11 Oct 2011 17:36:23 -0700 Subject: * New floater positioning code. Better than what's checked in but not great. * Floater updates for positioning and to revert some earlier string changes. --- indra/llui/llfloater.cpp | 76 +++++++++++++++++----- indra/llui/llfloater.h | 42 +++++++++--- indra/llui/llfloaterreg.cpp | 35 +++++----- indra/newview/llappviewer.cpp | 7 +- indra/newview/llfloatercamera.cpp | 2 +- indra/newview/llfloaterpreference.cpp | 1 - indra/newview/llfloatertoybox.cpp | 2 - .../newview/skins/default/xui/en/floater_about.xml | 1 + .../skins/default/xui/en/floater_about_land.xml | 3 +- .../skins/default/xui/en/floater_activeim.xml | 2 - .../skins/default/xui/en/floater_avatar.xml | 6 +- .../skins/default/xui/en/floater_avatar_picker.xml | 1 + .../skins/default/xui/en/floater_camera.xml | 6 +- .../skins/default/xui/en/floater_chat_bar.xml | 5 +- .../skins/default/xui/en/floater_critical.xml | 2 +- .../skins/default/xui/en/floater_destinations.xml | 7 +- .../skins/default/xui/en/floater_gesture.xml | 4 +- .../skins/default/xui/en/floater_help_browser.xml | 3 +- .../skins/default/xui/en/floater_im_session.xml | 2 - .../skins/default/xui/en/floater_inventory.xml | 1 - .../xui/en/floater_inventory_item_properties.xml | 1 - .../skins/default/xui/en/floater_land_holdings.xml | 1 + indra/newview/skins/default/xui/en/floater_map.xml | 5 +- .../skins/default/xui/en/floater_media_browser.xml | 1 - .../default/xui/en/floater_media_settings.xml | 1 - .../skins/default/xui/en/floater_model_preview.xml | 2 +- .../skins/default/xui/en/floater_moveview.xml | 5 +- .../skins/default/xui/en/floater_my_appearance.xml | 3 +- .../skins/default/xui/en/floater_my_inventory.xml | 3 +- .../skins/default/xui/en/floater_my_profile.xml | 3 +- .../default/xui/en/floater_outfit_save_as.xml | 2 +- .../skins/default/xui/en/floater_people.xml | 1 + .../skins/default/xui/en/floater_places.xml | 1 + .../skins/default/xui/en/floater_postcard.xml | 1 - .../skins/default/xui/en/floater_preferences.xml | 5 +- .../default/xui/en/floater_preview_animation.xml | 1 - .../default/xui/en/floater_preview_gesture.xml | 3 +- .../default/xui/en/floater_preview_notecard.xml | 1 - .../skins/default/xui/en/floater_preview_sound.xml | 1 - .../default/xui/en/floater_preview_texture.xml | 1 - .../skins/default/xui/en/floater_script.xml | 2 - .../default/xui/en/floater_script_preview.xml | 1 - .../skins/default/xui/en/floater_script_queue.xml | 1 - .../skins/default/xui/en/floater_search.xml | 14 ++-- .../skins/default/xui/en/floater_snapshot.xml | 3 +- .../skins/default/xui/en/floater_sound_devices.xml | 2 +- .../skins/default/xui/en/floater_sys_well.xml | 2 - .../skins/default/xui/en/floater_telehub.xml | 1 - .../newview/skins/default/xui/en/floater_tools.xml | 1 + .../skins/default/xui/en/floater_toybox.xml | 4 +- .../default/xui/en/floater_voice_controls.xml | 3 +- .../skins/default/xui/en/floater_web_content.xml | 1 - .../skins/default/xui/en/floater_world_map.xml | 4 +- .../skins/default/xui/en/outfit_accordion_tab.xml | 2 +- indra/newview/skins/default/xui/en/panel_toast.xml | 1 + .../skins/default/xui/en/widgets/floater.xml | 4 +- 56 files changed, 184 insertions(+), 112 deletions(-) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 90c41e99dc..0398c0d7eb 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -62,6 +62,17 @@ // use this to control "jumping" behavior when Ctrl-Tabbing const S32 TABBED_FLOATER_OFFSET = 0; +namespace LLInitParam +{ + void TypeValues::declareValues() + { + declare("none", LLFloaterEnums::OPEN_POSITIONING_NONE); + declare("cascading", LLFloaterEnums::OPEN_POSITIONING_CASCADING); + declare("centered", LLFloaterEnums::OPEN_POSITIONING_CENTERED); + declare("specified", LLFloaterEnums::OPEN_POSITIONING_SPECIFIED); + } +} + std::string LLFloater::sButtonNames[BUTTON_COUNT] = { "llfloater_close_btn", //BUTTON_CLOSE @@ -154,7 +165,6 @@ LLFloater::Params::Params() : title("title"), short_title("short_title"), single_instance("single_instance", false), - auto_tile("auto_tile", false), can_resize("can_resize", false), can_minimize("can_minimize", true), can_close("can_close", true), @@ -164,7 +174,7 @@ LLFloater::Params::Params() save_rect("save_rect", false), save_visibility("save_visibility", false), can_dock("can_dock", false), - open_centered("open_centered", false), + open_positioning("open_positioning", LLFloaterEnums::OPEN_POSITIONING_NONE), header_height("header_height", 0), legacy_header_height("legacy_header_height", 0), close_image("close_image"), @@ -227,7 +237,6 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) mShortTitle(p.short_title), mSingleInstance(p.single_instance), mKey(key), - mAutoTile(p.auto_tile), mCanTearOff(p.can_tear_off), mCanMinimize(p.can_minimize), mCanClose(p.can_close), @@ -831,7 +840,7 @@ LLMultiFloater* LLFloater::getHost() return (LLMultiFloater*)mHostHandle.get(); } -void LLFloater::applySavedVariables() +void LLFloater::applySavedVariables() { applyRectControl(); applyDockState(); @@ -839,13 +848,7 @@ void LLFloater::applySavedVariables() void LLFloater::applyRectControl() { - // first, center on screen if requested - if (mOpenCentered) - { - center(); - } - - // override center if we have saved rect control + // If we have a saved rect, use it if (mRectControl.size() > 1) { const LLRect& rect = getControlGroup()->getRect(mRectControl); @@ -867,7 +870,50 @@ void LLFloater::applyDockState() bool dockState = getControlGroup()->getBOOL(mDocStateControl); setDocked(dockState); } +} + +void LLFloater::applyPositioning() +{ + // Otherwise position according to the positioning code + switch (mOpenPositioning) + { + case LLFloaterEnums::OPEN_POSITIONING_CENTERED: + center(); + break; + + case LLFloaterEnums::OPEN_POSITIONING_SPECIFIED: + { + // Translate relative to snap rect + LLRect r = getRect(); + r.mBottom = getSnapRect().getHeight() - r.getHeight() - r.mBottom; + setOrigin(r.mLeft, r.mBottom); + translateIntoRect(getSnapRect(), FALSE); + } + break; + case LLFloaterEnums::OPEN_POSITIONING_CASCADING: + { + static const U32 CASCADING_FLOATER_HOFFSET = 25; + static const U32 CASCADING_FLOATER_VOFFSET = 25; + static const S32 CASCADING_FLOATER_LIMIT = 15; + static S32 cascading_floater_count = 1; + const S32 top = CASCADING_FLOATER_VOFFSET * cascading_floater_count; + const S32 left = CASCADING_FLOATER_HOFFSET * cascading_floater_count; + setOrigin(left, top); + translateIntoRect(getSnapRect(), FALSE); + + if (++cascading_floater_count > CASCADING_FLOATER_LIMIT) + { + cascading_floater_count = 1; + } + } + break; + + case LLFloaterEnums::OPEN_POSITIONING_NONE: + default: + // Do nothing + break; + } } void LLFloater::applyTitle() @@ -2784,7 +2830,6 @@ void LLFloater::setInstanceName(const std::string& name) { mDocStateControl = LLFloaterReg::declareDockStateControl(ctrl_name); } - } } @@ -2846,9 +2891,9 @@ void LLFloater::initFromParams(const LLFloater::Params& p) mHeaderHeight = p.header_height; mLegacyHeaderHeight = p.legacy_header_height; mSingleInstance = p.single_instance; - mAutoTile = p.auto_tile; - mOpenCentered = p.open_centered; + mOpenPositioning = p.open_positioning; + /* if (p.save_rect && mRectControl.empty()) { mRectControl = "t"; // flag to build mRectControl name once mInstanceName is set @@ -2856,7 +2901,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) if (p.save_visibility) { mVisibilityControl = "t"; // flag to build mVisibilityControl name once mInstanceName is set - } + }*/ if(p.save_dock_state) { @@ -3008,6 +3053,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str llerrs << "Failed to construct floater " << getName() << llendl; } + applyPositioning(); applyRectControl(); // If we have a saved rect control, apply it gFloaterView->adjustToFitScreen(this, FALSE); // Floaters loaded from XML should all fit on screen diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index af9665e599..b404306e94 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -59,11 +59,35 @@ const BOOL CLOSE_NO = FALSE; const BOOL ADJUST_VERTICAL_YES = TRUE; const BOOL ADJUST_VERTICAL_NO = FALSE; +namespace LLFloaterEnums +{ + enum EOpenPositioning + { + OPEN_POSITIONING_NONE, + OPEN_POSITIONING_CASCADING, + OPEN_POSITIONING_CENTERED, + OPEN_POSITIONING_SPECIFIED, + + OPEN_POSITIONING_COUNT + }; +} + +namespace LLInitParam +{ + template<> + struct TypeValues : public TypeValuesHelper + { + static void declareValues(); + }; +} + + class LLFloater : public LLPanel { -friend class LLFloaterView; -friend class LLFloaterReg; -friend class LLMultiFloater; + friend class LLFloaterView; + friend class LLFloaterReg; + friend class LLMultiFloater; + public: struct KeyCompare { @@ -95,7 +119,6 @@ public: short_title; Optional single_instance, - auto_tile, can_resize, can_minimize, can_close, @@ -104,8 +127,10 @@ public: save_rect, save_visibility, save_dock_state, - can_dock, - open_centered; + can_dock; + + Optional open_positioning; + Optional header_height, legacy_header_height; // HACK see initFromXML() @@ -297,6 +322,7 @@ protected: virtual void applyRectControl(); void applyDockState(); + void applyPositioning(); void storeRectControl(); void storeVisibilityControl(); void storeDockStateControl(); @@ -378,14 +404,14 @@ private: BOOL mSingleInstance; // TRUE if there is only ever one instance of the floater std::string mInstanceName; // Store the instance name so we can remove ourselves from the list - BOOL mAutoTile; // TRUE if placement of new instances tiles BOOL mCanTearOff; BOOL mCanMinimize; BOOL mCanClose; BOOL mDragOnLeft; BOOL mResizable; - bool mOpenCentered; + + LLFloaterEnums::EOpenPositioning mOpenPositioning; S32 mMinWidth; S32 mMinHeight; diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index ae06eb74ac..058223abbd 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -107,7 +107,6 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) if (!groupname.empty()) { instance_list_t& list = sInstanceMap[groupname]; - int index = list.size(); res = build_func(key); if (!res) @@ -121,27 +120,18 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) llwarns << "Failed to build floater type: '" << name << "'." << llendl; return NULL; } - + // Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe if (res->mKey.isUndefined()) { - res->mKey = key; + res->mKey = key; } res->setInstanceName(name); res->applySavedVariables(); // Can't apply rect and dock state until setting instance name - if (res->mAutoTile && !res->getHost() && index > 0) - { - LLFloater* last_floater = getLastFloaterInGroup(groupname); - if (last_floater) - { - res->stackWith(*last_floater); - gFloaterView->adjustToFitScreen(res, true); - } - } - else - { - gFloaterView->adjustToFitScreen(res, false); - } + + // apply list.size() and possibly stackWith(getLastFloaterInGroup(groupname)) + gFloaterView->adjustToFitScreen(res, false); + list.push_back(res); } } @@ -477,16 +467,21 @@ void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname) std::string name = sdname.asString(); parse_name_key(name, key); - LLFloater* instance = findInstance(name, key); + LLFloater* instance = getInstance(name, key); - if (LLFloater::isMinimized(instance)) + if (!instance) + { + lldebugs << "Unable to get instance of floater '" << name << "'" << llendl; + } + else if (instance->isMinimized()) { instance->setMinimized(FALSE); instance->setFocus(TRUE); } - else if (!LLFloater::isShown(instance)) + else if (!instance->isShown()) { - showInstance(name, key, TRUE); + instance->openFloater(key); + instance->setFocus(TRUE); } else if (!instance->hasFocus() && !instance->getIsChrome()) { diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 5077a0a596..2a9e411762 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4293,12 +4293,15 @@ void LLAppViewer::idle() return; } - gViewerWindow->updateUI(); + if (!quitRequested()) + { + gViewerWindow->updateUI(); + } /////////////////////////////////////// // Agent and camera movement // - LLCoordGL current_mouse = gViewerWindow->getCurrentMouse(); + LLCoordGL current_mouse = gViewerWindow->getCurrentMouse(); { // After agent and camera moved, figure out if we need to diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index b4658b1edb..aa78bc4f29 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -369,7 +369,7 @@ BOOL LLFloaterCamera::postBuild() // ensure that appearance mode is handled while building. See EXT-7796. handleAvatarEditingAppearance(sAppearanceEditing); - return TRUE; + return LLFloater::postBuild(); } void LLFloaterCamera::fillFlatlistFromPanel (LLFlatListView* list, LLPanel* panel) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 8412d37810..5fdeb46daa 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1913,7 +1913,6 @@ BOOL LLFloaterPreferenceProxy::postBuild() getChild("socks5_password")->setValue(socks_cred->getAuthenticator()["creds"].asString()); } - center(); return TRUE; } diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp index fa60022911..84881655f8 100644 --- a/indra/newview/llfloatertoybox.cpp +++ b/indra/newview/llfloatertoybox.cpp @@ -58,8 +58,6 @@ bool compare_localized_command_labels(LLCommand * cmd1, LLCommand * cmd2) BOOL LLFloaterToybox::postBuild() { - center(); - mBtnRestoreDefaults = getChild("btn_restore_defaults"); mToolBar = getChild("toybox_toolbar"); mToolBar->setStartDragCallback(boost::bind(LLToolBarView::startDragTool,_1,_2,_3)); diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml index 2580c06344..36af475824 100644 --- a/indra/newview/skins/default/xui/en/floater_about.xml +++ b/indra/newview/skins/default/xui/en/floater_about.xml @@ -1,5 +1,6 @@ diff --git a/indra/newview/skins/default/xui/en/floater_activeim.xml b/indra/newview/skins/default/xui/en/floater_activeim.xml index 96fe0aa70c..670c528f08 100644 --- a/indra/newview/skins/default/xui/en/floater_activeim.xml +++ b/indra/newview/skins/default/xui/en/floater_activeim.xml @@ -4,8 +4,6 @@ name="floater_activeim" help_topic="floater_activeim" title="ACTIVE IM" - top="26" - left="0" height="22" width="320" follows="right|bottom" diff --git a/indra/newview/skins/default/xui/en/floater_avatar.xml b/indra/newview/skins/default/xui/en/floater_avatar.xml index 666aa2d164..6e5c4ada48 100644 --- a/indra/newview/skins/default/xui/en/floater_avatar.xml +++ b/indra/newview/skins/default/xui/en/floater_avatar.xml @@ -12,12 +12,12 @@ single_instance="true" help_topic="avatar" save_rect="true" - title="Avatar Picker" - width="445"> + title="AVATAR PICKER" + width="635"> diff --git a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml index a11946d352..cbbbeb6094 100644 --- a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml +++ b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml @@ -1,5 +1,6 @@ diff --git a/indra/newview/skins/default/xui/en/floater_chat_bar.xml b/indra/newview/skins/default/xui/en/floater_chat_bar.xml index 6977e29b78..924e4bc11e 100644 --- a/indra/newview/skins/default/xui/en/floater_chat_bar.xml +++ b/indra/newview/skins/default/xui/en/floater_chat_bar.xml @@ -1,10 +1,13 @@ - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_side_tray.xml b/indra/newview/skins/default/xui/en/panel_side_tray.xml deleted file mode 100644 index 0f330a7b98..0000000000 --- a/indra/newview/skins/default/xui/en/panel_side_tray.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3 From 4c663ca8b997bd74fb3b646c3cb3870555dfeb91 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 13 Oct 2011 15:17:51 -0700 Subject: EXP-1314 FIX -- No floater for Marketplace EXP-1338 FIX -- Clicking on active Toybox buttons triggers clicking sound EXP-1339 FIX -- No minimum resize dimension for Place floater EXP-1340 FIX -- No minimum resize demension for Appearance floater EXP-1341 FIX -- Places Floater doesn't have Help button * Toybox buttons no longer have click sounds * Marketplace button opens external browser to marketplace url * Minimum sizes for places and appearance floaters * Marketplace URL's now all use https --- indra/newview/app_settings/commands.xml | 5 +- indra/newview/app_settings/settings.xml | 70 +++++++++++----------- indra/newview/llviewermenu.cpp | 2 + .../skins/default/xui/en/floater_my_appearance.xml | 2 + .../skins/default/xui/en/floater_places.xml | 3 + .../skins/default/xui/en/floater_toybox.xml | 1 + 6 files changed, 44 insertions(+), 39 deletions(-) diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index e4aaca1bd0..c83494df25 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -116,10 +116,7 @@ icon="Command_Marketplace_Icon" label_ref="Command_Marketplace_Label" tooltip_ref="Command_Marketplace_Tooltip" - execute_function="Floater.ToggleOrBringToFront" - execute_parameters="marketplace" - is_running_function="Floater.IsOpen" - is_running_parameters="marketplace" + execute_function="Avatar.OpenMarketplace" /> Type String Value - http://marketplace.secondlife.com/ + https://marketplace.secondlife.com/ MarketplaceURL_objectFemale @@ -5105,7 +5105,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/attachments + https://marketplace.secondlife.com/trampoline/viewer21/attachments MarketplaceURL_objectMale @@ -5116,7 +5116,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/attachments + https://marketplace.secondlife.com/trampoline/viewer21/attachments MarketplaceURL_clothingFemale @@ -5127,7 +5127,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/clothing_female_avatar + https://marketplace.secondlife.com/trampoline/viewer21/clothing_female_avatar MarketplaceURL_clothingMale @@ -5138,7 +5138,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/clothing_male_avatar + https://marketplace.secondlife.com/trampoline/viewer21/clothing_male_avatar MarketplaceURL_bodypartFemale @@ -5149,7 +5149,7 @@ Type String Value - http://marketplace.secondlife.com + https://marketplace.secondlife.com/ MarketplaceURL_bodypartMale @@ -5160,7 +5160,7 @@ Type String Value - http://marketplace.secondlife.com/ + https://marketplace.secondlife.com/ MarketplaceURL_glovesMale @@ -5171,7 +5171,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/gloves_both_women_and_men + https://marketplace.secondlife.com/trampoline/viewer21/gloves_both_women_and_men MarketplaceURL_glovesFemale @@ -5182,7 +5182,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/gloves_both_women_and_men + https://marketplace.secondlife.com/trampoline/viewer21/gloves_both_women_and_men MarketplaceURL_jacketFemale @@ -5193,7 +5193,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/jacket_womens + https://marketplace.secondlife.com/trampoline/viewer21/jacket_womens MarketplaceURL_jacketMale @@ -5204,7 +5204,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/jacket_mens + https://marketplace.secondlife.com/trampoline/viewer21/jacket_mens MarketplaceURL_shirtFemale @@ -5215,7 +5215,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/shirt_womens + https://marketplace.secondlife.com/trampoline/viewer21/shirt_womens MarketplaceURL_shirtMale @@ -5226,7 +5226,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/shirt_mens + https://marketplace.secondlife.com/trampoline/viewer21/shirt_mens MarketplaceURL_undershirtFemale @@ -5237,7 +5237,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/undershirt_womens + https://marketplace.secondlife.com/trampoline/viewer21/undershirt_womens MarketplaceURL_undershirtMale @@ -5248,7 +5248,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/undershirt_mens + https://marketplace.secondlife.com/trampoline/viewer21/undershirt_mens MarketplaceURL_skirtFemale @@ -5259,7 +5259,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/skirts_women + https://marketplace.secondlife.com/trampoline/viewer21/skirts_women MarketplaceURL_skirtMale @@ -5270,7 +5270,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/skirts_women + https://marketplace.secondlife.com/trampoline/viewer21/skirts_women MarketplaceURL_pantsFemale @@ -5281,7 +5281,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/pants_women + https://marketplace.secondlife.com/trampoline/viewer21/pants_women MarketplaceURL_pantsMale @@ -5292,7 +5292,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/pants_men + https://marketplace.secondlife.com/trampoline/viewer21/pants_men MarketplaceURL_underpantsFemale @@ -5303,7 +5303,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/underwear_women + https://marketplace.secondlife.com/trampoline/viewer21/underwear_women MarketplaceURL_underpantsMale @@ -5314,7 +5314,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/underwear_men + https://marketplace.secondlife.com/trampoline/viewer21/underwear_men MarketplaceURL_shoesFemale @@ -5325,7 +5325,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/shoes_women + https://marketplace.secondlife.com/trampoline/viewer21/shoes_women MarketplaceURL_shoesMale @@ -5336,7 +5336,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/shoes_men + https://marketplace.secondlife.com/trampoline/viewer21/shoes_men MarketplaceURL_socksFemale @@ -5347,7 +5347,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/socks_women + https://marketplace.secondlife.com/trampoline/viewer21/socks_women MarketplaceURL_socksMale @@ -5358,7 +5358,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/socks_women + https://marketplace.secondlife.com/trampoline/viewer21/socks_women MarketplaceURL_tattooMale @@ -5369,7 +5369,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/tattoo_both_women_and_men + https://marketplace.secondlife.com/trampoline/viewer21/tattoo_both_women_and_men MarketplaceURL_tattooFemale @@ -5380,7 +5380,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/tattoo_both_women_and_men + https://marketplace.secondlife.com/trampoline/viewer21/tattoo_both_women_and_men MarketplaceURL_hairFemale @@ -5391,7 +5391,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/womens_hair + https://marketplace.secondlife.com/trampoline/viewer21/womens_hair MarketplaceURL_hairMale @@ -5402,7 +5402,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/mens_hair + https://marketplace.secondlife.com/trampoline/viewer21/mens_hair MarketplaceURL_eyesFemale @@ -5413,7 +5413,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/womens_eyes + https://marketplace.secondlife.com/trampoline/viewer21/womens_eyes MarketplaceURL_eyesMale @@ -5424,7 +5424,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/mens_eyes + https://marketplace.secondlife.com/trampoline/viewer21/mens_eyes MarketplaceURL_shapeFemale @@ -5435,7 +5435,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/womens_shape + https://marketplace.secondlife.com/trampoline/viewer21/womens_shape MarketplaceURL_shapeMale @@ -5446,7 +5446,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/mens_shape + https://marketplace.secondlife.com/trampoline/viewer21/mens_shape MarketplaceURL_skinFemale @@ -5457,7 +5457,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/womens_skin + https://marketplace.secondlife.com/trampoline/viewer21/womens_skin MarketplaceURL_skinMale @@ -5468,7 +5468,7 @@ Type String Value - http://marketplace.secondlife.com/trampoline/viewer21/mens_skin + https://marketplace.secondlife.com/trampoline/viewer21/mens_skin MaxDragDistance diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 4b90f1952a..5d215c7f6d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8259,6 +8259,8 @@ void initialize_menus() view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse"); view_listener_t::addMenu(new LLAvatarToggleMyProfile(), "Avatar.ToggleMyProfile"); enable.add("Avatar.IsMyProfileOpen", boost::bind(&my_profile_visible)); + + commit.add("Avatar.OpenMarketplace", boost::bind(&LLWeb::loadURLExternal, gSavedSettings.getString("MarketplaceURL"))); view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend"); enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2)); diff --git a/indra/newview/skins/default/xui/en/floater_my_appearance.xml b/indra/newview/skins/default/xui/en/floater_my_appearance.xml index 758a1d5be9..74c4e22841 100644 --- a/indra/newview/skins/default/xui/en/floater_my_appearance.xml +++ b/indra/newview/skins/default/xui/en/floater_my_appearance.xml @@ -11,6 +11,8 @@ save_rect="true" single_instance="true" title="APPEARANCE" + min_height="230" + min_width="333" width="333"> Date: Thu, 13 Oct 2011 16:48:59 -0700 Subject: * Hooked up build FUI toolbar button * Added Shop button to status bar * Changed "Inventory..." menu item to go to same window as toolbar inventory button --- indra/newview/app_settings/commands.xml | 2 +- indra/newview/llstatusbar.cpp | 5 +++- indra/newview/skins/default/textures/textures.xml | 1 + .../default/textures/toolbar_icons/mini_cart.png | Bin 0 -> 2987 bytes indra/newview/skins/default/xui/en/menu_viewer.xml | 18 +++----------- .../skins/default/xui/en/panel_status_bar.xml | 27 ++++++++++++++++++--- 6 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 indra/newview/skins/default/textures/toolbar_icons/mini_cart.png diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index c83494df25..7c6468459c 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -35,7 +35,7 @@ icon="Command_Build_Icon" label_ref="Command_Build_Label" tooltip_ref="Command_Build_Tooltip" - execute_function="Floater.ToggleOrBringToFront" + execute_function="Build.Toggle" execute_parameters="build" is_enabled_function="Agent.IsActionAllowed" is_enabled_parameters="build" diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 1b8be7a5b2..75db269bde 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -169,6 +169,8 @@ BOOL LLStatusBar::postBuild() getChild("buyL")->setCommitCallback( boost::bind(&LLStatusBar::onClickBuyCurrency, this)); + getChild("goShop")->setCommitCallback(boost::bind(&LLWeb::loadURLExternal, gSavedSettings.getString("MarketplaceURL"))); + mBoxBalance = getChild("balance"); mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, this ); @@ -345,9 +347,10 @@ void LLStatusBar::setBalance(S32 balance) const S32 HPAD = 24; LLRect balance_rect = mBoxBalance->getTextBoundingRect(); LLRect buy_rect = getChildView("buyL")->getRect(); + LLRect shop_rect = getChildView("goShop")->getRect(); LLView* balance_bg_view = getChildView("balance_bg"); LLRect balance_bg_rect = balance_bg_view->getRect(); - balance_bg_rect.mLeft = balance_bg_rect.mRight - (buy_rect.getWidth() + balance_rect.getWidth() + HPAD); + balance_bg_rect.mLeft = balance_bg_rect.mRight - (buy_rect.getWidth() + shop_rect.getWidth() + balance_rect.getWidth() + HPAD); balance_bg_view->setShape(balance_bg_rect); } diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 25f1903131..ab1a8f0990 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -137,6 +137,7 @@ with the same filename but different name + diff --git a/indra/newview/skins/default/textures/toolbar_icons/mini_cart.png b/indra/newview/skins/default/textures/toolbar_icons/mini_cart.png new file mode 100644 index 0000000000..9fcf46794d Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/mini_cart.png differ diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 69029d2ab9..833e8b9f32 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -34,25 +34,13 @@ + shortcut="control|I" + visible="true"> - - - - + + + diff --git a/indra/newview/skins/default/xui/en/floater_critical.xml b/indra/newview/skins/default/xui/en/floater_critical.xml index 05c958e051..13b15bf724 100644 --- a/indra/newview/skins/default/xui/en/floater_critical.xml +++ b/indra/newview/skins/default/xui/en/floater_critical.xml @@ -6,7 +6,7 @@ height="500" layout="topleft" name="modal container" - open_centered="true" + open_positioning="centered" width="600"> + diff --git a/indra/newview/skins/default/xui/en/floater_voice_controls.xml b/indra/newview/skins/default/xui/en/floater_voice_controls.xml index f017a7ace6..3f5768bc0b 100644 --- a/indra/newview/skins/default/xui/en/floater_voice_controls.xml +++ b/indra/newview/skins/default/xui/en/floater_voice_controls.xml @@ -1,15 +1,16 @@ - NEARBY VOICE + Nearby voice - Group Call with [GROUP] + Group call with [GROUP] - Conference Call + Conference call diff --git a/indra/newview/skins/default/xui/en/floater_web_content.xml b/indra/newview/skins/default/xui/en/floater_web_content.xml index 0eda9ae62a..57d1c92acb 100644 --- a/indra/newview/skins/default/xui/en/floater_web_content.xml +++ b/indra/newview/skins/default/xui/en/floater_web_content.xml @@ -9,7 +9,6 @@ name="floater_web_content" help_topic="floater_web_content" save_rect="true" - auto_tile="true" title="" initial_mime_type="text/html" width="780"> diff --git a/indra/newview/skins/default/xui/en/floater_web_profile.xml b/indra/newview/skins/default/xui/en/floater_web_profile.xml new file mode 100644 index 0000000000..d0225f78a9 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_web_profile.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml index 019e7cd032..4314c8a9e2 100644 --- a/indra/newview/skins/default/xui/en/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en/floater_world_map.xml @@ -2,7 +2,7 @@ + top="0"> + + + - - + - - - - - - - - - - - - - - - - + + - + left="0" + follows="all" + height="500" + mouse_opaque="false" + name="login_panel_holder" + width="1024"/> - - - - + width="1024"/> + - - - + - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml index 29eeb93ac1..b452f96e7a 100644 --- a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml @@ -42,6 +42,6 @@ - + diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml index 65bd2793b6..614dd693c5 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml @@ -52,6 +52,6 @@ - + diff --git a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml index 0634e3bd3b..485a5a658c 100644 --- a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml @@ -34,6 +34,6 @@ - + diff --git a/indra/newview/skins/default/xui/en/menu_toolbars.xml b/indra/newview/skins/default/xui/en/menu_toolbars.xml new file mode 100644 index 0000000000..59912b5503 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_toolbars.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 16f48f3a4e..63e50b0b9f 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -8,169 +8,178 @@ label="Me" name="Me" tear_off="true"> - - - - - + + - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - + label="Sit Down" + layout="topleft" + shortcut="alt|shift|S" + name="Sit Down Here"> + + - - - - - - - - - - + label="Fly" + name="Fly" + shortcut="Home"> + + + - - + label="Always Run" + name="Always Run" + shortcut="control|R"> + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + label="Stop Animating Me" + name="Stop Animating My Avatar"> + + + + + label="Away" + name="Set Away"> + + + + + + + + + + + + + + + + + + + + + + + + function="Floater.Show" + parameter="preferences" /> + + + + + + @@ -219,10 +228,10 @@ use_mac_ctrl="true"> + parameter="chat_bar" /> + parameter="chat_bar" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml b/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml new file mode 100644 index 0000000000..355a76e05f --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_chiclet_bar.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 1c3e08d59b..3835cd17b6 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -120,33 +120,6 @@ label="Remember password" follows="left|bottom" font="SansSerifSmall" height="15" - left_pad="10" - name="mode_selection_text" - top="20" - width="130"> - Mode: - - - - - - - - - - - + diff --git a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml index 51ffec4727..7a8e872dc9 100644 --- a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml @@ -5,21 +5,21 @@ bg_opaque_color="MouseGray" follows="left|top|right" focus_root="true" - height="60" + height="34" layout="topleft" name="navigation_bar" chrome="true" - width="600"> + width="800"> + + + + width="480"> + width="355"> - - - - - - - - - - - - - - - - - + + + + + + + - - - - + auto_resize="true" + user_resize="true" + min_width="315" + name="favorites_layout_panel" + width="315"> + width="311"> - + + + More ▼ + + + + diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml new file mode 100644 index 0000000000..f766236b2e --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_nearby_chat.xml @@ -0,0 +1,35 @@ + + + + + diff --git a/indra/newview/skins/default/xui/en/panel_pick_info.xml b/indra/newview/skins/default/xui/en/panel_pick_info.xml index 7daa52b2d9..24046d5cca 100644 --- a/indra/newview/skins/default/xui/en/panel_pick_info.xml +++ b/indra/newview/skins/default/xui/en/panel_pick_info.xml @@ -117,7 +117,7 @@ + top_pad="0" + width="312"> - - Keyboard: + Keyboard: - Mouse: + Mouse: - Single click on land: + Single click on land: - Double click on land: + Double click on land: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index 5894abd03b..422bbada7f 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -35,8 +35,8 @@ + diff --git a/indra/newview/skins/default/xui/en/widgets/floater.xml b/indra/newview/skins/default/xui/en/widgets/floater.xml index 2e5ebafe46..adbb183317 100644 --- a/indra/newview/skins/default/xui/en/widgets/floater.xml +++ b/indra/newview/skins/default/xui/en/widgets/floater.xml @@ -1,7 +1,9 @@ - + + + + + diff --git a/indra/newview/skins/minimal/xui/da/floater_camera.xml b/indra/newview/skins/minimal/xui/da/floater_camera.xml deleted file mode 100644 index 5b7ef6db54..0000000000 --- a/indra/newview/skins/minimal/xui/da/floater_camera.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - Roter kamera omkring fokus - - - Zoom kamera mod fokus - - - Flyt kamera op og ned, til venstre og højre - - - Kamera valg - - - Kredsløb zoom panorering - - - Forvalg - - - Se objekt - - - - - - Se forfra - - - - - Se fra siden - - - - - Se bagfra - - - - - - - Se fra objekt - - - - - Førsteperson - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_help_browser.xml b/indra/newview/skins/minimal/xui/en/floater_help_browser.xml deleted file mode 100644 index 477f210352..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_help_browser.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - Loading... - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_media_browser.xml b/indra/newview/skins/minimal/xui/en/floater_media_browser.xml deleted file mode 100644 index 4862146c94..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_media_browser.xml +++ /dev/null @@ -1,242 +0,0 @@ - - - - http://www.secondlife.com - - - http://support.secondlife.com - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_nearby_chat.xml b/indra/newview/skins/minimal/xui/en/floater_nearby_chat.xml deleted file mode 100644 index 74ac885202..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_nearby_chat.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_side_bar_tab.xml b/indra/newview/skins/minimal/xui/en/floater_side_bar_tab.xml deleted file mode 100644 index 83b1260620..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_side_bar_tab.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/indra/newview/skins/minimal/xui/en/floater_web_content.xml b/indra/newview/skins/minimal/xui/en/floater_web_content.xml deleted file mode 100644 index 1d9a967d5a..0000000000 --- a/indra/newview/skins/minimal/xui/en/floater_web_content.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/inspect_avatar.xml b/indra/newview/skins/minimal/xui/en/inspect_avatar.xml deleted file mode 100644 index 853d5f8735..0000000000 --- a/indra/newview/skins/minimal/xui/en/inspect_avatar.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - -[AGE] - - -[SL_PROFILE] - - - - - - This is my second life description and I really think it is great. But for some reason my description is super extra long because I like to talk a whole lot - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/indra/newview/skins/minimal/xui/en/panel_group_control_panel.xml b/indra/newview/skins/minimal/xui/en/panel_group_control_panel.xml deleted file mode 100644 index abddc59296..0000000000 --- a/indra/newview/skins/minimal/xui/en/panel_group_control_panel.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - -