From c0637c83267540c5e91bd0afc3bea5c5b99a7f84 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 20 Oct 2009 22:59:38 +0000 Subject: Remove hard-coded black border around side tray, relates to EXT-1365 This leaves side tray contiguous with favorites bar, will be fixed by drop shadow from EXT-1742. Reviewed with Erica. --- indra/newview/llsidetray.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/newview/llsidetray.cpp') diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index ff95f8adce..3e53c354d8 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -209,11 +209,6 @@ void LLSideTrayTab::reshape (S32 width, S32 height, BOOL called_from_parent ) void LLSideTrayTab::draw() { LLPanel::draw(); - - //border - gl_rect_2d(0,0,getRect().getWidth() - 1,getRect().getHeight() - 1,LLColor4::black,false); - - } void LLSideTrayTab::onOpen (const LLSD& key) -- cgit v1.2.3 From a2d0b1d77ffdf78ca3dd0a5db276e657a8c4919e Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 21 Oct 2009 00:32:19 +0000 Subject: Side tray uses normal panel colors, not hard-coded floater colors. Added "Show Side Tray" to login debug menu. Fixed strange border color around Home side tray panel, more similar fixes to follow. Reviewed with Richard. --- indra/newview/llsidetray.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'indra/newview/llsidetray.cpp') diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 3e53c354d8..15f5e9da7b 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -144,12 +144,6 @@ BOOL LLSideTrayTab::postBuild() title_panel->getChild(TAB_PANEL_CAPTION_TITLE_BOX)->setValue(mTabTitle); - static LLUIColor default_background_color = LLUIColorTable::instance().getColor("FloaterDefaultBackgroundColor"); - static LLUIColor focus_background_color = LLUIColorTable::instance().getColor("FloaterFocusBackgroundColor"); - - setTransparentColor(default_background_color); - setBackgroundColor(focus_background_color); - return true; } -- cgit v1.2.3 From 044557a853ba70bfa80392b48936523528abda5f Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 21 Oct 2009 04:40:54 +0000 Subject: EXT-1365 Side tray panel borders fixed, XUI opacity of panels rationalized, eliminated programmatic setting of panel opacity, moved side tray panel buttons to flush with right of screen. Not reviewed. --- indra/newview/llsidetray.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'indra/newview/llsidetray.cpp') diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 15f5e9da7b..329d7d26ee 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -537,17 +537,15 @@ void LLSideTray::expandSideBar () void LLSideTray::highlightFocused() { + /* uncomment in case something change if(!mActiveTab) return; - /* uncomment in case something change BOOL dependent_has_focus = gFocusMgr.childHasKeyboardFocus(this); setBackgroundOpaque( dependent_has_focus ); mActiveTab->setBackgroundOpaque( dependent_has_focus ); */ - mActiveTab->setBackgroundOpaque( true ); - - } + BOOL LLSideTray::handleScrollWheel(S32 x, S32 y, S32 mask) { BOOL ret = LLPanel::handleScrollWheel(x,y,mask); @@ -565,6 +563,7 @@ BOOL LLSideTray::handleMouseDown (S32 x, S32 y, MASK mask) setFocus(true); return ret; } + void LLSideTray::reshape (S32 width, S32 height, BOOL called_from_parent) { @@ -675,7 +674,7 @@ void LLSideTray::resetPanelRect () static LLSideTray::Params sidetray_params(LLUICtrlFactory::getDefaultParams()); S32 panel_width = sidetray_params.default_button_width; - panel_width += mCollapsed ? sidetray_params.default_button_margin : mMaxBarWidth; + panel_width += mCollapsed ? 0 : mMaxBarWidth; S32 panel_height = parent_rect.getHeight()-fake_top_offset; @@ -692,7 +691,7 @@ void LLSideTray::setPanelRect () const LLRect& parent_rect = gViewerWindow->getRootView()->getRect(); S32 panel_width = sidetray_params.default_button_width; - panel_width += mCollapsed ? sidetray_params.default_button_margin : mMaxBarWidth; + panel_width += mCollapsed ? 0 : mMaxBarWidth; S32 panel_height = parent_rect.getHeight()-fake_top_offset - nav_rect.getHeight(); S32 panel_top = parent_rect.mTop-fake_top_offset - nav_rect.getHeight(); -- cgit v1.2.3 From 34316644305f2c212d99c01474d585e1a241cef4 Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 22 Oct 2009 15:40:59 -0700 Subject: Moved internal LLSideTrayTab class to .cpp file, de-inline param block constructor, not reviewed --- indra/newview/llsidetray.cpp | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'indra/newview/llsidetray.cpp') diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 329d7d26ee..47bf69d56c 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -111,6 +111,61 @@ bool LLSideTray::instanceCreated () return sInstance!=0; } +////////////////////////////////////////////////////////////////////////////// +// LLSideTrayTab +// Represents a single tab in the side tray, only used by LLSideTray +////////////////////////////////////////////////////////////////////////////// + +class LLSideTrayTab: public LLPanel +{ + friend class LLUICtrlFactory; + friend class LLSideTray; +public: + + struct Params + : public LLInitParam::Block + { + // image name + Optional image_path; + Optional tab_title; + Optional description; + Params() + : image_path("image"), + tab_title("tab_title","no title"), + description("description","no description") + {}; + }; +protected: + LLSideTrayTab(const Params& params); + + +public: + virtual ~LLSideTrayTab(); + + /*virtual*/ BOOL postBuild (); + /*virtual*/ bool addChild (LLView* view, S32 tab_group); + + + void arrange (S32 width, S32 height); + void reshape (S32 width, S32 height, BOOL called_from_parent = TRUE); + + static LLSideTrayTab* createInstance (); + + const std::string& getDescription () const { return mDescription;} + const std::string& getTabTitle() const { return mTabTitle;} + + void draw(); + + void onOpen (const LLSD& key); + +private: + std::string mTabTitle; + std::string mImagePath; + std::string mDescription; + + LLView* mMainPanel; +}; + LLSideTrayTab::LLSideTrayTab(const Params& params):mMainPanel(0) { mImagePath = params.image_path; @@ -221,6 +276,18 @@ LLSideTrayTab* LLSideTrayTab::createInstance () return tab; } +////////////////////////////////////////////////////////////////////////////// +// LLSideTray +////////////////////////////////////////////////////////////////////////////// + +LLSideTray::Params::Params() +: collapsed("collapsed",false), + tab_btn_image_normal("tab_btn_image","sidebar_tab_left.tga"), + tab_btn_image_selected("tab_btn_image_selected","button_enabled_selected_32x128.tga"), + default_button_width("tab_btn_width",32), + default_button_height("tab_btn_height",32), + default_button_margin("tab_btn_margin",0) +{} //virtual LLSideTray::LLSideTray(Params& params) -- cgit v1.2.3 From 350138e2bb086314bcdf74052d2b14c2f9f84c83 Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 22 Oct 2009 17:30:45 -0700 Subject: EXT-287 Side tray open/close arrows are now an image, not the text "<<" and ">>" Removed some dead code from LLSideTray Next step is to merge all the tab art with overlay art and use button selected images to show a "pressed" state for all buttons. Reviewed with Angela. --- indra/newview/llsidetray.cpp | 96 +++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 54 deletions(-) (limited to 'indra/newview/llsidetray.cpp') diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 47bf69d56c..22c3779050 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -126,13 +126,15 @@ public: : public LLInitParam::Block { // image name - Optional image_path; + Optional image; + Optional image_selected; Optional tab_title; Optional description; Params() - : image_path("image"), - tab_title("tab_title","no title"), - description("description","no description") + : image("image"), + image_selected("image_selected"), + tab_title("tab_title","no title"), + description("description","no description") {}; }; protected: @@ -160,18 +162,21 @@ public: private: std::string mTabTitle; - std::string mImagePath; + std::string mImage; + std::string mImageSelected; std::string mDescription; LLView* mMainPanel; }; -LLSideTrayTab::LLSideTrayTab(const Params& params):mMainPanel(0) +LLSideTrayTab::LLSideTrayTab(const Params& p) +: LLPanel(), + mTabTitle(p.tab_title), + mImage(p.image), + mImageSelected(p.image_selected), + mDescription(p.description), + mMainPanel(NULL) { - mImagePath = params.image_path; - mTabTitle = params.tab_title; - mDescription = params.description; - // Necessary for focus movement among child controls setFocusRoot(TRUE); } @@ -322,35 +327,6 @@ BOOL LLSideTray::postBuild() setMouseOpaque(false); return true; } - -/** - * add new panel to tab with tab_name name - * @param tab_name - name of sidebar tab to add new panel - * @param panel - pointer to panel - */ -bool LLSideTray::addPanel ( const std::string& tab_name - ,LLPanel* panel ) -{ - return false; -} -/** - * Add new tab to side bar - * @param tab_name - name of the new tab - * @param image - image for new sidebar button - * @param title - title for new tab - */ -bool LLSideTray::addTab ( const std::string& tab_name - ,const std::string& image - ,const std::string& title) -{ - LLSideTrayTab::Params params; - params.image_path = image; - params.tab_title = title; - LLSideTrayTab* tab = LLUICtrlFactory::create (params); - addChild(tab,1); - return true; -} - LLSideTrayTab* LLSideTray::getTab(const std::string& name) { @@ -358,7 +334,6 @@ LLSideTrayTab* LLSideTray::getTab(const std::string& name) } - void LLSideTray::toggleTabButton (LLSideTrayTab* tab) { if(tab == NULL) @@ -460,25 +435,30 @@ bool LLSideTray::addChild(LLView* view, S32 tab_group) void LLSideTray::createButtons () { - //create show/hide button - mCollapseButton = createButton(EXPANDED_NAME,"",boost::bind(&LLSideTray::onToggleCollapse, this)); - //create buttons for tabs child_vector_const_iter_t child_it = mTabs.begin(); - ++child_it; - for ( ; child_it != mTabs.end(); ++child_it) { LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); if(sidebar_tab == NULL) continue; - string name = sidebar_tab->getName(); + std::string name = sidebar_tab->getName(); - LLButton* button = createButton("",sidebar_tab->mImagePath,boost::bind(&LLSideTray::onTabButtonClick, this, sidebar_tab->getName())); - mTabButtons[sidebar_tab->getName()] = button; + // The "home" button will open/close the whole panel, this will need to + // change if the home screen becomes its own tab. + if (name == "sidebar_home") + { + mCollapseButton = createButton("",sidebar_tab->mImage, + boost::bind(&LLSideTray::onToggleCollapse, this)); + } + else + { + LLButton* button = createButton("",sidebar_tab->mImage, + boost::bind(&LLSideTray::onTabButtonClick, this, name)); + mTabButtons[name] = button; + } } - } void LLSideTray::onTabButtonClick(string name) @@ -581,25 +561,33 @@ void LLSideTray::arrange () } } -void LLSideTray::collapseSideBar () +void LLSideTray::collapseSideBar() { mCollapsed = true; - mCollapseButton->setLabel(COLLAPSED_NAME); + LLSideTrayTab* home_tab = getTab("sidebar_home"); + if (home_tab) + { + mCollapseButton->setImageOverlay( home_tab->mImage ); + } mActiveTab->setVisible(FALSE); reflectCollapseChange(); setFocus( FALSE ); } -void LLSideTray::expandSideBar () + +void LLSideTray::expandSideBar() { mCollapsed = false; - mCollapseButton->setLabel(EXPANDED_NAME); + LLSideTrayTab* home_tab = getTab("sidebar_home"); + if (home_tab) + { + mCollapseButton->setImageOverlay( home_tab->mImageSelected ); + } LLSD key;//empty mActiveTab->onOpen(key); mActiveTab->setVisible(TRUE); reflectCollapseChange(); - } void LLSideTray::highlightFocused() -- cgit v1.2.3 From 71822edfe824c5f7c742d6d9b8528f8ff541963b Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 23 Oct 2009 16:40:10 -0700 Subject: EXT-968 Side tray buttons have "selected" appearance when each tab is selected. Changed mTabs to hold LLSideTrayTab* so we don't have to dynamic_cast<> everywhere Reviewed with Leyla. --- indra/newview/llsidetray.cpp | 61 ++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 27 deletions(-) (limited to 'indra/newview/llsidetray.cpp') diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 22c3779050..a11ee05532 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -334,14 +334,19 @@ LLSideTrayTab* LLSideTray::getTab(const std::string& name) } -void LLSideTray::toggleTabButton (LLSideTrayTab* tab) +void LLSideTray::toggleTabButton(LLSideTrayTab* tab) { if(tab == NULL) return; - string name = tab->getName(); - std::map::iterator tIt = mTabButtons.find(name); - if(tIt!=mTabButtons.end()) - tIt->second->setToggleState(!tIt->second->getToggleState()); + 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); + btn->setImageOverlay( new_state ? tab->mImageSelected : tab->mImage ); + } } bool LLSideTray::selectTabByIndex(size_t index) @@ -349,9 +354,7 @@ bool LLSideTray::selectTabByIndex(size_t index) if(index>=mTabs.size()) return false; - LLSideTrayTab* sidebar_tab = dynamic_cast(mTabs[index]); - if(sidebar_tab == NULL) - return false; + LLSideTrayTab* sidebar_tab = mTabs[index]; return selectTabByName(sidebar_tab->getName()); } @@ -380,9 +383,7 @@ bool LLSideTray::selectTabByName (const std::string& name) child_vector_const_iter_t child_it; for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) { - LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); - if(sidebar_tab == NULL) - continue; + LLSideTrayTab* sidebar_tab = *child_it; sidebar_tab->setVisible(sidebar_tab == mActiveTab); } return true; @@ -439,9 +440,7 @@ void LLSideTray::createButtons () child_vector_const_iter_t child_it = mTabs.begin(); for ( ; child_it != mTabs.end(); ++child_it) { - LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); - if(sidebar_tab == NULL) - continue; + LLSideTrayTab* sidebar_tab = *child_it; std::string name = sidebar_tab->getName(); @@ -527,9 +526,7 @@ void LLSideTray::arrange () 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 = dynamic_cast(*child_it); - if(sidebar_tab == NULL) - continue; + LLSideTrayTab* sidebar_tab = *child_it; ctrl_rect.setLeftTopAndSize(0,getRect().getHeight()-offset ,sidetray_params.default_button_width @@ -552,10 +549,7 @@ void LLSideTray::arrange () //arrange tabs for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) { - LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); - if(sidebar_tab == NULL) - continue; - + LLSideTrayTab* sidebar_tab = *child_it; sidebar_tab->setRect(ctrl_rect); sidebar_tab->arrange(mMaxBarWidth,getRect().getHeight()); } @@ -564,6 +558,23 @@ void LLSideTray::arrange () 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 ); + } + } + + // Home tab doesn't put its button in mTabButtons LLSideTrayTab* home_tab = getTab("sidebar_home"); if (home_tab) { @@ -643,9 +654,7 @@ void LLSideTray::reshape (S32 width, S32 height, BOOL called_from_parent) 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 = dynamic_cast(*child_it); - if(sidebar_tab == NULL) - continue; + LLSideTrayTab* sidebar_tab = *child_it; ctrl_rect.setLeftTopAndSize(0,getRect().getHeight()-offset ,sidetray_params.default_button_width @@ -667,9 +676,7 @@ void LLSideTray::reshape (S32 width, S32 height, BOOL called_from_parent) for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) { - LLSideTrayTab* sidebar_tab = dynamic_cast(*child_it); - if(sidebar_tab == NULL) - continue; + LLSideTrayTab* sidebar_tab = *child_it; sidebar_tab->reshape(mMaxBarWidth,getRect().getHeight()); ctrl_rect.setLeftTopAndSize(sidetray_params.default_button_width,getRect().getHeight(),mMaxBarWidth,getRect().getHeight()); sidebar_tab->setRect(ctrl_rect); -- cgit v1.2.3