diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2009-12-30 13:49:17 -0800 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2009-12-30 13:49:17 -0800 |
commit | 6865d7e93c237cead70bd646d347b00cfd554f78 (patch) | |
tree | 9dd2dbb5c553198ac4182a48bbd0520029b48993 /indra/newview | |
parent | 5b7f71cd353799f405fe51d7b46c0a0296015cf2 (diff) | |
parent | 180ffcf263b81173ae7dcac0ce9abdb10c621e46 (diff) |
Merge
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 124 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.h | 4 | ||||
-rw-r--r-- | indra/newview/llfloaterwindowsize.cpp | 164 | ||||
-rw-r--r-- | indra/newview/llfloaterwindowsize.h | 41 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_window_size.xml | 64 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_login.xml | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 7 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_advanced.xml | 4 |
10 files changed, 290 insertions, 129 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index a26aae3590..254a44287f 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -219,6 +219,7 @@ set(viewer_SOURCE_FILES llfloaterwater.cpp llfloaterwhitelistentry.cpp llfloaterwindlight.cpp + llfloaterwindowsize.cpp llfloaterworldmap.cpp llfolderview.cpp llfolderviewitem.cpp @@ -728,6 +729,7 @@ set(viewer_HEADER_FILES llfloaterwater.h llfloaterwhitelistentry.h llfloaterwindlight.h + llfloaterwindowsize.h llfloaterworldmap.h llfolderview.h llfoldervieweventlistener.h diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 7e0e8bfaa7..11dd48056c 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -103,15 +103,10 @@ #include "llworld.h" #include "pipeline.h" #include "lluictrlfactory.h" -#include "llboost.h" #include "llviewermedia.h" #include "llpluginclassmedia.h" #include "llteleporthistorystorage.h" -#include <boost/regex.hpp> - -//RN temporary includes for resolution switching -#include "llglheaders.h" const F32 MAX_USER_FAR_CLIP = 512.f; const F32 MIN_USER_FAR_CLIP = 64.f; @@ -193,7 +188,6 @@ bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater); bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater); -bool extractWindowSizeFromString(const std::string& instr, U32 &width, U32 &height); void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator); viewer_media_t get_web_media() @@ -273,23 +267,6 @@ bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFl } -// Extract from strings of the form "<width> x <height>", e.g. "640 x 480". -bool extractWindowSizeFromString(const std::string& instr, U32 &width, U32 &height) -{ - using namespace boost; - cmatch what; - const regex expression("([0-9]+) x ([0-9]+)"); - if (regex_match(instr.c_str(), what, expression)) - { - width = atoi(what[1].first); - height = atoi(what[2].first); - return true; - } - - width = height = 0; - return false; -} - void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator) { numerator = 0; @@ -499,13 +476,6 @@ void LLFloaterPreference::apply() } applyResolution(); - - // Only set window size if we're not in fullscreen mode - if(!gSavedSettings.getBOOL("WindowFullScreen")) - { - applyWindowSize(); - } - } void LLFloaterPreference::cancel() @@ -1264,20 +1234,6 @@ void LLFloaterPreference::onKeystrokeAspectRatio() getChild<LLCheckBoxCtrl>("aspect_auto_detect")->set(FALSE); } -void LLFloaterPreference::applyWindowSize() -{ - LLComboBox* ctrl_windowSize = getChild<LLComboBox>("windowsize combo"); - if (ctrl_windowSize->getVisible() && (ctrl_windowSize->getCurrentIndex() != -1)) - { - U32 width = 0; - U32 height = 0; - if (extractWindowSizeFromString(ctrl_windowSize->getValue().asString().c_str(), width,height)) - { - LLViewerWindow::movieSize(width, height); - } - } -} - void LLFloaterPreference::applyResolution() { LLComboBox* ctrl_aspect_ratio = getChild<LLComboBox>( "aspect_ratio"); @@ -1345,36 +1301,7 @@ void LLFloaterPreference::applyResolution() refresh(); } -void LLFloaterPreference::initWindowSizeControls(LLPanel* panelp) -{ - // Window size - // mWindowSizeLabel = getChild<LLTextBox>("WindowSizeLabel"); - LLComboBox* ctrl_window_size = panelp->getChild<LLComboBox>("windowsize combo"); - - // Look to see if current window size matches existing window sizes, if so then - // just set the selection value... - const U32 height = gViewerWindow->getWindowHeightRaw(); - const U32 width = gViewerWindow->getWindowWidthRaw(); - for (S32 i=0; i < ctrl_window_size->getItemCount(); i++) - { - U32 height_test = 0; - U32 width_test = 0; - ctrl_window_size->setCurrentByIndex(i); - if (extractWindowSizeFromString(ctrl_window_size->getValue().asString(), width_test, height_test)) - { - if ((height_test == height) && (width_test == width)) - { - return; - } - } - } - // ...otherwise, add a new entry with the current window height/width. - LLUIString resolution_label = panelp->getString("resolution_format"); - resolution_label.setArg("[RES_X]", llformat("%d", width)); - resolution_label.setArg("[RES_Y]", llformat("%d", height)); - ctrl_window_size->add(resolution_label, ADD_TOP); - ctrl_window_size->setCurrentByIndex(0); -} + void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param) @@ -1433,53 +1360,8 @@ BOOL LLPanelPreference::postBuild() if(hasChild("aspect_ratio")) { - //============================================================================ - // Resolution -/* - S32 num_resolutions = 0; - LLWindow::LLWindowResolution* supported_resolutions = gViewerWindow->getWindow()->getSupportedResolutions(num_resolutions); - - S32 fullscreen_mode = num_resolutions - 1; - - LLComboBox*ctrl_full_screen = getChild<LLComboBox>( "fullscreen combo"); - LLUIString resolution_label = getString("resolution_format"); - - for (S32 i = 0; i < num_resolutions; i++) - { - resolution_label.setArg("[RES_X]", llformat("%d", supported_resolutions[i].mWidth)); - resolution_label.setArg("[RES_Y]", llformat("%d", supported_resolutions[i].mHeight)); - ctrl_full_screen->add( resolution_label, ADD_BOTTOM ); - } - - { - BOOL targetFullscreen; - S32 targetWidth; - S32 targetHeight; - - gViewerWindow->getTargetWindow(targetFullscreen, targetWidth, targetHeight); - - if (targetFullscreen) - { - fullscreen_mode = 0; // default to 800x600 - for (S32 i = 0; i < num_resolutions; i++) - { - if (targetWidth == supported_resolutions[i].mWidth - && targetHeight == supported_resolutions[i].mHeight) - { - fullscreen_mode = i; - } - } - ctrl_full_screen->setCurrentByIndex(fullscreen_mode); - } - else - { - // set to windowed mode - //fullscreen_mode = mCtrlFullScreen->getItemCount() - 1; - ctrl_full_screen->setCurrentByIndex(0); - } - } - */ - LLFloaterPreference::initWindowSizeControls(this); + // We used to set up fullscreen resolution and window size + // controls here, see LLFloaterWindowSize::initWindowSizeControls() if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio")) { diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 94108cb79a..74a53d673c 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -130,16 +130,12 @@ public: void onUpdateSliderText(LLUICtrl* ctrl, const LLSD& name); void onKeystrokeAspectRatio(); // void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator); -// bool extractWindowSizeFromString(const std::string& instr, U32 &width, U32 &height); void onCommitAutoDetectAspect(); void applyResolution(); - void applyWindowSize(); void applyUIColor(LLUICtrl* ctrl, const LLSD& param); void getUIColor(LLUICtrl* ctrl, const LLSD& param); - static void initWindowSizeControls(LLPanel* panelp); - void buildPopupLists(); static void refreshSkin(void* data); static void cleanupBadSetting(); diff --git a/indra/newview/llfloaterwindowsize.cpp b/indra/newview/llfloaterwindowsize.cpp new file mode 100644 index 0000000000..5519be6f08 --- /dev/null +++ b/indra/newview/llfloaterwindowsize.cpp @@ -0,0 +1,164 @@ +/** + * @file llfloaterwindowsize.cpp + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterwindowsize.h" + +// Viewer includes +#include "llviewerwindow.h" + +// Linden library includes +#include "llcombobox.h" +#include "llfloater.h" +#include "llfloaterreg.h" +#include "lluictrl.h" + +// System libraries +#include <boost/regex.hpp> + +// Extract from strings of the form "<width> x <height>", e.g. "640 x 480". +bool extractWindowSizeFromString(const std::string& instr, U32 *width, U32 *height) +{ + boost::cmatch what; + // matches (any number)(any non-number)(any number) + const boost::regex expression("([0-9]+)[^0-9]+([0-9]+)"); + if (boost::regex_match(instr.c_str(), what, expression)) + { + *width = atoi(what[1].first); + *height = atoi(what[2].first); + return true; + } + + *width = 0; + *height = 0; + return false; +} + + +///---------------------------------------------------------------------------- +/// Class LLFloaterWindowSize +///---------------------------------------------------------------------------- +class LLFloaterWindowSize +: public LLFloater +{ + friend class LLFloaterReg; +private: + LLFloaterWindowSize(const LLSD& key); + virtual ~LLFloaterWindowSize(); + +public: + /*virtual*/ BOOL postBuild(); + void initWindowSizeControls(); + void onClickSet(); + void onClickCancel(); +}; + + +LLFloaterWindowSize::LLFloaterWindowSize(const LLSD& key) +: LLFloater(key) +{ + //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_window_size.xml"); +} + +LLFloaterWindowSize::~LLFloaterWindowSize() +{ +} + +BOOL LLFloaterWindowSize::postBuild() +{ + center(); + initWindowSizeControls(); + getChild<LLUICtrl>("set_btn")->setCommitCallback( + boost::bind(&LLFloaterWindowSize::onClickSet, this)); + getChild<LLUICtrl>("cancel_btn")->setCommitCallback( + boost::bind(&LLFloaterWindowSize::onClickCancel, this)); + setDefaultBtn("set_btn"); + return TRUE; +} + +void LLFloaterWindowSize::initWindowSizeControls() +{ + LLComboBox* ctrl_window_size = getChild<LLComboBox>("window_size_combo"); + + // Look to see if current window size matches existing window sizes, if so then + // just set the selection value... + const U32 height = gViewerWindow->getWindowHeightRaw(); + const U32 width = gViewerWindow->getWindowWidthRaw(); + for (S32 i=0; i < ctrl_window_size->getItemCount(); i++) + { + U32 height_test = 0; + U32 width_test = 0; + ctrl_window_size->setCurrentByIndex(i); + std::string resolution = ctrl_window_size->getValue().asString(); + if (extractWindowSizeFromString(resolution, &width_test, &height_test)) + { + if ((height_test == height) && (width_test == width)) + { + return; + } + } + } + // ...otherwise, add a new entry with the current window height/width. + LLUIString resolution_label = getString("resolution_format"); + resolution_label.setArg("[RES_X]", llformat("%d", width)); + resolution_label.setArg("[RES_Y]", llformat("%d", height)); + ctrl_window_size->add(resolution_label, ADD_TOP); + ctrl_window_size->setCurrentByIndex(0); +} + +void LLFloaterWindowSize::onClickSet() +{ + LLComboBox* ctrl_window_size = getChild<LLComboBox>("window_size_combo"); + U32 width = 0; + U32 height = 0; + std::string resolution = ctrl_window_size->getValue().asString(); + if (extractWindowSizeFromString(resolution, &width, &height)) + { + LLViewerWindow::movieSize(width, height); + } + closeFloater(); +} + +void LLFloaterWindowSize::onClickCancel() +{ + closeFloater(); +} + +///---------------------------------------------------------------------------- +/// LLFloaterWindowSizeUtil +///---------------------------------------------------------------------------- +void LLFloaterWindowSizeUtil::registerFloater() +{ + LLFloaterReg::add("window_size", "floater_window_size.xml", + &LLFloaterReg::build<LLFloaterWindowSize>); + +} diff --git a/indra/newview/llfloaterwindowsize.h b/indra/newview/llfloaterwindowsize.h new file mode 100644 index 0000000000..fd9d17323a --- /dev/null +++ b/indra/newview/llfloaterwindowsize.h @@ -0,0 +1,41 @@ +/** + * @file llfloaterwindowsize.h + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LLFLOATERWINDOWSIZE_H +#define LLFLOATERWINDOWSIZE_H + +// Allow user to set the window size for filming tutorials, machinima, etc +namespace LLFloaterWindowSizeUtil +{ + void registerFloater(); +} + +#endif diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 00db11a767..5e624eeec7 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -111,6 +111,7 @@ #include "llfloaterwater.h" #include "llfloaterwhitelistentry.h" #include "llfloaterwindlight.h" +#include "llfloaterwindowsize.h" #include "llfloaterworldmap.h" #include "llimfloatercontainer.h" #include "llinspectavatar.h" @@ -260,6 +261,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("voice_controls", "floater_voice_controls.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLCallFloater>); LLFloaterReg::add("whitelist_entry", "floater_whitelist_entry.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWhiteListEntry>); + LLFloaterWindowSizeUtil::registerFloater(); LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWorldMap>); // *NOTE: Please keep these alphabetized for easier merges diff --git a/indra/newview/skins/default/xui/en/floater_window_size.xml b/indra/newview/skins/default/xui/en/floater_window_size.xml new file mode 100644 index 0000000000..355d257785 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_window_size.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + can_minimize="false" + can_resize="false" + height="105" + layout="topleft" + name="window_size" + title="WINDOW SIZE" + width="205"> + <string name="resolution_format">[RES_X] x [RES_Y]</string> + <text + follows="top|left" + font="SansSerif" + height="16" + left="15" + top="10" + name="windowsize_text" + width="280"> + Set window size: + </text> + <combo_box + allow_text_entry="true" + height="23" + follows="left|top" + left_delta="0" + max_chars="20" + name="window_size_combo" + tool_tip="width x height" + top_pad="5" + width="179"> + <combo_box.item + label="1000 x 700 (default)" + name="item0" + value="1000 x 700" /> + <combo_box.item + label="1024 x 768" + name="item1" + value="1024 x 768" /> + <combo_box.item + label="1280 x 720 (720p)" + name="item2" + value="1280 x 720" /> + <combo_box.item + label="1920 x 1080 (1080p)" + name="item3" + value="1920 x 1080" /> + </combo_box> + <button + follows="right|bottom" + height="23" + label="Set" + left_delta="0" + name="set_btn" + top_pad="10" + width="85" /> + <button + follows="right|bottom" + height="23" + label="Cancel" + left_pad="5" + name="cancel_btn" + top_delta="0" + width="85" /> +</floater> diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml index 7a0b11872a..690167bc33 100644 --- a/indra/newview/skins/default/xui/en/menu_login.xml +++ b/indra/newview/skins/default/xui/en/menu_login.xml @@ -233,6 +233,13 @@ parameter="RegInClient" /> </menu_item_check> <menu_item_separator /> + <menu_item_call + label="Set Window Size..." + name="Set Window Size..."> + <menu_item_call.on_click + function="Floater.Show" + parameter="window_size" /> + </menu_item_call> <menu_item_call label="Show TOS" name="TOS"> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 0640ae21de..4e495bab3f 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1119,6 +1119,13 @@ <menu_item_call.on_click function="View.DefaultUISize" /> </menu_item_call> + <menu_item_call + label="Set Window Size..." + name="Set Window Size..."> + <menu_item_call.on_click + function="Floater.Show" + parameter="window_size" /> + </menu_item_call> <menu_item_separator/> <menu_item_check label="Limit Select Distance" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index 426a2b1f9e..17651b8caa 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -10,10 +10,6 @@ name="advanced" top="1" width="517"> - <panel.string - name="resolution_format"> - [RES_X] x [RES_Y] - </panel.string> <panel.string name="aspect_ratio_text"> [NUM]:[DEN] |