From 01b28ddf5ddc7118bc8b2047d899aee0293a8721 Mon Sep 17 00:00:00 2001
From: Richard Nelson <none@none>
Date: Wed, 6 Oct 2010 20:10:36 -0700
Subject: EXP-156 WIP Implement custom Skylight hints

---
 indra/newview/app_settings/ignorable_dialogs.xml   |  11 ++++
 indra/newview/app_settings/settings.xml            |   2 +-
 indra/newview/llbottomtray.cpp                     |   1 +
 indra/newview/llfirstuse.cpp                       |  11 +++-
 indra/newview/llfirstuse.h                         |   1 +
 indra/newview/llfloatercamera.cpp                  |   5 ++
 indra/newview/llhints.cpp                          |  15 ++++-
 indra/newview/llnearbychathandler.cpp              |  16 ++---
 indra/newview/llpanelplaces.cpp                    |   2 -
 indra/newview/llpopupview.cpp                      |  70 ++++++++++++++++-----
 indra/newview/llrootview.h                         |  22 -------
 indra/newview/llsidetray.cpp                       |   1 -
 indra/newview/lltransientfloatermgr.cpp            |   4 +-
 indra/newview/llviewermenu.cpp                     |   3 +-
 .../newview/skins/default/textures/arrow_keys.png  | Bin 0 -> 6558 bytes
 .../newview/skins/default/xui/en/notifications.xml |  16 +++++
 .../skins/default/xui/en/panel_hint_image.xml      |  39 ++++++++++++
 17 files changed, 163 insertions(+), 56 deletions(-)
 create mode 100644 indra/newview/skins/default/textures/arrow_keys.png
 create mode 100644 indra/newview/skins/default/xui/en/panel_hint_image.xml

diff --git a/indra/newview/app_settings/ignorable_dialogs.xml b/indra/newview/app_settings/ignorable_dialogs.xml
index 0720ccee49..f800d836fa 100644
--- a/indra/newview/app_settings/ignorable_dialogs.xml
+++ b/indra/newview/app_settings/ignorable_dialogs.xml
@@ -45,6 +45,17 @@
     <key>Value</key>
     <integer>1</integer>
   </map>
+  <key>FirstViewPopup</key>
+  <map>
+    <key>Comment</key>
+    <string>Shows hint when resident opens view popup</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>Boolean</string>
+    <key>Value</key>
+    <integer>1</integer>
+  </map>
   <key>FirstReceiveLindens</key>
   <map>
     <key>Comment</key>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 204097769a..d5cfc11c2c 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -12176,7 +12176,7 @@
       <key>Type</key>
       <string>F32</string>
       <key>Value</key>
-      <real>600.0</real>
+      <real>1200.0</real>
     </map>
     <key>SidePanelHintTimeout</key>
     <map>
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index e47009c540..d869850b7c 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -517,6 +517,7 @@ void LLBottomTray::toggleCameraControls()
 
 BOOL LLBottomTray::postBuild()
 {
+	LLHints::registerHintTarget("dest_guide_btn", getChild<LLUICtrl>("destinations_btn")->getHandle());
 
 	LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("NearbyChatBar.Action", boost::bind(&LLBottomTray::onContextMenuItemClicked, this, _2));
 	LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("NearbyChatBar.EnableMenuItem", boost::bind(&LLBottomTray::onContextMenuItemEnabled, this, _2));
diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp
index dd08706f4f..4d6302596b 100644
--- a/indra/newview/llfirstuse.cpp
+++ b/indra/newview/llfirstuse.cpp
@@ -100,7 +100,7 @@ void LLFirstUse::useSandbox()
 void LLFirstUse::notUsingDestinationGuide(bool enable)
 {
 	// not doing this yet
-	//firstUseNotification("FirstNotUseDestinationGuide", enable, "HintDestinationGuide", LLSD(), LLSD().with("target", "dest_guide_btn").with("direction", "left"));
+	firstUseNotification("FirstNotUseDestinationGuide", enable, "HintDestinationGuide", LLSD(), LLSD().with("target", "dest_guide_btn").with("direction", "top"));
 }
 
 // static
@@ -113,7 +113,14 @@ void LLFirstUse::notUsingSidePanel(bool enable)
 // static
 void LLFirstUse::notMoving(bool enable)
 {
-	firstUseNotification("FirstNotMoving", enable, "HintMove", LLSD(), LLSD().with("target", "move_btn").with("direction", "top"));
+	//firstUseNotification("FirstNotMoving", enable, "HintMove", LLSD(), LLSD().with("target", "move_btn").with("direction", "top"));
+	firstUseNotification("FirstNotMoving", enable, "HintMoveArrows", LLSD(), LLSD().with("hint_image", "arrow_keys.png"));
+}
+
+// static
+void LLFirstUse::viewPopup(bool enable)
+{
+	firstUseNotification("FirstViewPopup", enable, "HintView", LLSD(), LLSD().with("target", "view_popup").with("direction", "right"));
 }
 
 // static
diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h
index 275f134400..3886df4ee9 100644
--- a/indra/newview/llfirstuse.h
+++ b/indra/newview/llfirstuse.h
@@ -89,6 +89,7 @@ public:
 	static void notUsingDestinationGuide(bool enable = true);
 	static void notUsingSidePanel(bool enable = true);
 	static void notMoving(bool enable = true);
+	static void viewPopup(bool enable = true);
 	static void newInventory(bool enable = true);
 	static void receiveLindens(bool enable = true);
 	static void useSandbox();
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp
index b4e211a38e..be65396b0f 100644
--- a/indra/newview/llfloatercamera.cpp
+++ b/indra/newview/llfloatercamera.cpp
@@ -40,6 +40,8 @@
 #include "lltoolmgr.h"
 #include "lltoolfocus.h"
 #include "llslider.h"
+#include "llfirstuse.h"
+#include "llhints.h"
 
 static LLDefaultChildRegistry::Register<LLPanelCameraItem> r("panel_camera_item");
 
@@ -294,6 +296,8 @@ LLFloaterCamera* LLFloaterCamera::findInstance()
 
 void LLFloaterCamera::onOpen(const LLSD& key)
 {
+	LLFirstUse::viewPopup();
+
 	LLButton *anchor_panel = LLBottomTray::getInstance()->getChild<LLButton>("camera_btn");
 
 	setDockControl(new LLDockControl(
@@ -339,6 +343,7 @@ LLFloaterCamera::LLFloaterCamera(const LLSD& val)
 	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
 	registrar.add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraItem, _2));
 
+	LLHints::registerHintTarget("view_popup", LLView::getHandle());
 }
 
 // virtual
diff --git a/indra/newview/llhints.cpp b/indra/newview/llhints.cpp
index d837ed8205..5ffc4ace59 100644
--- a/indra/newview/llhints.cpp
+++ b/indra/newview/llhints.cpp
@@ -33,6 +33,7 @@
 #include "lltextbox.h"
 #include "llviewerwindow.h"
 #include "llviewercontrol.h"
+#include "lliconctrl.h"
 #include "llsdparam.h"
 
 class LLHintPopup : public LLPanel
@@ -80,7 +81,8 @@ public:
 										up_arrow,
 										right_arrow,
 										down_arrow,
-										lower_left_arrow;
+										lower_left_arrow,
+										hint_image;
 				
 		Optional<S32>					left_arrow_offset,
 										up_arrow_offset,
@@ -96,6 +98,7 @@ public:
 			right_arrow("right_arrow"),
 			down_arrow("down_arrow"),
 			lower_left_arrow("lower_left_arrow"),
+			hint_image("hint_image"),
 			left_arrow_offset("left_arrow_offset"),
 			up_arrow_offset("up_arrow_offset"),
 			right_arrow_offset("right_arrow_offset"),
@@ -159,7 +162,15 @@ LLHintPopup::LLHintPopup(const LLHintPopup::Params& p)
 		mDirection = p.target_params.direction;
 		mTarget = p.target_params.target;
 	}
-	buildFromFile( "panel_hint.xml", NULL, p);
+	if (p.hint_image.isProvided())
+	{
+		buildFromFile("panel_hint_image.xml", NULL, p);
+		getChild<LLIconCtrl>("hint_image")->setImage(p.hint_image());
+	}
+	else
+	{
+		buildFromFile( "panel_hint.xml", NULL, p);
+	}
 }
 
 BOOL LLHintPopup::postBuild()
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index adb79fd4fd..7ee9aac0de 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -471,6 +471,14 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args)
 	}
 
 	nearby_chat->addMessage(chat_msg, true, args);
+
+	if(chat_msg.mSourceType == CHAT_SOURCE_AGENT 
+		&& chat_msg.mFromID.notNull() 
+		&& chat_msg.mFromID != gAgentID)
+	{
+ 		LLFirstUse::otherAvatarChatFirst();
+	}
+
 	if( nearby_chat->getVisible()
 		|| ( chat_msg.mSourceType == CHAT_SOURCE_AGENT
 			&& gSavedSettings.getBOOL("UseChatBubbles") ) )
@@ -530,13 +538,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args)
 		notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ;
 		channel->addNotification(notification);	
 	}
-	
-	if(chat_msg.mSourceType == CHAT_SOURCE_AGENT 
-		&& chat_msg.mFromID.notNull() 
-		&& chat_msg.mFromID != gAgentID)
-	{
- 		LLFirstUse::otherAvatarChatFirst();
-	}
+
 }
 
 void LLNearbyChatHandler::onDeleteToast(LLToast* toast)
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index f0e60386b6..8884228f23 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -347,8 +347,6 @@ BOOL LLPanelPlaces::postBuild()
 
 void LLPanelPlaces::onOpen(const LLSD& key)
 {
-	LLFirstUse::notUsingDestinationGuide(false);
-
 	if (!mPlaceProfile || !mLandmarkInfo)
 		return;
 
diff --git a/indra/newview/llpopupview.cpp b/indra/newview/llpopupview.cpp
index 18035c42f4..9fbb67a63a 100644
--- a/indra/newview/llpopupview.cpp
+++ b/indra/newview/llpopupview.cpp
@@ -138,64 +138,102 @@ BOOL LLPopupView::handleMouseEvent(boost::function<BOOL(LLView*, S32, S32)> func
 
 BOOL LLPopupView::handleMouseDown(S32 x, S32 y, MASK mask)
 {
-	if (!handleMouseEvent(boost::bind(&LLMouseHandler::handleMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true))
+	BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true);
+	if (!handled)
 	{
-		return FALSE;
+		handled = LLPanel::handleMouseDown(x, y, mask);
 	}
-	return TRUE;
+	return handled;
 }
 
 BOOL LLPopupView::handleMouseUp(S32 x, S32 y, MASK mask)
 {
-	return handleMouseEvent(boost::bind(&LLMouseHandler::handleMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+	BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+	if (!handled)
+	{
+		handled = LLPanel::handleMouseUp(x, y, mask);
+	}
+	return handled;
 }
 
 BOOL LLPopupView::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
 {
-	if (!handleMouseEvent(boost::bind(&LLMouseHandler::handleMiddleMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true))
+	BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMiddleMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true);
+	if (!handled)
 	{
-		return FALSE;
+		handled = LLPanel::handleMiddleMouseDown(x, y, mask);
 	}
-	return TRUE;
+	return handled;	
 }
 
 BOOL LLPopupView::handleMiddleMouseUp(S32 x, S32 y, MASK mask)
 {
-	return handleMouseEvent(boost::bind(&LLMouseHandler::handleMiddleMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+	BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleMiddleMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+	if (!handled)
+	{
+		handled = LLPanel::handleMiddleMouseUp(x, y, mask);
+	}
+	return handled;	
 }
 
 BOOL LLPopupView::handleRightMouseDown(S32 x, S32 y, MASK mask)
 {
-	if (!handleMouseEvent(boost::bind(&LLMouseHandler::handleRightMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true))
+	BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleRightMouseDown, _1, _2, _3, mask), view_visible_and_enabled, x, y, true);
+	if (!handled)
 	{
-		return FALSE;
+		handled = LLPanel::handleRightMouseDown(x, y, mask);
 	}
-	return TRUE;
+	return handled;	
 }
 
 BOOL LLPopupView::handleRightMouseUp(S32 x, S32 y, MASK mask)
 {
-	return handleMouseEvent(boost::bind(&LLMouseHandler::handleRightMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+	BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleRightMouseUp, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+	if (!handled)
+	{
+		handled = LLPanel::handleRightMouseUp(x, y, mask);
+	}
+	return handled;	
 }
 
 BOOL LLPopupView::handleDoubleClick(S32 x, S32 y, MASK mask)
 {
-	return handleMouseEvent(boost::bind(&LLMouseHandler::handleDoubleClick, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+	BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleDoubleClick, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+	if (!handled)
+	{
+		handled = LLPanel::handleDoubleClick(x, y, mask);
+	}
+	return handled;	
 }
 
 BOOL LLPopupView::handleHover(S32 x, S32 y, MASK mask)
 {
-	return handleMouseEvent(boost::bind(&LLMouseHandler::handleHover, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+	BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleHover, _1, _2, _3, mask), view_visible_and_enabled, x, y, false);
+	if (!handled)
+	{
+		handled = LLPanel::handleHover(x, y, mask);
+	}
+	return handled;	
 }
 
 BOOL LLPopupView::handleScrollWheel(S32 x, S32 y, S32 clicks)
 {
-	return handleMouseEvent(boost::bind(&LLMouseHandler::handleScrollWheel, _1, _2, _3, clicks), view_visible_and_enabled, x, y, false);
+	BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleScrollWheel, _1, _2, _3, clicks), view_visible_and_enabled, x, y, false);
+	if (!handled)
+	{
+		handled = LLPanel::handleScrollWheel(x, y, clicks);
+	}
+	return handled;	
 }
 
 BOOL LLPopupView::handleToolTip(S32 x, S32 y, MASK mask)
 {
-	return handleMouseEvent(boost::bind(&LLMouseHandler::handleToolTip, _1, _2, _3, mask), view_visible, x, y, false);
+	BOOL handled = handleMouseEvent(boost::bind(&LLMouseHandler::handleToolTip, _1, _2, _3, mask), view_visible, x, y, false);
+	if (!handled)
+	{
+		handled = LLPanel::handleToolTip(x, y, mask);
+	}
+	return handled;
 }
 
 void LLPopupView::addPopup(LLView* popup)
diff --git a/indra/newview/llrootview.h b/indra/newview/llrootview.h
index 4b1ba15a0b..5223a314f3 100644
--- a/indra/newview/llrootview.h
+++ b/indra/newview/llrootview.h
@@ -42,27 +42,5 @@ public:
 	LLRootView(const Params& p)
 	:	LLView(p)
 	{}
-
-	// added to provide possibility to handle mouse click event inside all application
-	// window without creating any floater
-	typedef boost::signals2::signal<void(S32 x, S32 y, MASK mask)>
-			mouse_signal_t;
-
-	private:
-		mouse_signal_t mMouseDownSignal;
-
-	public:
-	/*virtual*/
-	BOOL handleMouseDown(S32 x, S32 y, MASK mask)
-	{
-		mMouseDownSignal(x, y, mask);
-		return LLView::handleMouseDown(x, y, mask);
-	}
-
-	boost::signals2::connection addMouseDownCallback(
-			const mouse_signal_t::slot_type& cb)
-	{
-		return mMouseDownSignal.connect(cb);
-	}
 };
 #endif //LL_LLROOTVIEW_H
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index 53d8a5c19e..9cb6df6c30 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -878,7 +878,6 @@ void	LLSideTray::createButtons	()
 		}
 	}
 	LLHints::registerHintTarget("inventory_btn", mTabButtons["sidebar_inventory"]->getHandle());
-	LLHints::registerHintTarget("dest_guide_btn", mTabButtons["sidebar_places"]->getHandle());
 }
 
 void		LLSideTray::processTriState ()
diff --git a/indra/newview/lltransientfloatermgr.cpp b/indra/newview/lltransientfloatermgr.cpp
index 78dd602f39..01e41925c9 100644
--- a/indra/newview/lltransientfloatermgr.cpp
+++ b/indra/newview/lltransientfloatermgr.cpp
@@ -36,8 +36,8 @@
 
 LLTransientFloaterMgr::LLTransientFloaterMgr()
 {
-	gViewerWindow->getRootView()->addMouseDownCallback(boost::bind(
-			&LLTransientFloaterMgr::leftMouseClickCallback, this, _1, _2, _3));
+	gViewerWindow->getRootView()->getChild<LLUICtrl>("popup_holder")->setMouseDownCallback(boost::bind(
+			&LLTransientFloaterMgr::leftMouseClickCallback, this, _2, _3, _4));
 
 	mGroupControls.insert(std::pair<ETransientGroup, std::set<LLView*> >(GLOBAL, std::set<LLView*>()));
 	mGroupControls.insert(std::pair<ETransientGroup, std::set<LLView*> >(DOCKED, std::set<LLView*>()));
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 0ff5181cc5..0454d4a249 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -44,7 +44,7 @@
 #include "llconsole.h"
 #include "lldebugview.h"
 #include "llfilepicker.h"
-//#include "llfirstuse.h"
+#include "llfirstuse.h"
 #include "llfloaterbuy.h"
 #include "llfloaterbuycontents.h"
 #include "llbuycurrencyhtml.h"
@@ -855,6 +855,7 @@ void LLDestinationGuideToggle()
 		}
 		else
 		{
+			LLFirstUse::notUsingDestinationGuide(false);
 			destination_guide->setVisible( true );
 		}
 	}
diff --git a/indra/newview/skins/default/textures/arrow_keys.png b/indra/newview/skins/default/textures/arrow_keys.png
new file mode 100644
index 0000000000..f19af59251
Binary files /dev/null and b/indra/newview/skins/default/textures/arrow_keys.png differ
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index cf5a6ad255..6db1ae9bc0 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -6463,6 +6463,22 @@ Mute everyone?
     To walk or run, open the Move Panel and use the directional arrows to navigate. You can also use the directional keys on your keyboard.
   </notification>
 
+  <notification
+  name="HintMoveArrows"
+  label="Move"
+  type="hint"
+  unique="true">
+    To walk, use the directional keys on your keyboard. You can run by pressing the Up arrow twice.
+  </notification>
+  
+  <notification
+  name="HintView"
+  label="View"
+  type="hint"
+  unique="true">
+    To change your camera view, use the Orbit and Pan controls below. Reset your view by pressing Escape or walking.
+  </notification>
+
   <notification
   name="HintInventory"
   label="Inventory"
diff --git a/indra/newview/skins/default/xui/en/panel_hint_image.xml b/indra/newview/skins/default/xui/en/panel_hint_image.xml
new file mode 100644
index 0000000000..31a310c07b
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_hint_image.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+ width="205"
+ height="200"
+ layout="topleft">
+  <text name="hint_title"
+        font="SansSerifMedium" 
+        left="8"
+        right="180"
+        top="8"
+        bottom="20"
+        follows="left|right|top"
+        text_color="Black"
+        wrap="false"/>
+  <icon name="hint_image"
+        left="42"
+        top="25"
+        width="115"
+        height="86"
+        image_name="arrow_keys.png"
+        />
+  <text name="hint_text"
+        left="8"
+        right="197"
+        top_pad="5"
+        bottom="92"
+        follows="all" 
+        text_color="Black"
+        wrap="true"/>
+  <button right="197" 
+          top="8"
+          width="16" 
+          height="16"
+          name="close" 
+          follows="right|top" 
+          image_color="DkGray" 
+          image_unselected="Icon_Close_Foreground"
+          image_selected="Icon_Close_Press"/>
+</panel>
-- 
cgit v1.2.3