Ignore:
Timestamp:
Sep 5, 2001, 2:14:25 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comdlg32/filedlg.c

    r6315 r6645  
     1/* $Id: filedlg.c,v 1.6 2001-09-05 12:12:00 bird Exp $ */
    12/*
    23 * COMMDLG - File Dialogs
     
    2829#define GlobalLock16 GlobalLock
    2930#define GlobalUnlock16 GlobalUnlock
    30 #define GlobalAlloc16   GlobalAlloc
    31 #define FreeResource16  FreeResource
     31#define GlobalAlloc16   GlobalAlloc
     32#define FreeResource16  FreeResource
    3233#define LoadResource16  LoadResourceA
    3334#define FindResource16  FindResourceA
    34 #define MapSL(a)        a
     35#define MapSL(a)    a
    3536#define CallWindowProc16 CallWindowProcA
    3637
     
    4243
    4344#define BUFFILE 512
    44 #define BUFFILEALLOC 512 * sizeof(WCHAR)   
    45 
    46 struct FSPRIVATE 
     45#define BUFFILEALLOC 512 * sizeof(WCHAR)
     46
     47struct FSPRIVATE
    4748{
    4849    HWND hwnd; /* file dialog window handle */
     
    7576#define LFS32A 2
    7677#define LFS32W 3
    77  
     78
    7879static const WCHAR FILE_star[] = {'*','.','*', 0};
    7980static const WCHAR FILE_bslash[] = {'\\', 0};
     
    111112
    112113LRESULT WINAPI FileOpenDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
    113                                 LPARAM lParam);
     114                LPARAM lParam);
    114115LRESULT WINAPI FileSaveDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
    115                                 LPARAM lParam);
     116                LPARAM lParam);
    116117
    117118static LRESULT WINAPI FileOpenDlgProc(HWND hDlg, UINT msg,
     
    119120
    120121/***********************************************************************
    121  *                              FileDlg_Init                    [internal]
     122 *              FileDlg_Init            [internal]
    122123 */
    123124static BOOL FileDlg_Init(void)
     
    125126    static BOOL initialized = 0;
    126127    CURSORICONINFO *fldrInfo;
    127    
     128
    128129    if (!initialized) {
    129130#ifdef __WIN32OS2__
    130         if (!hFolder) hFolder = LoadImageA(0, MAKEINTRESOURCEA(OIC_FOLDER), IMAGE_ICON, 16, 16, LR_SHARED);
    131         if (!hFolder2) hFolder2 = LoadImageA(0, MAKEINTRESOURCEA(OIC_FOLDER2), IMAGE_ICON, 16, 16, LR_SHARED);
    132         if (!hFloppy) hFloppy = LoadImageA(0, MAKEINTRESOURCEA(OIC_FLOPPY), IMAGE_ICON, 16, 16, LR_SHARED);
    133         if (!hHDisk) hHDisk = LoadImageA(0, MAKEINTRESOURCEA(OIC_HDISK), IMAGE_ICON, 16, 16, LR_SHARED);
    134         if (!hCDRom) hCDRom = LoadImageA(0, MAKEINTRESOURCEA(OIC_CDROM), IMAGE_ICON, 16, 16, LR_SHARED);
    135         if (!hNet) hNet = LoadImageA(0, MAKEINTRESOURCEA(OIC_NETWORK), IMAGE_ICON, 16, 16, LR_SHARED);
     131    if (!hFolder) hFolder = LoadImageA(0, MAKEINTRESOURCEA(OIC_FOLDER), IMAGE_ICON, 16, 16, LR_SHARED);
     132    if (!hFolder2) hFolder2 = LoadImageA(0, MAKEINTRESOURCEA(OIC_FOLDER2), IMAGE_ICON, 16, 16, LR_SHARED);
     133    if (!hFloppy) hFloppy = LoadImageA(0, MAKEINTRESOURCEA(OIC_FLOPPY), IMAGE_ICON, 16, 16, LR_SHARED);
     134    if (!hHDisk) hHDisk = LoadImageA(0, MAKEINTRESOURCEA(OIC_HDISK), IMAGE_ICON, 16, 16, LR_SHARED);
     135    if (!hCDRom) hCDRom = LoadImageA(0, MAKEINTRESOURCEA(OIC_CDROM), IMAGE_ICON, 16, 16, LR_SHARED);
     136    if (!hNet) hNet = LoadImageA(0, MAKEINTRESOURCEA(OIC_NETWORK), IMAGE_ICON, 16, 16, LR_SHARED);
    136137#else
    137138        HINSTANCE inst = GetModuleHandleA( "comdlg32.dll" );
     
    148149        hNet     = LoadImageA( inst, "NETWORK", IMAGE_ICON, 16, 16, LR_SHARED );
    149150#endif
    150         if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 ||
    151             hHDisk == 0 || hCDRom == 0 || hNet == 0)
    152         {
    153             ERR("Error loading icons !\n");
    154             return FALSE;
    155         }
     151    if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 ||
     152        hHDisk == 0 || hCDRom == 0 || hNet == 0)
     153    {
     154        ERR("Error loading icons !\n");
     155        return FALSE;
     156    }
    156157#ifdef __WIN32OS2__
    157         fldrHeight = 16;
    158         fldrWidth = 16;
     158    fldrHeight = 16;
     159    fldrWidth = 16;
    159160#else
    160         fldrInfo = (CURSORICONINFO *) GlobalLock16( hFolder2 );
    161         if (!fldrInfo)
    162         {       
    163             ERR("Error measuring icons !\n");
    164             return FALSE;
    165         }
    166         fldrHeight = fldrInfo -> nHeight;
    167         fldrWidth = fldrInfo -> nWidth;
    168         GlobalUnlock16( hFolder2 );
    169 #endif
    170         initialized = TRUE;
     161    fldrInfo = (CURSORICONINFO *) GlobalLock16( hFolder2 );
     162    if (!fldrInfo)
     163    {
     164        ERR("Error measuring icons !\n");
     165        return FALSE;
     166    }
     167    fldrHeight = fldrInfo -> nHeight;
     168    fldrWidth = fldrInfo -> nWidth;
     169    GlobalUnlock16( hFolder2 );
     170#endif
     171    initialized = TRUE;
    171172    }
    172173    return TRUE;
     
    188189    if (ofnW->Flags & OFN_ENABLETEMPLATEHANDLE)
    189190    {
    190         if (!(lfs->template = LockResource( ofnW->hInstance )))
    191         {
    192             COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    193             return FALSE;
    194         }
     191    if (!(lfs->template = LockResource( ofnW->hInstance )))
     192    {
     193        COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
     194        return FALSE;
     195    }
    195196    }
    196197    else if (ofnW->Flags & OFN_ENABLETEMPLATE)
    197198    {
    198         HANDLE hResInfo;
     199    HANDLE hResInfo;
    199200        if (lfs->ofnA)
    200             hResInfo = FindResourceA(lfs->ofnA->hInstance,
    201                                 lfs->ofnA->lpTemplateName,
     201        hResInfo = FindResourceA(lfs->ofnA->hInstance,
     202                lfs->ofnA->lpTemplateName,
    202203                                 RT_DIALOGA);
    203204        else
    204             hResInfo = FindResourceW(ofnW->hInstance,
    205                                 ofnW->lpTemplateName,
     205        hResInfo = FindResourceW(ofnW->hInstance,
     206                ofnW->lpTemplateName,
    206207                                 RT_DIALOGW);
    207208        if (!hResInfo)
    208         {
    209             COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
    210             return FALSE;
    211         }
    212         if (!(hDlgTmpl = LoadResource(ofnW->hInstance,
    213                                 hResInfo)) ||
    214                     !(lfs->template = LockResource(hDlgTmpl)))
    215         {
    216             COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    217             return FALSE;
    218         }
     209    {
     210        COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
     211        return FALSE;
     212    }
     213    if (!(hDlgTmpl = LoadResource(ofnW->hInstance,
     214                hResInfo)) ||
     215            !(lfs->template = LockResource(hDlgTmpl)))
     216    {
     217        COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
     218        return FALSE;
     219    }
    219220    } else { /* get it from internal Wine resource */
    220         HANDLE hResInfo;
    221         if (!(hResInfo = FindResourceA(COMMDLG_hInstance32,
     221    HANDLE hResInfo;
     222    if (!(hResInfo = FindResourceA(COMMDLG_hInstance32,
    222223             lfs->open? "OPEN_FILE":"SAVE_FILE", RT_DIALOGA)))
    223         {
    224             COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
    225             return FALSE;
     224    {
     225        COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
     226        return FALSE;
    226227        }
    227228        if (!(hDlgTmpl = LoadResource(COMMDLG_hInstance32, hResInfo )) ||
     
    253254    else if (ofn16->Flags & OFN_ENABLETEMPLATE)
    254255    {
    255         HANDLE16 hResInfo;
    256         if (!(hResInfo = FindResource16(ofn16->hInstance,
    257                                         MapSL(ofn16->lpTemplateName),
     256    HANDLE16 hResInfo;
     257    if (!(hResInfo = FindResource16(ofn16->hInstance,
     258                    MapSL(ofn16->lpTemplateName),
    258259                                        RT_DIALOGA)))
    259         {
    260             COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
    261             return FALSE;
    262         }
    263         if (!(lfs->hDlgTmpl16 = LoadResource16( ofn16->hInstance, hResInfo )))
    264         {
    265             COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    266             return FALSE;
    267         }
     260    {
     261        COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
     262        return FALSE;
     263    }
     264    if (!(lfs->hDlgTmpl16 = LoadResource16( ofn16->hInstance, hResInfo )))
     265    {
     266        COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
     267        return FALSE;
     268    }
    268269        lfs->hResource16 = lfs->hDlgTmpl16;
    269270    }
    270271    else
    271272    { /* get resource from (32 bits) own Wine resource; convert it to 16 */
    272         HANDLE hResInfo, hDlgTmpl32;
     273    HANDLE hResInfo, hDlgTmpl32;
    273274        LPCVOID template32;
    274275        DWORD size;
    275276
    276         if (!(hResInfo = FindResourceA(COMMDLG_hInstance32,
     277    if (!(hResInfo = FindResourceA(COMMDLG_hInstance32,
    277278               lfs->open ? "OPEN_FILE":"SAVE_FILE", RT_DIALOGA)))
    278         {
    279             COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
    280             return FALSE;
    281         }
    282         if (!(hDlgTmpl32 = LoadResource(COMMDLG_hInstance32, hResInfo )) ||
    283             !(template32 = LockResource( hDlgTmpl32 )))
    284         {
    285             COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    286             return FALSE;
    287         }
     279    {
     280        COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
     281        return FALSE;
     282    }
     283    if (!(hDlgTmpl32 = LoadResource(COMMDLG_hInstance32, hResInfo )) ||
     284        !(template32 = LockResource( hDlgTmpl32 )))
     285    {
     286        COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
     287        return FALSE;
     288    }
    288289        size = SizeofResource(GetModuleHandleA("COMDLG32"), hResInfo);
    289290        hGlobal16 = GlobalAlloc16(0, size);
     
    321322    cp = strrchrW(temp, '\\');
    322323    if (cp != NULL) {
    323         strcpyW(temp, cp+1);
     324    strcpyW(temp, cp+1);
    324325    }
    325326    cp = strrchrW(temp, ':');
    326327    if (cp != NULL) {
    327         strcpyW(temp, cp+1);
     328    strcpyW(temp, cp+1);
    328329    }
    329330    /* FIXME: shouldn't we do something with the result here? ;-) */
     
    366367
    367368/***********************************************************************
    368  *                              FILEDLG_ScanDir                 [internal]
     369 *              FILEDLG_ScanDir                 [internal]
    369370 */
    370371static BOOL FILEDLG_ScanDir(HWND hWnd, LPWSTR newPath)
    371372{
    372     WCHAR               buffer[BUFFILE];
    373     HWND                hdlg, hdlgDir;
     373    WCHAR       buffer[BUFFILE];
     374    HWND        hdlg, hdlgDir;
    374375    LRESULT             lRet = TRUE;
    375376    HCURSOR             hCursorWait, oldCursor;
     
    387388    /* list of files */
    388389    if ((hdlg = GetDlgItem(hWnd, lst1)) != 0) {
    389         WCHAR*  scptr; /* ptr on semi-colon */
    390         WCHAR*  filter = buffer;
    391 
    392         TRACE("Using filter %s\n", debugstr_w(filter));
    393         SendMessageW(hdlg, LB_RESETCONTENT, 0, 0);
    394         while (filter) {
    395             scptr = strchrW(filter, ';');
    396             if (scptr)  *scptr = 0;
     390        WCHAR*  scptr; /* ptr on semi-colon */
     391    WCHAR*  filter = buffer;
     392
     393    TRACE("Using filter %s\n", debugstr_w(filter));
     394    SendMessageW(hdlg, LB_RESETCONTENT, 0, 0);
     395    while (filter) {
     396        scptr = strchrW(filter, ';');
     397        if (scptr)  *scptr = 0;
    397398            while (*filter == ' ') filter++;
    398             TRACE("Using file spec %s\n", debugstr_w(filter));
    399             if (SendMessageW(hdlg, LB_DIR, 0, (LPARAM)filter) == LB_ERR)
    400                 return FALSE;
    401             if (scptr) *scptr = ';';
    402                 filter = (scptr) ? (scptr + 1) : 0;
    403         }
     399        TRACE("Using file spec %s\n", debugstr_w(filter));
     400        if (SendMessageW(hdlg, LB_DIR, 0, (LPARAM)filter) == LB_ERR)
     401            return FALSE;
     402        if (scptr) *scptr = ';';
     403            filter = (scptr) ? (scptr + 1) : 0;
     404    }
    404405    }
    405406
     
    416417
    417418/***********************************************************************
    418  *                              FILEDLG_GetFileType             [internal]
     419 *              FILEDLG_GetFileType     [internal]
    419420 */
    420421
     
    424425  i = 0;
    425426  if (cfptr)
    426     for ( ;(n = lstrlenW(cfptr)) != 0; i++) 
     427    for ( ;(n = lstrlenW(cfptr)) != 0; i++)
    427428      {
    428         cfptr += n + 1;
    429         if (i == index)
    430           return cfptr;
    431         cfptr += lstrlenW(cfptr) + 1;
     429    cfptr += n + 1;
     430    if (i == index)
     431      return cfptr;
     432    cfptr += lstrlenW(cfptr) + 1;
    432433      }
    433434  if (fptr)
    434     for ( ;(n = lstrlenW(fptr)) != 0; i++) 
     435    for ( ;(n = lstrlenW(fptr)) != 0; i++)
    435436      {
    436         fptr += n + 1;
    437         if (i == index)
    438           return fptr;
    439         fptr += lstrlenW(fptr) + 1;
     437    fptr += n + 1;
     438    if (i == index)
     439      return fptr;
     440    fptr += lstrlenW(fptr) + 1;
    440441    }
    441442  return (LPWSTR) FILE_star; /* FIXME */
     
    455456    {
    456457        if (!(str = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC))) return FALSE;
    457         SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
     458    SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
    458459                      (LPARAM)str);
    459460
    460         if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
    461         {
    462             oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
    463             oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
    464         }
    465         if (savedlg)
    466             SetTextColor(lpdis->hDC,GetSysColor(COLOR_GRAYTEXT) );
    467 
    468         ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + 1,
     461    if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
     462    {
     463        oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
     464        oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
     465    }
     466    if (savedlg)
     467        SetTextColor(lpdis->hDC,GetSysColor(COLOR_GRAYTEXT) );
     468
     469    ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + 1,
    469470                  lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
    470471                  &(lpdis->rcItem), str, lstrlenW(str), NULL);
    471472
    472         if (lpdis->itemState & ODS_SELECTED)
    473             DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) );
    474 
    475         if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
    476         {
    477             SetBkColor( lpdis->hDC, oldBk );
    478             SetTextColor( lpdis->hDC, oldText );
    479         }
     473    if (lpdis->itemState & ODS_SELECTED)
     474        DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) );
     475
     476    if ((lpdis->itemState & ODS_SELECTED) && !savedlg)
     477    {
     478        SetBkColor( lpdis->hDC, oldBk );
     479        SetTextColor( lpdis->hDC, oldText );
     480    }
    480481        HeapFree(GetProcessHeap(), 0, str);
    481         return TRUE;
     482    return TRUE;
    482483    }
    483484
     
    486487        if (!(str = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC)))
    487488            return FALSE;
    488         SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
     489    SendMessageW(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID,
    489490                      (LPARAM)str);
    490491
    491         if (lpdis->itemState & ODS_SELECTED)
    492         {
    493             oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
    494             oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
    495         }
    496         ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth,
     492    if (lpdis->itemState & ODS_SELECTED)
     493    {
     494        oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
     495        oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
     496    }
     497    ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth,
    497498                  lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
    498499                  &(lpdis->rcItem), str, lstrlenW(str), NULL);
    499500
    500         if (lpdis->itemState & ODS_SELECTED)
    501             DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) );
    502 
    503         if (lpdis->itemState & ODS_SELECTED)
    504         {
    505             SetBkColor( lpdis->hDC, oldBk );
    506             SetTextColor( lpdis->hDC, oldText );
    507         }
    508         DrawIcon(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hFolder);
     501    if (lpdis->itemState & ODS_SELECTED)
     502        DrawFocusRect( lpdis->hDC, &(lpdis->rcItem) );
     503
     504    if (lpdis->itemState & ODS_SELECTED)
     505    {
     506        SetBkColor( lpdis->hDC, oldBk );
     507        SetTextColor( lpdis->hDC, oldText );
     508    }
     509    DrawIcon(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hFolder);
    509510        HeapFree(GetProcessHeap(), 0, str);
    510         return TRUE;
     511    return TRUE;
    511512    }
    512513    if (lpdis->CtlType == ODT_COMBOBOX && lpdis->CtlID == cmb2)
     
    515516        if (!(str = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC)))
    516517            return FALSE;
    517         SendMessageW(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID,
     518    SendMessageW(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID,
    518519                      (LPARAM)str);
    519520        root[0] += str[2] - 'a';
     
    526527        default:           hIcon = hHDisk; break;
    527528        }
    528         if (lpdis->itemState & ODS_SELECTED)
    529         {
    530             oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
    531             oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
    532         }
    533         ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth,
     529    if (lpdis->itemState & ODS_SELECTED)
     530    {
     531        oldBk = SetBkColor( lpdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) );
     532        oldText = SetTextColor( lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
     533    }
     534    ExtTextOutW(lpdis->hDC, lpdis->rcItem.left + fldrWidth,
    534535                  lpdis->rcItem.top + 1, ETO_OPAQUE | ETO_CLIPPED,
    535536                  &(lpdis->rcItem), str, lstrlenW(str), NULL);
    536537
    537         if (lpdis->itemState & ODS_SELECTED)
    538         {
    539             SetBkColor( lpdis->hDC, oldBk );
    540             SetTextColor( lpdis->hDC, oldText );
    541         }
    542         DrawIcon(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hIcon);
     538    if (lpdis->itemState & ODS_SELECTED)
     539    {
     540        SetBkColor( lpdis->hDC, oldBk );
     541        SetTextColor( lpdis->hDC, oldText );
     542    }
     543    DrawIcon(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hIcon);
    543544        HeapFree(GetProcessHeap(), 0, str);
    544         return TRUE;
     545    return TRUE;
    545546    }
    546547    return FALSE;
     
    550551 *                              FILEDLG_WMMeasureItem           [internal]
    551552 */
    552 static LONG FILEDLG_WMMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam) 
     553static LONG FILEDLG_WMMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
    553554{
    554555    LPMEASUREITEMSTRUCT lpmeasure;
    555    
     556
    556557    lpmeasure = (LPMEASUREITEMSTRUCT)lParam;
    557558    lpmeasure->itemHeight = fldrHeight;
     
    562563 */
    563564#ifdef __WIN32OS2__
    564 static LONG FILEDLG_WMMeasureItem16(HWND hWnd, WPARAM wParam, LPARAM lParam) 
     565static LONG FILEDLG_WMMeasureItem16(HWND hWnd, WPARAM wParam, LPARAM lParam)
    565566{
    566567    LPMEASUREITEMSTRUCT lpmeasure;
    567    
     568
    568569    lpmeasure = (LPMEASUREITEMSTRUCT)lParam;
    569570    lpmeasure->itemHeight = fldrHeight;
     
    571572}
    572573#else
    573 static LONG FILEDLG_WMMeasureItem16(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam) 
     574static LONG FILEDLG_WMMeasureItem16(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam)
    574575{
    575576    LPMEASUREITEMSTRUCT16 lpmeasure;
    576    
     577
    577578    lpmeasure = MapSL(lParam);
    578579    lpmeasure->itemHeight = fldrHeight;
     
    608609      TRACE("lpstrCustomFilter = %p\n", pstr);
    609610      while(*pstr)
    610         {
    611           old_pstr = pstr;
     611    {
     612      old_pstr = pstr;
    612613          i = SendDlgItemMessageW(hWnd, cmb1, CB_ADDSTRING, 0,
    613614                                   (LPARAM)(ofn->lpstrCustomFilter) + n );
    614615          n += lstrlenW(pstr) + 1;
    615           pstr += lstrlenW(pstr) + 1;
    616           TRACE("add str='%s' "
    617           "associated to '%s'\n", debugstr_w(old_pstr), debugstr_w(pstr));
     616      pstr += lstrlenW(pstr) + 1;
     617      TRACE("add str='%s' "
     618      "associated to '%s'\n", debugstr_w(old_pstr), debugstr_w(pstr));
    618619          SendDlgItemMessageW(hWnd, cmb1, CB_SETITEMDATA, i, (LPARAM)pstr);
    619620          n += lstrlenW(pstr) + 1;
    620           pstr += lstrlenW(pstr) + 1;
    621         }
     621      pstr += lstrlenW(pstr) + 1;
     622    }
    622623    }
    623624  /* read filter information */
    624625  if (ofn->lpstrFilter) {
    625         pstr = (LPWSTR) ofn->lpstrFilter;
    626         n = 0;
    627         while(*pstr) {
    628           old_pstr = pstr;
    629           i = SendDlgItemMessageW(hWnd, cmb1, CB_ADDSTRING, 0,
    630                                        (LPARAM)(ofn->lpstrFilter + n) );
    631           n += lstrlenW(pstr) + 1;
    632           pstr += lstrlenW(pstr) + 1;
    633           TRACE("add str='%s' "
    634                   "associated to '%s'\n", debugstr_w(old_pstr), debugstr_w(pstr));
    635           SendDlgItemMessageW(hWnd, cmb1, CB_SETITEMDATA, i, (LPARAM)pstr);
    636           n += lstrlenW(pstr) + 1;
    637           pstr += lstrlenW(pstr) + 1;
    638         }
     626    pstr = (LPWSTR) ofn->lpstrFilter;
     627    n = 0;
     628    while(*pstr) {
     629      old_pstr = pstr;
     630      i = SendDlgItemMessageW(hWnd, cmb1, CB_ADDSTRING, 0,
     631                       (LPARAM)(ofn->lpstrFilter + n) );
     632      n += lstrlenW(pstr) + 1;
     633      pstr += lstrlenW(pstr) + 1;
     634      TRACE("add str='%s' "
     635          "associated to '%s'\n", debugstr_w(old_pstr), debugstr_w(pstr));
     636      SendDlgItemMessageW(hWnd, cmb1, CB_SETITEMDATA, i, (LPARAM)pstr);
     637      n += lstrlenW(pstr) + 1;
     638      pstr += lstrlenW(pstr) + 1;
     639    }
    639640  }
    640641  /* set default filter */
    641642  if (ofn->nFilterIndex == 0 && ofn->lpstrCustomFilter == NULL)
    642         ofn->nFilterIndex = 1;
    643   SendDlgItemMessageW(hWnd, cmb1, CB_SETCURSEL, ofn->nFilterIndex - 1, 0);   
     643    ofn->nFilterIndex = 1;
     644  SendDlgItemMessageW(hWnd, cmb1, CB_SETCURSEL, ofn->nFilterIndex - 1, 0);
    644645  lstrcpynW(tmpstr, FILEDLG_GetFileType(ofn->lpstrCustomFilter,
    645              (LPWSTR)ofn->lpstrFilter, ofn->nFilterIndex - 1),BUFFILE);
    646   TRACE("nFilterIndex = %ld, SetText of edt1 to '%s'\n", 
    647                         ofn->nFilterIndex, debugstr_w(tmpstr));
     646         (LPWSTR)ofn->lpstrFilter, ofn->nFilterIndex - 1),BUFFILE);
     647  TRACE("nFilterIndex = %ld, SetText of edt1 to '%s'\n",
     648            ofn->nFilterIndex, debugstr_w(tmpstr));
    648649  SetDlgItemTextW( hWnd, edt1, tmpstr );
    649650  /* get drive list */
     
    651652  DlgDirListComboBoxW(hWnd, tmpstr, cmb2, 0, DDL_DRIVES | DDL_EXCLUSIVE);
    652653  /* read initial directory */
    653   if (ofn->lpstrInitialDir != NULL) 
     654  if (ofn->lpstrInitialDir != NULL)
    654655    {
    655656      int len;
     
    690691      {
    691692          str[0] = 'a' + i;
    692           if(drives & (1 << i)) n++;
     693          if(drives & (1 << i)) n++;
    693694
    694695          if (toupper(str[0]) == toupper(dir[0])) break;
     
    720721/***********************************************************************
    721722 *                              FILEDLG_UpdateResult            [internal]
    722  *      update the displayed file name (with path) 
     723 *      update the displayed file name (with path)
    723724 */
    724725void FILEDLG_UpdateResult(LFSPRIVATE lfs, WCHAR *tmpstr)
     
    747748    if (lfs->ofn16)
    748749    { /* we have to convert to short (8.3) path */
    749         char tmp[1024]; /* MAX_PATHNAME_LEN */
    750         LPOPENFILENAME16 ofn16 = lfs->ofn16;
     750    char tmp[1024]; /* MAX_PATHNAME_LEN */
     751    LPOPENFILENAME16 ofn16 = lfs->ofn16;
    751752        char *dest = MapSL(ofn16->lpstrFile);
    752753        if (!WideCharToMultiByte( CP_ACP, 0, ofnW->lpstrFile, -1,
    753754                                  tmp, ofnW->nMaxFile, NULL, NULL ))
    754755            tmp[ofnW->nMaxFile-1] = 0;
    755         GetShortPathNameA(tmp, dest, ofn16->nMaxFile);
    756 
    757         /* the same procedure as every year... */
     756    GetShortPathNameA(tmp, dest, ofn16->nMaxFile);
     757
     758    /* the same procedure as every year... */
    758759        ofn16->nFileOffset = strrchr(dest,'\\') - dest +1;
    759760        ofn16->nFileExtension = 0;
     
    779780/***********************************************************************
    780781 *                              FILEDLG_UpdateFileTitle         [internal]
    781  *      update the displayed file name (without path) 
     782 *      update the displayed file name (without path)
    782783 */
    783784void FILEDLG_UpdateFileTitle(LFSPRIVATE lfs)
     
    785786  LONG lRet;
    786787  LPOPENFILENAMEW ofnW = lfs->ofnW;
    787   if (ofnW->lpstrFileTitle != NULL) 
     788  if (ofnW->lpstrFileTitle != NULL)
    788789  {
    789790    lRet = SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETCURSEL, 0, 0);
     
    825826  pstr = HeapAlloc(GetProcessHeap(), 0, BUFFILEALLOC);
    826827  SendDlgItemMessageW(hWnd, lst2, LB_GETTEXT, lRet,
    827                      (LPARAM)pstr);
     828             (LPARAM)pstr);
    828829  strcpyW( tmpstr, pstr );
    829830  HeapFree(GetProcessHeap(), 0, pstr);
     
    897898    pBeginFileName = strrchrW(path, '\\');
    898899    if (pBeginFileName == NULL)
    899         pBeginFileName = strrchrW(path, ':');
     900    pBeginFileName = strrchrW(path, ':');
    900901
    901902    if (strchrW(path,'*') != NULL || strchrW(path,'?') != NULL)
     
    904905        if (pBeginFileName != NULL)
    905906        {
    906             lstrcpynW(tmpstr2, pBeginFileName + 1, BUFFILE);
    907             *(pBeginFileName + 1) = 0;
    908         }
    909         else
    910         {
    911             strcpyW(tmpstr2, path);
    912             *path = 0;
     907        lstrcpynW(tmpstr2, pBeginFileName + 1, BUFFILE);
     908        *(pBeginFileName + 1) = 0;
     909    }
     910    else
     911    {
     912        strcpyW(tmpstr2, path);
     913        *path = 0;
    913914        }
    914915
     
    997998        lRet = (BOOL)FILEDLG_CallWindowProc(lfs, lfs->fileokstring,
    998999                  0, lfs->lParam );
    999         if (lRet)       
     1000        if (lRet)
    10001001        {
    10011002            *ofnW = ofnsav; /* restore old state */
     
    10091010            LPWSTR str = (LPWSTR)ofnW->lpstrFile;
    10101011            LPWSTR ptr = strrchrW(str, '\\');
    1011             str[lstrlenW(str) + 1] = '\0';
    1012             *ptr = 0;
     1012        str[lstrlenW(str) + 1] = '\0';
     1013        *ptr = 0;
    10131014        }
    10141015    }
     
    10351036                         (LPARAM)pstr);
    10361037    wsprintfW(diskname, FILE_specc, pstr[2]);
    1037     HeapFree(GetProcessHeap(), 0, pstr);   
     1038    HeapFree(GetProcessHeap(), 0, pstr);
    10381039
    10391040    return FILEDLG_Validate( lfs, diskname, cmb2, lRet, TRUE );
     
    10671068 */
    10681069static LRESULT FILEDLG_WMCommand(HWND hWnd, LPARAM lParam, UINT notification,
    1069        UINT control, LFSPRIVATE lfs ) 
     1070       UINT control, LFSPRIVATE lfs )
    10701071{
    10711072    switch (control)
     
    10901091
    10911092        case cmb1: /* file type drop list */
    1092         if (notification == CBN_SELCHANGE) 
     1093        if (notification == CBN_SELCHANGE)
    10931094            return FILEDLG_FileTypeChange( lfs );
    10941095        break;
     
    12151216    if (ofnA->lpstrTitle)
    12161217        str = ofnA->lpstrTitle;
    1217     else 
     1218    else
    12181219        /* Allocates default title (FIXME : get it from resource) */
    12191220        str = open ? defaultopen:defaultsave;
     
    12721273/************************************************************************
    12731274 *                              FILEDLG_DestroyPrivate            [internal]
    1274  *      destroys the private object 
     1275 *      destroys the private object
    12751276 */
    12761277void FILEDLG_DestroyPrivate(LFSPRIVATE lfs)
     
    13111312/************************************************************************
    13121313 *                              FILEDLG_AllocPrivate            [internal]
    1313  *      allocate a private object to hold 32 bits Unicode 
     1314 *      allocate a private object to hold 32 bits Unicode
    13141315 *      structure that will be used throughtout the calls, while
    13151316 *      keeping available the original structures and a few variables
     
    13691370                FILEDLG_MapOfnStructA(lfs->ofnA, lfs->ofnW, lfs->open);
    13701371        }
    1371         else 
     1372        else
    13721373            ret = NULL;
    13731374    }
     
    13901391 * Creates a win31 style dialog box for the user to select a file to open/save.
    13911392 */
    1392 BOOL WINAPI GetFileName31A( 
     1393BOOL WINAPI GetFileName31A(
    13931394                           LPOPENFILENAMEA lpofn, /* addess of structure with data*/
    13941395                           UINT dlgType /* type dialogue : open/save */
     
    14051406    {
    14061407        hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE );
    1407         bRet = DialogBoxIndirectParamA( hInst, lfs->template, lpofn->hwndOwner, 
     1408        bRet = DialogBoxIndirectParamA( hInst, lfs->template, lpofn->hwndOwner,
    14081409             (DLGPROC) FileOpenDlgProc, (DWORD) lfs);
    14091410        FILEDLG_DestroyPrivate(lfs);
     
    14201421 * Creates a win31 style dialog box for the user to select a file to open/save
    14211422 */
    1422 BOOL WINAPI GetFileName31W( 
     1423BOOL WINAPI GetFileName31W(
    14231424                           LPOPENFILENAMEW lpofn, /* addess of structure with data*/
    14241425                           UINT dlgType /* type dialogue : open/save */
     
    14351436    {
    14361437        hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE );
    1437         bRet = DialogBoxIndirectParamW( hInst, lfs->template, lpofn->hwndOwner, 
     1438        bRet = DialogBoxIndirectParamW( hInst, lfs->template, lpofn->hwndOwner,
    14381439             (DLGPROC) FileOpenDlgProc, (DWORD) lfs);
    14391440        FILEDLG_DestroyPrivate(lfs);
     
    14531454LRESULT WINAPI FileOpenDlgProc16(HWND16 hWnd, UINT16 wMsg, WPARAM16 wParam,
    14541455                               LPARAM lParam)
    1455 { 
     1456{
    14561457    LFSPRIVATE lfs = (LFSPRIVATE)GetPropA(hWnd,OFN_PROP);
    14571458    DRAWITEMSTRUCT dis;
    1458  
     1459
    14591460    TRACE("msg=%x wparam=%x lParam=%lx\n", wMsg, wParam, lParam);
    14601461    if ((wMsg != WM_INITDIALOG) && lfs && lfs->hook)
    14611462        {
    14621463            LRESULT lRet = (BOOL16)FILEDLG_CallWindowProc(lfs, wMsg, wParam, lParam);
    1463             if (lRet)   
     1464            if (lRet)
    14641465                return lRet;         /* else continue message processing */
    14651466        }
     
    14831484         switch (HIWORD(lParam))
    14841485         {
    1485         case CTLCOLOR_BTN:
    1486              SetTextColor((HDC16)wParam, 0x00000000);
     1486    case CTLCOLOR_BTN:
     1487         SetTextColor((HDC16)wParam, 0x00000000);
    14871488             return hGRAYBrush;
    1488         case CTLCOLOR_STATIC:
     1489    case CTLCOLOR_STATIC:
    14891490             SetTextColor((HDC16)wParam, 0x00000000);
    14901491             return hGRAYBrush;
    1491         }
     1492    }
    14921493      break;
    14931494#endif
     
    15101511   LRESULT  lRet;
    15111512   lRet = (BOOL16)FILEDLG_CallWindowProc(lfs, wMsg, wParam, lParam);
    1512    if (lRet)   
     1513   if (lRet)
    15131514    return lRet;         /* else continue message processing */
    1514   }             
     1515  }
    15151516  switch (wMsg) {
    15161517   case WM_INITDIALOG:
    15171518      return FILEDLG_WMInitDialog(hWnd, wParam, lParam);
    1518      
     1519
    15191520   case WM_MEASUREITEM:
    15201521      return FILEDLG_WMMeasureItem16(hWnd, wParam, lParam);
    1521    
     1522
    15221523   case WM_DRAWITEM:
    15231524      FILEDLG_MapDrawItemStruct(MapSL(lParam), &dis);
     
    15271528      return FILEDLG_WMCommand(hWnd, lParam, HIWORD(lParam), wParam, lfs);
    15281529  }
    1529  
     1530
    15301531  /*
    15311532  case WM_CTLCOLOR:
     
    15411542   }
    15421543   return FALSE;
    1543    
     1544
    15441545   */
    15451546  return FALSE;
     
    15491550/***********************************************************************
    15501551 *           FileOpenDlgProc                                    [internal]
    1551  *      Used for open and save, in fact.   
     1552 *      Used for open and save, in fact.
    15521553 */
    15531554static LRESULT WINAPI FileOpenDlgProc(HWND hWnd, UINT wMsg,
     
    15611562            LRESULT lRet;
    15621563            lRet  = (BOOL)FILEDLG_CallWindowProc(lfs, wMsg, wParam, lParam);
    1563             if (lRet)   
     1564            if (lRet)
    15641565                return lRet;         /* else continue message processing */
    15651566        }
     
    15821583         switch (HIWORD(lParam))
    15831584         {
    1584         case CTLCOLOR_BTN:
    1585              SetTextColor((HDC16)wParam, 0x00000000);
     1585    case CTLCOLOR_BTN:
     1586         SetTextColor((HDC16)wParam, 0x00000000);
    15861587             return hGRAYBrush;
    1587         case CTLCOLOR_STATIC:
     1588    case CTLCOLOR_STATIC:
    15881589             SetTextColor((HDC16)wParam, 0x00000000);
    15891590             return hGRAYBrush;
    1590         }
     1591    }
    15911592      break;
    15921593#endif
     
    15951596}
    15961597
    1597 /* ------------------ APIs ---------------------- */ 
     1598/* ------------------ APIs ---------------------- */
    15981599#ifndef __WIN32OS2__
    15991600/***********************************************************************
     
    16091610 *    unknown, there are some FIXME's left.
    16101611 */
    1611 BOOL16 WINAPI GetOpenFileName16( 
    1612                                 SEGPTR ofn /* [in/out] address of structure with data*/
    1613                                 )
     1612BOOL16 WINAPI GetOpenFileName16(
     1613                SEGPTR ofn /* [in/out] address of structure with data*/
     1614                )
    16141615{
    16151616    HINSTANCE hInst;
     
    16261627        hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE );
    16271628        ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 6);
    1628         bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner, 
     1629        bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner,
    16291630             (DLGPROC16) ptr, (DWORD) lfs);
    16301631        FILEDLG_DestroyPrivate(lfs);
     
    16471648 *    unknown. There are some FIXME's left.
    16481649 */
    1649 BOOL16 WINAPI GetSaveFileName16( 
    1650                                 SEGPTR ofn /* [in/out] addess of structure with data*/
    1651                                 )
     1650BOOL16 WINAPI GetSaveFileName16(
     1651                SEGPTR ofn /* [in/out] addess of structure with data*/
     1652                )
    16521653{
    16531654    HINSTANCE hInst;
     
    16641665        hInst = GetWindowLongA( lpofn->hwndOwner, GWL_HINSTANCE );
    16651666        ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 7);
    1666         bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner, 
     1667        bRet = DialogBoxIndirectParam16( hInst, lfs->hDlgTmpl16, lpofn->hwndOwner,
    16671668             (DLGPROC16) ptr, (DWORD) lfs);
    16681669        FILEDLG_DestroyPrivate(lfs);
    1669     } 
     1670    }
    16701671
    16711672    TRACE("return lpstrFile='%s' !\n", (char *)MapSL(lpofn->lpstrFile));
     
    16851686 */
    16861687BOOL WINAPI GetOpenFileNameA(
    1687         LPOPENFILENAMEA ofn) /* [in/out] address of init structure */
     1688    LPOPENFILENAMEA ofn) /* [in/out] address of init structure */
    16881689{
    16891690    BOOL  newlook = TRUE; /* FIXME: TWEAK_WineLook */
     
    17211722 */
    17221723BOOL WINAPI GetOpenFileNameW(
    1723         LPOPENFILENAMEW ofn) /* [in/out] address of init structure */
     1724    LPOPENFILENAMEW ofn) /* [in/out] address of init structure */
    17241725{
    17251726    BOOL  newlook = TRUE; /* FIXME: TWEAK_WineLook */
     
    17571758 */
    17581759BOOL WINAPI GetSaveFileNameA(
    1759         LPOPENFILENAMEA ofn) /* [in/out] address of init structure */
     1760    LPOPENFILENAMEA ofn) /* [in/out] address of init structure */
    17601761{
    17611762    BOOL  newlook = TRUE; /* FIXME: TWEAK_WineLook */
     
    17751776    {
    17761777        return GetFileDialog95A(ofn, SAVE_DIALOG);
    1777     } 
     1778    }
    17781779    else
    17791780    {
     
    17931794 */
    17941795BOOL WINAPI GetSaveFileNameW(
    1795         LPOPENFILENAMEW ofn) /* [in/out] address of init structure */
     1796    LPOPENFILENAMEW ofn) /* [in/out] address of init structure */
    17961797{
    17971798    BOOL  newlook = TRUE; /* FIXME: TWEAK_WineLook */
     
    18111812    {
    18121813        return GetFileDialog95W(ofn, SAVE_DIALOG);
    1813     } 
     1814    }
    18141815    else
    18151816    {
Note: See TracChangeset for help on using the changeset viewer.