summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Yap <jhwelch@gmail.com>2014-11-28 10:00:41 -0500
committerJonathan Yap <jhwelch@gmail.com>2014-11-28 10:00:41 -0500
commitaf827615acc6cce0457ba00810136c41283f6158 (patch)
tree8edd97ee239f407151e8b8b8d9d44c64915f68fb
parentf30e518f1774cc3c1b4641e97c26afa496fb85e5 (diff)
STORM-2082 Initial support for presets popup from status bar
-rwxr-xr-xindra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llpanelpresetspulldown.cpp155
-rw-r--r--indra/newview/llpanelpresetspulldown.h57
-rw-r--r--indra/newview/llpresetsmanager.cpp15
-rw-r--r--indra/newview/llpresetsmanager.h1
-rwxr-xr-xindra/newview/llstatusbar.cpp32
-rwxr-xr-xindra/newview/llstatusbar.h5
-rw-r--r--indra/newview/skins/default/textures/icons/Presets_Icon.png (renamed from indra/newview/skins/default/textures/icons/FastPrefs_Icon.png)bin268 -> 268 bytes
-rwxr-xr-xindra/newview/skins/default/textures/textures.xml2
-rwxr-xr-xindra/newview/skins/default/xui/en/panel_preferences_graphics1.xml6
-rw-r--r--indra/newview/skins/default/xui/en/panel_presets_pulldown.xml40
-rwxr-xr-xindra/newview/skins/default/xui/en/panel_status_bar.xml7
12 files changed, 312 insertions, 10 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index e95cbf391d..e29506bdf5 100755
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -451,6 +451,7 @@ set(viewer_SOURCE_FILES
llpanelplaceprofile.cpp
llpanelplaces.cpp
llpanelplacestab.cpp
+ llpanelpresetspulldown.cpp
llpanelprimmediacontrols.cpp
llpanelprofile.cpp
llpanelsnapshot.cpp
@@ -1051,6 +1052,7 @@ set(viewer_HEADER_FILES
llpanelplaceprofile.h
llpanelplaces.h
llpanelplacestab.h
+ llpanelpresetspulldown.h
llpanelprimmediacontrols.h
llpanelprofile.h
llpanelsnapshot.h
diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp
new file mode 100644
index 0000000000..d93afd674c
--- /dev/null
+++ b/indra/newview/llpanelpresetspulldown.cpp
@@ -0,0 +1,155 @@
+/**
+ * @file llpanelpresetspulldown.cpp
+ * @author Tofu Linden
+ * @brief A panel showing a quick way to pick presets
+ *
+ * $LicenseInfo:firstyear=2008&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llpanelpresetspulldown.h"
+
+// Viewer libs
+#include "llviewercontrol.h"
+#include "llstatusbar.h"
+
+// Linden libs
+#include "llbutton.h"
+#include "lltabcontainer.h"
+#include "llfloaterreg.h"
+#include "llfloaterpreference.h"
+#include "llsliderctrl.h"
+
+/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseFadeStartTimeSec = 4.0f;
+/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseTotalTimeSec = 5.0f;
+
+///----------------------------------------------------------------------------
+/// Class LLPanelPresetsPulldown
+///----------------------------------------------------------------------------
+
+// Default constructor
+LLPanelPresetsPulldown::LLPanelPresetsPulldown()
+{
+ mHoverTimer.stop();
+
+ mCommitCallbackRegistrar.add("Presets.GoMoveViewPrefs", boost::bind(&LLPanelPresetsPulldown::onMoveViewButtonClick, this, _2));
+ mCommitCallbackRegistrar.add("Presets.GoGraphicsPrefs", boost::bind(&LLPanelPresetsPulldown::onGraphicsButtonClick, this, _2));
+ buildFromFile( "panel_presets_pulldown.xml");
+}
+
+BOOL LLPanelPresetsPulldown::postBuild()
+{
+ return LLPanel::postBuild();
+}
+
+/*virtual*/
+void LLPanelPresetsPulldown::onMouseEnter(S32 x, S32 y, MASK mask)
+{
+ mHoverTimer.stop();
+ LLPanel::onMouseEnter(x,y,mask);
+}
+
+/*virtual*/
+void LLPanelPresetsPulldown::onTopLost()
+{
+ setVisible(FALSE);
+}
+
+/*virtual*/
+void LLPanelPresetsPulldown::onMouseLeave(S32 x, S32 y, MASK mask)
+{
+ mHoverTimer.start();
+ LLPanel::onMouseLeave(x,y,mask);
+}
+
+/*virtual*/
+void LLPanelPresetsPulldown::onVisibilityChange ( BOOL new_visibility )
+{
+ if (new_visibility)
+ {
+ mHoverTimer.start(); // timer will be stopped when mouse hovers over panel
+ }
+ else
+ {
+ mHoverTimer.stop();
+
+ }
+}
+
+void LLPanelPresetsPulldown::onMoveViewButtonClick(const LLSD& user_data)
+{
+ // close the minicontrol, we're bringing up the big one
+ setVisible(FALSE);
+
+ // bring up the prefs floater
+ LLFloaterPreference* prefsfloater = dynamic_cast<LLFloaterPreference*>
+ (LLFloaterReg::showInstance("preferences"));
+ if (prefsfloater)
+ {
+ // grab the 'move' panel from the preferences floater and
+ // bring it the front!
+ LLTabContainer* tabcontainer = prefsfloater->getChild<LLTabContainer>("pref core");
+ LLPanel* movepanel = prefsfloater->getChild<LLPanel>("move");
+ if (tabcontainer && movepanel)
+ {
+ tabcontainer->selectTabPanel(movepanel);
+ }
+ }
+}
+
+void LLPanelPresetsPulldown::onGraphicsButtonClick(const LLSD& user_data)
+{
+ // close the minicontrol, we're bringing up the big one
+ setVisible(FALSE);
+
+ // bring up the prefs floater
+ LLFloaterPreference* prefsfloater = dynamic_cast<LLFloaterPreference*>
+ (LLFloaterReg::showInstance("preferences"));
+ if (prefsfloater)
+ {
+ // grab the 'graphics' panel from the preferences floater and
+ // bring it the front!
+ LLTabContainer* tabcontainer = prefsfloater->getChild<LLTabContainer>("pref core");
+ LLPanel* graphicspanel = prefsfloater->getChild<LLPanel>("display");
+ if (tabcontainer && graphicspanel)
+ {
+ tabcontainer->selectTabPanel(graphicspanel);
+ }
+ }
+}
+
+//virtual
+void LLPanelPresetsPulldown::draw()
+{
+ F32 alpha = mHoverTimer.getStarted()
+ ? clamp_rescale(mHoverTimer.getElapsedTimeF32(), sAutoCloseFadeStartTimeSec, sAutoCloseTotalTimeSec, 1.f, 0.f)
+ : 1.0f;
+ LLViewDrawContext context(alpha);
+
+ LLPanel::draw();
+
+ if (alpha == 0.f)
+ {
+ setVisible(FALSE);
+ }
+}
diff --git a/indra/newview/llpanelpresetspulldown.h b/indra/newview/llpanelpresetspulldown.h
new file mode 100644
index 0000000000..400dd73a4c
--- /dev/null
+++ b/indra/newview/llpanelpresetspulldown.h
@@ -0,0 +1,57 @@
+/**
+ * @file llpanelpresetspulldown.h
+ * @author Tofu Linden
+ * @brief A panel showing a quick way to pick presets
+ *
+ * $LicenseInfo:firstyear=2008&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLPANELPRESETSPULLDOWN_H
+#define LL_LLPANELPRESETSPULLDOWN_H
+
+#include "linden_common.h"
+
+#include "llpanel.h"
+
+class LLFrameTimer;
+
+class LLPanelPresetsPulldown : public LLPanel
+{
+ public:
+ LLPanelPresetsPulldown();
+ /*virtual*/ void draw();
+ /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask);
+ /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
+ /*virtual*/ void onTopLost();
+ /*virtual*/ void onVisibilityChange ( BOOL new_visibility );
+ /*virtual*/ BOOL postBuild();
+
+ private:
+ void onGraphicsButtonClick(const LLSD& user_data);
+ void onMoveViewButtonClick(const LLSD& user_data);
+
+ LLFrameTimer mHoverTimer;
+ static const F32 sAutoCloseFadeStartTimeSec;
+ static const F32 sAutoCloseTotalTimeSec;
+};
+
+#endif // LL_LLPANELPRESETSPULLDOWN_H
diff --git a/indra/newview/llpresetsmanager.cpp b/indra/newview/llpresetsmanager.cpp
index 8fd9024fef..642d9819fe 100644
--- a/indra/newview/llpresetsmanager.cpp
+++ b/indra/newview/llpresetsmanager.cpp
@@ -62,6 +62,11 @@ std::string LLPresetsManager::getUserDir(const std::string& subdirectory)
return full_path;
}
+std::string LLPresetsManager::getCameraPresetsDir()
+{
+ return getUserDir(PRESETS_CAMERA_DIR);
+}
+
std::string LLPresetsManager::getGraphicPresetsDir()
{
return getUserDir(PRESETS_GRAPHIC_DIR);
@@ -70,7 +75,6 @@ std::string LLPresetsManager::getGraphicPresetsDir()
void LLPresetsManager::getPresetNames(preset_name_list_t& presets) const
{
presets = mPresetNames;
-
}
void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir)
@@ -90,7 +94,14 @@ void LLPresetsManager::loadPresetNamesFromDir(const std::string& dir)
{
std::string path = gDirUtilp->add(dir, file);
std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true));
- mPresetNames.push_back(name);
+ if ("Default" != name)
+ {
+ mPresetNames.push_back(name);
+ }
+ else
+ {
+ mPresetNames.insert(mPresetNames.begin(), name);
+ }
}
}
}
diff --git a/indra/newview/llpresetsmanager.h b/indra/newview/llpresetsmanager.h
index 5bf85b835a..9b0de887ce 100644
--- a/indra/newview/llpresetsmanager.h
+++ b/indra/newview/llpresetsmanager.h
@@ -44,6 +44,7 @@ public:
void loadPresetNamesFromDir(const std::string& dir);
void savePreset(const std::string & name);
void loadPreset(const std::string & name);
+ static std::string getCameraPresetsDir();
static std::string getGraphicPresetsDir();
bool removeParamSet(const std::string& name, bool delete_from_disk);
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index eedb829b48..3c8dcaf4d4 100755
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -38,6 +38,7 @@
#include "llfloaterbuycurrency.h"
#include "llbuycurrencyhtml.h"
#include "llpanelnearbymedia.h"
+#include "llpanelpresetspulldown.h"
#include "llpanelvolumepulldown.h"
#include "llfloaterregioninfo.h"
#include "llfloaterscriptdebug.h"
@@ -175,6 +176,9 @@ BOOL LLStatusBar::postBuild()
mBtnStats = getChildView("stat_btn");
+ mIconPresets = getChild<LLIconCtrl>( "presets_icon" );
+ mIconPresets->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterPresets, this));
+
mBtnVolume = getChild<LLButton>( "volume_btn" );
mBtnVolume->setClickedCallback( onClickVolume, this );
mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this));
@@ -228,6 +232,11 @@ BOOL LLStatusBar::postBuild()
mSGPacketLoss = LLUICtrlFactory::create<LLStatGraph>(pgp);
addChild(mSGPacketLoss);
+ mPanelPresetsPulldown = new LLPanelPresetsPulldown();
+ addChild(mPanelPresetsPulldown);
+ mPanelPresetsPulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
+ mPanelPresetsPulldown->setVisible(FALSE);
+
mPanelVolumePulldown = new LLPanelVolumePulldown();
addChild(mPanelVolumePulldown);
mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
@@ -465,6 +474,27 @@ void LLStatusBar::onClickBuyCurrency()
LLFirstUse::receiveLindens(false);
}
+void LLStatusBar::onMouseEnterPresets()
+{
+ LLIconCtrl* icon = getChild<LLIconCtrl>( "presets_icon" );
+ LLRect btn_rect = icon->getRect();
+ LLRect pulldown_rect = mPanelPresetsPulldown->getRect();
+ pulldown_rect.setLeftTopAndSize(btn_rect.mLeft -
+ (pulldown_rect.getWidth() - btn_rect.getWidth()),
+ btn_rect.mBottom,
+ pulldown_rect.getWidth(),
+ pulldown_rect.getHeight());
+
+ mPanelPresetsPulldown->setShape(pulldown_rect);
+
+ // show the master presets pull-down
+ LLUI::clearPopups();
+ LLUI::addPopup(mPanelPresetsPulldown);
+ mPanelNearByMedia->setVisible(FALSE);
+ mPanelVolumePulldown->setVisible(FALSE);
+ mPanelPresetsPulldown->setVisible(TRUE);
+}
+
void LLStatusBar::onMouseEnterVolume()
{
LLButton* volbtn = getChild<LLButton>( "volume_btn" );
@@ -482,6 +512,7 @@ void LLStatusBar::onMouseEnterVolume()
// show the master volume pull-down
LLUI::clearPopups();
LLUI::addPopup(mPanelVolumePulldown);
+ mPanelPresetsPulldown->setVisible(FALSE);
mPanelNearByMedia->setVisible(FALSE);
mPanelVolumePulldown->setVisible(TRUE);
}
@@ -505,6 +536,7 @@ void LLStatusBar::onMouseEnterNearbyMedia()
LLUI::clearPopups();
LLUI::addPopup(mPanelNearByMedia);
+ mPanelPresetsPulldown->setVisible(FALSE);
mPanelVolumePulldown->setVisible(FALSE);
mPanelNearByMedia->setVisible(TRUE);
}
diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h
index 9d28e6c2bc..277f039f20 100755
--- a/indra/newview/llstatusbar.h
+++ b/indra/newview/llstatusbar.h
@@ -41,8 +41,10 @@ class LLUICtrl;
class LLUUID;
class LLFrameTimer;
class LLStatGraph;
+class LLPanelPresetsPulldown;
class LLPanelVolumePulldown;
class LLPanelNearByMedia;
+class LLIconCtrl;
class LLStatusBar
: public LLPanel
@@ -89,6 +91,7 @@ private:
void onClickBuyCurrency();
void onVolumeChanged(const LLSD& newvalue);
+ void onMouseEnterPresets();
void onMouseEnterVolume();
void onMouseEnterNearbyMedia();
void onClickScreen(S32 x, S32 y);
@@ -103,6 +106,7 @@ private:
LLStatGraph *mSGPacketLoss;
LLView *mBtnStats;
+ LLIconCtrl *mIconPresets;
LLButton *mBtnVolume;
LLTextBox *mBoxBalance;
LLButton *mMediaToggle;
@@ -115,6 +119,7 @@ private:
S32 mSquareMetersCommitted;
LLFrameTimer* mBalanceTimer;
LLFrameTimer* mHealthTimer;
+ LLPanelPresetsPulldown* mPanelPresetsPulldown;
LLPanelVolumePulldown* mPanelVolumePulldown;
LLPanelNearByMedia* mPanelNearByMedia;
};
diff --git a/indra/newview/skins/default/textures/icons/FastPrefs_Icon.png b/indra/newview/skins/default/textures/icons/Presets_Icon.png
index 380d3812d8..380d3812d8 100644
--- a/indra/newview/skins/default/textures/icons/FastPrefs_Icon.png
+++ b/indra/newview/skins/default/textures/icons/Presets_Icon.png
Binary files differ
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 2dbf9d1bab..feddb04a56 100755
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -204,7 +204,7 @@ with the same filename but different name
<texture name="Facebook_Icon" file_name="icons/Facebook.png" preload="false" />
- <texture name="FastPrefs_Icon" file_name="icons/FastPrefs_Icon.png" preload="true" />
+ <texture name="Presets_Icon" file_name="icons/Presets_Icon.png" preload="true" />
<texture name="Favorite_Star_Active" file_name="navbar/Favorite_Star_Active.png" preload="false" />
<texture name="Favorite_Star_Off" file_name="navbar/Favorite_Star_Off.png" preload="false" />
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
index 2cbba946d4..d8095c0476 100755
--- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
@@ -37,14 +37,14 @@
<button
follows="top|left"
height="23"
- label="Save As..."
+ label="Save..."
layout="topleft"
left_pad="5"
- name="PrefSaveAsButton"
+ name="PrefSaveButton"
top_delta="0"
width="115">
<button.commit_callback
- function="Pref.PrefSaveAs" />
+ function="Pref.PrefSave" />
</button>
<button
follows="top|left"
diff --git a/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml
new file mode 100644
index 0000000000..697bfd58e7
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_presets_pulldown.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+ background_opaque="true"
+ background_visible="true"
+ bg_opaque_image="Volume_Background"
+ bg_alpha_image="Volume_Background"
+ border_visible="false"
+ border="false"
+ chrome="true"
+ follows="bottom"
+ height="155"
+ layout="topleft"
+ name="presets_pulldown"
+ width="225">
+ <button
+ name="open_prefs_btn"
+ image_overlay="Icon_Gear_Foreground"
+ hover_glow_amount="0.15"
+ tool_tip = "Bring up graphics prefs"
+ top="5"
+ left="5"
+ height="20"
+ width="20">
+ <button.commit_callback
+ function="Presets.GoGraphicsPrefs" />
+ </button>
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="12"
+ layout="topleft"
+ top_delta="4"
+ left_delta="25"
+ font.style="BOLD"
+ name="Graphic Presets"
+ width="120">
+ Graphic Presets
+ </text>
+</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml
index a1f7503269..bb38c384a8 100755
--- a/indra/newview/skins/default/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml
@@ -105,14 +105,13 @@
width="145">
24:00 AM PST
</text>
- <button
+ <icon
follows="right|top"
height="16"
- image_unselected="FastPrefs_Icon"
- image_selected="FastPrefs_Icon"
+ image_name="Presets_Icon"
left_pad="5"
top="2"
- name="fastprefs_btn"
+ name="presets_icon"
width="18" />
<button
follows="right|top"