mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-20 04:34:48 +00:00
Added callback for onResize to guiWindowCtrl so controls - such as the EditorTree - can be properly resized in certain circumstances when the window is changed Added getIncrement() and getRange() to GuiGameSettingsCtrl to better facilitate options manipulation on the script side Corrected some of the console method documentation strings in GuiGameSettingsCtrl Removed some unneeded, extraneous files and their asset definitions that came from odd import conversions. Where applicable, created cleaned up versions to make naming conventions and references stable Fixed canvas mode update text typo: FSAA -> FXAA Added logic to DOF, Light Rays, SSAO and Vignette postFX's to check both the preset setting AND the user preference before enabling. Shifted initialization order so PostFX's are loaded before we configure the canvas, to ensure stuff like the FXAAPostFX exists and can be toggled on on load Fixed multiple issues with options menu: When using gamepad, unable to navigate from categories to options. Fixed so can now traverse as normal Input limitations on gamepad necessitated changing of how setting applying happens, is now done as a 'apply or discard' prompt when leaving the options menu Added proper handling for adjusting settings with gamepad with left/right inputs Fixed issue where the unapplied change for an option was sometimes being processed as an object name rather than an implicit string. Now made to be explicit strings to avoid issue. Made the menu button input for "Select" to go from categories to options gamepad only, and hidden when in the options list Fixed issue where changing window mode didn't correctly affect resolution option. Now set up so changing this field correctly refreshes the resolution option. Specifically, when on borderless, the resolution field does not show, preventing confusion as it is always full resolution Generally have the options list refresh when changes happen to allow any and all fields to be able to dynamically respond to other options having changed improving flexibility. Cleaned up old, unused, commented out functions Added ability on OKCancel message boxes to override the button text if needed Fixed issue with AssetBrowser where the shrink/grow icons next to the preview size slider were not anchored correctly. Adjusted callback logic so if preview slider is clicked on, rather than dragged, it will correctly update the zoom values Added sorting to Modules List dropdown for the AssetBrowser Improved standardization of double-clicking in AssetBrowser. Now defaults to editing action if regularly browsing and selecting if in select mode. Still allows regular per-type overrides as normal Moved definition of GuiDisabledTextEditProfile to gui profiles.ed.tscript file, removed duplicates to stop error spam Adjusted default settings value for double-click action in AB to be edit to prevent unstable behavior Removed old file refs from Load Recent list in the default settings
342 lines
12 KiB
Plaintext
342 lines
12 KiB
Plaintext
//-----------------------------------------------------------------------------
|
|
// Copyright (c) 2012 GarageGames, LLC
|
|
//
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
// of this software and associated documentation files (the "Software"), to
|
|
// deal in the Software without restriction, including without limitation the
|
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
// sell copies of the Software, and to permit persons to whom the Software is
|
|
// furnished to do so, subject to the following conditions:
|
|
//
|
|
// The above copyright notice and this permission notice shall be included in
|
|
// all copies or substantial portions of the Software.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
// IN THE SOFTWARE.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// --------------------------------------------------------------------
|
|
// Message Sound
|
|
// --------------------------------------------------------------------
|
|
/*new SFXDescription(MessageBoxAudioDescription)
|
|
{
|
|
volume = 1.0;
|
|
isLooping = false;
|
|
is3D = false;
|
|
channel = $GuiAudioType;
|
|
};
|
|
|
|
new SFXProfile(messageBoxBeep)
|
|
{
|
|
filename = "./messageBoxSound";
|
|
description = MessageBoxAudioDescription;
|
|
preload = true;
|
|
};*/
|
|
|
|
//---------------------------------------------------------------------------------------------
|
|
// messageCallback
|
|
// Calls a callback passed to a message box.
|
|
//---------------------------------------------------------------------------------------------
|
|
function messageCallback(%dlg, %callback)
|
|
{
|
|
Canvas.popDialog(%dlg);
|
|
eval(%callback);
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------
|
|
// MBSetText
|
|
// Sets the text of a message box and resizes it to accomodate the new string.
|
|
//---------------------------------------------------------------------------------------------
|
|
function MBSetText(%text, %frame, %msg)
|
|
{
|
|
// Get the extent of the text box.
|
|
%ext = %text.getExtent();
|
|
// Set the text in the center of the text box.
|
|
%text.setText("<just:center>" @ %msg);
|
|
// Force the textbox to resize itself vertically.
|
|
%text.forceReflow();
|
|
// Grab the new extent of the text box.
|
|
%newExtent = %text.getExtent();
|
|
|
|
// Get the vertical change in extent.
|
|
%deltaY = getWord(%newExtent, 1) - getWord(%ext, 1);
|
|
|
|
// Resize the window housing the text box.
|
|
%windowPos = %frame.getPosition();
|
|
%windowExt = %frame.getExtent();
|
|
%frame.resize(getWord(%windowPos, 0), getWord(%windowPos, 1) - (%deltaY / 2),
|
|
getWord(%windowExt, 0), getWord(%windowExt, 1) + %deltaY);
|
|
|
|
%frame.canMove = "0";
|
|
//%frame.canClose = "0";
|
|
%frame.resizeWidth = "0";
|
|
%frame.resizeHeight = "0";
|
|
%frame.canMinimize = "0";
|
|
%frame.canMaximize = "0";
|
|
|
|
//sfxPlayOnce( messageBoxBeep );
|
|
}
|
|
|
|
function MessageBoxCtrl::onWake(%this)
|
|
{
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------
|
|
// Various message box display functions. Each one takes a window title, a message, and a
|
|
// callback for each button.
|
|
//---------------------------------------------------------------------------------------------
|
|
|
|
//MessageBoxOK("Test", "This is a test message box", "echo(\"Uhhhhhawhat?\"");
|
|
function MessageBoxOK(%title, %message, %callback)
|
|
{
|
|
Canvas.pushDialog(MessageBoxDlg);
|
|
MessageBoxTitleText.text = %title;
|
|
|
|
MessageBoxOCButtonHolder.hidden = true;
|
|
MessageBoxYNCButtonHolder.hidden = true;
|
|
MessageBoxOKButtonHolder.hidden = false;
|
|
|
|
MessageBoxOKButtonHolder-->OKButton.set("btn_a", "Return", "OK", "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);");
|
|
|
|
MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer;
|
|
MessageBoxOKButtonHolder.setActive();
|
|
|
|
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
|
|
MessageBoxDlg.callback = %callback;
|
|
}
|
|
|
|
function MessageBoxOKDlg::onSleep( %this )
|
|
{
|
|
%this.callback = "";
|
|
MessageBoxCtrl.originalMenuInputContainer.setActive();
|
|
}
|
|
|
|
function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback, %okLabelOverride, %cancelLabelOverride)
|
|
{
|
|
Canvas.pushDialog(MessageBoxDlg);
|
|
MessageBoxTitleText.text = %title;
|
|
|
|
MessageBoxOCButtonHolder.hidden = false;
|
|
MessageBoxYNCButtonHolder.hidden = true;
|
|
MessageBoxOKButtonHolder.hidden = true;
|
|
|
|
if(%okLabelOverride $= "")
|
|
%okLabel = "OK";
|
|
else
|
|
%okLabel = %okLabelOverride;
|
|
|
|
if(%cancelLabelOverride $= "")
|
|
%cancelLabel = "Cancel";
|
|
else
|
|
%cancelLabel = %cancelLabelOverride;
|
|
|
|
MessageBoxOCButtonHolder-->OKButton.set("btn_a", "Return", %okLabel, "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);");
|
|
MessageBoxOCButtonHolder-->CancelButton.set("btn_b", "Escape", %cancelLabel, "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);");
|
|
|
|
MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer;
|
|
MessageBoxOCButtonHolder.setActive();
|
|
|
|
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
|
|
MessageBoxDlg.callback = %callback;
|
|
MessageBoxDlg.cancelCallback = %cancelCallback;
|
|
}
|
|
|
|
function MessageBoxOKCancelDlg::onSleep( %this )
|
|
{
|
|
%this.callback = "";
|
|
MessageBoxCtrl.originalMenuInputContainer.setActive();
|
|
}
|
|
|
|
function MessageBoxOKCancelDetails(%title, %message, %details, %callback, %cancelCallback)
|
|
{
|
|
if(%details $= "")
|
|
{
|
|
MBOKCancelDetailsButton.setVisible(false);
|
|
}
|
|
|
|
MBOKCancelDetailsScroll.setVisible(false);
|
|
|
|
MBOKCancelDetailsFrame.setText( %title );
|
|
|
|
Canvas.pushDialog(MessageBoxOKCancelDetailsDlg);
|
|
MBSetText(MBOKCancelDetailsText, MBOKCancelDetailsFrame, %message);
|
|
MBOKCancelDetailsInfoText.setText(%details);
|
|
|
|
%textExtent = MBOKCancelDetailsText.getExtent();
|
|
%textExtentY = getWord(%textExtent, 1);
|
|
%textPos = MBOKCancelDetailsText.getPosition();
|
|
%textPosY = getWord(%textPos, 1);
|
|
|
|
%extentY = %textPosY + %textExtentY + 65;
|
|
|
|
MBOKCancelDetailsInfoText.setExtent(285, 128);
|
|
|
|
MBOKCancelDetailsFrame.setExtent(300, %extentY);
|
|
|
|
MessageBoxOKCancelDetailsDlg.callback = %callback;
|
|
MessageBoxOKCancelDetailsDlg.cancelCallback = %cancelCallback;
|
|
|
|
MBOKCancelDetailsFrame.defaultExtent = MBOKCancelDetailsFrame.getExtent();
|
|
}
|
|
|
|
function MBOKCancelDetailsToggleInfoFrame()
|
|
{
|
|
if(!MBOKCancelDetailsScroll.isVisible())
|
|
{
|
|
MBOKCancelDetailsScroll.setVisible(true);
|
|
MBOKCancelDetailsText.forceReflow();
|
|
%textExtent = MBOKCancelDetailsText.getExtent();
|
|
%textExtentY = getWord(%textExtent, 1);
|
|
%textPos = MBOKCancelDetailsText.getPosition();
|
|
%textPosY = getWord(%textPos, 1);
|
|
|
|
%verticalStretch = %textExtentY;
|
|
|
|
if((%verticalStretch > 260) || (%verticalStretch < 0))
|
|
%verticalStretch = 260;
|
|
|
|
%extent = MBOKCancelDetailsFrame.defaultExtent;
|
|
%height = getWord(%extent, 1);
|
|
|
|
%posY = %textPosY + %textExtentY + 10;
|
|
%posX = getWord(MBOKCancelDetailsScroll.getPosition(), 0);
|
|
MBOKCancelDetailsScroll.setPosition(%posX, %posY);
|
|
MBOKCancelDetailsScroll.setExtent(getWord(MBOKCancelDetailsScroll.getExtent(), 0), %verticalStretch);
|
|
MBOKCancelDetailsFrame.setExtent(300, %height + %verticalStretch + 10);
|
|
} else
|
|
{
|
|
%extent = MBOKCancelDetailsFrame.defaultExtent;
|
|
%width = getWord(%extent, 0);
|
|
%height = getWord(%extent, 1);
|
|
MBOKCancelDetailsFrame.setExtent(%width, %height);
|
|
MBOKCancelDetailsScroll.setVisible(false);
|
|
}
|
|
}
|
|
|
|
function MessageBoxOKCancelDetailsDlg::onSleep( %this )
|
|
{
|
|
%this.callback = "";
|
|
MessageBoxCtrl.originalMenuInputContainer.setActive();
|
|
}
|
|
|
|
function MessageBoxYesNo(%title, %message, %yesCallback, %noCallback)
|
|
{
|
|
Canvas.pushDialog(MessageBoxDlg);
|
|
MessageBoxTitleText.text = %title;
|
|
|
|
MessageBoxOCButtonHolder.hidden = false;
|
|
MessageBoxYNCButtonHolder.hidden = true;
|
|
MessageBoxOKButtonHolder.hidden = true;
|
|
|
|
MessageBoxOCButtonHolder-->OKButton.set("btn_a", "Return", "Yes", "MessageCallback(MessageBoxDlg,MessageBoxDlg.yesCallBack);");
|
|
MessageBoxOCButtonHolder-->CancelButton.set("btn_b", "Escape", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.noCallback);");
|
|
|
|
MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer;
|
|
MessageBoxOCButtonHolder.setActive();
|
|
|
|
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
|
|
MessageBoxDlg.yesCallBack = %yesCallback;
|
|
MessageBoxDlg.noCallback = %noCallback;
|
|
}
|
|
|
|
function MessageBoxYesNoCancel(%title, %message, %yesCallback, %noCallback, %cancelCallback)
|
|
{
|
|
Canvas.pushDialog(MessageBoxDlg);
|
|
MessageBoxTitleText.text = %title;
|
|
|
|
MessageBoxOCButtonHolder.hidden = true;
|
|
MessageBoxYNCButtonHolder.hidden = false;
|
|
MessageBoxOKButtonHolder.hidden = true;
|
|
|
|
MessageBoxYNCButtonHolder-->yesButton.set("btn_a", "Return", "Yes", "MessageCallback(MessageBoxDlg,MessageBoxDlg.yesCallBack);");
|
|
MessageBoxYNCButtonHolder-->noButton.set("btn_x", "backspace", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.noCallback);");
|
|
MessageBoxYNCButtonHolder-->cancelButton.set("btn_b", "Escape", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);");
|
|
|
|
MessageBoxCtrl.originalMenuInputContainer = $activeMenuButtonContainer;
|
|
MessageBoxYNCButtonHolder.setActive();
|
|
|
|
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
|
|
MessageBoxDlg.yesCallBack = %yesCallback;
|
|
MessageBoxDlg.noCallback = %noCallback;
|
|
MessageBoxDlg.cancelCallback = %cancelCallback;
|
|
}
|
|
|
|
function MessageBoxDlg::onSleep( %this )
|
|
{
|
|
%this.callback = "";
|
|
%this.cancelCallback = "";
|
|
%this.yesCallback = "";
|
|
%this.noCallback = "";
|
|
%this.cancelCallback = "";
|
|
MessageBoxCtrl.originalMenuInputContainer.setActive();
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------
|
|
// MessagePopup
|
|
// Displays a message box with no buttons. Disappears after %delay milliseconds.
|
|
//---------------------------------------------------------------------------------------------
|
|
function MessagePopup(%title, %message, %delay)
|
|
{
|
|
Canvas.pushDialog(MessageBoxDlg);
|
|
MessageBoxTitleText.text = %title;
|
|
MBSetText(MessageBoxText, MessageBoxCtrl, %message);
|
|
|
|
if (%delay !$= "")
|
|
schedule(%delay, 0, CloseMessagePopup);
|
|
}
|
|
|
|
function CloseMessagePopup()
|
|
{
|
|
Canvas.popDialog(MessageBoxDlg);
|
|
}
|
|
|
|
//---------------------------------------------------------------------------------------------
|
|
// IODropdown
|
|
// By passing in a simgroup or simset, the user will be able to choose a child of that group
|
|
// through a guiPopupMenuCtrl
|
|
//---------------------------------------------------------------------------------------------
|
|
|
|
function IODropdown(%title, %message, %simgroup, %callback, %cancelCallback)
|
|
{
|
|
IODropdownFrame.text = %title;
|
|
Canvas.pushDialog(IODropdownDlg);
|
|
MBSetText(IODropdownText, IODropdownFrame, %message);
|
|
|
|
if(isObject(%simgroup))
|
|
{
|
|
for(%i = 0; %i < %simgroup.getCount(); %i++)
|
|
IODropdownMenu.add(%simgroup.getObject(%i).getName());
|
|
|
|
}
|
|
|
|
IODropdownMenu.sort();
|
|
IODropdownMenu.setFirstSelected(0);
|
|
|
|
IODropdownDlg.callback = %callback;
|
|
IODropdownDlg.cancelCallback = %cancelCallback;
|
|
}
|
|
|
|
function IODropdownDlg::onSleep( %this )
|
|
{
|
|
%this.callback = "";
|
|
%this.cancelCallback = "";
|
|
IODropdownMenu.clear();
|
|
}
|
|
|
|
//The # in the function passed replaced with the output
|
|
//of the preset menu.
|
|
function IOCallback(%dlg, %callback)
|
|
{
|
|
%id = IODropdownMenu.getSelected();
|
|
%text = IODropdownMenu.getTextById(%id);
|
|
%callback = strreplace(%callback, "#", %text);
|
|
eval(%callback);
|
|
|
|
Canvas.popDialog(%dlg);
|
|
}
|