From b0c3deb666c2b43c034264e9431d2e9ec451190b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sat, 12 Feb 2005 21:03:08 +0000 Subject: [PATCH] Henning Gerhardt - Update German resources. Robert Shearman - Draw a representation of a document in the page setup dialog. - Change some FIXME's to TRACE's because everything we need is implemented and they fire for ones that we don't need to implement. Remi Assailly - char -> const char fixes. Jose Manuel Ferrer Ortiz - Updated Spanish resources. Dmitry Timoshkov - Correct coordinates of a couple of controls. - Do not forget to allocate internal OPENFILENAMEW structure for 16-bit GetOpenFileName, initialize it by zeros for 16/A cases. - Make GetOpenFileNameW with an old style open file dialog work with the original OPENFILENAMEW structure, making sure that all changes are passed back to the caller. Ulrich Czekalla - GetFileName31W should call unicode version of FD31_AllocPrivate. Jonathan Ernst - Updated French resources. svn path=/trunk/; revision=13514 --- reactos/lib/comdlg32/cdlg.h | 2 + reactos/lib/comdlg32/cdlg32.c | 2 +- reactos/lib/comdlg32/cdlg_De.rc | 22 ++++-- reactos/lib/comdlg32/cdlg_En.rc | 28 +++++++ reactos/lib/comdlg32/cdlg_Es.rc | 38 +++++----- reactos/lib/comdlg32/cdlg_Fr.rc | 11 +++ reactos/lib/comdlg32/cdlg_Ru.rc | 4 +- reactos/lib/comdlg32/filedlg.c | 48 ++++++++---- reactos/lib/comdlg32/filedlg16.c | 10 ++- reactos/lib/comdlg32/filedlg31.c | 44 +++++------ reactos/lib/comdlg32/filedlg31.h | 3 +- reactos/lib/comdlg32/printdlg.c | 123 +++++++++++++++++++++++++++++-- 12 files changed, 260 insertions(+), 75 deletions(-) diff --git a/reactos/lib/comdlg32/cdlg.h b/reactos/lib/comdlg32/cdlg.h index 3e3378e138c..4a470f20834 100644 --- a/reactos/lib/comdlg32/cdlg.h +++ b/reactos/lib/comdlg32/cdlg.h @@ -152,6 +152,8 @@ typedef struct { #define IDS_SAVE_AS 1204 #define IDS_OPEN_FILE 1205 +#define IDS_FAKEDOCTEXT 1300 + #include "windef.h" #include "winbase.h" #include "wingdi.h" diff --git a/reactos/lib/comdlg32/cdlg32.c b/reactos/lib/comdlg32/cdlg32.c index 197d986358e..eaf0eb5c017 100644 --- a/reactos/lib/comdlg32/cdlg32.c +++ b/reactos/lib/comdlg32/cdlg32.c @@ -63,7 +63,7 @@ BOOL (WINAPI *COMDLG32_SHGetFolderPathW)(HWND,int,HANDLE,DWORD,LPWSTR); * FALSE if sibling could not be loaded or instantiated twice, TRUE * otherwise. */ -static char * GPA_string = "Failed to get entry point %s for hinst = 0x%08x\n"; +static const char * GPA_string = "Failed to get entry point %s for hinst = 0x%08x\n"; #define GPA(dest, hinst, name) \ if(!(dest = (void*)GetProcAddress(hinst,name)))\ { \ diff --git a/reactos/lib/comdlg32/cdlg_De.rc b/reactos/lib/comdlg32/cdlg_De.rc index d7264e24dba..849c3531d44 100644 --- a/reactos/lib/comdlg32/cdlg_De.rc +++ b/reactos/lib/comdlg32/cdlg_De.rc @@ -148,7 +148,7 @@ END CHOOSE_FONT DIALOG DISCARDABLE 13, 54, 264, 147 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Font" +CAPTION "Schriftart" FONT 8, "MS Shell Dlg" { LTEXT "Schrift&art:",1088 ,6,3,40,9 @@ -315,7 +315,7 @@ FONT 8, "MS Shell Dlg" PRINT32_SETUP DIALOG LOADONCALL MOVEABLE DISCARDABLE 32, 32, 288, 178 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_CONTEXTHELP | DS_3DLOOK -CAPTION "Print Setup" +CAPTION "Druckereinrichtung" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,180,156,48,14,WS_GROUP @@ -441,15 +441,25 @@ STRINGTABLE DISCARDABLE /* Color names */ IDS_COLOR_GREEN "Grün" IDS_COLOR_OLIVE "Olivgrün" IDS_COLOR_NAVY "Dunkelblau" - IDS_COLOR_PURPLE "Violett" - IDS_COLOR_TEAL "Teal" + IDS_COLOR_PURPLE "Lila" + IDS_COLOR_TEAL "Blaugrün" IDS_COLOR_GRAY "Grau" IDS_COLOR_SILVER "Silber" IDS_COLOR_RED "Rot" IDS_COLOR_LIME "Hellgrün" IDS_COLOR_YELLOW "Gelb" IDS_COLOR_BLUE "Blau" - IDS_COLOR_FUCHSIA "Lila" - IDS_COLOR_AQUA "Aqua" + IDS_COLOR_FUCHSIA "Pink" + IDS_COLOR_AQUA "Aquamarin" IDS_COLOR_WHITE "Weiß" } + +STRINGTABLE DISCARDABLE +{ + IDS_FONT_SIZE "Wählen Sie eine Schriftgröße zwischen %d und %d Punkten aus." + IDS_SAVE_BUTTON "&Speichern" + IDS_SAVE_IN "Speichern &unter:" + IDS_SAVE "Speichern" + IDS_SAVE_AS "Speichern als" + IDS_OPEN_FILE "Öffne Datei" +} diff --git a/reactos/lib/comdlg32/cdlg_En.rc b/reactos/lib/comdlg32/cdlg_En.rc index 332eb1090ac..a18ad98c5a5 100644 --- a/reactos/lib/comdlg32/cdlg_En.rc +++ b/reactos/lib/comdlg32/cdlg_En.rc @@ -470,6 +470,34 @@ STRINGTABLE DISCARDABLE IDS_OPEN_FILE "Open File" } +/* Translators do not need to translate this text, unless the language uses a + * different character set or if the distribution of characters looks wrong. + * It is rendered illegibly small and is used to make a mock-up of a document. + */ +STRINGTABLE DISCARDABLE +{ + IDS_FAKEDOCTEXT + "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \ + Nulla a tortor. Etiam aliquet libero venenatis nunc. \n \ + \n \ + Sed augue ante, fermentum sit amet, imperdiet et, gravida eu, enim. \ + Donec nibh quam, sodales in, commodo vel, facilisis id, neque. \n \ + \n \ + Nunc eleifend bibendum nibh. Phasellus in lorem. Ut vel odio quis \ + libero adipiscing consequat. Donec consectetuer laoreet mauris. \n \ + \n \ + Maecenas tempor, ligula sed congue nonummy, arcu dolor ornare erat, \ + egestas iaculis magna purus sed turpis. \n \ + \n \ + Morbi ultricies est non ipsum. Cum sociis natoque penatibus et magnis \ + dis parturient montes, nascetur ridiculus mus. \n \ + \n \ + Duis sit amet nibh quis purus sollicitudin blandit. Curabitur justo. \ + Phasellus varius, erat eu luctus pharetra, odio elit fringilla leo, \ + non vulputate turpis elit id neque. Vestibulum sit amet tellus sed \ + tortor fermentum consectetuer." +} + /****************************************************************/ /* English neutral resources /****************************************************************/ diff --git a/reactos/lib/comdlg32/cdlg_Es.rc b/reactos/lib/comdlg32/cdlg_Es.rc index 25798e151c1..fe466299f97 100644 --- a/reactos/lib/comdlg32/cdlg_Es.rc +++ b/reactos/lib/comdlg32/cdlg_Es.rc @@ -47,7 +47,7 @@ FONT 8, "MS Shell Dlg" SAVE_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "&Guardar como..." +CAPTION "Guardar como..." FONT 8, "MS Shell Dlg" { LTEXT "Nombre de &archivo:", 1090, 6, 6, 76, 9 @@ -85,7 +85,7 @@ FONT 8, "MS Shell Dlg" LTEXT "&Hasta:", 1091, 120, 80, 30, 9 LTEXT "Calidad de impre&sión:", 1092, 6, 100, 76, 9 COMBOBOX cmb1, 80, 100, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP - CHECKBOX "Impri&mir en un archivo", chx1, 20, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "Impri&mir en archivo", chx1, 20, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP CHECKBOX "Condensado", chx2, 160, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP } @@ -96,7 +96,7 @@ CAPTION "Configuraci FONT 8, "MS Shell Dlg" { GROUPBOX "Impresora:", grp1, 6, 10, 180, 65, BS_GROUPBOX - RADIOBUTTON "Pre&determinada del sistema", rad1, 16, 20, 80, 12 + RADIOBUTTON "Impresora por &defecto", rad1, 16, 20, 80, 12 LTEXT "[ninguna]", 1088, 35, 35, 120, 9 RADIOBUTTON "Impresora &específica:", rad2, 16, 50, 80, 12 COMBOBOX cmb1, 35, 65, 149, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP @@ -187,7 +187,7 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Buscar" FONT 8, "MS Shell Dlg" { - LTEXT "Buscar:", -1, 4, 8, 42, 8 + LTEXT "Buscar:", -1, 4, 8, 42, 8 EDITTEXT edt1, 47, 7, 128, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP CHECKBOX "&Sólo palabra entera", chx1, 4, 26, 100, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP CHECKBOX "&Mayúsculas/minúsculas", chx2, 4, 42, 64, 12, BS_AUTOCHECKBOX | WS_TABSTOP @@ -202,7 +202,7 @@ FONT 8, "MS Shell Dlg" REPLACEDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 230, 94 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "R&eemplazar" +CAPTION "Reemplazar" FONT 8, "MS Shell Dlg" { LTEXT "Buscar:", -1, 4, 9, 48, 8 @@ -230,7 +230,7 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "&Ayuda", pshHelp, 50, 161, 48,14, WS_GROUP GROUPBOX "Impresora", grp4, 8, 4, 272,84, WS_GROUP - CONTROL "Imprimir a a&rchivo", chx1, "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,212,70,64,12 + CONTROL "Imprimir en a&rchivo", chx1, "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,212,70,64,12 PUSHBUTTON "&Propiedades", psh2, 212, 17, 60,14, WS_GROUP LTEXT "&Nombre:", stc6, 16, 20, 36,8 COMBOBOX cmb4, 52, 18, 152,152,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP @@ -296,7 +296,7 @@ END PAGESETUPDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 32, 32, 240, 240 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Página de configuración" +CAPTION "Configuración de página" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 @@ -392,8 +392,8 @@ STRINGTABLE DISCARDABLE página.\n\ Por favor, introduzca un valor entre %d y %d." PD32_FROM_NOT_ABOVE_TO "La entrada 'desde' no puede exceder \ a la entrada 'hasta'." - PD32_MARGINS_OVERLAP "Los márgenes overlap o fall outside \ -los boundaries del papel.\nPor favor, reintroduzca los márgenes." + PD32_MARGINS_OVERLAP "Los márgenes se superponen o quedan \ +fuera de los límites del papel.\nPor favor, reintroduzca los márgenes." PD32_NR_OF_COPIES_EMPTY "El número del valor 'Número de \ copias' no puede estar vacío." PD32_TOO_LARGE_COPIES "Este número tan grande de copias no \ @@ -421,11 +421,11 @@ desconocido." PD32_PRINTER_STATUS_PAPER_OUT "Sin papel; " PD32_PRINTER_STATUS_MANUAL_FEED "Ponga papel a mano; " PD32_PRINTER_STATUS_PAPER_PROBLEM "Problema con el papel; " - PD32_PRINTER_STATUS_OFFLINE "Impresora apagada; " + PD32_PRINTER_STATUS_OFFLINE "Impresora desconectada; " PD32_PRINTER_STATUS_IO_ACTIVE "E/S activa; " PD32_PRINTER_STATUS_BUSY "Ocupada; " PD32_PRINTER_STATUS_PRINTING "Imprimiendo; " - PD32_PRINTER_STATUS_OUTPUT_BIN_FULL "La bandeja de salida está llena; " + PD32_PRINTER_STATUS_OUTPUT_BIN_FULL "Bandeja de salida llena; " PD32_PRINTER_STATUS_NOT_AVAILABLE "No disponible; " PD32_PRINTER_STATUS_WAITING "Esperando; " PD32_PRINTER_STATUS_PROCESSING "Procesando; " @@ -434,10 +434,9 @@ desconocido." PD32_PRINTER_STATUS_TONER_LOW "Tóner bajo; " PD32_PRINTER_STATUS_NO_TONER "Sin tóner; " PD32_PRINTER_STATUS_PAGE_PUNT "Page punt; " - PD32_PRINTER_STATUS_USER_INTERVENTION "Interrumpido por el usuario; " + PD32_PRINTER_STATUS_USER_INTERVENTION "Interrumpida por el usuario; " PD32_PRINTER_STATUS_OUT_OF_MEMORY "Sin memoria; " - PD32_PRINTER_STATUS_DOOR_OPEN "La puerta de la impresora está \ -abierta; " + PD32_PRINTER_STATUS_DOOR_OPEN "Puerta de la impresora abierta; " PD32_PRINTER_STATUS_SERVER_UNKNOWN "Servidor de impresión desconocido; " PD32_PRINTER_STATUS_POWER_SAVE "Modo de ahorro de energía; " } @@ -445,9 +444,9 @@ abierta; " STRINGTABLE DISCARDABLE /* Color names */ { IDS_COLOR_BLACK "Negro" - IDS_COLOR_MAROON "Marrón" + IDS_COLOR_MAROON "Granate" IDS_COLOR_GREEN "Verde" - IDS_COLOR_OLIVE "Oliva" + IDS_COLOR_OLIVE "Verde oliva" IDS_COLOR_NAVY "Azul marino" IDS_COLOR_PURPLE "Morado" IDS_COLOR_TEAL "Turquesa" @@ -464,5 +463,10 @@ STRINGTABLE DISCARDABLE /* Color names */ STRINGTABLE DISCARDABLE { - IDS_FONT_SIZE "Elija un tamaño de fuente entre %d and %d puntos." + IDS_FONT_SIZE "Elija un tamaño de fuente entre %d y %d puntos." + IDS_SAVE_BUTTON "&Guardar" + IDS_SAVE_IN "Guardar &en:" + IDS_SAVE "Guardar" + IDS_SAVE_AS "Guardar como" + IDS_OPEN_FILE "Abrir archivo" } diff --git a/reactos/lib/comdlg32/cdlg_Fr.rc b/reactos/lib/comdlg32/cdlg_Fr.rc index e1e67e085f8..c0e9e52c6fa 100644 --- a/reactos/lib/comdlg32/cdlg_Fr.rc +++ b/reactos/lib/comdlg32/cdlg_Fr.rc @@ -3,6 +3,7 @@ * French language support * * Copyright 1995 Alexandre Julliard + * Copyright 2005 Jonathan Ernst * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -462,3 +463,13 @@ STRINGTABLE DISCARDABLE /* Color names */ IDS_COLOR_AQUA "Aqua" IDS_COLOR_WHITE "Blanc" } + +STRINGTABLE DISCARDABLE +{ + IDS_FONT_SIZE "Sélectionnez une taille de police entre %d et %d points." + IDS_SAVE_BUTTON "&Sauver" + IDS_SAVE_IN "Sauver &dans:" + IDS_SAVE "Enregistrer" + IDS_SAVE_AS "Enregistrer sous" + IDS_OPEN_FILE "Ouvrir Fichier" +} diff --git a/reactos/lib/comdlg32/cdlg_Ru.rc b/reactos/lib/comdlg32/cdlg_Ru.rc index 1401f6cbccb..0e7447cb2a9 100644 --- a/reactos/lib/comdlg32/cdlg_Ru.rc +++ b/reactos/lib/comdlg32/cdlg_Ru.rc @@ -235,9 +235,9 @@ FONT 8, "MS Shell Dlg" LTEXT "&Èìÿ:", stc6, 16, 20, 36,8 COMBOBOX cmb4, 52, 18, 152,152,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP LTEXT "Ñòàòóñ:", stc8, 16, 36, 36,10, SS_NOPREFIX - LTEXT "Ýìóëèðîâàí", stc12, 60, 36, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP + LTEXT "Ýìóëèðîâàí", stc12, 52, 36, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP LTEXT "Òèï:", stc7, 16, 48, 36,10, SS_NOPREFIX - LTEXT "Ýìóëèðîâàí", stc11, 60, 48, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP + LTEXT "Ýìóëèðîâàí", stc11, 52, 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 "Ïðèìå÷àíèå:", stc9, 16, 72, 36,10, SS_NOPREFIX diff --git a/reactos/lib/comdlg32/filedlg.c b/reactos/lib/comdlg32/filedlg.c index 232b3273a09..86b66351cba 100644 --- a/reactos/lib/comdlg32/filedlg.c +++ b/reactos/lib/comdlg32/filedlg.c @@ -3377,7 +3377,7 @@ static void MemFree(void *mem) */ static BOOL FD32_GetTemplate(PFD31_DATA lfs) { - LPOPENFILENAMEW ofnW = &lfs->ofnW; + LPOPENFILENAMEW ofnW = lfs->ofnW; PFD32_PRIVATE priv = (PFD32_PRIVATE) lfs->private1632; HANDLE hDlgTmpl; @@ -3445,9 +3445,9 @@ static BOOL CALLBACK FD32_Init(LPARAM lParam, PFD31_DATA lfs, DWORD data) if (NULL == lfs->private1632) return FALSE; if (IsUnicode) { - lfs->ofnW = *((LPOPENFILENAMEW) lParam); - if (lfs->ofnW.Flags & OFN_ENABLEHOOK) - if (lfs->ofnW.lpfnHook) + lfs->ofnW = (LPOPENFILENAMEW) lParam; + if (lfs->ofnW->Flags & OFN_ENABLEHOOK) + if (lfs->ofnW->lpfnHook) lfs->hook = TRUE; } else @@ -3456,7 +3456,8 @@ static BOOL CALLBACK FD32_Init(LPARAM lParam, PFD31_DATA lfs, DWORD data) if (priv->ofnA->Flags & OFN_ENABLEHOOK) if (priv->ofnA->lpfnHook) lfs->hook = TRUE; - FD31_MapOfnStructA(priv->ofnA, &lfs->ofnW, lfs->open); + lfs->ofnW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*lfs->ofnW)); + FD31_MapOfnStructA(priv->ofnA, lfs->ofnW, lfs->open); } if (! FD32_GetTemplate(lfs)) return FALSE; @@ -3472,18 +3473,25 @@ static BOOL CALLBACK FD32_Init(LPARAM lParam, PFD31_DATA lfs, DWORD data) BOOL CALLBACK FD32_CallWindowProc(PFD31_DATA lfs, UINT wMsg, WPARAM wParam, LPARAM lParam) { + BOOL ret; PFD32_PRIVATE priv = (PFD32_PRIVATE) lfs->private1632; if (priv->ofnA) { - return (BOOL) CallWindowProcA( - (WNDPROC)priv->ofnA->lpfnHook, lfs->hwnd, - wMsg, wParam, lParam); + TRACE("Call hookA %p (%p, %04x, %08x, %08lx)\n", + priv->ofnA->lpfnHook, lfs->hwnd, wMsg, wParam, lParam); + ret = priv->ofnA->lpfnHook(lfs->hwnd, wMsg, wParam, lParam); + TRACE("ret hookA %p (%p, %04x, %08x, %08lx)\n", + priv->ofnA->lpfnHook, lfs->hwnd, wMsg, wParam, lParam); + return ret; } - return (BOOL) CallWindowProcW( - (WNDPROC)lfs->ofnW.lpfnHook, lfs->hwnd, - wMsg, wParam, lParam); + TRACE("Call hookW %p (%p, %04x, %08x, %08lx)\n", + lfs->ofnW->lpfnHook, lfs->hwnd, wMsg, wParam, lParam); + ret = lfs->ofnW->lpfnHook(lfs->hwnd, wMsg, wParam, lParam); + TRACE("Ret hookW %p (%p, %04x, %08x, %08lx)\n", + lfs->ofnW->lpfnHook, lfs->hwnd, wMsg, wParam, lParam); + return ret; } /*********************************************************************** @@ -3493,7 +3501,7 @@ BOOL CALLBACK FD32_CallWindowProc(PFD31_DATA lfs, UINT wMsg, WPARAM wParam, static void CALLBACK FD32_UpdateResult(PFD31_DATA lfs) { PFD32_PRIVATE priv = (PFD32_PRIVATE) lfs->private1632; - LPOPENFILENAMEW ofnW = &lfs->ofnW; + LPOPENFILENAMEW ofnW = lfs->ofnW; if (priv->ofnA) { @@ -3513,7 +3521,7 @@ static void CALLBACK FD32_UpdateResult(PFD31_DATA lfs) static void CALLBACK FD32_UpdateFileTitle(PFD31_DATA lfs) { PFD32_PRIVATE priv = (PFD32_PRIVATE) lfs->private1632; - LPOPENFILENAMEW ofnW = &lfs->ofnW; + LPOPENFILENAMEW ofnW = lfs->ofnW; if (priv->ofnA) { @@ -3544,7 +3552,10 @@ static void CALLBACK FD32_Destroy(PFD31_DATA lfs) /* if ofnW has been allocated, have to free everything in it */ if (NULL != priv && NULL != priv->ofnA) - FD31_FreeOfnW(&lfs->ofnW); + { + FD31_FreeOfnW(lfs->ofnW); + HeapFree(GetProcessHeap(), 0, lfs->ofnW); + } } static void FD32_SetupCallbacks(PFD31_CALLBACKS callbacks) @@ -3667,7 +3678,7 @@ static BOOL GetFileName31W(LPOPENFILENAMEW lpofn, /* addess of structure with da if (!lpofn || !FD31_Init()) return FALSE; FD32_SetupCallbacks(&callbacks); - lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, &callbacks, (DWORD) FALSE); + lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, &callbacks, (DWORD) TRUE); if (lfs) { hInst = (HINSTANCE)GetWindowLongPtrW( lpofn->hwndOwner, GWLP_HINSTANCE ); @@ -3676,7 +3687,8 @@ static BOOL GetFileName31W(LPOPENFILENAMEW lpofn, /* addess of structure with da FD31_DestroyPrivate(lfs); } - TRACE("return lpstrFile=%s !\n", debugstr_w(lpofn->lpstrFile)); + TRACE("file %s, file offset %d, ext offset %d\n", + debugstr_w(lpofn->lpstrFile), lpofn->nFileOffset, lpofn->nFileExtension); return bRet; } @@ -3697,6 +3709,10 @@ BOOL WINAPI GetOpenFileNameA( { BOOL win16look = FALSE; + /* OFN_FILEMUSTEXIST implies OFN_PATHMUSTEXIST */ + if (ofn->Flags & OFN_FILEMUSTEXIST) + ofn->Flags |= OFN_PATHMUSTEXIST; + if (ofn->Flags & (OFN_ALLOWMULTISELECT|OFN_ENABLEHOOK|OFN_ENABLETEMPLATE)) win16look = (ofn->Flags & OFN_EXPLORER) ? FALSE : TRUE; diff --git a/reactos/lib/comdlg32/filedlg16.c b/reactos/lib/comdlg32/filedlg16.c index ff50aa76057..d2d34804ff7 100644 --- a/reactos/lib/comdlg32/filedlg16.c +++ b/reactos/lib/comdlg32/filedlg16.c @@ -170,7 +170,8 @@ static BOOL CALLBACK FD16_Init(LPARAM lParam, PFD31_DATA lfs, DWORD data) if (priv->ofn16->lpfnHook) lfs->hook = TRUE; - FD16_MapOfnStruct16(priv->ofn16, &lfs->ofnW, lfs->open); + lfs->ofnW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*lfs->ofnW)); + FD16_MapOfnStruct16(priv->ofn16, lfs->ofnW, lfs->open); if (! FD16_GetTemplate(lfs)) return FALSE; @@ -204,7 +205,7 @@ BOOL CALLBACK FD16_CallWindowProc(PFD31_DATA lfs, UINT wMsg, WPARAM wParam, static void CALLBACK FD16_UpdateResult(PFD31_DATA lfs) { PFD16_PRIVATE priv = (PFD16_PRIVATE) lfs->private1632; - LPOPENFILENAMEW ofnW = &lfs->ofnW; + LPOPENFILENAMEW ofnW = lfs->ofnW; if (priv->ofn16) { /* we have to convert to short (8.3) path */ @@ -240,7 +241,7 @@ static void CALLBACK FD16_UpdateResult(PFD31_DATA lfs) static void CALLBACK FD16_UpdateFileTitle(PFD31_DATA lfs) { PFD16_PRIVATE priv = (PFD16_PRIVATE) lfs->private1632; - LPOPENFILENAMEW ofnW = &lfs->ofnW; + LPOPENFILENAMEW ofnW = lfs->ofnW; if (priv->ofn16) { @@ -279,7 +280,8 @@ static void CALLBACK FD16_Destroy(PFD31_DATA lfs) GlobalUnlock16(priv->hGlobal16); GlobalFree16(priv->hGlobal16); } - FD31_FreeOfnW(&lfs->ofnW); + FD31_FreeOfnW(lfs->ofnW); + HeapFree(GetProcessHeap(), 0, lfs->ofnW); } } diff --git a/reactos/lib/comdlg32/filedlg31.c b/reactos/lib/comdlg32/filedlg31.c index 9f26997c4ef..9542e557854 100644 --- a/reactos/lib/comdlg32/filedlg31.c +++ b/reactos/lib/comdlg32/filedlg31.c @@ -38,6 +38,7 @@ #include "cderr.h" #include "winreg.h" #include "winternl.h" +#include "shlwapi.h" WINE_DEFAULT_DEBUG_CHANNEL(commdlg); @@ -305,9 +306,9 @@ LONG FD31_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam, void FD31_UpdateResult(PFD31_DATA lfs, WCHAR *tmpstr) { int lenstr2; - LPOPENFILENAMEW ofnW = &lfs->ofnW; + LPOPENFILENAMEW ofnW = lfs->ofnW; WCHAR tmpstr2[BUFFILE]; - WCHAR *bs; + WCHAR *p; TRACE("%s\n", debugstr_w(tmpstr)); if(ofnW->Flags & OFN_NOVALIDATE) @@ -320,17 +321,18 @@ void FD31_UpdateResult(PFD31_DATA lfs, WCHAR *tmpstr) lstrcpynW(tmpstr2+lenstr2, tmpstr, BUFFILE-lenstr2); if (ofnW->lpstrFile) lstrcpynW(ofnW->lpstrFile, tmpstr2, ofnW->nMaxFile); - if((bs = strrchrW(tmpstr2, '\\')) != NULL) - ofnW->nFileOffset = bs - tmpstr2 +1; - else - ofnW->nFileOffset = 0; - ofnW->nFileExtension = 0; - while(tmpstr2[ofnW->nFileExtension] != '.' && tmpstr2[ofnW->nFileExtension] != '\0') - ofnW->nFileExtension++; - if (tmpstr2[ofnW->nFileExtension] == '\0') - ofnW->nFileExtension = 0; - else - ofnW->nFileExtension++; + + /* set filename offset */ + p = PathFindFileNameW(ofnW->lpstrFile); + ofnW->nFileOffset = (p - ofnW->lpstrFile); + + /* set extension offset */ + p = PathFindExtensionW(ofnW->lpstrFile); + ofnW->nFileExtension = (*p) ? (p - ofnW->lpstrFile) + 1 : 0; + + TRACE("file %s, file offset %d, ext offset %d\n", + debugstr_w(ofnW->lpstrFile), ofnW->nFileOffset, ofnW->nFileExtension); + /* update the real client structures if any */ lfs->callbacks->UpdateResult(lfs); } @@ -342,7 +344,7 @@ void FD31_UpdateResult(PFD31_DATA lfs, WCHAR *tmpstr) void FD31_UpdateFileTitle(PFD31_DATA lfs) { LONG lRet; - LPOPENFILENAMEW ofnW = &lfs->ofnW; + LPOPENFILENAMEW ofnW = lfs->ofnW; if (ofnW->lpstrFileTitle != NULL) { lRet = SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETCURSEL, 0, 0); @@ -447,14 +449,14 @@ static LRESULT FD31_TestPath( PFD31_DATA lfs, LPWSTR path ) else { strcpyW(tmpstr2, path); - if(!(lfs->ofnW.Flags & OFN_NOVALIDATE)) + if(!(lfs->ofnW->Flags & OFN_NOVALIDATE)) *path = 0; } TRACE("path=%s, tmpstr2=%s\n", debugstr_w(path), debugstr_w(tmpstr2)); SetDlgItemTextW( hWnd, edt1, tmpstr2 ); FD31_ScanDir(hWnd, path); - return (lfs->ofnW.Flags & OFN_NOVALIDATE) ? TRUE : FALSE; + return (lfs->ofnW->Flags & OFN_NOVALIDATE) ? TRUE : FALSE; } /* no wildcards, we might have a directory or a filename */ @@ -501,7 +503,7 @@ static LRESULT FD31_Validate( PFD31_DATA lfs, LPWSTR path, UINT control, INT ite LONG lRet; HWND hWnd = lfs->hwnd; OPENFILENAMEW ofnsav; - LPOPENFILENAMEW ofnW = &lfs->ofnW; + LPOPENFILENAMEW ofnW = lfs->ofnW; WCHAR filename[BUFFILE]; ofnsav = *ofnW; /* for later restoring */ @@ -610,9 +612,7 @@ LRESULT FD31_WMCommand(HWND hWnd, LPARAM lParam, UINT notification, FD31_StripEditControl(hWnd); if (notification == LBN_DBLCLK) { - if (FD31_Validate( lfs, NULL, control, 0, FALSE )) - EndDialog(hWnd, TRUE); - return TRUE; + return SendMessageW(hWnd, WM_COMMAND, IDOK, 0); } else if (notification == LBN_SELCHANGE) return FD31_FileListSelect( lfs ); @@ -700,7 +700,7 @@ static LPWSTR FD31_DupToW(LPCSTR str, DWORD size) * FD31_MapOfnStructA [internal] * map a 32 bits Ansi structure to an Unicode one */ -void FD31_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open) +void FD31_MapOfnStructA(const LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open) { UNICODE_STRING usBuffer; @@ -828,7 +828,7 @@ LONG FD31_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) if (!lfs) return FALSE; SetPropA(hWnd, FD31_OFN_PROP, (HANDLE)lfs); lfs->hwnd = hWnd; - ofn = &lfs->ofnW; + ofn = lfs->ofnW; TRACE("flags=%lx initialdir=%s\n", ofn->Flags, debugstr_w(ofn->lpstrInitialDir)); diff --git a/reactos/lib/comdlg32/filedlg31.h b/reactos/lib/comdlg32/filedlg31.h index 7f75fe205d3..2329eea7ae2 100644 --- a/reactos/lib/comdlg32/filedlg31.h +++ b/reactos/lib/comdlg32/filedlg31.h @@ -44,7 +44,8 @@ typedef struct tagFD31_DATA LPARAM lParam; /* save original lparam */ LPCVOID template; /* template for 32 bits resource */ BOOL open; /* TRUE if open dialog, FALSE if save dialog */ - OPENFILENAMEW ofnW; /* copy of original structure or work struct */ + LPOPENFILENAMEW ofnW; /* pointer either to the original structure or + a W copy for A/16 API */ LPVOID private1632; /* 16/32 bit caller private data */ PFD31_CALLBACKS callbacks; /* callbacks to handle 16/32 bit differences */ } FD31_DATA; diff --git a/reactos/lib/comdlg32/printdlg.c b/reactos/lib/comdlg32/printdlg.c index 159169a829e..c9eb8ac5488 100644 --- a/reactos/lib/comdlg32/printdlg.c +++ b/reactos/lib/comdlg32/printdlg.c @@ -71,6 +71,11 @@ static struct pd_flags psd_flags[] = { {-1, NULL} }; +/* address of wndproc for subclassed Static control */ +static WNDPROC lpfnStaticWndProc; +/* the text of the fake document to render for the Page Setup dialog */ +static WCHAR wszFakeDocumentText[1024]; + /*********************************************************************** * PRINTDLG_OpenDefaultPrinter * @@ -2551,6 +2556,8 @@ static BOOL PRINTDLG_PS_WMCommandA( HWND hDlg, WPARAM wParam, LPARAM lParam, PageSetupDataA *pda ) { + TRACE("loword (lparam) %d, wparam 0x%x, lparam %08lx\n", + LOWORD(lParam),wParam,lParam); switch (LOWORD(wParam)) { case IDOK: if (!PRINTDLG_PS_UpdateDlgStructA(hDlg, pda)) @@ -2570,9 +2577,6 @@ PRINTDLG_PS_WMCommandA( return TRUE; } } - FIXME("loword (lparam) %d, wparam 0x%x, lparam %08lx, STUB mostly.\n", - LOWORD(lParam),wParam,lParam - ); return FALSE; } @@ -2580,6 +2584,8 @@ static BOOL PRINTDLG_PS_WMCommandW( HWND hDlg, WPARAM wParam, LPARAM lParam, PageSetupDataW *pda ) { + TRACE("loword (lparam) %d, wparam 0x%x, lparam %08lx\n", + LOWORD(lParam),wParam,lParam); switch (LOWORD(wParam)) { case IDOK: if (!PRINTDLG_PS_UpdateDlgStructW(hDlg, pda)) @@ -2599,13 +2605,114 @@ PRINTDLG_PS_WMCommandW( return TRUE; } } - FIXME("loword (lparam) %d, wparam 0x%x, lparam %08lx, STUB mostly.\n", - LOWORD(lParam),wParam,lParam - ); return FALSE; } +static LRESULT CALLBACK +PagePaintProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (uMsg == WM_PAINT) + { + PAINTSTRUCT ps; + RECT rcClient; + HPEN hpen, holdpen; + HDC hdc; + HFONT hfont, holdfont; + LOGFONTW lf; + HBRUSH hbrush, holdbrush; + INT oldbkmode; + + hdc = BeginPaint(hWnd, &ps); + + GetClientRect(hWnd, &rcClient); + + /* fill background */ + hbrush = GetSysColorBrush(COLOR_3DHIGHLIGHT); + FillRect(hdc, &rcClient, hbrush); + holdbrush = SelectObject(hdc, hbrush); + + hpen = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW)); + holdpen = SelectObject(hdc, hpen); + + /* paint left edge */ + MoveToEx(hdc, rcClient.left, rcClient.top, NULL); + LineTo(hdc, rcClient.left, rcClient.bottom-1); + + /* paint top edge */ + MoveToEx(hdc, rcClient.left, rcClient.top, NULL); + LineTo(hdc, rcClient.right, rcClient.top); + + hpen = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DDKSHADOW)); + DeleteObject(SelectObject(hdc, hpen)); + + /* paint right edge */ + MoveToEx(hdc, rcClient.right-1, rcClient.top, NULL); + LineTo(hdc, rcClient.right-1, rcClient.bottom); + + /* paint bottom edge */ + MoveToEx(hdc, rcClient.left, rcClient.bottom-1, NULL); + LineTo(hdc, rcClient.right, rcClient.bottom-1); + + hpen = CreatePen(PS_DASH, 1, GetSysColor(COLOR_3DSHADOW)); + DeleteObject(SelectObject(hdc, hpen)); + + /* draw dashed rectangle showing margins */ + + /* FIXME: use real margin values */ + rcClient.left += 5; + rcClient.top += 5; + rcClient.right -= 5; + rcClient.bottom -= 5; + + /* if the space is too small then we make sure to not draw anything */ + rcClient.left = min(rcClient.left,rcClient.right); + rcClient.top = min(rcClient.top,rcClient.bottom); + + Rectangle(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); + + DeleteObject(SelectObject(hdc, holdpen)); + + /* draw the fake document */ + + /* give text a bit of a space from the frame */ + rcClient.left += 2; + rcClient.top += 2; + rcClient.right -= 2; + rcClient.bottom -= 2; + + /* if the space is too small then we make sure to not draw anything */ + rcClient.left = min(rcClient.left,rcClient.right); + rcClient.top = min(rcClient.top,rcClient.bottom); + + /* select a nice scalable font, because we want the text really small */ + SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0); + lf.lfHeight = 6; /* value chosen based on visual effect */ + hfont = CreateFontIndirectW(&lf); + holdfont = SelectObject(hdc, hfont); + + /* if text not loaded, then do so now */ + if (wszFakeDocumentText[0] == '\0') + LoadStringW(COMDLG32_hInstance, + IDS_FAKEDOCTEXT, + wszFakeDocumentText, + sizeof(wszFakeDocumentText)/sizeof(wszFakeDocumentText[0])); + + oldbkmode = SetBkMode(hdc, TRANSPARENT); + DrawTextW(hdc, wszFakeDocumentText, -1, &rcClient, DT_TOP|DT_LEFT|DT_NOPREFIX|DT_WORDBREAK); + SetBkMode(hdc, oldbkmode); + + DeleteObject(SelectObject(hdc, holdfont)); + + SelectObject(hdc, holdbrush); + + EndPaint(hWnd, &ps); + return 0; + } + else + return CallWindowProcW(lpfnStaticWndProc, hWnd, uMsg, wParam, lParam); +} + static INT_PTR CALLBACK PageDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -2613,6 +2720,10 @@ PageDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) INT_PTR res = FALSE; if (uMsg==WM_INITDIALOG) { + lpfnStaticWndProc = (WNDPROC)SetWindowLongPtrW( + GetDlgItem(hDlg, rct1), + GWLP_WNDPROC, + (ULONG_PTR)PagePaintProc); res = TRUE; pda = (PageSetupDataA*)lParam; SetPropA(hDlg,"__WINE_PAGESETUPDLGDATA",pda);