diff options
| author | Richard Nelson <richard@lindenlab.com> | 2011-09-26 17:36:07 -0700 | 
|---|---|---|
| committer | Richard Nelson <richard@lindenlab.com> | 2011-09-26 17:36:07 -0700 | 
| commit | a465f816b8e7674aa3f22023d7708106ca35b350 (patch) | |
| tree | a9c767df415ba156b7528a27ffb06402002e08db | |
| parent | 16fead6429eba35bdfb8ef01610780a508e062df (diff) | |
EXP-1239 FIX make toolbars wrap when there is not enough room
toolbars resize to fit buttons
toolbar view uses layout stacks to organize toolbars
reviewed by Leslie
| -rw-r--r-- | indra/llui/llcommandmanager.cpp | 2 | ||||
| -rw-r--r-- | indra/llui/lldockcontrol.cpp | 3 | ||||
| -rw-r--r-- | indra/llui/lltoolbar.cpp | 27 | ||||
| -rw-r--r-- | indra/llui/lltoolbarview.cpp | 3 | ||||
| -rw-r--r-- | indra/newview/llviewerwindow.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_toolbar_view.xml | 146 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/widgets/toolbar.xml | 3 | 
7 files changed, 114 insertions, 71 deletions
| diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 6be616b980..071ab24cda 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -109,7 +109,7 @@ void LLCommandManager::addCommand(LLCommand * command)  	mCommandIndices[command->name()] = mCommands.size();  	mCommands.push_back(command); -	llinfos << "Successfully added command: " << command->name() << llendl; +	lldebugs << "Successfully added command: " << command->name() << llendl;  }  //static diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index b1c27126d9..6e39fcd714 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -97,6 +97,7 @@ void LLDockControl::getAllowedRect(LLRect& rect)  void LLDockControl::repositionDockable()  { +	if (!mDockWidget) return;  	LLRect dockRect = mDockWidget->calcScreenRect();  	LLRect rootRect;  	mGetAllowedRectCallback(rootRect); @@ -160,7 +161,7 @@ bool LLDockControl::isDockVisible()  			case TOP:  			{  				// check is dock inside parent rect -				// assume that parent for all dockable flaoters +				// assume that parent for all dockable floaters  				// is the root view  				LLRect dockParentRect =  						mDockWidget->getRootView()->calcScreenRect(); diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 31a18dc707..90ade136e8 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -122,6 +122,7 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p)  	centering_stack_p.rect = getLocalRect();  	centering_stack_p.follows.flags = FOLLOWS_ALL;  	centering_stack_p.orientation = orientation; +	centering_stack_p.mouse_opaque = false;  	mCenteringStack = LLUICtrlFactory::create<LLLayoutStack>(centering_stack_p);  	addChild(mCenteringStack); @@ -131,6 +132,7 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p)  	border_panel_p.rect = getLocalRect();  	border_panel_p.auto_resize = true;  	border_panel_p.user_resize = false; +	border_panel_p.mouse_opaque = false;  	mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p)); @@ -145,21 +147,7 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p)  	LLPanel::Params button_panel_p(p.button_panel);  	button_panel_p.rect = center_panel->getLocalRect(); -	switch(p.side()) -	{ -	case SIDE_LEFT: -		button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT; -		break; -	case SIDE_RIGHT: -		button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_RIGHT; -		break; -	case SIDE_TOP: -		button_panel_p.follows.flags = FOLLOWS_TOP|FOLLOWS_LEFT; -		break; -	case SIDE_BOTTOM: -		button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT; -		break; -	} +	button_panel_p.follows.flags = FOLLOWS_BOTTOM|FOLLOWS_LEFT;  	mButtonPanel = LLUICtrlFactory::create<LLPanel>(button_panel_p);  	center_panel->addChild(mButtonPanel); @@ -329,19 +317,22 @@ void LLToolBar::updateLayoutAsNeeded()  	{  		if (mSideType == SIDE_TOP)  		{ // shift down to maintain top edge -			mButtonPanel->translate(0, mButtonPanel->getRect().getHeight() - total_girth); +			translate(0, getRect().getHeight() - total_girth);  		} +		reshape(getRect().getWidth(), total_girth);  		mButtonPanel->reshape(max_row_length, total_girth);  	}  	else // VERTICAL  	{  		if (mSideType == SIDE_RIGHT)  		{ // shift left to maintain right edge -			mButtonPanel->translate(mButtonPanel->getRect().getWidth() - total_girth, 0); +			translate(getRect().getWidth() - total_girth, 0);  		} +		 +		reshape(total_girth, getRect().getHeight());  		mButtonPanel->reshape(total_girth, max_row_length); -		} +	}  	// re-center toolbar buttons  	mCenteringStack->updateLayout(); diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp index c99b573b35..27d67184d8 100644 --- a/indra/llui/lltoolbarview.cpp +++ b/indra/llui/lltoolbarview.cpp @@ -60,12 +60,10 @@ void LLToolBarView::draw()  	LLToolBar* toolbar_bottom = getChild<LLToolBar>("toolbar_bottom");  	LLToolBar* toolbar_left = getChild<LLToolBar>("toolbar_left");  	LLToolBar* toolbar_right = getChild<LLToolBar>("toolbar_right"); -	LLPanel* sizer_left = getChild<LLPanel>("sizer_left");  	LLRect bottom_rect = toolbar_bottom->getRect();  	LLRect left_rect = toolbar_left->getRect();  	LLRect right_rect = toolbar_right->getRect(); -	LLRect sizer_left_rect = sizer_left->getRect();  	if ((old_width != getRect().getWidth()) || (old_height != getRect().getHeight()))  		debug_print = true; @@ -76,7 +74,6 @@ void LLToolBarView::draw()  		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;  -		llinfos << "Merov debug : draw s left  rect = " << sizer_left_rect.mLeft << ", " << sizer_left_rect.mTop << ", " << sizer_left_rect.mRight << ", " << sizer_left_rect.mBottom << llendl;   		old_width = ctrl_rect.getWidth();  		old_height = ctrl_rect.getHeight();  		debug_print = false; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 947f0ec184..4a20be63f6 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1787,6 +1787,7 @@ void LLViewerWindow::initBase()  		LLPanel* panel_holder = main_view->getChild<LLPanel>("toolbar_view_holder");  		// Load the toolbar view from file   		gToolBarView = LLUICtrlFactory::getInstance()->createFromFile<LLToolBarView>("panel_toolbar_view.xml", panel_holder, LLDefaultChildRegistry::instance()); +		gToolBarView->setShape(panel_holder->getLocalRect());  		// Attach it to the toolbar view holder  		//panel_holder->addChild(gToolBarView);  	} 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 6701266887..b24f5c3347 100644 --- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml +++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml @@ -10,51 +10,103 @@   mouse_opaque="false"   tab_stop="false"   visible="true"> - <toolbar -  follows="top|bottom|left" -  layout="topleft" -  name="toolbar_left" -  height="500" -  width="30" -  left="0" -  top="0"  -  side="left" -  button_display_mode="icons_only" -  visible="true" /> - <toolbar -  follows="right|bottom|left" -  layout="topleft" -  name="toolbar_bottom" -  height="30" -  width="964" -  left="30" -  top="470"  -  side="bottom" -  button_display_mode="icons_with_text" -  visible="true" /> - <toolbar -  follows="top|bottom|right" -  layout="topleft" -  name="toolbar_right" -  height="500" -  width="30" -  left="994" -  top="0"  -  side="right" -  button_display_mode="icons_only" -  visible="true" /> - <panel -  follows="top|bottom|left" -  layout="topleft" -  name="sizer_left" -  height="500" -  width="30" -  left="0" -  top="0"  -  background_opaque="false" -  border_visible="false" -  background_visible="true" -  bg_opaque_image="Toast_Over" -  bg_alpha_image="Toast_Background" -  visible="true" /> +  <layout_stack name="bottom_toolbar_stack" +                orientation="vertical" +                left="0" +                top="0" +                width="1024" +                height="500" +                follows="all" +                mouse_opaque="false"> +  <layout_panel name="vertical_toolbar_panel" +                auto_resize="true" +                user_resize="false" +                width="1024" +                height="500" +                mouse_opaque="false"> +    <layout_stack name="vertical_toolbar_stack" +                  orientation="horizontal" +                  left="0" +                  top="0" +                  width="1024" +                  height="500" +                  follows="all" +                  mouse_opaque="false"> +      <layout_panel name="left_toolbar_panel" +                    fit_content="true" +                    auto_resize="false" +                    user_resize="false" +                    height="500" +                    width="30" +                    mouse_opaque="false"> +        <toolbar follows="left|top|bottom" +                 name="toolbar_left" +                 height="500" +                 width="30" +                 left="0" +                 top="0" +                 side="left" +                 button_display_mode="icons_only"> +          <button name="button1" label="Left Toolbar"/> +          <button name="button2" label="Left Toolbar"/> +          <button name="button3" label="Left Toolbar"/> +          <button name="button4" label="Left Toolbar"/> +          <button name="button5" label="Left Toolbar"/> +        </toolbar> +      </layout_panel> +      <layout_panel name="non_toolbar_panel" +                    auto_resize="true" +                    user_resize="false" +                    mouse_opaque="false"/> +      <layout_panel name="right_toolbar_panel" +                    fit_content="true" +                    auto_resize="false" +                    user_resize="false" +                    height="500" +                    width="30" +                    mouse_opaque="false"> +        <toolbar +          follows="right|top|bottom" +          name="toolbar_right" +          height="500" +          width="30" +          left="0" +          top="0" +          side="right" +          button_display_mode="icons_only"> +          <button name="button1" label="Right Toolbar"/> +          <button name="button2" label="Right Toolbar"/> +          <button name="button3" label="Right Toolbar"/> +          <button name="button4" label="Right Toolbar"/> +          <button name="button5" label="Right Toolbar"/> +        </toolbar> +      </layout_panel> +    </layout_stack> +  </layout_panel> +  <layout_panel name="bottom_toolbar_panel" +                fit_content="true" +                auto_resize="false" +                user_resize="false" +                height="30" +                width="1024" +                mouse_opaque="false"> +    <toolbar layout="topleft" +             name="toolbar_bottom" +             height="30" +             width="1024" +             left="0" +             top="0" +             side="bottom" +             follows="left|right|bottom" +             button_display_mode="icons_with_text" +             visible="true"> +      <button name="button1" label="Bottom toolbar"/> +      <button name="button2" label="Bottom toolbar"/> +      <button name="button3" label="Bottom toolbar"/> +      <button name="button4" label="Bottom toolbar"/> +      <button name="button5" label="Bottom toolbar"/> +      <button name="button6" label="Bottom toolbar"/> +    </toolbar> +  </layout_panel> +  </layout_stack>  </toolbar_view> diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml index 45210277b2..69fd6f569c 100644 --- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml +++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml @@ -4,7 +4,8 @@           pad_right="5"           pad_top="5"           pad_bottom="5" -         pad_between="5"> +         pad_between="5" +         mouse_opaque="false">    <button_panel name="button_panel"                  bg_opaque_image="Rounded_Rect" | 
