Changeset 3243 for trunk/src/comdlg32


Ignore:
Timestamp:
Mar 26, 2000, 6:34:57 PM (26 years ago)
Author:
cbratschi
Message:

merged with Corel WINE 20000324

Location:
trunk/src/comdlg32
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comdlg32/cdlg_En.orc

    r3031 r3243  
     1/* $Id: cdlg_En.orc,v 1.2 2000-03-26 16:31:39 cbratschi Exp $ */
    12LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
     3
     4/* Corel WINE 20000324 level */
    25
    36OPEN_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
     
    108111    COMBOBOX        1138,179,13,32,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
    109112                    WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE | CBS_SORT
    110     DEFPUSHBUTTON   "OK",IDOK,218,6,40,14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON 
     113    DEFPUSHBUTTON   "OK",IDOK,218,6,40,14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
    111114    PUSHBUTTON      "Cancel",IDCANCEL,218,23,40,14,WS_GROUP | WS_TABSTOP
    112115    PUSHBUTTON      "&Apply", 1026,218,40,40,14,WS_GROUP | WS_TABSTOP
    113116    PUSHBUTTON      "&Help" , 1038,218,57,40,14,WS_GROUP | WS_TABSTOP
    114117    GROUPBOX        "Effects",1072,6,72,84,34,WS_GROUP
    115     CHECKBOX        "Stri&keout", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP
    116     CHECKBOX        "&Underline", 1041, 10,94,50,10, BS_AUTOCHECKBOX
     118    CHECKBOX        "Stri&keout", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP
     119    CHECKBOX        "&Underline", 1041, 10,94,50,10, BS_AUTOCHECKBOX
    117120    LTEXT           "&Color:", 1091 ,6,110,30,9
    118121    COMBOBOX        1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS |
    119                     CBS_AUTOHSCROLL |  WS_BORDER | WS_VSCROLL | WS_TABSTOP
     122                    CBS_AUTOHSCROLL |  WS_BORDER | WS_VSCROLL | WS_TABSTOP
    120123    GROUPBOX        "Sample",1073,98,72,160,49,WS_GROUP
    121124    CTEXT           "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE
     
    170173 CONTROL "&Down", 1057, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 138, 38, 30, 12
    171174
    172  DEFPUSHBUTTON "&Find Next", IDOK, 182,  5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON 
    173  PUSHBUTTON "Cancel", IDCANCEL  , 182, 23, 50, 14, WS_GROUP | WS_TABSTOP
    174  PUSHBUTTON "&Help", pshHelp    , 182, 45, 50, 14, WS_GROUP | WS_TABSTOP
     175 DEFPUSHBUTTON "&Find Next", IDOK, 182,  5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
     176 PUSHBUTTON "Cancel", IDCANCEL  , 182, 23, 50, 14, WS_GROUP | WS_TABSTOP
     177 PUSHBUTTON "&Help", pshHelp    , 182, 45, 50, 14, WS_GROUP | WS_TABSTOP
    175178}
    176179
     
    188191 CHECKBOX "Match &Case", 1041, 5, 62, 59, 12, BS_AUTOCHECKBOX | WS_TABSTOP
    189192
    190  DEFPUSHBUTTON "&Find Next", IDOK, 174,  4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON 
    191  PUSHBUTTON "&Replace", psh1    , 174, 21, 50, 14, WS_GROUP | WS_TABSTOP
     193 DEFPUSHBUTTON "&Find Next", IDOK, 174,  4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
     194 PUSHBUTTON "&Replace", psh1    , 174, 21, 50, 14, WS_GROUP | WS_TABSTOP
    192195 PUSHBUTTON "Replace &All", psh2 , 174, 38, 50, 14, WS_GROUP | WS_TABSTOP
    193  PUSHBUTTON "Cancel", IDCANCEL  , 174, 55, 50, 14, WS_GROUP | WS_TABSTOP
    194  PUSHBUTTON "&Help", pshHelp    , 174, 75, 50, 14, WS_GROUP | WS_TABSTOP
     196 PUSHBUTTON "Cancel", IDCANCEL  , 174, 55, 50, 14, WS_GROUP | WS_TABSTOP
     197 PUSHBUTTON "&Help", pshHelp    , 174, 75, 50, 14, WS_GROUP | WS_TABSTOP
    195198}
    196199
     
    264267    LTEXT           "&Source:",       stc3,  16,128,  36, 8
    265268    COMBOBOX                          cmb3,  52,126, 112,112,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP
    266    
     269
    267270    GROUPBOX        "Orientation",    grp1, 180, 92, 100,56, WS_GROUP
    268271    ICON            "",               ico1, 195,112,  18,20, WS_GROUP
     
    277280FONT 8, "helv"
    278281{
    279     LTEXT       "Look &in",IDC_LOOKINSTATIC,7,6,41,8, SS_NOTIFY
    280     COMBOBOX    IDC_LOOKIN,50,3,138,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
    281 
    282     LTEXT       "" , IDC_TOOLBARSTATIC, 188, 2, 82, 17, NOT WS_GROUP | NOT WS_VISIBLE
    283     LISTBOX     IDC_SHELLSTATIC,4,20,272,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE
    284    
    285     LTEXT       "File &name:",IDC_FILENAMESTATIC,5,112,46,8, SS_NOTIFY
    286     EDITTEXT    IDC_FILENAME,54,110,155,12,ES_AUTOHSCROLL
    287    
    288     LTEXT       "Files of &type",IDC_FILETYPESTATIC,5,128,42,8, SS_NOTIFY
    289     COMBOBOX    IDC_FILETYPE,54,126,155,53,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
    290 
    291     CONTROL     "Open as &read-only",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,145,100,10
    292 
    293     DEFPUSHBUTTON       "&Open",                 IDOK,222,110,50,14
    294     PUSHBUTTON          "Cancel",                IDCANCEL,222,128,50,14
    295     PUSHBUTTON          "&Help",                 pshHelp,222,145,50,14
    296 }
    297 
    298 STRINGTABLE DISCARDABLE
    299 {
    300     IDS_ABOUTBOX            "&About FolderPicker Test"
    301     IDS_DOCUMENTFOLDERS     "Document Folders"
    302     IDS_PERSONAL            "My Documents"
    303     IDS_FAVORITES           "My Favorites"
    304     IDS_PATH                "System Path"
    305     IDS_DESKTOP             "Desktop"
    306     IDS_FONTS               "Fonts"
    307     IDS_MYCOMPUTER          "My Computer"
    308 }
    309 
    310 STRINGTABLE DISCARDABLE
    311 {
    312     IDS_SYSTEMFOLDERS       "System Folders"
    313     IDS_LOCALHARDRIVES      "Local Hard Drives"
    314     IDS_FILENOTFOUND        "File not found"
     282    LTEXT       "Look &in",IDC_LOOKINSTATIC,7,6,41,8, SS_NOTIFY
     283    COMBOBOX    IDC_LOOKIN,50,3,138,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
     284
     285    LTEXT       "" , IDC_TOOLBARSTATIC, 188, 2, 82, 17, NOT WS_GROUP | NOT WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
     286    LISTBOX     IDC_SHELLSTATIC,4,20,272,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
     287
     288    LTEXT       "File &name:",IDC_FILENAMESTATIC,5,112,46,8, SS_NOTIFY
     289    EDITTEXT    IDC_FILENAME,54,110,155,12,ES_AUTOHSCROLL
     290
     291    LTEXT       "Files of &type",IDC_FILETYPESTATIC,5,128,42,8, SS_NOTIFY
     292    COMBOBOX    IDC_FILETYPE,54,126,155,53,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
     293
     294    CONTROL     "Open as &read-only",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,145,100,10
     295
     296    DEFPUSHBUTTON       "&Open",                 IDOK,222,110,50,14
     297    PUSHBUTTON          "Cancel",                IDCANCEL,222,128,50,14
     298    PUSHBUTTON          "&Help",                 pshHelp,222,145,50,14
     299}
     300
     301STRINGTABLE DISCARDABLE
     302{
    315303    IDS_VERIFYFILE          "Please verify if the correct file name was given"
    316304    IDS_CREATEFILE          "File does not exist\nDo you want to create file"
    317 }
    318 
     305    IDS_CREATEFOLDER_DENIED "Unable to create the folder \"%s\"\n\nAccess is denied."
     306    IDS_FILEOPEN_CAPTION    "Open"
     307    IDS_FILENOTFOUND        "File Not Found"
     308}
     309
     310STRINGTABLE DISCARDABLE
     311{
     312    IDS_UPFOLDER         "Up One Level"
     313    IDS_NEWFOLDER        "Create New Folder"
     314    IDS_LISTVIEW         "List"
     315    IDS_REPORTVIEW       "Details"
     316}
    319317
    320318STRINGTABLE DISCARDABLE
  • trunk/src/comdlg32/cdlg_xx.orc

    r3031 r3243  
     1/* $Id: cdlg_xx.orc,v 1.2 2000-03-26 16:31:40 cbratschi Exp $*/
    12/*
    23 * Language neutral resources for Common Dialogs
     4 *
     5 * Corel WINE 20000324 level
    36 */
    47
     
    811
    9121 VERSIONINFO
    10 FILEVERSION     4, 0, 0, 950    /* Maybe 4.1.0.980 for win98?? */
    11 PRODUCTVERSION  4, 0, 0, 950    /* id. */
    12 FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
    13 FILEOS          VOS_DOS_WINDOWS16
    14 FILETYPE        VFT_DLL
     13FILEVERSION     4, 0, 0, 950    /* Maybe 4.1.0.980 for win98?? */
     14PRODUCTVERSION  4, 0, 0, 950    /* id. */
     15FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
     16FILEOS          VOS_DOS_WINDOWS16
     17FILETYPE        VFT_DLL
    1518{
    16         BLOCK "StringFileInfo"
    17         {
    18                 BLOCK "040604B0"
    19                 {
    20                         VALUE "CompanyName", "Wine Developer Team\000"
    21                         VALUE "FileDescription", "Common Dialog Boxes\000"
    22                         VALUE "FileVersion", "4.00\000"
    23                         VALUE "InternalName", "COMDLG32\000"
    24                         VALUE "LegalCopyright", "Copyright \251 B. A. Stultiens 1998,1999\000"
    25                         VALUE "OriginalFilename", "COMDLG32.DLL\000"
    26                         VALUE "ProductName", "Wine\000"
    27                         VALUE "ProductVersion", "4.00\000"
    28                 }
    29         }
    30 
    31         /* Do we need this? It isn't a translation, but we have all languages at once... */
     19        BLOCK "StringFileInfo"
     20        {
     21                BLOCK "040604B0"
     22                {
     23                        VALUE "CompanyName", "Odin Developer Team\000"
     24                        VALUE "FileDescription", "Common Dialog Boxes\000"
     25                        VALUE "FileVersion", "4.00\000"
     26                        VALUE "InternalName", "COMDLG32\000"
     27                        VALUE "LegalCopyright", "Copyright \251 B. A. Stultiens 1998,1999\000"
     28                        VALUE "OriginalFilename", "COMDLG32.DLL\000"
     29                        VALUE "ProductName", "Odin\000"
     30                        VALUE "ProductVersion", "4.00\000"
     31                }
     32        }
     33
     34        /* Do we need this? It isn't a translation, but we have all languages at once... */
    3235/*
    33         BLOCK "VarFileInfo"
    34         {
    35                 VALUE "Translation", 1030, 1200
    36         }
     36        BLOCK "VarFileInfo"
     37        {
     38                VALUE "Translation", 1030, 1200
     39        }
    3740*/
    3841}
     
    180183
    181184/* BINRES pd32_nocollate.ico */
    182 PD32_NOCOLLATE ICON 
     185PD32_NOCOLLATE ICON
    183186{
    184187 '00 00 01 00 02 00 20 20 10 00 00 00 00 00 E8 02'
     
    317320 'FF FE 7F F0 00 00'
    318321}
     322
     323/******************
     324 * Bitmap
     325 */
     326
     327IDB_TOOLBAR     BITMAP DISCARDABLE
     328{'
     32942 4d 36 08 00 00 00 00 00 00 36 04 00 00 28 00
     33000 00 40 00 00 00 10 00 00 00 01 00 08 00 00 00
     33100 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00
     33200 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80
     33300 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80
     33400 00 c0 c0 c0 00 c0 dc c0 00 f0 ca a6 00 04 04
     33504 00 08 08 08 00 0c 0c 0c 00 11 11 11 00 16 16
     33616 00 1c 1c 1c 00 22 22 22 00 29 29 29 00 55 55
     33755 00 4d 4d 4d 00 42 42 42 00 39 39 39 00 80 7c
     338ff 00 50 50 ff 00 93 00 d6 00 ff ec cc 00 c6 d6
     339ef 00 d6 e7 e7 00 90 a9 ad 00 00 00 33 00 00 00
     34066 00 00 00 99 00 00 00 cc 00 00 33 00 00 00 33
     34133 00 00 33 66 00 00 33 99 00 00 33 cc 00 00 33
     342ff 00 00 66 00 00 00 66 33 00 00 66 66 00 00 66
     34399 00 00 66 cc 00 00 66 ff 00 00 99 00 00 00 99
     34433 00 00 99 66 00 00 99 99 00 00 99 cc 00 00 99
     345ff 00 00 cc 00 00 00 cc 33 00 00 cc 66 00 00 cc
     34699 00 00 cc cc 00 00 cc ff 00 00 ff 66 00 00 ff
     34799 00 00 ff cc 00 33 00 00 00 33 00 33 00 33 00
     34866 00 33 00 99 00 33 00 cc 00 33 00 ff 00 33 33
     34900 00 33 33 33 00 33 33 66 00 33 33 99 00 33 33
     350cc 00 33 33 ff 00 33 66 00 00 33 66 33 00 33 66
     35166 00 33 66 99 00 33 66 cc 00 33 66 ff 00 33 99
     35200 00 33 99 33 00 33 99 66 00 33 99 99 00 33 99
     353cc 00 33 99 ff 00 33 cc 00 00 33 cc 33 00 33 cc
     35466 00 33 cc 99 00 33 cc cc 00 33 cc ff 00 33 ff
     35533 00 33 ff 66 00 33 ff 99 00 33 ff cc 00 33 ff
     356ff 00 66 00 00 00 66 00 33 00 66 00 66 00 66 00
     35799 00 66 00 cc 00 66 00 ff 00 66 33 00 00 66 33
     35833 00 66 33 66 00 66 33 99 00 66 33 cc 00 66 33
     359ff 00 66 66 00 00 66 66 33 00 66 66 66 00 66 66
     36099 00 66 66 cc 00 66 99 00 00 66 99 33 00 66 99
     36166 00 66 99 99 00 66 99 cc 00 66 99 ff 00 66 cc
     36200 00 66 cc 33 00 66 cc 99 00 66 cc cc 00 66 cc
     363ff 00 66 ff 00 00 66 ff 33 00 66 ff 99 00 66 ff
     364cc 00 cc 00 ff 00 ff 00 cc 00 99 99 00 00 99 33
     36599 00 99 00 99 00 99 00 cc 00 99 00 00 00 99 33
     36633 00 99 00 66 00 99 33 cc 00 99 00 ff 00 99 66
     36700 00 99 66 33 00 99 33 66 00 99 66 99 00 99 66
     368cc 00 99 33 ff 00 99 99 33 00 99 99 66 00 99 99
     36999 00 99 99 cc 00 99 99 ff 00 99 cc 00 00 99 cc
     37033 00 66 cc 66 00 99 cc 99 00 99 cc cc 00 99 cc
     371ff 00 99 ff 00 00 99 ff 33 00 99 cc 66 00 99 ff
     37299 00 99 ff cc 00 99 ff ff 00 cc 00 00 00 99 00
     37333 00 cc 00 66 00 cc 00 99 00 cc 00 cc 00 99 33
     37400 00 cc 33 33 00 cc 33 66 00 cc 33 99 00 cc 33
     375cc 00 cc 33 ff 00 cc 66 00 00 cc 66 33 00 99 66
     37666 00 cc 66 99 00 cc 66 cc 00 99 66 ff 00 cc 99
     37700 00 cc 99 33 00 cc 99 66 00 cc 99 99 00 cc 99
     378cc 00 cc 99 ff 00 cc cc 00 00 cc cc 33 00 cc cc
     37966 00 cc cc 99 00 cc cc cc 00 cc cc ff 00 cc ff
     38000 00 cc ff 33 00 99 ff 66 00 cc ff 99 00 cc ff
     381cc 00 cc ff ff 00 cc 00 33 00 ff 00 66 00 ff 00
     38299 00 cc 33 00 00 ff 33 33 00 ff 33 66 00 ff 33
     38399 00 ff 33 cc 00 ff 33 ff 00 ff 66 00 00 ff 66
     38433 00 cc 66 66 00 ff 66 99 00 ff 66 cc 00 cc 66
     385ff 00 ff 99 00 00 ff 99 33 00 ff 99 66 00 ff 99
     38699 00 ff 99 cc 00 ff 99 ff 00 ff cc 00 00 ff cc
     38733 00 ff cc 66 00 ff cc 99 00 ff cc cc 00 ff cc
     388ff 00 ff ff 33 00 cc ff 66 00 ff ff 99 00 ff ff
     389cc 00 66 66 ff 00 66 ff 66 00 66 ff ff 00 ff 66
     39066 00 ff 66 ff 00 ff ff 66 00 21 00 a5 00 5f 5f
     3915f 00 77 77 77 00 86 86 86 00 96 96 96 00 cb cb
     392cb 00 b2 b2 b2 00 d7 d7 d7 00 dd dd dd 00 e3 e3
     393e3 00 ea ea ea 00 f1 f1 f1 00 f8 f8 f8 00 f0 fb
     394ff 00 a4 a0 a0 00 80 80 80 00 00 00 ff 00 00 ff
     39500 00 00 ff ff 00 ff 00 00 00 ff 00 ff 00 ff ff
     39600 00 ff ff ff 00 fa fa fa fa fa fa fa fa fa fa
     397fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
     398fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
     399fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
     400fa fa fa fa fa fa fa fa 92 92 92 92 92 92 92 92
     40192 92 92 92 92 fa fa fa 6d 6d 6d 6d 6d 6d 6d 6d
     4026d 6d 6d 6d 6d fa fa fa 00 00 00 fa fa fa fa fa
     403fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa fa
     404fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 00
     40500 00 00 00 92 fa fa 00 00 00 00 00 00 00 00 00
     40600 00 00 00 6d fa fa fa ff ff 00 fa 00 00 00 00
     40700 00 fa fa fa fa fa ff 00 fa 00 00 00 00 fa 00
     40800 fa 00 00 00 fa fa 00 ff dd dd dd dd d6 d6 d6
     409d6 d6 d6 00 92 fa fa 00 ff dd dd dd dd d6 d6 d6
     410d6 d6 d6 00 6d fa fa fa ff ff 00 fa 00 00 00 00
     41100 00 fa fa fa fa fa ff 00 fa fa fa fa fa fa fa
     412fa fa fa fa fa fa fa 00 ff dd dd dd dd dd dd d6
     413d6 d6 d6 00 92 fa fa 00 ff dd dd dd dd dd dd d6
     414d6 d6 d6 00 6d fa fa fa ff ff 00 fa fa fa fa fa
     415fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
     416fa fa fa fa fa fa fa 00 ff dd dd dd dd dd dd dd
     417d6 d6 d6 00 92 fa fa 00 ff dd dd dd dd dd dd dd
     418d6 d6 d6 00 6d fa fa fa fa fa fa fa fa fa fa fa
     419fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa fa
     420fa fa fa fa fa fa fa 00 ff dd dd dd dd 1f 1f 1f
     421d6 d6 d6 00 92 fa fa 00 ff dd dd dd dd dd dd dd
     422d6 fb d6 00 6d fa fa fa 00 00 00 fa fa fa fa fa
     423fa fa fa fa fa fa fa ff 00 fa 00 00 00 00 fa 00
     42400 fa 00 00 00 fa fa 00 ff dd dd dd dd dd dd dd
     4251f d6 d6 00 92 fa fa 00 ff dd dd dd dd dd dd dd
     426d6 fb d6 00 6d fa fa fa ff ff 00 fa 00 00 00 00
     42700 00 fa fa fa fa fa ff 00 fa fa fa fa fa fa fa
     428fa fa fa fa fa fa fa 00 ff dd dd dd dd dd dd dd
     429dd 1f d6 00 92 fa fa 00 ff dd dd dd dd dd fb dd
     430dd fb d6 92 fb fa fa fa ff ff 00 fa 00 00 00 00
     43100 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa
     432fa fa fa fa fa fa fa 00 ff ff ff ff ff ff ff ff
     433ff 1f c3 00 fa fa fa 00 ff ff ff ff ff ff ff fb
     434ff fb c3 fb fa fa fa fa ff ff 00 fa fa fa fa fa
     435fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa fa
     436fa fa fa fa fa fa fa 00 d6 d6 d6 d6 d6 d6 d6 00
     43700 1f 00 00 fa fa fa 00 d6 d6 d6 d6 d6 d6 d6 92
     438fb fb fb 92 92 fa fa fa fa fa fa fa fa fa fa fa
     439fa fa fa fa fa fa fa ff 00 fa 00 00 00 00 fa 00
     44000 fa 00 00 00 fa fa fa 00 d6 d6 d6 d6 d6 00 fa
     441fa 1f fa fa fa fa fa fa 00 d6 d6 d6 d6 fb fb fb
     442fb fb fb fb fb fb fa fa 00 00 00 fa fa fa fa fa
     443fa fa fa fa fa fa fa ff 00 fa fa fa fa fa fa fa
     444fa fa fa fa fa fa fa fa fa 00 00 00 00 00 fa fa
     445fa 1f fa fa fa fa fa fa fa 00 00 00 00 00 fa 92
     446fb fb fb 92 fa fa fa fa ff ff 00 fa 00 00 00 00
     44700 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa
     448fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 1f
     4491f 1f 1f 1f fa fa fa fa fa fa fa fa fa fa ff fb
     450fa fb fa fb 92 fa fa fa ff ff 00 fa 00 00 00 00
     45100 00 fa fa fa fa 92 92 92 92 92 92 92 92 92 92
     45292 92 92 92 92 92 fa fa fa fa fa fa fa fa fa fa
     4531f 1f 1f fa fa fa fa fa fa fa fa fa fa fa fb fa
     454fa fb fa fa fb fa fa fa ff ff 00 fa fa fa fa fa
     455fa fa fa fa fa fa 92 ff ff 92 ff ff ff ff 92 ff
     456ff 92 ff ff ff 92 fa fa fa fa fa fa fa fa fa fa
     457fa 1f fa fa fa fa fa fa fa fa fa fa fa fa fa fa
     458fa fb fa fa fa fa fa fa fa fa fa fa fa fa fa fa
     459fa fa fa fa fa fa 92 92 92 92 92 92 92 92 92 92
     46092 92 92 92 92 92
     461'}
     462
  • trunk/src/comdlg32/filedlg95.c

    r3216 r3243  
     1/* $Id: filedlg95.c,v 1.4 2000-03-26 16:31:41 cbratschi Exp $*/
    12/*
    23 * COMMDLG - File Open Dialogs Win95 look and feel
    34 *
     5 * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch)
     6 * Project Odin Software License can be found in LICENSE.TXT
     7 *
     8 * Corel WINE 20000324 level
    49 */
    510#ifdef __WIN32OS2__
     
    4853  CHAR*        szDisplayName;
    4954  INT          iIcon;
     55  INT          iSelIcon;
    5056  HIMAGELIST   ilItemImage;
    5157
     
    173179HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
    174180HRESULT FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
     181BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPSTR lpstrFileList, UINT nFileCount, UINT sizeUsed);
     182static BOOL BrowseSelectedFolder(HWND hwnd);
    175183
    176184/***********************************************************************
     
    207215    lRes = DialogBoxIndirectParamA(COMMDLG_hInstance32,
    208216                                  (LPDLGTEMPLATEA) template,
    209                                   fodInfos->ofnInfos.hwndOwner,
     217                                  fodInfos->ofnInfos->hwndOwner,
    210218                                  (DLGPROC) FileOpenDlgProc95,
    211219                                  (LPARAM) fodInfos);
     
    229237BOOL  WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType)
    230238{
    231 
    232239  BOOL ret;
    233240  FileOpenDlgInfos *fodInfos;
     241  HINSTANCE hInstance;
     242  LPCSTR lpstrFilter = NULL;
     243  LPSTR lpstrCustomFilter = NULL;
     244  LPCSTR lpstrInitialDir = NULL;
     245  DWORD dwFlags = 0;
    234246
    235247  /* Initialise FileOpenDlgInfos structure*/
    236248  fodInfos = (FileOpenDlgInfos*)MemAlloc(sizeof(FileOpenDlgInfos));
    237   memset(&fodInfos->ofnInfos,'\0',sizeof(*ofn)); fodInfos->ofnInfos.lStructSize = sizeof(*ofn);
    238   fodInfos->ofnInfos.hwndOwner = ofn->hwndOwner;
    239   fodInfos->ofnInfos.hInstance = MapHModuleLS(ofn->hInstance);
     249
     250  /* Pass in the original ofn */
     251  fodInfos->ofnInfos = ofn;
     252
     253  /* Save original hInstance value */
     254  hInstance = ofn->hInstance;
     255  fodInfos->ofnInfos->hInstance = MapHModuleLS(ofn->hInstance);
     256
    240257  if (ofn->lpstrFilter)
    241258  {
    242259    LPSTR s,x;
     260    lpstrFilter = ofn->lpstrFilter;
    243261
    244262    /* filter is a list...  title\0ext\0......\0\0 */
     
    249267    x = (LPSTR)MemAlloc(s-ofn->lpstrFilter);
    250268    memcpy(x,ofn->lpstrFilter,s-ofn->lpstrFilter);
    251     fodInfos->ofnInfos.lpstrFilter = (LPSTR)x;
     269    fodInfos->ofnInfos->lpstrFilter = (LPSTR)x;
    252270  }
    253271  if (ofn->lpstrCustomFilter)
    254272  {
    255273    LPSTR s,x;
     274    lpstrCustomFilter = ofn->lpstrCustomFilter;
    256275
    257276    /* filter is a list...  title\0ext\0......\0\0 */
     
    262281    x = MemAlloc(s-ofn->lpstrCustomFilter);
    263282    memcpy(x,ofn->lpstrCustomFilter,s-ofn->lpstrCustomFilter);
    264     fodInfos->ofnInfos.lpstrCustomFilter = (LPSTR)x;
    265   }
    266   fodInfos->ofnInfos.nMaxCustFilter = ofn->nMaxCustFilter;
    267   fodInfos->ofnInfos.nFilterIndex = ofn->nFilterIndex;
    268   if (ofn->nMaxFile)
    269   {
    270       fodInfos->ofnInfos.lpstrFile = (LPSTR)MemAlloc(ofn->nMaxFile);
    271       strcpy((LPSTR)fodInfos->ofnInfos.lpstrFile,ofn->lpstrFile);
    272   }
    273   fodInfos->ofnInfos.nMaxFile = ofn->nMaxFile;
    274   fodInfos->ofnInfos.nMaxFileTitle = ofn->nMaxFileTitle;
    275     if (fodInfos->ofnInfos.nMaxFileTitle)
    276       fodInfos->ofnInfos.lpstrFileTitle = (LPSTR)MemAlloc(ofn->nMaxFileTitle);
    277   if (ofn->lpstrInitialDir)
    278   {
    279       fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(strlen(ofn->lpstrInitialDir)+1);
    280       strcpy((LPSTR)fodInfos->ofnInfos.lpstrInitialDir,ofn->lpstrInitialDir);
    281   }
    282 
    283   if (ofn->lpstrTitle)
    284   {
    285       fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(strlen(ofn->lpstrTitle)+1);
    286       strcpy((LPSTR)fodInfos->ofnInfos.lpstrTitle,ofn->lpstrTitle);
    287   }
    288 
    289   fodInfos->ofnInfos.Flags = ofn->Flags|OFN_WINE;
    290   fodInfos->ofnInfos.nFileOffset = ofn->nFileOffset;
    291   fodInfos->ofnInfos.nFileExtension = ofn->nFileExtension;
    292   if (ofn->lpstrDefExt)
    293   {
    294       fodInfos->ofnInfos.lpstrDefExt = MemAlloc(strlen(ofn->lpstrDefExt)+1);
    295       strcpy((LPSTR)fodInfos->ofnInfos.lpstrDefExt,ofn->lpstrDefExt);
    296   }
    297   fodInfos->ofnInfos.lCustData = ofn->lCustData;
    298   fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook;
    299 
    300   if (HIWORD(ofn->lpTemplateName))
    301   {
    302       fodInfos->ofnInfos.lpTemplateName = MemAlloc(strlen(ofn->lpTemplateName)+1);
    303       strcpy ((LPSTR)fodInfos->ofnInfos.lpTemplateName, ofn->lpTemplateName);
    304   }
    305   else
    306   {
    307       /* resource id */
    308       fodInfos->ofnInfos.lpTemplateName = ofn->lpTemplateName;
    309   }
     283    fodInfos->ofnInfos->lpstrCustomFilter = (LPSTR)x;
     284  }
     285
     286  dwFlags = ofn->Flags;
     287  fodInfos->ofnInfos->Flags = ofn->Flags|OFN_WINE;
    310288
    311289  /* Replace the NULL lpstrInitialDir by the current folder */
    312   if(!ofn->lpstrInitialDir)
    313   {
    314     fodInfos->ofnInfos.lpstrInitialDir = MemAlloc(MAX_PATH);
    315     GetCurrentDirectoryA(MAX_PATH,(LPSTR)fodInfos->ofnInfos.lpstrInitialDir);
     290  lpstrInitialDir = ofn->lpstrInitialDir;
     291  if(!lpstrInitialDir)
     292  {
     293    fodInfos->ofnInfos->lpstrInitialDir = MemAlloc(MAX_PATH);
     294    GetCurrentDirectoryA(MAX_PATH,(LPSTR)fodInfos->ofnInfos->lpstrInitialDir);
    316295  }
    317296
     
    333312  }
    334313
    335   ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset;
    336   ofn->nFileExtension = fodInfos->ofnInfos.nFileExtension;
    337 
    338   /*
    339      Transfer the combo index in the OPENFILENAME structure;
    340      No support for custom filters, so nFilterIndex must be one-based.
    341   */
    342   ofn->nFilterIndex = fodInfos->ofnInfos.nFilterIndex;
    343 
    344   if (fodInfos->ofnInfos.lpstrFilter)
    345       MemFree((LPVOID)(fodInfos->ofnInfos.lpstrFilter));
    346   if (HIWORD(fodInfos->ofnInfos.lpTemplateName))
    347       MemFree((LPVOID)(fodInfos->ofnInfos.lpTemplateName));
    348   if (fodInfos->ofnInfos.lpstrDefExt)
    349       MemFree((LPVOID)(fodInfos->ofnInfos.lpstrDefExt));
    350   if (fodInfos->ofnInfos.lpstrTitle)
    351       MemFree((LPVOID)(fodInfos->ofnInfos.lpstrTitle));
    352   if (fodInfos->ofnInfos.lpstrInitialDir)
    353       MemFree((LPVOID)(fodInfos->ofnInfos.lpstrInitialDir));
    354   if (fodInfos->ofnInfos.lpstrCustomFilter)
    355       MemFree((LPVOID)(fodInfos->ofnInfos.lpstrCustomFilter));
    356 
    357   if (fodInfos->ofnInfos.lpstrFile)
    358   {
    359       /*
    360        * We have to clear the buffer before we copy the filename since we don't
    361        * support selecting multiple files. We have to make sure that the caller won't
    362        * attempt to read past the first filename.
    363        */
    364       memset(ofn->lpstrFile, '\0', ofn->nMaxFile);
    365       strcpy(ofn->lpstrFile,fodInfos->ofnInfos.lpstrFile);
    366       MemFree((LPVOID)fodInfos->ofnInfos.lpstrFile);
    367   }
    368   if (fodInfos->ofnInfos.lpstrFileTitle)
    369     {
    370       if (ofn->lpstrFileTitle)
    371           strcpy(ofn->lpstrFileTitle,
    372                  fodInfos->ofnInfos.lpstrFileTitle);
    373       MemFree((LPVOID)fodInfos->ofnInfos.lpstrFileTitle);
     314  if (lpstrInitialDir)
     315  {
     316    MemFree((LPVOID)(fodInfos->ofnInfos->lpstrInitialDir));
     317    fodInfos->ofnInfos->lpstrInitialDir = lpstrInitialDir;
    374318      }
    375 
     319  if (lpstrFilter)
     320  {
     321    MemFree((LPVOID)(fodInfos->ofnInfos->lpstrFilter));
     322    fodInfos->ofnInfos->lpstrFilter = lpstrFilter;
     323  }
     324  if (lpstrCustomFilter)
     325  {
     326    MemFree((LPVOID)(fodInfos->ofnInfos->lpstrCustomFilter));
     327    fodInfos->ofnInfos->lpstrCustomFilter = lpstrCustomFilter;
     328  }
     329
     330  ofn->Flags = dwFlags;
     331  ofn->hInstance = hInstance;
    376332  MemFree((LPVOID)(fodInfos));
    377333  return ret;
     
    391347  BOOL ret;
    392348  FileOpenDlgInfos *fodInfos;
     349  HINSTANCE hInstance;
     350  LPCSTR lpstrFilter = NULL;
     351  LPSTR lpstrCustomFilter = NULL;
     352  DWORD dwFlags;
    393353
    394354  /* Initialise FileOpenDlgInfos structure*/
    395355  fodInfos = (FileOpenDlgInfos*)MemAlloc(sizeof(FileOpenDlgInfos));
    396   memset(&fodInfos->ofnInfos,'\0',sizeof(*ofn));
    397   fodInfos->ofnInfos.lStructSize = sizeof(*ofn);
    398   fodInfos->ofnInfos.hwndOwner = ofn->hwndOwner;
    399   fodInfos->ofnInfos.hInstance = MapHModuleLS(ofn->hInstance);
     356
     357  /*  Pass in the original ofn */
     358  fodInfos->ofnInfos = (LPOPENFILENAMEA)ofn;
     359
     360  /* Save hInstance */
     361  hInstance = fodInfos->ofnInfos->hInstance;
     362  fodInfos->ofnInfos->hInstance = MapHModuleLS(ofn->hInstance);
     363
     364  /* Save lpstrFilter */
    400365  if (ofn->lpstrFilter)
    401366  {
     
    403368    LPSTR x,y;
    404369    int n;
     370
     371    lpstrFilter = fodInfos->ofnInfos->lpstrFilter;
    405372
    406373    /* filter is a list...  title\0ext\0......\0\0 */
     
    419386    }
    420387    *x=0;
    421     fodInfos->ofnInfos.lpstrFilter = (LPSTR)y;
    422   }
    423   if (ofn->lpstrCustomFilter) {
     388    fodInfos->ofnInfos->lpstrFilter = (LPSTR)y;
     389  }
     390  /* Save lpstrCustomFilter */
     391  if (ofn->lpstrCustomFilter)
     392  {
    424393    LPWSTR  s;
    425394    LPSTR x,y;
    426395    int n;
    427396
     397    lpstrCustomFilter = fodInfos->ofnInfos->lpstrCustomFilter;
    428398    /* filter is a list...  title\0ext\0......\0\0 */
    429399    s = (LPWSTR)ofn->lpstrCustomFilter;
     
    440410    }
    441411    *x=0;
    442     fodInfos->ofnInfos.lpstrCustomFilter = (LPSTR)y;
    443   }
    444   fodInfos->ofnInfos.nMaxCustFilter = ofn->nMaxCustFilter;
    445   fodInfos->ofnInfos.nFilterIndex = ofn->nFilterIndex;
    446   if (ofn->nMaxFile)
    447      fodInfos->ofnInfos.lpstrFile = (LPSTR)MemAlloc(ofn->nMaxFile);
    448   fodInfos->ofnInfos.nMaxFile = ofn->nMaxFile;
    449   fodInfos->ofnInfos.nMaxFileTitle = ofn->nMaxFileTitle;
    450   if (ofn->nMaxFileTitle)
    451     fodInfos->ofnInfos.lpstrFileTitle = (LPSTR)MemAlloc(ofn->nMaxFileTitle);
    452   if (ofn->lpstrInitialDir)
    453   {
    454     fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrInitialDir)+1);
    455     lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrInitialDir,ofn->lpstrInitialDir);
    456   }
    457   if (ofn->lpstrTitle)
    458   {
    459     fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrTitle)+1);
    460     lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrTitle,ofn->lpstrTitle);
    461   }
    462   fodInfos->ofnInfos.Flags = ofn->Flags|OFN_WINE|OFN_UNICODE;
    463   fodInfos->ofnInfos.nFileOffset = ofn->nFileOffset;
    464   fodInfos->ofnInfos.nFileExtension = ofn->nFileExtension;
    465   if (ofn->lpstrDefExt)
    466   {
    467     fodInfos->ofnInfos.lpstrDefExt = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrDefExt)+1);
    468     lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrDefExt,ofn->lpstrDefExt);
    469   }
    470   fodInfos->ofnInfos.lCustData = ofn->lCustData;
    471   fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook;
    472 
    473   if (HIWORD(ofn->lpTemplateName))
    474   {
    475     fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)+1);
    476     lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpTemplateName,ofn->lpTemplateName);
    477   }
    478   else
    479   {
    480       /* resource id */
    481       fodInfos->ofnInfos.lpTemplateName = (LPSTR)ofn->lpTemplateName;
    482   }
     412    fodInfos->ofnInfos->lpstrCustomFilter = (LPSTR)y;
     413  }
     414
     415  /* Save Flags */
     416  dwFlags = fodInfos->ofnInfos->Flags;
     417  fodInfos->ofnInfos->Flags = ofn->Flags|OFN_WINE|OFN_UNICODE;
     418
    483419  /* Initialise the dialog property */
    484420  fodInfos->DlgInfos.dwDlgProp = 0;
     
    498434
    499435  /* Cleaning */
    500   ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset;
    501   ofn->nFileExtension = fodInfos->ofnInfos.nFileExtension;
    502 
    503   /*
    504      Transfer the combo index in the OPENFILENAME structure;
    505      No support for custom filters, so nFilterIndex must be one-based.
    506   */
    507   ofn->nFilterIndex = fodInfos->ofnInfos.nFilterIndex;
    508 
    509   if (fodInfos->ofnInfos.lpstrFilter)
    510     MemFree((LPVOID)(fodInfos->ofnInfos.lpstrFilter));
    511   if (HIWORD(fodInfos->ofnInfos.lpTemplateName))
    512     MemFree((LPVOID)(fodInfos->ofnInfos.lpTemplateName));
    513   if (fodInfos->ofnInfos.lpstrDefExt)
    514     MemFree((LPVOID)(fodInfos->ofnInfos.lpstrDefExt));
    515   if (fodInfos->ofnInfos.lpstrTitle)
    516     MemFree((LPVOID)(fodInfos->ofnInfos.lpstrTitle));
    517   if (fodInfos->ofnInfos.lpstrInitialDir)
    518     MemFree((LPVOID)(fodInfos->ofnInfos.lpstrInitialDir));
    519   if (fodInfos->ofnInfos.lpstrCustomFilter)
    520     MemFree((LPVOID)(fodInfos->ofnInfos.lpstrCustomFilter));
    521 
    522   if (fodInfos->ofnInfos.lpstrFile)
    523   {
    524       /*
    525        * We have to clear the buffer before we copy the filename since we don't
    526        * support selecting multiple files. We have to make sure that the caller won't
    527        * attempt to read past the first filename.
    528        */
    529       memset(ofn->lpstrFile, '\0', ofn->nMaxFile * sizeof(WCHAR) );
    530       lstrcpyAtoW(ofn->lpstrFile,(fodInfos->ofnInfos.lpstrFile));
    531       MemFree((LPVOID)(fodInfos->ofnInfos.lpstrFile));
    532   }
    533 
    534   if (fodInfos->ofnInfos.lpstrFileTitle) {
    535       if (ofn->lpstrFileTitle)
    536                 lstrcpyAtoW(ofn->lpstrFileTitle,
    537       (fodInfos->ofnInfos.lpstrFileTitle));
    538       MemFree((LPVOID)(fodInfos->ofnInfos.lpstrFileTitle));
    539   }
     436  /* Restore Flags */
     437  fodInfos->ofnInfos->Flags = dwFlags;
     438
     439  /* Restore lpstrFilter */
     440  if (fodInfos->ofnInfos->lpstrFilter)
     441  {
     442    MemFree((LPVOID)(fodInfos->ofnInfos->lpstrFilter));
     443    fodInfos->ofnInfos->lpstrFilter = lpstrFilter;
     444  }
     445  if (fodInfos->ofnInfos->lpstrCustomFilter)
     446  {
     447    MemFree((LPVOID)(fodInfos->ofnInfos->lpstrCustomFilter));
     448    fodInfos->ofnInfos->lpstrCustomFilter = lpstrCustomFilter;
     449  }
     450
     451  /* Restore hInstance */
     452  fodInfos->ofnInfos->hInstance = hInstance;
    540453  MemFree((LPVOID)(fodInfos));
    541454  return ret;
    542 
    543455}
    544456
     
    688600                lParam = (LPARAM) &fodInfos->ofnInfos;
    689601                ArrangeCtrlPositions(hwnd,GetParent(hwnd));
    690             if(fodInfos && (fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos.lpfnHook)
    691                  return CallWindowProcA((WNDPROC)fodInfos->ofnInfos.lpfnHook,hwnd,uMsg,wParam,lParam);
     602            if(fodInfos && (fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos->lpfnHook)
     603                 return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
    692604                return 0;
    693605        }
    694606    }
    695     if(fodInfos && (fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos.lpfnHook )
    696         return CallWindowProcA((WNDPROC)fodInfos->ofnInfos.lpfnHook,hwnd,uMsg,wParam,lParam);
     607    if(fodInfos && (fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos->lpfnHook )
     608        return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
    697609  return DefWindowProcA(hwnd,uMsg,wParam,lParam);
    698610}
     
    704616    HANDLE hDlgTmpl = 0;
    705617    HWND hChildDlg = 0;
    706    if (fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATE || fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE)
     618   if (fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATE || fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATEHANDLE)
    707619   {
    708         if (fodInfos->ofnInfos.Flags  & OFN_ENABLETEMPLATEHANDLE)
     620        if (fodInfos->ofnInfos->Flags  & OFN_ENABLETEMPLATEHANDLE)
    709621        {
    710            if( !(template = LockResource( fodInfos->ofnInfos.hInstance)))
     622           if( !(template = LockResource( fodInfos->ofnInfos->hInstance)))
    711623                {
    712624                COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
     
    717629        else
    718630        {
    719          if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos.hInstance),
    720             (fodInfos->ofnInfos.lpTemplateName), RT_DIALOGA)))
     631         if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos->hInstance),
     632            (fodInfos->ofnInfos->lpTemplateName), RT_DIALOGA)))
    721633        {
    722634                COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
    723635                 return (HWND)NULL;
    724636        }
    725         if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos.hInstance),
     637        if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos->hInstance),
    726638             hRes )) ||
    727639                 !(template = LockResource( hDlgTmpl )))
     
    732644        }
    733645
    734         hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,template,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
     646        hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,template,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
    735647        if(hChildDlg)
    736648        {
     
    739651        }
    740652 }
    741  else if(fodInfos->ofnInfos.Flags & OFN_ENABLEHOOK && fodInfos->ofnInfos.lpfnHook)
     653 else if(fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK && fodInfos->ofnInfos->lpfnHook)
    742654 {
    743655        RECT rectHwnd;
     
    752664        tmplate.cy = rectHwnd.bottom-rectHwnd.top;
    753665
    754         return CreateDialogIndirectParamA(fodInfos->ofnInfos.hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
     666        return CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
    755667 }
    756668return (HWND)NULL;
     
    774686        ofnNotify.hdr.idFrom=0;
    775687        ofnNotify.hdr.code = uCode;
    776         ofnNotify.lpOFN = &fodInfos->ofnInfos;
     688        ofnNotify.lpOFN = fodInfos->ofnInfos;
    777689        return SendMessageA(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify);
    778690    }
     
    788700{
    789701    LPSTR lpstrFileSpec;
    790     int reqSize;
    791     char lpstrPath[MAX_PATH];
     702    char lpstrCurrentDir[MAX_PATH]="";
    792703    FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
    793704    if(!fodInfos)
    794         return -1;
     705        return TRUE;
    795706    switch(uMsg)
    796707    {
    797708        case CDM_GETFILEPATH:
     709        {
     710            char lpstrPathSpec[MAX_PATH]="";
     711            GetDlgItemTextA(hwnd,IDC_FILENAME,(LPSTR)lParam, (int)wParam);
     712            lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA((LPSTR)lParam);
     713            strcpy(lpstrPathSpec,(LPSTR)lParam);
     714            COMDLG32_PathRemoveFileSpecA(lpstrPathSpec);
     715            if(!lpstrPathSpec[0])
     716                COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,
     717                lpstrPathSpec);
     718            strcat(lpstrPathSpec,"\\");
     719            strcat(lpstrPathSpec,(LPSTR)lParam);
     720            strcpy((LPSTR)lParam,(LPSTR)lpstrPathSpec);
     721        }
     722            return TRUE;
     723        case CDM_GETFOLDERPATH:
     724            if(lParam)
    798725            {
    799             GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrPath, sizeof(lpstrPath));
    800             lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrPath);
    801             if (lpstrFileSpec==lpstrPath) {
    802                 char lpstrCurrentDir[MAX_PATH];
    803                 /* Prepend the current path */
    804                 COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrCurrentDir);
    805                 if ((LPSTR)lParam!=NULL)
    806                     wsnprintfA((LPSTR)lParam,(int)wParam,"%s\\%s",lpstrCurrentDir,lpstrPath);
    807                 reqSize=strlen(lpstrCurrentDir)+1+strlen(lpstrPath)+1;
    808             } else {
    809                 lstrcpynA((LPSTR)lParam,(LPSTR)lpstrPath,(int)wParam);
    810                 reqSize=strlen(lpstrPath);
     726                if(fodInfos)
     727                {
     728                    COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,
     729                    lpstrCurrentDir);
     730                    strncpy((LPSTR)lParam,lpstrCurrentDir,(int)wParam);
    811731                }
     732                else
     733                *((LPSTR)lParam)=0;
    812734            }
    813             /* return the required buffer size */
    814             return reqSize;
    815         case CDM_GETFOLDERPATH:
    816             COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrPath);
    817             if ((LPSTR)lParam!=NULL)
    818                 lstrcpynA((LPSTR)lParam,lpstrPath,(int)wParam);
    819             return strlen(lpstrPath);
     735            return TRUE;
    820736    case CDM_GETSPEC:
    821             reqSize=GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrPath, sizeof(lpstrPath));
    822             lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrPath);
    823             if ((LPSTR)lParam!=NULL)
    824                 lstrcpynA((LPSTR)lParam, lpstrFileSpec, (int)wParam);
    825             return strlen(lpstrFileSpec);
     737            if(lParam)
     738            {
     739                GetDlgItemTextA(hwnd,IDC_FILENAME,(LPSTR)lParam, (int)wParam);
     740                lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA((LPSTR)lParam);
     741                if(lpstrFileSpec)
     742                   strcpy((LPSTR)lParam, lpstrFileSpec);
     743                else
     744                    *((LPSTR)lParam)=0;
     745            }
     746            return TRUE;
     747        case CDM_SETCONTROLTEXT:
     748          if ( 0 != lParam )
     749            SetDlgItemTextA( hwnd, (UINT) wParam, (LPSTR) lParam );
     750          return TRUE;
    826751        case CDM_HIDECONTROL:
    827         case CDM_SETCONTROLTEXT:
    828752        case CDM_SETDEFEXT:
    829753        FIXME("CDM_HIDECONTROL,CDM_SETCONTROLTEXT,CDM_SETDEFEXT not implemented\n");
    830754        return TRUE;
    831755    }
    832     return -1;
     756    return TRUE;
    833757}
    834758
     
    869793
    870794  case WM_DESTROY:
    871       RemovePropA(hwnd, FileOpenDlgInfosStr);
     795        FILEDLG95_Clean(hwnd);
     796        RemovePropA(hwnd, FileOpenDlgInfosStr);
     797        return FALSE;
     798
     799    case WM_NOTIFY:
     800    {
     801        LPNMHDR lpnmh = (LPNMHDR)lParam;
     802        UINT stringId = -1;
     803
     804        /* set up the button tooltips strings */
     805        if(TTN_GETDISPINFOA == lpnmh->code )
     806        {
     807            LPNMTTDISPINFOA lpdi = (LPNMTTDISPINFOA)lParam;
     808            switch(lpnmh->idFrom )
     809            {
     810                /* Up folder button */
     811                case FCIDM_TB_UPFOLDER:
     812                    stringId = IDS_UPFOLDER;
     813                    break;
     814                /* New folder button */
     815                case FCIDM_TB_NEWFOLDER:
     816                    stringId = IDS_NEWFOLDER;
     817                    break;
     818                /* List option button */
     819                case FCIDM_TB_SMALLICON:
     820                    stringId = IDS_LISTVIEW;
     821                    break;
     822                /* Details option button */
     823                case FCIDM_TB_REPORTVIEW:
     824                    stringId = IDS_REPORTVIEW;
     825                    break;
     826            }
     827            lpdi->hinst = COMMDLG_hInstance32;
     828            lpdi->lpszText =  (LPSTR) stringId;
     829        }
     830        return FALSE;
     831    }
    872832
    873833    default :
     
    887847  LPITEMIDLIST pidlItemId;
    888848  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam;
     849  DWORD count;
    889850
    890851  TRACE("\n");
     
    894855  InitCommonControls();
    895856#endif
    896 
     857//MessageBox(hwnd,"WM_INITDIALOG",NULL,MB_OK);
     858dprintf(("CB: FILEDLG95_SHELL_Init"));
     859count = GetTickCount();
    897860  /* Initialise shell objects */
    898861  FILEDLG95_SHELL_Init(hwnd);
    899 
     862dprintf(("CB: FILEDLG95_InitUI %d ms",GetTickCount()-count));
     863count = GetTickCount();
    900864  /* Initialise dialog UI */
    901865  FILEDLG95_InitUI(hwnd);
    902 
     866dprintf(("CB: FILEDLG95_LOOKIN_Init %d",GetTickCount()-count));
     867count = GetTickCount();
    903868  /* Initialize the Look In combo box*/
    904869  FILEDLG95_LOOKIN_Init(fodInfos->DlgInfos.hwndLookInCB);
    905 
     870dprintf(("CB: FILEDLG95_FILETYPE_Init %d",GetTickCount()-count));
     871count = GetTickCount();
    906872  /* Initialize the filter combo box */
    907873  FILEDLG95_FILETYPE_Init(hwnd);
    908 
     874dprintf(("CB: FILEDLG95_FILETYPE_Init done %d",GetTickCount()-count));
     875count = GetTickCount();
    909876  /* Get the initial directory pidl */
    910877
    911   if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->ofnInfos.lpstrInitialDir)))
     878  if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->ofnInfos->lpstrInitialDir)))
    912879  {
    913880    char path[MAX_PATH];
     
    918885
    919886  }
    920 
     887dprintf(("CB: IShellBrowser_BrowseObject %d",GetTickCount()-count));
     888count = GetTickCount();
    921889  /* Browse to the initial directory */
    922890  IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,pidlItemId,SBSP_RELATIVE);
    923 
     891dprintf(("CB: done WM_INITDIALOG %d",GetTickCount()-count));
    924892  /* Free pidlItem memory */
    925893  COMDLG32_SHFree(pidlItemId);
     
    958926    /* Cancel button */
    959927  case IDCANCEL:
    960       FILEDLG95_Clean(hwnd);
    961928      EndDialog(hwnd, FALSE);
    962929    break;
     
    10641031
    10651032  /* Set the window text with the text specified in the OPENFILENAME structure */
    1066   if(fodInfos->ofnInfos.lpstrTitle)
    1067   {
    1068       SetWindowTextA(hwnd,fodInfos->ofnInfos.lpstrTitle);
     1033  if(fodInfos->ofnInfos->lpstrTitle)
     1034  {
     1035      SetWindowTextA(hwnd,fodInfos->ofnInfos->lpstrTitle);
    10691036  }
    10701037  else if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
     
    10741041
    10751042  /* Initialise the file name edit control */
    1076   if(fodInfos->ofnInfos.lpstrFile)
    1077   {
    1078       SetDlgItemTextA(hwnd,IDC_FILENAME,fodInfos->ofnInfos.lpstrFile);
    1079   }
     1043  if(fodInfos->ofnInfos->lpstrFile)
     1044  {
     1045      /**
     1046       * When passed a fully qualified filename, windows removes
     1047       * the path component, before showing it in the control
     1048       */
     1049      LPSTR lpstrFileName = NULL;
     1050
     1051      lpstrFileName = (LPSTR)COMDLG32_PathFindFilenameA(fodInfos->ofnInfos->lpstrFile);
     1052      if(NULL != lpstrFileName)
     1053          SetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileName);
     1054      else
     1055          SetDlgItemTextA(hwnd,IDC_FILENAME,"");
     1056  }
     1057
    10801058  /* Must the open as read only check box be checked ?*/
    1081   if(fodInfos->ofnInfos.Flags & OFN_READONLY)
     1059  if(fodInfos->ofnInfos->Flags & OFN_READONLY)
    10821060  {
    10831061    SendDlgItemMessageA(hwnd,IDC_OPENREADONLY,BM_SETCHECK,(WPARAM)TRUE,0);
    10841062  }
    10851063  /* Must the open as read only check box be hid ?*/
    1086   if(fodInfos->ofnInfos.Flags & OFN_HIDEREADONLY)
     1064  if(fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY)
    10871065  {
    10881066    ShowWindow(GetDlgItem(hwnd,IDC_OPENREADONLY),SW_HIDE);
     1067  }
     1068  /* Must the help button be hid ?*/
     1069  if (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP))
     1070  {
     1071    ShowWindow(GetDlgItem(hwnd, pshHelp), SW_HIDE);
     1072  }
     1073  /* Resize the height, if open as read only checkbox ad help button
     1074     are hidden */
     1075  if ( (fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY) &&
     1076       (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP)) )
     1077  {
     1078    RECT rectDlg, rectHelp, rectCancel;
     1079    GetWindowRect(hwnd, &rectDlg);
     1080    GetWindowRect(GetDlgItem(hwnd, pshHelp), &rectHelp);
     1081    GetWindowRect(GetDlgItem(hwnd, IDCANCEL), &rectCancel);
     1082    /* subtract the height of the help button plus the space between
     1083       the help button and the cancel button to the height of the dialog */
     1084    SetWindowPos(hwnd, 0, 0, 0, rectDlg.right-rectDlg.left,
     1085                 (rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom),
     1086                 SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
    10891087  }
    10901088  /* change Open to Save */
     
    10921090  {
    10931091      SetDlgItemTextA(hwnd,IDOK,"Save");
     1092      SetDlgItemTextA(hwnd,IDC_LOOKINSTATIC,"Save &in");
    10941093  }
    10951094  return 0;
     
    10971096
    10981097/***********************************************************************
     1098 *      FILEDLG95_OnOpenMultipleFiles
     1099 *
     1100 * Handles the opening of multiple files.
     1101 *
     1102*/
     1103BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPSTR lpstrFileList, UINT nFileCount, UINT sizeUsed)
     1104{
     1105  CHAR   lpstrPathSpec[MAX_PATH] = "";
     1106  CHAR   lpstrTempFileList[MAX_PATH] = "";
     1107  LPSTR  lpstrFile;
     1108  UINT   sizePath;
     1109  UINT   nCount;
     1110  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
     1111
     1112  TRACE("\n");
     1113
     1114  lpstrFile = fodInfos->ofnInfos->lpstrFile;
     1115
     1116  COMDLG32_SHGetPathFromIDListA( fodInfos->ShellInfos.pidlAbsCurrent, lpstrPathSpec );
     1117  sizePath = lstrlenA( lpstrPathSpec );
     1118
     1119  memset( lpstrFile, 0x0, fodInfos->ofnInfos->nMaxFile * sizeof(CHAR) );
     1120
     1121  if ( fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST ||
     1122          !(fodInfos->ofnInfos->Flags & OFN_EXPLORER ))
     1123          {
     1124      LPSTR lpstrTemp = lpstrFileList;
     1125
     1126      for ( nCount = 0; nCount < nFileCount; nCount++ )
     1127      {
     1128          WIN32_FIND_DATAA findData;
     1129          CHAR lpstrFindFile[MAX_PATH];
     1130
     1131          memset( lpstrFindFile, 0x0, MAX_PATH * sizeof(CHAR) );
     1132
     1133          lstrcpyA( lpstrFindFile, lpstrPathSpec );
     1134          lstrcatA( lpstrFindFile, "\\" );
     1135          lstrcatA( lpstrFindFile, lpstrTemp );
     1136
     1137          if ( FindFirstFileA( lpstrFindFile, &findData ) == INVALID_HANDLE_VALUE )
     1138          {
     1139              CHAR lpstrNotFound[100];
     1140              CHAR lpstrMsg[100];
     1141              CHAR tmp[400];
     1142
     1143              LoadStringA(COMMDLG_hInstance32, IDS_FILENOTFOUND, lpstrNotFound, 100);
     1144              LoadStringA(COMMDLG_hInstance32, IDS_VERIFYFILE, lpstrMsg, 100);
     1145
     1146              strcpy(tmp, lpstrFindFile);
     1147              strcat(tmp, "\n");
     1148              strcat(tmp, lpstrNotFound);
     1149              strcat(tmp, "\n");
     1150              strcat(tmp, lpstrMsg);
     1151
     1152              MessageBoxA(hwnd,
     1153                      tmp,
     1154                      fodInfos->ofnInfos->lpstrTitle,
     1155                      MB_OK | MB_ICONEXCLAMATION);
     1156              return FALSE;
     1157  }
     1158
     1159          if (!(fodInfos->ofnInfos->Flags & OFN_EXPLORER ))
     1160  {
     1161              lstrcatA( lpstrTempFileList, findData.cAlternateFileName);
     1162              if ( nCount + 1 < nFileCount)
     1163                  lstrcatA( lpstrTempFileList, " ");
     1164  }
     1165          lpstrTemp += strlen(lpstrFileList) + 1;
     1166      }
     1167  }
     1168
     1169      if ( fodInfos->ofnInfos->Flags & OFN_EXPLORER )
     1170      {
     1171      lstrcpyA( lpstrFile, lpstrPathSpec);
     1172      memcpy( lpstrFile + sizePath + 1, lpstrFileList, sizeof(CHAR) * sizeUsed );
     1173      }
     1174      else
     1175      {
     1176      memcpy( lpstrFile, lpstrTempFileList, sizeof(CHAR) * strlen(lpstrTempFileList));
     1177      }
     1178
     1179      fodInfos->ofnInfos->nFileOffset = sizePath + 1;
     1180      fodInfos->ofnInfos->nFileExtension = 0;
     1181
     1182  /* clean and exit */
     1183  return EndDialog(hwnd,TRUE);
     1184}
     1185
     1186/***********************************************************************
    10991187 *      FILEDLG95_OnOpen
    11001188 *
     
    11051193BOOL FILEDLG95_OnOpen(HWND hwnd)
    11061194{
    1107   char lpstrSpecifiedByUser[MAX_PATH];
     1195  CHAR lpstrSpecifiedByUser[MAX_PATH] = "";
     1196  CHAR lpstrFileList[MAX_PATH] = "";
     1197  LPSTR lpstrFile;
     1198  UINT nStrCharCount = 0;
     1199  UINT nFileCount = 0;
     1200  UINT nFileIndex = 0;
     1201  UINT sizeUsed = 0;
     1202  UINT nStrLen = 0;
     1203
    11081204  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
    1109   LPITEMIDLIST pidlSelection;
    1110 
    1111   lpstrSpecifiedByUser[0]='\0';
    11121205
    11131206  TRACE("\n");
    1114 
    1115   /* Check if there is a selected item in the listview */
    1116   if(fodInfos->DlgInfos.dwDlgProp & FODPROP_USEVIEW)
    1117   {
    1118       pidlSelection = GetSelectedPidl(fodInfos->Shell.FOIShellView);
    1119       GetName(fodInfos->Shell.FOIShellFolder,pidlSelection,SHGDN_NORMAL,lpstrSpecifiedByUser);
    1120       COMDLG32_SHFree((LPVOID)pidlSelection);
    1121   }
    1122   else
    1123       /* Get the text from the filename edit */
    1124       GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrSpecifiedByUser,MAX_PATH);
    1125 
    1126   if(strlen(lpstrSpecifiedByUser))
     1207//CB: optimize this function!
     1208  /* If a folder is selected browse folder */
     1209  if (BrowseSelectedFolder(hwnd))
     1210      return FALSE;
     1211
     1212  lpstrFile = fodInfos->ofnInfos->lpstrFile;
     1213
     1214  GetDlgItemTextA(hwnd, IDC_FILENAME, lpstrSpecifiedByUser, MAX_PATH);
     1215  nStrLen = strlen(lpstrSpecifiedByUser);
     1216
     1217  while ( nStrCharCount <= nStrLen )
     1218  {
     1219      if ( lpstrSpecifiedByUser[nStrCharCount]=='"' )
     1220      {
     1221          nStrCharCount++;
     1222
     1223          while ((lpstrSpecifiedByUser[nStrCharCount]!='"') &&
     1224              (nStrCharCount <= nStrLen))
     1225  {
     1226              lpstrFileList[nFileIndex++] = lpstrSpecifiedByUser[nStrCharCount];
     1227              nStrCharCount++;
     1228              sizeUsed++;
     1229  }
     1230          lpstrFileList[nFileIndex++] = '\0';
     1231          sizeUsed++;
     1232          nFileCount++;
     1233      }
     1234      nStrCharCount++;
     1235  }
     1236
     1237  if(nFileCount > 0)
     1238      return FILEDLG95_OnOpenMultipleFiles(hwnd, lpstrFileList, nFileCount, sizeUsed);
     1239
     1240  if (nStrLen)
    11271241  {
    11281242      LPSHELLFOLDER psfDesktop;
     
    11301244      LPSTR lpstrFileSpec;
    11311245      LPSTR lpstrTemp;
    1132       char lpstrPathSpec[MAX_PATH];
    1133       char lpstrCurrentDir[MAX_PATH];
    1134       char lpstrPathAndFile[MAX_PATH];
    1135 
    1136       lpstrPathSpec[0]    = '\0';
    1137       lpstrCurrentDir[0]  = '\0';
    1138       lpstrPathAndFile[0] = '\0';
     1246      char lpstrPathSpec[MAX_PATH] = "";
     1247      char lpstrCurrentDir[MAX_PATH] = "";
     1248      char lpstrPathAndFile[MAX_PATH] = "";
    11391249
    11401250      /* Separate the file spec from the path spec
     
    11431253              C:\TEXT1\TEXT2        C:\TEXT1          TEXT2
    11441254      */
     1255      if (nFileCount == 0)
     1256      {
    11451257      lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrSpecifiedByUser);
    11461258      strcpy(lpstrPathSpec,lpstrSpecifiedByUser);
    11471259      COMDLG32_PathRemoveFileSpecA(lpstrPathSpec);
     1260      }
    11481261
    11491262      /* Get the index of the selected item in the filetype combo box */
    1150       fodInfos->ofnInfos.nFilterIndex = (DWORD) CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
     1263      fodInfos->ofnInfos->nFilterIndex = (DWORD) CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
    11511264      /* nFilterIndex is 1 based while combo GetCurSel return zero based index */
    1152       fodInfos->ofnInfos.nFilterIndex++;
     1265      fodInfos->ofnInfos->nFilterIndex++;
    11531266
    11541267      /* Get the current directory name */
     
    11641277          case '\\':
    11651278              {
    1166               int lenPathSpec=strlen(lpstrPathSpec);
    1167               INT iCopy = (lenPathSpec!=0?2:3);
    1168               memmove(lpstrPathSpec+iCopy,lpstrPathSpec,lenPathSpec);
    1169               strncpy(lpstrPathSpec,lpstrCurrentDir,iCopy);
     1279                  INT iCopy = 2;
     1280                  char lpstrTmp[MAX_PATH] = "";
     1281                  if(!strlen(lpstrPathSpec))
     1282                      iCopy = 3;
     1283                  strncpy(lpstrTmp,lpstrCurrentDir,iCopy);
     1284                  strcat(lpstrTmp,lpstrPathSpec);
     1285                  strcpy(lpstrPathSpec,lpstrTmp);
    11701286              }
    11711287              break;
     
    11741290              {
    11751291                  INT iSize;
    1176                   char lpstrTmp2[MAX_PATH];
     1292                  char lpstrTmp2[MAX_PATH] = "";
    11771293                  LPSTR lpstrTmp = strrchr(lpstrCurrentDir,'\\');
    1178 
    11791294                  iSize = lpstrTmp - lpstrCurrentDir;
    11801295                  strncpy(lpstrTmp2,lpstrCurrentDir,iSize + 1);
    11811296                  if(strlen(lpstrSpecifiedByUser) <= 3)
    1182                   *lpstrFileSpec='\0';
     1297                      strcpy(lpstrFileSpec,"");
    11831298                  if(strcmp(lpstrPathSpec,".."))
    11841299                      strcat(lpstrTmp2,&lpstrPathSpec[3]);
     
    11881303          default:
    11891304  {
    1190                   char lpstrTmp[MAX_PATH];
    1191 
     1305                  char lpstrTmp[MAX_PATH] = "";
    11921306                  if(strcmp(&lpstrCurrentDir[strlen(lpstrCurrentDir)-1],"\\"))
    11931307                      strcat(lpstrCurrentDir,"\\");
     
    12161330          {
    12171331              /* Path does not exist */
    1218               if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST)
     1332              if(fodInfos->ofnInfos->Flags & OFN_PATHMUSTEXIST)
    12191333              {
    12201334                  MessageBoxA(hwnd,
    12211335                              "Path does not exist",
    1222                               fodInfos->ofnInfos.lpstrTitle,
     1336                              fodInfos->ofnInfos->lpstrTitle,
    12231337                              MB_OK | MB_ICONEXCLAMATION);
    12241338                  return FALSE;
     
    12731387    }
    12741388
     1389      {
     1390       HANDLE hFile;
     1391       WIN32_FIND_DATAA stffile;
    12751392      /* browse if the user specified a directory */
     1393       hFile = FindFirstFileA(lpstrFileSpec, &stffile);
     1394       if ( hFile != INVALID_HANDLE_VALUE )
     1395       {
     1396        FindClose (hFile);
     1397        if (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
    12761398      browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder,
    12771399              lpstrFileSpec);
     1400        else
     1401        {
     1402         // if there is an extention, then get the Pidl otherwise
     1403         // we are going to need to add the extention
     1404         if(strrchr(lpstrFileSpec,'.'))
     1405          browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder,
     1406                lpstrFileSpec);
     1407         else
     1408          browsePidl=NULL;
     1409        }
     1410       }
     1411       else
     1412        browsePidl=NULL;
     1413      }
     1414
    12781415      if (!browsePidl) /* not a directory check the specified file exists */
    12791416      {
     1417       int i;
    12801418          int iExt;
    12811419          char lpstrFileSpecTemp[MAX_PATH] = "";
     
    12851423          iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
    12861424          lpOrg = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, iExt);
     1425          if (lpOrg == (LPSTR)-1)
     1426              lpOrg = NULL;     // we get -1 if the filetype LB is empty
     1427
    12871428          lpstrExt = lpOrg;
    12881429
    12891430          /*
    1290              add user specified extentions to the file one by one and
    1291              check if the file exists
     1431          Simply take the first one of the list as default.
     1432          Otherwise the user must specify which extention they want.
     1433          Also, make sure we don't have a .*, in this case simply
     1434          forget about the extention
    12921435         */
    1293           while(lpOrg)
    1294          {
    1295              int i;
    12961436             lpstrExt = strchr(lpOrg, ';');
    12971437             if (lpstrExt)
     
    13091449                 if (strchr(lpBuf, '.'))
    13101450                     strcat(lpstrFileSpecTemp, (strchr(lpBuf, '.')) + 1);
    1311              } else {
    1312                  if (strchr(lpBuf, '.'))
    1313                      strcat(lpstrFileSpecTemp, strchr(lpBuf, '.'));
    13141451             }
     1452             else
     1453                 strcat(lpstrFileSpecTemp, strchr(lpBuf, '.'));
    13151454             browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder,
    13161455                     lpstrFileSpecTemp);
    13171456             MemFree((void *)lpBuf);
    13181457             if (browsePidl)
    1319              {
    13201458                 strcpy(lpstrFileSpec,lpstrFileSpecTemp);
    1321                  break;
    1322              }
    13231459             if (lpstrExt)
    13241460                 lpOrg = lpstrExt+1;
    13251461             else
    13261462                 lpOrg = NULL;
    1327          }
    13281463      }
    13291464
     
    13461481                                                   SBSP_RELATIVE)))
    13471482        {
    1348                   if(fodInfos->ofnInfos.Flags & OFN_PATHMUSTEXIST)
     1483                  if(fodInfos->ofnInfos->Flags & OFN_PATHMUSTEXIST)
    13491484        {
    13501485                      MessageBoxA(hwnd,
    13511486                                  "Path does not exist",
    1352                                   fodInfos->ofnInfos.lpstrTitle,
     1487                                  fodInfos->ofnInfos->lpstrTitle,
    13531488                                  MB_OK | MB_ICONEXCLAMATION);
    13541489                      COMDLG32_SHFree(browsePidl);
     
    13621497          /* The file does exist, so ask the user if we should overwrite it */
    13631498          if((fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) &&
    1364              (fodInfos->ofnInfos.Flags & OFN_OVERWRITEPROMPT))
     1499             (fodInfos->ofnInfos->Flags & OFN_OVERWRITEPROMPT))
    13651500          {
    13661501                strcpy(lpstrFileExist, lpstrFileSpec);
     
    13691504                nMsgBoxRet = MessageBoxA(hwnd,
    13701505                                        lpstrFileExist,
    1371                                         fodInfos->ofnInfos.lpstrTitle,
     1506                                        fodInfos->ofnInfos->lpstrTitle,
    13721507                                        MB_YESNO | MB_ICONEXCLAMATION);
    13731508                if (nMsgBoxRet == IDNO)
     
    13851520          /* The selected file does not exist */
    13861521      /* Tell the user the selected does not exist */
    1387       if(fodInfos->ofnInfos.Flags & OFN_FILEMUSTEXIST)
     1522      if(fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST)
    13881523      {
    13891524        char lpstrNotFound[100];
     
    14001535                          100);
    14011536
    1402         strcpy(tmp,fodInfos->ofnInfos.lpstrFile);
     1537        strcpy(tmp,fodInfos->ofnInfos->lpstrFile);
    14031538        strcat(tmp,"\n");
    14041539        strcat(tmp,lpstrNotFound);
     
    14081543              MessageBoxA(hwnd,
    14091544                          tmp,
    1410                           fodInfos->ofnInfos.lpstrTitle,
     1545                          fodInfos->ofnInfos->lpstrTitle,
    14111546                          MB_OK | MB_ICONEXCLAMATION);
    14121547        return FALSE;
    14131548      }
    14141549      /* Ask the user if he wants to create the file*/
    1415       if(fodInfos->ofnInfos.Flags & OFN_CREATEPROMPT)
     1550      if(fodInfos->ofnInfos->Flags & OFN_CREATEPROMPT)
    14161551      {
    14171552        char tmp[100];
     
    14191554        LoadStringA(COMMDLG_hInstance32,IDS_CREATEFILE,tmp,100);
    14201555
    1421               if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos.lpstrTitle,
     1556              if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos->lpstrTitle,
    14221557                                      MB_YESNO | MB_ICONQUESTION))
    14231558        {
    14241559            /* Create the file, clean and exit */
    1425             FILEDLG95_Clean(hwnd);
    14261560            return EndDialog(hwnd,TRUE);
    14271561        }
     
    14291563      }
    14301564    }
     1565      /* check the write access to the current directory before opening the selected file */
     1566      if((fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && (fodInfos->ofnInfos->Flags & OFN_PATHMUSTEXIST))
     1567      {
     1568          HANDLE hfile;
     1569          char testFile[MAX_PATH];
     1570
     1571          strcpy(testFile,lpstrPathSpec);
     1572          strcat(testFile,"_tes_13.579");
     1573
     1574          hfile = CreateFileA(testFile,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0);
     1575
     1576          switch(GetLastError())
     1577          {
     1578          case ERROR_ACCESS_DENIED:
     1579          case ERROR_WRITE_PROTECT:
     1580          case ERROR_PATH_NOT_FOUND:
     1581          case ERROR_FILE_NOT_FOUND:
     1582              {
     1583                  char strAccessDenied[MAX_PATH + 100];
     1584                  strcpy(strAccessDenied,lpstrPathSpec);
     1585                  strcat(strAccessDenied,lpstrFileSpec);
     1586                  strcat(strAccessDenied,"\nWrite access denied for this file !");
     1587                  MessageBoxA(hwnd,strAccessDenied,fodInfos->ofnInfos->lpstrTitle,MB_OK | MB_ICONEXCLAMATION);
     1588                  return FALSE;
     1589              }
     1590          }
     1591
     1592          if (hfile != INVALID_HANDLE_VALUE)
     1593          {
     1594              CloseHandle(hfile);
     1595              DeleteFileA(testFile);
     1596          }
     1597
     1598      }
    14311599
    14321600      /* Open the selected file */
     
    14571625              }
    14581626
    1459               if(!strcmp(&lpstrExt[1],"*") && fodInfos->ofnInfos.lpstrDefExt)
    1460               {
    1461                   lpstrExt = MemAlloc(strlen(fodInfos->ofnInfos.lpstrDefExt)+2);
    1462                   strcat(lpstrExt,".");
    1463                   strcat(lpstrExt,(LPSTR) fodInfos->ofnInfos.lpstrDefExt);
     1627               if(strcmp(lpstrExt,".*") != 0)
     1628               {
     1629                  /* OPEN DIALOG: Let's see if the file exists with the current extention,
     1630                     if not return the file without the extention.
     1631                     SAVE DIALOG: Concatenate the extention to the file.
     1632                  */
     1633
     1634                  if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG))
     1635                  {
     1636                        LPSTR lpstrFindFile;
     1637                        WIN32_FIND_DATAA fd;
     1638
     1639                        lpstrFindFile = MemAlloc(strlen(lpstrPathAndFile)+strlen(lpstrExt));
     1640                        strcpy(lpstrFindFile, lpstrPathAndFile);
     1641                        strcat(lpstrFindFile, lpstrExt);
     1642                        if(FindFirstFileA(lpstrFindFile, &fd) != INVALID_HANDLE_VALUE)
     1643                                strcat(lpstrPathAndFile,lpstrExt);
     1644                        MemFree(lpstrFindFile);
     1645                  }
     1646                  else
     1647                        strcat(lpstrPathAndFile,lpstrExt);
    14641648              }
    1465               strcat(lpstrPathAndFile,lpstrExt);
     1649              MemFree( lpstrExt );
    14661650          }
    14671651      }
    14681652      /* Check that size size of the file does not exceed buffer size */
    1469       if(strlen(lpstrPathAndFile) > fodInfos->ofnInfos.nMaxFile)
     1653      if(strlen(lpstrPathAndFile) > fodInfos->ofnInfos->nMaxFile)
    14701654      {
    14711655          /* set error FNERR_BUFFERTOSMALL */
    1472           FILEDLG95_Clean(hwnd);
    14731656          return EndDialog(hwnd,FALSE);
    14741657      }
    1475       strcpy(fodInfos->ofnInfos.lpstrFile,lpstrPathAndFile);
     1658      strcpy(fodInfos->ofnInfos->lpstrFile,lpstrPathAndFile);
     1659         fodInfos->ofnInfos->lpstrFile[strlen(lpstrPathAndFile)] = '\0';
     1660         fodInfos->ofnInfos->lpstrFile[strlen(lpstrPathAndFile)+1] = '\0';
    14761661
    14771662      /* Set the lpstrFileTitle of the OPENFILENAME structure */
    1478       if(fodInfos->ofnInfos.lpstrFileTitle)
    1479           strncpy(fodInfos->ofnInfos.lpstrFileTitle,
     1663      if(fodInfos->ofnInfos->lpstrFileTitle)
     1664          strncpy(fodInfos->ofnInfos->lpstrFileTitle,
    14801665                  lpstrFileSpec,
    1481                   fodInfos->ofnInfos.nMaxFileTitle);
     1666                  fodInfos->ofnInfos->nMaxFileTitle);
    14821667
    14831668      /* Check if the file is to be opened as read only */
     
    14851670                                            IDC_OPENREADONLY,
    14861671                                            BM_GETSTATE,0,0))
    1487           SetFileAttributesA(fodInfos->ofnInfos.lpstrFile,
     1672          SetFileAttributesA(fodInfos->ofnInfos->lpstrFile,
    14881673                             FILE_ATTRIBUTE_READONLY);
    14891674
    14901675      /*  nFileExtension and nFileOffset of OPENFILENAME structure */
    1491       lpstrTemp = strrchr(fodInfos->ofnInfos.lpstrFile,'\\');
    1492       fodInfos->ofnInfos.nFileOffset = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1;
    1493       lpstrTemp = strrchr(fodInfos->ofnInfos.lpstrFile,'.');
    1494       fodInfos->ofnInfos.nFileExtension = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1;
     1676      lpstrTemp = strrchr(fodInfos->ofnInfos->lpstrFile,'\\');
     1677      fodInfos->ofnInfos->nFileOffset = lpstrTemp - fodInfos->ofnInfos->lpstrFile + 1;
     1678      lpstrTemp = strrchr(fodInfos->ofnInfos->lpstrFile,'.');
     1679      fodInfos->ofnInfos->nFileExtension = lpstrTemp - fodInfos->ofnInfos->lpstrFile + 1;
    14951680
    14961681
    14971682    /* clean and exit */
    1498     FILEDLG95_Clean(hwnd);
    14991683    return EndDialog(hwnd,TRUE);
    15001684  }
     
    15271711  fodInfos->ShellInfos.hwndOwner = hwnd;
    15281712
    1529   fodInfos->ShellInfos.folderSettings.fFlags = FWF_AUTOARRANGE | FWF_ALIGNLEFT;
     1713  fodInfos->ShellInfos.folderSettings.fFlags = 0;
     1714  /* Disable multi-select if flag not set */
     1715  if (!(fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT))
     1716  {
     1717     fodInfos->ShellInfos.folderSettings.fFlags |= FWF_SINGLESEL;
     1718  }
     1719  fodInfos->ShellInfos.folderSettings.fFlags |= FWF_AUTOARRANGE | FWF_ALIGNLEFT;
    15301720  fodInfos->ShellInfos.folderSettings.ViewMode = FVM_LIST;
    15311721
     
    16541844      char lpstrText[128+MAX_PATH];
    16551845      char lpstrTempText[128];
    1656       char lpstrCaption[256];
     1846      char lpstrCaption[32];
    16571847
    16581848      /* Cannot Create folder because of permissions */
     
    16951885  TRACE("\n");
    16961886
    1697   if(fodInfos->ofnInfos.lpstrFilter)
     1887  if(fodInfos->ofnInfos->lpstrFilter)
    16981888  {
    16991889    int iStrIndex = 0;
     
    17121902
    17131903      /* Get the title */
    1714       lpstrTmp = (&((LPBYTE)fodInfos->ofnInfos.lpstrFilter)[iStrIndex]);
     1904      lpstrTmp = (&((LPBYTE)fodInfos->ofnInfos->lpstrFilter)[iStrIndex]);
    17151905      if(!strlen(lpstrTmp))
    17161906        break;
    17171907      iStrIndex += strlen(lpstrTmp) +1;
    17181908      /* Get the extension */
    1719       lpstrExtTmp = (&((LPBYTE)fodInfos->ofnInfos.lpstrFilter)[iStrIndex]);
     1909      lpstrExtTmp = (&((LPBYTE)fodInfos->ofnInfos->lpstrFilter)[iStrIndex]);
    17201910      if(!lpstrExtTmp)
    17211911          break;
     
    17381928
    17391929      /* set default filter index */
    1740       if(fodInfos->ofnInfos.nFilterIndex == 0 && fodInfos->ofnInfos.lpstrCustomFilter == NULL)
    1741         fodInfos->ofnInfos.nFilterIndex = 1;
     1930      if(fodInfos->ofnInfos->nFilterIndex == 0 && fodInfos->ofnInfos->lpstrCustomFilter == NULL)
     1931        fodInfos->ofnInfos->nFilterIndex = 1;
    17421932      /* First, check to make sure our index isn't out of bounds. */
    1743       if ( fodInfos->ofnInfos.nFilterIndex > iPos )
    1744         fodInfos->ofnInfos.nFilterIndex = iPos;
     1933      if ( fodInfos->ofnInfos->nFilterIndex > iPos )
     1934        fodInfos->ofnInfos->nFilterIndex = iPos;
    17451935
    17461936
    17471937      /* Get the current index selection. */
    17481938      CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB,
    1749                   fodInfos->ofnInfos.nFilterIndex-1);
     1939                  fodInfos->ofnInfos->nFilterIndex-1);
    17501940
    17511941      /* Get the corresponding text string from the combo box. */
    17521942      lpstrFilter = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
    1753                                              fodInfos->ofnInfos.nFilterIndex-1);
     1943                                             fodInfos->ofnInfos->nFilterIndex-1);
     1944
     1945      if ((INT)lpstrFilter == -1)
     1946        lpstrFilter = NULL;     // we get -1 if the control is empty
    17541947
    17551948    if(lpstrFilter)
     
    17741967  switch(wNotifyCode)
    17751968  {
    1776     case CBN_CLOSEUP:
     1969    case CBN_SELENDOK:
    17771970    {
    17781971      LPSTR lpstrFilter;
     
    17801973      /* Get the current item of the filetype combo box */
    17811974      int iItem = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);
     1975
     1976      /* set the current filter index - indexed from 1 */
     1977      fodInfos->ofnInfos->nFilterIndex = iItem + 1;
    17821978
    17831979      /* Set the current filter with the current selection */
     
    18702066  CBSetItemHeight(hwndCombo,0,GetSystemMetrics(SM_CYSMICON));
    18712067
     2068#ifndef SHELL_NO_DESKTOP
    18722069  /* Initialise data of Desktop folder */
    18732070  COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidlTmp);
    18742071  FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
    18752072  COMDLG32_SHFree(pidlTmp);
     2073#endif
    18762074
    18772075  COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DRIVES,&pidlDrives);
     
    19342132  int iIndentation;
    19352133  LPSFOLDER tmpFolder;
     2134  INT iIcon;
    19362135
    19372136  LookInInfos *liInfos = (LookInInfos *)GetPropA(pDIStruct->hwndItem,LookInInfosStr);
     
    19422141    return 0;
    19432142
    1944   if(!(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(pDIStruct->hwndItem,
     2143  if((LPSFOLDER)CB_ERR == (tmpFolder = (LPSFOLDER) CBGetItemDataPtr(pDIStruct->hwndItem,
    19452144                            pDIStruct->itemID)))
    19462145    return 0;
     
    19572156                                                  &sfi,
    19582157                                                  sizeof (SHFILEINFOA),
    1959                                                   SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_OPENICON | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME);
     2158                                                  SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME);
    19602159    len = strlen(sfi.szDisplayName)+1;
    19612160    tmpFolder->szDisplayName = MemAlloc(len);
     
    19632162    tmpFolder->iIcon = sfi.iIcon;
    19642163  }
     2164
     2165  if((pDIStruct->itemID == liInfos->uSelectedItem) || (pDIStruct->itemState & ODS_COMBOBOXEDIT))
     2166  {
     2167    if (!tmpFolder->iSelIcon)
     2168    {
     2169      SHFILEINFOA sfi2;
     2170
     2171      COMDLG32_SHGetFileInfoA((LPCSTR)tmpFolder->pidlItem,0,&sfi2,sizeof(SHFILEINFOA),
     2172                              SHGFI_PIDL | SHGFI_SMALLICON |
     2173                              SHGFI_OPENICON | SHGFI_SYSICONINDEX);
     2174      tmpFolder->iSelIcon = sfi2.iIcon;
     2175    }
     2176    iIcon = tmpFolder->iSelIcon;
     2177  } else iIcon = tmpFolder->iIcon;
     2178
    19652179
    19662180  /* Is this item selected ?*/
     
    20012215  /* Draw the icon from the image list */
    20022216  COMDLG32_ImageList_Draw(tmpFolder->ilItemImage,
    2003                  tmpFolder->iIcon,
     2217                 iIcon,
    20042218                 pDIStruct->hDC,
    20052219                 rectIcon.left,
     
    20292243  switch(wNotifyCode)
    20302244  {
    2031   case CBN_CLOSEUP:
     2245  case CBN_SELENDOK:
    20322246    {
    20332247      LPSFOLDER tmpFolder;
     
    20642278  LPITEMIDLIST pidlNext;
    20652279  SHFILEINFOA sfi;
    2066   SFOLDER *tmpFolder = MemAlloc(sizeof(SFOLDER));
     2280  SFOLDER *tmpFolder;
    20672281  LookInInfos *liInfos;
    20682282
    20692283  TRACE("\n");
     2284
     2285  if(!pidl)
     2286    return -1;
    20702287
    20712288  if(!(liInfos = (LookInInfos *)GetPropA(hwnd,LookInInfosStr)))
    20722289    return -1;
    20732290
     2291  tmpFolder = MemAlloc(sizeof(SFOLDER));
    20742292  tmpFolder->m_iIndent = 0;
    20752293  tmpFolder->szDisplayName = NULL;
    2076 
    2077   if(!pidl)
    2078     return -1;
    20792294
    20802295  /* Calculate the indentation of the item in the lookin*/
     
    20942309                  &sfi,
    20952310                  sizeof(sfi),
    2096                   SHGFI_ATTRIBUTES);
     2311                  SHGFI_PIDL | SHGFI_ATTRIBUTES);
    20972312
    20982313  if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM))
     
    21152330  }
    21162331
     2332  MemFree(tmpFolder);
    21172333  return -1;
    2118 
    21192334}
    21202335
     
    24332648    }
    24342649}
     2650
     2651/***********************************************************************
     2652 *      BrowseSelectedFolder
     2653 *
     2654 */
     2655static BOOL BrowseSelectedFolder(HWND hwnd)
     2656{
     2657  BOOL bBrowseSelFolder = FALSE;
     2658
     2659  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
     2660
     2661  if (GetNumSelected(fodInfos->Shell.FOIShellView) == 1)
     2662  {
     2663      LPITEMIDLIST pidlSelection;
     2664      ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
     2665
     2666      /* get the file selected */
     2667      EnumSelectedPidls( fodInfos->Shell.FOIShellView, 0, &pidlSelection );
     2668      IShellFolder_GetAttributesOf( fodInfos->Shell.FOIShellFolder, 1, &pidlSelection, &uAttr );
     2669      if ( uAttr & SFGAO_FOLDER )
     2670      {
     2671          if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser,
     2672                          pidlSelection, SBSP_RELATIVE ) ) )
     2673          {
     2674               MessageBoxA( hwnd, "Path does not exist", fodInfos->ofnInfos->lpstrTitle,
     2675                       MB_OK | MB_ICONEXCLAMATION );
     2676          }
     2677
     2678          bBrowseSelFolder = TRUE;
     2679      }
     2680      COMDLG32_SHFree( pidlSelection );
     2681  }
     2682
     2683  return bBrowseSelFolder;
     2684}
     2685
  • trunk/src/comdlg32/filedlgbrowser.c

    r3216 r3243  
     1/* $Id: filedlgbrowser.c,v 1.3 2000-03-26 16:31:42 cbratschi Exp $ */
    12/*
    23 *  Implementation of IShellBrowser for the File Open common dialog
    34 *
     5 * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch)
     6 * Project Odin Software License can be found in LICENSE.TXT
     7 *
     8 *  Corel WINE 20000324 level
    49 */
    510
     
    4146static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl =
    4247{
     48        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    4349        /* IUnknown */
    4450        IShellBrowserImpl_QueryInterface,
     
    6672static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl =
    6773{
     74        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    6875        /* IUnknown */
    6976        IShellBrowserImpl_ICommDlgBrowser_QueryInterface,
     
    327334        return NOERROR;
    328335    }
     336#ifdef SHELL_NO_DESKTOP
     337
     338    if(pidlTmp->mkid.cb == 0x00)
     339    {
     340        IShellFolder_Release(psfTmp);
     341                COMDLG32_SHFree(pidlTmp);
     342        return NOERROR;
     343    }
     344#endif
    329345
    330346    /* Release the current fodInfos->Shell.FOIShellFolder and update its value */
     
    339355    {
    340356        HWND hwndView;
     357        HWND hDlgWnd;
     358        BOOL bViewHasFocus;
     359
     360        /* Check if listview has focus */
     361        bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
     362
    341363        /* Get the foldersettings from the old view */
    342364        if(fodInfos->Shell.FOIShellView)
     
    383405            fodInfos->ShellInfos.hwndView = hwndView;
    384406
     407            /* changes the tab order of the ListView to reflect the window's File Dialog */
     408            hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN);
     409            SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
     410
     411            /* Since we destroyed the old view if it had focus set focus
     412               to the newly created view */
     413            if (bViewHasFocus)
     414                SetFocus(fodInfos->ShellInfos.hwndView);
     415
    385416            return NOERROR;
    386417        }
     
    662693        else
    663694        {
    664             hRes = FILEDLG95_OnOpen(This->hwndOwner);
     695            hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L);
    665696        }
    666697
     
    689720    {
    690721        case CDBOSC_SETFOCUS:
     722             /* FIXME: Reset the default button.
     723                This should be taken care of by defdlg. If control
     724                other than button receives focus the default button
     725                should be restored. */
     726             SendMessageA(This->hwndOwner, DM_SETDEFID, IDOK, 0);
    691727            break;
    692728        case CDBOSC_KILLFOCUS:
     
    754790HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv)
    755791{
    756     LPITEMIDLIST pidl;
     792    ULONG             uAttr;
    757793    FileOpenDlgInfos *fodInfos;
     794    UINT              nFiles = 0;                  /* Intial to zero */
     795    UINT              nCurrLength;
     796    UINT              nFileToOpen;
     797    UINT              nAllLength = 2;              /* Include intial '"' and final NULL */
     798    UINT              nSize = MAX_PATH;
     799    UINT              nFileSelected = 0;
     800    LPITEMIDLIST      pidlSelection;
     801    LPSTR             lpstrTemp = NULL;
     802    LPSTR             lpstrAllFile = NULL;
     803    char              lpstrCurrFile[MAX_PATH];
     804
    758805    _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface);
    759806
     
    761808    TRACE("(%p)\n", This);
    762809
    763     pidl = GetSelectedPidl(ppshv);
    764     if (pidl)
    765     {
    766         HRESULT hRes = E_FAIL;
    767         char lpstrFileName[MAX_PATH];
    768         ULONG  ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
    769 
    770         IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr);
    771         if (!ulAttr)
     810    /* Locate memory and Get selected item counter */
     811    if((lpstrAllFile = (LPSTR)SHAlloc(nSize * sizeof(char))) != NULL)
     812    {
     813        ZeroMemory(lpstrAllFile, nSize * sizeof(char));
     814        *lpstrAllFile =  '\"';
     815        lpstrTemp = lpstrAllFile + 1;
     816        nFileSelected = GetNumSelected(fodInfos->Shell.FOIShellView);     /* Get all selected counter */
     817    }
     818
     819    /* Count all selected files we have */
     820    for(nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++)
     821    {   /* get the file selected */
     822        pidlSelection = NULL;
     823        uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
     824        ZeroMemory(lpstrCurrFile, MAX_PATH * sizeof(char));
     825        EnumSelectedPidls(fodInfos->Shell.FOIShellView, nFileToOpen, &pidlSelection);
     826
     827        /* get the file name and attrib of the selected files*/
     828        GetName(fodInfos->Shell.FOIShellFolder, pidlSelection, SHGDN_NORMAL, lpstrCurrFile);
     829        IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidlSelection, &uAttr);
     830        COMDLG32_SHFree((LPVOID) pidlSelection);
     831
     832        if(!uAttr)
     833        {   /* Get the new file name */
     834            nCurrLength = lstrlenA(lpstrCurrFile);
     835            if(nAllLength + nCurrLength + 3 > nSize)
     836            {   /* increase the memory and transfer string to new location */
     837                nSize += MAX_PATH;
     838                if((lpstrTemp = (LPSTR)SHAlloc(nSize * sizeof(char))) != NULL)
     839                {   /* Transfer old file names */
     840                    ZeroMemory(lpstrTemp, nSize * sizeof(char));
     841                    lstrcpyA(lpstrTemp, lpstrAllFile);
     842                    SHFree(lpstrAllFile);
     843                    lpstrAllFile = lpstrTemp;
     844                    lpstrTemp = lpstrAllFile + nAllLength - 1;
     845                }
     846                else
     847                {   /* if failure, stop the loop to get filename */
     848                    nFileSelected = 0;
     849                }
     850            }
     851
     852            if(lpstrTemp != NULL)
     853            {   /* Add the new file name */
     854                nFiles++;
     855                lstrcpyA(lpstrTemp, lpstrCurrFile);
     856                *(lpstrTemp + nCurrLength) = '\"';
     857                *(lpstrTemp + nCurrLength + 1) = ' ';
     858                *(lpstrTemp + nCurrLength + 2) = '\"';
     859                nAllLength += nCurrLength + 3;
     860                lpstrTemp = lpstrAllFile + nAllLength - 1;
     861            }
     862        }
     863    }
     864
     865    if(lpstrAllFile)
     866    {
     867        if(nFiles > 1)
    772868        {
    773             if(SUCCEEDED(hRes = GetName(fodInfos->Shell.FOIShellFolder,pidl,SHGDN_NORMAL,lpstrFileName)))
    774                 SetWindowTextA(fodInfos->DlgInfos.hwndFileName,lpstrFileName);
    775             if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
    776                     SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
     869            *(lpstrTemp - 2) = '\0';
     870            SetWindowTextA(fodInfos->DlgInfos.hwndFileName, lpstrAllFile);
    777871        }
    778872        else
    779             SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Open");
     873        {
     874            *(lpstrTemp - 3) = '\0';
     875            SetWindowTextA(fodInfos->DlgInfos.hwndFileName, lpstrAllFile + 1);
     876        }
    780877
    781878        fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW;
    782 
    783         COMDLG32_SHFree((LPVOID)pidl);
    784879        SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE);
    785         return hRes;
    786     }
     880        SHFree( lpstrAllFile );
     881    }
     882    else
     883    {
     884        SetWindowTextA(fodInfos->DlgInfos.hwndFileName, "");
     885    }
     886
    787887    if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
    788         SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save");
     888        SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner, IDOK, "&Save");
     889    else
     890        SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner, IDOK, "&Open");
    789891
    790892    fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW;
    791     return E_FAIL;
     893
     894    return nFileSelected ? S_OK : E_FAIL;
    792895}
    793896
     
    841944}
    842945
    843 
    844 
    845 
    846 
     946/***********************************************************************
     947 *          EnumSelectedPidls
     948 *
     949 * Return the pidl(s) of the selected item(s) in the view.
     950 *
     951*/
     952BOOL EnumSelectedPidls( IShellView *ppshv,  /*[in]*/
     953                        UINT nPidlIndex,  /*[in]*/
     954                        LPITEMIDLIST *pidlSelected /*[out]*/ )
     955{
     956
     957    IDataObject *doSelected;
     958    BOOL retVal = TRUE;
     959
     960    /* Get an IDataObject from the view */
     961    if(SUCCEEDED(IShellView_GetItemObject(ppshv,
     962                                          SVGIO_SELECTION,
     963                                          &IID_IDataObject,
     964                                          (LPVOID *)&doSelected)))
     965    {
     966        STGMEDIUM medium;
     967        FORMATETC formatetc;
     968
     969        /* Set the FORMATETC structure*/
     970        SETDefFormatEtc(formatetc,
     971                        RegisterClipboardFormatA(CFSTR_SHELLIDLIST),
     972                        TYMED_HGLOBAL);
     973
     974        /* Get the pidls from IDataObject */
     975        if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
     976        {
     977            LPIDA cida = GlobalLock(medium.u.hGlobal);
     978            if(nPidlIndex < cida->cidl)
     979            {
     980                *pidlSelected = COMDLG32_PIDL_ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[nPidlIndex + 1]]));
     981            }
     982            else
     983            {
     984                retVal = FALSE;
     985            }
     986
     987            if(medium.pUnkForRelease)
     988            {
     989                IUnknown_Release(medium.pUnkForRelease);
     990            }
     991            else
     992            {
     993                GlobalUnlock(medium.u.hGlobal);
     994                GlobalFree(medium.u.hGlobal);
     995            }
     996        }
     997        IDataObject_Release(doSelected);
     998        return retVal;
     999    }
     1000    return FALSE;
     1001}
     1002
     1003/***********************************************************************
     1004 *          GetNumSelected
     1005 *
     1006 * Return the number of selected items in the view.
     1007 *
     1008*/
     1009UINT GetNumSelected( IShellView *ppshv )
     1010{
     1011    IDataObject *doSelected;
     1012    UINT retVal = 0;
     1013
     1014       /* Get an IDataObject from the view */
     1015    if(SUCCEEDED(IShellView_GetItemObject(ppshv,
     1016                                          SVGIO_SELECTION,
     1017                                          &IID_IDataObject,
     1018                                          (LPVOID *)&doSelected)))
     1019    {
     1020        STGMEDIUM medium;
     1021        FORMATETC formatetc;
     1022
     1023        /* Set the FORMATETC structure*/
     1024        SETDefFormatEtc(formatetc,
     1025                        RegisterClipboardFormatA(CFSTR_SHELLIDLIST),
     1026                        TYMED_HGLOBAL);
     1027
     1028        /* Get the pidls from IDataObject */
     1029        if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium)))
     1030        {
     1031            LPIDA cida = GlobalLock(medium.u.hGlobal);
     1032            retVal = cida->cidl;
     1033
     1034            if(medium.pUnkForRelease)
     1035                IUnknown_Release(medium.pUnkForRelease);
     1036            else
     1037            {
     1038                GlobalUnlock(medium.u.hGlobal);
     1039                GlobalFree(medium.u.hGlobal);
     1040            }
     1041        }
     1042        IDataObject_Release(doSelected);
     1043        return retVal;
     1044    }
     1045
     1046    return 0;
     1047}
     1048
     1049
     1050
  • trunk/src/comdlg32/filedlgbrowser.h

    r2607 r3243  
    11/*
    22 *  Implementation of IShellBrowser for the File Open common dialog
    3  *
    43 *
     4 *  Corel WINE 20000324 level
    55 */
    66
     
    2121
    2222#define FODPROP_SAVEDLG 0x0001  /* File dialog is a Save file dialog */
    23 #define FODPROP_USEVIEW 0x0002  /* Indicates the user selection must be taken 
    24                                    from the IShellView */
     23#define FODPROP_USEVIEW 0x0002  /* Indicates the user selection must be taken
     24                                   from the IShellView */
    2525
    2626/***********************************************************************
     
    4141typedef struct
    4242{
    43    
    44     OPENFILENAMEA ofnInfos;
     43
     44    LPOPENFILENAMEA ofnInfos;
    4545    struct {
    46         IShellBrowser *FOIShellBrowser; 
     46        IShellBrowser *FOIShellBrowser;
    4747        IShellFolder *FOIShellFolder;
    4848        IShellView *FOIShellView;
     
    6262        HWND hwndLookInCB;
    6363        HWND hwndFileName;
    64         HWND hwndTB;
     64        HWND hwndTB;
    6565        HWND hwndCustomDlg;
    66         DWORD dwDlgProp;
     66        DWORD dwDlgProp;
    6767    } DlgInfos;
    6868
     
    7272 * Control ID's
    7373 */
    74 #define IDS_ABOUTBOX                    101
    75 #define IDS_DOCUMENTFOLDERS             102
    76 #define IDS_PERSONAL                    103
    77 #define IDS_FAVORITES                   104
    78 #define IDS_PATH                        105
    79 #define IDS_DESKTOP                     106
    80 
    81 #define IDS_FONTS                       108
    82 #define IDS_MYCOMPUTER                  110
    83 #define IDS_SYSTEMFOLDERS               112
    84 #define IDS_LOCALHARDRIVES              113
    8574#define IDS_FILENOTFOUND                114
    8675#define IDS_VERIFYFILE                  115
     
    8978#define IDS_FILEOPEN_CAPTION            118
    9079
     80/* File Dialog Tooltips string IDs */
     81
     82#define IDS_UPFOLDER                    150
     83#define IDS_NEWFOLDER                   151
     84#define IDS_LISTVIEW                    152
     85#define IDS_REPORTVIEW                  153
     86
    9187#define IDC_OPENREADONLY                chx1
    9288
    93 #define IDC_TOOLBARSTATIC               stc1
     89#define IDC_TOOLBARSTATIC               stc1
    9490#define IDC_FILETYPESTATIC              stc2
    9591#define IDC_FILENAMESTATIC              stc3
     
    10399#define IDC_FILENAME                    edt1
    104100
    105 #define IDC_TOOLBAR                     ctl1
     101#define IDC_TOOLBAR                     ctl1
    106102
    107103/***********************************************************************
     
    113109/* IUnknown */
    114110HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
    115                                             REFIID riid, 
     111                                            REFIID riid,
    116112                                            LPVOID *ppvObj);
    117113
     
    121117
    122118/* IOleWindow */
    123 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 
     119HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface,
    124120                                           HWND * phwnd);
    125121
     
    129125/* IShellBrowser */
    130126
    131 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, 
    132                                           LPCITEMIDLIST pidl,   
     127HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
     128                                          LPCITEMIDLIST pidl,
    133129                                          UINT wFlags);
    134130
    135 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,   
     131HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,
    136132                                              BOOL fEnable);
    137                                              
    138 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,   
    139                                               UINT id,   
     133
     134HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,
     135                                              UINT id,
    140136                                              HWND *lphwnd);
    141137
    142138HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
    143                                                 DWORD grfMode,   
     139                                                DWORD grfMode,
    144140                                                LPSTREAM *ppStrm);
    145141
     
    150146HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
    151147                                                IShellView *ppshv);
    152                                              
     148
    153149
    154150HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
     
    158154                                           HMENU hmenuShared);
    159155
    160 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,   
    161                                             UINT id,   
    162                                             UINT uMsg,   
    163                                             WPARAM wParam,   
     156HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
     157                                            UINT id,
     158                                            UINT uMsg,
     159                                            WPARAM wParam,
    164160                                            LPARAM lParam,
    165161                                            LRESULT *pret);
    166162
    167163HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
    168                                        HMENU hmenuShared,   
     164                                       HMENU hmenuShared,
    169165                                       HOLEMENU holemenuReserved,
    170166                                       HWND hwndActiveObject);
     
    172168HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
    173169                                             LPCOLESTR lpszStatusText);
    174                                                
     170
    175171
    176172HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
    177                                              LPTBBUTTON lpButtons,   
    178                                              UINT nButtons,   
     173                                             LPTBBUTTON lpButtons,
     174                                             UINT nButtons,
    179175                                             UINT uFlags);
    180                                              
     176
    181177HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
    182                                                     LPMSG lpmsg,   
     178                                                    LPMSG lpmsg,
    183179                                                    WORD wID);
    184180
     
    187183
    188184HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(ICommDlgBrowser *iface,
    189                                             REFIID riid, 
     185                                            REFIID riid,
    190186                                            LPVOID *ppvObj);
    191187
     
    201197                                                               ULONG uChange);
    202198
    203 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, 
     199HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface,
    204200                                                               IShellView * ppshv,
    205201                                                               LPCITEMIDLIST pidl);
     
    208204
    209205LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
     206BOOL EnumSelectedPidls(IShellView *ppshv, UINT nPidlIndex, LPITEMIDLIST *pidlSelected);
     207UINT GetNumSelected(IShellView *ppshv);
    210208
    211209#endif /*SHBROWSER_H*/
  • trunk/src/comdlg32/filetitle.c

    r2607 r3243  
    44 * Copyright 1994 Martin Ayotte
    55 * Copyright 1996 Albrecht Kleine
     6 *
     7 * Corel WINE 20000324 level
    68 */
    79
     
    1315#include "debugtools.h"
    1416
    15 #include "heap.h"       /* Has to go */
     17#include "heap.h"       /* Has to go */
    1618
    1719DEFAULT_DEBUG_CHANNEL(commdlg)
     
    2426
    2527/***********************************************************************
    26  *      GetFileTitleA           (COMDLG32.8)
     28 *      GetFileTitleA           (COMDLG32.8)
    2729 *
    2830 */
    2931short WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf)
    3032{
    31         int i, len;
     33        int i, len;
    3234
    33         TRACE("(%p %p %d); \n", lpFile, lpTitle, cbBuf);
     35        TRACE("(%p %p %d); \n", lpFile, lpTitle, cbBuf);
    3436
    35         if(lpFile == NULL || (lpTitle == NULL && cbBuf != 0))
    36                 return -1;
     37        if(lpFile == NULL || (lpTitle == NULL))
     38                return -1;
    3739
    38         len = strlen(lpFile);
     40        len = strlen(lpFile);
    3941
    40         if (len == 0)
    41                 return -1;
     42        if (len == 0)
     43                return -1;
    4244
    43         if(strpbrk(lpFile, "*[]"))
    44                 return -1;
     45        if(strpbrk(lpFile, "*[]"))
     46                return -1;
    4547
    46         len--;
     48        len--;
    4749
    48         if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')
    49                 return -1;
     50        if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')
     51                return -1;
    5052
    51         for(i = len; i >= 0; i--)
    52         {
    53                 if (lpFile[i] == '/' ||  lpFile[i] == '\\' ||  lpFile[i] == ':')
    54                 {
    55                         i++;
    56                         break;
    57                 }
    58         }
     53        for(i = len; i >= 0; i--)
     54        {
     55                if (lpFile[i] == '/' ||  lpFile[i] == '\\' ||  lpFile[i] == ':')
     56                {
     57                        i++;
     58                        break;
     59                }
     60        }
    5961
    60         if(i == -1)
    61                 i++;
     62        if(i == -1)
     63                i++;
    6264
    63         TRACE("---> '%s' \n", &lpFile[i]);
    64    
    65         len = strlen(lpFile+i)+1;
    66         if(cbBuf < len)
    67                 return len;
     65        TRACE("---> '%s' \n", &lpFile[i]);
    6866
    69        /* The lpTitle buffer is big enough, perform a simple copy */
    70         strcpy(lpTitle, &lpFile[i]);
    71         return 0;
     67        len = strlen(lpFile+i)+1;
     68        if(cbBuf < len)
     69                return len;
     70
     71        strncpy(lpTitle,&lpFile[i],len);
     72        return 0;
    7273}
    7374
    7475
    7576/***********************************************************************
    76  *      GetFileTitleW           (COMDLG32.9)
     77 *      GetFileTitleW           (COMDLG32.9)
    7778 *
    7879 */
    7980short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, UINT cbBuf)
    8081{
    81         LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile);      /* Has to go */
    82         LPSTR title = HeapAlloc(GetProcessHeap(), 0, cbBuf);
    83         short   ret;
     82        LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile);      /* Has to go */
     83        LPSTR title = HeapAlloc(GetProcessHeap(), 0, cbBuf);
     84        short   ret;
    8485
    85         ret = GetFileTitleA(file, title, cbBuf);
     86        ret = GetFileTitleA(file, title, cbBuf);
    8687
    87         lstrcpynAtoW(lpTitle, title, cbBuf);
    88         HeapFree(GetProcessHeap(), 0, file);
    89         HeapFree(GetProcessHeap(), 0, title);
    90         return ret;
     88        lstrcpynAtoW(lpTitle, title, cbBuf);
     89        HeapFree(GetProcessHeap(), 0, file);
     90        HeapFree(GetProcessHeap(), 0, title);
     91        return ret;
    9192}
    9293
    9394
    9495/***********************************************************************
    95  *      GetFileTitle16          (COMMDLG.27)
     96 *      GetFileTitle16          (COMMDLG.27)
    9697 */
    9798short WINAPI GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf)
    9899{
    99         return GetFileTitleA(lpFile, lpTitle, cbBuf);
     100        return GetFileTitleA(lpFile, lpTitle, cbBuf);
    100101}
    101102
  • trunk/src/comdlg32/finddlg32.cpp

    r1557 r3243  
    1 /* $Id: finddlg32.cpp,v 1.2 1999-11-02 20:37:43 sandervl Exp $ */
     1/* $Id: finddlg32.cpp,v 1.3 2000-03-26 16:31:44 cbratschi Exp $ */
    22/*
    33 *  Common Dialog Boxes interface (32 bit) (990815)
     
    55 *
    66 * Copyright 1998,1999 Bertho A. Stultiens
     7 *
     8 * Corel WINE 20000324 level
    79 */
    810
     
    2426/*-----------------------------------------------------------------------*/
    2527
    26 static UINT             FindReplaceMessage;
    27 static UINT             HelpMessage;
    28 
    29 #define FR_MASK (FR_DOWN | FR_MATCHCASE | FR_WHOLEWORD | FR_REPLACEALL | FR_REPLACE | FR_FINDNEXT | FR_DIALOGTERM)
     28static UINT             FindReplaceMessage;
     29static UINT             HelpMessage;
     30
     31#define FR_MASK (FR_DOWN | FR_MATCHCASE | FR_WHOLEWORD | FR_REPLACEALL | FR_REPLACE | FR_FINDNEXT | FR_DIALOGTERM)
    3032/* CRITICAL_SECTION COMDLG32_CritSect; */
    3133
     
    4951
    5052/***********************************************************************
    51  *      COMDLG32_FR_GetFlags                    [internal]
     53 *      COMDLG32_FR_GetFlags                    [internal]
    5254 * Returns the button state that needs to be reported to the caller.
    53  *      RETURNS
    54  *              Current state of check and radio buttons
     55 *      RETURNS
     56 *              Current state of check and radio buttons
    5557 */
    5658static DWORD COMDLG32_FR_GetFlags(HWND hDlgWnd)
    5759{
    58         DWORD flags = 0;
    59         if(IsDlgButtonChecked(hDlgWnd, rad2) == BST_CHECKED)
    60                 flags |= FR_DOWN;
    61         if(IsDlgButtonChecked(hDlgWnd, chx1) == BST_CHECKED)
    62                 flags |= FR_WHOLEWORD;
    63         if(IsDlgButtonChecked(hDlgWnd, chx2) == BST_CHECKED)
    64                 flags |= FR_MATCHCASE;
     60        DWORD flags = 0;
     61        if(IsDlgButtonChecked(hDlgWnd, rad2) == BST_CHECKED)
     62                flags |= FR_DOWN;
     63        if(IsDlgButtonChecked(hDlgWnd, chx1) == BST_CHECKED)
     64                flags |= FR_WHOLEWORD;
     65        if(IsDlgButtonChecked(hDlgWnd, chx2) == BST_CHECKED)
     66                flags |= FR_MATCHCASE;
    6567        return flags;
    6668}
    6769
    6870/***********************************************************************
    69  *      COMDLG32_FR_HandleWMCommand             [internal]
     71 *      COMDLG32_FR_HandleWMCommand             [internal]
    7072 * Handle WM_COMMAND messages...
    7173 */
    7274static void COMDLG32_FR_HandleWMCommand(HWND hDlgWnd, COMDLG32_FR_Data *pData, int Id, int NotifyCode)
    7375{
    74         DWORD flag;
    75 
    76         pData->user_fr.fra->Flags &= ~FR_MASK;  /* Clear return flags */
    77         if(pData->fr.Flags & FR_WINE_REPLACE)   /* Replace always goes down... */
    78                 pData->user_fr.fra->Flags |= FR_DOWN;
    79 
    80         if(NotifyCode == BN_CLICKED)
    81         {
    82                 switch(Id)
    83                 {
    84                 case IDOK: /* Find Next */
    85                         if(GetDlgItemTextA(hDlgWnd, edt1, pData->fr.lpstrFindWhat, pData->fr.wFindWhatLen) > 0)
     76        DWORD flag;
     77
     78        pData->user_fr.fra->Flags &= ~FR_MASK;  /* Clear return flags */
     79        if(pData->fr.Flags & FR_WINE_REPLACE)   /* Replace always goes down... */
     80                pData->user_fr.fra->Flags |= FR_DOWN;
     81
     82        if(NotifyCode == BN_CLICKED)
     83        {
     84                switch(Id)
     85                {
     86                case IDOK: /* Find Next */
     87                        if(GetDlgItemTextA(hDlgWnd, edt1, pData->fr.lpstrFindWhat, pData->fr.wFindWhatLen) > 0)
    8688                        {
    87                                 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_FINDNEXT;
     89                                pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_FINDNEXT;
    8890                                if(pData->fr.Flags & FR_WINE_UNICODE)
    8991                                {
    90                                         lstrcpyAtoW(pData->user_fr.frw->lpstrFindWhat, pData->fr.lpstrFindWhat);
     92                                        lstrcpyAtoW(pData->user_fr.frw->lpstrFindWhat, pData->fr.lpstrFindWhat);
    9193                                }
    9294                                else
    9395                                {
    94                                         lstrcpyA(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat);
     96                                        lstrcpyA(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat);
    9597                                }
    96                                 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);
     98                                SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);
    9799                        }
    98                         break;
    99 
    100                 case IDCANCEL:
    101                         pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_DIALOGTERM;
    102                         SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);
    103                         DestroyWindow(hDlgWnd);
    104                         break;
     100                        break;
     101
     102                case IDCANCEL:
     103                        pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_DIALOGTERM;
     104                        SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);
     105                        DestroyWindow(hDlgWnd);
     106                        break;
    105107
    106108                case psh2: /* Replace All */
    107                         flag = FR_REPLACEALL;
     109                        flag = FR_REPLACEALL;
    108110                        goto Replace;
    109111
    110112                case psh1: /* Replace */
    111                         flag = FR_REPLACE;
     113                        flag = FR_REPLACE;
    112114Replace:
    113                         if((pData->fr.Flags & FR_WINE_REPLACE)
     115                        if((pData->fr.Flags & FR_WINE_REPLACE)
    114116                        && GetDlgItemTextA(hDlgWnd, edt1, pData->fr.lpstrFindWhat, pData->fr.wFindWhatLen) > 0)
    115117                        {
    116                                 pData->fr.lpstrReplaceWith[0] = 0; /* In case the next GetDlgItemText Fails */
    117                                 GetDlgItemTextA(hDlgWnd, edt2, pData->fr.lpstrReplaceWith, pData->fr.wReplaceWithLen);
    118                                 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | flag;
     118                                pData->fr.lpstrReplaceWith[0] = 0; /* In case the next GetDlgItemText Fails */
     119                                GetDlgItemTextA(hDlgWnd, edt2, pData->fr.lpstrReplaceWith, pData->fr.wReplaceWithLen);
     120                                pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | flag;
    119121                                if(pData->fr.Flags & FR_WINE_UNICODE)
    120122                                {
    121                                         lstrcpyAtoW(pData->user_fr.frw->lpstrFindWhat, pData->fr.lpstrFindWhat);
    122                                         lstrcpyAtoW(pData->user_fr.frw->lpstrReplaceWith, pData->fr.lpstrReplaceWith);
     123                                        lstrcpyAtoW(pData->user_fr.frw->lpstrFindWhat, pData->fr.lpstrFindWhat);
     124                                        lstrcpyAtoW(pData->user_fr.frw->lpstrReplaceWith, pData->fr.lpstrReplaceWith);
    123125                                }
    124126                                else
    125127                                {
    126                                         lstrcpyA(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat);
    127                                         lstrcpyA(pData->user_fr.fra->lpstrReplaceWith, pData->fr.lpstrReplaceWith);
     128                                        lstrcpyA(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat);
     129                                        lstrcpyA(pData->user_fr.fra->lpstrReplaceWith, pData->fr.lpstrReplaceWith);
    128130                                }
    129                                 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);
     131                                SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);
    130132                        }
    131                         break;
    132 
    133                 case pshHelp:
    134                         pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd);
    135                         SendMessageA(pData->fr.hwndOwner, HelpMessage, (WPARAM)hDlgWnd, (LPARAM)pData->user_fr.fra);
    136                         break;
     133                        break;
     134
     135                case pshHelp:
     136                        pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd);
     137                        SendMessageA(pData->fr.hwndOwner, HelpMessage, (WPARAM)hDlgWnd, (LPARAM)pData->user_fr.fra);
     138                        break;
    137139                }
    138140        }
    139141        else if(NotifyCode == EN_CHANGE && Id == edt1)
    140         {
    141                 BOOL enable = SendDlgItemMessageA(hDlgWnd, edt1, WM_GETTEXTLENGTH, 0, 0) > 0;
    142                 EnableWindow(GetDlgItem(hDlgWnd, IDOK), enable);
     142        {
     143                BOOL enable = SendDlgItemMessageA(hDlgWnd, edt1, WM_GETTEXTLENGTH, 0, 0) > 0;
     144                EnableWindow(GetDlgItem(hDlgWnd, IDOK), enable);
    143145                if(pData->fr.Flags & FR_WINE_REPLACE)
    144146                {
    145                         EnableWindow(GetDlgItem(hDlgWnd, psh1), enable);
    146                         EnableWindow(GetDlgItem(hDlgWnd, psh2), enable);
    147                 }
    148         }
    149 }
    150 
    151 /***********************************************************************
    152  *      COMDLG32_FindReplaceDlgProc             [internal]
     147                        EnableWindow(GetDlgItem(hDlgWnd, psh1), enable);
     148                        EnableWindow(GetDlgItem(hDlgWnd, psh2), enable);
     149                }
     150        }
     151}
     152
     153/***********************************************************************
     154 *      COMDLG32_FindReplaceDlgProc             [internal]
    153155 * [Find/Replace]Text32[A/W] window procedure.
    154156 */
    155157static BOOL CALLBACK COMDLG32_FindReplaceDlgProc(HWND hDlgWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
    156158{
    157         COMDLG32_FR_Data *pdata = (COMDLG32_FR_Data *)GetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom);
    158         BOOL retval = TRUE;;
    159 
    160         if(iMsg == WM_INITDIALOG)
     159        COMDLG32_FR_Data *pdata = (COMDLG32_FR_Data *)GetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom);
     160        BOOL retval = TRUE;;
     161
     162        if(iMsg == WM_INITDIALOG)
    161163        {
    162164                pdata = (COMDLG32_FR_Data *)lParam;
    163                 if(!SetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom, (HANDLE)pdata))
    164                 {
    165                         ERR("Could not Set prop; invent a gracefull exit?...\n");
    166                         DestroyWindow(hDlgWnd);
     165                if(!SetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom, (HANDLE)pdata))
     166                {
     167                        ERR("Could not Set prop; invent a gracefull exit?...\n");
     168                        DestroyWindow(hDlgWnd);
    167169                        return FALSE;
    168170                }
    169                 SendDlgItemMessageA(hDlgWnd, edt1, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wFindWhatLen, 0);
    170                 SendDlgItemMessageA(hDlgWnd, edt1, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrFindWhat);
     171                SendDlgItemMessageA(hDlgWnd, edt1, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wFindWhatLen, 0);
     172                SendDlgItemMessageA(hDlgWnd, edt1, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrFindWhat);
    171173                if(pdata->fr.Flags & FR_WINE_REPLACE)
    172174                {
    173                         SendDlgItemMessageA(hDlgWnd, edt2, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wReplaceWithLen, 0);
    174                         SendDlgItemMessageA(hDlgWnd, edt2, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrReplaceWith);
    175                 }
    176 
    177                 if(!(pdata->fr.Flags & FR_SHOWHELP))
    178                         ShowWindow(GetDlgItem(hDlgWnd, pshHelp), SW_HIDE);
    179                 if(pdata->fr.Flags & FR_HIDEUPDOWN)
    180                 {
    181                         ShowWindow(GetDlgItem(hDlgWnd, rad1), SW_HIDE);
    182                         ShowWindow(GetDlgItem(hDlgWnd, rad2), SW_HIDE);
    183                         ShowWindow(GetDlgItem(hDlgWnd, grp1), SW_HIDE);
    184                 }
    185                 else if(pdata->fr.Flags & FR_NOUPDOWN)
    186                 {
    187                         EnableWindow(GetDlgItem(hDlgWnd, rad1), FALSE);
    188                         EnableWindow(GetDlgItem(hDlgWnd, rad2), FALSE);
    189                         EnableWindow(GetDlgItem(hDlgWnd, grp1), FALSE);
    190                 }
     175                        SendDlgItemMessageA(hDlgWnd, edt2, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wReplaceWithLen, 0);
     176                        SendDlgItemMessageA(hDlgWnd, edt2, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrReplaceWith);
     177                }
     178
     179                if(!(pdata->fr.Flags & FR_SHOWHELP))
     180                        ShowWindow(GetDlgItem(hDlgWnd, pshHelp), SW_HIDE);
     181                if(pdata->fr.Flags & FR_HIDEUPDOWN)
     182                {
     183                        ShowWindow(GetDlgItem(hDlgWnd, rad1), SW_HIDE);
     184                        ShowWindow(GetDlgItem(hDlgWnd, rad2), SW_HIDE);
     185                        ShowWindow(GetDlgItem(hDlgWnd, grp1), SW_HIDE);
     186                }
     187                else if(pdata->fr.Flags & FR_NOUPDOWN)
     188                {
     189                        EnableWindow(GetDlgItem(hDlgWnd, rad1), FALSE);
     190                        EnableWindow(GetDlgItem(hDlgWnd, rad2), FALSE);
     191                        EnableWindow(GetDlgItem(hDlgWnd, grp1), FALSE);
     192                }
    191193                else
    192194                {
    193                         SendDlgItemMessageA(hDlgWnd, rad1, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? 0 : BST_CHECKED, 0);
    194                         SendDlgItemMessageA(hDlgWnd, rad2, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? BST_CHECKED : 0, 0);
    195                 }
    196 
    197                 if(pdata->fr.Flags & FR_HIDEMATCHCASE)
    198                         ShowWindow(GetDlgItem(hDlgWnd, chx2), SW_HIDE);
    199                 else if(pdata->fr.Flags & FR_NOMATCHCASE)
    200                         EnableWindow(GetDlgItem(hDlgWnd, chx2), FALSE);
     195                        SendDlgItemMessageA(hDlgWnd, rad1, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? 0 : BST_CHECKED, 0);
     196                        SendDlgItemMessageA(hDlgWnd, rad2, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? BST_CHECKED : 0, 0);
     197                }
     198
     199                if(pdata->fr.Flags & FR_HIDEMATCHCASE)
     200                        ShowWindow(GetDlgItem(hDlgWnd, chx2), SW_HIDE);
     201                else if(pdata->fr.Flags & FR_NOMATCHCASE)
     202                        EnableWindow(GetDlgItem(hDlgWnd, chx2), FALSE);
    201203                else
    202                         SendDlgItemMessageA(hDlgWnd, chx2, BM_SETCHECK, pdata->fr.Flags & FR_MATCHCASE ? BST_CHECKED : 0, 0);
    203 
    204                 if(pdata->fr.Flags & FR_HIDEWHOLEWORD)
    205                         ShowWindow(GetDlgItem(hDlgWnd, chx1), SW_HIDE);
    206                 else if(pdata->fr.Flags & FR_NOWHOLEWORD)
    207                         EnableWindow(GetDlgItem(hDlgWnd, chx1), FALSE);
     204                        SendDlgItemMessageA(hDlgWnd, chx2, BM_SETCHECK, pdata->fr.Flags & FR_MATCHCASE ? BST_CHECKED : 0, 0);
     205
     206                if(pdata->fr.Flags & FR_HIDEWHOLEWORD)
     207                        ShowWindow(GetDlgItem(hDlgWnd, chx1), SW_HIDE);
     208                else if(pdata->fr.Flags & FR_NOWHOLEWORD)
     209                        EnableWindow(GetDlgItem(hDlgWnd, chx1), FALSE);
    208210                else
    209                         SendDlgItemMessageA(hDlgWnd, chx1, BM_SETCHECK, pdata->fr.Flags & FR_WHOLEWORD ? BST_CHECKED : 0, 0);
    210 
    211                 /* We did the init here, now call the hook if requested */
     211                        SendDlgItemMessageA(hDlgWnd, chx1, BM_SETCHECK, pdata->fr.Flags & FR_WHOLEWORD ? BST_CHECKED : 0, 0);
     212
     213                /* We did the init here, now call the hook if requested */
    212214#ifdef __WIN32OS2__
    213                 //SvL: If hooked and hook returns TRUE, then show dialog
    214                 //     -> if not hooked, just display it!
    215                 if(!(pdata->fr.Flags & FR_ENABLEHOOK) ||
    216                      pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, pdata->fr.lCustData))
     215                //SvL: If hooked and hook returns TRUE, then show dialog
     216                //     -> if not hooked, just display it!
     217                if(!(pdata->fr.Flags & FR_ENABLEHOOK) ||
     218                     pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, pdata->fr.lCustData))
    217219#else
    218                 if((pdata->fr.Flags & FR_ENABLEHOOK)
    219                      && pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, pdata->fr.lCustData))
     220                if((pdata->fr.Flags & FR_ENABLEHOOK)
     221                     && pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, pdata->fr.lCustData))
    220222#endif
    221                 {
    222                         ShowWindow(hDlgWnd, SW_SHOWNORMAL);
    223                         UpdateWindow(hDlgWnd);
    224                 }
    225                 /* else the caller is responsible for showing */
     223                {
     224                        ShowWindow(hDlgWnd, SW_SHOWNORMAL);
     225                        UpdateWindow(hDlgWnd);
     226                }
     227                /* else the caller is responsible for showing */
    226228                return TRUE;
    227229        }
    228230
    229         if(pdata && (pdata->fr.Flags & FR_ENABLEHOOK))
    230         {
    231                 retval = pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, lParam);
    232         }
    233         else
    234                 retval = FALSE;
    235 
    236         if(pdata && !retval)
    237         {
    238                 retval = TRUE;
    239                 switch(iMsg)
    240                 {
    241                 case WM_COMMAND:
    242                         COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, LOWORD(wParam), HIWORD(wParam));
    243                         break;
    244 
    245                 case WM_CLOSE:
    246                         COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, IDCANCEL, BN_CLICKED);
    247                         break;
    248 
    249                 case WM_HELP:
    250                         /* Heeeeelp! */
    251                         FIXME("Got WM_HELP. Who is gonna supply it?\n");
    252                         break;
    253 
    254                 case WM_CONTEXTMENU:
    255                         /* Heeeeelp! */
    256                         FIXME("Got WM_CONTEXTMENU. Who is gonna supply it?\n");
    257                         break;
    258                 /* FIXME: Handle F1 help */
    259 
    260                 default:
    261                         retval = FALSE; /* We did not handle the message */
    262                 }
     231        if(pdata && (pdata->fr.Flags & FR_ENABLEHOOK))
     232        {
     233                retval = pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, lParam);
     234        }
     235        else
     236                retval = FALSE;
     237
     238        if(pdata && !retval)
     239        {
     240                retval = TRUE;
     241                switch(iMsg)
     242                {
     243                case WM_COMMAND:
     244                        COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, LOWORD(wParam), HIWORD(wParam));
     245                        break;
     246
     247                case WM_CLOSE:
     248                        COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, IDCANCEL, BN_CLICKED);
     249                        break;
     250
     251                case WM_HELP:
     252                        /* Heeeeelp! */
     253                        FIXME("Got WM_HELP. Who is gonna supply it?\n");
     254                        break;
     255
     256                case WM_CONTEXTMENU:
     257                        /* Heeeeelp! */
     258                        FIXME("Got WM_CONTEXTMENU. Who is gonna supply it?\n");
     259                        break;
     260                /* FIXME: Handle F1 help */
     261
     262                default:
     263                        retval = FALSE; /* We did not handle the message */
     264                }
    263265        }
    264266
     
    269271        if(iMsg == WM_DESTROY)
    270272        {
    271                 RemovePropA(hDlgWnd, (LPSTR)COMDLG32_Atom);
    272                 HeapFree(GetProcessHeap(), 0, pdata);
     273                RemovePropA(hDlgWnd, (LPSTR)COMDLG32_Atom);
     274                HeapFree(GetProcessHeap(), 0, pdata);
    273275        }
    274276
     
    277279
    278280/***********************************************************************
    279  *      COMDLG32_FR_CheckPartial                [internal]
     281 *      COMDLG32_FR_CheckPartial                [internal]
    280282 * Check various fault conditions in the supplied parameters that
    281283 * cause an extended error to be reported.
    282  *      RETURNS
    283  *              TRUE: Succes
    284  *              FALSE: Failure
     284 *      RETURNS
     285 *              TRUE: Succes
     286 *              FALSE: Failure
    285287 */
    286288static BOOL COMDLG32_FR_CheckPartial(
    287         LPFINDREPLACEA pfr,     /* [in] Find structure */
    288         BOOL Replace            /* [in] True if called as replace */
     289        LPFINDREPLACEA pfr,     /* [in] Find structure */
     290        BOOL Replace            /* [in] True if called as replace */
    289291) {
    290         if(!pfr)
    291         {
    292                 COMDLG32_SetCommDlgExtendedError(CDERR_GENERALCODES);
    293                 return FALSE;
    294         }
     292        if(!pfr)
     293        {
     294                COMDLG32_SetCommDlgExtendedError(CDERR_GENERALCODES);
     295                return FALSE;
     296        }
    295297
    296298        if(pfr->lStructSize != sizeof(FINDREPLACEA))
    297299        {
    298                 COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE);
    299                 return FALSE;
     300                COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE);
     301                return FALSE;
    300302        }
    301303
    302304        if(!IsWindow(pfr->hwndOwner))
    303305        {
    304                 COMDLG32_SetCommDlgExtendedError(CDERR_DIALOGFAILURE);
    305                 return FALSE;
     306                COMDLG32_SetCommDlgExtendedError(CDERR_DIALOGFAILURE);
     307                return FALSE;
    306308        }
    307309
    308310#ifdef __WIN32OS2__
    309         //SvL: Notepad set this to 32
    310         if((!pfr->lpstrFindWhat)
     311        //SvL: Notepad set this to 32
     312        if((!pfr->lpstrFindWhat)
    311313#else
    312         if((pfr->wFindWhatLen < 80 || !pfr->lpstrFindWhat)
     314        if((pfr->wFindWhatLen < 80 || !pfr->lpstrFindWhat)
    313315#endif
    314316           ||(Replace && (pfr->wReplaceWithLen < 80 || !pfr->lpstrReplaceWith)))
    315317        {
    316                 COMDLG32_SetCommDlgExtendedError(FRERR_BUFFERLENGTHZERO);
    317                 return FALSE;
    318         }
    319 
    320         if((FindReplaceMessage = RegisterWindowMessageA(FINDMSGSTRING)) == 0)
    321         {
    322                 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);
    323                 return FALSE;
    324         }
    325         if((HelpMessage = RegisterWindowMessageA(HELPMSGSTRING)) == 0)
    326         {
    327                 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);
     318                COMDLG32_SetCommDlgExtendedError(FRERR_BUFFERLENGTHZERO);
     319                return FALSE;
     320        }
     321
     322        if((FindReplaceMessage = RegisterWindowMessageA(FINDMSGSTRING)) == 0)
     323        {
     324                COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);
     325                return FALSE;
     326        }
     327        if((HelpMessage = RegisterWindowMessageA(HELPMSGSTRING)) == 0)
     328        {
     329                COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);
    328330                return FALSE;
    329331        }
     
    331333        if((pfr->Flags & FR_ENABLEHOOK) && !pfr->lpfnHook)
    332334        {
    333                 COMDLG32_SetCommDlgExtendedError(CDERR_NOHOOK);
     335                COMDLG32_SetCommDlgExtendedError(CDERR_NOHOOK);
    334336                return FALSE;
    335337        }
     
    337339        if((pfr->Flags & (FR_ENABLETEMPLATE | FR_ENABLETEMPLATEHANDLE)) && !pfr->hInstance)
    338340        {
    339                 COMDLG32_SetCommDlgExtendedError(CDERR_NOHINSTANCE);
     341                COMDLG32_SetCommDlgExtendedError(CDERR_NOHINSTANCE);
    340342                return FALSE;
    341343        }
     
    343345        if((pfr->Flags & FR_ENABLETEMPLATE) && !pfr->lpTemplateName)
    344346        {
    345                 COMDLG32_SetCommDlgExtendedError(CDERR_NOTEMPLATE);
    346                 return FALSE;
    347         }
    348 
    349         return TRUE;
    350 }
    351 
    352 /***********************************************************************
    353  *      COMDLG32_FR_DoFindReplace               [internal]
     347                COMDLG32_SetCommDlgExtendedError(CDERR_NOTEMPLATE);
     348                return FALSE;
     349        }
     350
     351        return TRUE;
     352}
     353
     354/***********************************************************************
     355 *      COMDLG32_FR_DoFindReplace               [internal]
    354356 * Actual load and creation of the Find/Replace dialog.
    355  *      RETURNS
    356  *              Window handle to created dialog:Succes
    357  *              NULL:Failure
     357 *      RETURNS
     358 *              Window handle to created dialog:Succes
     359 *              NULL:Failure
    358360 */
    359361static HWND COMDLG32_FR_DoFindReplace(
    360         COMDLG32_FR_Data *pdata /* [in] Internal data structure */
     362        COMDLG32_FR_Data *pdata /* [in] Internal data structure */
    361363) {
    362         HWND hdlgwnd = 0;
     364        HWND hdlgwnd = 0;
    363365        HGLOBAL loadrc;
    364366        DWORD error;
    365367        LPDLGTEMPLATEW rcs;
    366368
    367         TRACE("hInst=%08x, Flags=%08lx\n", pdata->fr.hInstance, pdata->fr.Flags);
     369        TRACE("hInst=%08x, Flags=%08lx\n", pdata->fr.hInstance, pdata->fr.Flags);
    368370
    369371        if(!(pdata->fr.Flags & FR_ENABLETEMPLATEHANDLE))
    370372        {
    371                 HMODULE hmod = COMDLG32_hInstance;
    372                 HRSRC htemplate;
    373                 if(pdata->fr.Flags & FR_ENABLETEMPLATE)
    374                 {
    375                         hmod = (HMODULE)pdata->fr.hInstance;
     373                HMODULE hmod = COMDLG32_hInstance;
     374                HRSRC htemplate;
     375                if(pdata->fr.Flags & FR_ENABLETEMPLATE)
     376                {
     377                        hmod = (HMODULE)pdata->fr.hInstance;
    376378                        if(pdata->fr.Flags & FR_WINE_UNICODE)
    377379                        {
    378                                 htemplate = FindResourceW(hmod, (LPWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOGA);
     380                                htemplate = FindResourceW(hmod, (LPWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOGA);
    379381                        }
    380382                        else
    381383                        {
    382                                 htemplate = FindResourceA(hmod, pdata->fr.lpTemplateName, (LPCSTR)RT_DIALOGA);
     384                                htemplate = FindResourceA(hmod, pdata->fr.lpTemplateName, (LPCSTR)RT_DIALOGA);
    383385                        }
    384                 }
    385                 else
    386                 {
    387                         int rcid = pdata->fr.Flags & FR_WINE_REPLACE ? REPLACEDLGORD
    388                                                                      : FINDDLGORD;
    389                         htemplate = FindResourceA(hmod, MAKEINTRESOURCEA(rcid), (LPCSTR)RT_DIALOGA);
    390                 }
    391                 if(!htemplate)
    392                 {
    393                         error = CDERR_FINDRESFAILURE;
    394                         goto cleanup;
    395                 }
    396 
    397                 loadrc = LoadResource(hmod, htemplate);
     386                }
     387                else
     388                {
     389                        int rcid = pdata->fr.Flags & FR_WINE_REPLACE ? REPLACEDLGORD
     390                                                                     : FINDDLGORD;
     391                        htemplate = FindResourceA(hmod, MAKEINTRESOURCEA(rcid), (LPCSTR)RT_DIALOGA);
     392                }
     393                if(!htemplate)
     394                {
     395                        error = CDERR_FINDRESFAILURE;
     396                        goto cleanup;
     397                }
     398
     399                loadrc = LoadResource(hmod, htemplate);
    398400        }
    399401        else
    400402        {
    401                 loadrc = (HGLOBAL)pdata->fr.hInstance;
     403                loadrc = (HGLOBAL)pdata->fr.hInstance;
    402404        }
    403405
    404406        if(!loadrc)
    405407        {
    406                 error = CDERR_LOADRESFAILURE;
    407                 goto cleanup;
    408         }
     408                error = CDERR_LOADRESFAILURE;
     409                goto cleanup;
     410        }
    409411
    410412        if((rcs = (LPDLGTEMPLATEW)LockResource(loadrc)) == NULL)
    411413        {
    412                 error = CDERR_LOCKRESFAILURE;
    413                 goto cleanup;
     414                error = CDERR_LOCKRESFAILURE;
     415                goto cleanup;
    414416        }
    415417
    416418        hdlgwnd = CreateDialogIndirectParamA(COMDLG32_hInstance,
    417                                              rcs,
     419                                             rcs,
    418420                                             pdata->fr.hwndOwner,
    419421                                             (DLGPROC)COMDLG32_FindReplaceDlgProc,
    420422                                             (LPARAM)pdata);
    421         if(!hdlgwnd)
    422         {
    423                 error = CDERR_DIALOGFAILURE;
     423        if(!hdlgwnd)
     424        {
     425                error = CDERR_DIALOGFAILURE;
    424426cleanup:
    425                 COMDLG32_SetCommDlgExtendedError(error);
     427                COMDLG32_SetCommDlgExtendedError(error);
    426428                HeapFree(GetProcessHeap(), 0, pdata);
    427429        }
     
    430432
    431433/***********************************************************************
    432  *      FindText32A                             [COMDLG32.6]
    433  *      RETURNS
    434  *              Window handle to created dialog: Succes
    435  *              NULL: Failure
     434 *      FindText32A                             [COMDLG32.6]
     435 *      RETURNS
     436 *              Window handle to created dialog: Succes
     437 *              NULL: Failure
    436438 */
    437439HWND WINAPI FindTextA(
    438         LPFINDREPLACEA pfr      /* [in] Find/replace structure*/
     440        LPFINDREPLACEA pfr      /* [in] Find/replace structure*/
    439441) {
    440         COMDLG32_FR_Data *pdata;
     442        COMDLG32_FR_Data *pdata;
    441443
    442444        dprintf(("FindTextA: LPFINDREPLACE=%p\n", pfr));
    443445
    444         if(!COMDLG32_FR_CheckPartial(pfr, FALSE))
    445                 return 0;
    446 
    447         if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL)
    448                 return 0; /* Error has been set */
     446        if(!COMDLG32_FR_CheckPartial(pfr, FALSE))
     447                return 0;
     448
     449        if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL)
     450                return 0; /* Error has been set */
    449451
    450452        pdata->user_fr.fra = pfr;
    451453        pdata->fr = *pfr;
    452         return COMDLG32_FR_DoFindReplace(pdata);
    453 }
    454 
    455 /***********************************************************************
    456  *      ReplaceText32A                          [COMDLG32.19]
    457  *      RETURNS
    458  *              Window handle to created dialog: Succes
    459  *              NULL: Failure
     454        return COMDLG32_FR_DoFindReplace(pdata);
     455}
     456
     457/***********************************************************************
     458 *      ReplaceText32A                          [COMDLG32.19]
     459 *      RETURNS
     460 *              Window handle to created dialog: Succes
     461 *              NULL: Failure
    460462 */
    461463HWND WINAPI ReplaceTextA(
    462         LPFINDREPLACEA pfr      /* [in] Find/replace structure*/
     464        LPFINDREPLACEA pfr      /* [in] Find/replace structure*/
    463465) {
    464         COMDLG32_FR_Data *pdata;
     466        COMDLG32_FR_Data *pdata;
    465467
    466468        dprintf(("ReplaceTextA: LPFINDREPLACE=%p\n", pfr));
    467469
    468         if(!COMDLG32_FR_CheckPartial(pfr, TRUE))
    469                 return 0;
    470 
    471         if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL)
    472                 return 0; /* Error has been set */
     470        if(!COMDLG32_FR_CheckPartial(pfr, TRUE))
     471                return 0;
     472
     473        if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL)
     474                return 0; /* Error has been set */
    473475
    474476        pdata->user_fr.fra = pfr;
    475477        pdata->fr = *pfr;
    476         pdata->fr.Flags |= FR_WINE_REPLACE;
    477         return COMDLG32_FR_DoFindReplace(pdata);
    478 }
    479 
    480 /***********************************************************************
    481  *      FinfText32W                             [COMDLG32.7]
    482  *      RETURNS
    483  *              Window handle to created dialog: Succes
    484  *              NULL: Failure
     478        pdata->fr.Flags |= FR_WINE_REPLACE;
     479        return COMDLG32_FR_DoFindReplace(pdata);
     480}
     481
     482/***********************************************************************
     483 *      FinfText32W                             [COMDLG32.7]
     484 *      RETURNS
     485 *              Window handle to created dialog: Succes
     486 *              NULL: Failure
    485487 */
    486488HWND WINAPI FindTextW(
    487         LPFINDREPLACEW pfr      /* [in] Find/replace structure*/
     489        LPFINDREPLACEW pfr      /* [in] Find/replace structure*/
    488490) {
    489         COMDLG32_FR_Data *pdata;
     491        COMDLG32_FR_Data *pdata;
    490492
    491493        dprintf(("FindTextW: LPFINDREPLACE=%p\n", pfr));
    492494
    493         if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE))
    494                 return 0;
    495 
    496         if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data)
    497                                                            + pfr->wFindWhatLen)) == NULL)
    498                 return 0; /* Error has been set */
     495        if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE))
     496                return 0;
     497
     498        if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data)
     499                                                           + pfr->wFindWhatLen)) == NULL)
     500                return 0; /* Error has been set */
    499501
    500502        pdata->user_fr.frw = pfr;
    501         pdata->fr = *(LPFINDREPLACEA)pfr;       /* FINDREPLACEx have same size */
    502         pdata->fr.Flags |= FR_WINE_UNICODE;
    503         pdata->fr.lpstrFindWhat = (LPSTR)(((LPFINDREPLACEA)(pdata+1))+1);       /* Set string pointer */
     503        pdata->fr = *(LPFINDREPLACEA)pfr;       /* FINDREPLACEx have same size */
     504        pdata->fr.Flags |= FR_WINE_UNICODE;
     505        pdata->fr.lpstrFindWhat = (LPSTR)(((LPFINDREPLACEA)(pdata+1))+1);       /* Set string pointer */
    504506        lstrcpynWtoA(pdata->fr.lpstrFindWhat, pfr->lpstrFindWhat, pfr->wFindWhatLen);
    505507        return COMDLG32_FR_DoFindReplace(pdata);
     
    507509
    508510/***********************************************************************
    509  *      ReplaceTextW                            [COMDLG32.20]
    510  *      RETURNS
    511  *              Window handle to created dialog: Succes
    512  *              NULL: Failure
     511 *      ReplaceTextW                            [COMDLG32.20]
     512 *      RETURNS
     513 *              Window handle to created dialog: Succes
     514 *              NULL: Failure
    513515 */
    514516HWND WINAPI ReplaceTextW(
    515         LPFINDREPLACEW pfr      /* [in] Find/replace structure*/
     517        LPFINDREPLACEW pfr      /* [in] Find/replace structure*/
    516518) {
    517         COMDLG32_FR_Data *pdata;
     519        COMDLG32_FR_Data *pdata;
    518520
    519521        dprintf(("ReplaceTextW: LPFINDREPLACE=%p\n", pfr));
    520522
    521         if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE))
    522                 return 0;
    523 
    524         if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data)
    525                                                            + pfr->wFindWhatLen
    526                                                            + pfr->wReplaceWithLen)) == NULL)
    527 
    528                 return 0; /* Error has been set */
     523        if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE))
     524                return 0;
     525
     526        if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data)
     527                                                           + pfr->wFindWhatLen
     528                                                           + pfr->wReplaceWithLen)) == NULL)
     529
     530                return 0; /* Error has been set */
    529531
    530532        pdata->user_fr.frw = pfr;
    531         pdata->fr = *(LPFINDREPLACEA)pfr;       /* FINDREPLACEx have same size */
    532         pdata->fr.Flags |= FR_WINE_REPLACE | FR_WINE_UNICODE;
    533         pdata->fr.lpstrFindWhat = (LPSTR)(((LPFINDREPLACEA)(pdata+1))+1);       /* Set string pointers */
     533        pdata->fr = *(LPFINDREPLACEA)pfr;       /* FINDREPLACEx have same size */
     534        pdata->fr.Flags |= FR_WINE_REPLACE | FR_WINE_UNICODE;
     535        pdata->fr.lpstrFindWhat = (LPSTR)(((LPFINDREPLACEA)(pdata+1))+1);       /* Set string pointers */
    534536        pdata->fr.lpstrReplaceWith = (LPSTR)(((LPFINDREPLACEA)(pdata+1))+1) + pfr->wFindWhatLen;
    535537        lstrcpynWtoA(pdata->fr.lpstrFindWhat, pfr->lpstrFindWhat, pfr->wFindWhatLen);
  • trunk/src/comdlg32/rsrc.orc

    r3033 r3243  
    1 /* $Id: rsrc.orc,v 1.2 2000-03-06 23:48:25 bird Exp $ */
     1/* $Id: rsrc.orc,v 1.3 2000-03-26 16:31:45 cbratschi Exp $ */
    22/*
    33 * Top level resource file for Common Dialogs
     
    2626 * get localized bitmaps for example.
    2727 */
    28 //#include "cdlg_Ca.orc"
    29 //#include "cdlg_Cs.orc"
    30 //#include "cdlg_Da.orc"
    31 //#include "cdlg_De.orc"
     28
     29/* TODO TODO FIXME
     30 * The localized resources have be pulled out due to
     31 * the time required to move some strings from here to
     32 * shell32.dll.  This is something to deal with
     33 * after release
     34 */
     35#if 0
     36#include "cdlg_Ca.orc"
     37#include "cdlg_Cs.orc"
     38#include "cdlg_Da.orc"
     39#include "cdlg_De.orc"
     40#endif
    3241#include "cdlg_En.orc"
    33 //#include "cdlg_Eo.orc"
    34 //#include "cdlg_Es.orc"
    35 //#include "cdlg_Fi.orc"
    36 //#include "cdlg_Fr.orc"
    37 //#include "cdlg_Hu.orc"
    38 //#include "cdlg_It.orc"
    39 //#include "cdlg_Ko.orc"
    40 //#include "cdlg_Nl.orc"
    41 //#include "cdlg_No.orc"
    42 //#include "cdlg_Pl.orc"
    43 //#include "cdlg_Pt.orc"
    44 //#include "cdlg_Ru.orc"
    45 //#include "cdlg_Sv.orc"
    46 //#include "cdlg_Wa.orc"
     42#if 0
     43#include "cdlg_Eo.orc"
     44#include "cdlg_Es.orc"
     45#include "cdlg_Fi.orc"
     46#include "cdlg_Fr.orc"
     47#include "cdlg_Hu.orc"
     48#include "cdlg_It.orc"
     49#include "cdlg_Ko.orc"
     50#include "cdlg_Nl.orc"
     51#include "cdlg_No.orc"
     52#include "cdlg_Pl.orc"
     53#include "cdlg_Pt.orc"
     54#include "cdlg_Ru.orc"
     55#include "cdlg_Sv.orc"
     56#include "cdlg_Wa.orc"
     57#endif
Note: See TracChangeset for help on using the changeset viewer.