Minor i18n-related bugfixes.

* "Browse" option in recent iso menu should translate now.
 * Dialogs and config panels remember their positions more reliably (when using X or alt-F4 to close PCSX2, for example).
 * Preliminary language selector dialog (available in debug builds only).  Will finish it up later.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4088 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-12-12 07:43:21 +00:00
parent e38a0ba32d
commit 21c022542f
11 changed files with 79 additions and 10 deletions

View File

@ -522,6 +522,7 @@ public:
// --------------------------------------------------------------------------------------
class wxDialogWithHelpers : public wxDialog
{
typedef wxDialog _parent;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDialogWithHelpers)
protected:
@ -541,6 +542,7 @@ public:
virtual void SmartCenterFit();
virtual int ShowModal();
virtual bool Show( bool show=true );
virtual bool Destroy();
// Must return the same thing as GetNameStatic; a name ideal for use in uniquely
// identifying dialogs. (this version is the 'instance' version, which is called

View File

@ -274,13 +274,13 @@ pxStaticText& wxDialogWithHelpers::Heading( const wxString& label )
return *new pxStaticHeading( this, label );
}
void wxDialogWithHelpers::OnCloseWindow( wxCloseEvent& evt )
bool wxDialogWithHelpers::Destroy()
{
// Save the dialog position if the dialog is named...
// FIXME : This doesn't get called if the app is exited by alt-f4'ing the main app window.
// ... not sure how to fix that yet. I could register a list of open windows into wxAppWithHelpers
// that systematically get closed. Seems like work, maybe later. --air
if( wxConfigBase* cfg = IsIconized() ? NULL : wxConfigBase::Get( false ) )
{
const wxString dlgName( GetDialogName() );
@ -300,6 +300,11 @@ void wxDialogWithHelpers::OnCloseWindow( wxCloseEvent& evt )
}
}
return _parent::Destroy();
}
void wxDialogWithHelpers::OnCloseWindow( wxCloseEvent& evt )
{
if( !IsModal() ) Destroy();
evt.Skip();
}

View File

@ -117,6 +117,7 @@ enum MenuIdentifiers
MenuId_Config_AppSettings,
MenuId_Config_GameDatabase,
MenuId_Config_BIOS,
MenuId_Config_Language,
// Plugin ID order is important. Must match the order in tbl_PluginInfo.
MenuId_Config_GS,

View File

@ -581,8 +581,6 @@ bool Pcsx2App::OnInit()
InitDefaultGlobalAccelerators();
delete wxLog::SetActiveTarget( new pxLogConsole() );
m_RecentIsoList = new RecentIsoList();
#ifdef __WXMSW__
pxDwm_Load();
#endif

View File

@ -80,13 +80,13 @@ pxAppResources::~pxAppResources() throw() {}
wxMenu& Pcsx2App::GetRecentIsoMenu()
{
pxAssert( !!m_RecentIsoList->Menu );
if (!m_RecentIsoList) m_RecentIsoList = new RecentIsoList();
return *m_RecentIsoList->Menu;
}
RecentIsoManager& Pcsx2App::GetRecentIsoManager()
{
pxAssert( !!m_RecentIsoList->Manager );
if (!m_RecentIsoList) m_RecentIsoList = new RecentIsoList();
return *m_RecentIsoList->Manager;
}

View File

@ -89,6 +89,26 @@ namespace Dialogs
virtual wxString& GetConfSettingsTabName() const { return g_Conf->SysSettingsTabName; }
};
// --------------------------------------------------------------------------------------
// LanguageSelectionDialog
// --------------------------------------------------------------------------------------
class LanguageSelectionDialog : public BaseConfigurationDialog
{
public:
virtual ~LanguageSelectionDialog() throw() {}
LanguageSelectionDialog(wxWindow* parent=NULL);
static wxString GetNameStatic() { return L"LanguageSelector"; }
wxString GetDialogName() const { return GetNameStatic(); }
protected:
virtual wxString& GetConfSettingsTabName() const
{
pxFailDev("Language selector does not have a listbook or settings tab.");
static wxString fail;
return fail;
}
};
// --------------------------------------------------------------------------------------
// McdConfigDialog
// --------------------------------------------------------------------------------------

View File

@ -106,3 +106,13 @@ Dialogs::ComponentsConfigDialog::ComponentsConfigDialog(wxWindow* parent)
if( wxGetApp().Overrides.HasPluginsOverride() )
wxGetApp().PostMethod( CheckPluginsOverrides );
}
Dialogs::LanguageSelectionDialog::LanguageSelectionDialog(wxWindow *parent)
: BaseConfigurationDialog( parent, AddAppName(_("Language Selector - %s")), 400 )
{
ScopedBusyCursor busy( Cursor_ReallyBusy );
*this += new Panels::LanguageSelectionPanel( this ) | pxCenter;
wxDialogWithHelpers::AddOkCancel( NULL, false );
}

View File

@ -61,6 +61,29 @@ void MainEmuFrame::UpdateIsoSrcSelection()
// exists ? Path::GetFilename(g_Conf->CurrentIso).c_str() : _("Empty") ) );
}
bool MainEmuFrame::Destroy()
{
// Sigh: wxWidgets doesn't issue Destroy() calls for children windows when the parent
// is destroyed (it just deletes them, quite suddenly). So let's do it for them, since
// our children have configuration stuff they like to do when they're closing.
for (
wxWindowList::const_iterator
i = wxTopLevelWindows.begin(),
end = wxTopLevelWindows.end();
i != end; ++i
)
{
wxTopLevelWindow * const win = wx_static_cast(wxTopLevelWindow *, *i);
if (win == this) continue;
if (win->GetParent() != this) continue;
win->Destroy();
}
return _parent::Destroy();
}
// ------------------------------------------------------------------------
// MainFrame OnEvent Handlers
// ------------------------------------------------------------------------
@ -157,6 +180,7 @@ void MainEmuFrame::ConnectMenus()
ConnectMenu( MenuId_Config_AppSettings, Menu_WindowSettings_Click );
ConnectMenu( MenuId_Config_GameDatabase,Menu_GameDatabase_Click );
ConnectMenu( MenuId_Config_BIOS, Menu_SelectPluginsBios_Click );
ConnectMenu( MenuId_Config_Language, Menu_Language_Click );
ConnectMenu( MenuId_Config_ResetAll, Menu_ResetAllSettings_Click );
ConnectMenu( MenuId_Config_Multitap0Toggle, Menu_MultitapToggle_Click );
@ -424,7 +448,10 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
m_menuConfig.Append(MenuId_Config_McdSettings, _("&Memory cards") );
m_menuConfig.Append(MenuId_Config_BIOS, _("&Plugin/BIOS Selector") );
if (IsDebugBuild)
{
m_menuConfig.Append(MenuId_Config_GameDatabase, _("Game Database Editor") );
m_menuConfig.Append(MenuId_Config_Language, _("Language...") );
}
m_menuConfig.AppendSeparator();

View File

@ -145,6 +145,8 @@ public:
void UpdateIsoSrcSelection();
void RemoveCdvdMenu();
void EnableMenuItem( int id, bool enable );
bool Destroy();
protected:
void DoGiveHelp(const wxString& text, bool show);
@ -166,6 +168,7 @@ protected:
void Menu_WindowSettings_Click(wxCommandEvent &event);
void Menu_GSSettings_Click(wxCommandEvent &event);
void Menu_SelectPluginsBios_Click(wxCommandEvent &event);
void Menu_Language_Click(wxCommandEvent &event);
void Menu_ResetAllSettings_Click(wxCommandEvent &event);
void Menu_IsoBrowse_Click(wxCommandEvent &event);

View File

@ -72,6 +72,11 @@ void MainEmuFrame::Menu_SelectPluginsBios_Click(wxCommandEvent &event)
AppOpenDialog<ComponentsConfigDialog>( this );
}
void MainEmuFrame::Menu_Language_Click(wxCommandEvent &event)
{
//AppOpenDialog<LanguageSelectionDialog>( this );
LanguageSelectionDialog(this).ShowModal();
}
static void WipeSettings()
{

View File

@ -75,9 +75,6 @@ static void i18n_DoPackageCheck( wxLanguage wxLangId, LangPackList& langs )
{
if( i18n_IsLegacyLanguageId( wxLangId ) ) return;
//if( !wxLocale::IsAvailable( wxLangId ) )
// return;
// note: wx preserves the current locale for us, so creating a new locale and deleting
// will not affect program status.
ScopedPtr<wxLocale> locale( new wxLocale( wxLangId, wxLOCALE_CONV_ENCODING ) );
@ -86,7 +83,8 @@ static void i18n_DoPackageCheck( wxLanguage wxLangId, LangPackList& langs )
// 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"pcsx2_Main", wxLANGUAGE_UNKNOWN, NULL ) )
if ((locale->GetLanguage() == wxLANGUAGE_ENGLISH_US) ||
(locale->IsOk() && locale->AddCatalog( L"pcsx2_Main", wxLANGUAGE_UNKNOWN, NULL )) )
langs.push_back( LangPackEnumeration( wxLangId ) );
}