From 874da4cde8914de81992505ade8bc7f106a6019a Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 24 Feb 2011 18:37:06 -0800
Subject: SOCIAL-551 WIP add buttons to open people and profile windows
 ShowSideTrayPanel action can now toggle undocked panels
 OpenSidePanelsInFloaters works now Clossing a sidepanel floater will not
 return contents to side tray close button enabled in minimal skin for side
 panel floaters

---
 indra/newview/llfloatersidetraytab.cpp             |   6 +
 indra/newview/llfloatersidetraytab.h               |   2 +
 indra/newview/llsidetray.cpp                       |  89 +++++++++--
 indra/newview/llsidetray.h                         |   6 +-
 indra/newview/llviewermenu.cpp                     |  19 ++-
 .../skins/minimal/xui/en/floater_web_content.xml   | 172 +++++++++++++++++++++
 6 files changed, 269 insertions(+), 25 deletions(-)
 create mode 100644 indra/newview/skins/minimal/xui/en/floater_web_content.xml

(limited to 'indra/newview')

diff --git a/indra/newview/llfloatersidetraytab.cpp b/indra/newview/llfloatersidetraytab.cpp
index f13b4db3a0..94407e6da0 100644
--- a/indra/newview/llfloatersidetraytab.cpp
+++ b/indra/newview/llfloatersidetraytab.cpp
@@ -30,6 +30,7 @@
 
 // newview includes
 #include "lltransientfloatermgr.h"
+#include "llsidetray.h"
 
 LLFloaterSideTrayTab::LLFloaterSideTrayTab(const LLSD& key, const Params& params)
 :	LLFloater(key, params)
@@ -43,3 +44,8 @@ LLFloaterSideTrayTab::~LLFloaterSideTrayTab()
 {
 	LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::GLOBAL, this);
 }
+
+void LLFloaterSideTrayTab::onClose(bool app_quitting)
+{
+	LLSideTray::getInstance()->setTabDocked(getName(), true);
+}
diff --git a/indra/newview/llfloatersidetraytab.h b/indra/newview/llfloatersidetraytab.h
index e47f82e8ba..89f2444a0e 100644
--- a/indra/newview/llfloatersidetraytab.h
+++ b/indra/newview/llfloatersidetraytab.h
@@ -42,6 +42,8 @@ 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/llsidetray.cpp b/indra/newview/llsidetray.cpp
index eb537c7d7b..1fc34bd681 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -629,8 +629,16 @@ LLPanel* LLSideTray::openChildPanel(LLSideTrayTab* tab, const std::string& panel
 
 	std::string tab_name = tab->getName();
 
+	bool tab_attached = isTabAttached(tab_name);
+
+	if (tab_attached && gSavedSettings.getBOOL("OpenSidePanelsInFloaters"))
+	{
+		tab->toggleTabDocked();
+		tab_attached = false;
+	}
+
 	// Select tab and expand Side Tray only when a tab is attached.
-	if (isTabAttached(tab_name))
+	if (tab_attached)
 	{
 		selectTabByName(tab_name);
 		if (mCollapsed)
@@ -641,14 +649,7 @@ LLPanel* LLSideTray::openChildPanel(LLSideTrayTab* tab, const std::string& panel
 		LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name);
 		if (!floater_tab) return NULL;
 
-		// Restore the floater if it was minimized.
-		if (floater_tab->isMinimized())
-		{
-			floater_tab->setMinimized(FALSE);
-		}
-
-		// Send the floater to the front.
-		floater_tab->setFrontmost();
+		floater_tab->openFloater(panel_name);
 	}
 
 	LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent());
@@ -1161,23 +1162,43 @@ void LLSideTray::reshape(S32 width, S32 height, BOOL called_from_parent)
  */
 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)
 	{
-		LLPanel* panel = openChildPanel(*child_it, panel_name, params);
-		if (panel) return panel;
-			}
+		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)
-			{
-		LLPanel* panel = openChildPanel(*child_it, panel_name, params);
-		if (panel) return panel;
+	{
+		new_panel = openChildPanel(*child_it, panel_name, params);
+		if (new_panel) break;
+	}
+
+	return new_panel;
+}
+
+void LLSideTray::hidePanel(const std::string& panel_name)
+{
+	LLPanel* panelp = getPanel(panel_name);
+	if (panelp)
+	{
+		if(isTabAttached(panel_name))
+		{
+			collapseSideBar();
+		}
+		else
+		{
+			LLFloaterReg::hideInstance("side_bar_tab", panel_name);
+		}
 	}
-	return NULL;
 }
 
+
 void LLSideTray::togglePanel(LLPanel* &sub_panel, const std::string& panel_name, const LLSD& params)
 {
 	if(!sub_panel)
@@ -1267,6 +1288,42 @@ bool		LLSideTray::isPanelActive(const std::string& panel_name)
 	return (panel->getName() == panel_name);
 }
 
+void LLSideTray::setTabDocked(const std::string& tab_name, bool dock)
+{
+	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;
+			}
+		}
+
+	}
+
+	if (tab)
+	{
+		bool tab_attached = isTabAttached(tab_name);
+		LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name);
+		if (!floater_tab) return;
+
+		if (dock && !tab_attached)
+		{
+			tab->dock(floater_tab);
+		}
+		else if (!dock && tab_attached)
+		{
+			tab->undock(floater_tab);
+		}
+	}
+}
+
+
 void	LLSideTray::updateSidetrayVisibility()
 {
 	// set visibility of parent container based on collapsed state
diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h
index 184d78845f..2516b5689f 100644
--- a/indra/newview/llsidetray.h
+++ b/indra/newview/llsidetray.h
@@ -97,6 +97,8 @@ public:
 	 */
 	LLPanel*	showPanel		(const std::string& panel_name, const LLSD& params = LLSD());
 
+	void		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,
@@ -112,6 +114,8 @@ public:
     LLPanel*	getActivePanel	();
     bool		isPanelActive	(const std::string& panel_name);
 
+	void		setTabDocked(const std::string& tab_name, bool dock);
+
 	/*
 	 * get the panel of given type T (don't show it or do anything else with it)
 	 */
@@ -215,7 +219,7 @@ private:
 		if (LLSideTray::instanceCreated())
 			LLSideTray::getInstance()->setEnabled(FALSE);
 	}
-	
+
 private:
 	LLPanel*						mButtonsPanel;
 	typedef std::map<std::string,LLButton*> button_map_t;
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index dd6b034dc8..02ef1e4e50 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -5651,15 +5651,18 @@ class LLShowSidetrayPanel : public view_listener_t
 	bool handleEvent(const LLSD& userdata)
 	{
 		std::string panel_name = userdata.asString();
-		// Toggle the panel
-		if (!LLSideTray::getInstance()->isPanelActive(panel_name))
-		{
-			// LLFloaterInventory::showAgentInventory();
-			LLSideTray::getInstance()->showPanel(panel_name, LLSD());
-		}
-		else
+
+		LLPanel* panel = LLSideTray::getInstance()->getPanel(panel_name);
+		if (panel)
 		{
-			LLSideTray::getInstance()->collapseSideBar();
+			if (panel->isInVisibleChain())
+			{
+				LLSideTray::getInstance()->hidePanel(panel_name);
+			}
+			else
+			{
+				LLSideTray::getInstance()->showPanel(panel_name);
+			}
 		}
 		return true;
 	}
diff --git a/indra/newview/skins/minimal/xui/en/floater_web_content.xml b/indra/newview/skins/minimal/xui/en/floater_web_content.xml
new file mode 100644
index 0000000000..4a13339ee4
--- /dev/null
+++ b/indra/newview/skins/minimal/xui/en/floater_web_content.xml
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+  legacy_header_height="18"
+  can_resize="true"
+  height="775"
+  layout="topleft"
+  min_height="400"
+  min_width="500"
+  name="floater_web_content"
+  help_topic="floater_web_content"
+  save_rect="true"
+  auto_tile="true"
+  title=""
+  initial_mime_type="text/html"
+  width="780">
+  <layout_stack
+    bottom="775"
+    follows="left|right|top|bottom"
+    layout="topleft"
+    left="5"
+    name="stack1"
+    orientation="vertical"
+    top="20"
+    width="770">
+    <layout_panel
+      auto_resize="false"
+      default_tab_group="1"
+      height="22"
+      layout="topleft"
+      left="0"
+      min_height="20"
+      name="nav_controls"
+      top="400"
+      user_resize="false"
+      width="770">
+      <button
+        image_overlay="Arrow_Left_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+		    hover_glow_amount="0.15"
+        tool_tip="Navigate back"
+        follows="left|top"
+        height="22"
+        layout="topleft"
+        left="1"
+        name="back"
+        top="0"
+        width="22">
+        <button.commit_callback
+          function="WebContent.Back" />
+      </button>
+      <button
+        image_overlay="Arrow_Right_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+        tool_tip="Navigate forward"
+        follows="left|top"
+        height="22"
+        layout="topleft"
+        left="27"
+        name="forward"
+        top_delta="0"
+        width="22">
+        <button.commit_callback
+          function="WebContent.Forward" />
+      </button>
+      <button
+        image_overlay="Stop_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+        tool_tip="Stop navigation"
+        enabled="true"
+        follows="left|top"
+        height="22"
+        layout="topleft"
+        left="51"
+        name="stop"
+        top_delta="0"
+        width="22">
+        <button.commit_callback
+          function="WebContent.Stop" />
+      </button>
+      <button
+        image_overlay="Refresh_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+        tool_tip="Reload page"
+        follows="left|top"
+        height="22"
+        layout="topleft"
+        left="51"
+        name="reload"
+        top_delta="0"
+        width="22">
+        <button.commit_callback
+          function="WebContent.Reload" />
+      </button>
+      <combo_box
+        allow_text_entry="true"
+        follows="left|top|right"
+        tab_group="1"
+        height="22"
+        layout="topleft"
+        left_pad="4"
+        max_chars="1024"
+        name="address"
+        combo_editor.select_on_focus="true"
+        tool_tip="Enter URL here"
+        top_delta="0"
+        width="672">
+        <combo_box.commit_callback
+          function="WebContent.EnterAddress" />
+      </combo_box>
+      <icon
+        name="media_secure_lock_flag"
+        height="16"
+        follows="top|right"
+        image_name="Lock2"
+        layout="topleft"
+        left_delta="620"
+        top_delta="2"
+        visible="false" 
+        tool_tip="Secured Browsing"
+        width="16" />
+    </layout_panel>
+    <layout_panel
+      height="40"
+      layout="topleft"
+      left_delta="0"
+      name="external_controls"
+      top_delta="0"
+      user_resize="false"
+      width="585">
+      <web_browser
+        bottom="-22"
+        follows="all"
+        layout="topleft"
+        left="0"
+        name="webbrowser"
+        top="0"/>
+      <text
+        type="string"
+        length="200"
+        follows="bottom|left"
+        height="20"
+        layout="topleft"
+        left_delta="0"
+        name="statusbartext"
+        parse_urls="false"
+        text_color="0.4 0.4 0.4 1"
+        top_pad="5"
+        width="495"/>
+      <progress_bar
+        color_bar="0.3 1.0 0.3 1"
+        follows="bottom|right"
+        height="16"
+        top_delta="-1"
+        left_pad="24"
+        layout="topleft"
+        name="statusbarprogress"
+        width="64"/>
+    </layout_panel>
+  </layout_stack>
+</floater>
-- 
cgit v1.2.3