Changeset 4561 for trunk/src


Ignore:
Timestamp:
Nov 6, 2000, 11:20:56 AM (25 years ago)
Author:
sandervl
Message:

merged with latest Wine (11-05-2000)

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comdlg32/WINE.LEVEL

    r4511 r4561  
    1 Wine 20001002 level (10-21-2000)
     1Wine 20001002 level (11-05-2000)
  • trunk/src/comdlg32/cdlg_Sk.orc

    r4511 r4561  
    11LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT
     2
     3/* Slovak strings in CP1250 */
    24
    35OPEN_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
     
    2527SAVE_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
    2628STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    27 CAPTION "Ulož pod menom..."
     29CAPTION "Ulož pod menom..."
    2830FONT 8, "Helv"
    2931{
     
    5355 LTEXT "", 1089, 60, 6, 150, 9
    5456 GROUPBOX "Rozsah tlaèe", 1072, 6, 30, 160, 65, BS_GROUPBOX
    55  RADIOBUTTON "Vytlaè &všetko", 1056, 16, 45, 60, 12
    56  RADIOBUTTON "Vytlaè vý&ber", 1057, 16, 60, 60, 12
    57  RADIOBUTTON "Vytlaè &zadané strany", 1058, 16, 75, 60, 12
     57 RADIOBUTTON "Vytlaè &všetko", 1056, 16, 45, 60, 12
     58 RADIOBUTTON "Vytlaè vý&ber", 1057, 16, 60, 60, 12
     59 RADIOBUTTON "Vytlaè &zadané strany", 1058, 16, 75, 60, 12
    5860 DEFPUSHBUTTON "Tlaè", IDOK, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
    5961 PUSHBUTTON "Zruši", IDCANCEL, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
     
    6365 LTEXT "&Kvalita tlaèe:", 1092, 6, 100, 76, 9
    6466 COMBOBOX 1136, 80, 100, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
    65  CHECKBOX "Tlaè do &súboru", 1040, 20, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
     67 CHECKBOX "Tlaè do &súboru", 1040, 20, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
    6668 CHECKBOX "Kondenzované", 1041, 160, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
    6769}
     
    7577 GROUPBOX "Tlaèiareò", 1072, 6, 10, 180, 65, BS_GROUPBOX
    7678 RADIOBUTTON "&Predvolená tlaèiareò", 1056, 16, 20, 80, 12
    77  LTEXT "[none]", 1088, 35, 35, 120, 9
     79 LTEXT "[žiadna]", 1088, 35, 35, 120, 9
    7880 RADIOBUTTON "Špecifická &tlaèiareò", 1057, 16, 50, 80, 12
    7981 COMBOBOX 1136, 35, 65, 149, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
    8082 DEFPUSHBUTTON "Ok", IDOK, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
    8183 PUSHBUTTON "Zruši", IDCANCEL, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
    82  PUSHBUTTON "Ïa&lšie voŸby...", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
     84 PUSHBUTTON "ÏaŸši&e voŸby...", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
    8385 GROUPBOX "Orientácia", 1073, 6, 85, 100, 50, BS_GROUPBOX
    8486 RADIOBUTTON "Na &výšku", 1058, 50, 100, 40, 12
     
    9496
    9597
    96 CHOOSE_FONT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
    97 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    98 CAPTION "Písmo"
    99 FONT 8, "Helv"
    100 {
    101  LTEXT "Písmo:", 1088, 6, 6, 40, 9
    102  LTEXT "", 1089, 60, 6, 150, 9
    103  DEFPUSHBUTTON "Ok", IDOK, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
    104  PUSHBUTTON "Zruši", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
    105 }
    106 
    107 
    108 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 185
     98CHOOSE_FONT DIALOG DISCARDABLE  13, 54, 264, 147
     99STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
     100CAPTION "Font"
     101FONT 8, "Helv"
     102{
     103    LTEXT           "&Font:",1088 ,6,3,40,9
     104    COMBOBOX        1136 ,6,13,94,54,  CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
     105                    CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE
     106    LTEXT           "Š&týl fontu:",1089 ,108,3,44,9
     107    COMBOBOX        1137,108,13,64,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
     108                    WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE
     109    LTEXT           "&VeŸkos:",1090,179,3,30,9
     110    COMBOBOX        1138,179,13,32,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
     111                    WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE | CBS_SORT
     112    DEFPUSHBUTTON   "OK",IDOK,218,6,40,14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
     113    PUSHBUTTON      "Zruši",IDCANCEL,218,23,40,14,WS_GROUP | WS_TABSTOP
     114    PUSHBUTTON      "&Aplikova", 1026,218,40,40,14,WS_GROUP | WS_TABSTOP
     115    PUSHBUTTON      "&Pomoc" , 1038,218,57,40,14,WS_GROUP | WS_TABSTOP
     116    GROUPBOX        "Efekty",1072,6,72,84,34,WS_GROUP
     117    CHECKBOX        "P&reèiarknuté", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP
     118    CHECKBOX        "&Podèiarknuté", 1041, 10,94,50,10, BS_AUTOCHECKBOX
     119    LTEXT           "&Farba:", 1091 ,6,110,30,9
     120    COMBOBOX        1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS |
     121                    CBS_AUTOHSCROLL |  WS_BORDER | WS_VSCROLL | WS_TABSTOP
     122    GROUPBOX        "Vzorka",1073,98,72,160,49,WS_GROUP
     123    CTEXT           "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE
     124}
     125
     126CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 185
    109127STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
    110128CAPTION "Farby"
    111129FONT 8, "Helv"
    112130{
    113  LTEXT "&Základné farby:", 1088, 6, 6, 40, 9
    114  LTEXT "&Farby na zakázku:", 1089, 6, 126, 40, 9
    115  LTEXT "Farba|Spoj&itá", 1090, 100, 146, 40, 9
    116  LTEXT "&Odtieò:", 1091, 150, 126, 40, 9
    117  LTEXT "&Sýtos:", 1092, 150, 146, 40, 9
    118  LTEXT "&Jas:", 1093, 150, 166, 40, 9
    119  LTEXT "Èe&rvená:", 1094, 150, 126, 40, 9
    120  LTEXT "&Zelená:", 1095, 150, 146, 40, 9
    121  LTEXT "&Modrá:", 1096, 150, 166, 40, 9
    122  DEFPUSHBUTTON "Ok", IDOK, 6, 182, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
    123  PUSHBUTTON "&Prida farbu", 1024, 120, 182, 100, 14, WS_GROUP | WS_TABSTOP
    124  PUSHBUTTON "&Vyradi farbu", 1025, 6, 164, 56, 14, WS_GROUP | WS_TABSTOP
    125  PUSHBUTTON "Zruši", IDCANCEL, 76, 182, 56, 14, WS_GROUP | WS_TABSTOP
     131 LTEXT "&Základné farby:",   1088, 4,    4,  140, 10
     132 LTEXT "&UžívateŸské farby:",  1089, 4,   106, 140, 10
     133 LTEXT "Farba |  Spoj&itá",  1090, 150, 151,  48, 10
     134 LTEXT   "Èe&rvená:", 726 /*1094*/,249,126,24,10
     135 EDITTEXT 706, 275,124,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP
     136 LTEXT   "&Zelená:",727/*1095*/,249,140,24,10
     137 EDITTEXT 707, 275,138,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP
     138 LTEXT   "&Modrá:",728 /*1096*/,249,154,24,10
     139 EDITTEXT 708, 275,152,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP
     140 LTEXT  "&Hue:" ,723 /*1091*/,202,126,22,10
     141 EDITTEXT 703, 226,124,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP
     142 LTEXT  "&Sat:" ,724 /*1092*/,202,140,22,10
     143 EDITTEXT 704, 226,138,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP
     144 LTEXT  "&Lum:" ,725 /*1093*/,202,154,22,10
     145 EDITTEXT 705, 226,152,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP
     146 CONTROL "" ,720,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,14,140,86
     147 CONTROL "" ,721,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,116,140,28
     148 CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116
     149 CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116
     150 CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26
     151 DEFPUSHBUTTON "OK",  1,  4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
     152 PUSHBUTTON "Zruši", 2, 52, 166, 44, 14, WS_GROUP | WS_TABSTOP
     153 PUSHBUTTON "Pomoc", 1038,100,166, 44, 14
     154 PUSHBUTTON "&Prida k užívateŸovým farbám",    712/*1024*/, 152, 166, 142, 14, WS_GROUP | WS_TABSTOP
     155 PUSHBUTTON "&Definova užívateŸské farby >>", 719/*1025*/,   4, 150, 142, 14, WS_GROUP | WS_TABSTOP
     156 PUSHBUTTON  "&i",713,300,200,4,14   /* just a dummy:  'i' is  like  &i  in "sol&id"  */
    126157}
    127158
     
    139170 CONTROL "H&ore", 1056, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 111, 38, 20, 12
    140171 CONTROL "&Dole", 1057, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 138, 38, 30, 12
     172
    141173 DEFPUSHBUTTON "Nájs ï&alšie", IDOK, 182, 5, 50, 14, WS_GROUP | WS_TABSTOP
    142174 PUSHBUTTON "Zavrie", IDCANCEL, 182, 23, 50, 14, WS_GROUP | WS_TABSTOP
     
    156188 CHECKBOX "Len &celé slová", 1040, 5, 46, 104, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
    157189 CHECKBOX "&Rozlišova malá a veŸké písmená", 1041, 5, 62, 59, 12, BS_AUTOCHECKBOX | WS_TABSTOP
     190
    158191 DEFPUSHBUTTON "Nájs ï&alšie", 1, 174, 4, 50, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
    159192 PUSHBUTTON "Za&meni", 1024, 174, 21, 50, 14, WS_GROUP | WS_TABSTOP
     
    162195 PUSHBUTTON "&Pomoc", 1038, 174, 75, 50, 14, WS_GROUP | WS_TABSTOP
    163196}
     197
     198
     199PRINT32 DIALOG LOADONCALL MOVEABLE DISCARDABLE  32, 32, 288, 186
     200STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |
     201      DS_CONTEXTHELP | DS_3DLOOK
     202CAPTION "Tlaè"
     203FONT 8, "Helv"
     204{
     205    DEFPUSHBUTTON   "OK",     IDOK,     180,164, 48,14, WS_GROUP | BS_DEFPUSHBUTTON
     206    PUSHBUTTON      "Zruši", IDCANCEL, 232,164, 48,14, WS_GROUP
     207    PUSHBUTTON      "&Pomoc",  pshHelp,  50, 161, 48,14, WS_GROUP
     208
     209    GROUPBOX        "Tlaèiareò",        grp4,   8,  4, 272,84, WS_GROUP
     210    CONTROL         "tlaèi do &súboru", chx1, "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,212,70,64,12
     211    PUSHBUTTON      "&Vlastnosti",    psh2, 212, 17,  60,14, WS_GROUP
     212    LTEXT           "&Meno:",         stc6,  16, 20,  36,8
     213    COMBOBOX                          cmb4,  52, 18, 152,152,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP
     214    LTEXT           "Stav:",        stc8,  16, 36,  36,10, SS_NOPREFIX
     215    LTEXT           "Dummy State",    stc12, 52, 36, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
     216    LTEXT           "Typ:",          stc7,  16, 48,  36,10, SS_NOPREFIX
     217    LTEXT           "Dummy Typ",     stc11, 52, 48, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
     218    LTEXT           "Kam:",         stc10, 16, 60,  36,10, SS_NOPREFIX
     219    LTEXT           "Dummy Location", stc14, 52, 60, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
     220    LTEXT           "Komentár:",       stc9,  16, 72,  36,10, SS_NOPREFIX
     221    LTEXT           "Dummy Remark",   stc13, 52, 72, 152,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
     222
     223    GROUPBOX        "Kópie",         grp2, 160, 92, 120,64, WS_GROUP
     224    LTEXT           "Poèet &kópií:",stc5,168,108,68,8
     225    ICON            "",               ico3, 162,124,  76,24, WS_GROUP | SS_CENTERIMAGE
     226    CONTROL         "C&ollate",       chx2,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,240,130,36,12
     227    EDITTEXT                          edt3, 240,106,  32,12, WS_GROUP | ES_NUMBER
     228
     229    GROUPBOX        "Rozsah tlaèe",    grp1,   8,92,  144,64, WS_GROUP
     230    CONTROL         "&Všetky",           rad1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,16,106,64,12
     231    CONTROL         "St&rany",         rad3,"Button",BS_AUTORADIOBUTTON,16,122,36,12
     232    CONTROL         "Vý&ber",     rad2,"Button",BS_AUTORADIOBUTTON,16,138,64,12
     233    EDITTEXT                          edt1,  74,122,  26,12, WS_GROUP | ES_NUMBER
     234    EDITTEXT                          edt2, 118,122,  26,12, WS_GROUP | ES_NUMBER
     235    RTEXT           "&od:",         stc2,  52,124,  20,8
     236    RTEXT           "&do:",           stc3, 100,124,  16,8
     237}
     238
     239PRINT32_SETUP DIALOG LOADONCALL MOVEABLE DISCARDABLE  32, 32, 288, 178
     240STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |
     241      DS_CONTEXTHELP | DS_3DLOOK
     242CAPTION "Nastavenie tlaèe"
     243FONT 8, "Helv"
     244BEGIN
     245    DEFPUSHBUTTON   "OK",IDOK,180,156,48,14,WS_GROUP
     246    PUSHBUTTON      "Zruši",IDCANCEL,232,156,48,14
     247/*    PUSHBUTTON      "Sie...", psh5, 284,156,48,14 */
     248
     249    GROUPBOX        "Tlaèiareò",        grp4,   8,  4, 272,84, WS_GROUP
     250    PUSHBUTTON      "&Vlastnosti",    psh2, 212, 17,  60,14, WS_GROUP
     251    LTEXT           "&Meno:",         stc6,  16, 20,  36,8
     252    COMBOBOX                          cmb1,  52, 18, 152,152,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP
     253    LTEXT           "Stav:",        stc8,  16, 36,  36,10, SS_NOPREFIX
     254    LTEXT           "Dummy State",    stc12, 52, 36, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
     255    LTEXT           "Typ:",          stc7,  16, 48,  36,10, SS_NOPREFIX
     256    LTEXT           "Dummy Type",     stc11, 52, 48, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
     257    LTEXT           "Kam:",         stc10, 16, 60,  36,10, SS_NOPREFIX
     258    LTEXT           "Dummy Location", stc14, 52, 60, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
     259    LTEXT           "Komentár:",       stc9,  16, 72,  36,10, SS_NOPREFIX
     260    LTEXT           "Dummy Remark",   stc13, 52, 72, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
     261
     262    GROUPBOX        "Papier",          grp2,   8, 92, 164,56, WS_GROUP
     263    LTEXT           "&VeŸkos:",         stc2,  16,108,  36, 8
     264    COMBOBOX                          cmb2,  52,106, 112,112,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP
     265    LTEXT           "&Zdroj:",       stc3,  16,128,  36, 8
     266    COMBOBOX                          cmb3,  52,126, 112,112,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP
     267   
     268    GROUPBOX        "Orientácia",    grp1, 180, 92, 100,56, WS_GROUP
     269    ICON            "",               ico1, 195,112,  18,20, WS_GROUP
     270    CONTROL         "&Na výšku",      rad1,"Button",BS_AUTORADIOBUTTON | WS_GROUP |WS_TABSTOP,224,106,52,12
     271    CONTROL         "Na ší&rku",     rad2,"Button",BS_AUTORADIOBUTTON,224,126,52,12
     272END
     273
     274
     275NEWFILEOPENORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 287, 165
     276STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_CAPTION | WS_SYSMENU
     277CAPTION "Otvori"
     278FONT 8, "helv"
     279{
     280    LTEXT       "HŸada &v",IDC_LOOKINSTATIC,4,6,43,8, SS_NOTIFY
     281    COMBOBOX    IDC_LOOKIN,49,3,132,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
     282
     283    LTEXT       "" , IDC_TOOLBARSTATIC, 181, 2, 102, 17, NOT WS_GROUP | NOT WS_VISIBLE
     284    LISTBOX     IDC_SHELLSTATIC,4,20,272,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE
     285   
     286    LTEXT       "&Meno súboru:",IDC_FILENAMESTATIC,5,112,46,8, SS_NOTIFY
     287    EDITTEXT    IDC_FILENAME,54,110,155,12,ES_AUTOHSCROLL
     288   
     289    LTEXT       "&Typ súborov",IDC_FILETYPESTATIC,5,128,42,8, SS_NOTIFY
     290    COMBOBOX    IDC_FILETYPE,54,126,155,53,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
     291
     292    CONTROL     "Otvo&ri iba na èítanie",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,145,100,10
     293
     294    DEFPUSHBUTTON       "&Otvori",              IDOK,222,110,50,14
     295    PUSHBUTTON          "Zruši",                IDCANCEL,222,128,50,14
     296    PUSHBUTTON          "&Pomoc",                pshHelp,222,145,50,14
     297}
     298
     299STRINGTABLE DISCARDABLE
     300{
     301    IDS_ABOUTBOX            "&O teste uchopovania adresárov"
     302    IDS_DOCUMENTFOLDERS     "Adresár dokumentov"
     303    IDS_PERSONAL            "Moje dokumenty"
     304    IDS_FAVORITES           "Moji favoriti"
     305    IDS_PATH                "Systémová cesta"
     306    IDS_DESKTOP             "Pracovná plocha"
     307    IDS_FONTS               "Fonty"
     308    IDS_MYCOMPUTER          "Môj poèítaè"
     309}
     310
     311STRINGTABLE DISCARDABLE
     312{
     313    IDS_SYSTEMFOLDERS       "Systémové adresáre"
     314    IDS_LOCALHARDRIVES      "Lokálne pevné disky"
     315    IDS_FILENOTFOUND        "Súbor nenájdený"
     316    IDS_VERIFYFILE          "Please verify if the correct file name was given"
     317    IDS_CREATEFILE          "File does not exist\nDo you want to create file"
     318    IDL_OVERWRITEFILE       "File does already exist.\nDo you want to replace it?"
     319    IDS_INVALID_FILENAME_TITLE "Invalid character(s) in path"
     320    IDS_INVALID_FILENAME    "A filename cannot contain any of the following characters: \n                          / : < > |"
     321    IDS_PATHNOTEXISTING     "Cesta neexistuje"
     322    IDS_FILENOTEXISTING     "Súbor neexistuje"
     323}
     324
     325STRINGTABLE DISCARDABLE
     326{
     327    IDS_UPFOLDER         "O úroveò vyššie"
     328    IDS_NEWFOLDER        "Vytvori nový adresár"
     329    IDS_LISTVIEW         "Zoznam"
     330    IDS_REPORTVIEW       "Detaily"
     331    IDS_TODESKTOP        "Listova pracovnú plochu"
     332}
     333
     334STRINGTABLE DISCARDABLE
     335{
     336    PD32_PRINT_TITLE       "Tlaè"
     337
     338    PD32_VALUE_UREADABLE                  "Unreadable Entry"
     339    PD32_INVALID_PAGE_RANGE "This value lies not within Page range\n\
     340Please enter a value between %d and %d"
     341    PD32_FROM_NOT_ABOVE_TO                "The FROM entry cannot exceed TO:"
     342    PD32_MARGINS_OVERLAP                  "Margins overlap or fall outside \
     343Paper boundaries.\nPlease reenter margins"
     344    PD32_NR_OF_COPIES_EMPTY               "The NumberOfCopies entry cannot \
     345be empty"
     346    PD32_TOO_LARGE_COPIES                 "This large amount of prints is not \
     347supported by your printer.\nPlease enter a value between 1 and %d"
     348    PD32_PRINT_ERROR                      "A printer error occurred"
     349    PD32_NO_DEFAULT_PRINTER               "Nie je nastavená implicitná tlaèiareò"
     350    PD32_CANT_FIND_PRINTER                "Cannot find the printer"
     351    PD32_OUT_OF_MEMORY                    "Nedostatok pamäte"
     352    PD32_GENERIC_ERROR                    "Vyskytla sa chyba"
     353    PD32_DRIVER_UNKNOWN                   "Neznámy ovládaè tlaèiarne"
     354
     355    PD32_DEFAULT_PRINTER                  "Implicitná tlaèiareò; "
     356    PD32_NR_OF_DOCUMENTS_IN_QUEUE         "There are %d documents in queue"
     357    PD32_PRINT_ALL_X_PAGES                "&Všetky %d strany"
     358    PD32_MARGINS_IN_INCHES                "Okraje [palce]"
     359    PD32_MARGINS_IN_MILIMETERS            "Okraje [mm]"
     360    PD32_MILIMETERS                       "mm"
     361
     362    PD32_PRINTER_STATUS_READY             "Pripravená"
     363    PD32_PRINTER_STATUS_PAUSED            "Pozastavená; "
     364    PD32_PRINTER_STATUS_ERROR             "Chyba; "
     365    PD32_PRINTER_STATUS_PENDING_DELETION  "Pending deletion; "
     366    PD32_PRINTER_STATUS_PAPER_JAM         "Paper jam; "
     367    PD32_PRINTER_STATUS_PAPER_OUT         "Chýba papier; "
     368    PD32_PRINTER_STATUS_MANUAL_FEED       "Feed paper manual; "
     369    PD32_PRINTER_STATUS_PAPER_PROBLEM     "Paper problem; "
     370    PD32_PRINTER_STATUS_OFFLINE           "Tlaèiareò v stave offline; "
     371    PD32_PRINTER_STATUS_IO_ACTIVE         "I/O Active; "
     372    PD32_PRINTER_STATUS_BUSY              "Zaneprázdnená; "
     373    PD32_PRINTER_STATUS_PRINTING          "Prebieha tlaè; "
     374    PD32_PRINTER_STATUS_OUTPUT_BIN_FULL   "Output tray is full; "
     375    PD32_PRINTER_STATUS_NOT_AVAILABLE     "Nie je k dispozícii; "
     376    PD32_PRINTER_STATUS_WAITING           "Waiting; "
     377    PD32_PRINTER_STATUS_PROCESSING        "Prebieha spracovanie; "
     378    PD32_PRINTER_STATUS_INITIALIZING      "Inicializácia; "
     379    PD32_PRINTER_STATUS_WARMING_UP        "Warming up; "
     380    PD32_PRINTER_STATUS_TONER_LOW         "Primálo toneru; "
     381    PD32_PRINTER_STATUS_NO_TONER          "Chýba toner; "
     382    PD32_PRINTER_STATUS_PAGE_PUNT         "Page punt; "
     383    PD32_PRINTER_STATUS_USER_INTERVENTION "Prerušenie užívateŸom; "
     384    PD32_PRINTER_STATUS_OUT_OF_MEMORY     "Nedostatok pamäte; "
     385    PD32_PRINTER_STATUS_DOOR_OPEN         "Dvierka tlaèiarne sú otvorené; "
     386    PD32_PRINTER_STATUS_SERVER_UNKNOWN    "Neznámy print server; "
     387    PD32_PRINTER_STATUS_POWER_SAVE        "Power safe mode; "
     388}
  • trunk/src/comdlg32/filedlg95.c

    r4511 r4561  
    22 * COMMDLG - File Open Dialogs Win95 look and feel
    33 *
     4 * FIXME: The whole concept of handling unicode is badly broken.
     5 *      many hook-messages expecting a pointer to a
     6 *      OPENFILENAMEA or W structure. With the current architecture
     7 *      we would have to convert the beast at every call to a hook.
     8 *      we have to find a better solution but if would likely cause
     9 *      a complete rewrite with after we shouldhandle the
     10 *      OPENFILENAME structure without any converting (jsch).
     11 *
     12 * FIXME: any hook gets a OPENFILENAMEA structure
     13 *
     14 * FIXME: CDN_FILEOK is wrong implemented, other CDN_ messages likely too
     15 *
     16 * FIXME: old style hook messages are not implemented (except FILEOKSTRING)
     17 *
    418 * FIXME: lpstrCustomFilter not handled
    519 *
    6  * FIXME: if the size of lpstrFile (nMaxFile) is to small the first
     20 * FIXME: if the size of lpstrFile (nMaxFile) is too small the first
    721 * two bytes of lpstrFile should contain the needed size
    822 *
     
    1327 * FIXME: flags not implemented: OFN_CREATEPROMPT, OFN_DONTADDTORECENT,
    1428 * OFN_ENABLEINCLUDENOTIFY, OFN_ENABLESIZING, OFN_EXTENSIONDIFFERENT,
    15  * OFN_NOCHANGEDIR, OFN_NODEREFERENCELINKS, OFN_READONLYRETURN,
     29 * OFN_NOCHANGEDIR, OFN_NODEREFERENCELINKS, OFN_NOREADONLYRETURN,
    1630 * OFN_NOTESTFILECREATE, OFN_OVERWRITEPROMPT, OFN_USEMONIKERS
    1731 *
     
    3145#define MapHModuleSL(a) a
    3246#define MapHModuleLS(a) a
    33 
    3447#endif
    3548
     
    5972DEFAULT_DEBUG_CHANNEL(commdlg);
    6073
     74#define UNIMPLEMENTED_FLAGS \
     75(OFN_CREATEPROMPT | OFN_DONTADDTORECENT |\
     76OFN_ENABLEINCLUDENOTIFY | OFN_ENABLESIZING | OFN_EXTENSIONDIFFERENT |\
     77OFN_NOCHANGEDIR | OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\
     78OFN_NOTESTFILECREATE | OFN_OVERWRITEPROMPT /*| OFN_USEMONIKERS*/)
     79
     80#define IsHooked(fodInfos) \
     81        ((fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos->lpfnHook)
    6182/***********************************************************************
    6283 * Data structure and global variables
     
    84105/* Draw item constant */
    85106#define ICONWIDTH 18
    86 #define YTEXTOFFSET 2
    87107#define XTEXTOFFSET 3
    88108
     
    100120/* NOTE
    101121 * Those macros exist in windowsx.h. However, you can't really use them since
    102  * they rely on the UNICODE defines and can't be use inside Wine itself.
     122 * they rely on the UNICODE defines and can't be used inside Wine itself.
    103123 */
    104124
     
    146166
    147167/* Internal functions used by the dialog */
    148 static LRESULT FILEDLG95_OnWMInitDialog(HWND hwnd, WPARAM wParam, LPARAM lParam);
     168static LRESULT FILEDLG95_FillControls(HWND hwnd, WPARAM wParam, LPARAM lParam);
    149169static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam, LPARAM lParam);
    150170static LRESULT FILEDLG95_OnWMGetIShellBrowser(HWND hwnd);
    151171       BOOL    FILEDLG95_OnOpen(HWND hwnd);
    152 static LRESULT FILEDLG95_InitUI(HWND hwnd);
     172static LRESULT FILEDLG95_InitControls(HWND hwnd);
    153173static void    FILEDLG95_Clean(HWND hwnd);
    154174
     
    213233    HANDLE hDlgTmpl = 0;
    214234
     235    /* test for missing functionality */
     236    if (fodInfos->ofnInfos->Flags & UNIMPLEMENTED_FLAGS)
     237    {
     238      FIXME("Flags 0x%08lx not yet implemented\n",
     239         fodInfos->ofnInfos->Flags & UNIMPLEMENTED_FLAGS);
     240    }
     241
    215242    /* Create the dialog from a template */
    216243
     
    226253        return FALSE;
    227254    }
     255   
     256    /* old style hook messages */
     257    if (IsHooked(fodInfos))
     258    {
     259      fodInfos->HookMsg.fileokstring = RegisterWindowMessageA(FILEOKSTRING);
     260      fodInfos->HookMsg.lbselchstring = RegisterWindowMessageA(LBSELCHSTRING);
     261      fodInfos->HookMsg.helpmsgstring = RegisterWindowMessageA(HELPMSGSTRING);
     262      fodInfos->HookMsg.sharevistring = RegisterWindowMessageA(SHAREVISTRING);
     263    }
     264   
    228265    lRes = DialogBoxIndirectParamA(COMMDLG_hInstance32,
    229266                                  (LPDLGTEMPLATEA) template,
     
    232269                                  (LPARAM) fodInfos);
    233270
    234     /* Unable to create the dialog*/
     271    /* Unable to create the dialog */
    235272    if( lRes == -1)
    236273        return FALSE;
     
    270307  ofn->Flags = ofn->Flags|OFN_WINE;
    271308
    272   /* Replace the NULL lpstrInitialDir by the current folder */
    273   if(!ofn->lpstrInitialDir)
    274   {
    275     lpstrInitialDir = ofn->lpstrInitialDir;
    276     ofn->lpstrInitialDir = MemAlloc(MAX_PATH);
    277     GetCurrentDirectoryA(MAX_PATH,(LPSTR)ofn->lpstrInitialDir);
    278   }
    279 
    280309  /* Initialise the dialog property */
    281310  fodInfos->DlgInfos.dwDlgProp = 0;
     
    313342 * Call GetFileName95 with this structure and clean the memory.
    314343 *
    315  * IN  : The OPENFILENAMEW initialisation structure passed to
    316  *       GetOpenFileNameW win api function (see filedlg.c)
    317  *
    318  * FIXME:
    319  *   some more strings are needing to be convertet AtoW
    320  */
     344 * FIXME: lpstrCustomFilter has to converted back
     345 *
     346 */
     347
     348/* converting IN arguments */
     349#define AllocInArgWtoA(arg, save) \
     350  if(arg) \
     351  { \
     352    save = arg; \
     353    arg =  MemAlloc(lstrlenW(arg)); \
     354    lstrcpyWtoA((LPSTR)arg, save); \
     355  }
     356
     357#define FreeInArg(arg, save) \
     358  if(arg) \
     359  { \
     360    MemFree((LPSTR)arg); \
     361    arg = save; \
     362  }
     363
     364/* converting OUT arguments */
     365#define AllocOutArgWtoA(arg, save, len) \
     366  if(arg) \
     367  { \
     368    save = arg; \
     369    arg = MemAlloc(len); \
     370  }
     371
     372#define FreeOutArg(arg, save, len) \
     373  if(arg) \
     374  { \
     375    lstrcpynAtoW(save, (LPCSTR)arg, len); \
     376    MemFree(arg); \
     377    arg = save; \
     378  }
     379
    321380BOOL  WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType)
    322381{
     
    324383  FileOpenDlgInfos *fodInfos;
    325384  HINSTANCE hInstance;
    326   LPCSTR lpstrFilter = NULL;
    327   LPSTR lpstrCustomFilter = NULL;
    328 #ifdef __WIN32OS2__
    329   LPWSTR lpstrInitialDir = NULL;
    330   LPWSTR lpstrTitle = NULL;
    331 #endif
     385 
     386  /* out arguments */
    332387  LPWSTR lpstrFile = NULL;
     388  LPWSTR lpstrFileTitle = NULL;
     389
     390  /* in/out arguments */
     391  LPWSTR lpstrCustomFilter = NULL;
     392
     393  /* input arguments */
     394  LPCWSTR lpstrFilter = NULL;
     395  LPCWSTR lpstrInitialDir = NULL;
     396  LPCWSTR lpstrTitle = NULL;
     397  LPCWSTR lpstrDefExt = NULL;
     398  LPCWSTR lpTemplateName = NULL;
    333399  DWORD dwFlags;
    334400
     
    340406  fodInfos->ofnInfos = (LPOPENFILENAMEA) ofn;
    341407
    342   /* Save hInstance */
    343   hInstance = fodInfos->ofnInfos->hInstance;
    344   fodInfos->ofnInfos->hInstance = MapHModuleLS(ofn->hInstance);
    345 
    346   /* Save lpstrFilter */
     408  /* convert lpstrFilter */
    347409  if (ofn->lpstrFilter)
    348410  {
    349     LPWSTR  s;
    350     LPSTR x,y;
     411    LPCWSTR  s;
     412    LPSTR x, y;
    351413    int n;
    352414
    353     lpstrFilter = fodInfos->ofnInfos->lpstrFilter;
     415    lpstrFilter = ofn->lpstrFilter;
    354416
    355417    /* filter is a list...  title\0ext\0......\0\0 */
    356     s = (LPWSTR)ofn->lpstrFilter;
     418    s = ofn->lpstrFilter;
    357419   
    358     while (*s)
    359       s = s+lstrlenW(s)+1;
     420    while (*s) s = s+lstrlenW(s)+1;
    360421    s++;
    361422    n = s - ofn->lpstrFilter; /* already divides by 2. ptr magic */
    362423    x = y = (LPSTR)MemAlloc(n);
    363424    s = (LPWSTR)ofn->lpstrFilter;
    364     while (*s) {
     425    while (*s)
     426    {
    365427      lstrcpyWtoA(x,s);
    366428      x+=strlen(x)+1;
     
    368430    }
    369431    *x=0;
    370     fodInfos->ofnInfos->lpstrFilter = (LPSTR)y;
    371   }
    372   /* Save lpstrCustomFilter */
     432#ifdef __WIN32OS2__
     433    ofn->lpstrFilter = (LPWSTR)y;
     434#else
     435    (LPSTR)ofn->lpstrFilter = y;
     436#endif
     437  }
     438
     439  /* convert lpstrCustomFilter */
    373440  if (ofn->lpstrCustomFilter)
    374441  {
     
    377444    int n;
    378445
    379     lpstrCustomFilter = fodInfos->ofnInfos->lpstrCustomFilter;
     446    lpstrCustomFilter = ofn->lpstrCustomFilter;
    380447    /* filter is a list...  title\0ext\0......\0\0 */
    381     s = (LPWSTR)ofn->lpstrCustomFilter;
    382     while (*s)
    383       s = s+lstrlenW(s)+1;
     448    s = ofn->lpstrCustomFilter;
     449    while (*s) s = s+lstrlenW(s)+1;
    384450    s++;
    385451    n = s - ofn->lpstrCustomFilter;
    386452    x = y = (LPSTR)MemAlloc(n);
    387     s = (LPWSTR)ofn->lpstrCustomFilter;
    388     while (*s) {
     453    s = ofn->lpstrCustomFilter;
     454    while (*s)
     455    {
    389456      lstrcpyWtoA(x,s);
    390457      x+=strlen(x)+1;
     
    392459    }
    393460    *x=0;
    394     fodInfos->ofnInfos->lpstrCustomFilter = (LPSTR)y;
    395   }
    396 
    397   /* Save Flags */
    398   dwFlags = fodInfos->ofnInfos->Flags;
    399   fodInfos->ofnInfos->Flags = ofn->Flags|OFN_WINE|OFN_UNICODE;
    400 
    401   /* Initialise the dialog property */
    402   fodInfos->DlgInfos.dwDlgProp = 0;
    403  
    404   /* allocate ansi filename buffer */
    405   lpstrFile = ofn->lpstrFile; 
    406   ofn->lpstrFile = MemAlloc(ofn->nMaxFile);
    407 
    408461#ifdef __WIN32OS2__
    409   // convert initial dir & title (if necessary)
    410   lpstrInitialDir = (LPWSTR)ofn->lpstrInitialDir;
    411   if(lpstrInitialDir && *lpstrInitialDir != 0) {
    412         ofn->lpstrInitialDir = MemAlloc(lstrlenW(ofn->lpstrInitialDir)+1);
    413         lstrcpyWtoA((LPSTR)ofn->lpstrInitialDir, lpstrInitialDir);
    414   }
    415   else
    416   /* Replace the NULL lpstrInitialDir by the current folder */
    417   if(!lpstrInitialDir || *lpstrInitialDir == 0)
    418   {
    419         ofn->lpstrInitialDir = MemAlloc(MAX_PATH);
    420         GetCurrentDirectoryA(MAX_PATH,(LPSTR)ofn->lpstrInitialDir);
    421   }
    422 
    423   lpstrTitle = (LPWSTR)ofn->lpstrTitle;
    424   if(lpstrTitle) {
    425         ofn->lpstrTitle = MemAlloc(lstrlenW(ofn->lpstrTitle)+1);
    426         lstrcpyWtoA((LPSTR)ofn->lpstrTitle, lpstrTitle);
    427   }
    428 
     462    ofn->lpstrCustomFilter = (LPWSTR)y;
     463#else
     464    (LPSTR)ofn->lpstrCustomFilter = y;
    429465#endif
    430  
     466  }
     467
     468  /* convert string arguments, save others */
     469  AllocOutArgWtoA(ofn->lpstrFile, lpstrFile, ofn->nMaxFile);
     470  AllocOutArgWtoA(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle);
     471  AllocInArgWtoA(ofn->lpstrInitialDir, lpstrInitialDir);
     472  AllocInArgWtoA(ofn->lpstrTitle, lpstrTitle);
     473  AllocInArgWtoA(ofn->lpstrDefExt, lpstrDefExt);
     474  AllocInArgWtoA(ofn->lpTemplateName, lpTemplateName);
     475  dwFlags = ofn->Flags;
     476  hInstance = ofn->hInstance;
     477
     478  ofn->Flags = ofn->Flags|OFN_WINE|OFN_UNICODE;
     479  ofn->hInstance = MapHModuleLS(ofn->hInstance);
     480
    431481  switch(iDlgType)
    432482  {
     
    442492  }
    443493     
    444   /* Cleaning */
    445   /* Restore Flags */
    446   fodInfos->ofnInfos->Flags = dwFlags;
    447 
    448   /* Restore lpstrFilter */
    449   if (fodInfos->ofnInfos->lpstrFilter)
    450   {
    451     MemFree((LPVOID)(fodInfos->ofnInfos->lpstrFilter));
    452     fodInfos->ofnInfos->lpstrFilter = lpstrFilter;
    453   }
    454   if (fodInfos->ofnInfos->lpstrCustomFilter)
    455   {
    456     MemFree((LPVOID)(fodInfos->ofnInfos->lpstrCustomFilter));
    457     fodInfos->ofnInfos->lpstrCustomFilter = lpstrCustomFilter;
    458   }
    459 
    460   /* Restore hInstance */
    461   fodInfos->ofnInfos->hInstance = hInstance;
     494  /* restore saved IN arguments and convert OUT arguments back */
     495  ofn->Flags = dwFlags;
     496  ofn->hInstance = hInstance;
     497  FreeInArg(ofn->lpstrFilter, lpstrFilter);
     498  FreeInArg(ofn->lpstrCustomFilter, lpstrCustomFilter);
     499  FreeOutArg(ofn->lpstrFile, lpstrFile, ofn->nMaxFile);
     500  FreeOutArg(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle);
     501  FreeInArg(ofn->lpstrInitialDir, lpstrInitialDir);
     502  FreeInArg(ofn->lpstrTitle, lpstrTitle);
     503  FreeInArg(ofn->lpstrDefExt, lpstrDefExt);
     504  FreeInArg(ofn->lpTemplateName, lpTemplateName);
     505
    462506  MemFree((LPVOID)(fodInfos));
    463 
    464   /* filename */
    465   lstrcpynAtoW(lpstrFile, (LPCSTR)ofn->lpstrFile, ofn->nMaxFile);
    466   MemFree(ofn->lpstrFile);
    467   ofn->lpstrFile = lpstrFile;
    468 
    469 #ifdef __WIN32OS2__
    470   //free converted initial dir & title strings
    471   if(lpstrInitialDir) {
    472         MemFree((LPVOID)ofn->lpstrInitialDir);
    473         ofn->lpstrInitialDir = (LPCWSTR)lpstrInitialDir;
    474   }
    475   if(lpstrTitle) {
    476         MemFree((LPVOID)ofn->lpstrTitle);
    477         ofn->lpstrTitle = (LPCWSTR)lpstrTitle;
    478   }
    479 #endif
    480 
    481507  return ret;
    482508}
     
    484510void ArrangeCtrlPositions( HWND hwndChildDlg, HWND hwndParentDlg)
    485511{
    486 
    487         HWND hwndChild,hwndStc32;
    488         RECT rectParent, rectChild, rectCtrl, rectStc32, rectTemp;
    489         POINT ptMoveCtl;
    490         POINT ptParentClient;
    491 
    492         ptMoveCtl.x = ptMoveCtl.y = 0;
    493         hwndStc32=GetDlgItem(hwndChildDlg,stc32);
    494         GetClientRect(hwndParentDlg,&rectParent);
    495         GetClientRect(hwndChildDlg,&rectChild);
    496         if(hwndStc32)
    497         {
    498                 GetWindowRect(hwndStc32,&rectStc32);
    499                 MapWindowPoints(0, hwndChildDlg,(LPPOINT)&rectStc32,2);
    500                 CopyRect(&rectTemp,&rectStc32);
    501 
    502                 SetRect(&rectStc32,rectStc32.left,rectStc32.top,rectStc32.left + (rectParent.right-rectParent.left),rectStc32.top+(rectParent.bottom-rectParent.top));
    503                 SetWindowPos(hwndStc32,0,rectStc32.left,rectStc32.top,rectStc32.right-rectStc32.left,rectStc32.bottom-rectStc32.top,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE);
    504 
    505                 if(rectStc32.right < rectTemp.right)
    506                 {
    507                         ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
    508                         ptMoveCtl.x = 0;
    509                 }
    510                 else
    511                 {
    512                         ptMoveCtl.x = (rectStc32.right - rectTemp.right);
    513                         ptParentClient.x = max((rectParent.right-rectParent.left),((rectChild.right-rectChild.left)+rectStc32.right-rectTemp.right));
    514                 }
    515                 if(rectStc32.bottom < rectTemp.bottom)
    516                 {
    517                         ptParentClient.y = max((rectParent.bottom-rectParent.top),(rectChild.bottom-rectChild.top));
    518                         ptMoveCtl.y = 0;
    519                 }
    520                 else
    521                 {
    522                         ptMoveCtl.y = (rectStc32.bottom - rectTemp.bottom);
    523                         ptParentClient.y = max((rectParent.bottom-rectParent.top),((rectChild.bottom-rectChild.top)+rectStc32.bottom-rectTemp.bottom));
    524                 }
    525         }
    526         else
    527         {
    528                 if( (GetWindow(hwndChildDlg,GW_CHILD)) == (HWND) NULL)
    529                    return;
    530                 SetRectEmpty(&rectTemp);
    531                 ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
    532                 ptParentClient.y = (rectParent.bottom-rectParent.top) + (rectChild.bottom-rectChild.top);
    533                 ptMoveCtl.y = rectParent.bottom-rectParent.top;
    534                 ptMoveCtl.x=0;
    535         }
    536         SetRect(&rectParent,rectParent.left,rectParent.top,rectParent.left+ptParentClient.x,rectParent.top+ptParentClient.y);
    537         AdjustWindowRectEx( &rectParent,GetWindowLongA(hwndParentDlg,GWL_STYLE),FALSE,GetWindowLongA(hwndParentDlg,GWL_EXSTYLE));
    538 
    539         SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y,
    540                  SWP_NOZORDER );
    541         SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left),
    542                 (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER);
     512    HWND hwndChild,hwndStc32;
     513    RECT rectParent, rectChild, rectCtrl, rectStc32, rectTemp;
     514    POINT ptMoveCtl;
     515    POINT ptParentClient;
     516
     517    TRACE("\n");
     518
     519    ptMoveCtl.x = ptMoveCtl.y = 0;
     520    hwndStc32=GetDlgItem(hwndChildDlg,stc32);
     521    GetClientRect(hwndParentDlg,&rectParent);
     522    GetClientRect(hwndChildDlg,&rectChild);
     523
     524    if(hwndStc32)
     525    {
     526      GetWindowRect(hwndStc32,&rectStc32);
     527      MapWindowPoints(0, hwndChildDlg,(LPPOINT)&rectStc32,2);
     528      CopyRect(&rectTemp,&rectStc32);
     529
     530      SetRect(&rectStc32,rectStc32.left,rectStc32.top,rectStc32.left + (rectParent.right-rectParent.left),rectStc32.top+(rectParent.bottom-rectParent.top));
     531      SetWindowPos(hwndStc32,0,rectStc32.left,rectStc32.top,rectStc32.right-rectStc32.left,rectStc32.bottom-rectStc32.top,SWP_NOMOVE|SWP_NOZORDER | SWP_NOACTIVATE);
     532
     533      if(rectStc32.right < rectTemp.right)
     534      {
     535        ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
     536        ptMoveCtl.x = 0;
     537      }
     538      else
     539      {
     540        ptMoveCtl.x = (rectStc32.right - rectTemp.right);
     541        ptParentClient.x = max((rectParent.right-rectParent.left),((rectChild.right-rectChild.left)+rectStc32.right-rectTemp.right));
     542      }
     543
     544      if(rectStc32.bottom < rectTemp.bottom)
     545      {
     546        ptParentClient.y = max((rectParent.bottom-rectParent.top),(rectChild.bottom-rectChild.top));
     547        ptMoveCtl.y = 0;
     548      }
     549      else
     550      {
     551        ptMoveCtl.y = (rectStc32.bottom - rectTemp.bottom);
     552        ptParentClient.y = max((rectParent.bottom-rectParent.top),((rectChild.bottom-rectChild.top)+rectStc32.bottom-rectTemp.bottom));
     553      }
     554    }
     555    else
     556    {
     557      if( (GetWindow(hwndChildDlg,GW_CHILD)) == (HWND) NULL) return;
     558
     559      SetRectEmpty(&rectTemp);
     560      ptParentClient.x = max((rectParent.right-rectParent.left),(rectChild.right-rectChild.left));
     561      ptParentClient.y = (rectParent.bottom-rectParent.top) + (rectChild.bottom-rectChild.top);
     562      ptMoveCtl.y = rectParent.bottom-rectParent.top;
     563      ptMoveCtl.x=0;
     564    }
     565    SetRect(&rectParent,rectParent.left,rectParent.top,rectParent.left+ptParentClient.x,rectParent.top+ptParentClient.y);
     566    AdjustWindowRectEx( &rectParent,GetWindowLongA(hwndParentDlg,GWL_STYLE),FALSE,GetWindowLongA(hwndParentDlg,GWL_EXSTYLE));
     567
     568    SetWindowPos(hwndChildDlg, 0, 0,0, ptParentClient.x,ptParentClient.y, SWP_NOZORDER );
     569    SetWindowPos(hwndParentDlg, 0, rectParent.left,rectParent.top, (rectParent.right- rectParent.left),
     570        (rectParent.bottom-rectParent.top),SWP_NOMOVE | SWP_NOZORDER);
    543571       
    544         hwndChild = GetWindow(hwndChildDlg,GW_CHILD);
    545         if(hwndStc32)
    546         {
    547                 GetWindowRect(hwndStc32,&rectStc32);
    548                 MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
    549         }
    550         else
    551                 SetRect(&rectStc32,0,0,0,0);
    552 
    553         if (hwndChild )
    554         {
    555                 do
    556                 {
    557                         if(hwndChild != hwndStc32)
    558                         {
    559                         if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
     572    hwndChild = GetWindow(hwndChildDlg,GW_CHILD);
     573    if(hwndStc32)
     574    {
     575      GetWindowRect(hwndStc32,&rectStc32);
     576      MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
     577    }
     578    else
     579      SetRect(&rectStc32,0,0,0,0);
     580
     581    if (hwndChild )
     582    {
     583      do
     584      {
     585        if(hwndChild != hwndStc32)
     586        {
     587          if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
    560588                                continue;
    561                         GetWindowRect(hwndChild,&rectCtrl);
    562                         MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
     589          GetWindowRect(hwndChild,&rectCtrl);
     590          MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
    563591                                 
    564                                 /*
    565                                    Check the initial position of the controls relative to the initial
    566                                    position and size of stc32 (before it is expanded).
    567                                 */
    568                 if (rectCtrl.left >= rectTemp.right && rectCtrl.top >= rectTemp.bottom)
    569                                 {
    570                                         rectCtrl.left += ptMoveCtl.x;
    571                                 rectCtrl.top  += ptMoveCtl.y;
    572                                 }
    573                                 else if (rectCtrl.left >= rectTemp.right)
    574                                         rectCtrl.left += ptMoveCtl.x;
    575                                 else if (rectCtrl.top >= rectTemp.bottom)
    576                                         rectCtrl.top  += ptMoveCtl.y;
     592          /*
     593            Check the initial position of the controls relative to the initial
     594            position and size of stc32 (before it is expanded).
     595          */
     596          if (rectCtrl.left >= rectTemp.right && rectCtrl.top >= rectTemp.bottom)
     597          {
     598            rectCtrl.left += ptMoveCtl.x;
     599            rectCtrl.top  += ptMoveCtl.y;
     600          }
     601          else if (rectCtrl.left >= rectTemp.right)
     602          {
     603            rectCtrl.left += ptMoveCtl.x;
     604          }
     605          else if (rectCtrl.top >= rectTemp.bottom)
     606          {
     607            rectCtrl.top  += ptMoveCtl.y;
     608          }
    577609                                       
    578                                 SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
     610          SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
    579611                                rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
    580612                                SWP_NOSIZE | SWP_NOZORDER );
    581                                 }
    582                         }
    583                 while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
    584         }               
    585         hwndChild = GetWindow(hwndParentDlg,GW_CHILD);
     613        }
     614      } while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
     615    }
     616    hwndChild = GetWindow(hwndParentDlg,GW_CHILD);
    586617       
    587         if(hwndStc32)
    588         {
    589                 GetWindowRect(hwndStc32,&rectStc32);
    590                 MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
    591                 ptMoveCtl.x = rectStc32.left - 0;
    592                 ptMoveCtl.y = rectStc32.top - 0;
    593                 if (hwndChild )
    594                 {
    595                         do
    596                         {
    597                                 if(hwndChild != hwndChildDlg)
    598                                 {
    599 
    600                                         if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
    601                                                 continue;
    602                                         GetWindowRect(hwndChild,&rectCtrl);
    603                                         MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
    604 
    605                                         rectCtrl.left += ptMoveCtl.x;
    606                                         rectCtrl.top += ptMoveCtl.y;
    607 
    608                                         SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
    609                                         rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
    610                                         SWP_NOSIZE |SWP_NOZORDER );
    611                                 }
    612                         }
    613                         while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
    614                 }               
    615         }
    616 
     618    if(hwndStc32)
     619    {
     620      GetWindowRect(hwndStc32,&rectStc32);
     621      MapWindowPoints( 0, hwndChildDlg,(LPPOINT)&rectStc32,2);
     622      ptMoveCtl.x = rectStc32.left - 0;
     623      ptMoveCtl.y = rectStc32.top - 0;
     624      if (hwndChild )
     625      {
     626        do
     627        {
     628          if(hwndChild != hwndChildDlg)
     629          {
     630            if (GetWindowLongA( hwndChild, GWL_STYLE ) & WS_MAXIMIZE)
     631              continue;
     632            GetWindowRect(hwndChild,&rectCtrl);
     633            MapWindowPoints( 0, hwndParentDlg,(LPPOINT)&rectCtrl,2);
     634
     635            rectCtrl.left += ptMoveCtl.x;
     636            rectCtrl.top += ptMoveCtl.y;
     637
     638            SetWindowPos( hwndChild, 0, rectCtrl.left, rectCtrl.top,
     639                rectCtrl.right-rectCtrl.left,rectCtrl.bottom-rectCtrl.top,
     640                SWP_NOSIZE |SWP_NOZORDER );
     641          }
     642        } while ((hwndChild=GetWindow( hwndChild, GW_HWNDNEXT )) != (HWND)NULL);
     643      }         
     644    }
    617645}
    618646
     
    621649{
    622650    FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(GetParent(hwnd),FileOpenDlgInfosStr);
    623   switch(uMsg)
    624   {
    625         case WM_INITDIALOG:
    626         {         
    627             fodInfos = (FileOpenDlgInfos *)lParam;
    628                 lParam = (LPARAM) fodInfos->ofnInfos;
    629                 ArrangeCtrlPositions(hwnd,GetParent(hwnd));
    630             if(fodInfos && (fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos->lpfnHook)
    631                  return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
    632                 return 0;       
    633         }
    634     }
    635     if(fodInfos && (fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos->lpfnHook )
    636         return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
    637   return DefWindowProcA(hwnd,uMsg,wParam,lParam);
    638 }
    639 
    640 HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos,HWND hwnd)
     651
     652#if 0
     653    TRACE("0x%04x\n", uMsg);
     654#endif
     655
     656    switch(uMsg)
     657    {
     658      case WM_INITDIALOG:
     659      {         
     660        fodInfos = (FileOpenDlgInfos *)lParam;
     661        lParam = (LPARAM) fodInfos->ofnInfos;
     662        ArrangeCtrlPositions(hwnd,GetParent(hwnd));
     663
     664        if(fodInfos && IsHooked(fodInfos))
     665          return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
     666        return 0;       
     667      }
     668    }
     669
     670    if(fodInfos && IsHooked(fodInfos))
     671      return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam);
     672
     673    return DefWindowProcA(hwnd,uMsg,wParam,lParam);
     674}
     675
     676HWND CreateTemplateDialog(FileOpenDlgInfos *fodInfos, HWND hwnd)
    641677{
    642678    LPCVOID template;
     
    644680    HANDLE hDlgTmpl = 0;
    645681    HWND hChildDlg = 0;
    646    if (fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATE || fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATEHANDLE)
    647    {
    648         if (fodInfos->ofnInfos->Flags  & OFN_ENABLETEMPLATEHANDLE)
    649         {
    650            if( !(template = LockResource( fodInfos->ofnInfos->hInstance)))
    651                 {
    652                 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    653                 return (HWND)NULL;
    654                 }
    655                
    656         }
    657         else
    658         {
    659          if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos->hInstance),
    660             (fodInfos->ofnInfos->lpTemplateName), RT_DIALOGA)))
    661         {
    662                 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
    663                  return (HWND)NULL;
     682
     683    TRACE("\n");
     684
     685    if (fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATE ||
     686        fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATEHANDLE)
     687    {
     688      if (fodInfos->ofnInfos->Flags  & OFN_ENABLETEMPLATEHANDLE)
     689      {
     690        if( !(template = LockResource( fodInfos->ofnInfos->hInstance)))
     691        {
     692          COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
     693          return (HWND)NULL;
     694        }
     695      }
     696      else
     697      {
     698        if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos->hInstance),
     699             (fodInfos->ofnInfos->lpTemplateName), RT_DIALOGA)))
     700        {
     701          COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE);
     702          return (HWND)NULL;
     703        }
     704        if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos->hInstance),
     705             hRes )) || !(template = LockResource( hDlgTmpl )))
     706        {
     707          COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
     708          return (HWND)NULL;
    664709        }
    665         if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos->hInstance),
    666              hRes )) ||
    667                  !(template = LockResource( hDlgTmpl )))
    668         {
    669                 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE);
    670                 return (HWND)NULL;
    671         }
    672         }
    673 
    674         hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,template,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
    675         if(hChildDlg)
    676         {
    677                 ShowWindow(hChildDlg,SW_SHOW);
    678                 return hChildDlg;
    679         }
    680  }
    681  else if(fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK && fodInfos->ofnInfos->lpfnHook)
    682  {
    683         RECT rectHwnd;
    684         DLGTEMPLATE tmplate;
    685         GetClientRect(hwnd,&rectHwnd);
    686         tmplate.style = WS_CHILD | WS_CLIPSIBLINGS;
    687         tmplate.dwExtendedStyle = 0;
    688         tmplate.cdit = 0;
    689         tmplate.x = 0;
    690         tmplate.y = 0;
    691         tmplate.cx = rectHwnd.right-rectHwnd.left;
    692         tmplate.cy = rectHwnd.bottom-rectHwnd.top;
     710      }
     711
     712      hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,template,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
     713      if(hChildDlg)
     714      {
     715        ShowWindow(hChildDlg,SW_SHOW);
     716        return hChildDlg;
     717      }
     718    }
     719    else if( IsHooked(fodInfos))
     720    {
     721      RECT rectHwnd;
     722      DLGTEMPLATE tmplate;
     723      GetClientRect(hwnd,&rectHwnd);
     724      tmplate.style = WS_CHILD | WS_CLIPSIBLINGS;
     725      tmplate.dwExtendedStyle = 0;
     726      tmplate.cdit = 0;
     727      tmplate.x = 0;
     728      tmplate.y = 0;
     729      tmplate.cx = rectHwnd.right-rectHwnd.left;
     730      tmplate.cy = rectHwnd.bottom-rectHwnd.top;
    693731       
    694         return CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
    695  }
    696 return (HWND)NULL;
     732      return CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);
     733    }
     734    return (HWND)NULL;
    697735}
    698736 
     
    706744{
    707745    FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwndParentDlg,FileOpenDlgInfosStr);
    708     if(!fodInfos)
    709         return 0;
     746
     747    TRACE("0x%04x 0x%04x\n",hwndParentDlg, uCode);
     748
     749    if(!fodInfos) return 0;
     750
     751    if(fodInfos->ofnInfos->Flags & OFN_UNICODE)
     752      FIXME("sending OPENFILENAMEA structure. Hook is expecting OPENFILENAMEW!");
     753
    710754    if(fodInfos->DlgInfos.hwndCustomDlg)
    711755    {
    712756        OFNOTIFYA ofnNotify;
     757        HRESULT ret;
    713758        ofnNotify.hdr.hwndFrom=hwndParentDlg;
    714759        ofnNotify.hdr.idFrom=0;
    715760        ofnNotify.hdr.code = uCode;
    716761        ofnNotify.lpOFN = fodInfos->ofnInfos;
    717         return SendMessageA(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify);
     762        TRACE("CALL NOTIFY for %x\n", uCode);
     763        ret = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify);
     764        TRACE("RET NOTIFY\n");
     765        return ret;
    718766    }
    719767    return TRUE;
     
    788836HRESULT WINAPI FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    789837{
     838#if 0
     839  TRACE("0x%04x 0x%04x\n", hwnd, uMsg);
     840#endif
     841 
    790842  switch(uMsg)
    791843  {
    792844    case WM_INITDIALOG:
    793          /* Adds the FileOpenDlgInfos in the property list of the dialog
     845      {
     846         FileOpenDlgInfos * fodInfos = (FileOpenDlgInfos *)lParam;
     847
     848         /* Adds the FileOpenDlgInfos in the property list of the dialog
    794849            so it will be easily accessible through a GetPropA(...) */
    795          SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) lParam);
    796 
    797          FILEDLG95_OnWMInitDialog(hwnd, wParam, lParam);
    798          ((FileOpenDlgInfos *)lParam)->DlgInfos.hwndCustomDlg =
    799         CreateTemplateDialog((FileOpenDlgInfos *)lParam,hwnd);
     850         SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) fodInfos);
     851
     852         fodInfos->DlgInfos.hwndCustomDlg =
     853           CreateTemplateDialog((FileOpenDlgInfos *)lParam, hwnd);
     854
     855         FILEDLG95_InitControls(hwnd);
    800856         SendCustomDlgNotificationMessage(hwnd,CDN_INITDONE);
     857         FILEDLG95_FillControls(hwnd, wParam, lParam);
    801858         return 0;
     859       }
    802860    case WM_COMMAND:
    803861      return FILEDLG95_OnWMCommand(hwnd, wParam, lParam);
     
    867925
    868926/***********************************************************************
    869  *      FILEDLG95_OnWMInitDialog
    870  *
    871  * WM_INITDIALOG message handler
    872  */
    873 static LRESULT FILEDLG95_OnWMInitDialog(HWND hwnd, WPARAM wParam, LPARAM lParam)
    874 {
    875   LPITEMIDLIST pidlItemId;
     927 *      FILEDLG95_InitControls
     928 *
     929 * WM_INITDIALOG message handler (before hook notification)
     930 */
     931static LRESULT FILEDLG95_InitControls(HWND hwnd)
     932{
     933  TBBUTTON tbb[] =
     934  {
     935   {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
     936   {VIEW_PARENTFOLDER, FCIDM_TB_UPFOLDER,   TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
     937   {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
     938   {VIEW_NEWFOLDER+1,  FCIDM_TB_DESKTOP,    TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
     939   {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
     940   {VIEW_NEWFOLDER,    FCIDM_TB_NEWFOLDER,  TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
     941   {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
     942   {VIEW_LIST,         FCIDM_TB_SMALLICON,  TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
     943   {VIEW_DETAILS,      FCIDM_TB_REPORTVIEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
     944  };
     945  TBADDBITMAP tba[] =
     946  {
     947   { HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR },
     948   { COMDLG32_hInstance, 800 }                  // desktop icon
     949  };
     950 
     951  RECT rectTB;
     952 
     953  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
     954
     955  TRACE("%p\n", fodInfos);
     956
     957  /* Get the hwnd of the controls */
     958  fodInfos->DlgInfos.hwndFileName = GetDlgItem(hwnd,IDC_FILENAME);
     959  fodInfos->DlgInfos.hwndFileTypeCB = GetDlgItem(hwnd,IDC_FILETYPE);
     960  fodInfos->DlgInfos.hwndLookInCB = GetDlgItem(hwnd,IDC_LOOKIN);
     961
     962  /* construct the toolbar */
     963  GetWindowRect(GetDlgItem(hwnd,IDC_TOOLBARSTATIC),&rectTB);
     964  MapWindowPoints( 0, hwnd,(LPPOINT)&rectTB,2);
     965
     966  fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, (LPSTR) NULL,
     967        WS_CHILD | WS_GROUP | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NORESIZE,
     968        0, 0, 150, 26, hwnd, (HMENU) IDC_TOOLBAR, COMMDLG_hInstance32, NULL);
     969 
     970  SetWindowPos(fodInfos->DlgInfos.hwndTB, 0,
     971        rectTB.left,rectTB.top, rectTB.right-rectTB.left, rectTB.bottom-rectTB.top,
     972        SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER );
     973
     974  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0);
     975
     976/* fixme: use TB_LOADIMAGES when implemented */
     977/*  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_LOADIMAGES, (WPARAM) IDB_VIEW_SMALL_COLOR, HINST_COMMCTRL);*/
     978  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, (WPARAM) 12, (LPARAM) &tba[0]);
     979  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, (WPARAM) 1, (LPARAM) &tba[1]);
     980
     981  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSA, (WPARAM) 9,(LPARAM) &tbb);
     982  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
     983
     984  /* Set the window text with the text specified in the OPENFILENAME structure */
     985  if(fodInfos->ofnInfos->lpstrTitle)
     986  {
     987      SetWindowTextA(hwnd,fodInfos->ofnInfos->lpstrTitle);
     988  }
     989  else if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
     990  {
     991      SetWindowTextA(hwnd,"Save");
     992  }
     993
     994  /* Initialise the file name edit control */
     995  if(fodInfos->ofnInfos->lpstrFile)
     996  {
     997      LPSTR lpstrFile = COMDLG32_PathFindFileNameA(fodInfos->ofnInfos->lpstrFile);
     998      SetDlgItemTextA(hwnd, IDC_FILENAME, lpstrFile);
     999  }
     1000
     1001  /* Must the open as read only check box be checked ?*/
     1002  if(fodInfos->ofnInfos->Flags & OFN_READONLY)
     1003  {
     1004    SendDlgItemMessageA(hwnd,IDC_OPENREADONLY,BM_SETCHECK,(WPARAM)TRUE,0);
     1005  }
     1006
     1007  /* Must the open as read only check box be hid ?*/
     1008  if(fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY)
     1009  {
     1010    ShowWindow(GetDlgItem(hwnd,IDC_OPENREADONLY),SW_HIDE);
     1011  }
     1012
     1013  /* Must the help button be hid ?*/
     1014  if (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP))
     1015  {
     1016    ShowWindow(GetDlgItem(hwnd, pshHelp), SW_HIDE);
     1017  }
     1018
     1019  /* Resize the height, if open as read only checkbox ad help button
     1020     are hidden and we are not using a custom template */
     1021  if ( (fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY) &&
     1022       (!(fodInfos->ofnInfos->Flags &
     1023         (OFN_SHOWHELP|OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE))))
     1024  {
     1025    RECT rectDlg, rectHelp, rectCancel;
     1026    GetWindowRect(hwnd, &rectDlg);
     1027    GetWindowRect(GetDlgItem(hwnd, pshHelp), &rectHelp);
     1028    GetWindowRect(GetDlgItem(hwnd, IDCANCEL), &rectCancel);
     1029    /* subtract the height of the help button plus the space between
     1030       the help button and the cancel button to the height of the dialog */
     1031    SetWindowPos(hwnd, 0, 0, 0, rectDlg.right-rectDlg.left,
     1032                 (rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom),
     1033                 SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
     1034  }
     1035
     1036  /* change Open to Save FIXME: use resources */
     1037  if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
     1038  {
     1039      SetDlgItemTextA(hwnd,IDOK,"&Save");
     1040      SetDlgItemTextA(hwnd,IDC_LOOKINSTATIC,"Save &in");
     1041  }
     1042  return 0;
     1043}
     1044
     1045/***********************************************************************
     1046 *      FILEDLG95_FillControls
     1047 *
     1048 * WM_INITDIALOG message handler (after hook notification)
     1049 */
     1050static LRESULT FILEDLG95_FillControls(HWND hwnd, WPARAM wParam, LPARAM lParam)
     1051{
     1052  LPITEMIDLIST pidlItemId = NULL;
     1053 
    8761054  FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam;
    8771055
     
    8871065    GetCurrentDirectoryA(MAX_PATH,path);
    8881066    pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder, path);
    889 
    8901067  }
    8911068
     
    8931070  FILEDLG95_SHELL_Init(hwnd);
    8941071
    895   /* Initialise dialog UI */
    896   FILEDLG95_InitUI(hwnd);
    897 
    898   /* Initialize the Look In combo box*/
     1072  /* Initialize the Look In combo box */
    8991073  FILEDLG95_LOOKIN_Init(fodInfos->DlgInfos.hwndLookInCB);
    9001074
     
    10031177
    10041178/***********************************************************************
    1005  *      FILEDLG95_InitUI
    1006  *
    1007  */
    1008 static LRESULT FILEDLG95_InitUI(HWND hwnd)
    1009 {
    1010   TBBUTTON tbb[] =
    1011   {
    1012    {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
    1013    {VIEW_PARENTFOLDER, FCIDM_TB_UPFOLDER,   TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
    1014    {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
    1015    {VIEW_NEWFOLDER+1,  FCIDM_TB_DESKTOP,    TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
    1016    {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
    1017    {VIEW_NEWFOLDER,    FCIDM_TB_NEWFOLDER,  TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
    1018    {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
    1019    {VIEW_LIST,         FCIDM_TB_SMALLICON,  TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
    1020    {VIEW_DETAILS,      FCIDM_TB_REPORTVIEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
    1021   };
    1022   TBADDBITMAP tba[] =
    1023   {
    1024    { HINST_COMMCTRL, IDB_VIEW_SMALL_COLOR },
    1025    { COMDLG32_hInstance, 800 }                  // desktop icon
    1026   };
    1027  
    1028   RECT rectTB;
    1029  
    1030   FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr);
    1031 
    1032   TRACE("%p\n", fodInfos);
    1033 
    1034   /* Get the hwnd of the controls */
    1035   fodInfos->DlgInfos.hwndFileName = GetDlgItem(hwnd,IDC_FILENAME);
    1036   fodInfos->DlgInfos.hwndFileTypeCB = GetDlgItem(hwnd,IDC_FILETYPE);
    1037   fodInfos->DlgInfos.hwndLookInCB = GetDlgItem(hwnd,IDC_LOOKIN);
    1038 
    1039   /* construct the toolbar */
    1040   GetWindowRect(GetDlgItem(hwnd,IDC_TOOLBARSTATIC),&rectTB);
    1041   MapWindowPoints( 0, hwnd,(LPPOINT)&rectTB,2);
    1042 
    1043   fodInfos->DlgInfos.hwndTB = CreateWindowExA(0, TOOLBARCLASSNAMEA, (LPSTR) NULL,
    1044         WS_CHILD | WS_GROUP | TBSTYLE_TOOLTIPS | CCS_NODIVIDER | CCS_NORESIZE,
    1045         0, 0, 150, 26,
    1046         hwnd, (HMENU) IDC_TOOLBAR, COMMDLG_hInstance32, NULL);
    1047  
    1048   SetWindowPos(fodInfos->DlgInfos.hwndTB, 0,
    1049         rectTB.left,rectTB.top, rectTB.right-rectTB.left, rectTB.bottom-rectTB.top,
    1050         SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER );
    1051 
    1052   SendMessageA(fodInfos->DlgInfos.hwndTB, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), 0);
    1053 
    1054 /* fixme: use TB_LOADIMAGES when implemented */
    1055 /*  SendMessageA(fodInfos->DlgInfos.hwndTB, TB_LOADIMAGES, (WPARAM) IDB_VIEW_SMALL_COLOR, HINST_COMMCTRL);*/
    1056   SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, (WPARAM) 12, (LPARAM) &tba[0]);
    1057   SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBITMAP, (WPARAM) 1, (LPARAM) &tba[1]);
    1058 
    1059   SendMessageA(fodInfos->DlgInfos.hwndTB, TB_ADDBUTTONSA, (WPARAM) 9,(LPARAM) &tbb);
    1060   SendMessageA(fodInfos->DlgInfos.hwndTB, TB_AUTOSIZE, 0, 0);
    1061 
    1062   /* Set the window text with the text specified in the OPENFILENAME structure */
    1063   if(fodInfos->ofnInfos->lpstrTitle)
    1064   {
    1065       SetWindowTextA(hwnd,fodInfos->ofnInfos->lpstrTitle);
    1066   }
    1067   else if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
    1068   {
    1069       SetWindowTextA(hwnd,"Save");
    1070   }
    1071 
    1072   /* Initialise the file name edit control */
    1073   if(fodInfos->ofnInfos->lpstrFile)
    1074   {
    1075       LPSTR lpstrFile = COMDLG32_PathFindFileNameA(fodInfos->ofnInfos->lpstrFile);
    1076       SetDlgItemTextA(hwnd, IDC_FILENAME, lpstrFile);
    1077   }
    1078 
    1079   /* Must the open as read only check box be checked ?*/
    1080   if(fodInfos->ofnInfos->Flags & OFN_READONLY)
    1081   {
    1082     SendDlgItemMessageA(hwnd,IDC_OPENREADONLY,BM_SETCHECK,(WPARAM)TRUE,0);
    1083   }
    1084 
    1085   /* Must the open as read only check box be hid ?*/
    1086   if(fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY)
    1087   {
    1088     ShowWindow(GetDlgItem(hwnd,IDC_OPENREADONLY),SW_HIDE);
    1089   }
    1090 
    1091   /* Must the help button be hid ?*/
    1092   if (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP))
    1093   {
    1094     ShowWindow(GetDlgItem(hwnd, pshHelp), SW_HIDE);
    1095   }
    1096 
    1097   /* Resize the height, if open as read only checkbox ad help button
    1098      are hidden */
    1099   if ( (fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY) &&
    1100        (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP)) )
    1101   {
    1102     RECT rectDlg, rectHelp, rectCancel;
    1103     GetWindowRect(hwnd, &rectDlg);
    1104     GetWindowRect(GetDlgItem(hwnd, pshHelp), &rectHelp);
    1105     GetWindowRect(GetDlgItem(hwnd, IDCANCEL), &rectCancel);
    1106     /* subtract the height of the help button plus the space between
    1107        the help button and the cancel button to the height of the dialog */
    1108     SetWindowPos(hwnd, 0, 0, 0, rectDlg.right-rectDlg.left,
    1109                  (rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom),
    1110                  SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
    1111   }
    1112 
    1113   /* change Open to Save FIXME: use resources */
    1114   if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
    1115   {
    1116       SetDlgItemTextA(hwnd,IDOK,"&Save");
    1117       SetDlgItemTextA(hwnd,IDC_LOOKINSTATIC,"Save &in");
    1118   }
    1119   return 0;
    1120 }
    1121 
    1122 /***********************************************************************
    11231179 *      FILEDLG95_OnOpenMultipleFiles
    11241180 *     
     
    11711227      }
    11721228 
    1173       lpstrTemp += strlen(lpstrFileList) + 1;
     1229      /* move to the next file in the list of files */
     1230      lpstrTemp += strlen(lpstrTemp) + 1;
    11741231      COMDLG32_SHFree(pidl);
    11751232    }
     
    13231380
    13241381      lpszTemp = COMDLG32_PathFindNextComponentA(lpszTemp);
    1325       if (*lpszTemp)
     1382
     1383      if (!lpszTemp) break; /* end of path */
     1384
     1385      if(*lpszTemp)
    13261386        lstrcpynAtoW(lpwstrTemp, lpszTemp1, lpszTemp - lpszTemp1);
    13271387      else
    13281388      {
    13291389        lstrcpyAtoW(lpwstrTemp, lpszTemp1);     /* last element */
     1390
     1391        /* if the last element is a wildcard do a search */
    13301392        if(strpbrk(lpszTemp1, "*?") != NULL)
    13311393        {
    1332           nOpenAction = ONOPEN_SEARCH;
     1394          nOpenAction = ONOPEN_SEARCH;
     1395          break;
     1396        }
     1397      }
     1398      lpszTemp1 = lpszTemp;
     1399
     1400      TRACE("parse now=%s next=%s sf=%p\n",debugstr_w(lpwstrTemp), debugstr_a(lpszTemp), lpsf);
     1401
     1402      if(lstrlenW(lpwstrTemp)==2) COMDLG32_PathAddBackslashW(lpwstrTemp);
     1403
     1404      dwAttributes = SFGAO_FOLDER;
     1405      if(SUCCEEDED(IShellFolder_ParseDisplayName(lpsf, hwnd, NULL, lpwstrTemp, &dwEaten, &pidl, &dwAttributes)))
     1406      {
     1407        /* the path component is valid, we have a pidl of the next path component */
     1408        TRACE("parse OK attr=0x%08lx pidl=%p\n", dwAttributes, pidl);
     1409        if(dwAttributes & SFGAO_FOLDER)
     1410        {
     1411          if(FAILED(IShellFolder_BindToObject(lpsf, pidl, 0, &IID_IShellFolder, (LPVOID*)&lpsfChild)))
     1412          {
     1413            ERR("bind to failed\n"); /* should not fail */
     1414            break;
     1415          }
     1416          IShellFolder_Release(lpsf);
     1417          lpsf = lpsfChild;
     1418          lpsfChild = NULL;
     1419        }
     1420        else
     1421        {
     1422          TRACE("value\n");
     1423
     1424          /* end dialog, return value */
     1425          nOpenAction = ONOPEN_OPEN;
    13331426          break;
    13341427        }
     1428        COMDLG32_SHFree(pidl);
     1429        pidl = NULL;
    13351430      }
    1336       lpszTemp1 = lpszTemp;
    1337 
    1338       TRACE("parse now=%s next=%s sf=%p\n",debugstr_w(lpwstrTemp), debugstr_a(lpszTemp), lpsf);
    1339 
    1340       if(lstrlenW(lpwstrTemp)==2) COMDLG32_PathAddBackslashW(lpwstrTemp);
    1341 
    1342       dwAttributes = SFGAO_FOLDER;
    1343       if(FAILED(IShellFolder_ParseDisplayName(lpsf, hwnd, NULL, lpwstrTemp, &dwEaten, &pidl, &dwAttributes)))
     1431      else
    13441432      {
    13451433        if(*lpszTemp)   /* points to trailing null for last path element */
     
    13631451        break;
    13641452      }
    1365       else
    1366       {
    1367         /* the path component is valid */
    1368         TRACE("parse OK attr=0x%08lx pidl=%p\n", dwAttributes, pidl);
    1369         if(dwAttributes & SFGAO_FOLDER)
    1370         {
    1371           if(FAILED(IShellFolder_BindToObject(lpsf, pidl, 0, &IID_IShellFolder, (LPVOID*)&lpsfChild)))
    1372           {
    1373             ERR("bind to failed\n"); /* should not fail */
    1374             break;
    1375           }
    1376           IShellFolder_Release(lpsf);
    1377           lpsf = lpsfChild;
    1378           lpsfChild = NULL;
    1379         }
    1380         else
    1381         {
    1382           TRACE("value\n");
    1383 
    1384           /* end dialog, return value */
    1385           nOpenAction = ONOPEN_OPEN;
    1386           break;
    1387         }
    1388         COMDLG32_SHFree(pidl);
    1389         pidl = NULL;
    1390       }
    13911453    }
    13921454    if(pidl) COMDLG32_SHFree(pidl);
    13931455  }
    1394 
    1395   /* path is valid, clean the edit box */
    1396   SetDlgItemTextA(hwnd,IDC_FILENAME,"");
    13971456
    13981457/*
     
    14831542          }
    14841543
    1485           FILEDLG95_Clean(hwnd);
     1544          /* ask the hook if we can close */
     1545          if(IsHooked(fodInfos))
     1546          {
     1547            /* FIXME we are sending ASCII-structures. Does not work with NT */
     1548            /* first old style */
     1549            TRACE("---\n");
     1550            CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook, hwnd,
     1551                         fodInfos->HookMsg.fileokstring, 0, (LPARAM)fodInfos->ofnInfos);
     1552            if (GetWindowLongA(hwnd, DWL_MSGRESULT))
     1553            {
     1554              TRACE("cancled\n");
     1555              ret = FALSE;
     1556              goto ret;
     1557            }
     1558          }
     1559
     1560          TRACE("close\n");
     1561          FILEDLG95_Clean(hwnd);
    14861562          ret = EndDialog(hwnd, TRUE);
    14871563        }
     
    18181894
    18191895  SetPropA(hwndCombo, LookInInfosStr, (HANDLE) liInfos);
     1896
     1897  /* set item height for both text field and listbox */
     1898  CBSetItemHeight(hwndCombo,-1,GetSystemMetrics(SM_CYSMICON));
    18201899  CBSetItemHeight(hwndCombo,0,GetSystemMetrics(SM_CYSMICON));
    18211900
     
    18841963  HIMAGELIST ilItemImage;
    18851964  int iIndentation;
     1965  TEXTMETRICA tm;
    18861966  LPSFOLDER tmpFolder;
    18871967
     
    19202000  }
    19212001
    1922   /* Is this item selected ?*/
     2002  /* Is this item selected ? */
    19232003  if(pDIStruct->itemState & ODS_SELECTED)
    19242004  {
     
    19342014  }
    19352015
    1936   /* Do not indent item  if drawing in the edit of the combo*/
     2016  /* Do not indent item if drawing in the edit of the combo */
    19372017  if(pDIStruct->itemState & ODS_COMBOBOXEDIT)
    19382018  {
     
    19592039
    19602040  /* Initialise the text display area */
     2041  GetTextMetricsA(pDIStruct->hDC, &tm);
    19612042  rectText.left = rectIcon.right;
    1962   rectText.top = pDIStruct->rcItem.top + YTEXTOFFSET;
     2043  rectText.top =
     2044          (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom - tm.tmHeight) / 2;
    19632045  rectText.right = pDIStruct->rcItem.right + XTEXTOFFSET;
    1964   rectText.bottom = pDIStruct->rcItem.bottom;
    1965 
     2046  rectText.bottom =
     2047          (pDIStruct->rcItem.top + pDIStruct->rcItem.bottom + tm.tmHeight) / 2;
    19662048 
    19672049  /* Draw the icon from the image list */
     
    20332115  LookInInfos *liInfos;
    20342116
    2035   TRACE("\n");
     2117  TRACE("%08x\n", iInsertId);
    20362118
    20372119  if(!pidl)
     
    20642146                  | SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_ATTRIBUTES | SHGFI_ATTR_SPECIFIED);
    20652147
     2148  TRACE("-- Add %s attr=%08lx\n", sfi.szDisplayName, sfi.dwAttributes);
    20662149
    20672150  if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM))
     
    20692152    int iItemID;
    20702153 
     2154    TRACE("-- Add %s at %u\n", sfi.szDisplayName, tmpFolder->m_iIndent);
     2155
    20712156    /* Add the item at the end of the list */
    20722157    if(iInsertId < 0)
     
    22002285  int iCount = CBGetCount(hwnd);
    22012286
    2202   TRACE("\n");
     2287  TRACE("0x%08x 0x%x\n",searchArg, iSearchMethod);
    22032288
    22042289  if (iCount != CB_ERR)
     
    25972682
    25982683  TRACE("%p\n", pidl);
    2599 
     2684 
    26002685  pidlParent = COMDLG32_PIDL_ILClone(pidl);
    26012686  COMDLG32_PIDL_ILRemoveLastID(pidlParent);
     
    26182703  TRACE("sf=%p file=%s\n", lpsf, lpcstrFileName);
    26192704
     2705#ifdef __WIN32OS2__
     2706  if(!lpcstrFileName || *lpcstrFileName == 0) return NULL;
     2707#else
    26202708  if(!lpcstrFileName) return NULL;
    2621    
     2709#endif
     2710
    26222711  MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,lpcstrFileName,-1,(LPWSTR)lpwstrDirName,MAX_PATH); 
    26232712
  • trunk/src/comdlg32/filedlgbrowser.c

    r4511 r4561  
    2828#include "cdlg.h"
    2929
     30#define INITGUID
     31#include "initguid.h"
     32#include "wine/obj_serviceprovider.h"
     33
    3034DEFAULT_DEBUG_CHANNEL(commdlg);
    3135
    32 /**************************************************************************
    33 *   Structure
    34 */
     36typedef struct
     37{
     38
     39    ICOM_VTABLE(IShellBrowser)   * lpVtbl;
     40    ICOM_VTABLE(ICommDlgBrowser) * lpVtblCommDlgBrowser;
     41    ICOM_VTABLE(IServiceProvider)* lpVtblServiceProvider;
     42    DWORD ref;                                  /* Reference counter */
     43    HWND hwndOwner;                             /* Owner dialog of the interface */
     44
     45} IShellBrowserImpl;
     46
     47/**************************************************************************
     48*   vtable
     49*/
     50static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl;
     51static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl;
     52static ICOM_VTABLE(IServiceProvider) IShellBrowserImpl_IServiceProvider_Vtbl;
     53
     54/**************************************************************************
     55*   Local Prototypes
     56*/
     57
     58HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv);
     59#if 0
     60LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
     61#endif
     62
     63/**************************************************************************
     64*   External Prototypes
     65*/
     66extern const char *FileOpenDlgInfosStr;
     67
     68extern HRESULT          GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName);
     69extern HRESULT          GetFileName(HWND hwnd, LPITEMIDLIST pidl, LPSTR lpstrFileName);
     70extern IShellFolder*    GetShellFolderFromPidl(LPITEMIDLIST pidlAbs);
     71extern LPITEMIDLIST     GetParentPidl(LPITEMIDLIST pidl);
     72extern LPITEMIDLIST     GetPidlFromName(IShellFolder *psf,LPCSTR lpcstrFileName);
     73
     74extern BOOL    FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd,
     75                                                        LPITEMIDLIST pidlCurrentFolder,
     76                                                        LPSTR lpstrMask);
     77
     78extern int     FILEDLG95_LOOKIN_SelectItem(HWND hwnd,LPITEMIDLIST pidl);
     79extern BOOL    FILEDLG95_OnOpen(HWND hwnd);
     80extern HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
     81
     82
     83/*
     84 *   Helper functions
     85 */
     86
     87/* copied from shell32 to avoid linking to it */
     88static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
     89{
     90        TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
     91
     92        switch (src->uType)
     93        {
     94          case STRRET_WSTR:
     95            lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
     96            COMDLG32_SHFree(src->u.pOleStr);
     97            break;
     98
     99          case STRRET_CSTRA:
     100            lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
     101            break;
     102
     103          case STRRET_OFFSETA:
     104            if (pidl)
     105            {
     106              lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
     107            }
     108            break;
     109
     110          default:
     111            FIXME("unknown type!\n");
     112            if (len)
     113            { *(LPSTR)dest = '\0';
     114            }
     115            return(FALSE);
     116        }
     117        return S_OK;
     118}
     119
     120/*
     121 *      IShellBrowser
     122 */
     123 
     124/**************************************************************************
     125*  IShellBrowserImpl_Construct
     126*/
     127IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner)
     128{
     129    IShellBrowserImpl *sb;
     130    FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwndOwner,FileOpenDlgInfosStr);
     131
     132    sb=(IShellBrowserImpl*)COMDLG32_SHAlloc(sizeof(IShellBrowserImpl));
     133
     134    /* Initialisation of the member variables */
     135    sb->ref=1;
     136    sb->hwndOwner = hwndOwner;
     137
     138    /* Initialisation of the vTables */
     139    sb->lpVtbl = &IShellBrowserImpl_Vtbl;
     140    sb->lpVtblCommDlgBrowser = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
     141    sb->lpVtblServiceProvider = &IShellBrowserImpl_IServiceProvider_Vtbl;
     142    COMDLG32_SHGetSpecialFolderLocation(hwndOwner, CSIDL_DESKTOP,
     143                               &fodInfos->ShellInfos.pidlAbsCurrent);
     144
     145    TRACE("%p\n", sb);
     146
     147    return (IShellBrowser *) sb;
     148}
     149
     150/***************************************************************************
     151*  IShellBrowserImpl_QueryInterface
     152*/
     153HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
     154                                            REFIID riid,
     155                                            LPVOID *ppvObj)
     156{
     157    ICOM_THIS(IShellBrowserImpl, iface);
     158
     159#ifndef __WIN32OS2__
     160    TRACE("(%p)\n\t%s\n", This, debugstr_guid(riid));
     161#endif
     162
     163    *ppvObj = NULL;
     164
     165    if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
     166    { *ppvObj = This;
     167    }
     168    else if(IsEqualIID(riid, &IID_IOleWindow))  /*IOleWindow*/
     169    { *ppvObj = (IOleWindow*)This;
     170    }
     171
     172    else if(IsEqualIID(riid, &IID_IShellBrowser))  /*IShellBrowser*/
     173    { *ppvObj = (IShellBrowser*)This;
     174    }
     175
     176    else if(IsEqualIID(riid, &IID_ICommDlgBrowser))  /*ICommDlgBrowser*/
     177    { *ppvObj = (ICommDlgBrowser*) &(This->lpVtblCommDlgBrowser);
     178    }
     179
     180    else if(IsEqualIID(riid, &IID_IServiceProvider))  /* IServiceProvider */
     181    { *ppvObj = (ICommDlgBrowser*) &(This->lpVtblServiceProvider);
     182    }
     183
     184    if(*ppvObj)
     185    { IUnknown_AddRef( (IShellBrowser*) *ppvObj);
     186      return S_OK;
     187    }
     188    FIXME("Unknown interface requested\n");
     189    return E_NOINTERFACE;
     190}
     191
     192/**************************************************************************
     193*  IShellBrowser::AddRef
     194*/
     195ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface)
     196{
     197    ICOM_THIS(IShellBrowserImpl, iface);
     198
     199    TRACE("(%p)\n", This);
     200
     201    return ++(This->ref);
     202}
     203
     204/**************************************************************************
     205*  IShellBrowserImpl_Release
     206*/
     207ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
     208{
     209    ICOM_THIS(IShellBrowserImpl, iface);
     210
     211    TRACE("(%p)\n", This);
     212
     213    if (!--(This->ref))
     214    {
     215      HeapFree(GetProcessHeap(),0, This);
     216      return 0;
     217    }
     218    return This->ref;
     219}
     220
     221/*
     222 * IOleWindow
     223 */
     224
     225/**************************************************************************
     226*  IShellBrowserImpl_GetWindow  (IOleWindow)
     227*
     228*  Inherited from IOleWindow::GetWindow
     229*
     230*  See Windows documentation for more details
     231*
     232*  Note : We will never be window less in the File Open dialog
     233
     234*/
     235HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 
     236                                           HWND * phwnd)
     237{
     238    ICOM_THIS(IShellBrowserImpl, iface);
     239
     240    TRACE("(%p)\n", This);
     241
     242    if(!This->hwndOwner)
     243        return E_FAIL;
     244
     245    *phwnd = This->hwndOwner;
     246
     247    return (*phwnd) ? S_OK : E_UNEXPECTED;
     248
     249}
     250
     251/**************************************************************************
     252*  IShellBrowserImpl_ContextSensitiveHelp
     253*/
     254HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser * iface,
     255                                                      BOOL fEnterMode)
     256{
     257    ICOM_THIS(IShellBrowserImpl, iface);
     258
     259    TRACE("(%p)\n", This);
     260
     261    /* Feature not implemented */
     262    return E_NOTIMPL;
     263}
     264
     265/*
     266 * IShellBrowser
     267 */
     268
     269/**************************************************************************
     270*  IShellBrowserImpl_BrowseObject
     271*
     272*  See Windows documentation on IShellBrowser::BrowseObject for more details
     273*
     274*  This function will override user specified flags and will always
     275*  use SBSP_DEFBROWSER and SBSP_DEFMODE. 
     276*/
     277HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
     278                                              LPCITEMIDLIST pidl,
     279                                              UINT wFlags)
     280{
     281    HRESULT hRes;
     282    IShellFolder *psfTmp;
     283    IShellView *psvTmp;
     284    FileOpenDlgInfos *fodInfos;
     285    LPITEMIDLIST pidlTmp;
     286    HWND hwndView;
     287    HWND hDlgWnd;
     288    BOOL bViewHasFocus;
     289
     290    ICOM_THIS(IShellBrowserImpl, iface);
     291
     292    TRACE("(%p)(%p,0x%08x)\n", This, pidl, wFlags);
     293
     294    fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
     295
     296    /* Format the pidl according to its parameter's category */
     297    if(wFlags & SBSP_RELATIVE)
     298    {
     299       
     300        /* SBSP_RELATIVE  A relative pidl (relative from the current folder) */
     301        if(FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
     302             pidl, NULL, &IID_IShellFolder, (LPVOID *)&psfTmp)))
     303        {
     304            ERR("bind to object failed\n");
     305            return hRes;
     306        }
     307        /* create an absolute pidl */
     308        pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent,
     309                                                        (LPITEMIDLIST)pidl);
     310    }
     311    else if(wFlags & SBSP_PARENT)
     312    {
     313        /* Browse the parent folder (ignores the pidl) */
     314        pidlTmp = GetParentPidl(fodInfos->ShellInfos.pidlAbsCurrent);
     315        psfTmp = GetShellFolderFromPidl(pidlTmp);
     316
     317    }
     318    else /* SBSP_ABSOLUTE is 0x0000 */
     319    {
     320        /* An absolute pidl (relative from the desktop) */
     321        pidlTmp =  COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl);
     322        psfTmp = GetShellFolderFromPidl(pidlTmp);
     323    }
     324   
     325    if(!psfTmp)
     326    {
     327      ERR("could not browse to folder\n");
     328      return E_FAIL;
     329    }
     330
     331    /* If the pidl to browse to is equal to the actual pidl ...
     332       do nothing and pretend you did it*/
     333    if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent))
     334    {
     335        IShellFolder_Release(psfTmp);
     336        COMDLG32_SHFree(pidlTmp);
     337        TRACE("keep current folder\n");
     338        return NOERROR;
     339    }
     340
     341    /* Release the current DataObject */
     342    if (fodInfos->Shell.FOIDataObject)
     343    {
     344      IDataObject_Release(fodInfos->Shell.FOIDataObject);
     345      fodInfos->Shell.FOIDataObject = NULL;
     346    }
     347
     348    /* Create the associated view */
     349    TRACE("create view object\n");
     350    if(FAILED(hRes = IShellFolder_CreateViewObject(psfTmp, fodInfos->ShellInfos.hwndOwner,
     351           &IID_IShellView, (LPVOID *)&psvTmp))) goto error;
     352
     353    /* Check if listview has focus */
     354    bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
     355
     356    /* Get the foldersettings from the old view */
     357    if(fodInfos->Shell.FOIShellView)
     358      IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView, &fodInfos->ShellInfos.folderSettings);
     359
     360    /* Release the old fodInfos->Shell.FOIShellView and update its value.
     361    We have to update this early since ShellView_CreateViewWindow of native
     362    shell32 calls OnStateChange and needs the correct view here.*/
     363    if(fodInfos->Shell.FOIShellView)
     364    {
     365      IShellView_DestroyViewWindow(fodInfos->Shell.FOIShellView);
     366      IShellView_Release(fodInfos->Shell.FOIShellView);
     367    }
     368    fodInfos->Shell.FOIShellView = psvTmp;
     369
     370    /* Release old FOIShellFolder and update its value */
     371    if (fodInfos->Shell.FOIShellFolder)
     372      IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
     373    fodInfos->Shell.FOIShellFolder = psfTmp;
     374
     375    /* Release old pidlAbsCurrent and update its value */
     376    COMDLG32_SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);
     377    fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp;
     378
     379    /* Create the window */
     380    TRACE("create view window\n");
     381    if(FAILED(hRes = IShellView_CreateViewWindow(psvTmp, NULL,
     382         &fodInfos->ShellInfos.folderSettings, fodInfos->Shell.FOIShellBrowser,
     383         &fodInfos->ShellInfos.rectView, &hwndView))) goto error;
     384
     385    fodInfos->ShellInfos.hwndView = hwndView;
     386
     387    /* Select the new folder in the Look In combo box of the Open file dialog */
     388    FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent);
     389
     390    /* changes the tab order of the ListView to reflect the window's File Dialog */
     391    hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN);
     392    SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
     393
     394    /* Since we destroyed the old view if it had focus set focus to the newly created view */
     395    if (bViewHasFocus)
     396      SetFocus(fodInfos->ShellInfos.hwndView);
     397
     398    return hRes;
     399error:
     400    ERR("Failed with error 0x%08lx\n", hRes);
     401    return hRes;
     402}
     403
     404/**************************************************************************
     405*  IShellBrowserImpl_EnableModelessSB
     406*/
     407HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,   
     408                                              BOOL fEnable)
     409                                             
     410{
     411    ICOM_THIS(IShellBrowserImpl, iface);
     412
     413    TRACE("(%p)\n", This);
     414
     415    /* Feature not implemented */
     416    return E_NOTIMPL;
     417}
     418
     419/**************************************************************************
     420*  IShellBrowserImpl_GetControlWindow
     421*/
     422HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,   
     423                                              UINT id,   
     424                                              HWND *lphwnd)
     425                                             
     426{
     427    ICOM_THIS(IShellBrowserImpl, iface);
     428
     429    TRACE("(%p)\n", This);
     430
     431    /* Feature not implemented */
     432    return E_NOTIMPL;
     433}
     434/**************************************************************************
     435*  IShellBrowserImpl_GetViewStateStream
     436*/
     437HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
     438                                                DWORD grfMode,   
     439                                                LPSTREAM *ppStrm)
     440                                             
     441{
     442    ICOM_THIS(IShellBrowserImpl, iface);
     443
     444    FIXME("(%p 0x%08lx %p)\n", This, grfMode, ppStrm);
     445
     446    /* Feature not implemented */
     447    return E_NOTIMPL;
     448}       
     449/**************************************************************************
     450*  IShellBrowserImpl_InsertMenusSB
     451*/
     452HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
     453                                           HMENU hmenuShared,
     454                                           LPOLEMENUGROUPWIDTHS lpMenuWidths)
     455                                             
     456{
     457    ICOM_THIS(IShellBrowserImpl, iface);
     458
     459    TRACE("(%p)\n", This);
     460
     461    /* Feature not implemented */
     462    return E_NOTIMPL;
     463}
     464/**************************************************************************
     465*  IShellBrowserImpl_OnViewWindowActive
     466*/
     467HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
     468                                                IShellView *ppshv)
     469                                             
     470{
     471    ICOM_THIS(IShellBrowserImpl, iface);
     472
     473    TRACE("(%p)\n", This);
     474
     475    /* Feature not implemented */
     476    return E_NOTIMPL;
     477}   
     478/**************************************************************************
     479*  IShellBrowserImpl_QueryActiveShellView
     480*/
     481HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
     482                                                  IShellView **ppshv)
     483                                             
     484{
     485    ICOM_THIS(IShellBrowserImpl, iface);
     486
     487    FileOpenDlgInfos *fodInfos;
     488
     489    TRACE("(%p)\n", This);
     490
     491    fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
     492
     493    if(!(*ppshv = fodInfos->Shell.FOIShellView))
     494    {
     495        return E_FAIL;
     496    }
     497    IShellView_AddRef(fodInfos->Shell.FOIShellView);
     498    return NOERROR;
     499}   
     500/**************************************************************************
     501*  IShellBrowserImpl_RemoveMenusSB
     502*/
     503HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
     504                                           HMENU hmenuShared)
     505                                             
     506{
     507    ICOM_THIS(IShellBrowserImpl, iface);
     508
     509    TRACE("(%p)\n", This);
     510
     511    /* Feature not implemented */
     512    return E_NOTIMPL;
     513}   
     514/**************************************************************************
     515*  IShellBrowserImpl_SendControlMsg
     516*/
     517HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,   
     518                                            UINT id,   
     519                                            UINT uMsg,   
     520                                            WPARAM wParam,   
     521                                            LPARAM lParam,
     522                                            LRESULT *pret)
     523                                             
     524{
     525    ICOM_THIS(IShellBrowserImpl, iface);
     526    LRESULT lres;
     527   
     528    TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);
     529
     530    switch (id)
     531    {
     532      case FCW_TOOLBAR:
     533        lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam);
     534        break;
     535      default:
     536        FIXME("ctrl id: %x\n", id);
     537        return E_NOTIMPL;
     538    }
     539    if (pret) *pret = lres;
     540    return S_OK;
     541}
     542/**************************************************************************
     543*  IShellBrowserImpl_SetMenuSB
     544*/
     545HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
     546                                       HMENU hmenuShared,   
     547                                       HOLEMENU holemenuReserved,
     548                                       HWND hwndActiveObject)
     549                                             
     550{
     551    ICOM_THIS(IShellBrowserImpl, iface);
     552
     553    TRACE("(%p)\n", This);
     554
     555    /* Feature not implemented */
     556    return E_NOTIMPL;
     557}   
     558/**************************************************************************
     559*  IShellBrowserImpl_SetStatusTextSB
     560*/
     561HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
     562                                             LPCOLESTR lpszStatusText)
     563                                             
     564{
     565    ICOM_THIS(IShellBrowserImpl, iface);
     566
     567    TRACE("(%p)\n", This);
     568
     569    /* Feature not implemented */
     570    return E_NOTIMPL;
     571}   
     572/**************************************************************************
     573*  IShellBrowserImpl_SetToolbarItems
     574*/
     575HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
     576                                             LPTBBUTTON lpButtons,   
     577                                             UINT nButtons,   
     578                                             UINT uFlags)
     579                                             
     580{
     581    ICOM_THIS(IShellBrowserImpl, iface);
     582
     583    TRACE("(%p)\n", This);
     584
     585    /* Feature not implemented */
     586    return E_NOTIMPL;
     587}   
     588/**************************************************************************
     589*  IShellBrowserImpl_TranslateAcceleratorSB
     590*/
     591HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
     592                                                    LPMSG lpmsg,   
     593                                                    WORD wID)
     594                                             
     595{
     596    ICOM_THIS(IShellBrowserImpl, iface);
     597
     598    TRACE("(%p)\n", This);
     599
     600    /* Feature not implemented */
     601    return E_NOTIMPL;
     602}
     603
    35604static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl =
    36605{
     
    59628};
    60629
    61 static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl =
    62 {
    63         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    64         /* IUnknown */
    65         IShellBrowserImpl_ICommDlgBrowser_QueryInterface,
    66         IShellBrowserImpl_ICommDlgBrowser_AddRef,
    67         IShellBrowserImpl_ICommDlgBrowser_Release,
    68         /* ICommDlgBrowser */
    69         IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand,
    70         IShellBrowserImpl_ICommDlgBrowser_OnStateChange,
    71         IShellBrowserImpl_ICommDlgBrowser_IncludeObject
    72 };
    73 
    74 
    75 /**************************************************************************
    76 *   Local Prototypes
    77 */
    78 
    79 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv);
    80 #if 0
    81 LPITEMIDLIST GetSelectedPidl(IShellView *ppshv);
    82 #endif
    83 
    84 /**************************************************************************
    85 *   External Prototypes
    86 */
    87 extern const char *FileOpenDlgInfosStr;
    88 
    89 extern HRESULT          GetName(LPSHELLFOLDER lpsf, LPITEMIDLIST pidl,DWORD dwFlags,LPSTR lpstrFileName);
    90 extern HRESULT          GetFileName(HWND hwnd, LPITEMIDLIST pidl, LPSTR lpstrFileName);
    91 extern IShellFolder*    GetShellFolderFromPidl(LPITEMIDLIST pidlAbs);
    92 extern LPITEMIDLIST     GetParentPidl(LPITEMIDLIST pidl);
    93 extern LPITEMIDLIST     GetPidlFromName(IShellFolder *psf,LPCSTR lpcstrFileName);
    94 
    95 extern BOOL    FILEDLG95_SHELL_FillIncludedItemList(HWND hwnd,
    96                                                         LPITEMIDLIST pidlCurrentFolder,
    97                                                         LPSTR lpstrMask);
    98 
    99 extern int     FILEDLG95_LOOKIN_SelectItem(HWND hwnd,LPITEMIDLIST pidl);
    100 extern BOOL    FILEDLG95_OnOpen(HWND hwnd);
    101 extern HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode);
    102 
    103 
    104 /**************************************************************************
    105 *  IShellBrowserImpl_Construct
    106 */
    107 IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner)
    108 {
    109     IShellBrowserImpl *sb;
    110     FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwndOwner,FileOpenDlgInfosStr);
    111 
    112     sb=(IShellBrowserImpl*)COMDLG32_SHAlloc(sizeof(IShellBrowserImpl));
    113 
    114     /* Initialisation of the member variables */
    115     sb->ref=1;
    116     sb->hwndOwner = hwndOwner;
    117 
    118     /* Initialisation of the vTables */
    119     sb->lpVtbl = &IShellBrowserImpl_Vtbl;
    120     sb->lpVtbl2 = &IShellBrowserImpl_ICommDlgBrowser_Vtbl;
    121 
    122     COMDLG32_SHGetSpecialFolderLocation(hwndOwner, CSIDL_DESKTOP,
    123                                &fodInfos->ShellInfos.pidlAbsCurrent);
    124 
    125     TRACE("%p\n", sb);
    126 
    127     return (IShellBrowser *) sb;
    128 }
    129 
    130 /**************************************************************************
    131 *
    132 *
    133 *  The INTERFACE of the IShellBrowser object
    134 *
    135 */
    136 
    137 /*
    138  * IUnknown
    139  */
    140 
    141 /***************************************************************************
    142 *  IShellBrowserImpl_QueryInterface
    143 */
    144 HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
    145                                             REFIID riid,
    146                                             LPVOID *ppvObj)
    147 {
    148     ICOM_THIS(IShellBrowserImpl, iface);
    149 
    150     TRACE("(%p)\n", This);
    151 
    152     *ppvObj = NULL;
    153 
    154     if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
    155     { *ppvObj = This;
    156     }
    157     else if(IsEqualIID(riid, &IID_IOleWindow))  /*IOleWindow*/
    158     { *ppvObj = (IOleWindow*)This;
    159     }
    160 
    161     else if(IsEqualIID(riid, &IID_IShellBrowser))  /*IShellBrowser*/
    162     { *ppvObj = (IShellBrowser*)This;
    163     }
    164 
    165     else if(IsEqualIID(riid, &IID_ICommDlgBrowser))  /*ICommDlgBrowser*/
    166     { *ppvObj = (ICommDlgBrowser*) &(This->lpVtbl2);
    167     }
    168 
    169     if(*ppvObj)
    170     { IUnknown_AddRef( (IShellBrowser*) *ppvObj);
    171       return S_OK;
    172     }
    173     return E_NOINTERFACE;
    174 }
    175 
    176 /**************************************************************************
    177 *  IShellBrowser::AddRef
    178 */
    179 ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface)
    180 {
    181     ICOM_THIS(IShellBrowserImpl, iface);
    182 
    183     TRACE("(%p)\n", This);
    184 
    185     return ++(This->ref);
    186 }
    187 
    188 /**************************************************************************
    189 *  IShellBrowserImpl_Release
    190 */
    191 ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface)
    192 {
    193     ICOM_THIS(IShellBrowserImpl, iface);
    194 
    195     TRACE("(%p)\n", This);
    196 
    197     if (!--(This->ref))
    198     {
    199       HeapFree(GetProcessHeap(),0, This);
    200       return 0;
    201     }
    202     return This->ref;
    203 }
    204 
    205 /*
    206  * IOleWindow
    207  */
    208 
    209 /**************************************************************************
    210 *  IShellBrowserImpl_GetWindow  (IOleWindow)
    211 *
    212 *  Inherited from IOleWindow::GetWindow
    213 *
    214 *  See Windows documentation for more details
    215 *
    216 *  Note : We will never be window less in the File Open dialog
    217 
    218 */
    219 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 
    220                                            HWND * phwnd)
    221 {
    222     ICOM_THIS(IShellBrowserImpl, iface);
    223 
    224     TRACE("(%p)\n", This);
    225 
    226     if(!This->hwndOwner)
    227         return E_FAIL;
    228 
    229     *phwnd = This->hwndOwner;
    230 
    231     return (*phwnd) ? S_OK : E_UNEXPECTED;
    232 
    233 }
    234 
    235 /**************************************************************************
    236 *  IShellBrowserImpl_ContextSensitiveHelp
    237 */
    238 HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser * iface,
    239                                                       BOOL fEnterMode)
    240 {
    241     ICOM_THIS(IShellBrowserImpl, iface);
    242 
    243     TRACE("(%p)\n", This);
    244 
    245     /* Feature not implemented */
    246     return E_NOTIMPL;
    247 }
    248 
    249 /*
    250  * IShellBrowser
    251  */
    252 
    253 /**************************************************************************
    254 *  IShellBrowserImpl_BrowseObject
    255 *
    256 *  See Windows documentation on IShellBrowser::BrowseObject for more details
    257 *
    258 *  This function will override user specified flags and will always
    259 *  use SBSP_DEFBROWSER and SBSP_DEFMODE. 
    260 */
    261 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
    262                                               LPCITEMIDLIST pidl,
    263                                               UINT wFlags)
    264 {
    265     HRESULT hRes;
    266     IShellFolder *psfTmp;
    267     IShellView *psvTmp;
    268     FileOpenDlgInfos *fodInfos;
    269     LPITEMIDLIST pidlTmp;
    270     HWND hwndView;
    271     HWND hDlgWnd;
    272     BOOL bViewHasFocus;
    273 
    274     ICOM_THIS(IShellBrowserImpl, iface);
    275 
    276     TRACE("(%p)(%p,0x%08x)\n", This, pidl, wFlags);
    277 
    278     fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
    279 
    280     /* Format the pidl according to its parameter's category */
    281     if(wFlags & SBSP_RELATIVE)
    282     {
    283        
    284         /* SBSP_RELATIVE  A relative pidl (relative from the current folder) */
    285         if(FAILED(hRes = IShellFolder_BindToObject(fodInfos->Shell.FOIShellFolder,
    286              pidl, NULL, &IID_IShellFolder, (LPVOID *)&psfTmp)))
    287         {
    288             ERR("bind to object failed\n");
    289             return hRes;
    290         }
    291         /* create an absolute pidl */
    292         pidlTmp = COMDLG32_PIDL_ILCombine(fodInfos->ShellInfos.pidlAbsCurrent,
    293                                                         (LPITEMIDLIST)pidl);
    294     }
    295     else if(wFlags & SBSP_PARENT)
    296     {
    297         /* Browse the parent folder (ignores the pidl) */
    298         pidlTmp = GetParentPidl(fodInfos->ShellInfos.pidlAbsCurrent);
    299         psfTmp = GetShellFolderFromPidl(pidlTmp);
    300 
    301     }
    302     else /* SBSP_ABSOLUTE is 0x0000 */
    303     {
    304         /* An absolute pidl (relative from the desktop) */
    305         pidlTmp =  COMDLG32_PIDL_ILClone((LPITEMIDLIST)pidl);
    306         psfTmp = GetShellFolderFromPidl(pidlTmp);
    307     }
    308    
    309     if(!psfTmp) return E_FAIL;
    310 
    311     /* If the pidl to browse to is equal to the actual pidl ...
    312        do nothing and pretend you did it*/
    313     if(COMDLG32_PIDL_ILIsEqual(pidlTmp,fodInfos->ShellInfos.pidlAbsCurrent))
    314     {
    315         IShellFolder_Release(psfTmp);
    316         COMDLG32_SHFree(pidlTmp);
    317         return NOERROR;
    318     }
    319 
    320     /* Release the current DataObject */
    321     if (fodInfos->Shell.FOIDataObject)
    322     {
    323       IDataObject_Release(fodInfos->Shell.FOIDataObject);
    324       fodInfos->Shell.FOIDataObject = NULL;
    325     }
    326 
    327     /* Create the associated view */
    328     if(FAILED(hRes = IShellFolder_CreateViewObject(psfTmp, fodInfos->ShellInfos.hwndOwner,
    329            &IID_IShellView, (LPVOID *)&psvTmp))) return hRes;
    330 
    331     /* Check if listview has focus */
    332     bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus());
    333 
    334     /* Get the foldersettings from the old view */
    335     if(fodInfos->Shell.FOIShellView)
    336       IShellView_GetCurrentInfo(fodInfos->Shell.FOIShellView, &fodInfos->ShellInfos.folderSettings);
    337 
    338     /* Release the old fodInfos->Shell.FOIShellView and update its value.
    339     We have to update this early since ShellView_CreateViewWindow of native
    340     shell32 calls OnStateChange and needs the correct view here.*/
    341     if(fodInfos->Shell.FOIShellView)
    342     {
    343       IShellView_DestroyViewWindow(fodInfos->Shell.FOIShellView);
    344       IShellView_Release(fodInfos->Shell.FOIShellView);
    345     }
    346     fodInfos->Shell.FOIShellView = psvTmp;
    347 
    348     /* Release old FOIShellFolder and update its value */
    349     if (fodInfos->Shell.FOIShellFolder)
    350       IShellFolder_Release(fodInfos->Shell.FOIShellFolder);
    351     fodInfos->Shell.FOIShellFolder = psfTmp;
    352 
    353     /* Release old pidlAbsCurrent and update its value */
    354     COMDLG32_SHFree((LPVOID)fodInfos->ShellInfos.pidlAbsCurrent);
    355     fodInfos->ShellInfos.pidlAbsCurrent = pidlTmp;
    356 
    357     /* Create the window */
    358     TRACE("create view window\n");
    359     if(FAILED(hRes = IShellView_CreateViewWindow(psvTmp, NULL,
    360          &fodInfos->ShellInfos.folderSettings, fodInfos->Shell.FOIShellBrowser,
    361          &fodInfos->ShellInfos.rectView, &hwndView))) return hRes;
    362 
    363     fodInfos->ShellInfos.hwndView = hwndView;
    364 
    365     /* Select the new folder in the Look In combo box of the Open file dialog */
    366     FILEDLG95_LOOKIN_SelectItem(fodInfos->DlgInfos.hwndLookInCB,fodInfos->ShellInfos.pidlAbsCurrent);
    367 
    368     /* changes the tab order of the ListView to reflect the window's File Dialog */
    369     hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN);
    370     SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
    371 
    372     /* Since we destroyed the old view if it had focus set focus to the newly created view */
    373     if (bViewHasFocus)
    374       SetFocus(fodInfos->ShellInfos.hwndView);
    375 
    376     return hRes;
    377 }
    378 
    379 /**************************************************************************
    380 *  IShellBrowserImpl_EnableModelessSB
    381 */
    382 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,   
    383                                               BOOL fEnable)
    384                                              
    385 {
    386     ICOM_THIS(IShellBrowserImpl, iface);
    387 
    388     TRACE("(%p)\n", This);
    389 
    390     /* Feature not implemented */
    391     return E_NOTIMPL;
    392 }
    393 
    394 /**************************************************************************
    395 *  IShellBrowserImpl_GetControlWindow
    396 */
    397 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,   
    398                                               UINT id,   
    399                                               HWND *lphwnd)
    400                                              
    401 {
    402     ICOM_THIS(IShellBrowserImpl, iface);
    403 
    404     TRACE("(%p)\n", This);
    405 
    406     /* Feature not implemented */
    407     return E_NOTIMPL;
    408 }
    409 /**************************************************************************
    410 *  IShellBrowserImpl_GetViewStateStream
    411 */
    412 HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
    413                                                 DWORD grfMode,   
    414                                                 LPSTREAM *ppStrm)
    415                                              
    416 {
    417     ICOM_THIS(IShellBrowserImpl, iface);
    418 
    419     TRACE("(%p)\n", This);
    420 
    421     /* Feature not implemented */
    422     return E_NOTIMPL;
    423 }       
    424 /**************************************************************************
    425 *  IShellBrowserImpl_InsertMenusSB
    426 */
    427 HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
    428                                            HMENU hmenuShared,
    429                                            LPOLEMENUGROUPWIDTHS lpMenuWidths)
    430                                              
    431 {
    432     ICOM_THIS(IShellBrowserImpl, iface);
    433 
    434     TRACE("(%p)\n", This);
    435 
    436     /* Feature not implemented */
    437     return E_NOTIMPL;
    438 }
    439 /**************************************************************************
    440 *  IShellBrowserImpl_OnViewWindowActive
    441 */
    442 HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
    443                                                 IShellView *ppshv)
    444                                              
    445 {
    446     ICOM_THIS(IShellBrowserImpl, iface);
    447 
    448     TRACE("(%p)\n", This);
    449 
    450     /* Feature not implemented */
    451     return E_NOTIMPL;
    452 }   
    453 /**************************************************************************
    454 *  IShellBrowserImpl_QueryActiveShellView
    455 */
    456 HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
    457                                                   IShellView **ppshv)
    458                                              
    459 {
    460     ICOM_THIS(IShellBrowserImpl, iface);
    461 
    462     FileOpenDlgInfos *fodInfos;
    463 
    464     TRACE("(%p)\n", This);
    465 
    466     fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr);
    467 
    468     if(!(*ppshv = fodInfos->Shell.FOIShellView))
    469     {
    470         return E_FAIL;
    471     }
    472     IShellView_AddRef(fodInfos->Shell.FOIShellView);
    473     return NOERROR;
    474 }   
    475 /**************************************************************************
    476 *  IShellBrowserImpl_RemoveMenusSB
    477 */
    478 HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
    479                                            HMENU hmenuShared)
    480                                              
    481 {
    482     ICOM_THIS(IShellBrowserImpl, iface);
    483 
    484     TRACE("(%p)\n", This);
    485 
    486     /* Feature not implemented */
    487     return E_NOTIMPL;
    488 }   
    489 /**************************************************************************
    490 *  IShellBrowserImpl_SendControlMsg
    491 */
    492 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,   
    493                                             UINT id,   
    494                                             UINT uMsg,   
    495                                             WPARAM wParam,   
    496                                             LPARAM lParam,
    497                                             LRESULT *pret)
    498                                              
    499 {
    500     ICOM_THIS(IShellBrowserImpl, iface);
    501     LRESULT lres;
    502    
    503     TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);
    504 
    505     switch (id)
    506     {
    507       case FCW_TOOLBAR:
    508         lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam);
    509         break;
    510       default:
    511         FIXME("ctrl id: %x\n", id);
    512         return E_NOTIMPL;
    513     }
    514     if (pret) *pret = lres;
    515     return S_OK;
    516 }
    517 /**************************************************************************
    518 *  IShellBrowserImpl_SetMenuSB
    519 */
    520 HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
    521                                        HMENU hmenuShared,   
    522                                        HOLEMENU holemenuReserved,
    523                                        HWND hwndActiveObject)
    524                                              
    525 {
    526     ICOM_THIS(IShellBrowserImpl, iface);
    527 
    528     TRACE("(%p)\n", This);
    529 
    530     /* Feature not implemented */
    531     return E_NOTIMPL;
    532 }   
    533 /**************************************************************************
    534 *  IShellBrowserImpl_SetStatusTextSB
    535 */
    536 HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
    537                                              LPCOLESTR lpszStatusText)
    538                                              
    539 {
    540     ICOM_THIS(IShellBrowserImpl, iface);
    541 
    542     TRACE("(%p)\n", This);
    543 
    544     /* Feature not implemented */
    545     return E_NOTIMPL;
    546 }   
    547 /**************************************************************************
    548 *  IShellBrowserImpl_SetToolbarItems
    549 */
    550 HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
    551                                              LPTBBUTTON lpButtons,   
    552                                              UINT nButtons,   
    553                                              UINT uFlags)
    554                                              
    555 {
    556     ICOM_THIS(IShellBrowserImpl, iface);
    557 
    558     TRACE("(%p)\n", This);
    559 
    560     /* Feature not implemented */
    561     return E_NOTIMPL;
    562 }   
    563 /**************************************************************************
    564 *  IShellBrowserImpl_TranslateAcceleratorSB
    565 */
    566 HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
    567                                                     LPMSG lpmsg,   
    568                                                     WORD wID)
    569                                              
    570 {
    571     ICOM_THIS(IShellBrowserImpl, iface);
    572 
    573     TRACE("(%p)\n", This);
    574 
    575     /* Feature not implemented */
    576     return E_NOTIMPL;
    577 }
     630
    578631
    579632/*
     
    584637*  IShellBrowserImpl_ICommDlgBrowser_QueryInterface
    585638*/
    586 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(ICommDlgBrowser *iface,
    587                                             REFIID riid,
    588                                             LPVOID *ppvObj)
     639HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(
     640        ICommDlgBrowser *iface,
     641        REFIID riid,
     642        LPVOID *ppvObj)
    589643{
    590644    _ICOM_THIS_FromICommDlgBrowser(IShellBrowser,iface);
     
    700754}
    701755
    702 /* copied from shell32 to avoid linking to it */
    703 static HRESULT COMDLG32_StrRetToStrNW (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST pidl)
    704 {
    705         TRACE("dest=0x%p len=0x%lx strret=0x%p pidl=%p stub\n",dest,len,src,pidl);
    706 
    707         switch (src->uType)
    708         {
    709           case STRRET_WSTR:
    710             lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
    711             COMDLG32_SHFree(src->u.pOleStr);
    712             break;
    713 
    714           case STRRET_CSTRA:
    715             lstrcpynAtoW((LPWSTR)dest, src->u.cStr, len);
    716             break;
    717 
    718           case STRRET_OFFSETA:
    719             if (pidl)
    720             {
    721               lstrcpynAtoW((LPWSTR)dest, ((LPCSTR)&pidl->mkid)+src->u.uOffset, len);
    722             }
    723             break;
    724 
    725           default:
    726             FIXME("unknown type!\n");
    727             if (len)
    728             { *(LPSTR)dest = '\0';
    729             }
    730             return(FALSE);
    731         }
    732         return S_OK;
    733 }
    734756/**************************************************************************
    735757*  IShellBrowserImpl_ICommDlgBrowser_IncludeObject
     
    804826}
    805827
     828static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl =
     829{
     830        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     831        /* IUnknown */
     832        IShellBrowserImpl_ICommDlgBrowser_QueryInterface,
     833        IShellBrowserImpl_ICommDlgBrowser_AddRef,
     834        IShellBrowserImpl_ICommDlgBrowser_Release,
     835        /* ICommDlgBrowser */
     836        IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand,
     837        IShellBrowserImpl_ICommDlgBrowser_OnStateChange,
     838        IShellBrowserImpl_ICommDlgBrowser_IncludeObject
     839};
     840
     841
     842
     843
     844/*
     845 * IServiceProvider
     846 */
     847
     848/***************************************************************************
     849*  IShellBrowserImpl_IServiceProvider_QueryInterface
     850*/
     851HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryInterface(
     852        IServiceProvider *iface,
     853        REFIID riid,
     854        LPVOID *ppvObj)
     855{
     856    _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
     857
     858    FIXME("(%p)\n", This);
     859
     860    return IShellBrowserImpl_QueryInterface(This,riid,ppvObj);
     861}
     862
     863/**************************************************************************
     864*  IShellBrowserImpl_IServiceProvider_AddRef
     865*/
     866ULONG WINAPI IShellBrowserImpl_IServiceProvider_AddRef(IServiceProvider * iface)
     867{
     868    _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
     869
     870    FIXME("(%p)\n", This);
     871
     872    return IShellBrowserImpl_AddRef(This);
     873}
     874
     875/**************************************************************************
     876*  IShellBrowserImpl_IServiceProvider_Release
     877*/
     878ULONG WINAPI IShellBrowserImpl_IServiceProvider_Release(IServiceProvider * iface)
     879{
     880    _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
     881
     882    FIXME("(%p)\n", This);
     883
     884    return IShellBrowserImpl_Release(This);
     885}
     886
     887/**************************************************************************
     888*  IShellBrowserImpl_IServiceProvider_Release
     889*
     890* NOTES
     891*  the w2k shellview asks for
     892*   guidService = SID_STopLevelBrowser
     893*   riid = IShellBrowser
     894*
     895* FIXME
     896*  this is a hack!
     897*/
     898
     899HRESULT WINAPI IShellBrowserImpl_IServiceProvider_QueryService(
     900        IServiceProvider * iface,
     901        REFGUID guidService,
     902        REFIID riid,
     903        void** ppv)
     904{
     905    _ICOM_THIS_FromIServiceProvider(IShellBrowser,iface);
     906
     907#ifndef __WIN32OS2__
     908    FIXME("(%p)\n\t%s\n\t%s\n", This,debugstr_guid(guidService), debugstr_guid(riid) );
     909#endif
     910
     911    *ppv = NULL;
     912    if(guidService && IsEqualIID(guidService, &SID_STopLevelBrowser))
     913    {
     914      return IShellBrowserImpl_QueryInterface(This,riid,ppv);
     915    }
     916    FIXME("(%p) unknown interface requested\n", This);
     917    return E_NOINTERFACE;
     918
     919}
     920
     921static ICOM_VTABLE(IServiceProvider) IShellBrowserImpl_IServiceProvider_Vtbl =
     922{
     923        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     924        /* IUnknown */
     925        IShellBrowserImpl_IServiceProvider_QueryInterface,
     926        IShellBrowserImpl_IServiceProvider_AddRef,
     927        IShellBrowserImpl_IServiceProvider_Release,
     928        /* IServiceProvider */
     929        IShellBrowserImpl_IServiceProvider_QueryService
     930};
  • trunk/src/comdlg32/filedlgbrowser.h

    r4511 r4561  
    1616 * Defines and global variables
    1717 */
    18 #define _ICOM_THIS_FromICommDlgBrowser(Class,name) Class* This = (Class*) (((char*)name)-sizeof(void *))
     18#define _ICommDlgBrowser_Offset ((int)(&(((IShellBrowserImpl*)0)->lpVtblCommDlgBrowser)))
     19#define _ICOM_THIS_FromICommDlgBrowser(class, name) class* This = (class*)(((char*)name)-_ICommDlgBrowser_Offset);
     20
     21#define _IServiceProvider_Offset ((int)(&(((IShellBrowserImpl*)0)->lpVtblServiceProvider)))
     22#define _ICOM_THIS_FromIServiceProvider(class, name) class* This = (class*)(((char*)name)-_IServiceProvider_Offset);
    1923
    2024/* dialog internal property */
     
    2832 */
    2933
    30 
    31 typedef struct
    32 {
    33 
    34     ICOM_VTABLE(IShellBrowser)* lpVtbl;         /* IShellBrowser VTable */
    35     ICOM_VTABLE(ICommDlgBrowser)* lpVtbl2;      /* ICommDlgBrowser VTable */
    36     DWORD ref;                                  /* Reference counter */
    37     HWND hwndOwner;                             /* Owner dialog of the interface */
    38 
    39 } IShellBrowserImpl;
    4034
    4135typedef struct
     
    6761        DWORD dwDlgProp;
    6862    } DlgInfos;
     63
     64    struct {
     65        UINT fileokstring;
     66        UINT lbselchstring;
     67        UINT helpmsgstring;
     68        UINT sharevistring;
     69    } HookMsg;
    6970
    7071} FileOpenDlgInfos;
     
    125126IShellBrowser * IShellBrowserImpl_Construct(HWND hwndOwner);
    126127
    127 /* IUnknown */
    128 HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
    129                                             REFIID riid,
    130                                             LPVOID *ppvObj);
    131 
    132 ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface);
    133 
    134 ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface);
    135 
    136 /* IOleWindow */
    137 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 
    138                                            HWND * phwnd);
    139 
    140 HRESULT WINAPI IShellBrowserImpl_ContextSensitiveHelp(IShellBrowser * iface,
    141                                                       BOOL fEnterMode);
    142 
    143 /* IShellBrowser */
    144 
    145 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface,
    146                                           LPCITEMIDLIST pidl,   
    147                                           UINT wFlags);
    148 
    149 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface,   
    150                                               BOOL fEnable);
    151                                              
    152 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface,   
    153                                               UINT id,   
    154                                               HWND *lphwnd);
    155 
    156 HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface,
    157                                                 DWORD grfMode,   
    158                                                 LPSTREAM *ppStrm);
    159 
    160 HRESULT WINAPI IShellBrowserImpl_InsertMenusSB(IShellBrowser *iface,
    161                                            HMENU hmenuShared,
    162                                            LPOLEMENUGROUPWIDTHS lpMenuWidths);
    163 
    164 HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface,
    165                                                 IShellView *ppshv);
    166                                              
    167 
    168 HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface,
    169                                                   IShellView **ppshv);
    170 
    171 HRESULT WINAPI IShellBrowserImpl_RemoveMenusSB(IShellBrowser *iface,
    172                                            HMENU hmenuShared);
    173 
    174 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,   
    175                                             UINT id,   
    176                                             UINT uMsg,   
    177                                             WPARAM wParam,   
    178                                             LPARAM lParam,
    179                                             LRESULT *pret);
    180 
    181 HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface,
    182                                        HMENU hmenuShared,   
    183                                        HOLEMENU holemenuReserved,
    184                                        HWND hwndActiveObject);
    185 
    186 HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface,
    187                                              LPCOLESTR lpszStatusText);
    188                                                
    189 
    190 HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface,
    191                                              LPTBBUTTON lpButtons,   
    192                                              UINT nButtons,   
    193                                              UINT uFlags);
    194                                              
    195 HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface,
    196                                                     LPMSG lpmsg,   
    197                                                     WORD wID);
    198 
    199 
    200 /* ICommDlgBrowser */
    201 
    202 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(ICommDlgBrowser *iface,
    203                                             REFIID riid,
    204                                             LPVOID *ppvObj);
    205 
    206 ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_AddRef(ICommDlgBrowser * iface);
    207 
    208 ULONG WINAPI IShellBrowserImpl_ICommDlgBrowser_Release(ICommDlgBrowser * iface);
    209 
    210 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowser *iface,
    211                                                                   IShellView *ppshv);
    212 
    213 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnStateChange(ICommDlgBrowser *iface,
    214                                                                IShellView *ppshv,
    215                                                                ULONG uChange);
    216 
    217 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface,
    218                                                                IShellView * ppshv,
    219                                                                LPCITEMIDLIST pidl);
    220 
    221128
    222129LPITEMIDLIST GetPidlFromDataObject ( IDataObject *doSelected, UINT nPidlIndex);
  • trunk/src/shell32/shell32.def

    r4550 r4561  
    1 ; $Id: shell32.def,v 1.32 2000-11-02 09:52:18 sandervl Exp $
     1; $Id: shell32.def,v 1.33 2000-11-06 10:20:55 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    7575    IsNetDrive                        = _IsNetDrive@4                         @66
    7676    Shell_MergeMenus                  = _Shell_MergeMenus@24                  @67
    77     SHGetSettings                     = _SHGetSettings@12                     @68
     77    SHGetSetSettings                  = _SHGetSetSettings@12                  @68
    7878;   SHGetNetResource                  = _SHGetNetResource@?                   @69
    7979    SHCreateDefClassObject            = _SHCreateDefClassObject@20            @70
     
    377377    SHGetSpecialFolderPathA           = _SHGetSpecialFolderPathA@16           @690
    378378
     379    SHGetSettings                     = _SHGetSettings@12                     @691
     380
    379381;
    380382; version 5.00 (Win2K)
  • trunk/src/shell32/shelllink.c

    r4121 r4561  
    1 /* $Id: shelllink.c,v 1.1 2000-08-30 13:52:55 sandervl Exp $ */
     1/* $Id: shelllink.c,v 1.2 2000-11-06 10:20:56 sandervl Exp $ */
    22/*
    33 *
     
    1212
    1313#include <string.h>
     14#include <sys/stat.h>
     15#include <stdio.h>
     16#ifndef __WIN32OS2__
     17#include <unistd.h>
     18#endif
     19#include <errno.h>
     20#ifndef __WIN32OS2__
     21#include <sys/wait.h>
     22#endif
     23
    1424#include "debugtools.h"
    1525#include "winerror.h"
    16 
    17 #include "wine/obj_base.h"
    18 #include "wine/obj_storage.h"
    19 #include "wine/obj_shelllink.h"
     26#include "winbase.h"
     27#include "winnls.h"
     28
     29#include "shlobj.h"
     30#include "wine/winestring.h"
    2031#include "wine/undocshell.h"
     32#ifndef __WIN32OS2__
     33#include "bitmaps/wine.xpm"
     34#endif
    2135
    2236#include "heap.h"
    23 #include "winnls.h"
    2437#include "pidl.h"
    2538#include "shell32_main.h"
    2639#include "shlguid.h"
     40#include "file.h"
     41#include "options.h"
    2742
    2843DEFAULT_DEBUG_CHANNEL(shell);
     
    6378#define LINK_HEADER_SIZE (sizeof(LINK_HEADER)-sizeof(ITEMIDLIST))
    6479
     80typedef struct
     81{
     82        BYTE bWidth;
     83        BYTE bHeight;
     84        BYTE bColorCount;
     85        BYTE bReserved;
     86        WORD wPlanes;
     87        WORD wBitCount;
     88        DWORD dwBytesInRes;
     89        WORD nID;
     90} GRPICONDIRENTRY;
     91
     92typedef struct
     93{
     94        WORD idReserved;
     95        WORD idType;
     96        WORD idCount;
     97        GRPICONDIRENTRY idEntries[1];
     98} GRPICONDIR;
     99
     100typedef struct
     101{
     102        BYTE bWidth;
     103        BYTE bHeight;
     104        BYTE bColorCount;
     105        BYTE bReserved;
     106        WORD wPlanes;
     107        WORD wBitCount;
     108        DWORD dwBytesInRes;
     109        DWORD dwImageOffset;
     110} ICONDIRENTRY;
     111
     112typedef struct
     113{
     114        WORD idReserved;
     115        WORD idType;
     116        WORD idCount;
     117} ICONDIR;
     118
     119
    65120#include "poppack.h"
     121
    66122
    67123static ICOM_VTABLE(IShellLinkA)         slvt;
     
    92148        SYSTEMTIME      time3;
    93149
     150        LPSTR           sIcoPath;
     151        INT             iIcoNdx;
     152        LPSTR           sArgs;
     153        LPSTR           sWorkDir;
     154        LPSTR           sDescription;
    94155} IShellLinkImpl;
    95156
     
    179240}
    180241
     242
     243#ifndef __WIN32OS2__
     244/* Icon extraction routines
     245 *
     246 * FIXME: should use PrivateExtractIcons and friends
     247 * FIXME: should not use stdio
     248 */
     249
     250static BOOL SaveIconResAsXPM(const BITMAPINFO *pIcon, const char *szXPMFileName)
     251{
     252    FILE *fXPMFile;
     253    int nHeight;
     254    int nXORWidthBytes;
     255    int nANDWidthBytes;
     256    BOOL b8BitColors;
     257    int nColors;
     258    BYTE *pXOR;
     259    BYTE *pAND;
     260    BOOL aColorUsed[256] = {0};
     261    int nColorsUsed = 0;
     262    int i,j;
     263
     264    if (!((pIcon->bmiHeader.biBitCount == 4) || (pIcon->bmiHeader.biBitCount == 8)))
     265        return 0;
     266
     267    if (!(fXPMFile = fopen(szXPMFileName, "w")))
     268        return 0;
     269
     270    nHeight = pIcon->bmiHeader.biHeight / 2;
     271    nXORWidthBytes = 4 * ((pIcon->bmiHeader.biWidth * pIcon->bmiHeader.biBitCount / 32)
     272                          + ((pIcon->bmiHeader.biWidth * pIcon->bmiHeader.biBitCount % 32) > 0));
     273    nANDWidthBytes = 4 * ((pIcon->bmiHeader.biWidth / 32)
     274                          + ((pIcon->bmiHeader.biWidth % 32) > 0));
     275    b8BitColors = pIcon->bmiHeader.biBitCount == 8;
     276    nColors = pIcon->bmiHeader.biClrUsed ? pIcon->bmiHeader.biClrUsed
     277        : 1 << pIcon->bmiHeader.biBitCount;
     278    pXOR = (BYTE*) pIcon + sizeof (BITMAPINFOHEADER) + (nColors * sizeof (RGBQUAD));
     279    pAND = pXOR + nHeight * nXORWidthBytes;
     280
     281#define MASK(x,y) (pAND[(x) / 8 + (nHeight - (y) - 1) * nANDWidthBytes] & (1 << (7 - (x) % 8)))
     282#define COLOR(x,y) (b8BitColors ? pXOR[(x) + (nHeight - (y) - 1) * nXORWidthBytes] : (x) % 2 ? pXOR[(x) / 2 + (nHeight - (y) - 1) * nXORWidthBytes] & 0xF : (pXOR[(x) / 2 + (nHeight - (y) - 1) * nXORWidthBytes] & 0xF0) >> 4)
     283
     284    for (i = 0; i < nHeight; i++)
     285        for (j = 0; j < pIcon->bmiHeader.biWidth; j++)
     286            if (!aColorUsed[COLOR(j,i)] && !MASK(j,i))
     287            {
     288                aColorUsed[COLOR(j,i)] = TRUE;
     289                nColorsUsed++;
     290            }
     291
     292    if (fprintf(fXPMFile, "/* XPM */\nstatic char *icon[] = {\n") <= 0)
     293        goto error;
     294    if (fprintf(fXPMFile, "\"%d %d %d %d\",\n",
     295                (int) pIcon->bmiHeader.biWidth, nHeight, nColorsUsed + 1, 2) <=0)
     296        goto error;
     297
     298    for (i = 0; i < nColors; i++)
     299        if (aColorUsed[i])
     300            if (fprintf(fXPMFile, "\"%.2X c #%.2X%.2X%.2X\",\n", i, pIcon->bmiColors[i].rgbRed,
     301                        pIcon->bmiColors[i].rgbGreen, pIcon->bmiColors[i].rgbBlue) <= 0)
     302                goto error;
     303    if (fprintf(fXPMFile, "\"   c None\"") <= 0)
     304        goto error;
     305
     306    for (i = 0; i < nHeight; i++)
     307    {
     308        if (fprintf(fXPMFile, ",\n\"") <= 0)
     309            goto error;
     310        for (j = 0; j < pIcon->bmiHeader.biWidth; j++)
     311        {
     312            if MASK(j,i)
     313                {
     314                    if (fprintf(fXPMFile, "  ") <= 0)
     315                        goto error;
     316                }
     317            else
     318                if (fprintf(fXPMFile, "%.2X", COLOR(j,i)) <= 0)
     319                    goto error;
     320        }
     321        if (fprintf(fXPMFile, "\"") <= 0)
     322            goto error;
     323    }
     324    if (fprintf(fXPMFile, "};\n") <= 0)
     325        goto error;
     326
     327#undef MASK
     328#undef COLOR
     329
     330    fclose(fXPMFile);
     331    return 1;
     332
     333 error:
     334    fclose(fXPMFile);
     335    unlink( szXPMFileName );
     336    return 0;
     337}
     338
     339static BOOL CALLBACK EnumResNameProc(HANDLE hModule, const char *lpszType, char *lpszName, LONG lParam)
     340{
     341    *(HRSRC *) lParam = FindResourceA(hModule, lpszName, RT_GROUP_ICONA);
     342    return FALSE;
     343}
     344
     345static int ExtractFromEXEDLL(const char *szFileName, int nIndex, const char *szXPMFileName)
     346{
     347    HMODULE hModule;
     348    HRSRC hResInfo;
     349    char *lpName = NULL;
     350    HGLOBAL hResData;
     351    GRPICONDIR *pIconDir;
     352    BITMAPINFO *pIcon;
     353    int nMax = 0;
     354    int i;
     355
     356    if (!(hModule = LoadLibraryExA(szFileName, 0, LOAD_LIBRARY_AS_DATAFILE)))
     357        goto error1;
     358
     359    if (nIndex)
     360        hResInfo = FindResourceA(hModule, MAKEINTRESOURCEA(nIndex), RT_GROUP_ICONA);
     361    else
     362        if (EnumResourceNamesA(hModule, RT_GROUP_ICONA, &EnumResNameProc, (LONG) &hResInfo))
     363            goto error2;
     364
     365    if (!hResInfo)
     366        goto error2;
     367
     368    if (!(hResData = LoadResource(hModule, hResInfo)))
     369        goto error2;
     370    if (!(pIconDir = LockResource(hResData)))
     371        goto error3;
     372
     373    for (i = 0; i < pIconDir->idCount; i++)
     374        if ((pIconDir->idEntries[i].bHeight * pIconDir->idEntries[i].bWidth) > nMax)
     375        {
     376            lpName = MAKEINTRESOURCEA(pIconDir->idEntries[i].nID);
     377            nMax = pIconDir->idEntries[i].bHeight * pIconDir->idEntries[i].bWidth;
     378        }
     379
     380    FreeResource(hResData);
     381
     382    if (!(hResInfo = FindResourceA(hModule, lpName, RT_ICONA)))
     383        goto error2;
     384    if (!(hResData = LoadResource(hModule, hResInfo)))
     385        goto error2;
     386    if (!(pIcon = LockResource(hResData)))
     387        goto error3;
     388
     389    if(!SaveIconResAsXPM(pIcon, szXPMFileName))
     390        goto error3;
     391
     392    FreeResource(hResData);
     393    FreeLibrary(hModule);
     394
     395    return 1;
     396
     397 error3:
     398    FreeResource(hResData);
     399 error2:
     400    FreeLibrary(hModule);
     401 error1:
     402    return 0;
     403}
     404
     405static int ExtractFromICO(const char *szFileName, const char *szXPMFileName)
     406{
     407    FILE *fICOFile;
     408    ICONDIR iconDir;
     409    ICONDIRENTRY *pIconDirEntry;
     410    int nMax = 0;
     411    int nIndex = 0;
     412    void *pIcon;
     413    int i;
     414
     415    if (!(fICOFile = fopen(szFileName, "r")))
     416        goto error1;
     417
     418    if (fread(&iconDir, sizeof (ICONDIR), 1, fICOFile) != 1)
     419        goto error2;
     420    if ((iconDir.idReserved != 0) || (iconDir.idType != 1))
     421        goto error2;
     422
     423    if ((pIconDirEntry = malloc(iconDir.idCount * sizeof (ICONDIRENTRY))) == NULL)
     424        goto error2;
     425    if (fread(pIconDirEntry, sizeof (ICONDIRENTRY), iconDir.idCount, fICOFile) != iconDir.idCount)
     426        goto error3;
     427
     428    for (i = 0; i < iconDir.idCount; i++)
     429        if ((pIconDirEntry[i].bHeight * pIconDirEntry[i].bWidth) > nMax)
     430        {
     431            nIndex = i;
     432            nMax = pIconDirEntry[i].bHeight * pIconDirEntry[i].bWidth;
     433        }
     434    if ((pIcon = malloc(pIconDirEntry[nIndex].dwBytesInRes)) == NULL)
     435        goto error3;
     436    if (fseek(fICOFile, pIconDirEntry[nIndex].dwImageOffset, SEEK_SET))
     437        goto error4;
     438    if (fread(pIcon, pIconDirEntry[nIndex].dwBytesInRes, 1, fICOFile) != 1)
     439        goto error4;
     440
     441    if(!SaveIconResAsXPM(pIcon, szXPMFileName))
     442        goto error4;
     443
     444    free(pIcon);
     445    free(pIconDirEntry);
     446    fclose(fICOFile);
     447
     448    return 1;
     449
     450 error4:
     451    free(pIcon);
     452 error3:
     453    free(pIconDirEntry);
     454 error2:
     455    fclose(fICOFile);
     456 error1:
     457    return 0;
     458}
     459
     460/* get the Unix file name for a given path, allocating the string */
     461inline static char *get_unix_file_name( const char *dos )
     462{
     463    DOS_FULL_NAME path;
     464
     465    if (!DOSFS_GetFullName( dos, FALSE, &path )) return NULL;
     466    return HEAP_strdupA( GetProcessHeap(), 0, path.long_name );
     467}
     468
     469static BOOL create_default_icon( const char *filename )
     470{
     471    FILE *fXPM;
     472    int i;
     473
     474    if (!(fXPM = fopen(filename, "w"))) return FALSE;
     475    fprintf(fXPM, "/* XPM */\nstatic char * icon[] = {");
     476    for (i = 0; i < sizeof(wine_xpm)/sizeof(wine_xpm[0]); i++)
     477        fprintf( fXPM, "\n\"%s\",", wine_xpm[i]);
     478    fprintf( fXPM, "};\n" );
     479    fclose( fXPM );
     480    return TRUE;
     481}
     482
     483/* extract an icon from an exe or icon file; helper for IPersistFile_fnSave */
     484static char *extract_icon( const char *path, int index )
     485{
     486    char *filename = HEAP_strdupA( GetProcessHeap(), 0, tmpnam(NULL) );
     487    if (ExtractFromEXEDLL( path, index, filename )) return filename;
     488    if (ExtractFromICO( path, filename )) return filename;
     489    if (create_default_icon( filename )) return filename;
     490    HeapFree( GetProcessHeap(), 0, filename );
     491    return NULL;
     492}
     493#endif //#ifndef __WIN32OS2__
     494
     495
    181496static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFileName, BOOL fRemember)
    182497{
    183         _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
    184         FIXME("(%p)->(%s)\n",This,debugstr_w(pszFileName));
    185         return NOERROR;
    186 }
     498    HRESULT ret = NOERROR;
     499    int pid, status;
     500    char buffer[MAX_PATH], buff2[MAX_PATH];
     501    char *filename, *link_name, *p;
     502    char *shell_link_app = NULL;
     503    char *icon_name = NULL;
     504    char *path_name = NULL;
     505    char *work_dir = NULL;
     506    BOOL bDesktop;
     507
     508    _ICOM_THIS_From_IPersistFile(IShellLinkImpl, iface);
     509
     510    TRACE("(%p)->(%s)\n",This,debugstr_w(pszFileName));
     511
     512    if (!pszFileName || !This->sPath)
     513        return ERROR_UNKNOWN;
     514
     515    /* check for .exe extension */
     516    if (!(p = strrchr( This->sPath, '.' ))) return NOERROR;
     517    if (strchr( p, '\\' ) || strchr( p, '/' )) return NOERROR;
     518    if (strcasecmp( p, ".exe" )) return NOERROR;
     519
     520    /* check if ShellLinker configured */
     521#ifdef __WIN32OS2__
     522    return NOERROR;
     523#else
     524    PROFILE_GetWineIniString( "wine", "ShellLinker", "", buffer, sizeof(buffer) );
     525    if (!*buffer) return NOERROR;
     526    shell_link_app = HEAP_strdupA( GetProcessHeap(), 0, buffer );
     527
     528    if (!WideCharToMultiByte( CP_ACP, 0, pszFileName, -1, buffer, sizeof(buffer), NULL, NULL))
     529        return ERROR_UNKNOWN;
     530    GetFullPathNameA( buffer, sizeof(buff2), buff2, NULL );
     531    filename = HEAP_strdupA( GetProcessHeap(), 0, buff2 );
     532
     533    if (SHGetSpecialFolderPathA( 0, buffer, CSIDL_STARTUP, FALSE ))
     534    {
     535        /* ignore startup for now */
     536        if (!strncasecmp( filename, buffer, strlen(buffer) )) goto done;
     537    }
     538    if (SHGetSpecialFolderPathA( 0, buffer, CSIDL_DESKTOPDIRECTORY, FALSE ))
     539    {
     540        if (!strncasecmp( filename, buffer, strlen(buffer) ))
     541        {
     542            link_name = filename + strlen(buffer);
     543            bDesktop = TRUE;
     544            goto found;
     545        }
     546    }
     547    if (SHGetSpecialFolderPathA( 0, buffer, CSIDL_STARTMENU, FALSE ))
     548    {
     549        if (!strncasecmp( filename, buffer, strlen(buffer) ))
     550        {
     551            link_name = filename + strlen(buffer);
     552            bDesktop = FALSE;
     553            goto found;
     554        }
     555    }
     556    goto done;
     557
     558 found:
     559    /* make link name a Unix name */
     560    for (p = link_name; *p; p++) if (*p == '\\') *p = '/';
     561    /* strip leading slashes */
     562    while (*link_name == '/') link_name++;
     563    /* remove extension */
     564    if ((p = strrchr( link_name, '.' ))) *p = 0;
     565
     566    /* convert app path name */
     567    path_name = get_unix_file_name( This->sPath );
     568
     569    /* convert app working dir */
     570    if (This->sWorkDir) work_dir = get_unix_file_name( This->sWorkDir );
     571
     572    /* extract the icon */
     573    if (!(icon_name = extract_icon( This->sIcoPath ? This->sIcoPath : This->sPath,
     574                                    This->iIcoNdx ))) goto done;
     575
     576    TRACE("linker app='%s' link='%s' mode=%s path='%s' args='%s' icon='%s' workdir='%s' descr='%s'\n",
     577        shell_link_app, link_name, bDesktop ? "desktop" : "menu", path_name,
     578        This->sArgs ? This->sArgs : "", icon_name, work_dir ? work_dir : "",
     579        This->sDescription ? This->sDescription : "" );
     580
     581    if ((pid = fork()) == -1) goto done;
     582    if (!pid)
     583    {
     584        int pos = 0;
     585        char *argv[20];
     586        argv[pos++] = shell_link_app;
     587        argv[pos++] = "--link";
     588        argv[pos++] = link_name;
     589        argv[pos++] = "--path";
     590        argv[pos++] = path_name;
     591        argv[pos++] = bDesktop ? "--desktop" : "--menu";
     592        if (This->sArgs)
     593        {
     594            argv[pos++] = "--args";
     595            argv[pos++] = This->sArgs;
     596        }
     597        if (icon_name)
     598        {
     599            argv[pos++] = "--icon";
     600            argv[pos++] = icon_name;
     601        }
     602        if (This->sWorkDir)
     603        {
     604            argv[pos++] = "--workdir";
     605            argv[pos++] = This->sWorkDir;
     606        }
     607        if (This->sDescription)
     608        {
     609            argv[pos++] = "--descr";
     610            argv[pos++] = This->sDescription;
     611        }
     612        argv[pos] = NULL;
     613        execvp( shell_link_app, argv );
     614        _exit(1);
     615    }
     616
     617    while (waitpid( pid, &status, 0 ) == -1)
     618    {
     619        if (errno != EINTR)
     620        {
     621            ret = ERROR_UNKNOWN;
     622            goto done;
     623        }
     624    }
     625    if (status) ret = E_ACCESSDENIED;
     626
     627 done:
     628    if (icon_name) unlink( icon_name );
     629    HeapFree( GetProcessHeap(), 0, shell_link_app );
     630    HeapFree( GetProcessHeap(), 0, filename );
     631    HeapFree( GetProcessHeap(), 0, icon_name );
     632    HeapFree( GetProcessHeap(), 0, path_name );
     633    HeapFree( GetProcessHeap(), 0, work_dir );
     634    return ret;
     635#endif //__WIN32OS2__
     636}
     637
    187638static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile* iface, LPCOLESTR pszFileName)
    188639{
     
    481932        if (!--(This->ref))
    482933        { TRACE("-- destroying IShellLink(%p)\n",This);
     934       
     935          if (This->sIcoPath)
     936            HeapFree(GetProcessHeap(), 0, This->sIcoPath);
     937           
     938          if (This->sArgs)
     939            HeapFree(GetProcessHeap(), 0, This->sArgs);
     940
     941          if (This->sWorkDir)
     942            HeapFree(GetProcessHeap(), 0, This->sWorkDir);
     943           
     944          if (This->sDescription)
     945            HeapFree(GetProcessHeap(), 0, This->sDescription);
    483946
    484947          if (This->sPath)
     
    490953          if (This->lpFileStream)
    491954            IStream_Release(This->lpFileStream);
     955       
     956          This->iIcoNdx = 0;
    492957
    493958          HeapFree(GetProcessHeap(),0,This);
     
    5421007        ICOM_THIS(IShellLinkImpl, iface);
    5431008       
    544         FIXME("(%p)->(desc=%s)\n",This, pszName);
     1009        TRACE("(%p)->(pName=%s)\n", This, pszName);
     1010
     1011        if (This->sDescription)
     1012            HeapFree(GetProcessHeap(), 0, This->sDescription);
     1013        if (!(This->sDescription = HEAP_strdupA(GetProcessHeap(), 0, pszName)))
     1014            return E_OUTOFMEMORY;
     1015
    5451016        return NOERROR;
    5461017}
     
    5571028        ICOM_THIS(IShellLinkImpl, iface);
    5581029       
    559         FIXME("(%p)->(dir=%s)\n",This, pszDir);
     1030        TRACE("(%p)->(dir=%s)\n",This, pszDir);
     1031
     1032        if (This->sWorkDir)
     1033            HeapFree(GetProcessHeap(), 0, This->sWorkDir);
     1034        if (!(This->sWorkDir = HEAP_strdupA(GetProcessHeap(), 0, pszDir)))
     1035            return E_OUTOFMEMORY;
     1036
    5601037        return NOERROR;
    5611038}
     
    5721049        ICOM_THIS(IShellLinkImpl, iface);
    5731050       
    574         FIXME("(%p)->(args=%s)\n",This, pszArgs);
     1051        TRACE("(%p)->(args=%s)\n",This, pszArgs);
     1052
     1053        if (This->sArgs)
     1054            HeapFree(GetProcessHeap(), 0, This->sArgs);
     1055        if (!(This->sArgs = HEAP_strdupA(GetProcessHeap(), 0, pszArgs)))
     1056            return E_OUTOFMEMORY;
    5751057
    5761058        return NOERROR;
     
    6241106        ICOM_THIS(IShellLinkImpl, iface);
    6251107       
    626         FIXME("(%p)->(path=%s iicon=%u)\n",This, pszIconPath, iIcon);
     1108        TRACE("(%p)->(path=%s iicon=%u)\n",This, pszIconPath, iIcon);
     1109       
     1110        if (This->sIcoPath)
     1111            HeapFree(GetProcessHeap(), 0, This->sIcoPath);
     1112        if (!(This->sIcoPath = HEAP_strdupA(GetProcessHeap(), 0, pszIconPath)))
     1113            return E_OUTOFMEMORY;       
     1114        This->iIcoNdx = iIcon;
     1115       
    6271116        return NOERROR;
    6281117}
     
    6451134        ICOM_THIS(IShellLinkImpl, iface);
    6461135       
    647         FIXME("(%p)->(path=%s)\n",This, pszFile);
     1136        TRACE("(%p)->(path=%s)\n",This, pszFile);
     1137
     1138        if (This->sPath)
     1139            HeapFree(GetProcessHeap(), 0, This->sPath);
     1140        if (!(This->sPath = HEAP_strdupA(GetProcessHeap(), 0, pszFile)))
     1141            return E_OUTOFMEMORY;
     1142       
    6481143        return NOERROR;
    6491144}
     
    7541249        _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
    7551250       
    756         FIXME("(%p)->(desc=%s)\n",This, debugstr_w(pszName));
     1251        TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName));
     1252
     1253        if (This->sDescription)
     1254            HeapFree(GetProcessHeap(), 0, This->sDescription);
     1255        if (!(This->sDescription = HEAP_strdupWtoA(GetProcessHeap(), 0, pszName)))
     1256            return E_OUTOFMEMORY;
     1257               
    7571258        return NOERROR;
    7581259}
     
    7711272        _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
    7721273       
    773         FIXME("(%p)->(dir=%s)\n",This, debugstr_w(pszDir));
     1274        TRACE("(%p)->(dir=%s)\n",This, debugstr_w(pszDir));
     1275
     1276        if (This->sWorkDir)
     1277            HeapFree(GetProcessHeap(), 0, This->sWorkDir);
     1278        if (!(This->sWorkDir = HEAP_strdupWtoA(GetProcessHeap(), 0, pszDir)))
     1279            return E_OUTOFMEMORY;
     1280
    7741281        return NOERROR;
    7751282}
     
    7881295        _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
    7891296       
    790         FIXME("(%p)->(args=%s)\n",This, debugstr_w(pszArgs));
     1297        TRACE("(%p)->(args=%s)\n",This, debugstr_w(pszArgs));
     1298       
     1299        if (This->sArgs)
     1300            HeapFree(GetProcessHeap(), 0, This->sArgs);
     1301        if (!(This->sArgs = HEAP_strdupWtoA(GetProcessHeap(), 0, pszArgs)))
     1302            return E_OUTOFMEMORY;
     1303       
    7911304        return NOERROR;
    7921305}
     
    8401353        _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
    8411354       
    842         FIXME("(%p)->(path=%s iicon=%u)\n",This, debugstr_w(pszIconPath), iIcon);
     1355        TRACE("(%p)->(path=%s iicon=%u)\n",This, debugstr_w(pszIconPath), iIcon);
     1356
     1357        if (This->sIcoPath)
     1358            HeapFree(GetProcessHeap(), 0, This->sIcoPath);
     1359        if (!(This->sIcoPath = HEAP_strdupWtoA(GetProcessHeap(), 0, pszIconPath)))
     1360            return E_OUTOFMEMORY;       
     1361        This->iIcoNdx = iIcon;
     1362
    8431363        return NOERROR;
    8441364}
     
    8641384        _ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
    8651385       
    866         FIXME("(%p)->(path=%s)\n",This, debugstr_w(pszFile));
     1386        TRACE("(%p)->(path=%s)\n",This, debugstr_w(pszFile));
     1387       
     1388        if (This->sPath)
     1389            HeapFree(GetProcessHeap(), 0, This->sPath);
     1390        if (!(This->sPath = HEAP_strdupWtoA(GetProcessHeap(), 0, pszFile)))
     1391            return E_OUTOFMEMORY;       
     1392       
    8671393        return NOERROR;
    8681394}
  • trunk/src/shell32/shellord.c

    r4121 r4561  
    1 /* $Id: shellord.c,v 1.1 2000-08-30 13:52:56 sandervl Exp $ */
     1/* $Id: shellord.c,v 1.2 2000-11-06 10:20:56 sandervl Exp $ */
    22/*
    33 * The parameters of many functions changes between different OS versions
     
    109109
    110110/*************************************************************************
    111  * SHGetSettings                                [SHELL32.68]
     111 * SHGetSetSettings                             [SHELL32.68]
     112 */
     113VOID WINAPI SHGetSetSettings(DWORD x, DWORD y, DWORD z)
     114{
     115        FIXME("0x%08lx 0x%08lx 0x%08lx\n", x, y, z);
     116}
     117
     118/*************************************************************************
     119 * SHGetSettings                                [SHELL32.@]
    112120 *
    113121 * NOTES
  • trunk/src/shell32/shellpath.c

    r4121 r4561  
    1 /* $Id: shellpath.c,v 1.2 2000-08-30 13:51:02 sandervl Exp $ */
     1/* $Id: shellpath.c,v 1.3 2000-11-06 10:20:56 sandervl Exp $ */
    22/*
    33 * Path Functions
     
    1010#include <odin.h>
    1111#endif
     12
    1213#include <string.h>
    1314#include <ctype.h>
     
    2021#include "windef.h"
    2122#include "options.h"
     23#include "wine/winestring.h"
    2224#include "wine/undocshell.h"
    2325#include "wine/unicode.h"
     
    481483    return TRUE;
    482484}
     485
    483486#ifdef __WIN32OS2__
    484487/*************************************************************************
     
    758761            hRootKey = HKEY_CURRENT_USER;
    759762            strcpy(szValueName, "Programs");
    760             strcpy(szDefaultPath, "StartMenu\\Programs");
     763            strcpy(szDefaultPath, "Start Menu\\Programs");
    761764            break;
    762765
     
    781784          case CSIDL_STARTMENU:
    782785            hRootKey = HKEY_CURRENT_USER;
    783             strcpy(szValueName, "StartMenu");
    784             strcpy(szDefaultPath, "StartMenu");
     786            strcpy(szValueName, "Start Menu");
     787            strcpy(szDefaultPath, "Start Menu");
    785788            break;
    786789
    787790          case CSIDL_COMMON_STARTMENU:
    788791            hRootKey = HKEY_LOCAL_MACHINE;
    789             strcpy(szValueName, "Common StartMenu");
    790             strcpy(szDefaultPath, "StartMenu");
     792            strcpy(szValueName, "Common Start Menu");
     793            strcpy(szDefaultPath, "Start Menu");
    791794            break;
    792795
    793796          case CSIDL_STARTUP:
    794797            hRootKey = HKEY_CURRENT_USER;
    795             strcpy(szValueName, "Startup");
    796             strcpy(szDefaultPath, "StartMenu\\Programs\\Startup");
     798            strcpy(szValueName, "StartUp");
     799            strcpy(szDefaultPath, "Start Menu\\Programs\\StartUp");
    797800            break;
    798801
    799802          case CSIDL_COMMON_STARTUP:
    800803            hRootKey = HKEY_LOCAL_MACHINE;
    801             strcpy(szValueName, "Common Startup");
    802             strcpy(szDefaultPath, "StartMenu\\Programs\\Startup");
     804            strcpy(szValueName, "Common StartUp");
     805            strcpy(szDefaultPath, "Start Menu\\Programs\\StartUp");
    803806            break;
    804807
Note: See TracChangeset for help on using the changeset viewer.