/[pcsx2_0.9.7]/trunk/pcsx2/gui/Dialogs/McdConfigDialog.cpp
ViewVC logotype

Contents of /trunk/pcsx2/gui/Dialogs/McdConfigDialog.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (show annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 2 months ago) by william
File size: 4670 byte(s)
re-commit (had local access denied errors when committing)
1 /* PCSX2 - PS2 Emulator for PCs
2 * Copyright (C) 2002-2010 PCSX2 Dev Team
3 *
4 * PCSX2 is free software: you can redistribute it and/or modify it under the terms
5 * of the GNU Lesser General Public License as published by the Free Software Found-
6 * ation, either version 3 of the License, or (at your option) any later version.
7 *
8 * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * PURPOSE. See the GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License along with PCSX2.
13 * If not, see <http://www.gnu.org/licenses/>.
14 */
15
16 #include "PrecompiledHeader.h"
17
18 #include "ConfigurationDialog.h"
19 #include "BaseConfigurationDialog.inl"
20 #include "ModalPopups.h"
21 #include "MSWstuff.h"
22
23 #include "Panels/ConfigurationPanels.h"
24 #include "Panels/MemoryCardPanels.h"
25
26 using namespace pxSizerFlags;
27
28 wxString GetMsg_McdNtfsCompress()
29 {
30 return pxE( "!Panel:Mcd:NtfsCompress",
31 L"NTFS compression is built-in, fast, and completely reliable; and typically compresses memory cards "
32 L"very well (this option is highly recommended)."
33 );
34 }
35
36 Panels::McdConfigPanel_Toggles::McdConfigPanel_Toggles(wxWindow *parent)
37 : _parent( parent )
38 {
39 m_check_Ejection = new pxCheckBox( this,
40 _("Auto-eject memory cards when loading savestates"),
41 pxE( "!Panel:Mcd:EnableEjection",
42 L"Avoids memory card corruption by forcing games to re-index card contents after "
43 L"loading from savestates. May not be compatible with all games (Guitar Hero)."
44 )
45 );
46
47 m_check_SavestateBackup = new pxCheckBox( this, pxsFmt(_("Backup existing Savestate when creating a new one")) );
48
49 for( uint i=0; i<2; ++i )
50 {
51 m_check_Multitap[i] = new pxCheckBox( this, pxsFmt(_("Enable Multitap on Port %u"), i+1) );
52 m_check_Multitap[i]->SetClientData( (void*)i );
53 m_check_Multitap[i]->SetName(pxsFmt( L"CheckBox::Multitap%u", i ));
54 }
55
56 // ------------------------------
57 // Sizers and Layout Section
58 // ------------------------------
59
60 for( uint i=0; i<2; ++i )
61 *this += m_check_Multitap[i];
62
63 *this += 4;
64
65 *this += m_check_SavestateBackup;
66
67 *this += 4;
68
69 *this += m_check_Ejection;
70 }
71
72 void Panels::McdConfigPanel_Toggles::Apply()
73 {
74 g_Conf->EmuOptions.MultitapPort0_Enabled = m_check_Multitap[0]->GetValue();
75 g_Conf->EmuOptions.MultitapPort1_Enabled = m_check_Multitap[1]->GetValue();
76
77 g_Conf->EmuOptions.BackupSavestate = m_check_SavestateBackup->GetValue();
78 g_Conf->EmuOptions.McdEnableEjection = m_check_Ejection->GetValue();
79 }
80
81 void Panels::McdConfigPanel_Toggles::AppStatusEvent_OnSettingsApplied()
82 {
83 m_check_Multitap[0] ->SetValue( g_Conf->EmuOptions.MultitapPort0_Enabled );
84 m_check_Multitap[1] ->SetValue( g_Conf->EmuOptions.MultitapPort1_Enabled );
85
86 m_check_SavestateBackup ->SetValue( g_Conf->EmuOptions.BackupSavestate );
87 m_check_Ejection ->SetValue( g_Conf->EmuOptions.McdEnableEjection );
88 }
89
90
91 using namespace Panels;
92 using namespace pxSizerFlags;
93
94 Dialogs::McdConfigDialog::McdConfigDialog( wxWindow* parent )
95 : BaseConfigurationDialog( parent, _("MemoryCard Manager"), 600 )
96 {
97 m_panel_mcdlist = new MemoryCardListPanel_Simple( this );
98
99 // [TODO] : Plan here is to add an advanced tab which gives the user the ability
100 // to configure the names of each memory card slot.
101
102 //AddPage<McdConfigPanel_Toggles> ( wxLt("Settings"), cfgid.MemoryCard );
103 //AddPage<McdConfigPanel_Standard> ( wxLt("Slots 1/2"), cfgid.MemoryCard );
104
105 *this += Heading(_("Drag items over other items in the list to swap or copy memory cards.")) | StdExpand();
106 *this += StdPadding;
107
108 *this += m_panel_mcdlist | StdExpand();
109 //*this += StdPadding;
110 *this += new wxStaticLine( this ) | StdExpand();
111 *this += StdPadding;
112 *this += new McdConfigPanel_Toggles( this ) | StdExpand();
113
114 for( uint i=0; i<2; ++i )
115 {
116 if( pxCheckBox* check = (pxCheckBox*)FindWindow(pxsFmt( L"CheckBox::Multitap%u", i )) )
117 Connect( check->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(McdConfigDialog::OnMultitapClicked) );
118 }
119
120 AddOkCancel();
121 }
122
123 void Dialogs::McdConfigDialog::OnMultitapClicked( wxCommandEvent& evt )
124 {
125 evt.Skip();
126 if( !m_panel_mcdlist ) return;
127
128 if( pxCheckBox* box = (pxCheckBox*)evt.GetEventObject() )
129 m_panel_mcdlist->SetMultitapEnabled( (int)box->GetClientData(), box->IsChecked() );
130 }
131
132 bool Dialogs::McdConfigDialog::Show( bool show )
133 {
134 if( show && m_panel_mcdlist )
135 m_panel_mcdlist->OnShown();
136
137 return _parent::Show( show );
138 }
139
140 int Dialogs::McdConfigDialog::ShowModal()
141 {
142 if( m_panel_mcdlist )
143 m_panel_mcdlist->OnShown();
144
145 return _parent::ShowModal();
146 }

  ViewVC Help
Powered by ViewVC 1.1.22