From af827615acc6cce0457ba00810136c41283f6158 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 28 Nov 2014 10:00:41 -0500 Subject: STORM-2082 Initial support for presets popup from status bar --- indra/newview/llpanelpresetspulldown.cpp | 155 +++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 indra/newview/llpanelpresetspulldown.cpp (limited to 'indra/newview/llpanelpresetspulldown.cpp') 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 + (LLFloaterReg::showInstance("preferences")); + if (prefsfloater) + { + // grab the 'move' panel from the preferences floater and + // bring it the front! + LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); + LLPanel* movepanel = prefsfloater->getChild("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 + (LLFloaterReg::showInstance("preferences")); + if (prefsfloater) + { + // grab the 'graphics' panel from the preferences floater and + // bring it the front! + LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); + LLPanel* graphicspanel = prefsfloater->getChild("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); + } +} -- cgit v1.2.3 From 34a79a6ece28fbc560bde907142ecaadf95e910f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 30 Nov 2014 07:15:00 -0500 Subject: STORM-2082 Implement delete floater --- indra/newview/llpanelpresetspulldown.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index d93afd674c..fc459a27e7 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -1,11 +1,10 @@ /** * @file llpanelpresetspulldown.cpp - * @author Tofu Linden * @brief A panel showing a quick way to pick presets * - * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * $LicenseInfo:firstyear=2014&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2014, 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 @@ -29,11 +28,9 @@ #include "llpanelpresetspulldown.h" -// Viewer libs #include "llviewercontrol.h" #include "llstatusbar.h" -// Linden libs #include "llbutton.h" #include "lltabcontainer.h" #include "llfloaterreg.h" @@ -102,8 +99,7 @@ void LLPanelPresetsPulldown::onMoveViewButtonClick(const LLSD& user_data) setVisible(FALSE); // bring up the prefs floater - LLFloaterPreference* prefsfloater = dynamic_cast - (LLFloaterReg::showInstance("preferences")); + LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences"); if (prefsfloater) { // grab the 'move' panel from the preferences floater and @@ -123,8 +119,7 @@ void LLPanelPresetsPulldown::onGraphicsButtonClick(const LLSD& user_data) setVisible(FALSE); // bring up the prefs floater - LLFloaterPreference* prefsfloater = dynamic_cast - (LLFloaterReg::showInstance("preferences")); + LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences"); if (prefsfloater) { // grab the 'graphics' panel from the preferences floater and -- cgit v1.2.3 From 7360f046634d013fec1e9b37c60840a83b470ce1 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 1 Dec 2014 15:36:59 -0500 Subject: STORM-2082 Better control on how (or if) to display Default preset Make sure default preset is created when flyout panel is activated Only display deleted notification upon successful deletion --- indra/newview/llpanelpresetspulldown.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index fc459a27e7..977e9ff5e2 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -35,6 +35,7 @@ #include "lltabcontainer.h" #include "llfloaterreg.h" #include "llfloaterpreference.h" +#include "llpresetsmanager.h" #include "llsliderctrl.h" /* static */ const F32 LLPanelPresetsPulldown::sAutoCloseFadeStartTimeSec = 4.0f; @@ -56,6 +57,9 @@ LLPanelPresetsPulldown::LLPanelPresetsPulldown() BOOL LLPanelPresetsPulldown::postBuild() { + // Make sure there is a default preference file + LLPresetsManager::getInstance()->createMissingDefault(); + return LLPanel::postBuild(); } -- cgit v1.2.3 From cc22efa4c0d6b06bac6f49b6243df7726f89c7c4 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 3 Dec 2014 06:35:46 -0500 Subject: STORM-2082 Remove Apply button. Add new control variable to track which preset is active. Save settings to active preset when clicking on Ok button. Initial work to make pulldown operational. Still to do: add pretty icon for current preset. Notifications do not appear when called from this panel. --- indra/newview/llpanelpresetspulldown.cpp | 65 +++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 13 deletions(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 977e9ff5e2..cd049712e1 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -37,6 +37,7 @@ #include "llfloaterpreference.h" #include "llpresetsmanager.h" #include "llsliderctrl.h" +#include "llscrolllistctrl.h" /* static */ const F32 LLPanelPresetsPulldown::sAutoCloseFadeStartTimeSec = 4.0f; /* static */ const F32 LLPanelPresetsPulldown::sAutoCloseTotalTimeSec = 5.0f; @@ -50,19 +51,53 @@ LLPanelPresetsPulldown::LLPanelPresetsPulldown() { mHoverTimer.stop(); - mCommitCallbackRegistrar.add("Presets.GoMoveViewPrefs", boost::bind(&LLPanelPresetsPulldown::onMoveViewButtonClick, this, _2)); mCommitCallbackRegistrar.add("Presets.GoGraphicsPrefs", boost::bind(&LLPanelPresetsPulldown::onGraphicsButtonClick, this, _2)); + mCommitCallbackRegistrar.add("Presets.RowClick", boost::bind(&LLPanelPresetsPulldown::onRowClick, this, _2)); + buildFromFile( "panel_presets_pulldown.xml"); } BOOL LLPanelPresetsPulldown::postBuild() { + LLPresetsManager::instance().setPresetListChangeCallback(boost::bind(&LLPanelPresetsPulldown::populatePanel, this)); // Make sure there is a default preference file LLPresetsManager::getInstance()->createMissingDefault(); + populatePanel(); + return LLPanel::postBuild(); } +void LLPanelPresetsPulldown::populatePanel() +{ + std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_GRAPHIC); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_POSITION_NORMAL); + + LLScrollListCtrl* scroll = getChild("preset_list"); + + if (scroll && mPresetNames.begin() != mPresetNames.end()) + { + scroll->clearRows(); + + for (std::list::const_iterator it = mPresetNames.begin(); it != mPresetNames.end(); ++it) + { + const std::string& name = *it; + + LLSD row; + row["columns"][0]["column"] = "preset_name"; + row["columns"][0]["value"] = name; + + if (name == gSavedSettings.getString("PresetGraphicActive")) + { + row["columns"][1]["column"] = "active_name"; + row["columns"][1]["value"] = "X"; + } + + scroll->addElement(row); + } + } +} + /*virtual*/ void LLPanelPresetsPulldown::onMouseEnter(S32 x, S32 y, MASK mask) { @@ -97,22 +132,26 @@ void LLPanelPresetsPulldown::onVisibilityChange ( BOOL new_visibility ) } } -void LLPanelPresetsPulldown::onMoveViewButtonClick(const LLSD& user_data) +void LLPanelPresetsPulldown::onRowClick(const LLSD& user_data) { - // close the minicontrol, we're bringing up the big one - setVisible(FALSE); + LLScrollListCtrl* scroll = getChild("preset_list"); - // bring up the prefs floater - LLFloater* prefsfloater = LLFloaterReg::showInstance("preferences"); - if (prefsfloater) + if (scroll) { - // grab the 'move' panel from the preferences floater and - // bring it the front! - LLTabContainer* tabcontainer = prefsfloater->getChild("pref core"); - LLPanel* movepanel = prefsfloater->getChild("move"); - if (tabcontainer && movepanel) + LLScrollListItem* item = scroll->getFirstSelected(); + if (item) { - tabcontainer->selectTabPanel(movepanel); + std::string name = item->getColumn(1)->getValue().asString(); + + LLPresetsManager::getInstance()->loadPreset(PRESETS_GRAPHIC, name); + LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); + if (instance) + { + instance->refreshEnabledGraphics(); + } + setVisible(FALSE); + // This line shouldn't be necessary but it is. + populatePanel(); } } } -- cgit v1.2.3 From afd12a6e784574e69ef3b3e7cac14573fe7c3197 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 3 Dec 2014 09:38:10 -0500 Subject: STORM-2082 Send signal to pulldown panel to refresh itself --- indra/newview/llpanelpresetspulldown.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index cd049712e1..093b5caad9 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -150,8 +150,6 @@ void LLPanelPresetsPulldown::onRowClick(const LLSD& user_data) instance->refreshEnabledGraphics(); } setVisible(FALSE); - // This line shouldn't be necessary but it is. - populatePanel(); } } } -- cgit v1.2.3 From 5be238b127ff30f09105ad6f0d9b8ee3dec8b40f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 4 Dec 2014 14:27:15 -0500 Subject: STORM-2082 Revert name of Reset button from Undo back to Reset. Hopefully this will be renamed Recommended Settings. Display a test icon (artwork needed) in the pulldown panel --- indra/newview/llpanelpresetspulldown.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 093b5caad9..1918623cab 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -89,8 +89,9 @@ void LLPanelPresetsPulldown::populatePanel() if (name == gSavedSettings.getString("PresetGraphicActive")) { - row["columns"][1]["column"] = "active_name"; - row["columns"][1]["value"] = "X"; + row["columns"][1]["column"] = "icon"; + row["columns"][1]["type"] = "icon"; + row["columns"][1]["value"] = "Inv_Landmark"; } scroll->addElement(row); -- cgit v1.2.3 From 8d12072979ee46a1eb2d13fdfef8bef62ff3f619 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 12 Dec 2014 11:13:11 -0500 Subject: STORM-2082 Merge Hardware floater into main graphics preferences display Change notifications so they are emitted only when an error occurs Put active preset at top of list Add Maximum ARC slider Merge two small methods into slider update code --- indra/newview/llpanelpresetspulldown.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 1918623cab..4756f3bd75 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -71,7 +71,7 @@ BOOL LLPanelPresetsPulldown::postBuild() void LLPanelPresetsPulldown::populatePanel() { std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_GRAPHIC); - LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_POSITION_NORMAL); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_SHOW); LLScrollListCtrl* scroll = getChild("preset_list"); -- cgit v1.2.3 From d1bc2fe292edcea60b49ce8111a495974e9415a2 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 14 Jan 2015 19:55:58 -0500 Subject: STORM-2082 Assorted UI tweaks, better MaximumARC formula, pulldowns disappear faster --- indra/newview/llpanelpresetspulldown.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 4756f3bd75..66f2f4c3f3 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -39,8 +39,8 @@ #include "llsliderctrl.h" #include "llscrolllistctrl.h" -/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseFadeStartTimeSec = 4.0f; -/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseTotalTimeSec = 5.0f; +/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseFadeStartTimeSec = 2.0f; +/* static */ const F32 LLPanelPresetsPulldown::sAutoCloseTotalTimeSec = 3.0f; ///---------------------------------------------------------------------------- /// Class LLPanelPresetsPulldown @@ -71,7 +71,7 @@ BOOL LLPanelPresetsPulldown::postBuild() void LLPanelPresetsPulldown::populatePanel() { std::string presets_dir = LLPresetsManager::getInstance()->getPresetsDir(PRESETS_GRAPHIC); - LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_SHOW); + LLPresetsManager::getInstance()->loadPresetNamesFromDir(presets_dir, mPresetNames, DEFAULT_TOP); LLScrollListCtrl* scroll = getChild("preset_list"); @@ -91,7 +91,7 @@ void LLPanelPresetsPulldown::populatePanel() { row["columns"][1]["column"] = "icon"; row["columns"][1]["type"] = "icon"; - row["columns"][1]["value"] = "Inv_Landmark"; + row["columns"][1]["value"] = "Checkbox_On"; } scroll->addElement(row); -- cgit v1.2.3 From ce324355787bd9c1c864050ca54b4306c30a0e79 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 15 Jan 2015 16:43:43 -0500 Subject: STORM-2082 Use correct icon for checkmark Redo UI layout to indicate the two dependencies on the Imposters checkbox Reverse the ARC slider --- indra/newview/llpanelpresetspulldown.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 66f2f4c3f3..2c5ae01b12 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -91,7 +91,7 @@ void LLPanelPresetsPulldown::populatePanel() { row["columns"][1]["column"] = "icon"; row["columns"][1]["type"] = "icon"; - row["columns"][1]["value"] = "Checkbox_On"; + row["columns"][1]["value"] = "Check_Mark"; } scroll->addElement(row); -- cgit v1.2.3 From 58577702a8c185683e089afc3f7fbcbaaf40122c Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 20 Jan 2015 18:24:02 -0500 Subject: STORM-2082 Finally(?) deal properly with dirty UI processing. Code cleanup, some per bitbucket comments. --- indra/newview/llpanelpresetspulldown.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'indra/newview/llpanelpresetspulldown.cpp') diff --git a/indra/newview/llpanelpresetspulldown.cpp b/indra/newview/llpanelpresetspulldown.cpp index 2c5ae01b12..ceff5a54e8 100644 --- a/indra/newview/llpanelpresetspulldown.cpp +++ b/indra/newview/llpanelpresetspulldown.cpp @@ -145,11 +145,7 @@ void LLPanelPresetsPulldown::onRowClick(const LLSD& user_data) std::string name = item->getColumn(1)->getValue().asString(); LLPresetsManager::getInstance()->loadPreset(PRESETS_GRAPHIC, name); - LLFloaterPreference* instance = LLFloaterReg::findTypedInstance("preferences"); - if (instance) - { - instance->refreshEnabledGraphics(); - } + setVisible(FALSE); } } -- cgit v1.2.3