From 28676c56c8a2c6c4ddad0211c811dd0da600f71d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sun, 8 Aug 2004 20:15:06 +0000 Subject: [PATCH] Sync to Wine-20040716: Krishna Murthy - Add the selected extension from file type filter if file name does not contain the file extension. Dmitry Timoshkov - Fix control coordinates in German and French versions of open file dialog. - Remove duplicate control ids in Catalan, Russian and Ukrainian dialogs. James Hawkins - Fixed collate icon behavior. - Check for empty PrinterName in PRINTDLG_WMCommandW. svn path=/trunk/; revision=10427 --- reactos/lib/comdlg32/cdlg_Ca.rc | 2 +- reactos/lib/comdlg32/cdlg_De.rc | 11 +++---- reactos/lib/comdlg32/cdlg_Fr.rc | 10 +++--- reactos/lib/comdlg32/cdlg_Ru.rc | 2 +- reactos/lib/comdlg32/cdlg_Uk.rc | 2 +- reactos/lib/comdlg32/filedlg.c | 57 ++++++++++++++++++++------------- reactos/lib/comdlg32/printdlg.c | 19 ++++++++--- 7 files changed, 63 insertions(+), 40 deletions(-) diff --git a/reactos/lib/comdlg32/cdlg_Ca.rc b/reactos/lib/comdlg32/cdlg_Ca.rc index 4f4da809592..403df1b31b8 100644 --- a/reactos/lib/comdlg32/cdlg_Ca.rc +++ b/reactos/lib/comdlg32/cdlg_Ca.rc @@ -169,7 +169,7 @@ FONT 8, "Helv" EDITTEXT 705, 226,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP CONTROL "" ,720,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,14,140,86 CONTROL "" ,721,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,116,140,28 - CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116 CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116 + CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116 CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116 CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26 DEFPUSHBUTTON "D'acord", IDOK, 4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP diff --git a/reactos/lib/comdlg32/cdlg_De.rc b/reactos/lib/comdlg32/cdlg_De.rc index 91c5c6840a2..a0caee09245 100644 --- a/reactos/lib/comdlg32/cdlg_De.rc +++ b/reactos/lib/comdlg32/cdlg_De.rc @@ -255,8 +255,8 @@ FONT 8, "Helv" LTEXT "&Suche in",IDC_LOOKINSTATIC,4,6,43,8, SS_NOTIFY COMBOBOX IDC_LOOKIN,49,3,132,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - LTEXT "" , IDC_TOOLBARSTATIC, 181, 2, 122, 17, NOT WS_GROUP | NOT WS_VISIBLE - LISTBOX IDC_SHELLSTATIC,4,20,292,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE + LTEXT "" , IDC_TOOLBARSTATIC, 181, 2, 102, 17, NOT WS_GROUP | NOT WS_VISIBLE + LISTBOX IDC_SHELLSTATIC,4,20,272,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE LTEXT "Datei&name:",IDC_FILENAMESTATIC,5,112,46,8, SS_NOTIFY EDITTEXT IDC_FILENAME,54,110,155,12,ES_AUTOHSCROLL @@ -266,10 +266,9 @@ FONT 8, "Helv" CONTROL "&Schreibgeschьtzt",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,145,100,10 - - DEFPUSHBUTTON "Ц&ffnen", IDOK,242,110,50,14 - PUSHBUTTON "Abbrechen", IDCANCEL,242,128,50,14 - PUSHBUTTON "&Hilfe", pshHelp,242,145,50,14 + DEFPUSHBUTTON "Ц&ffnen", IDOK,222,110,50,14 + PUSHBUTTON "Abbrechen", IDCANCEL,222,128,50,14 + PUSHBUTTON "&Hilfe", pshHelp,222,145,50,14 } PRINT32 DIALOG LOADONCALL MOVEABLE DISCARDABLE 32, 32, 288, 186 diff --git a/reactos/lib/comdlg32/cdlg_Fr.rc b/reactos/lib/comdlg32/cdlg_Fr.rc index 38fce69e6dd..f462bad0260 100644 --- a/reactos/lib/comdlg32/cdlg_Fr.rc +++ b/reactos/lib/comdlg32/cdlg_Fr.rc @@ -336,8 +336,8 @@ FONT 8, "Helv" LTEXT "&Rechercher dans",IDC_LOOKINSTATIC,4,6,43,8, SS_NOTIFY COMBOBOX IDC_LOOKIN,49,3,132,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP - LTEXT "" , IDC_TOOLBARSTATIC, 181, 2, 122, 17, NOT WS_GROUP | NOT WS_VISIBLE - LISTBOX IDC_SHELLSTATIC,4,20,292,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE + LTEXT "" , IDC_TOOLBARSTATIC, 181, 2, 102, 17, NOT WS_GROUP | NOT WS_VISIBLE + LISTBOX IDC_SHELLSTATIC,4,20,272,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE LTEXT "&Nom du fichier:",IDC_FILENAMESTATIC,5,112,46,8, SS_NOTIFY EDITTEXT IDC_FILENAME,54,110,155,12,ES_AUTOHSCROLL @@ -347,9 +347,9 @@ FONT 8, "Helv" CONTROL "&Protection йcriture",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,145,100,10 - DEFPUSHBUTTON "Ouvrir", IDOK,242,110,50,14 - PUSHBUTTON "Annuler", IDCANCEL,242,128,50,14 - PUSHBUTTON "&Aide", pshHelp,242,145,50,14 + DEFPUSHBUTTON "Ouvrir", IDOK,222,110,50,14 + PUSHBUTTON "Annuler", IDCANCEL,222,128,50,14 + PUSHBUTTON "&Aide", pshHelp,222,145,50,14 } STRINGTABLE DISCARDABLE diff --git a/reactos/lib/comdlg32/cdlg_Ru.rc b/reactos/lib/comdlg32/cdlg_Ru.rc index 3a76440baee..798d400884a 100644 --- a/reactos/lib/comdlg32/cdlg_Ru.rc +++ b/reactos/lib/comdlg32/cdlg_Ru.rc @@ -240,7 +240,7 @@ FONT 8, "Ms Sans Serif" LTEXT "Эмулирован", stc11, 60, 48, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP LTEXT "Место:", stc10, 16, 60, 36,10, SS_NOPREFIX LTEXT "Эмулировано", stc14, 60, 60, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP - LTEXT "Примечание:", stc13, 16, 72, 36,10, SS_NOPREFIX + LTEXT "Примечание:", stc9, 16, 72, 36,10, SS_NOPREFIX LTEXT "Эмулировано", stc13, 60, 72, 152,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP GROUPBOX "Копии", grp2, 160, 92, 120,64, WS_GROUP diff --git a/reactos/lib/comdlg32/cdlg_Uk.rc b/reactos/lib/comdlg32/cdlg_Uk.rc index 76d3b5cec7a..df82c1f086e 100644 --- a/reactos/lib/comdlg32/cdlg_Uk.rc +++ b/reactos/lib/comdlg32/cdlg_Uk.rc @@ -240,7 +240,7 @@ FONT 8, "Ms Sans Serif" LTEXT "Емульовано", stc11, 60, 48, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP LTEXT "Місце:", stc10, 16, 60, 36,10, SS_NOPREFIX LTEXT "Емульовано", stc14, 60, 60, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP - LTEXT "Примітка:", stc13, 16, 72, 36,10, SS_NOPREFIX + LTEXT "Примітка:", stc9, 16, 72, 36,10, SS_NOPREFIX LTEXT "Емульовано", stc13, 60, 72, 152,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP GROUPBOX "Копії", grp2, 160, 92, 120,64, WS_GROUP diff --git a/reactos/lib/comdlg32/filedlg.c b/reactos/lib/comdlg32/filedlg.c index aef7f774729..ef3f5b0e679 100644 --- a/reactos/lib/comdlg32/filedlg.c +++ b/reactos/lib/comdlg32/filedlg.c @@ -1871,35 +1871,48 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) case ONOPEN_OPEN: /* fill in the return struct and close the dialog */ TRACE("ONOPEN_OPEN %s\n", debugstr_w(lpstrPathAndFile)); { + WCHAR *ext = NULL; + /* update READONLY check box flag */ if ((SendMessageA(GetDlgItem(hwnd,IDC_OPENREADONLY),BM_GETCHECK,0,0) & 0x03) == BST_CHECKED) fodInfos->ofnInfos->Flags |= OFN_READONLY; else fodInfos->ofnInfos->Flags &= ~OFN_READONLY; - /* add default extension */ - if (fodInfos->defext) + /* Attach the file extension with file name*/ + ext = PathFindExtensionW(lpstrPathAndFile); + if (! *ext) + { + /* if no extension is specified with file name, then */ + /* attach the extension from file filter or default one */ + + WCHAR *filterExt = NULL; + LPWSTR lpstrFilter = NULL; + static const WCHAR szwDot[] = {'.',0}; + int PathLength = strlenW(lpstrPathAndFile); + + /* Attach the dot*/ + strcatW(lpstrPathAndFile, szwDot); + + /*Get the file extension from file type filter*/ + lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, + fodInfos->ofnInfos->nFilterIndex-1); + + if (lpstrFilter != (LPWSTR)CB_ERR) /* control is not empty */ + filterExt = PathFindExtensionW(lpstrFilter); + + if ( *filterExt ) /* attach the file extension from file type filter*/ + strcatW(lpstrPathAndFile, filterExt + 1); + else if ( fodInfos->defext ) /* attach the default file extension*/ + strcatW(lpstrPathAndFile, fodInfos->defext); + + /* In Open dialog: if file does not exist try without extension */ + if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && !PathFileExistsW(lpstrPathAndFile)) + lpstrPathAndFile[PathLength] = '\0'; + } + + if (fodInfos->defext) /* add default extension */ { - WCHAR *ext = PathFindExtensionW(lpstrPathAndFile); - - if (! *ext) - { - /* only add "." in case a default extension does exist */ - if (*fodInfos->defext != '\0') - { - static const WCHAR szwDot[] = {'.',0}; - int PathLength = strlenW(lpstrPathAndFile); - - strcatW(lpstrPathAndFile, szwDot); - strcatW(lpstrPathAndFile, fodInfos->defext); - - /* In Open dialog: if file does not exist try without extension */ - if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) - && !PathFileExistsW(lpstrPathAndFile)) - lpstrPathAndFile[PathLength] = '\0'; - } - } - /* Set/clear the output OFN_EXTENSIONDIFFERENT flag */ if (*ext) ext++; diff --git a/reactos/lib/comdlg32/printdlg.c b/reactos/lib/comdlg32/printdlg.c index edc555ad615..18e568647af 100644 --- a/reactos/lib/comdlg32/printdlg.c +++ b/reactos/lib/comdlg32/printdlg.c @@ -1622,11 +1622,22 @@ static LRESULT PRINTDLG_WMCommandW(HWND hDlg, WPARAM wParam, if(HIWORD(wParam) == EN_CHANGE) { INT copies = GetDlgItemInt(hDlg, edt3, NULL, FALSE); if(copies <= 1) + { + CheckDlgButton(hDlg, chx2, BST_UNCHECKED); + SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, + (WPARAM) IMAGE_ICON, 0); EnableWindow(GetDlgItem(hDlg, chx2), FALSE); + } else - EnableWindow(GetDlgItem(hDlg, chx2), TRUE); - } - break; + { + EnableWindow(GetDlgItem(hDlg, chx2), TRUE); + + SendDlgItemMessageA(hDlg, ico3, STM_SETIMAGE, + (WPARAM) IMAGE_ICON, + (LPARAM)PrintStructures->hNoCollateIcon); + } + } + break; case psh1: /* Print Setup */ { @@ -1638,7 +1649,7 @@ static LRESULT PRINTDLG_WMCommandW(HWND hDlg, WPARAM wParam, HANDLE hPrinter; WCHAR PrinterName[256]; - GetDlgItemTextW(hDlg, PrinterComboID, PrinterName, 255); + if (!GetDlgItemTextW(hDlg, PrinterComboID, PrinterName, 255)) break; if (!OpenPrinterW(PrinterName, &hPrinter, NULL)) { FIXME(" Call to OpenPrinter did not succeed!\n"); break;