From 65892a01cad5d22403f36a10187af40b37b48383 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Wed, 21 Sep 2011 19:31:07 -0700
Subject: [PATCH] EXP-1207 : More work on LLToolbarView, still not
 operational...

---
 indra/llui/lltoolbarview.cpp                  | 35 +++++++-----
 indra/newview/app_settings/settings.xml       |  2 +-
 indra/newview/llviewerwindow.cpp              | 11 +++-
 .../skins/default/xui/en/main_view.xml        | 44 +++------------
 .../default/xui/en/panel_toolbar_view.xml     | 55 +++++++++++++++++++
 5 files changed, 95 insertions(+), 52 deletions(-)
 create mode 100644 indra/newview/skins/default/xui/en/panel_toolbar_view.xml

diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp
index 40d1ac3418e..0e54c91ceaa 100644
--- a/indra/llui/lltoolbarview.cpp
+++ b/indra/llui/lltoolbarview.cpp
@@ -28,6 +28,7 @@
 #include "linden_common.h"
 
 #include "lltoolbarview.h"
+#include "lltoolbar.h"
 #include "llbutton.h"
 
 LLToolBarView* gToolBarView = NULL;
@@ -41,34 +42,40 @@ LLToolBarView::LLToolBarView(const Params& p)
 
 BOOL LLToolBarView::postBuild()
 {
-	LLButton* btn = getChild<LLButton>("color_pipette");
-	btn->setVisible(TRUE);
 	LLRect ctrl_rect = getRect();
+	LLButton* btn = getChild<LLButton>("test");
 	LLRect btn_rect = btn->getRect();
 	llinfos << "Merov debug : control rect = " << ctrl_rect.mLeft << ", " << ctrl_rect.mTop << ", " << ctrl_rect.mRight << ", " << ctrl_rect.mBottom << llendl; 
-	llinfos << "Merov debug : button rect = " << btn_rect.mLeft << ", " << btn_rect.mTop << ", " << btn_rect.mRight << ", " << btn_rect.mBottom << llendl; 
-	btn_rect.mLeft = 0;
-	btn_rect.mTop = ctrl_rect.getHeight();
-	btn_rect.mRight = 28;
-	btn_rect.mBottom = btn_rect.mTop - 28;
-	btn->setRect(btn_rect);
-	btn_rect = btn->getRect();
-	llinfos << "Merov debug : button rect = " << btn_rect.mLeft << ", " << btn_rect.mTop << ", " << btn_rect.mRight << ", " << btn_rect.mBottom << llendl; 
+	llinfos << "Merov debug : test    rect = " << btn_rect.mLeft << ", " << btn_rect.mTop << ", " << btn_rect.mRight << ", " << btn_rect.mBottom << llendl; 
 	return TRUE;
 }
 
 void LLToolBarView::draw()
 {
-	LLButton* btn = getChild<LLButton>("color_pipette");
-	btn->setVisible(TRUE);
 	static bool debug_print = true;
+
+	LLToolBar* toolbar_bottom = getChild<LLToolBar>("toolbar_bottom");
+	LLToolBar* toolbar_left = getChild<LLToolBar>("toolbar_left");
+	LLToolBar* toolbar_right = getChild<LLToolBar>("toolbar_right");
+	
+	LLRect bottom_rect = toolbar_bottom->getRect();
+	LLRect left_rect = toolbar_left->getRect();
+	LLRect right_rect = toolbar_right->getRect();
+	
 	if (debug_print)
 	{
 		LLRect ctrl_rect = getRect();
-		LLRect btn_rect = btn->getRect();
 		llinfos << "Merov debug : draw control rect = " << ctrl_rect.mLeft << ", " << ctrl_rect.mTop << ", " << ctrl_rect.mRight << ", " << ctrl_rect.mBottom << llendl; 
-		llinfos << "Merov debug : draw button rect = " << btn_rect.mLeft << ", " << btn_rect.mTop << ", " << btn_rect.mRight << ", " << btn_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; 
 		debug_print = false;
 	}
+	// Debug draw
+	gl_rect_2d(getLocalRect(), LLColor4::blue, TRUE);
+	gl_rect_2d(bottom_rect, LLColor4::red, TRUE);
+	gl_rect_2d(left_rect, LLColor4::green, TRUE);
+	gl_rect_2d(right_rect, LLColor4::yellow, TRUE);
+	
 	LLUICtrl::draw();
 }
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index cc9e17409f6..148b80e817c 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1858,7 +1858,7 @@
     <key>Type</key>
     <string>Boolean</string>
     <key>Value</key>
-    <integer>1</integer>
+    <integer>0</integer>
   </map>
     <key>Cursor3D</key>
     <map>
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 1055fd373b0..d197782eed1 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1783,10 +1783,17 @@ void LLViewerWindow::initBase()
 	// *TODO: Eventually, suppress the existence of this debug setting and turn toolbar FUI on permanently
 	if (gSavedSettings.getBOOL("DebugToolbarFUI"))
 	{
-		gToolBarView = main_view->getChild<LLToolBarView>("Toolbar View");
+		llinfos << "Merov debug : Creating the toolbar view" << llendl;
+		// Get a pointer to the toolbar view holder
+		LLPanel* panel_holder = main_view->getChild<LLPanel>("toolbar_view_holder");
+		llinfos << "Merov debug : panel_holder = " << panel_holder << llendl;
+		// Load the toolbar view from file 
+		gToolBarView = LLUICtrlFactory::getInstance()->createFromFile<LLToolBarView>("panel_toolbar_view.xml", NULL, LLPanel::child_registry_t::instance());
+		llinfos << "Merov debug : gToolBarView = " << gToolBarView << llendl;
+		// Attach it to the toolbar view holder
+		panel_holder->addChild(gToolBarView);
 	}
 
-	
 	// Constrain floaters to inside the menu and status bar regions.
 	gFloaterView = main_view->getChild<LLFloaterView>("Floater View");
 	gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle());
diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml
index 54badb13862..a21c988bb8f 100644
--- a/indra/newview/skins/default/xui/en/main_view.xml
+++ b/indra/newview/skins/default/xui/en/main_view.xml
@@ -162,41 +162,15 @@
                       top="0"
                       width="1024"/>
       </panel>
-	  
-      <panel follows="left|top"
-			layout="topleft"
-                    height="500"
-                    left="0"
-                    mouse_opaque="false"
-                    name="toolbar_view_holder"
-                    tab_stop="false"
-                    top="0"
-					visible="true"
-                    width="1024">
-        <toolbar_view follows="left|top"
-			layout="topleft"
-                      height="100"
-                      left="100"
-                      mouse_opaque="false"
-                      name="Toolbar View"
-                      tab_stop="false"
-                      top="100"
-					  visible="true"
-                      width="512">
-    <button
-     follows="left|top"
-     height="28"
-     image_selected="eye_button_active.tga"
-     image_unselected="eye_button_inactive.tga"
-     layout="topleft"
-			top="0"
-			left="0"
-     name="color_pipette"
-     width="28"
-	 visible="true" />
-					  </toolbar_view>
-      </panel>
-
+      <panel name="toolbar_view_holder"
+	    follows="all"
+		layout="topleft"
+        height="500"
+        width="1024"
+        top="0"
+        left="0"
+        mouse_opaque="false"
+        tab_stop="false"/>
     </layout_panel>
   </layout_stack>
   <panel mouse_opaque="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
new file mode 100644
index 00000000000..b58f8e837a7
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<ui_ctrl
+ follows="all"
+ layout="topleft"
+ name="toolbar view"
+ height="500"
+ width="1024"
+ 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" 
+  button_display_mode="icons_only"
+  side="left"
+  visible="true" />
+ <toolbar
+  follows="right|bottom|left"
+  layout="topleft"
+  name="toolbar_bottom"
+  height="30"
+  width="964"
+  left="30"
+  top="470" 
+  button_display_mode="icons_with_text"
+  side="bottom"
+  visible="true" />
+ <toolbar
+  follows="top|bottom|right"
+  layout="topleft"
+  name="toolbar_right"
+  height="500"
+  width="30"
+  left="994"
+  top="0" 
+  button_display_mode="icons_only"
+  side="right"
+  visible="true" />
+ <button
+  follows="none"
+  name="test"
+  layout="topleft"
+  top="100"
+  left="100"
+  height="28"
+  width="28"
+  image_selected="eye_button_active.tga"
+  image_unselected="eye_button_inactive.tga"
+  visible="true" />
+</ui_ctrl>
-- 
GitLab