diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llui/llaccordionctrl.cpp | 8 | ||||
| -rw-r--r-- | indra/llui/llaccordionctrltab.cpp | 293 | ||||
| -rw-r--r-- | indra/llui/llaccordionctrltab.h | 31 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml | 59 | 
4 files changed, 295 insertions, 96 deletions
| diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index aa69dfe0cc..2ed1082f56 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -103,13 +103,6 @@ void LLAccordionCtrl::draw()  	LLLocalClipRect clip(local_rect);  	LLPanel::draw(); -	/* -	S32 width = getRect().getWidth(); -	S32 height = getRect().getHeight(); - -	gl_rect_2d(0, 0 , width - 1 ,height - 1,LLColor4::green,true); -	gl_line_2d(0, 0 , width - 1 ,height - 1,LLColor4::black); -	*/  } @@ -125,7 +118,6 @@ BOOL LLAccordionCtrl::postBuild()  		scrollbar_size,  		getRect().getHeight() - 1); -  	LLScrollbar::Params sbparams;  	sbparams.name("scrollable vertical");  	sbparams.rect(scroll_rect); diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index b90ed25058..1067c3f1d5 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -33,8 +33,9 @@  #include "linden_common.h"  #include "lluictrl.h" - +#include "llscrollbar.h"  #include "llaccordionctrltab.h" +#include "lllocalcliprect.h"  #include "lltextbox.h" @@ -46,6 +47,8 @@ static const S32 HEADER_HEIGHT = 20;  static const S32 HEADER_IMAGE_LEFT_OFFSET = 5;  static const S32 HEADER_TEXT_LEFT_OFFSET = 30;  static const F32 AUTO_OPEN_TIME = 1.f; +static const S32 VERTICAL_MULTIPLE = 16; +static const S32 PARENT_BORDER_MARGIN = 5;  static LLDefaultChildRegistry::Register<LLAccordionCtrlTab> t1("accordion_tab"); @@ -277,6 +280,7 @@ LLAccordionCtrlTab::Params::Params()  	,header_image_pressed("header_image_pressed")  	,header_image_focused("header_image_focused")  	,header_text_color("header_text_color") +	,fit_panel("fit_panel",true)  {  	mouse_opaque(false);  } @@ -293,6 +297,9 @@ LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p)  	,mPaddingTop(p.padding_top)  	,mPaddingBottom(p.padding_bottom)  	,mCanOpenClose(true) +	,mFitPanel(p.fit_panel) +	,mContainerPanel(NULL) +	,mScrollbar(NULL)  {  	mStoredOpenCloseState = false;  	mWasStateStored = false; @@ -321,54 +328,42 @@ void LLAccordionCtrlTab::setDisplayChildren(bool display)  		mExpandedHeight : HEADER_HEIGHT);  	setRect(rect); -	for(child_list_const_iter_t it = getChildList()->begin(); -		getChildList()->end() != it; ++it) -	{ -		LLView* child = *it; -		if(DD_HEADER_NAME == child->getName()) -			continue; +	if(mContainerPanel) +		mContainerPanel->setVisible(getDisplayChildren()); -		child->setVisible(getDisplayChildren()); +	if(mDisplayChildren) +	{ +		adjustContainerPanel(); +	} +	else +	{ +		if(mScrollbar) +			mScrollbar->setVisible(false);  	} +  }  void LLAccordionCtrlTab::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */)  {  	LLRect headerRect; -	LLUICtrl::reshape(width, height, TRUE); -  	headerRect.setLeftTopAndSize(  		0,height,width,HEADER_HEIGHT);  	mHeader->setRect(headerRect);  	mHeader->reshape(headerRect.getWidth(), headerRect.getHeight()); -	for(child_list_const_iter_t it = getChildList()->begin();  -		getChildList()->end() != it; ++it) -	{ -		LLView* child = *it; -		if(DD_HEADER_NAME == child->getName()) -			continue; -		if(!child->getVisible()) -			continue; - -		LLRect childRect = child->getRect(); -		S32 childWidth = width - getPaddingLeft() - getPaddingRight(); -		S32 childHeight = height - getHeaderHeight() - getPaddingTop() - getPaddingBottom(); +	if(!mDisplayChildren) +		return; -		child->reshape(childWidth,childHeight); -		 -		childRect.setLeftTopAndSize( -			getPaddingLeft(), -			childHeight + getPaddingBottom(), -			childWidth,  -			childHeight); +	LLRect childRect; -		child->setRect(childRect); -		 -		break;//suppose that there is only one panel -	} +	childRect.setLeftTopAndSize( +		getPaddingLeft(), +		height - getHeaderHeight() - getPaddingTop(), +		width - getPaddingLeft() - getPaddingRight(),  +		height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() ); +	adjustContainerPanel(childRect);  }  void LLAccordionCtrlTab::changeOpenClose(bool is_open) @@ -439,7 +434,7 @@ void LLAccordionCtrlTab::setAccordionView(LLView* panel)  } -LLView*	LLAccordionCtrlTab::getAccordionView() +LLView*	LLAccordionCtrlTab::findContainerView()  {  	for(child_list_const_iter_t it = getChildList()->begin();   		getChildList()->end() != it; ++it) @@ -474,6 +469,43 @@ void LLAccordionCtrlTab::setHeaderVisible(bool value)  BOOL LLAccordionCtrlTab::postBuild()  {  	mHeader->setVisible(mHeaderVisible); +	 +	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); + +	LLRect scroll_rect; +	scroll_rect.setOriginAndSize(  +		getRect().getWidth() - scrollbar_size, +		1, +		scrollbar_size, +		getRect().getHeight() - 1); + +	mContainerPanel = findContainerView(); + +	if(!mFitPanel) +	{ +		LLScrollbar::Params sbparams; +		sbparams.name("scrollable vertical"); +		sbparams.rect(scroll_rect); +		sbparams.orientation(LLScrollbar::VERTICAL); +		sbparams.doc_size(getRect().getHeight()); +		sbparams.doc_pos(0); +		sbparams.page_size(getRect().getHeight()); +		sbparams.step_size(VERTICAL_MULTIPLE); +		sbparams.follows.flags(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM); +		sbparams.change_callback(boost::bind(&LLAccordionCtrlTab::onScrollPosChangeCallback, this, _1, _2)); + + +		mScrollbar = LLUICtrlFactory::create<LLScrollbar> (sbparams); +		LLView::addChild( mScrollbar ); +		mScrollbar->setFollowsRight(); +		mScrollbar->setFollowsTop(); +		mScrollbar->setFollowsBottom(); + +		mScrollbar->setVisible(false); +	} + +	mContainerPanel->setVisible(mDisplayChildren); +  	return LLUICtrl::postBuild();  }  bool	LLAccordionCtrlTab::notifyChildren	(const LLSD& info) @@ -628,6 +660,7 @@ void    LLAccordionCtrlTab::storeOpenCloseState()  	mStoredOpenCloseState = getDisplayChildren();  	mWasStateStored = true;  } +  void   LLAccordionCtrlTab::restoreOpenCloseState()  {  	if(!mWasStateStored) @@ -638,3 +671,195 @@ void   LLAccordionCtrlTab::restoreOpenCloseState()  	}  	mWasStateStored = false;  } + +void LLAccordionCtrlTab::adjustContainerPanel	() +{ +	S32 width = getRect().getWidth(); +	S32 height = getRect().getHeight(); + +	LLRect child_rect; +	child_rect.setLeftTopAndSize( +		getPaddingLeft(), +		height - getHeaderHeight() - getPaddingTop(), +		width - getPaddingLeft() - getPaddingRight(),  +		height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() ); + +	adjustContainerPanel(child_rect); +} + +void LLAccordionCtrlTab::adjustContainerPanel(const LLRect& child_rect) +{ +	if(!mContainerPanel) +		return;  + +	if(!mFitPanel) +	{ +		show_hide_scrollbar(child_rect); +		updateLayout(child_rect); +	} +	else +	{ +		mContainerPanel->reshape(child_rect.getWidth(),child_rect.getHeight()); +		mContainerPanel->setRect(child_rect); +	} +} + +S32 LLAccordionCtrlTab::getChildViewHeight() +{ +	if(!mContainerPanel) +		return 0; +	return mContainerPanel->getRect().getHeight(); +} + +void LLAccordionCtrlTab::show_hide_scrollbar(const LLRect& child_rect) +{ +	if(getChildViewHeight() > child_rect.getHeight() ) +		showScrollbar(child_rect); +	else +		hideScrollbar(child_rect); +} +void LLAccordionCtrlTab::showScrollbar(const LLRect& child_rect) +{ +	if(!mContainerPanel || !mScrollbar) +		return; +	bool was_visible = mScrollbar->getVisible(); +	mScrollbar->setVisible(true); +	 +	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); + +	{ +		ctrlSetLeftTopAndSize(mScrollbar,child_rect.getWidth()-scrollbar_size,  +			child_rect.getHeight()-PARENT_BORDER_MARGIN,  +			scrollbar_size,  +			child_rect.getHeight()-2*PARENT_BORDER_MARGIN); +	} + +	LLRect orig_rect = mContainerPanel->getRect(); + +	mScrollbar->setPageSize(child_rect.getHeight()); +	mScrollbar->setDocParams(orig_rect.getHeight(),mScrollbar->getDocPos()); +	 +	if(was_visible) +	{ +		S32 scroll_pos = llmin(mScrollbar->getDocPos(), orig_rect.getHeight() - child_rect.getHeight() - 1); +		mScrollbar->setDocPos(scroll_pos); +	} +	else//shrink child panel +	{ +		updateLayout(child_rect); +	} +	 +} + +void	LLAccordionCtrlTab::hideScrollbar( const LLRect& child_rect ) +{ +	if(!mContainerPanel || !mScrollbar) +		return; + +	if(mScrollbar->getVisible() == false) +		return; +	mScrollbar->setVisible(false); +	mScrollbar->setDocPos(0); + +	//shrink child panel +	updateLayout(child_rect); +} + +void	LLAccordionCtrlTab::onScrollPosChangeCallback(S32, LLScrollbar*) +{ +	LLRect child_rect; + +	S32 width = getRect().getWidth(); +	S32 height = getRect().getHeight(); + +	child_rect.setLeftTopAndSize( +		getPaddingLeft(), +		height - getHeaderHeight() - getPaddingTop(), +		width - getPaddingLeft() - getPaddingRight(),  +		height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() ); + +	updateLayout(child_rect); +} + +void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child) +{ +	if (child && child->getVisible() && child->getRect().isValid()) +	{ +		LLRect screen_rect; +		localRectToScreen(child->getRect(),&screen_rect); +		 +		if ( root_rect.overlaps(screen_rect)  && LLUI::sDirtyRect.overlaps(screen_rect)) +		{ +			glMatrixMode(GL_MODELVIEW); +			LLUI::pushMatrix(); +			{ +				LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom, 0.f); +				child->draw(); + +			} +			LLUI::popMatrix(); +		} +	} +} + +void LLAccordionCtrlTab::draw() +{ +	if(mFitPanel) +		LLUICtrl::draw(); +	else +	{ +		LLRect root_rect = getRootView()->getRect(); +		drawChild(root_rect,mHeader); +		drawChild(root_rect,mScrollbar ); +		{ +			LLRect child_rect; + +			S32 width = getRect().getWidth(); +			S32 height = getRect().getHeight(); + +			child_rect.setLeftTopAndSize( +				getPaddingLeft(), +				height - getHeaderHeight() - getPaddingTop(), +				width - getPaddingLeft() - getPaddingRight(),  +				height - getHeaderHeight() - getPaddingTop() - getPaddingBottom() ); + +			LLLocalClipRect clip(child_rect); +			drawChild(root_rect,mContainerPanel); +		} +		 + +		gGL.getTexUnit(0)->disable(); +	} +} + +void	LLAccordionCtrlTab::updateLayout	( const LLRect& child_rect ) +{ +	LLView*	child = getAccordionView(); +	if(!mContainerPanel) +		return; + +	S32 panel_top = child_rect.getHeight(); +	S32 panel_width = child_rect.getWidth(); + +	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); +	if(mScrollbar->getVisible() != false) +	{ +		panel_top+=mScrollbar->getDocPos(); +		panel_width-=scrollbar_size; +	} + +	//set sizes for first panels and dragbars +	LLRect panel_rect = child->getRect(); +	ctrlSetLeftTopAndSize(mContainerPanel,child_rect.mLeft,panel_top,panel_width,panel_rect.getHeight()); +} +void LLAccordionCtrlTab::ctrlSetLeftTopAndSize(LLView* panel, S32 left, S32 top, S32 width, S32 height) +{ +	if(!panel) +		return; +	LLRect panel_rect = panel->getRect(); +	panel_rect.setLeftTopAndSize( left, top, width, height); +	panel->reshape( width, height, 1); +	panel->setRect(panel_rect); +} + + diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index 2e0260ab16..462ccc6d53 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -41,6 +41,7 @@ class LLUICtrlFactory;  class LLUIImage;  class LLButton;  class LLTextBox; +class LLScrollbar; @@ -84,6 +85,8 @@ public:  		Optional<bool>			header_visible; +		Optional<bool>			fit_panel; +  		Optional<S32>			padding_left;  		Optional<S32>			padding_right;  		Optional<S32>			padding_top; @@ -107,7 +110,7 @@ public:  	//set LLAccordionCtrlTab panel  	void		setAccordionView(LLView* panel); -	LLView*		getAccordionView(); +	LLView*		getAccordionView() { return mContainerPanel; };  	bool getCollapsible() {return mCollapsible;}; @@ -123,6 +126,8 @@ public:  	S32 notify(const LLSD& info);  	bool notifyChildren(const LLSD& info); +	void draw(); +  	void    storeOpenCloseState		();  	void    restoreOpenCloseState	(); @@ -164,9 +169,26 @@ public:  	void showAndFocusHeader(); -private: +	void setFitPanel( bool fit ) { mFitPanel = true; } -	 +protected: +	void adjustContainerPanel	(const LLRect& child_rect); +	void adjustContainerPanel	(); +	S32	 getChildViewHeight		(); + +	void onScrollPosChangeCallback(S32, LLScrollbar*); + +	void show_hide_scrollbar	(const LLRect& child_rect); +	void showScrollbar			(const LLRect& child_rect); +	void hideScrollbar			(const LLRect& child_rect); + +	void updateLayout			( const LLRect& child_rect ); +	void ctrlSetLeftTopAndSize	(LLView* panel, S32 left, S32 top, S32 width, S32 height); + +	void drawChild(const LLRect& root_rect,LLView* child); + +	LLView* findContainerView	(); +private:  	class LLAccordionCtrlTabHeader;  	LLAccordionCtrlTabHeader* mHeader; //Header @@ -176,6 +198,7 @@ private:  	bool mHeaderVisible;  	bool mCanOpenClose; +	bool mFitPanel;  	S32	mPaddingLeft;  	S32	mPaddingRight; @@ -185,6 +208,8 @@ private:  	bool mStoredOpenCloseState;  	bool mWasStateStored; +	LLScrollbar*	mScrollbar; +	LLView*			mContainerPanel;  	LLUIColor mDropdownBGColor;  }; diff --git a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml index 4e57b428bd..5147bb72d0 100644 --- a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml +++ b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml @@ -100,17 +100,8 @@ background_visible="true"              expanded="true"              layout="topleft"              name="group_general_tab" -            title="General"> -               <scroll_container -                 color="DkGray2" -                 follows="all" -                 layout="topleft" -                 left="0" -                 name="profile_scroll" -                 opaque="true" -                 height="604" -                 width="304" -                 top="0"> +            title="General" +            fit_panel="false">                     <panel                        border="false"                        class="panel_group_general" @@ -121,24 +112,13 @@ background_visible="true"                        help_topic="group_general_tab"                        name="group_general_tab_panel"                        top="0" /> -			   </scroll_container>           </accordion_tab>           <accordion_tab              expanded="false"              layout="topleft"              name="group_roles_tab" -            title="Roles"> -               <scroll_container -                 color="DkGray2" -                 follows="all" -                 layout="topleft" -                 left="0" -                 name="profile_scroll" -                 opaque="true" -                 height="680" -                 width="304" -                 top="0"> - +            title="Roles" +            fit_panel="false">                  <panel                     border="false"                     class="panel_group_roles" @@ -148,24 +128,13 @@ background_visible="true"                     left="0"                     name="group_roles_tab_panel"                     top="0" /> -                </scroll_container>           </accordion_tab>           <accordion_tab              expanded="false"              layout="topleft"              name="group_notices_tab" -            title="Notices"> -               <scroll_container -                 color="DkGray2" -                 follows="all" -                 layout="topleft" -                 left="0" -                 name="profile_scroll" -                 opaque="true" -                 height="530" -                 width="304" -                 top="0"> - +            title="Notices" +            fit_panel="false">                  <panel                      border="false"                      class="panel_group_notices" @@ -176,24 +145,13 @@ background_visible="true"                      help_topic="group_notices_tab"                      name="group_notices_tab_panel"                      top="0" /> -               </scroll_container>           </accordion_tab>           <accordion_tab               expanded="false"               layout="topleft"               name="group_land_tab" -             title="Land/Assets"> -               <scroll_container -                 color="DkGray2" -                 follows="all" -                 layout="topleft" -                 left="0" -                 name="profile_scroll" -                 opaque="true" -                 height="500" -                 width="304" -                 top="0"> - +             title="Land/Assets" +             fit_panel="false">                   <panel  					 border="false"                       class="panel_group_land_money" @@ -203,7 +161,6 @@ background_visible="true"                       left="0"                       name="group_land_tab_panel"                       top="0" /> -               </scroll_container>           </accordion_tab>           </accordion>     </layout_panel> | 
