You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
4.7 KiB
157 lines
4.7 KiB
//========= Copyright (c) 1996-2005, Valve Corporation, All rights reserved. ============//
|
|
//
|
|
// Purpose:
|
|
//
|
|
// $NoKeywords: $
|
|
//=============================================================================//
|
|
|
|
#include "basepanel.h"
|
|
#include "optionsdialog.h"
|
|
|
|
#include "vgui_controls/Button.h"
|
|
#include "vgui_controls/CheckButton.h"
|
|
#include "vgui_controls/PropertySheet.h"
|
|
#include "vgui_controls/Label.h"
|
|
#include "vgui_controls/QueryBox.h"
|
|
|
|
#include "vgui/ILocalize.h"
|
|
#include "vgui/ISurface.h"
|
|
#include "vgui/ISystem.h"
|
|
#include "vgui/IVGui.h"
|
|
|
|
#include "keyvalues.h"
|
|
#include "optionssubkeyboard.h"
|
|
#include "optionssubmouse.h"
|
|
#include "optionssubaudio.h"
|
|
#include "optionssubvideo.h"
|
|
#include "optionssubvoice.h"
|
|
#include "optionssubmultiplayer.h"
|
|
#include "optionssubdifficulty.h"
|
|
#include "optionssubportal.h"
|
|
#include "modinfo.h"
|
|
|
|
using namespace vgui;
|
|
|
|
// memdbgon must be the last include file in a .cpp file!!!
|
|
#include "tier0/memdbgon.h"
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: Basic help dialog
|
|
//-----------------------------------------------------------------------------
|
|
COptionsDialog::COptionsDialog(vgui::Panel *parent, OptionsDialogTabStyle iTabStyle) : PropertyDialog(parent, "OptionsDialog")
|
|
{
|
|
SetDeleteSelfOnClose( true );
|
|
SetBounds(0, 0, 512, 406);
|
|
|
|
|
|
SetSizeable( false );
|
|
|
|
// debug timing code, this function takes too long
|
|
// double s4 = system()->GetCurrentTime();
|
|
|
|
if ( iTabStyle == OPTIONS_DIALOG_ALL_TABS )
|
|
{
|
|
SetTitle("#GameUI_Options", true);
|
|
|
|
if ( ModInfo().IsSinglePlayerOnly() && !ModInfo().NoDifficulty() )
|
|
{
|
|
AddPage(new COptionsSubDifficulty(this), "#GameUI_Difficulty");
|
|
}
|
|
|
|
if ( ModInfo().HasPortals() )
|
|
{
|
|
AddPage(new COptionsSubPortal(this), "#GameUI_Portal");
|
|
}
|
|
|
|
AddPage(new COptionsSubKeyboard(this), "#GameUI_Keyboard");
|
|
AddPage(new COptionsSubMouse(this), "#GameUI_Mouse");
|
|
|
|
m_pOptionsSubAudio = new COptionsSubAudio(this);
|
|
AddPage(m_pOptionsSubAudio, "#GameUI_Audio");
|
|
m_pOptionsSubVideo = new COptionsSubVideo(this);
|
|
AddPage(m_pOptionsSubVideo, "#GameUI_Video");
|
|
|
|
if ( !ModInfo().IsSinglePlayerOnly() )
|
|
{
|
|
AddPage(new COptionsSubVoice(this), "#GameUI_Voice");
|
|
}
|
|
|
|
// add the multiplay page last, if we're combo single/multi or just multi
|
|
if ( (ModInfo().IsMultiplayerOnly() && !ModInfo().IsSinglePlayerOnly()) ||
|
|
(!ModInfo().IsMultiplayerOnly() && !ModInfo().IsSinglePlayerOnly()) )
|
|
{
|
|
AddPage(new COptionsSubMultiplayer(this), "#GameUI_Multiplayer");
|
|
}
|
|
}
|
|
else if ( iTabStyle == OPTIONS_DIALOG_ONLY_BINDING_TABS )
|
|
{
|
|
SetTitle("#SFUI_Controller_Edit_Keys_Buttons", true);
|
|
|
|
AddPage(new COptionsSubKeyboard(this), "#GameUI_Console_UserSettings");
|
|
}
|
|
|
|
// double s5 = system()->GetCurrentTime();
|
|
// Msg("COptionsDialog::COptionsDialog(): %.3fms\n", (float)(s5 - s4) * 1000.0f);
|
|
|
|
SetApplyButtonVisible(true);
|
|
GetPropertySheet()->SetTabWidth(84);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: Destructor
|
|
//-----------------------------------------------------------------------------
|
|
COptionsDialog::~COptionsDialog()
|
|
{
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: Brings the dialog to the fore
|
|
//-----------------------------------------------------------------------------
|
|
void COptionsDialog::Activate()
|
|
{
|
|
BaseClass::Activate();
|
|
EnableApplyButton(false);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: Opens the dialog
|
|
//-----------------------------------------------------------------------------
|
|
void COptionsDialog::Run()
|
|
{
|
|
SetTitle("#GameUI_Options", true);
|
|
Activate();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: Opens the gamma dialog directly
|
|
//-----------------------------------------------------------------------------
|
|
void COptionsDialog::OpenGammaDialog()
|
|
{
|
|
m_pOptionsSubVideo->OpenGammaDialog();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: To notify BasePanel to restore Scaleform menus, if they are activated.
|
|
//-----------------------------------------------------------------------------
|
|
void COptionsDialog::OnFinishedClose( void )
|
|
{
|
|
BasePanel()->NotifyVguiDialogClosed();
|
|
|
|
BaseClass::OnFinishedClose();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Purpose: Called when the GameUI is hidden
|
|
//-----------------------------------------------------------------------------
|
|
void COptionsDialog::OnGameUIHidden()
|
|
{
|
|
// tell our children about it
|
|
for ( int i = 0 ; i < GetChildCount() ; i++ )
|
|
{
|
|
Panel *pChild = GetChild( i );
|
|
if ( pChild )
|
|
{
|
|
PostMessage( pChild, new KeyValues( "GameUIHidden" ) );
|
|
}
|
|
}
|
|
}
|