localize text in all dialogs

This commit is contained in:
Chris Danford
2006-01-06 07:48:26 +00:00
parent 9dfc40ba9c
commit f6f253b545
24 changed files with 176 additions and 62 deletions
@@ -50,6 +50,9 @@ BOOL ChangeGameSettings::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SMPackageUtil::LocalizeDialogAndContents( *this );
//
// Fill the radio buttons
//
@@ -32,6 +32,9 @@ BOOL CreateLanguageDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SMPackageUtil::LocalizeDialogAndContents( *this );
vector<const LanguageInfo*> v;
GetLanguageInfos( v );
FOREACH_CONST( const LanguageInfo*, v, i )
+4 -1
View File
@@ -17,8 +17,11 @@ public:
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
// Generated message map functions
//{{AFX_MSG(CreateLanguageDlg)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
CComboBox m_comboLanguages;
+11
View File
@@ -6,6 +6,7 @@
#include "stdafx.h"
#include "smpackage.h"
#include "EnterComment.h"
#include "SMPackageUtil.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -36,6 +37,16 @@ void EnterComment::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_DONTASK, m_bDontAsk);
}
BOOL EnterComment::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SMPackageUtil::LocalizeDialogAndContents( *this );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BEGIN_MESSAGE_MAP(EnterComment, CDialog)
//{{AFX_MSG_MAP(EnterComment)
+1
View File
@@ -39,6 +39,7 @@ protected:
// Generated message map functions
//{{AFX_MSG(EnterComment)
virtual void OnOK();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
+11 -1
View File
@@ -6,6 +6,7 @@
#include "stdafx.h"
#include "smpackage.h"
#include "EnterName.h"
#include "SMPackageUtil.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -25,7 +26,6 @@ EnterName::EnterName(CWnd* pParent /*=NULL*/)
//}}AFX_DATA_INIT
}
void EnterName::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
@@ -34,6 +34,16 @@ void EnterName::DoDataExchange(CDataExchange* pDX)
//}}AFX_DATA_MAP
}
BOOL EnterName::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SMPackageUtil::LocalizeDialogAndContents( *this );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BEGIN_MESSAGE_MAP(EnterName, CDialog)
//{{AFX_MSG_MAP(EnterName)
+1
View File
@@ -39,6 +39,7 @@ protected:
// Generated message map functions
//{{AFX_MSG(EnterName)
virtual void OnOK();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
+2 -19
View File
@@ -43,6 +43,7 @@ void MainMenuDlg::DoDataExchange(CDataExchange* pDX)
//{{AFX_DATA_MAP(MainMenuDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
DDX_Control(pDX, IDC_STATIC_HEADER_TEXT, m_staticHeaderText);
}
@@ -58,7 +59,6 @@ BEGIN_MESSAGE_MAP(MainMenuDlg, CDialog)
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_BUTTON_LAUNCH_GAME, OnBnClickedButtonLaunchGame)
ON_BN_CLICKED(IDC_VIEW_STATISTICS, OnBnClickedViewStatistics)
ON_BN_CLICKED(IDC_CLEAR_CACHE, OnBnClickedClearCache)
ON_BN_CLICKED(IDC_LANGUAGES, OnBnClickedLanguages)
END_MESSAGE_MAP()
@@ -174,6 +174,7 @@ BOOL MainMenuDlg::OnInitDialog()
// TODO: Add extra initialization here
SMPackageUtil::LocalizeDialogAndContents( *this );
SMPackageUtil::SetHeaderFont( *this );
TCHAR szCurDir[MAX_PATH];
GetCurrentDirectory( ARRAYSIZE(szCurDir), szCurDir );
@@ -255,24 +256,6 @@ void MainMenuDlg::OnBnClickedViewStatistics()
MessageBox( "Failed to open '" + sFile + "': " + GetLastErrorString() );
}
void MainMenuDlg::OnBnClickedClearCache()
{
// TODO: Add your control notification handler code here
if( DoesFileExist(SpecialFiles::CACHE_DIR) )
{
if( DeleteRecursive(SpecialFiles::CACHE_DIR) )
MessageBox( "The cache has been cleared." );
else
MessageBox( "There was an error clearing the cache." );
}
else
{
MessageBox( "The cache is already cleared." );
}
FlushDirCache();
}
void MainMenuDlg::OnBnClickedLanguages()
{
// TODO: Add your control notification handler code here
+3 -1
View File
@@ -7,6 +7,8 @@
// MainMenuDlg.h : header file
//
#include "TransparentStatic.h"
/////////////////////////////////////////////////////////////////////////////
// MainMenuDlg dialog
@@ -32,6 +34,7 @@ public:
// Implementation
protected:
CTransparentStatic m_staticHeaderText;
// Generated message map functions
//{{AFX_MSG(MainMenuDlg)
@@ -50,7 +53,6 @@ protected:
public:
afx_msg void OnBnClickedButtonLaunchGame();
afx_msg void OnBnClickedViewStatistics();
afx_msg void OnBnClickedClearCache();
afx_msg void OnBnClickedLanguages();
};
@@ -48,6 +48,7 @@ void CSMPackageInstallDlg::DoDataExchange(CDataExchange* pDX)
DDX_Control(pDX, IDC_BUTTON_EDIT, m_buttonEdit);
DDX_Control(pDX, IDC_COMBO_DIR, m_comboDir);
//}}AFX_DATA_MAP
DDX_Control(pDX, IDC_STATIC_HEADER_TEXT, m_staticHeaderText);
}
@@ -77,6 +78,8 @@ BOOL CSMPackageInstallDlg::OnInitDialog()
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
SMPackageUtil::LocalizeDialogAndContents( *this );
SMPackageUtil::SetHeaderFont( *this );
// mount the zip
if( !FILEMAN->Mount( "zip", m_sPackagePath, TEMP_MOUNT_POINT ) )
@@ -7,6 +7,8 @@
// SMPackageInstallDlg.h : header file
//
#include "TransparentStatic.h"
/////////////////////////////////////////////////////////////////////////////
// CSMPackageInstallDlg dialog
@@ -38,6 +40,7 @@ protected:
HICON m_hIcon;
RString m_sPackagePath;
CTransparentStatic m_staticHeaderText;
// Generated message map functions
//{{AFX_MSG(CSMPackageInstallDlg)
+26 -8
View File
@@ -7,6 +7,7 @@
#include "RageUtil.h"
#include "RageFileManager.h"
#include "ThemeManager.h"
#include "resource.h"
void SMPackageUtil::WriteStepManiaInstallDirs( const vector<RString>& asInstallDirsToWrite )
{
@@ -211,23 +212,40 @@ RString SMPackageUtil::GetLanguageCodeFromDisplayString( const RString &sDisplay
return s;
}
void SMPackageUtil::SetHeaderFont( CDialog &dlg )
{
CWnd *pWnd = dlg.GetDlgItem( IDC_STATIC_HEADER_TEXT );
ASSERT( pWnd );
CFont *pFont = new CFont;
const int FONT_POINTS = 16;
pFont->CreatePointFont( FONT_POINTS*10, "Arial Black" );
pWnd->SetFont( pFont );
}
void SMPackageUtil::LocalizeDialogAndContents( CDialog &dlg )
{
CString s1;
dlg.GetWindowText( s1 );
RString sGroup = "Tools-"+s1;
dlg.SetWindowText( THEME->GetString(sGroup,"DialogCaption") );
CString sTemp;
dlg.GetWindowText( sTemp );
RString sGroup = "Tools-"+sTemp;
dlg.GetWindowText( sTemp );
RString s = sTemp;
dlg.SetWindowText( THEME->GetString(sGroup,s) );
for( CWnd *pChild = dlg.GetTopWindow(); pChild != NULL; pChild = pChild->GetNextWindow() )
{
pChild->GetWindowText( s1 );
if( s1.IsEmpty() )
pChild->GetWindowText( sTemp );
RString s = sTemp;
if( s.empty() )
continue;
pChild->SetWindowText( THEME->GetString(sGroup,RString(s1)) );
vector<RString> vsBits;
split( s, "\n", vsBits, true );
FOREACH( RString, vsBits, iter )
*iter = THEME->GetString(sGroup,RString(*iter));
s = join("\n",vsBits);
pChild->SetWindowText( s );
}
}
static const RString TEMP_MOUNT_POINT = "/@package/";
RageFileOsAbsolute::~RageFileOsAbsolute()
+2 -1
View File
@@ -6,6 +6,7 @@
#include "stdafx.h"
#include "smpackage.h"
#include "ShowComment.h"
#include "SMPackageUtil.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -36,7 +37,6 @@ void ShowComment::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_DONTSHOW, m_bDontShow);
}
BEGIN_MESSAGE_MAP(ShowComment, CDialog)
//{{AFX_MSG_MAP(ShowComment)
//}}AFX_MSG_MAP
@@ -50,6 +50,7 @@ BOOL ShowComment::OnInitDialog()
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SMPackageUtil::LocalizeDialogAndContents( *this );
m_edit.SetWindowText( m_sComment );
@@ -49,6 +49,7 @@ void CSmpackageExportDlg::DoDataExchange(CDataExchange* pDX)
DDX_Control(pDX, IDC_BUTTON_EXPORT_AS_ONE, m_buttonExportAsOne);
DDX_Control(pDX, IDC_TREE, m_tree);
//}}AFX_DATA_MAP
DDX_Control(pDX, IDC_STATIC_HEADER_TEXT, m_staticHeaderText);
}
@@ -71,7 +72,8 @@ BOOL CSmpackageExportDlg::OnInitDialog()
CDialog::OnInitDialog();
// TODO: Add extra initialization here
//
SMPackageUtil::LocalizeDialogAndContents( *this );
SMPackageUtil::SetHeaderFont( *this );
RefreshInstallationList();
@@ -6,6 +6,7 @@
#endif // _MSC_VER > 1000
#include "afxtempl.h"
#include "TransparentStatic.h"
// SmpackageExportDlg.h : header file
//
@@ -45,6 +46,8 @@ protected:
void GetCheckedPaths( vector<RString>& aCheckedItemsOut );
bool MakeComment( RString &comment );
CTransparentStatic m_staticHeaderText;
// Generated message map functions
//{{AFX_MSG(CSmpackageExportDlg)
virtual BOOL OnInitDialog();
@@ -0,0 +1,46 @@
// TransparentStatic.cpp : implementation file
//
#include "stdafx.h"
#include "TransparentStatic.h"
// CTransparentStatic
IMPLEMENT_DYNAMIC(CTransparentStatic, CStatic)
CTransparentStatic::CTransparentStatic()
{
}
CTransparentStatic::~CTransparentStatic()
{
}
BEGIN_MESSAGE_MAP(CTransparentStatic, CStatic)
ON_MESSAGE(WM_SETTEXT,OnSetText)
ON_WM_CTLCOLOR_REFLECT()
END_MESSAGE_MAP()
// CTransparentStatic message handlers
LRESULT CTransparentStatic::OnSetText(WPARAM wParam,LPARAM lParam)
{
LRESULT Result = Default();
CRect Rect;
GetWindowRect(&Rect);
GetParent()->ScreenToClient(&Rect);
GetParent()->InvalidateRect(&Rect);
GetParent()->UpdateWindow();
return Result;
}
HBRUSH CTransparentStatic::CtlColor(CDC* pDC, UINT /*nCtlColor*/)
{
pDC->SetBkMode(TRANSPARENT);
return (HBRUSH)GetStockObject(NULL_BRUSH);
}
@@ -0,0 +1,20 @@
#pragma once
// CTransparentStatic
class CTransparentStatic : public CStatic
{
DECLARE_DYNAMIC(CTransparentStatic)
public:
CTransparentStatic();
virtual ~CTransparentStatic();
protected:
afx_msg LRESULT OnSetText(WPARAM,LPARAM);
afx_msg HBRUSH CtlColor(CDC* /*pDC*/, UINT /*nCtlColor*/);
DECLARE_MESSAGE_MAP()
};
+4 -1
View File
@@ -6,7 +6,7 @@
#include "stdafx.h"
#include "smpackage.h"
#include "UninstallOld.h"
#include "SMPackageUtil.h"
// UninstallOld dialog
@@ -29,6 +29,9 @@ void UninstallOld::DoDataExchange(CDataExchange* pDX)
BOOL UninstallOld::OnInitDialog()
{
CDialog::OnInitDialog();
SMPackageUtil::LocalizeDialogAndContents( *this );
return TRUE; // return TRUE unless you set the focus to a control
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

+4 -6
View File
@@ -7,12 +7,9 @@
#define IDR_MAINFRAME 128
#define IDD_INSTALL 129
#define IDD_EXPORTER 130
#define INSTALL 133
#define MANAGE 135
#define IDD_DIALOG_NAME 137
#define IDD_EDIT_INSTALLATIONS 138
#define IDD_MENU 139
#define MENU 140
#define IDD_ENTER_COMMENT 146
#define IDD_SHOW_COMMENT 147
#define IDD_UNINSTALL_OLD_PACKAGES 148
@@ -66,6 +63,7 @@
#define IDC_DONTSHOW 1042
#define IDC_PACKAGES 1044
#define IDC_BUTTON1 1045
#define IDB_HEADER 1045
#define IDC_BUTTON_DELETE 1046
#define IDC_PROGRESS1 1047
#define IDC_RADIO_DEFAULT 1048
@@ -87,15 +85,15 @@
#define IDC_STATIC_NEED_TRANSLATION 1061
#define IDC_COMBO_LANGUAGES 1065
#define IDC_CHECK_EXPORT_ALREADY_TRANSLATED 1066
#define IDC_CHECK1 1066
#define IDC_STATIC_HEADER_TEXT 1067
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 152
#define _APS_NEXT_RESOURCE_VALUE 153
#define _APS_NEXT_COMMAND_VALUE 32771
#define _APS_NEXT_CONTROL_VALUE 1067
#define _APS_NEXT_CONTROL_VALUE 1068
#define _APS_NEXT_SYMED_VALUE 104
#endif
#endif
+22 -23
View File
@@ -75,7 +75,7 @@ IDR_MAINFRAME ICON "smpackage.ICO"
IDD_INSTALL DIALOGEX 0, 0, 332, 234
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
CAPTION "Stepmania Package Manager"
CAPTION "StepMania Tools"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
EDITTEXT IDC_EDIT_MESSAGE1,7,42,320,45,ES_MULTILINE |
@@ -84,7 +84,7 @@ BEGIN
DEFPUSHBUTTON "Finish >",IDOK,200,215,55,15
PUSHBUTTON "Cancel",IDCANCEL,275,215,50,15
PUSHBUTTON "< Back",IDC_BUTTON_BACK,145,215,55,15,WS_DISABLED
CONTROL 133,IDC_STATIC,"Static",SS_BITMAP,0,0,258,37
CONTROL 1045,IDC_STATIC,"Static",SS_BITMAP,0,0,332,38
EDITTEXT IDC_EDIT_MESSAGE3,5,180,320,13,ES_MULTILINE |
ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT
WS_TABSTOP
@@ -96,19 +96,20 @@ BEGIN
PUSHBUTTON "Edit Installations",IDC_BUTTON_EDIT,233,194,59,14
CONTROL "",IDC_PROGRESS1,"msctls_progress32",NOT WS_VISIBLE |
WS_BORDER,7,60,318,14
LTEXT "Install a package",IDC_STATIC_HEADER_TEXT,5,2,280,24
END
IDD_EXPORTER DIALOGEX 0, 0, 332, 234
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP |
WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Stepmania Package Manager"
CAPTION "StepMania Tools"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "Close",IDOK,255,215,69,14
PUSHBUTTON "Launch Game",IDC_BUTTON_PLAY,5,215,70,15
PUSHBUTTON "Export As One",IDC_BUTTON_EXPORT_AS_ONE,255,104,69,15
CONTROL 135,IDC_STATIC,"Static",SS_BITMAP,0,0,332,38
CONTROL 1045,IDC_STATIC,"Static",SS_BITMAP,0,0,332,38
PUSHBUTTON "Export As Individual",IDC_BUTTON_EXPORT_AS_INDIVIDUAL,
255,137,69,15
CONTROL "Tree2",IDC_TREE,"SysTreeView32",TVS_HASBUTTONS |
@@ -119,6 +120,7 @@ BEGIN
PUSHBUTTON "Edit Installations",IDC_BUTTON_EDIT,253,39,71,14
LTEXT "Select Installation:",IDC_STATIC,7,42,66,11
PUSHBUTTON "Open Program Folder",IDC_BUTTON_OPEN,83,215,79,15
LTEXT "Export Packages",IDC_STATIC_HEADER_TEXT,5,2,280,24
END
IDD_DIALOG_NAME DIALOG 0, 0, 261, 58
@@ -155,23 +157,23 @@ BEGIN
IDC_STATIC,18,144,196,17
END
IDD_MENU DIALOGEX 0, 0, 332, 325
IDD_MENU DIALOGEX 0, 0, 332, 303
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "StepMania Tools Main Menu"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "Exit",IDOK,275,304,50,14
CONTROL 140,IDC_STATIC,"Static",SS_BITMAP,0,0,332,38
DEFPUSHBUTTON "Exit",IDOK,275,282,50,14
CONTROL 1045,IDC_STATIC,"Static",SS_BITMAP,0,0,332,38
GROUPBOX "Installation",IDC_STATIC,7,41,318,28
PUSHBUTTON "Edit Installations",IDC_EDIT_INSTALLATIONS,241,49,75,15
GROUPBOX "Create and Share",IDC_STATIC,7,219,318,79
PUSHBUTTON "Export Packages",IDC_EXPORT_PACKAGES,15,234,75,15
GROUPBOX "Create and Share",IDC_STATIC,7,198,318,79
PUSHBUTTON "Export Packages",IDC_EXPORT_PACKAGES,15,213,75,15
LTEXT "Create .smzip package files to share with other users. Packages can contain songs, courses, themes, backgrounds, and more.",
IDC_STATIC,104,233,215,18
PUSHBUTTON "Create Song",IDC_CREATE_SONG,15,255,75,15
IDC_STATIC,104,212,215,18
PUSHBUTTON "Create Song",IDC_CREATE_SONG,15,234,75,15
LTEXT "Create a new song in from your favorite mp3 or ogg music file.",
IDC_STATIC,103,254,215,20
GROUPBOX "Troubleshooting",IDC_STATIC,7,109,318,109
IDC_STATIC,103,233,215,20
GROUPBOX "Troubleshooting",IDC_STATIC,7,109,318,87
PUSHBUTTON "Change Preferences",IDC_CHANGE_PREFERENCES,16,120,75,15
PUSHBUTTON "Open Preferences",IDC_OPEN_PREFERENCES,16,152,75,15
LTEXT "Using this feature, you can:\n - Change the graphics API that the game will use.\n - Change the sound API that the game will use.\n - Clear all preferences if the game won't start.\n - Open the preferences file to make changes by hand.",
@@ -182,17 +184,16 @@ BEGIN
ES_READONLY
LTEXT "Erase all of your keyboard and joystick mappings if you've made a mistake.",
IDC_STATIC,104,174,214,18
PUSHBUTTON "Launch Game",IDC_BUTTON_LAUNCH_GAME,189,304,70,14
PUSHBUTTON "Launch Game",IDC_BUTTON_LAUNCH_GAME,189,282,70,14
PUSHBUTTON "View Statistics",IDC_VIEW_STATISTICS,16,85,75,15
LTEXT "View high scores and usage statistics and other data saved from your play.",
IDC_STATIC,103,84,215,20
GROUPBOX "Statistics",IDC_STATIC,7,72,318,35
PUSHBUTTON "Clear Cache",IDC_CLEAR_CACHE,16,196,75,15
LTEXT "Erase the song and course cache. Use this if you change a song file and the change isn't showing in-game.",
IDC_STATIC,104,196,214,18
PUSHBUTTON "Languages",IDC_LANGUAGES,15,276,75,15
PUSHBUTTON "Languages",IDC_LANGUAGES,15,255,75,15
LTEXT "Create a new or manage existing language translations.",
IDC_STATIC,103,275,215,20
IDC_STATIC,103,254,215,20
LTEXT "StepMania Tools Main Menu",IDC_STATIC_HEADER_TEXT,5,2,
280,24
END
IDD_ENTER_COMMENT DIALOGEX 0, 0, 312, 202
@@ -401,7 +402,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 325
TOPMARGIN, 7
BOTTOMMARGIN, 318
BOTTOMMARGIN, 296
END
IDD_ENTER_COMMENT, DIALOG
@@ -460,9 +461,7 @@ END
// Bitmap
//
INSTALL BITMAP "install.bmp"
MANAGE BITMAP "manage.bmp"
MENU BITMAP "menu.bmp"
IDB_HEADER BITMAP "header.bmp"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
+1
View File
@@ -24,6 +24,7 @@ namespace SMPackageUtil
bool GetFileContentsOsAbsolute( const RString &sAbsoluteOsFile, RString &sOut );
void SetHeaderFont( CDialog &dlg );
void LocalizeDialogAndContents( CDialog &dlg );
}