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 4ee79abdca66f73aaba25ebf0b874bd422db46f6 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 4 Oct 2011 15:21:13 -0700 Subject: Renamed PREFERENCES --- indra/newview/skins/default/xui/en/floater_preferences.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/floater_preferences.xml b/indra/newview/skins/default/xui/en/floater_preferences.xml index dcfa8bc060..c8a139904a 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences.xml @@ -8,7 +8,7 @@ name="Preferences" help_topic="preferences" single_instance="true" - title="PREFERENCES" + title="Preferences" width="658">