EXT-3720 Added Advanced > Set Window Size... for video making
Torley needed this to make tutorial movies. Removed dead code from Preferences. Reviewed by Leyla.master
parent
c2915a8899
commit
b3d0c94ee0
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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>);
|
||||
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Reference in New Issue