From 84146684015c05eb5e9debae662b56ad93fae75b Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sun, 9 Jan 2005 16:31:36 +0000 Subject: [PATCH] Moved save* strings to resources. --- dlls/commdlg/cdlg.h | 5 +++++ dlls/commdlg/cdlg_En.rc | 5 +++++ dlls/commdlg/cdlg_Pl.rc | 5 +++++ dlls/commdlg/filedlg.c | 24 ++++++++++++++---------- dlls/commdlg/filedlg31.c | 23 ++++++++++++----------- 5 files changed, 41 insertions(+), 21 deletions(-) diff --git a/dlls/commdlg/cdlg.h b/dlls/commdlg/cdlg.h index 5f80e51dd88..a859c487fef 100644 --- a/dlls/commdlg/cdlg.h +++ b/dlls/commdlg/cdlg.h @@ -146,6 +146,11 @@ typedef struct { #define IDS_COLOR_WHITE 1055 #define IDS_FONT_SIZE 1200 +#define IDS_SAVE_BUTTON 1201 +#define IDS_SAVE_IN 1202 +#define IDS_SAVE 1203 +#define IDS_SAVE_AS 1204 +#define IDS_OPEN_FILE 1205 #include "windef.h" #include "winbase.h" diff --git a/dlls/commdlg/cdlg_En.rc b/dlls/commdlg/cdlg_En.rc index d4ede7a8cfa..3bd25763d65 100644 --- a/dlls/commdlg/cdlg_En.rc +++ b/dlls/commdlg/cdlg_En.rc @@ -463,6 +463,11 @@ STRINGTABLE DISCARDABLE /* Color names */ STRINGTABLE DISCARDABLE { IDS_FONT_SIZE "Select a font size between %d and %d points." + IDS_SAVE_BUTTON "&Save" + IDS_SAVE_IN "Save &in:" + IDS_SAVE "Save" + IDS_SAVE_AS "Save as" + IDS_OPEN_FILE "Open File" } /****************************************************************/ diff --git a/dlls/commdlg/cdlg_Pl.rc b/dlls/commdlg/cdlg_Pl.rc index 85fa2232a12..eb34f76ad53 100644 --- a/dlls/commdlg/cdlg_Pl.rc +++ b/dlls/commdlg/cdlg_Pl.rc @@ -439,6 +439,11 @@ STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE { IDS_FONT_SIZE "Wybierz czcionkę o rozmiarze pomiędzy %d a %d punktami." + IDS_SAVE_BUTTON "&Zapisz" + IDS_SAVE_IN "Zapisz &w:" + IDS_SAVE "Zapisz" + IDS_SAVE_AS "Zapisz jako" + IDS_OPEN_FILE "Otwórz Plik" } STRINGTABLE DISCARDABLE /* Color names */ diff --git a/dlls/commdlg/filedlg.c b/dlls/commdlg/filedlg.c index 64530ee1ba5..86f9dabefc2 100644 --- a/dlls/commdlg/filedlg.c +++ b/dlls/commdlg/filedlg.c @@ -1164,7 +1164,9 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) } else if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) { - SetWindowTextA(hwnd,"Save"); + WCHAR buf[16]; + LoadStringW(COMDLG32_hInstance, IDS_SAVE, buf, sizeof(buf)/sizeof(WCHAR)); + SetWindowTextW(hwnd, buf); } /* Initialise the file name edit control */ @@ -1388,11 +1390,14 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) (rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom), SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER); } - /* change Open to Save FIXME: use resources */ + /* change Open to Save */ if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) { - SetDlgItemTextA(hwnd,IDOK,"&Save"); - SetDlgItemTextA(hwnd,IDC_LOOKINSTATIC,"Save &in"); + WCHAR buf[16]; + LoadStringW(COMDLG32_hInstance, IDS_SAVE_BUTTON, buf, sizeof(buf)/sizeof(WCHAR)); + SetDlgItemTextW(hwnd, IDOK, buf); + LoadStringW(COMDLG32_hInstance, IDS_SAVE_IN, buf, sizeof(buf)/sizeof(WCHAR)); + SetDlgItemTextW(hwnd, IDC_LOOKINSTATIC, buf); } return 0; } @@ -1684,14 +1689,14 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCo #define ONOPEN_SEARCH 3 static void FILEDLG95_OnOpenMessage(HWND hwnd, int idCaption, int idText) { - char strMsgTitle[MAX_PATH]; - char strMsgText [MAX_PATH]; + WCHAR strMsgTitle[MAX_PATH]; + WCHAR strMsgText [MAX_PATH]; if (idCaption) - LoadStringA(COMDLG32_hInstance, idCaption, strMsgTitle, sizeof(strMsgTitle)); + LoadStringW(COMDLG32_hInstance, idCaption, strMsgTitle, sizeof(strMsgTitle)/sizeof(WCHAR)); else strMsgTitle[0] = '\0'; - LoadStringA(COMDLG32_hInstance, idText, strMsgText, sizeof(strMsgText)); - MessageBoxA(hwnd,strMsgText, strMsgTitle, MB_OK | MB_ICONHAND); + LoadStringW(COMDLG32_hInstance, idText, strMsgText, sizeof(strMsgText)/sizeof(WCHAR)); + MessageBoxW(hwnd,strMsgText, strMsgTitle, MB_OK | MB_ICONHAND); } BOOL FILEDLG95_OnOpen(HWND hwnd) @@ -3208,7 +3213,6 @@ HRESULT GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrF if(!lpsf) { - HRESULT hRes; SHGetDesktopFolder(&lpsf); hRes = GetName(lpsf,pidl,dwFlags,lpstrFileName); IShellFolder_Release(lpsf); diff --git a/dlls/commdlg/filedlg31.c b/dlls/commdlg/filedlg31.c index af45ed627b7..5fa41dcc92d 100644 --- a/dlls/commdlg/filedlg31.c +++ b/dlls/commdlg/filedlg31.c @@ -586,11 +586,8 @@ static LRESULT FD31_DiskChange( PFD31_DATA lfs ) static LRESULT FD31_FileTypeChange( PFD31_DATA lfs ) { LONG lRet; - WCHAR diskname[BUFFILE]; LPWSTR pstr; - diskname[0] = 0; - lRet = SendDlgItemMessageW(lfs->hwnd, cmb1, CB_GETCURSEL, 0, 0); if (lRet == LB_ERR) return TRUE; @@ -705,7 +702,6 @@ static LPWSTR FD31_DupToW(LPCSTR str, DWORD size) */ void FD31_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open) { - LPCSTR str; UNICODE_STRING usBuffer; ofnW->lStructSize = sizeof(OPENFILENAMEW); @@ -727,13 +723,18 @@ void FD31_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open) RtlCreateUnicodeStringFromAsciiz (&usBuffer,ofnA->lpstrInitialDir); ofnW->lpstrInitialDir = usBuffer.Buffer; } - if (ofnA->lpstrTitle) - str = ofnA->lpstrTitle; - else - /* Allocates default title (FIXME : get it from resource) */ - str = open ? "Open File" : "Save as"; - RtlCreateUnicodeStringFromAsciiz (&usBuffer,str); - ofnW->lpstrTitle = usBuffer.Buffer; + if (ofnA->lpstrTitle) { + RtlCreateUnicodeStringFromAsciiz (&usBuffer, ofnA->lpstrTitle); + ofnW->lpstrTitle = usBuffer.Buffer; + } else { + WCHAR buf[16]; + int len; + LoadStringW(COMDLG32_hInstance, open ? IDS_OPEN_FILE : IDS_SAVE_AS, + buf, sizeof(buf)/sizeof(WCHAR)); + len = lstrlenW(buf)+1; + ofnW->lpstrTitle = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); + memcpy((void*)ofnW->lpstrTitle, buf, len*sizeof(WCHAR)); + } ofnW->Flags = ofnA->Flags; ofnW->nFileOffset = ofnA->nFileOffset; ofnW->nFileExtension = ofnA->nFileExtension;