mirror of https://github.com/PCSX2/pcsx2.git
wxgui: Tons of updates and fixes ...
* Mostly finalized the i18n system. * fully implemented the speedhacks dialog. * improved the wxHelpers quite a lot. * added a new gamefixes icon as put together by gigaherz. git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1554 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
aaf1acf58d
commit
2814323298
|
@ -222,18 +222,6 @@
|
|||
RelativePath="..\..\src\Utilities\vssprintf.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\Utilities\Windows\WinHostSys.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\Utilities\Windows\WinMisc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\Utilities\Windows\WinThreads.cpp"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="Linux"
|
||||
>
|
||||
|
@ -350,6 +338,22 @@
|
|||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Windows"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\Utilities\Windows\WinHostSys.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\Utilities\Windows\WinMisc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\Utilities\Windows\WinThreads.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
|
|
|
@ -175,10 +175,11 @@ public:
|
|||
struct SpeedhackOptions
|
||||
{
|
||||
int
|
||||
EECycleRate:3, // EE cyclerate selector (1.0, 1.5, 2.0, 3.0)
|
||||
EECycleRate:2, // EE cyclerate selector (1.0, 1.5, 2.0)
|
||||
VUCycleSteal:3, // VU Cycle Stealer factor (0, 1, 2, or 3)
|
||||
IopCycleRate_X2:1, // enables the x2 multiplier of the IOP cyclerate
|
||||
ExtWaitcycles:1, // enables extended waitcycles duration
|
||||
IntcStat:1; // tells Pcsx2 to fast-forward through intc_stat waits.
|
||||
IntcStat:1, // tells Pcsx2 to fast-forward through intc_stat waits.
|
||||
BIFC0:1; // enables BIFC0 detection and fast-forwarding
|
||||
|
||||
void LoadSave( IniInterface& conf );
|
||||
};
|
||||
|
@ -189,7 +190,7 @@ public:
|
|||
bool CdvdVerboseReads; // enables cdvd read activity verbosely dumped to the console
|
||||
|
||||
// Current language in use (correlates to a wxWidgets wxLANGUAGE specifier)
|
||||
int LanguageId;
|
||||
wxLanguage LanguageId;
|
||||
|
||||
int RecentFileCount; // number of files displayed in the Recent Isos list.
|
||||
|
||||
|
|
|
@ -350,7 +350,8 @@ wxString AppConfig::FullpathToMcd( uint mcdidx ) const { return Path::Combine( F
|
|||
// syntax errors. >_<
|
||||
//
|
||||
#define IniEntry( varname, defval ) ini.Entry( wxT(#varname), varname, defval )
|
||||
#define IniEntryBitfield( varname, defval ) varname = ini.EntryBitfield( wxT(#varname), defval )
|
||||
#define IniBitfield( varname, defval ) varname = ini.EntryBitfield( wxT(#varname), varname, defval )
|
||||
#define IniBitBool( varname, defval ) varname = ini.EntryBitBool( wxT(#varname), varname, defval )
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
void AppConfig::LoadSaveUserMode( IniInterface& ini )
|
||||
|
@ -365,7 +366,7 @@ void AppConfig::LoadSaveUserMode( IniInterface& ini )
|
|||
void AppConfig::LoadSave( IniInterface& ini )
|
||||
{
|
||||
IniEntry( MainGuiPosition, wxDefaultPosition );
|
||||
IniEntry( LanguageId, wxLANGUAGE_DEFAULT );
|
||||
ini.EnumEntry( L"LanguageId", LanguageId );
|
||||
IniEntry( RecentFileCount, 6 );
|
||||
IniEntry( DeskTheme, L"default" );
|
||||
IniEntry( Listbook_ImageSize, 32 );
|
||||
|
@ -466,6 +467,12 @@ void AppConfig::SpeedhackOptions::LoadSave( IniInterface& ini )
|
|||
{
|
||||
ini.SetPath( L"Speedhacks" );
|
||||
|
||||
IniBitfield( EECycleRate, 0 );
|
||||
IniBitfield( VUCycleSteal, 0 );
|
||||
IniBitBool( IopCycleRate_X2, false );
|
||||
IniBitBool( IntcStat, false );
|
||||
IniBitBool( BIFC0, false );
|
||||
|
||||
ini.SetPath( L".." );
|
||||
}
|
||||
|
||||
|
@ -498,13 +505,13 @@ void AppConfig::FolderOptions::LoadSave( IniInterface& ini )
|
|||
|
||||
IniEntry( RunIso, PathDefs::GetDocuments() ); // raw default is always the Documents folder.
|
||||
|
||||
IniEntryBitfield( UseDefaultPlugins, true );
|
||||
IniEntryBitfield( UseDefaultSettings, true );
|
||||
IniEntryBitfield( UseDefaultBios, true );
|
||||
IniEntryBitfield( UseDefaultSnapshots, true );
|
||||
IniEntryBitfield( UseDefaultSavestates, true );
|
||||
IniEntryBitfield( UseDefaultMemoryCards, true );
|
||||
IniEntryBitfield( UseDefaultLogs, true );
|
||||
IniBitBool( UseDefaultPlugins, true );
|
||||
IniBitBool( UseDefaultSettings, true );
|
||||
IniBitBool( UseDefaultBios, true );
|
||||
IniBitBool( UseDefaultSnapshots, true );
|
||||
IniBitBool( UseDefaultSavestates, true );
|
||||
IniBitBool( UseDefaultMemoryCards, true );
|
||||
IniBitBool( UseDefaultLogs, true );
|
||||
|
||||
if( ini.IsLoading() )
|
||||
ApplyDefaults();
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
#include "CheckedStaticBox.h"
|
||||
|
||||
CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title, int id ) :
|
||||
wxPanel( parent ),
|
||||
m_MasterSizer( *new wxBoxSizer( wxVERTICAL ) ),
|
||||
ThisToggle( *new wxCheckBox( this, id, title, wxPoint( 8, 0 ) ) ),
|
||||
ThisSizer( *new wxStaticBoxSizer( orientation, this ) )
|
||||
wxPanelWithHelpers( parent, wxDefaultCoord )
|
||||
, m_MasterSizer( *new wxBoxSizer( wxVERTICAL ) )
|
||||
, ThisToggle( *new wxCheckBox( this, id, title, wxPoint( 8, 0 ) ) )
|
||||
, ThisSizer( *new wxStaticBoxSizer( orientation, this ) )
|
||||
{
|
||||
m_MasterSizer.Add( &ThisToggle );
|
||||
m_MasterSizer.Add( &ThisSizer, wxSizerFlags().Expand() );
|
||||
|
@ -39,9 +39,9 @@ CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxS
|
|||
// Adds a checkbox to this group panel's base sizer.
|
||||
// This is a helper function which saves some typographic red tape over using manual
|
||||
// checkbox creation and sizer appendage.
|
||||
wxCheckBox& CheckedStaticBox::AddCheckBox( const wxString& label, wxWindowID id )
|
||||
wxCheckBox& CheckedStaticBox::AddCheckBox( const wxString& label, const wxString& subtext, const wxString& tooltip )
|
||||
{
|
||||
return wxHelpers::AddCheckBoxTo( this, ThisSizer, label, id );
|
||||
return wxPanelWithHelpers::AddCheckBox( ThisSizer, label, subtext, tooltip );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "wxHelpers.h"
|
||||
|
||||
class CheckedStaticBox : public wxPanel
|
||||
class CheckedStaticBox : public wxPanelWithHelpers
|
||||
{
|
||||
protected:
|
||||
wxBoxSizer& m_MasterSizer;
|
||||
|
@ -35,7 +35,8 @@ public:
|
|||
void SetValue( bool val );
|
||||
bool GetValue() const;
|
||||
|
||||
wxCheckBox& AddCheckBox( const wxString& label, wxWindowID id=wxID_ANY );
|
||||
using wxPanelWithHelpers::AddCheckBox; // allows access to overloaded parent :)
|
||||
wxCheckBox& AddCheckBox( const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString );
|
||||
|
||||
public:
|
||||
// Event handler for click events for the main checkbox (default behavior: enables/disables all child controls)
|
||||
|
|
|
@ -39,9 +39,11 @@ using namespace Panels;
|
|||
|
||||
|
||||
Dialogs::ConfigurationDialog::ConfigurationDialog( wxWindow* parent, int id ) :
|
||||
wxDialogWithHelpers( parent, id, _T("PCSX2 Configuration"), true )
|
||||
wxDialogWithHelpers( parent, id, _("PCSX2 Configuration"), true )
|
||||
, m_listbook( *new wxListbook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, s_orient ) )
|
||||
{
|
||||
static const int IdealWidth = 460;
|
||||
|
||||
wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_listbook.SetImageList( &wxGetApp().GetImgList_Config() );
|
||||
|
@ -50,16 +52,16 @@ Dialogs::ConfigurationDialog::ConfigurationDialog( wxWindow* parent, int id ) :
|
|||
g_ApplyState.StartBook( &m_listbook );
|
||||
|
||||
g_ApplyState.SetCurrentPage( m_listbook.GetPageCount() );
|
||||
m_listbook.AddPage( new PathsPanel( m_listbook ), _("Folders"), false, cfgid.Paths );
|
||||
m_listbook.AddPage( new PathsPanel( m_listbook, IdealWidth ), _("Folders"), false, cfgid.Paths );
|
||||
|
||||
g_ApplyState.SetCurrentPage( m_listbook.GetPageCount() );
|
||||
m_listbook.AddPage( new PluginSelectorPanel( m_listbook ), _("Plugins"), false, cfgid.Plugins );
|
||||
m_listbook.AddPage( new PluginSelectorPanel( m_listbook, IdealWidth ), _("Plugins"), false, cfgid.Plugins );
|
||||
|
||||
g_ApplyState.SetCurrentPage( m_listbook.GetPageCount() );
|
||||
m_listbook.AddPage( new SpeedHacksPanel( m_listbook ), _("Speedhacks"), false, cfgid.Speedhacks );
|
||||
m_listbook.AddPage( new SpeedHacksPanel( m_listbook, IdealWidth ), _("Speedhacks"), false, cfgid.Speedhacks );
|
||||
|
||||
g_ApplyState.SetCurrentPage( m_listbook.GetPageCount() );
|
||||
m_listbook.AddPage( new GameFixesPanel( m_listbook ), _("Game Fixes"), false, cfgid.Gamefixes );
|
||||
m_listbook.AddPage( new GameFixesPanel( m_listbook, IdealWidth ), _("Game Fixes"), false, cfgid.Gamefixes );
|
||||
|
||||
mainSizer.Add( &m_listbook );
|
||||
AddOkCancel( mainSizer, true );
|
||||
|
|
|
@ -40,13 +40,13 @@ namespace Dialogs
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
LogOptionsDialog::eeLogOptionsPanel::eeLogOptionsPanel( wxWindow* parent ) :
|
||||
CheckedStaticBox( parent, wxHORIZONTAL, L"EE Logs", LogID_EEBox )
|
||||
CheckedStaticBox( parent, wxHORIZONTAL, L"EE Logs" )
|
||||
{
|
||||
wxBoxSizer& eeMisc = *new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
AddCheckBoxTo( this, eeMisc, L"Memory", LogID_Memory );
|
||||
AddCheckBoxTo( this, eeMisc, L"Bios", LogID_Bios );
|
||||
AddCheckBoxTo( this, eeMisc, L"Elf", LogID_ELF );
|
||||
AddCheckBox( eeMisc, L"Memory" );
|
||||
AddCheckBox( eeMisc, L"Bios" );
|
||||
AddCheckBox( eeMisc, L"Elf" );
|
||||
|
||||
wxBoxSizer& eeStack = *new wxBoxSizer( wxVERTICAL );
|
||||
eeStack.Add( new DisasmPanel( this ), SizerFlags::StdSpace() );
|
||||
|
@ -60,29 +60,29 @@ LogOptionsDialog::eeLogOptionsPanel::eeLogOptionsPanel( wxWindow* parent ) :
|
|||
}
|
||||
|
||||
LogOptionsDialog::eeLogOptionsPanel::DisasmPanel::DisasmPanel( wxWindow* parent ) :
|
||||
CheckedStaticBox( parent, wxVERTICAL, L"Disasm" , LogID_Disasm )
|
||||
CheckedStaticBox( parent, wxVERTICAL, L"Disasm" )
|
||||
{
|
||||
AddCheckBox( L"Core", LogID_CPU );
|
||||
AddCheckBox( L"Fpu", LogID_FPU );
|
||||
AddCheckBox( L"VU0", LogID_VU0 );
|
||||
AddCheckBox( L"Cop0", LogID_COP0 );
|
||||
AddCheckBox( L"VU Macro", LogID_VU_Macro );
|
||||
AddCheckBox( L"Core" );
|
||||
AddCheckBox( L"Fpu" );
|
||||
AddCheckBox( L"VU0" );
|
||||
AddCheckBox( L"Cop0" );
|
||||
AddCheckBox( L"VU Macro" );
|
||||
|
||||
SetValue( false );
|
||||
Fit();
|
||||
}
|
||||
|
||||
LogOptionsDialog::eeLogOptionsPanel::HwPanel::HwPanel( wxWindow* parent ) :
|
||||
CheckedStaticBox( parent, wxVERTICAL, L"Hardware", LogID_Hardware )
|
||||
CheckedStaticBox( parent, wxVERTICAL, L"Hardware" )
|
||||
{
|
||||
AddCheckBox( L"Registers", LogID_Registers );
|
||||
AddCheckBox( L"Dma", LogID_DMA );
|
||||
AddCheckBox( L"Vif", LogID_VIF );
|
||||
AddCheckBox( L"SPR", LogID_SPR );
|
||||
AddCheckBox( L"GIF", LogID_GIF );
|
||||
AddCheckBox( L"Sif", LogID_SIF );
|
||||
AddCheckBox( L"IPU", LogID_IPU );
|
||||
AddCheckBox( L"RPC", LogID_RPC );
|
||||
AddCheckBox( L"Registers" );
|
||||
AddCheckBox( L"Dma" );
|
||||
AddCheckBox( L"Vif" );
|
||||
AddCheckBox( L"SPR" );
|
||||
AddCheckBox( L"GIF" );
|
||||
AddCheckBox( L"Sif" );
|
||||
AddCheckBox( L"IPU" );
|
||||
AddCheckBox( L"RPC" );
|
||||
|
||||
SetValue( false );
|
||||
Fit();
|
||||
|
@ -98,16 +98,16 @@ void LogOptionsDialog::eeLogOptionsPanel::OnLogChecked(wxCommandEvent &event)
|
|||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
LogOptionsDialog::iopLogOptionsPanel::iopLogOptionsPanel( wxWindow* parent ) :
|
||||
CheckedStaticBox( parent, wxVERTICAL, L"IOP Logs", LogID_IopBox )
|
||||
CheckedStaticBox( parent, wxVERTICAL, L"IOP Logs" )
|
||||
{
|
||||
AddCheckBox( L"Disasm", LogID_Disasm);
|
||||
AddCheckBox( L"Memory", LogID_Memory );
|
||||
AddCheckBox( L"Bios", LogID_Bios );
|
||||
AddCheckBox( L"Registers", LogID_Hardware );
|
||||
AddCheckBox( L"Dma", LogID_DMA );
|
||||
AddCheckBox( L"Pad", LogID_Pad );
|
||||
AddCheckBox( L"Cdrom", LogID_Cdrom );
|
||||
AddCheckBox( L"GPU (PSX)", LogID_GPU );
|
||||
AddCheckBox( L"Disasm" );
|
||||
AddCheckBox( L"Memory" );
|
||||
AddCheckBox( L"Bios" );
|
||||
AddCheckBox( L"Registers" );
|
||||
AddCheckBox( L"Dma" );
|
||||
AddCheckBox( L"Pad" );
|
||||
AddCheckBox( L"Cdrom" );
|
||||
AddCheckBox( L"GPU (PSX)" );
|
||||
|
||||
SetValue( true );
|
||||
Fit();
|
||||
|
@ -122,8 +122,8 @@ LogOptionsDialog::LogOptionsDialog(wxWindow* parent, int id, const wxPoint& pos,
|
|||
iopLogOptionsPanel& iopSizer = *new iopLogOptionsPanel( this );
|
||||
|
||||
wxStaticBoxSizer& miscSizer = *new wxStaticBoxSizer( wxHORIZONTAL, this, _T("Misc") );
|
||||
AddCheckBox( miscSizer, L"Log to STDOUT", LogID_StdOut );
|
||||
AddCheckBox( miscSizer, L"SYMs Log", LogID_Symbols );
|
||||
AddCheckBox( miscSizer, L"Log to STDOUT" );
|
||||
AddCheckBox( miscSizer, L"SYMs Log" );
|
||||
|
||||
wxBoxSizer& mainsizer = *new wxBoxSizer( wxVERTICAL );
|
||||
wxBoxSizer& topSizer = *new wxBoxSizer( wxHORIZONTAL );
|
||||
|
|
|
@ -32,30 +32,11 @@ public:
|
|||
LogOptionsDialog( wxWindow* parent, int id, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize );
|
||||
|
||||
protected:
|
||||
enum LogChecks
|
||||
{
|
||||
LogID_StdOut = 100,
|
||||
LogID_Symbols
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class iopLogOptionsPanel : public CheckedStaticBox
|
||||
{
|
||||
protected:
|
||||
enum LogCheckIDs
|
||||
{
|
||||
LogID_IopBox = 100,
|
||||
LogID_Disasm,
|
||||
LogID_Memory,
|
||||
LogID_Hardware,
|
||||
LogID_Bios,
|
||||
LogID_DMA,
|
||||
LogID_Pad,
|
||||
LogID_Cdrom,
|
||||
LogID_GPU
|
||||
};
|
||||
|
||||
public:
|
||||
iopLogOptionsPanel( wxWindow* parent );
|
||||
void OnLogChecked(wxCommandEvent &event);
|
||||
|
@ -66,34 +47,6 @@ protected:
|
|||
//
|
||||
class eeLogOptionsPanel : public CheckedStaticBox
|
||||
{
|
||||
protected:
|
||||
enum LogCheckIDs
|
||||
{
|
||||
// Group boxes and misc logs
|
||||
LogID_EEBox = 100,
|
||||
LogID_Disasm,
|
||||
LogID_Hardware,
|
||||
LogID_Memory,
|
||||
LogID_Bios,
|
||||
LogID_ELF,
|
||||
|
||||
// Disasm section
|
||||
LogID_CPU = 200,
|
||||
LogID_FPU,
|
||||
LogID_VU0,
|
||||
LogID_COP0,
|
||||
LogID_VU_Macro,
|
||||
|
||||
LogID_Registers = 300,
|
||||
LogID_DMA,
|
||||
LogID_VIF,
|
||||
LogID_SPR,
|
||||
LogID_GIF,
|
||||
LogID_SIF,
|
||||
LogID_IPU,
|
||||
LogID_RPC
|
||||
};
|
||||
|
||||
public:
|
||||
eeLogOptionsPanel( wxWindow* parent );
|
||||
void OnLogChecked(wxCommandEvent &event);
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace Dialogs
|
|||
{
|
||||
protected:
|
||||
Panels::UsermodeSelectionPanel* m_panel_usersel;
|
||||
Panels::LanguageSelectionPanel* m_panel_langsel;
|
||||
|
||||
public:
|
||||
PickUserModeDialog( wxWindow* parent, int id=wxID_ANY );
|
||||
|
|
|
@ -23,37 +23,34 @@
|
|||
|
||||
using namespace wxHelpers;
|
||||
|
||||
|
||||
|
||||
Dialogs::PickUserModeDialog::PickUserModeDialog( wxWindow* parent, int id ) :
|
||||
wxDialogWithHelpers( parent, id, _("PCSX2 First Time configuration"), false )
|
||||
, m_panel_usersel( new Panels::UsermodeSelectionPanel( this ) )
|
||||
, m_panel_langsel( new Panels::LanguageSelectionPanel( this ) )
|
||||
{
|
||||
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
AddStaticText( s_main, _("PCSX2 is starting from a new or unknown folder and needs to be configured."),
|
||||
0, wxALIGN_CENTRE );
|
||||
|
||||
s_main.Add( m_panel_langsel, SizerFlags::StdCenter() );
|
||||
s_main.Add( m_panel_usersel, wxSizerFlags().Expand().Border( wxALL, 8 ) );
|
||||
|
||||
AddOkCancel( s_main );
|
||||
SetSizerAndFit( &s_main );
|
||||
|
||||
Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PickUserModeDialog::OnOk_Click ) );
|
||||
|
||||
// TODO : Add a command event handler for language changes, that dynamically re-update contents of this window.
|
||||
}
|
||||
|
||||
void Dialogs::PickUserModeDialog::OnOk_Click( wxCommandEvent& evt )
|
||||
{
|
||||
AppConfig confcopy( *g_Conf );
|
||||
|
||||
try
|
||||
if( Panels::g_ApplyState.ApplyAll() )
|
||||
{
|
||||
m_panel_usersel->Apply( confcopy );
|
||||
*g_Conf = confcopy;
|
||||
g_Conf->Apply();
|
||||
|
||||
Close();
|
||||
evt.Skip();
|
||||
}
|
||||
catch( Exception::CannotApplySettings& ex )
|
||||
{
|
||||
wxMessageBox( ex.DisplayMessage() + L"\n" + _("You may press Cancel to close the program."), _("Cannot apply settings...") );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ void IniLoader::Entry( const wxString& var, bool& value, const bool defvalue )
|
|||
value = (dest == L"enabled") || (dest != L"0");
|
||||
}
|
||||
|
||||
bool IniLoader::EntryBitfield( const wxString& var, bool value, const bool defvalue )
|
||||
bool IniLoader::EntryBitBool( const wxString& var, bool value, const bool defvalue )
|
||||
{
|
||||
// Note: 'value' param is used by inisaver only.
|
||||
bool result;
|
||||
|
@ -107,6 +107,13 @@ bool IniLoader::EntryBitfield( const wxString& var, bool value, const bool defva
|
|||
return result;
|
||||
}
|
||||
|
||||
int IniLoader::EntryBitfield( const wxString& var, int value, const int defvalue )
|
||||
{
|
||||
int result;
|
||||
Entry( var, result, defvalue );
|
||||
return result;
|
||||
}
|
||||
|
||||
void IniLoader::Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue )
|
||||
{
|
||||
TryParse( value, m_Config.Read( var, ToString( defvalue ) ), defvalue );
|
||||
|
@ -122,7 +129,7 @@ void IniLoader::Entry( const wxString& var, wxRect& value, const wxRect& defvalu
|
|||
TryParse( value, m_Config.Read( var, ToString( defvalue ) ), defvalue );
|
||||
}
|
||||
|
||||
void IniLoader::EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, const int defvalue )
|
||||
void IniLoader::_EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, const int defvalue )
|
||||
{
|
||||
wxString retval;
|
||||
m_Config.Read( var, &retval, enumArray[defvalue] );
|
||||
|
@ -184,12 +191,18 @@ void IniSaver::Entry( const wxString& var, bool& value, const bool defvalue )
|
|||
m_Config.Write( var, value ? L"enabled" : L"disabled" );
|
||||
}
|
||||
|
||||
bool IniSaver::EntryBitfield( const wxString& var, bool value, const bool defvalue )
|
||||
bool IniSaver::EntryBitBool( const wxString& var, bool value, const bool defvalue )
|
||||
{
|
||||
m_Config.Write( var, value ? L"enabled" : L"disabled" );
|
||||
return value;
|
||||
}
|
||||
|
||||
int IniSaver::EntryBitfield( const wxString& var, int value, const int defvalue )
|
||||
{
|
||||
m_Config.Write( var, value );
|
||||
return value;
|
||||
}
|
||||
|
||||
void IniSaver::Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue )
|
||||
{
|
||||
m_Config.Write( var, ToString( value ) );
|
||||
|
@ -205,7 +218,7 @@ void IniSaver::Entry( const wxString& var, wxRect& value, const wxRect& defvalue
|
|||
m_Config.Write( var, ToString( value ) );
|
||||
}
|
||||
|
||||
void IniSaver::EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, const int defvalue )
|
||||
void IniSaver::_EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, const int defvalue )
|
||||
{
|
||||
m_Config.Write( var, enumArray[value] );
|
||||
}
|
||||
|
|
|
@ -55,13 +55,26 @@ public:
|
|||
virtual void Entry( const wxString& var, bool& value, const bool defvalue=false )=0;
|
||||
|
||||
// This special form of Entry is provided for bitfields, which cannot be passed by reference.
|
||||
virtual bool EntryBitfield( const wxString& var, bool value, const bool defvalue=false )=0;
|
||||
virtual bool EntryBitBool( const wxString& var, bool value, const bool defvalue=false )=0;
|
||||
virtual int EntryBitfield( const wxString& var, int value, const int defvalue=0 )=0;
|
||||
|
||||
virtual void Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue=wxDefaultPosition )=0;
|
||||
virtual void Entry( const wxString& var, wxSize& value, const wxSize& defvalue=wxDefaultSize )=0;
|
||||
virtual void Entry( const wxString& var, wxRect& value, const wxRect& defvalue=wxDefaultRect )=0;
|
||||
|
||||
virtual void EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, const int defvalue=0 )=0;
|
||||
template< typename T >
|
||||
void EnumEntry( const wxString& var, T& value, const wxChar* const* enumArray=NULL, const T defvalue=(T)0 )
|
||||
{
|
||||
int tstore = (int)value;
|
||||
if( enumArray == NULL )
|
||||
Entry( var, tstore, defvalue );
|
||||
else
|
||||
_EnumEntry( var, tstore, enumArray, defvalue );
|
||||
value = (T)tstore;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void _EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, const int defvalue )=0;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -88,13 +101,15 @@ public:
|
|||
void Entry( const wxString& var, uint& value, const uint defvalue=0 );
|
||||
void Entry( const wxString& var, bool& value, const bool defvalue=false );
|
||||
|
||||
bool EntryBitfield( const wxString& var, bool value, const bool defvalue=false );
|
||||
bool EntryBitBool( const wxString& var, bool value, const bool defvalue=false );
|
||||
int EntryBitfield( const wxString& var, int value, const int defvalue=0 );
|
||||
|
||||
void Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue=wxDefaultPosition );
|
||||
void Entry( const wxString& var, wxSize& value, const wxSize& defvalue=wxDefaultSize );
|
||||
void Entry( const wxString& var, wxRect& value, const wxRect& defvalue=wxDefaultRect );
|
||||
|
||||
void EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, const int defvalue=0 );
|
||||
protected:
|
||||
void _EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, const int defvalue );
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -121,12 +136,14 @@ public:
|
|||
void Entry( const wxString& var, uint& value, const uint defvalue=0 );
|
||||
void Entry( const wxString& var, bool& value, const bool defvalue=false );
|
||||
|
||||
bool EntryBitfield( const wxString& var, bool value, const bool defvalue=false );
|
||||
bool EntryBitBool( const wxString& var, bool value, const bool defvalue=false );
|
||||
int EntryBitfield( const wxString& var, int value, const int defvalue=0 );
|
||||
|
||||
void Entry( const wxString& var, wxPoint& value, const wxPoint& defvalue=wxDefaultPosition );
|
||||
void Entry( const wxString& var, wxSize& value, const wxSize& defvalue=wxDefaultSize );
|
||||
void Entry( const wxString& var, wxRect& value, const wxRect& defvalue=wxDefaultRect );
|
||||
|
||||
void EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, const int defvalue=0 );
|
||||
protected:
|
||||
void _EnumEntry( const wxString& var, int& value, const wxChar* const* enumArray, const int defvalue );
|
||||
};
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ wxMenu* MainEmuFrame::MakeStatesMenu()
|
|||
{
|
||||
wxMenu* mnuStates = new wxMenu();
|
||||
|
||||
m_LoadStatesSubmenu.Append( Menu_State_LoadOther, _T("Other..."), wxEmptyString, wxITEM_NORMAL );
|
||||
m_SaveStatesSubmenu.Append( Menu_State_SaveOther, _T("Other..."), wxEmptyString, wxITEM_NORMAL );
|
||||
m_LoadStatesSubmenu.Append( Menu_State_LoadOther, _("Other..."), wxEmptyString, wxITEM_NORMAL );
|
||||
m_SaveStatesSubmenu.Append( Menu_State_SaveOther, _("Other..."), wxEmptyString, wxITEM_NORMAL );
|
||||
|
||||
mnuStates->Append( Menu_State_Load, _("Load"), &m_LoadStatesSubmenu, wxEmptyString );
|
||||
mnuStates->Append( Menu_State_Save, _("Save"), &m_SaveStatesSubmenu, wxEmptyString );
|
||||
|
@ -79,12 +79,12 @@ wxMenu* MainEmuFrame::MakeCdvdMenu()
|
|||
// ------------------------------------------------------------------------
|
||||
void MainEmuFrame::PopulateVideoMenu()
|
||||
{
|
||||
m_menuVideo.Append( Menu_Video_Basics, _T("Basic Settings..."), wxEmptyString, wxITEM_CHECK );
|
||||
m_menuVideo.Append( Menu_Video_Basics, _("Basic Settings..."), wxEmptyString, wxITEM_CHECK );
|
||||
m_menuVideo.AppendSeparator();
|
||||
|
||||
// Populate options from the plugin here.
|
||||
|
||||
m_menuVideo.Append( Menu_Video_Advanced, _T("Advanced..."), wxEmptyString, wxITEM_NORMAL );
|
||||
m_menuVideo.Append( Menu_Video_Advanced, _("Advanced..."), wxEmptyString, wxITEM_NORMAL );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -92,7 +92,7 @@ void MainEmuFrame::PopulateAudioMenu()
|
|||
{
|
||||
// Populate options from the plugin here.
|
||||
|
||||
m_menuAudio.Append( Menu_Audio_Advanced, _T("Advanced..."), wxEmptyString, wxITEM_NORMAL );
|
||||
m_menuAudio.Append( Menu_Audio_Advanced, _("Advanced..."), wxEmptyString, wxITEM_NORMAL );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -100,7 +100,7 @@ void MainEmuFrame::PopulatePadMenu()
|
|||
{
|
||||
// Populate options from the plugin here.
|
||||
|
||||
m_menuPad.Append( Menu_Pad_Advanced, _T("Advanced..."), wxEmptyString, wxITEM_NORMAL );
|
||||
m_menuPad.Append( Menu_Pad_Advanced, _("Advanced..."), wxEmptyString, wxITEM_NORMAL );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -122,6 +122,11 @@ void MainEmuFrame::OnMoveAround( wxMoveEvent& evt )
|
|||
// ... makes for a good test of the message pump's responsiveness.
|
||||
//Console::Notice( "Mess o' crashiness? It can't be!" );
|
||||
|
||||
// evt.GetPosition() returns the client area position, not the window frame position.
|
||||
// So read the window position directly... hope there's no problem with this too. :| --air
|
||||
|
||||
g_Conf->MainGuiPosition = GetPosition();
|
||||
|
||||
// wxGTK note: X sends gratuitous amounts of OnMove messages for various crap actions
|
||||
// like selecting or deselecting a window, which muck up docking logic. We filter them
|
||||
// out using 'lastpos' here. :)
|
||||
|
@ -137,8 +142,6 @@ void MainEmuFrame::OnMoveAround( wxMoveEvent& evt )
|
|||
wxGetApp().ProgramLog_PostEvent( conevt );
|
||||
}
|
||||
|
||||
g_Conf->MainGuiPosition = evt.GetPosition();
|
||||
|
||||
//evt.Skip();
|
||||
}
|
||||
|
||||
|
@ -275,16 +278,16 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title):
|
|||
m_menuRun.Append(Menu_RunELF, _("Run ELF File..."), _("For running raw PS2 binaries."));
|
||||
|
||||
m_menuRun.AppendSeparator();
|
||||
m_menuRun.Append(Menu_SkipBiosToggle,_("Skip Bios on Boot"), _("Enable this to skip PS2 bootup screens (may hurt compat)"));
|
||||
m_menuRun.Append(Menu_SkipBiosToggle,_("Skip Bios on Boot"), _("Enable this to skip PS2 bootup screens (may hurt compat)"));
|
||||
|
||||
m_menuRun.AppendSeparator();
|
||||
m_menuRun.Append(Menu_SuspendExec, _("Suspend"), _T("Stops emulation dead in its tracks"));
|
||||
m_menuRun.Append(Menu_ResumeExec, _("Resume"), _T("Resumes suspended emulation"));
|
||||
m_menuRun.Append(Menu_SuspendExec, _("Suspend"), _("Stops emulation dead in its tracks"));
|
||||
m_menuRun.Append(Menu_ResumeExec, _("Resume"), _("Resumes suspended emulation"));
|
||||
m_menuRun.Append(Menu_States, _("States"), MakeStatesMenu(), wxEmptyString);
|
||||
m_menuRun.Append(Menu_Reset, _("Reset"), _T("Resets emulation state and reloads plugins"));
|
||||
m_menuRun.Append(Menu_Reset, _("Reset"), _("Resets emulation state and reloads plugins"));
|
||||
|
||||
m_menuRun.AppendSeparator();
|
||||
m_menuRun.Append(Menu_Run_Exit, _("Exit"), _T("Closing PCSX2 may be hazardous to your health"));
|
||||
m_menuRun.Append(Menu_Run_Exit, _("Exit"), _("Closing PCSX2 may be hazardous to your health"));
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
@ -309,8 +312,8 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title):
|
|||
// ------------------------------------------------------------------------
|
||||
|
||||
m_menuMisc.Append( &m_MenuItem_Console );
|
||||
m_menuMisc.Append(Menu_Patches, _T("Enable Patches"), wxEmptyString, wxITEM_CHECK);
|
||||
m_menuMisc.Append(Menu_Profiler,_T("Enable Profiler"), wxEmptyString, wxITEM_CHECK);
|
||||
m_menuMisc.Append(Menu_Patches, _("Enable Patches"), wxEmptyString, wxITEM_CHECK);
|
||||
m_menuMisc.Append(Menu_Profiler,_("Enable Profiler"), wxEmptyString, wxITEM_CHECK);
|
||||
m_menuMisc.AppendSeparator();
|
||||
|
||||
// No dialogs implemented for these yet...
|
||||
|
|
|
@ -138,8 +138,8 @@ namespace Panels
|
|||
g_ApplyState.PanelList.remove( this );
|
||||
}
|
||||
|
||||
BaseApplicableConfigPanel( wxWindow* parent ) :
|
||||
wxPanelWithHelpers( parent, wxID_ANY )
|
||||
BaseApplicableConfigPanel( wxWindow* parent, int idealWidth ) :
|
||||
wxPanelWithHelpers( parent, idealWidth )
|
||||
, m_OwnerPage( g_ApplyState.CurOwnerPage )
|
||||
, m_OwnerBook( g_ApplyState.ParentBook )
|
||||
{
|
||||
|
@ -172,8 +172,23 @@ namespace Panels
|
|||
|
||||
public:
|
||||
virtual ~UsermodeSelectionPanel() { }
|
||||
UsermodeSelectionPanel( wxWindow* parent );
|
||||
|
||||
UsermodeSelectionPanel( wxWindow* parent, int idealWidth=wxDefaultCoord );
|
||||
|
||||
void Apply( AppConfig& conf );
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class LanguageSelectionPanel : public BaseApplicableConfigPanel
|
||||
{
|
||||
protected:
|
||||
LangPackList m_langs;
|
||||
wxComboBox* m_picker;
|
||||
|
||||
public:
|
||||
virtual ~LanguageSelectionPanel() { }
|
||||
LanguageSelectionPanel( wxWindow* parent, int idealWidth=wxDefaultCoord );
|
||||
|
||||
void Apply( AppConfig& conf );
|
||||
};
|
||||
|
||||
|
@ -181,15 +196,26 @@ namespace Panels
|
|||
//
|
||||
class SpeedHacksPanel : public BaseApplicableConfigPanel
|
||||
{
|
||||
protected:
|
||||
wxSlider* m_slider_eecycle;
|
||||
wxSlider* m_slider_vustealer;
|
||||
wxStaticText* m_msg_eecycle;
|
||||
wxStaticText* m_msg_vustealer;
|
||||
|
||||
wxCheckBox* m_check_intc;
|
||||
wxCheckBox* m_check_b1fc0;
|
||||
wxCheckBox* m_check_IOPx2;
|
||||
|
||||
public:
|
||||
SpeedHacksPanel(wxWindow& parent);
|
||||
SpeedHacksPanel( wxWindow& parent, int idealWidth );
|
||||
void Apply( AppConfig& conf );
|
||||
|
||||
protected:
|
||||
void IOPCycleDouble_Click(wxCommandEvent &event);
|
||||
void WaitCycleExt_Click(wxCommandEvent &event);
|
||||
void INTCSTATSlow_Click(wxCommandEvent &event);
|
||||
void IdleLoopFF_Click(wxCommandEvent &event);
|
||||
const wxChar* GetEEcycleSliderMsg( int val );
|
||||
const wxChar* GetVUcycleSliderMsg( int val );
|
||||
|
||||
void EECycleRate_Scroll(wxScrollEvent &event);
|
||||
void VUCycleRate_Scroll(wxScrollEvent &event);
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -197,15 +223,8 @@ namespace Panels
|
|||
class GameFixesPanel: public BaseApplicableConfigPanel
|
||||
{
|
||||
public:
|
||||
GameFixesPanel(wxWindow& parent);
|
||||
GameFixesPanel( wxWindow& parent, int idealWidth );
|
||||
void Apply( AppConfig& conf );
|
||||
|
||||
void FPUCompareHack_Click(wxCommandEvent &event);
|
||||
void FPUMultHack_Click(wxCommandEvent &event);
|
||||
void TriAce_Click(wxCommandEvent &event);
|
||||
void GodWar_Click(wxCommandEvent &event);
|
||||
void Ok_Click(wxCommandEvent &event);
|
||||
void Cancel_Click(wxCommandEvent &event);
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -235,27 +254,27 @@ namespace Panels
|
|||
wxBoxSizer& s_main;
|
||||
|
||||
public:
|
||||
MyBasePanel(wxWindow& parent, int id=wxID_ANY);
|
||||
MyBasePanel( wxWindow& parent, int idealWidth=wxDefaultCoord );
|
||||
|
||||
protected:
|
||||
void AddDirPicker( wxBoxSizer& sizer, FoldersEnum_t folderid, const wxString& label,
|
||||
const wxString& popupLabel, enum ExpandedMsgEnum tooltip );
|
||||
DirPickerPanel& AddDirPicker( wxBoxSizer& sizer, FoldersEnum_t folderid,
|
||||
const wxString& label, const wxString& popupLabel );
|
||||
};
|
||||
|
||||
class StandardPanel : public MyBasePanel
|
||||
{
|
||||
public:
|
||||
StandardPanel(wxWindow& parent, int id=wxID_ANY);
|
||||
StandardPanel( wxWindow& parent );
|
||||
};
|
||||
|
||||
class AdvancedPanel : public MyBasePanel
|
||||
{
|
||||
public:
|
||||
AdvancedPanel(wxWindow& parent, int id=wxID_ANY);
|
||||
AdvancedPanel( wxWindow& parent, int idealWidth );
|
||||
};
|
||||
|
||||
public:
|
||||
PathsPanel(wxWindow& parent);
|
||||
PathsPanel( wxWindow& parent, int idealWidth );
|
||||
void Apply( AppConfig& conf );
|
||||
};
|
||||
|
||||
|
@ -342,7 +361,7 @@ namespace Panels
|
|||
|
||||
public:
|
||||
virtual ~PluginSelectorPanel();
|
||||
PluginSelectorPanel(wxWindow& parent);
|
||||
PluginSelectorPanel( wxWindow& parent, int idealWidth );
|
||||
virtual void OnShow( wxShowEvent& evt );
|
||||
virtual void OnRefresh( wxCommandEvent& evt );
|
||||
virtual void OnProgress( wxCommandEvent& evt );
|
||||
|
|
|
@ -21,62 +21,31 @@
|
|||
|
||||
using namespace wxHelpers;
|
||||
|
||||
#define FLAG_VU_ADD_SUB 0x1 //Tri-Ace - IDC_GAMEFIX2
|
||||
#define FLAG_VU_CLIP 0x2 // Persona3/4 - IDC_GAMEFIX4
|
||||
#define FLAG_FPU_Compare 0x4 // Digimon Rumble Arena - IDC_GAMEFIX3
|
||||
#define FLAG_FPU_MUL 0x8 //Tales of Destiny - IDC_GAMEFIX5
|
||||
|
||||
Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent ) :
|
||||
BaseApplicableConfigPanel( &parent )
|
||||
Panels::GameFixesPanel::GameFixesPanel( wxWindow& parent, int idealWidth ) :
|
||||
BaseApplicableConfigPanel( &parent, idealWidth)
|
||||
{
|
||||
wxStaticText* label_Title = new wxStaticText(
|
||||
this, wxID_ANY, _T("Some games need special settings.\nConfigure them here."), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE
|
||||
);
|
||||
|
||||
wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
|
||||
AddStaticText( mainSizer, _("Some games need special settings.\nEnable them here."), wxALIGN_CENTRE );
|
||||
|
||||
wxStaticBoxSizer& groupSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("PCSX2 Gamefixes") );
|
||||
AddCheckBox( groupSizer, _("DMA Execution Hack - for Fatal Frame.") );
|
||||
AddCheckBox( groupSizer, _("FPU Compare Hack - for Digimon Rumble Arena 2.") );
|
||||
AddCheckBox( groupSizer, _("FPU Multiply Hack - for Tales of Destiny.") );
|
||||
AddCheckBox( groupSizer, _("VU Add Hack - for Tri-Ace games!") );
|
||||
AddCheckBox( groupSizer, _("VU XGkick Hack - for Erementar Gerad") );
|
||||
|
||||
AddCheckBox( groupSizer, _T("FPU Compare Hack - Special fix for Digimon Rumble Arena 2.") );
|
||||
AddCheckBox( groupSizer, _T("FPU Multiply Hack - Special fix for Tales of Destiny.") );
|
||||
AddCheckBox( groupSizer, _T("VU Add / Sub Hack - Special fix for Tri-Ace games!") );
|
||||
AddCheckBox( groupSizer, _T("VU Clip Hack - Special fix for God of War") );
|
||||
mainSizer.Add( &groupSizer, wxSizerFlags().Centre() );
|
||||
|
||||
mainSizer.Add( label_Title, SizerFlags::StdCenter() );
|
||||
mainSizer.Add( &groupSizer, SizerFlags::StdSpace() );
|
||||
AddStaticText( mainSizer, pxE( "Gamefixes Dialog:Compat Warning",
|
||||
L"Enabling game fixes can cause compatibility or performance issues in other games. You "
|
||||
L"will need to turn off fixes manually when changing games."
|
||||
), wxALIGN_CENTRE );
|
||||
|
||||
SetSizerAndFit( &mainSizer );
|
||||
|
||||
Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( GameFixesPanel::FPUCompareHack_Click ) );
|
||||
Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( GameFixesPanel::FPUMultHack_Click ) );
|
||||
Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( GameFixesPanel::TriAce_Click ) );
|
||||
Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( GameFixesPanel::GodWar_Click ) );
|
||||
}
|
||||
|
||||
void Panels::GameFixesPanel::Apply( AppConfig& conf )
|
||||
{
|
||||
}
|
||||
|
||||
void Panels::GameFixesPanel::FPUCompareHack_Click(wxCommandEvent &event)
|
||||
{
|
||||
//Config.GameFixes |= is_checked ? FLAG_FPU_Compare : 0;
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void Panels::GameFixesPanel::FPUMultHack_Click(wxCommandEvent &event)
|
||||
{
|
||||
//Config.GameFixes |= is_checked ? FLAG_FPU_MUL : 0;
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void Panels::GameFixesPanel::TriAce_Click(wxCommandEvent &event)
|
||||
{
|
||||
//Config.GameFixes |= is_checked ? FLAG_VU_ADD_SUB : 0;
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void Panels::GameFixesPanel::GodWar_Click(wxCommandEvent &event)
|
||||
{
|
||||
//Config.GameFixes |= is_checked ? FLAG_VU_CLIP : 0;
|
||||
event.Skip();
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
using namespace wxHelpers;
|
||||
|
||||
Panels::StaticApplyState Panels::g_ApplyState;
|
||||
|
||||
|
@ -83,8 +84,8 @@ bool Panels::StaticApplyState::ApplyAll()
|
|||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent ) :
|
||||
BaseApplicableConfigPanel( parent )
|
||||
Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent, int idealWidth ) :
|
||||
BaseApplicableConfigPanel( parent, idealWidth )
|
||||
, m_radio_user( NULL )
|
||||
, m_radio_cwd( NULL )
|
||||
{
|
||||
|
@ -93,9 +94,10 @@ Panels::UsermodeSelectionPanel::UsermodeSelectionPanel( wxWindow* parent ) :
|
|||
L"Please select your preferred default location for PCSX2 user-level documents below "
|
||||
L"(includes memory cards, screenshots, settings, and savestates). "
|
||||
L"These folder locations can be overridden at any time using the Core Settings panel.",
|
||||
480, wxALIGN_CENTRE );
|
||||
wxALIGN_CENTRE );
|
||||
|
||||
m_radio_user = &AddRadioButton( s_boxer, _("User Documents (recommended)"), _("Location: ") + wxStandardPaths::Get().GetDocumentsDir() );
|
||||
s_boxer.AddSpacer( 4 );
|
||||
m_radio_cwd = &AddRadioButton( s_boxer, _("Current working folder (intended for developer use only)"), _("Location: ") + wxGetCwd() );
|
||||
|
||||
s_boxer.AddSpacer( 4 );
|
||||
|
@ -108,3 +110,54 @@ void Panels::UsermodeSelectionPanel::Apply( AppConfig& conf )
|
|||
throw Exception::CannotApplySettings( this, wxLt( "You must select one of the available user modes before proceeding." ) );
|
||||
conf.UseAdminMode = m_radio_cwd->GetValue();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
Panels::LanguageSelectionPanel::LanguageSelectionPanel( wxWindow* parent, int idealWidth ) :
|
||||
BaseApplicableConfigPanel( parent, idealWidth )
|
||||
, m_langs()
|
||||
, m_picker( NULL )
|
||||
{
|
||||
i18n_EnumeratePackages( m_langs );
|
||||
|
||||
int size = m_langs.size();
|
||||
int cursel = 0;
|
||||
wxString* compiled = new wxString[size];
|
||||
wxString configLangName( wxLocale::GetLanguageName( wxLANGUAGE_DEFAULT ) );
|
||||
|
||||
for( int i=0; i<size; ++i )
|
||||
{
|
||||
compiled[i].Printf( L"%s", m_langs[i].englishName.c_str() ); //, xltNames[i].c_str() );
|
||||
if( m_langs[i].englishName == configLangName )
|
||||
cursel = i;
|
||||
}
|
||||
|
||||
m_picker = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||
size, compiled, wxCB_READONLY | wxCB_SORT );
|
||||
m_picker->SetSelection( cursel );
|
||||
|
||||
wxBoxSizer& s_lang = *new wxBoxSizer( wxHORIZONTAL );
|
||||
AddStaticText( s_lang, _("Select a language: "), wxALIGN_CENTRE_VERTICAL );
|
||||
s_lang.AddSpacer( 5 );
|
||||
s_lang.Add( m_picker, SizerFlags::StdSpace() );
|
||||
|
||||
SetSizerAndFit( &s_lang );
|
||||
}
|
||||
|
||||
void Panels::LanguageSelectionPanel::Apply( AppConfig& conf )
|
||||
{
|
||||
// The combo box's order is sorted and may not match our m_langs order, so
|
||||
// we have to do a string comparison to find a match:
|
||||
|
||||
wxString sel( m_picker->GetString( m_picker->GetSelection() ) );
|
||||
|
||||
conf.LanguageId = wxLANGUAGE_DEFAULT; // use this if no matches found
|
||||
int size = m_langs.size();
|
||||
for( int i=0; i<size; ++i )
|
||||
{
|
||||
if( m_langs[i].englishName == sel )
|
||||
{
|
||||
conf.LanguageId = m_langs[i].wxLangId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ void Panels::PathsPanel::DirPickerPanel::UseDefaultPath_Click(wxCommandEvent &ev
|
|||
//
|
||||
Panels::PathsPanel::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnum_t folderid,
|
||||
const wxString& label, const wxString& dialogLabel ) :
|
||||
BaseApplicableConfigPanel( parent )
|
||||
BaseApplicableConfigPanel( parent, wxDefaultCoord )
|
||||
, m_FolderId( folderid )
|
||||
{
|
||||
const bool isDefault = g_Conf->Folders.IsDefault( m_FolderId );
|
||||
|
@ -73,93 +73,123 @@ Panels::PathsPanel::DirPickerPanel::DirPickerPanel( wxWindow* parent, FoldersEnu
|
|||
|
||||
void Panels::PathsPanel::DirPickerPanel::Apply( AppConfig& conf )
|
||||
{
|
||||
throw Exception::CannotApplySettings( this );
|
||||
conf.Folders.Set( m_FolderId, m_pickerCtrl->GetPath(), m_checkCtrl->GetValue() );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
Panels::PathsPanel::MyBasePanel::MyBasePanel( wxWindow& parent, int id ) :
|
||||
wxPanelWithHelpers( &parent, id )
|
||||
Panels::PathsPanel::MyBasePanel::MyBasePanel( wxWindow& parent, int idealWidth ) :
|
||||
wxPanelWithHelpers( &parent, idealWidth-12 )
|
||||
, s_main( *new wxBoxSizer( wxVERTICAL ) )
|
||||
{
|
||||
}
|
||||
|
||||
void Panels::PathsPanel::MyBasePanel::AddDirPicker( wxBoxSizer& sizer, FoldersEnum_t folderid, const wxString& label, const wxString& popupLabel, ExpandedMsgEnum tooltip )
|
||||
Panels::PathsPanel::DirPickerPanel& Panels::PathsPanel::MyBasePanel::AddDirPicker( wxBoxSizer& sizer,
|
||||
FoldersEnum_t folderid, const wxString& label, const wxString& popupLabel )
|
||||
{
|
||||
DirPickerPanel* dpan = new DirPickerPanel( this, folderid, label, popupLabel );
|
||||
dpan->SetToolTip( pxE(tooltip) );
|
||||
sizer.Add( dpan, SizerFlags::StdGroupie() );
|
||||
sizer.Add( dpan, SizerFlags::SubGroup() );
|
||||
return *dpan;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
Panels::PathsPanel::StandardPanel::StandardPanel( wxWindow& parent, int id ) :
|
||||
MyBasePanel( parent, id )
|
||||
Panels::PathsPanel::StandardPanel::StandardPanel( wxWindow& parent ) :
|
||||
MyBasePanel( parent )
|
||||
{
|
||||
// TODO : Replace the callback mess here with the new FolderId enumeration setup. :)
|
||||
|
||||
AddDirPicker( s_main, FolderId_Bios,
|
||||
_("Bios:"),
|
||||
_("Select folder with PS2 Bios"), Msg_Tooltips_Bios );
|
||||
_("Select folder with PS2 Bios") ).
|
||||
SetToolTip( pxE( "Setting Tooltip:Bios Folder",
|
||||
L"This folder is where PCSX2 looks to find PS2 bios files. The actual bios used can be "
|
||||
L"selected from the CPU dialog."
|
||||
) );
|
||||
|
||||
s_main.AddSpacer( BetweenFolderSpace );
|
||||
AddDirPicker( s_main, FolderId_Savestates,
|
||||
_("Savestates:"),
|
||||
_("Select folder for Savestates"), Msg_Tooltips_Savestates );
|
||||
_("Select folder for Savestates") ).
|
||||
SetToolTip( pxE( "Setting Tooltip:Savestates Folder",
|
||||
L"This folder is where PCSX2 records savestates; which are recorded either by using "
|
||||
L"menus/toolbars, or by pressing F1/F3 (load/save)."
|
||||
) );
|
||||
|
||||
s_main.AddSpacer( BetweenFolderSpace );
|
||||
AddDirPicker( s_main, FolderId_Snapshots,
|
||||
_("Snapshots:"),
|
||||
_("Select a folder for Snapshots"), Msg_Tooltips_Snapshots );
|
||||
_("Select a folder for Snapshots") ).
|
||||
SetToolTip( pxE( "Setting Tooltip:Snapshots Folder",
|
||||
L"This folder is where PCSX2 saves screenshots. Actual screenshot image format and style "
|
||||
L"may vary depending on the GS plugin being used."
|
||||
) );
|
||||
|
||||
s_main.AddSpacer( BetweenFolderSpace );
|
||||
AddDirPicker( s_main, FolderId_Logs,
|
||||
_("Logs/Dumps:" ),
|
||||
_("Select a folder for logs/dumps"), Msg_Tooltips_Logs );
|
||||
_("Select a folder for logs/dumps") ).
|
||||
SetToolTip( pxE( "Setting Tooltip:Logs Folder",
|
||||
L"This folder is where PCSX2 saves its logfiles and diagnostic dumps. Most plugins will "
|
||||
L"also adhere to this folder, however some older plugins may ignore it."
|
||||
) );
|
||||
|
||||
s_main.AddSpacer( BetweenFolderSpace );
|
||||
AddDirPicker( s_main, FolderId_MemoryCards,
|
||||
_("Memorycards:"),
|
||||
_("Select a default Memorycards folder"), Msg_Tooltips_Memorycards );
|
||||
_("Select a default Memorycards folder") ).
|
||||
SetToolTip( pxE( "Setting Tooltip:Memorycards Folder",
|
||||
L"This is the default path where PCSX2 loads or creates its memory cards, and can be "
|
||||
L"overridden in the MemoryCard Configuration by using absolute filenames."
|
||||
) );
|
||||
|
||||
s_main.AddSpacer( 5 );
|
||||
SetSizerAndFit( &s_main );
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
Panels::PathsPanel::AdvancedPanel::AdvancedPanel( wxWindow& parent, int id ) :
|
||||
MyBasePanel( parent, id )
|
||||
Panels::PathsPanel::AdvancedPanel::AdvancedPanel( wxWindow& parent, int idealWidth ) :
|
||||
MyBasePanel( parent, idealWidth-9 )
|
||||
{
|
||||
wxStaticBoxSizer& advanced = *new wxStaticBoxSizer( wxVERTICAL, this, _("Advanced") );
|
||||
AddStaticText( advanced, pxE(Msg_Dialog_AdvancedPaths), 420, wxALIGN_CENTRE );
|
||||
AddStaticText( advanced, pxE( "Settings Dialog:Advanced Paths",
|
||||
L"Warning!! These advanced options are provided for developers and advanced testers only. "
|
||||
L"Changing these settings can cause program errors, so please be weary."
|
||||
), wxALIGN_CENTRE );
|
||||
|
||||
AddDirPicker( advanced, FolderId_Plugins,
|
||||
_("Plugins:"),
|
||||
_("Select folder for PCSX2 plugins"), Msg_Tooltips_PluginsPath );
|
||||
_("Select folder for PCSX2 plugins") ).
|
||||
SetToolTip( pxE( "Setting Tooltip:Plugins Path",
|
||||
L"This is the location where PCSX2 will expect to find its plugins. Plugins found in this folder "
|
||||
L"will be enumerated and are selectable from the Plugins panel."
|
||||
) );
|
||||
|
||||
advanced.AddSpacer( BetweenFolderSpace );
|
||||
AddDirPicker( advanced, FolderId_Settings,
|
||||
_("Settings:"),
|
||||
_("Select a folder for PCSX2 settings/inis"), Msg_Tooltips_SettingsPath );
|
||||
_("Select a folder for PCSX2 settings/inis") ).
|
||||
SetToolTip( pxE( "Settings Tooltip:Settings Path",
|
||||
L"This is the folder where PCSX2 saves all settings, including settings generated "
|
||||
L"by most plugins.\n\nWarning: Some older versions of plugins may not respect this value."
|
||||
) );
|
||||
|
||||
advanced.AddSpacer( 4 );
|
||||
advanced.Add( new UsermodeSelectionPanel( this ), SizerFlags::StdGroupie() );
|
||||
advanced.Add( new UsermodeSelectionPanel( this, GetIdealWidth()-9 ), SizerFlags::SubGroup() );
|
||||
|
||||
s_main.Add( &advanced, SizerFlags::StdGroupie() );
|
||||
s_main.Add( &advanced, SizerFlags::SubGroup() );
|
||||
s_main.AddSpacer( 5 );
|
||||
|
||||
SetSizerAndFit( &s_main );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
Panels::PathsPanel::PathsPanel( wxWindow& parent ) :
|
||||
BaseApplicableConfigPanel( &parent )
|
||||
Panels::PathsPanel::PathsPanel( wxWindow& parent, int idealWidth ) :
|
||||
BaseApplicableConfigPanel( &parent, idealWidth )
|
||||
{
|
||||
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
|
||||
wxNotebook& notebook = *new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_BOTTOM | wxNB_FIXEDWIDTH );
|
||||
|
||||
notebook.AddPage( new StandardPanel( notebook ), _("Standard") );
|
||||
notebook.AddPage( new AdvancedPanel( notebook ), _("Advanced") );
|
||||
notebook.AddPage( new AdvancedPanel( notebook, GetIdealWidth() ), _("Advanced") );
|
||||
|
||||
s_main.Add( ¬ebook, SizerFlags::StdSpace() );
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ DECLARE_EVENT_TYPE(wxEVT_EnumeratedNext, -1)
|
|||
DECLARE_EVENT_TYPE(wxEVT_EnumerationFinished, -1)
|
||||
|
||||
DEFINE_EVENT_TYPE(wxEVT_EnumeratedNext)
|
||||
DEFINE_EVENT_TYPE(wxEVT_EnumerationFinished)
|
||||
DEFINE_EVENT_TYPE(wxEVT_EnumerationFinished);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -158,7 +158,7 @@ Panels::PluginSelectorPanel::StatusPanel::StatusPanel( wxWindow* parent, int plu
|
|||
{
|
||||
wxBoxSizer& s_main = *new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
AddStaticText( s_main, _( "Enumerating available plugins..." ), 0, wxALIGN_CENTRE );
|
||||
AddStaticText( s_main, _( "Enumerating available plugins..." ), wxALIGN_CENTRE );
|
||||
s_main.Add( &m_gauge, wxSizerFlags().Expand().Border( wxLEFT | wxRIGHT, 32 ) );
|
||||
s_main.Add( &m_label, SizerFlags::StdExpand() );
|
||||
|
||||
|
@ -208,8 +208,8 @@ void Panels::PluginSelectorPanel::ComboBoxPanel::Reset()
|
|||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow& parent ) :
|
||||
BaseApplicableConfigPanel( &parent )
|
||||
Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow& parent, int idealWidth ) :
|
||||
BaseApplicableConfigPanel( &parent, idealWidth )
|
||||
, m_FileList()
|
||||
, m_StatusPanel( *new StatusPanel( this,
|
||||
wxDir::GetAllFiles( g_Conf->Folders.Plugins.ToString(), &m_FileList, wxsFormat( L"*%s", wxDynamicLibrary::GetDllExt()), wxDIR_FILES )
|
||||
|
@ -223,7 +223,7 @@ Panels::PluginSelectorPanel::PluginSelectorPanel( wxWindow& parent ) :
|
|||
s_main.Add( &m_ComboBoxes, SizerFlags::StdExpand().ReserveSpaceEvenIfHidden() );
|
||||
|
||||
s_main.AddSpacer( 4 );
|
||||
AddStaticText( s_main, _("Tip: Any installed plugins that are not compatible with your hardware or operating system will be listed below a separator."), 388, wxALIGN_CENTRE );
|
||||
AddStaticText( s_main, _("Tip: Installed plugins that are not compatible with your hardware or operating system will be listed below a separator."), wxALIGN_CENTRE );
|
||||
s_main.AddSpacer( 4 );
|
||||
|
||||
s_main.Add( &m_StatusPanel, SizerFlags::StdExpand().ReserveSpaceEvenIfHidden() );
|
||||
|
@ -315,8 +315,11 @@ void Panels::PluginSelectorPanel::OnEnumComplete( wxCommandEvent& evt )
|
|||
|
||||
if( emptyBoxes > 0 )
|
||||
{
|
||||
wxMessageBox( pxE( Msg_Popup_MissingPlugins),
|
||||
_("PCSX2 Error - Plugin components not found") );
|
||||
wxMessageBox( pxE( "Popup Error:Missing Plugins",
|
||||
L"Critical Error: A valid plugin for one or more components of PCSX2 could not be found. "
|
||||
L"Your installation of PCSX2 is incomplete, and will be unable to run games."),
|
||||
_("PCSX2 Error - Plugin components not found")
|
||||
);
|
||||
}
|
||||
|
||||
m_ComboBoxes.Show();
|
||||
|
|
|
@ -24,83 +24,186 @@
|
|||
|
||||
using namespace wxHelpers;
|
||||
|
||||
Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent ) :
|
||||
BaseApplicableConfigPanel( &parent )
|
||||
static int pxGetTextHeight( const wxWindow* wind, int rows )
|
||||
{
|
||||
wxClientDC dc(wx_const_cast(wxWindow *, wind));
|
||||
dc.SetFont( wind->GetFont() );
|
||||
return (dc.GetCharHeight() + 1 ) * rows;
|
||||
}
|
||||
|
||||
const wxChar* Panels::SpeedHacksPanel::GetEEcycleSliderMsg( int val )
|
||||
{
|
||||
switch( val )
|
||||
{
|
||||
case 1:
|
||||
return pxE( ":Panels:Speedhacks:EECycleX1",
|
||||
L"1 - Default cyclerate. This closely matches the actual speed of a real PS2 EmotionEngine."
|
||||
);
|
||||
|
||||
case 2:
|
||||
return pxE( ":Panels:Speedhacks:EECycleX2",
|
||||
L"2 - Reduces the EE's cyclerate by about 33%. Mild speedup for most games with high compatibility."
|
||||
);
|
||||
|
||||
case 3:
|
||||
return pxE( ":Panels:Speedhacks:EECycleX3",
|
||||
L"3 - Reduces the EE's cyclerate by about 50%. Moderate speedup, but *will* cause studdering "
|
||||
L"audio on many FMVs."
|
||||
);
|
||||
|
||||
jNO_DEFAULT
|
||||
}
|
||||
|
||||
return L"Unreachable Warning Suppressor!!";
|
||||
}
|
||||
|
||||
const wxChar* Panels::SpeedHacksPanel::GetVUcycleSliderMsg( int val )
|
||||
{
|
||||
switch( val )
|
||||
{
|
||||
case 0:
|
||||
return pxE( ":Panels:Speedhacks:VUCycleStealOff",
|
||||
L"0 - Disables VU Cycle Stealing. Most compatible setting!"
|
||||
);
|
||||
|
||||
case 1:
|
||||
return pxE( ":Panels:Speedhacks:VUCycleSteal1",
|
||||
L"1 - Mild VU Cycle Stealing. High compatibility with some speedup for most games."
|
||||
);
|
||||
|
||||
case 2:
|
||||
return pxE( ":Panels:Speedhacks:VUCycleSteal2",
|
||||
L"2 - Moderate VU Cycle Stealing. Moderate compatibility with significant speedups in some games."
|
||||
);
|
||||
|
||||
case 3:
|
||||
// TODO: Mention specific games that benefit from this setting here.
|
||||
return pxE( ":Panels:Speedhacks:VUCycleSteal3",
|
||||
L"3 - Maximum VU Cycle Stealing. Usefulness is limited, as this will cause flickering "
|
||||
L"visuals or slowdown in most games."
|
||||
);
|
||||
|
||||
jNO_DEFAULT
|
||||
}
|
||||
|
||||
return L"Unreachable Warning Suppressor!!";
|
||||
}
|
||||
|
||||
Panels::SpeedHacksPanel::SpeedHacksPanel( wxWindow& parent, int idealWidth ) :
|
||||
BaseApplicableConfigPanel( &parent, idealWidth )
|
||||
{
|
||||
wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
|
||||
wxFlexGridSizer& cycleHacksSizer = *new wxFlexGridSizer( 2 );
|
||||
|
||||
cycleHacksSizer.AddGrowableCol( 0, 1 );
|
||||
cycleHacksSizer.AddGrowableCol( 1, 1 );
|
||||
|
||||
wxStaticBoxSizer& sliderSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("Cycle Hacks") );
|
||||
wxStaticBoxSizer& miscSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("Misc Speed Hacks") );
|
||||
wxStaticBoxSizer& cyclerateSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("EE Cyclerate") );
|
||||
wxStaticBoxSizer& stealerSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("VU Cycle Stealing") );
|
||||
wxStaticBoxSizer& miscSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("Other Hacks") );
|
||||
|
||||
wxStaticText* label_Title = new wxStaticText(
|
||||
this, wxID_ANY,
|
||||
L"These hacks will affect the speed of PCSX2, but compromise compatibility.\n"
|
||||
L"If you have issues, disable all of these and try again.",
|
||||
wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE
|
||||
AddStaticText( mainSizer, pxE( ":Panels:Speedhacks:Overview",
|
||||
L"These hacks will usually improve the speed of PCSX2 emulation, but compromise compatibility. "
|
||||
L"If you have issues, always try disabling these hacks first."
|
||||
), wxALIGN_CENTRE );
|
||||
|
||||
const wxChar* tooltip; // needed because we duplicate tooltips across multiple controls.
|
||||
const wxSizerFlags sliderFlags( wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() );
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// EE Cyclerate Hack Section:
|
||||
|
||||
m_slider_eecycle = new wxSlider( this, wxID_ANY, g_Conf->Speedhacks.EECycleRate+1, 1, 3,
|
||||
wxDefaultPosition, wxDefaultSize, wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS );
|
||||
|
||||
tooltip = pxE( ":Tooltips:Speedhacks:EECycleRate Slider",
|
||||
L"Setting higher values on this slider effectively reduces the clock speed of the EmotionEngine's "
|
||||
L"R5900 core cpu, and typically brings big speedups to games that fail to utilize "
|
||||
L"the full potential of the real PS2 hardware."
|
||||
);
|
||||
|
||||
cyclerateSizer.Add( m_slider_eecycle, sliderFlags );
|
||||
m_msg_eecycle = &AddStaticText( cyclerateSizer, GetEEcycleSliderMsg( g_Conf->Speedhacks.EECycleRate+1 ), wxALIGN_CENTRE, (GetIdealWidth()-24)/2 );
|
||||
m_msg_eecycle->SetForegroundColour( wxColour( L"Red" ) );
|
||||
m_msg_eecycle->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_eecycle, 4) ) );
|
||||
|
||||
mainSizer.Add( label_Title, SizerFlags::StdCenter() );
|
||||
m_slider_eecycle->SetToolTip( tooltip );
|
||||
m_msg_eecycle->SetToolTip( tooltip );
|
||||
|
||||
wxSlider* vuScale = new wxSlider(this, wxID_ANY, Config.Hacks.VUCycleSteal, 0, 4 );
|
||||
wxSlider* eeScale = new wxSlider(this, wxID_ANY, Config.Hacks.EECycleRate, 0, 2);
|
||||
// ------------------------------------------------------------------------
|
||||
// VU Cycle Stealing Hack Section:
|
||||
|
||||
AddStaticText(sliderSizer, _T("EE Cycle"));
|
||||
sliderSizer.Add( eeScale, wxEXPAND );
|
||||
AddStaticText(sliderSizer, _T("Placeholder text for EE scale position."));
|
||||
m_slider_vustealer = new wxSlider( this, wxID_ANY, g_Conf->Speedhacks.VUCycleSteal, 0, 4, wxDefaultPosition, wxDefaultSize,
|
||||
wxHORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS );
|
||||
|
||||
AddStaticText(sliderSizer, _T("VU Cycle"));
|
||||
sliderSizer.Add( vuScale, wxEXPAND );
|
||||
AddStaticText(sliderSizer, _T("Placeholder text for VU scale position."));
|
||||
tooltip = pxE( ":Tooltips:Speedhacks:VUCycleStealing Slider",
|
||||
L"This slider controls the amount of cycles the VU unit steals from the EmotionEngine. Higher values increase the number of "
|
||||
L"cycles stolen from the EE for each VU microprogram the game runs."
|
||||
);
|
||||
// Misc help text that I might find a home for later:
|
||||
// Cycle stealing works by 'fast-forwarding' the EE by an arbitrary number of cycles whenever VU1 micro-programs
|
||||
// are run, which works as a rough-guess skipping of what would normally be idle time spent running on the EE.
|
||||
|
||||
stealerSizer.Add( m_slider_vustealer, wxSizerFlags().Border( wxLEFT | wxRIGHT, 8 ).Expand() );
|
||||
m_msg_vustealer = &AddStaticText(stealerSizer, GetVUcycleSliderMsg( g_Conf->Speedhacks.VUCycleSteal ), wxALIGN_CENTRE, (GetIdealWidth()-24)/2 );
|
||||
m_msg_vustealer->SetForegroundColour( wxColour( L"Red" ) );
|
||||
m_msg_vustealer->SetSizeHints( wxSize( wxDefaultCoord, pxGetTextHeight(m_msg_vustealer, 4) ) );
|
||||
|
||||
AddCheckBox(miscSizer, _T("Enable IOP x2 Cycle rate"));
|
||||
AddStaticText(miscSizer, _T(" Small Speedup, and works well with most games."), 400);
|
||||
m_slider_vustealer->SetToolTip( tooltip );
|
||||
m_msg_vustealer->SetToolTip( tooltip );
|
||||
|
||||
AddCheckBox(miscSizer, _T("WaitCycles Sync Hack") );
|
||||
AddStaticText(miscSizer, _T(" Small Speedup. Works well with most games, but it may cause certain games to crash, or freeze up during bootup or stage changes."), 400);
|
||||
// ------------------------------------------------------------------------
|
||||
// All other hacks Section:
|
||||
|
||||
AddCheckBox(miscSizer, _T("INTC Sync Hack") );
|
||||
AddStaticText(miscSizer, _T(" Huge speedup in many games, and a pretty high compatability rate (some games still work better with EE sync hacks)."), 400);
|
||||
m_check_intc = &AddCheckBox(miscSizer, _("Enable INTC Spin Detection"),
|
||||
_("Huge speedup for some games, with almost no compatibility side effects. [Recommended]"),
|
||||
pxE( ":Tooltips:Speedhacks:INTC",
|
||||
L"This hack works best for games that use the INTC Status register to wait for vsyncs, which includes primarily non-3D "
|
||||
L"RPG titles. Games that do not use this method of vsync will see little or no speeup from this hack."
|
||||
) );
|
||||
|
||||
AddCheckBox(miscSizer, _T("Idle Loop Fast-Forward (experimental)") );
|
||||
AddStaticText(miscSizer, _T(" Speedup for a few games, including FFX with no known side effects. More later."), 400);
|
||||
m_check_b1fc0 = &AddCheckBox(miscSizer, _("Enable BIFC0 Spin Detection"),
|
||||
_("Moderate speedup for some games, with no known side effects. [Recommended]" ),
|
||||
pxE( ":Tooltips:Speedhacks:BIFC0",
|
||||
L"This hack works especially well for Final Fantasy X and Kingdom Hearts. BIFC0 is the address of a specific block of "
|
||||
L"code in the EE kernel that's run repeatedly when the EE is waiting for the IOP to complete a task. This hack detects "
|
||||
L"that and responds by fast-forwarding the EE until the IOP signals that the task is complete."
|
||||
) );
|
||||
|
||||
//secondarySizer.Add( &sliderSizer, wxEXPAND );
|
||||
//secondarySizer.Add( &miscSizer, wxEXPAND );
|
||||
//mainSizer.Add( &secondarySizer, stdCenteredFlags );
|
||||
mainSizer.Add( &sliderSizer, wxEXPAND );
|
||||
mainSizer.Add( &miscSizer, wxEXPAND );
|
||||
m_check_IOPx2 = &AddCheckBox(miscSizer, _("IOP x2 cycle rate hack"),
|
||||
_("Small Speedup and works well with most games; may cause some games to hang during startup."),
|
||||
pxE( ":Tooltips:Speedhacks:IOPx2",
|
||||
L"Halves the cycle rate of the IOP, giving it an effective emulated speed of roughly 18 MHz. "
|
||||
L"The speedup is very minor, so this hack is generally not recommended."
|
||||
) );
|
||||
|
||||
cycleHacksSizer.Add( &cyclerateSizer, SizerFlags::TopLevelBox() );
|
||||
cycleHacksSizer.Add( &stealerSizer, SizerFlags::TopLevelBox() );
|
||||
|
||||
mainSizer.Add( &cycleHacksSizer, wxSizerFlags().Expand() );
|
||||
mainSizer.Add( &miscSizer, SizerFlags::TopLevelBox() );
|
||||
SetSizerAndFit( &mainSizer );
|
||||
|
||||
Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SpeedHacksPanel::IOPCycleDouble_Click ) );
|
||||
Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SpeedHacksPanel::WaitCycleExt_Click ) );
|
||||
Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SpeedHacksPanel::INTCSTATSlow_Click ) );
|
||||
Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( SpeedHacksPanel::IdleLoopFF_Click ) );
|
||||
Connect( m_slider_eecycle->GetId(), wxEVT_SCROLL_CHANGED, wxScrollEventHandler( SpeedHacksPanel::EECycleRate_Scroll ) );
|
||||
Connect( m_slider_vustealer->GetId(), wxEVT_SCROLL_CHANGED, wxScrollEventHandler( SpeedHacksPanel::VUCycleRate_Scroll ) );
|
||||
}
|
||||
|
||||
void Panels::SpeedHacksPanel::Apply( AppConfig& conf )
|
||||
{
|
||||
conf.Speedhacks.EECycleRate = m_slider_eecycle->GetValue()-1;
|
||||
conf.Speedhacks.VUCycleSteal = m_slider_vustealer->GetValue();
|
||||
|
||||
conf.Speedhacks.BIFC0 = m_check_b1fc0->GetValue();
|
||||
conf.Speedhacks.IopCycleRate_X2 = m_check_IOPx2->GetValue();
|
||||
conf.Speedhacks.IntcStat = m_check_intc->GetValue();
|
||||
}
|
||||
|
||||
void Panels::SpeedHacksPanel::IOPCycleDouble_Click(wxCommandEvent &event)
|
||||
void Panels::SpeedHacksPanel::EECycleRate_Scroll(wxScrollEvent &event)
|
||||
{
|
||||
//Config.Hacks.IOPCycleDouble = if it is clicked.
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void Panels::SpeedHacksPanel::WaitCycleExt_Click(wxCommandEvent &event)
|
||||
void Panels::SpeedHacksPanel::VUCycleRate_Scroll(wxScrollEvent &event)
|
||||
{
|
||||
//Config.Hacks.WaitCycleExt = if it is clicked.
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void Panels::SpeedHacksPanel::INTCSTATSlow_Click(wxCommandEvent &event)
|
||||
{
|
||||
//Config.Hacks.INTCSTATSlow = if it is clicked.
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void Panels::SpeedHacksPanel::IdleLoopFF_Click(wxCommandEvent &event)
|
||||
{
|
||||
//Config.Hacks.IdleLoopFF = if it is clicked.
|
||||
event.Skip();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 16 KiB |
|
@ -18,115 +18,54 @@
|
|||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "i18n.h"
|
||||
#include "HashMap.h"
|
||||
|
||||
#include "Utilities/SafeArray.h"
|
||||
|
||||
|
||||
using namespace HashTools;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Notes to Translators:
|
||||
// * The first line of each entry consists of an enumerated index (used internally), and
|
||||
// the gettext lookup string (which you'll find in the PO data). The resulting translation
|
||||
// should match the text underneath.
|
||||
//
|
||||
// * Text marked as Tooltips are usually tertiary information that is not critical to PCSX2
|
||||
// use, and translations are not required.
|
||||
//
|
||||
const EnglishExpansionEntry m_tbl_English[] =
|
||||
{
|
||||
{ Msg_Dialog_AdvancedPaths, wxLt(L"Settings Dialog:Advanced Paths"),
|
||||
L"Warning!! These advanced options are provided for developers and advanced testers only. "
|
||||
L"Changing these settings can cause program errors, so please be weary."
|
||||
},
|
||||
|
||||
{ Msg_Tooltips_SettingsPath, wxLt(L"Settings Tooltip:Settings Path"),
|
||||
L"This is the folder where PCSX2 saves all settings, including settings generated "
|
||||
L"by most plugins.\n\nWarning: Some older versions of plugins may not respect this value."
|
||||
},
|
||||
|
||||
{ Msg_Popup_MissingPlugins, wxLt(L"Popup Error:Missing Plugins"),
|
||||
L"Critical Error: A valid plugin for one or more components of PCSX2 could not be found. "
|
||||
L"Your installation of PCSX2 is incomplete, and will be unable to run games."
|
||||
},
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Begin Tooltips Section
|
||||
// (All following texts are non-critical for a functional PCSX2 translation).
|
||||
|
||||
{ Msg_Tooltips_PluginsPath, wxLt(L"Setting Tooltip:Plugins Path"),
|
||||
L"This is the location where PCSX2 will expect to find its plugins. Plugins found in this folder "
|
||||
L"will be enumerated and are selectable from the Plugins panel."
|
||||
},
|
||||
|
||||
{ Msg_Tooltips_Savestates, wxLt(L"Setting Tooltip:Savestates Folder"),
|
||||
L"This folder is where PCSX2 records savestates; which are recorded either by using "
|
||||
L"menus/toolbars, or by pressing F1/F3 (load/save)."
|
||||
},
|
||||
|
||||
{ Msg_Tooltips_Snapshots, wxLt(L"Setting Tooltip:Snapshots Folder"),
|
||||
L"This folder is where PCSX2 saves screenshots. Actual screenshot image format and style "
|
||||
L"may vary depending on the GS plugin being used."
|
||||
},
|
||||
|
||||
{ Msg_Tooltips_Bios, wxLt(L"Setting Tooltip:Bios Folder"),
|
||||
L"This folder is where PCSX2 looks to find PS2 bios files. The actual bios used can be "
|
||||
L"selected from the CPU dialog."
|
||||
},
|
||||
|
||||
{ Msg_Tooltips_Logs, wxLt(L"Setting Tooltip:Logs Folder"),
|
||||
L"This folder is where PCSX2 saves its logfiles and diagnostic dumps. Most plugins will "
|
||||
L"also adhere to this folder, however some older plugins may ignore it."
|
||||
},
|
||||
|
||||
{ Msg_Tooltips_Memorycards, wxLt(L"Setting Tooltip:Memorycards Folder"),
|
||||
L"This is the default path where PCSX2 loads or creates its memory cards, and can be "
|
||||
L"overridden in the MemoryCard Configuration by using absolute filenames."
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
C_ASSERT( ArraySize( m_tbl_English ) == ExpandedMsg_Count );
|
||||
|
||||
static HashMap<int,HashedExpansionPair> m_EnglishExpansions( -1, 0xcdcdcd, ArraySize( m_tbl_English ) );
|
||||
|
||||
static bool IsEnglish( int id )
|
||||
{
|
||||
return ( id == wxLANGUAGE_ENGLISH || id == wxLANGUAGE_ENGLISH_US );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Builds an internal hashtable for English iconized description lookups.
|
||||
//
|
||||
void i18n_InitPlainEnglish()
|
||||
LangPackEnumeration::LangPackEnumeration( wxLanguage langId ) :
|
||||
wxLangId( langId )
|
||||
, englishName( wxLocale::GetLanguageName( wxLangId ) )
|
||||
, xlatedName( IsEnglish( wxLangId ) ? wxEmptyString : wxGetTranslation( L"NativeName" ) )
|
||||
{
|
||||
static bool IsInitialized = false;
|
||||
|
||||
IsInitialized = true;
|
||||
for( int i=0; i<ExpandedMsg_Count; ++i )
|
||||
{
|
||||
HashedExpansionPair silly = { m_tbl_English[i].gettextKey, m_tbl_English[i].Expanded };
|
||||
m_EnglishExpansions[m_tbl_English[i].Key] = silly;
|
||||
}
|
||||
}
|
||||
|
||||
LangPackEnumeration::LangPackEnumeration() :
|
||||
wxLangId( wxLANGUAGE_DEFAULT )
|
||||
, englishName( L" System Default" ) // left-side space forces it to sort to the front of the lists
|
||||
, xlatedName()
|
||||
{
|
||||
int sysLang( wxLocale::GetSystemLanguage() );
|
||||
if( sysLang != wxLANGUAGE_UNKNOWN )
|
||||
englishName += L" [" + wxLocale::GetLanguageName( sysLang ) + L"]";
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
//
|
||||
static void i18n_DoPackageCheck( int wxLangId, wxArrayString& destEng, wxArrayString& destTrans )
|
||||
static void i18n_DoPackageCheck( wxLanguage wxLangId, LangPackList& langs )
|
||||
{
|
||||
// Note: wx auto-preserves the current locale for us
|
||||
// Plain english is a special case that's built in, and we only want it added to the list
|
||||
// once, so we check for wxLANGUAGE_ENGLISH and then ignore other IsEnglish ids below.
|
||||
if( wxLangId == wxLANGUAGE_ENGLISH )
|
||||
langs.push_back( LangPackEnumeration( wxLangId ) );
|
||||
|
||||
if( IsEnglish( wxLangId ) ) return;
|
||||
|
||||
// Note: wx auto-preserves the current locale for us
|
||||
if( !wxLocale::IsAvailable( wxLangId ) ) return;
|
||||
wxLocale* locale = new wxLocale( wxLangId, wxLOCALE_CONV_ENCODING );
|
||||
|
||||
if( locale->IsOk() && locale->AddCatalog( L"pcsx2ident" ) )
|
||||
{
|
||||
// Should be a valid language, so add it to the list.
|
||||
// Force the msgIdLanguage param to wxLANGUAGE_UNKNOWN to disable wx's automatic english
|
||||
// matching logic, which will bypass the catalog loader for all english-based dialects, and
|
||||
// (wrongly) enumerate a bunch of locales that don't actually exist.
|
||||
|
||||
if( locale->IsOk() && locale->AddCatalog( L"pcsx2ident", wxLANGUAGE_UNKNOWN, NULL ) )
|
||||
langs.push_back( LangPackEnumeration( wxLangId ) );
|
||||
|
||||
destEng.Add( wxLocale::GetLanguageName( wxLangId ) );
|
||||
destTrans.Add( wxGetTranslation( L"NativeName" ) );
|
||||
}
|
||||
delete locale;
|
||||
}
|
||||
|
||||
|
@ -139,15 +78,18 @@ static void i18n_DoPackageCheck( int wxLangId, wxArrayString& destEng, wxArraySt
|
|||
// database. Anything which hasn't been installed will fail to load.
|
||||
//
|
||||
// Because loading and hashing the entire pcsx2 translation for every possible language would
|
||||
// assinine and slow, I've decided to use a two-file translation system. One file is very
|
||||
// small and simply contains the name of the language in the language native. The second file
|
||||
// is loaded only if the user picks it (or if it's the default language of the OS).
|
||||
// assinine and slow, I've decided to use a two-file translation system. One file (pcsx2ident.mo)
|
||||
// is very small and simply contains the name of the language in the language native. The
|
||||
// second file (pcsx2.mo) is loaded only if the user picks the language (or if it's the default
|
||||
// language of the user's OS installation).
|
||||
//
|
||||
void i18n_EnumeratePackages( wxArrayString& englishNames, wxArrayString& xlatedNames)
|
||||
void i18n_EnumeratePackages( LangPackList& langs )
|
||||
{
|
||||
langs.push_back( LangPackEnumeration() );
|
||||
|
||||
for( int li=wxLANGUAGE_UNKNOWN+1; li<wxLANGUAGE_USER_DEFINED; ++li )
|
||||
{
|
||||
i18n_DoPackageCheck( li, englishNames, xlatedNames );
|
||||
i18n_DoPackageCheck( (wxLanguage)li, langs );
|
||||
}
|
||||
|
||||
// Brilliant. Because someone in the wx world didn't think to move wxLANGUAGE_USER_DEFINED
|
||||
|
@ -174,18 +116,16 @@ void i18n_EnumeratePackages( wxArrayString& englishNames, wxArrayString& xlatedN
|
|||
// (without this second pass many tooltips would just show up as "Savestate Tooltip" instead
|
||||
// of something meaningful).
|
||||
//
|
||||
const wxChar* __fastcall pxExpandMsg( ExpandedMsgEnum key )
|
||||
const wxChar* __fastcall pxExpandMsg( const wxChar* key, const wxChar* englishContent )
|
||||
{
|
||||
const HashedExpansionPair& data( m_EnglishExpansions[key] );
|
||||
|
||||
int curlangid = wxLocale::GetLanguageInfo( g_Conf->LanguageId )->Language;
|
||||
if( IsEnglish( curlangid ) )
|
||||
return data.Expanded;
|
||||
return englishContent;
|
||||
|
||||
const wxChar* retval = wxGetTranslation( data.gettextKey );
|
||||
const wxChar* retval = wxGetTranslation( key );
|
||||
|
||||
// Check if the translation failed, and fall back on an english lookup.
|
||||
return ( wxStrcmp( retval, data.gettextKey ) == 0 ) ? data.Expanded : retval;
|
||||
return ( wxStrcmp( retval, key ) == 0 ) ? englishContent : retval;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -200,7 +140,7 @@ const wxChar* __fastcall pxGetTranslation( const wxChar* message )
|
|||
{
|
||||
if( wxStrlen( message ) > 96 )
|
||||
{
|
||||
Console::Notice( "pxGetTranslation: Long message detected, maybe use pxExpandMsg instead?" );
|
||||
Console::Notice( "pxGetTranslation: Long message detected, maybe use pxE() instead?" );
|
||||
Console::Status( wxsFormat( L"\tMessage: %s", message ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,45 +20,33 @@
|
|||
|
||||
#include <wx/wx.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
enum ExpandedMsgEnum
|
||||
{
|
||||
Msg_Dialog_AdvancedPaths,
|
||||
Msg_Popup_MissingPlugins,
|
||||
|
||||
Msg_Tooltips_Savestates,
|
||||
Msg_Tooltips_Snapshots,
|
||||
Msg_Tooltips_Bios,
|
||||
Msg_Tooltips_Logs,
|
||||
Msg_Tooltips_Memorycards,
|
||||
Msg_Tooltips_SettingsPath,
|
||||
Msg_Tooltips_PluginsPath,
|
||||
class LangPackEnumeration
|
||||
{
|
||||
public:
|
||||
wxLanguage wxLangId;
|
||||
wxString englishName;
|
||||
wxString xlatedName;
|
||||
|
||||
ExpandedMsg_Count
|
||||
public:
|
||||
LangPackEnumeration( wxLanguage langId );
|
||||
LangPackEnumeration();
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// English Tables for "Translating" iconized UI descriptions.
|
||||
//
|
||||
struct HashedExpansionPair
|
||||
{
|
||||
const wxChar* gettextKey; // send this to wxGetTranslation()
|
||||
const wxChar* Expanded;
|
||||
};
|
||||
typedef std::vector<LangPackEnumeration> LangPackList;
|
||||
|
||||
struct EnglishExpansionEntry
|
||||
{
|
||||
ExpandedMsgEnum Key;
|
||||
const wxChar* gettextKey; // send this to wxGetTranslation()
|
||||
const wxChar* Expanded;
|
||||
};
|
||||
|
||||
extern void i18n_InitPlainEnglish();
|
||||
extern bool i18n_SetLanguage( int wxLangId );
|
||||
extern void i18n_EnumeratePackages( LangPackList& langs );
|
||||
|
||||
extern const wxChar* __fastcall pxExpandMsg( ExpandedMsgEnum key );
|
||||
extern const wxChar* __fastcall pxExpandMsg( const wxChar* key, const wxChar* englishContent );
|
||||
extern const wxChar* __fastcall pxGetTranslation( const wxChar* message );
|
||||
|
||||
#define pxE(n) pxExpandMsg( n )
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Translation Feature: pxE is used as a method of dereferencing very long english text
|
||||
// descriptions via a "key" identifier. In this way, the english text can be revised without
|
||||
// it breaking existing translation bindings. Make sure to add pxE to your PO catalog's
|
||||
// source code identifiers, and then reference the source code to see what the current
|
||||
// english version is.
|
||||
//
|
||||
#define pxE(key,english) pxExpandMsg( wxT(key), english )
|
||||
|
||||
|
|
|
@ -188,7 +188,6 @@ bool Pcsx2App::OnInit()
|
|||
|
||||
g_Conf = new AppConfig();
|
||||
|
||||
i18n_InitPlainEnglish();
|
||||
wxLocale::AddCatalogLookupPathPrefix( wxGetCwd() );
|
||||
|
||||
// User/Admin Mode Dual Setup:
|
||||
|
|
|
@ -53,7 +53,19 @@ namespace wxHelpers
|
|||
return StdSpace().Expand();
|
||||
}
|
||||
|
||||
wxSizerFlags StdGroupie()
|
||||
// A good sizer flags setting for top-level static boxes or top-level picture boxes.
|
||||
// Gives a generous border to the left, right, and bottom. Top border can be configured
|
||||
// manually by using a spacer.
|
||||
wxSizerFlags TopLevelBox()
|
||||
{
|
||||
return wxSizerFlags().Border( wxLEFT | wxBOTTOM | wxRIGHT, 6 ).Expand();
|
||||
}
|
||||
|
||||
// Flags intended for use on grouped StaticBox controls. These flags are ideal for
|
||||
// StaticBoxes that are part of sub-panels or children of other static boxes, but may
|
||||
// not be best for parent StaticBoxes on dialogs (left and right borders feel a bit
|
||||
// "tight").
|
||||
wxSizerFlags SubGroup()
|
||||
{
|
||||
// Groups look better with a slightly smaller margin than standard.
|
||||
// (basically this accounts for the group's frame)
|
||||
|
@ -73,27 +85,58 @@ namespace wxHelpers
|
|||
return StdExpand();
|
||||
}
|
||||
};
|
||||
|
||||
// This method is used internally to create multi line checkboxes and radio buttons.
|
||||
void _appendStaticSubtext( wxWindow* parent, wxSizer& sizer, const wxString& subtext, const wxString& tooltip, int wrapLen )
|
||||
{
|
||||
static const int Indentation = 23;
|
||||
|
||||
if( subtext.IsEmpty() ) return;
|
||||
|
||||
wxStaticText* joe = new wxStaticText( parent, wxID_ANY, subtext );
|
||||
if( wrapLen > 0 ) joe->Wrap( wrapLen-Indentation );
|
||||
if( !tooltip.IsEmpty() )
|
||||
joe->SetToolTip( tooltip );
|
||||
sizer.Add( joe, wxSizerFlags().Border( wxLEFT, Indentation ) );
|
||||
sizer.AddSpacer( 9 );
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Creates a new checkbox and adds it to the specified sizer/parent combo.
|
||||
// Uses the default spacer setting for adding checkboxes.
|
||||
// Creates a new checkbox and adds it to the specified sizer/parent combo, with optional tooltip.
|
||||
// Uses the default spacer setting for adding checkboxes, and the tooltip (if specified) is applied
|
||||
// to both the checkbox and it's static subtext (if present).
|
||||
//
|
||||
wxCheckBox& AddCheckBoxTo( wxWindow* parent, wxSizer& sizer, const wxString& label, wxWindowID id )
|
||||
wxCheckBox& AddCheckBoxTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext, const wxString& tooltip, int wrapLen )
|
||||
{
|
||||
wxCheckBox* retval = new wxCheckBox( parent, id, label );
|
||||
wxCheckBox* retval = new wxCheckBox( parent, wxID_ANY, label );
|
||||
sizer.Add( retval, SizerFlags::Checkbox() );
|
||||
|
||||
if( !tooltip.IsEmpty() )
|
||||
retval->SetToolTip( tooltip );
|
||||
|
||||
_appendStaticSubtext( parent, sizer, subtext, tooltip, wrapLen );
|
||||
|
||||
return *retval;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Creates a new Radio Button and adds it to the specified sizer/parent combo.
|
||||
// The first item in a group should pass True for the isFisrt parameter.
|
||||
// Uses the default spacer setting for checkboxes.
|
||||
// Creates a new Radio button and adds it to the specified sizer/parent combo, with optional tooltip.
|
||||
// Uses the default spacer setting for adding checkboxes, and the tooltip (if specified) is applied
|
||||
// to both the radio button and it's static subtext (if present).
|
||||
//
|
||||
wxRadioButton& AddRadioButtonTo( wxWindow* parent, wxSizer& sizer, const wxString& label, wxWindowID id, bool isFirst )
|
||||
// The first item in a group should pass True for the isFirst parameter.
|
||||
//
|
||||
wxRadioButton& AddRadioButtonTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext, const wxString& tooltip, int wrapLen, bool isFirst )
|
||||
{
|
||||
wxRadioButton* retval = new wxRadioButton( parent, id, label, wxDefaultPosition, wxDefaultSize, isFirst ? wxRB_GROUP : 0 );
|
||||
wxRadioButton* retval = new wxRadioButton( parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, isFirst ? wxRB_GROUP : 0 );
|
||||
sizer.Add( retval, SizerFlags::Checkbox() );
|
||||
|
||||
if( !tooltip.IsEmpty() )
|
||||
retval->SetToolTip( tooltip );
|
||||
|
||||
_appendStaticSubtext( parent, sizer, subtext, tooltip, wrapLen );
|
||||
|
||||
return *retval;
|
||||
}
|
||||
|
||||
|
@ -109,12 +152,12 @@ namespace wxHelpers
|
|||
// alignFlags - Either wxALIGN_LEFT, RIGHT, or CENTRE. All other wxStaticText flags are ignored
|
||||
// or overridden. [default is left alignment]
|
||||
//
|
||||
wxStaticText& AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int size, int alignFlags )
|
||||
wxStaticText& AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int alignFlags, int size )
|
||||
{
|
||||
// No reason to ever have AutoResize enabled, quite frankly. It just causes layout and centering problems.
|
||||
alignFlags |= wxST_NO_AUTORESIZE;
|
||||
wxStaticText *temp = new wxStaticText(parent, wxID_ANY, label, wxDefaultPosition, wxDefaultSize, alignFlags );
|
||||
if (size > 0) temp->Wrap(size);
|
||||
if( size > 0 ) temp->Wrap( size );
|
||||
|
||||
sizer.Add(temp, SizerFlags::StdSpace().Align( alignFlags & wxALIGN_MASK ) );
|
||||
return *temp;
|
||||
|
@ -155,6 +198,60 @@ namespace wxHelpers
|
|||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void pxTextWrapperBase::Wrap( const wxWindow *win, const wxString& text, int widthMax )
|
||||
{
|
||||
const wxChar *lastSpace = NULL;
|
||||
wxString line;
|
||||
line.Alloc( widthMax+12 );
|
||||
|
||||
const wxChar *lineStart = text.c_str();
|
||||
for ( const wxChar *p = lineStart; ; p++ )
|
||||
{
|
||||
if ( IsStartOfNewLine() )
|
||||
{
|
||||
OnNewLine();
|
||||
|
||||
lastSpace = NULL;
|
||||
line.clear();
|
||||
lineStart = p;
|
||||
}
|
||||
|
||||
if ( *p == L'\n' || *p == L'\0' )
|
||||
{
|
||||
DoOutputLine(line);
|
||||
|
||||
if ( *p == L'\0' )
|
||||
break;
|
||||
}
|
||||
else // not EOL
|
||||
{
|
||||
if ( *p == L' ' )
|
||||
lastSpace = p;
|
||||
|
||||
line += *p;
|
||||
|
||||
if ( widthMax >= 0 && lastSpace )
|
||||
{
|
||||
int width;
|
||||
win->GetTextExtent(line, &width, NULL);
|
||||
|
||||
if ( width > widthMax )
|
||||
{
|
||||
// remove the last word from this line
|
||||
line.erase(lastSpace - lineStart, p + 1 - lineStart);
|
||||
DoOutputLine(line);
|
||||
|
||||
// go back to the last word of this line which we didn't
|
||||
// output yet
|
||||
p = lastSpace;
|
||||
}
|
||||
}
|
||||
//else: no wrapping at all or impossible to wrap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
wxDialogWithHelpers::wxDialogWithHelpers( wxWindow* parent, int id, const wxString& title, bool hasContextHelp, const wxPoint& pos, const wxSize& size ) :
|
||||
|
@ -170,9 +267,14 @@ wxDialogWithHelpers::wxDialogWithHelpers( wxWindow* parent, int id, const wxStr
|
|||
// any good.
|
||||
}
|
||||
|
||||
wxCheckBox& wxDialogWithHelpers::AddCheckBox( wxSizer& sizer, const wxString& label, wxWindowID id )
|
||||
// ------------------------------------------------------------------------
|
||||
// Creates a new checkbox and adds it to the specified sizer/parent combo, with optional tooltip.
|
||||
// Uses the default spacer setting for adding checkboxes, and the tooltip (if specified) is applied
|
||||
// to both the checkbox and it's static subtext (if present).
|
||||
//
|
||||
wxCheckBox& wxDialogWithHelpers::AddCheckBox( wxSizer& sizer, const wxString& label, const wxString& subtext, const wxString& tooltip )
|
||||
{
|
||||
return wxHelpers::AddCheckBoxTo( this, sizer, label, id );
|
||||
return wxHelpers::AddCheckBoxTo( this, sizer, label, subtext, tooltip);
|
||||
}
|
||||
|
||||
wxStaticText& wxDialogWithHelpers::AddStaticText(wxSizer& sizer, const wxString& label, int size, int alignFlags )
|
||||
|
@ -214,32 +316,61 @@ void wxDialogWithHelpers::AddOkCancel( wxSizer &sizer, bool hasApply )
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, int id, const wxPoint& pos, const wxSize& size ) :
|
||||
wxPanel( parent, id, pos, size )
|
||||
wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, int idealWidth ) :
|
||||
wxPanel( parent, wxID_ANY )
|
||||
, m_idealWidth( idealWidth )
|
||||
, m_StartNewRadioGroup( true )
|
||||
{
|
||||
}
|
||||
|
||||
wxCheckBox& wxPanelWithHelpers::AddCheckBox( wxSizer& sizer, const wxString& label, wxWindowID id )
|
||||
wxPanelWithHelpers::wxPanelWithHelpers( wxWindow* parent, const wxPoint& pos, const wxSize& size ) :
|
||||
wxPanel( parent, wxID_ANY, pos, size )
|
||||
, m_idealWidth( wxDefaultCoord )
|
||||
, m_StartNewRadioGroup( true )
|
||||
{
|
||||
return wxHelpers::AddCheckBoxTo( this, sizer, label, id );
|
||||
}
|
||||
|
||||
wxStaticText& wxPanelWithHelpers::AddStaticText(wxSizer& sizer, const wxString& label, int size, int alignFlags )
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Creates a new checkbox and adds it to the specified sizer, with optional tooltip. Uses the default
|
||||
// spacer setting for adding checkboxes, and the tooltip (if specified) is applied to both the checkbox
|
||||
// and it's static subtext (if present).
|
||||
//
|
||||
// Static subtext, if specified, is displayed below the checkbox and is indented accordingly.
|
||||
//
|
||||
wxCheckBox& wxPanelWithHelpers::AddCheckBox( wxSizer& sizer, const wxString& label, const wxString& subtext, const wxString& tooltip )
|
||||
{
|
||||
return wxHelpers::AddStaticTextTo( this, sizer, label, size, alignFlags );
|
||||
return wxHelpers::AddCheckBoxTo( this, sizer, label, subtext, tooltip, GetIdealWidth()-8 );
|
||||
}
|
||||
|
||||
wxRadioButton& wxPanelWithHelpers::AddRadioButton( wxSizer& sizer, const wxString& label, const wxString& subtext, wxWindowID id )
|
||||
// ------------------------------------------------------------------------
|
||||
// Creates a static text box that generally "makes sense" in a free-flowing layout. Specifically, this
|
||||
// ensures that that auto resizing is disabled, and that the sizer flags match the alignment specified
|
||||
// for the textbox.
|
||||
//
|
||||
// Parameters:
|
||||
// Size - allows forcing the control to wrap text at a specific pre-defined pixel width;
|
||||
// or specify zero to let wxWidgets layout the text as it deems appropriate (recommended)
|
||||
//
|
||||
// alignFlags - Either wxALIGN_LEFT, RIGHT, or CENTRE. All other wxStaticText flags are ignored
|
||||
// or overridden. [default is left alignment]
|
||||
//
|
||||
wxStaticText& wxPanelWithHelpers::AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags, int size )
|
||||
{
|
||||
wxRadioButton& retval = wxHelpers::AddRadioButtonTo( this, sizer, label, id, m_StartNewRadioGroup );
|
||||
return wxHelpers::AddStaticTextTo( this, sizer, label, alignFlags, (size > 0) ? size : GetIdealWidth()-24 );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Creates a new Radio button and adds it to the specified sizer, with optional tooltip. Uses the
|
||||
// default spacer setting for adding checkboxes, and the tooltip (if specified) is applied to both
|
||||
// the radio button and it's static subtext (if present).
|
||||
//
|
||||
// Static subtext, if specified, is displayed below the checkbox and is indented accordingly.
|
||||
// The first item in a group should pass True for the isFirst parameter.
|
||||
//
|
||||
wxRadioButton& wxPanelWithHelpers::AddRadioButton( wxSizer& sizer, const wxString& label, const wxString& subtext, const wxString& tooltip )
|
||||
{
|
||||
return wxHelpers::AddRadioButtonTo( this, sizer, label, subtext, tooltip, GetIdealWidth()-8, m_StartNewRadioGroup );
|
||||
m_StartNewRadioGroup = false;
|
||||
|
||||
if( !subtext.IsEmpty() )
|
||||
{
|
||||
sizer.Add( new wxStaticText( this, wxID_ANY, subtext ), wxSizerFlags().Border( wxLEFT, 25 ) );
|
||||
sizer.AddSpacer( 4 );
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,21 +6,117 @@
|
|||
|
||||
namespace wxHelpers
|
||||
{
|
||||
extern wxCheckBox& AddCheckBoxTo( wxWindow* parent, wxSizer& sizer, const wxString& label, wxWindowID id=wxID_ANY );
|
||||
extern wxRadioButton& AddRadioButtonTo( wxWindow* parent, wxSizer& sizer, const wxString& label, wxWindowID id=wxID_ANY, bool isFirst = false );
|
||||
extern wxStaticText& AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int size=0, int alignFlags=wxALIGN_LEFT );
|
||||
extern wxCheckBox& AddCheckBoxTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString, int wrapLen=wxDefaultCoord );
|
||||
extern wxRadioButton& AddRadioButtonTo( wxWindow* parent, wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString, int wrapLen=wxDefaultCoord, bool isFirst = false );
|
||||
extern wxStaticText& AddStaticTextTo(wxWindow* parent, wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_LEFT, int wrapLen=wxDefaultCoord );
|
||||
|
||||
namespace SizerFlags
|
||||
{
|
||||
extern wxSizerFlags StdSpace();
|
||||
extern wxSizerFlags StdCenter();
|
||||
extern wxSizerFlags StdExpand();
|
||||
extern wxSizerFlags StdGroupie();
|
||||
extern wxSizerFlags TopLevelBox();
|
||||
extern wxSizerFlags SubGroup();
|
||||
extern wxSizerFlags StdButton();
|
||||
extern wxSizerFlags Checkbox();
|
||||
};
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// pxTextWrapper
|
||||
// this class is used to wrap the text on word boundary: wrapping is done by calling
|
||||
// OnStartLine() and OnOutputLine() functions. This class by itself can be used as a
|
||||
// line counting tool, but produces no formatted text output.
|
||||
//
|
||||
// [class "borrowed" from wxWidgets private code, and renamed to avoid possible conflicts
|
||||
// with future editions of wxWidgets which might make it public. Why this isn't publicly
|
||||
// available already in wxBase I'll never know-- air]
|
||||
//
|
||||
class pxTextWrapperBase
|
||||
{
|
||||
protected:
|
||||
bool m_eol;
|
||||
int m_linecount;
|
||||
|
||||
public:
|
||||
virtual ~pxTextWrapperBase() { }
|
||||
|
||||
pxTextWrapperBase() :
|
||||
m_eol( false )
|
||||
, m_linecount( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
// win is used for getting the font, text is the text to wrap, width is the
|
||||
// max line width or -1 to disable wrapping
|
||||
void Wrap( const wxWindow *win, const wxString& text, int widthMax );
|
||||
|
||||
int GetLineCount() const
|
||||
{
|
||||
return m_linecount;
|
||||
}
|
||||
|
||||
protected:
|
||||
// line may be empty
|
||||
virtual void OnOutputLine(const wxString& line) { }
|
||||
|
||||
// called at the start of every new line (except the very first one)
|
||||
virtual void OnNewLine() { }
|
||||
|
||||
void DoOutputLine(const wxString& line)
|
||||
{
|
||||
OnOutputLine(line);
|
||||
m_linecount++;
|
||||
m_eol = true;
|
||||
}
|
||||
|
||||
// this function is a destructive inspector: when it returns true it also
|
||||
// resets the flag to false so calling it again wouldn't return true any
|
||||
// more
|
||||
bool IsStartOfNewLine()
|
||||
{
|
||||
if ( !m_eol )
|
||||
return false;
|
||||
|
||||
m_eol = false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// pxTextWrapper
|
||||
// This class extends pxTextWrapperBase and adds the ability to retrieve the formatted
|
||||
// result of word wrapping.
|
||||
//
|
||||
class pxTextWrapper : public pxTextWrapperBase
|
||||
{
|
||||
protected:
|
||||
wxString m_text;
|
||||
|
||||
public:
|
||||
pxTextWrapper() : pxTextWrapperBase()
|
||||
, m_text()
|
||||
{
|
||||
}
|
||||
|
||||
const wxString& GetResult() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void OnOutputLine(const wxString& line)
|
||||
{
|
||||
m_text += line;
|
||||
}
|
||||
|
||||
virtual void OnNewLine()
|
||||
{
|
||||
m_text += L'\n';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class wxDialogWithHelpers : public wxDialog
|
||||
|
@ -31,10 +127,11 @@ protected:
|
|||
public:
|
||||
wxDialogWithHelpers(wxWindow* parent, int id, const wxString& title, bool hasContextHelp, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize );
|
||||
|
||||
protected:
|
||||
wxCheckBox& AddCheckBox( wxSizer& sizer, const wxString& label, wxWindowID id=wxID_ANY );
|
||||
wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int size=0, int alignFlags=wxALIGN_LEFT );
|
||||
wxCheckBox& AddCheckBox( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString );
|
||||
wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_LEFT, int size=wxDefaultCoord );
|
||||
void AddOkCancel( wxSizer& sizer, bool hasApply=false );
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -42,16 +139,21 @@ protected:
|
|||
class wxPanelWithHelpers : public wxPanel
|
||||
{
|
||||
protected:
|
||||
const int m_idealWidth;
|
||||
bool m_StartNewRadioGroup;
|
||||
|
||||
public:
|
||||
wxPanelWithHelpers( wxWindow* parent, int id=wxID_ANY, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize );
|
||||
wxPanelWithHelpers( wxWindow* parent, int idealWidth=wxDefaultCoord );
|
||||
wxPanelWithHelpers( wxWindow* parent, const wxPoint& pos, const wxSize& size=wxDefaultSize );
|
||||
|
||||
protected:
|
||||
wxCheckBox& AddCheckBox( wxSizer& sizer, const wxString& label, wxWindowID id=wxID_ANY );
|
||||
wxRadioButton& AddRadioButton( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, wxWindowID id=wxID_ANY );
|
||||
wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int size=0, int alignFlags=wxALIGN_LEFT );
|
||||
|
||||
wxCheckBox& AddCheckBox( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString );
|
||||
wxRadioButton& AddRadioButton( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString );
|
||||
wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_LEFT, int size=wxDefaultCoord );
|
||||
|
||||
int GetIdealWidth() const { return m_idealWidth; }
|
||||
bool HasIdealWidth() const { return m_idealWidth != wxDefaultCoord; }
|
||||
|
||||
protected:
|
||||
void StartRadioGroup()
|
||||
{
|
||||
m_StartNewRadioGroup = true;
|
||||
|
|
Loading…
Reference in New Issue