Changeset 3243 for trunk/src/comdlg32
- Timestamp:
- Mar 26, 2000, 6:34:57 PM (26 years ago)
- Location:
- trunk/src/comdlg32
- Files:
-
- 8 edited
-
cdlg_En.orc (modified) (6 diffs)
-
cdlg_xx.orc (modified) (4 diffs)
-
filedlg95.c (modified) (68 diffs)
-
filedlgbrowser.c (modified) (11 diffs)
-
filedlgbrowser.h (modified) (16 diffs)
-
filetitle.c (modified) (3 diffs)
-
finddlg32.cpp (modified) (11 diffs)
-
rsrc.orc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/cdlg_En.orc
r3031 r3243 1 /* $Id: cdlg_En.orc,v 1.2 2000-03-26 16:31:39 cbratschi Exp $ */ 1 2 LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT 3 4 /* Corel WINE 20000324 level */ 2 5 3 6 OPEN_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134 … … 108 111 COMBOBOX 1138,179,13,32,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL | 109 112 WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE | CBS_SORT 110 DEFPUSHBUTTON "OK",IDOK,218,6,40,14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON 113 DEFPUSHBUTTON "OK",IDOK,218,6,40,14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON 111 114 PUSHBUTTON "Cancel",IDCANCEL,218,23,40,14,WS_GROUP | WS_TABSTOP 112 115 PUSHBUTTON "&Apply", 1026,218,40,40,14,WS_GROUP | WS_TABSTOP 113 116 PUSHBUTTON "&Help" , 1038,218,57,40,14,WS_GROUP | WS_TABSTOP 114 117 GROUPBOX "Effects",1072,6,72,84,34,WS_GROUP 115 CHECKBOX "Stri&keout", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP116 CHECKBOX "&Underline", 1041, 10,94,50,10, BS_AUTOCHECKBOX118 CHECKBOX "Stri&keout", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP 119 CHECKBOX "&Underline", 1041, 10,94,50,10, BS_AUTOCHECKBOX 117 120 LTEXT "&Color:", 1091 ,6,110,30,9 118 121 COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | 119 CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP122 CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP 120 123 GROUPBOX "Sample",1073,98,72,160,49,WS_GROUP 121 124 CTEXT "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE … … 170 173 CONTROL "&Down", 1057, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 138, 38, 30, 12 171 174 172 DEFPUSHBUTTON "&Find Next", IDOK, 182, 5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON 173 PUSHBUTTON "Cancel", IDCANCEL , 182, 23, 50, 14, WS_GROUP | WS_TABSTOP174 PUSHBUTTON "&Help", pshHelp , 182, 45, 50, 14, WS_GROUP | WS_TABSTOP175 DEFPUSHBUTTON "&Find Next", IDOK, 182, 5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON 176 PUSHBUTTON "Cancel", IDCANCEL , 182, 23, 50, 14, WS_GROUP | WS_TABSTOP 177 PUSHBUTTON "&Help", pshHelp , 182, 45, 50, 14, WS_GROUP | WS_TABSTOP 175 178 } 176 179 … … 188 191 CHECKBOX "Match &Case", 1041, 5, 62, 59, 12, BS_AUTOCHECKBOX | WS_TABSTOP 189 192 190 DEFPUSHBUTTON "&Find Next", IDOK, 174, 4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON 191 PUSHBUTTON "&Replace", psh1 , 174, 21, 50, 14, WS_GROUP | WS_TABSTOP193 DEFPUSHBUTTON "&Find Next", IDOK, 174, 4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON 194 PUSHBUTTON "&Replace", psh1 , 174, 21, 50, 14, WS_GROUP | WS_TABSTOP 192 195 PUSHBUTTON "Replace &All", psh2 , 174, 38, 50, 14, WS_GROUP | WS_TABSTOP 193 PUSHBUTTON "Cancel", IDCANCEL , 174, 55, 50, 14, WS_GROUP | WS_TABSTOP194 PUSHBUTTON "&Help", pshHelp , 174, 75, 50, 14, WS_GROUP | WS_TABSTOP196 PUSHBUTTON "Cancel", IDCANCEL , 174, 55, 50, 14, WS_GROUP | WS_TABSTOP 197 PUSHBUTTON "&Help", pshHelp , 174, 75, 50, 14, WS_GROUP | WS_TABSTOP 195 198 } 196 199 … … 264 267 LTEXT "&Source:", stc3, 16,128, 36, 8 265 268 COMBOBOX cmb3, 52,126, 112,112,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP 266 269 267 270 GROUPBOX "Orientation", grp1, 180, 92, 100,56, WS_GROUP 268 271 ICON "", ico1, 195,112, 18,20, WS_GROUP … … 277 280 FONT 8, "helv" 278 281 { 279 LTEXT "Look &in",IDC_LOOKINSTATIC,7,6,41,8, SS_NOTIFY 280 COMBOBOX IDC_LOOKIN,50,3,138,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP 281 282 LTEXT "" , IDC_TOOLBARSTATIC, 188, 2, 82, 17, NOT WS_GROUP | NOT WS_VISIBLE 283 LISTBOX IDC_SHELLSTATIC,4,20,272,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE 284 285 LTEXT "File &name:",IDC_FILENAMESTATIC,5,112,46,8, SS_NOTIFY 286 EDITTEXT IDC_FILENAME,54,110,155,12,ES_AUTOHSCROLL 287 288 LTEXT "Files of &type",IDC_FILETYPESTATIC,5,128,42,8, SS_NOTIFY 289 COMBOBOX IDC_FILETYPE,54,126,155,53,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP 290 291 CONTROL "Open as &read-only",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,145,100,10 292 293 DEFPUSHBUTTON "&Open", IDOK,222,110,50,14 294 PUSHBUTTON "Cancel", IDCANCEL,222,128,50,14 295 PUSHBUTTON "&Help", pshHelp,222,145,50,14 296 } 297 298 STRINGTABLE DISCARDABLE 299 { 300 IDS_ABOUTBOX "&About FolderPicker Test" 301 IDS_DOCUMENTFOLDERS "Document Folders" 302 IDS_PERSONAL "My Documents" 303 IDS_FAVORITES "My Favorites" 304 IDS_PATH "System Path" 305 IDS_DESKTOP "Desktop" 306 IDS_FONTS "Fonts" 307 IDS_MYCOMPUTER "My Computer" 308 } 309 310 STRINGTABLE DISCARDABLE 311 { 312 IDS_SYSTEMFOLDERS "System Folders" 313 IDS_LOCALHARDRIVES "Local Hard Drives" 314 IDS_FILENOTFOUND "File not found" 282 LTEXT "Look &in",IDC_LOOKINSTATIC,7,6,41,8, SS_NOTIFY 283 COMBOBOX IDC_LOOKIN,50,3,138,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP 284 285 LTEXT "" , IDC_TOOLBARSTATIC, 188, 2, 82, 17, NOT WS_GROUP | NOT WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN 286 LISTBOX IDC_SHELLSTATIC,4,20,272,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN 287 288 LTEXT "File &name:",IDC_FILENAMESTATIC,5,112,46,8, SS_NOTIFY 289 EDITTEXT IDC_FILENAME,54,110,155,12,ES_AUTOHSCROLL 290 291 LTEXT "Files of &type",IDC_FILETYPESTATIC,5,128,42,8, SS_NOTIFY 292 COMBOBOX IDC_FILETYPE,54,126,155,53,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP 293 294 CONTROL "Open as &read-only",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,145,100,10 295 296 DEFPUSHBUTTON "&Open", IDOK,222,110,50,14 297 PUSHBUTTON "Cancel", IDCANCEL,222,128,50,14 298 PUSHBUTTON "&Help", pshHelp,222,145,50,14 299 } 300 301 STRINGTABLE DISCARDABLE 302 { 315 303 IDS_VERIFYFILE "Please verify if the correct file name was given" 316 304 IDS_CREATEFILE "File does not exist\nDo you want to create file" 317 } 318 305 IDS_CREATEFOLDER_DENIED "Unable to create the folder \"%s\"\n\nAccess is denied." 306 IDS_FILEOPEN_CAPTION "Open" 307 IDS_FILENOTFOUND "File Not Found" 308 } 309 310 STRINGTABLE DISCARDABLE 311 { 312 IDS_UPFOLDER "Up One Level" 313 IDS_NEWFOLDER "Create New Folder" 314 IDS_LISTVIEW "List" 315 IDS_REPORTVIEW "Details" 316 } 319 317 320 318 STRINGTABLE DISCARDABLE -
trunk/src/comdlg32/cdlg_xx.orc
r3031 r3243 1 /* $Id: cdlg_xx.orc,v 1.2 2000-03-26 16:31:40 cbratschi Exp $*/ 1 2 /* 2 3 * Language neutral resources for Common Dialogs 4 * 5 * Corel WINE 20000324 level 3 6 */ 4 7 … … 8 11 9 12 1 VERSIONINFO 10 FILEVERSION 4, 0, 0, 950/* Maybe 4.1.0.980 for win98?? */11 PRODUCTVERSION 4, 0, 0, 950/* id. */12 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK13 FILEOS VOS_DOS_WINDOWS1614 FILETYPE VFT_DLL13 FILEVERSION 4, 0, 0, 950 /* Maybe 4.1.0.980 for win98?? */ 14 PRODUCTVERSION 4, 0, 0, 950 /* id. */ 15 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 16 FILEOS VOS_DOS_WINDOWS16 17 FILETYPE VFT_DLL 15 18 { 16 BLOCK "StringFileInfo"17 {18 BLOCK "040604B0"19 {20 VALUE "CompanyName", "WineDeveloper Team\000"21 VALUE "FileDescription", "Common Dialog Boxes\000"22 VALUE "FileVersion", "4.00\000"23 VALUE "InternalName", "COMDLG32\000"24 VALUE "LegalCopyright", "Copyright \251 B. A. Stultiens 1998,1999\000"25 VALUE "OriginalFilename", "COMDLG32.DLL\000"26 VALUE "ProductName", "Wine\000"27 VALUE "ProductVersion", "4.00\000"28 }29 }30 31 /* Do we need this? It isn't a translation, but we have all languages at once... */19 BLOCK "StringFileInfo" 20 { 21 BLOCK "040604B0" 22 { 23 VALUE "CompanyName", "Odin Developer Team\000" 24 VALUE "FileDescription", "Common Dialog Boxes\000" 25 VALUE "FileVersion", "4.00\000" 26 VALUE "InternalName", "COMDLG32\000" 27 VALUE "LegalCopyright", "Copyright \251 B. A. Stultiens 1998,1999\000" 28 VALUE "OriginalFilename", "COMDLG32.DLL\000" 29 VALUE "ProductName", "Odin\000" 30 VALUE "ProductVersion", "4.00\000" 31 } 32 } 33 34 /* Do we need this? It isn't a translation, but we have all languages at once... */ 32 35 /* 33 BLOCK "VarFileInfo"34 {35 VALUE "Translation", 1030, 120036 }36 BLOCK "VarFileInfo" 37 { 38 VALUE "Translation", 1030, 1200 39 } 37 40 */ 38 41 } … … 180 183 181 184 /* BINRES pd32_nocollate.ico */ 182 PD32_NOCOLLATE ICON 185 PD32_NOCOLLATE ICON 183 186 { 184 187 '00 00 01 00 02 00 20 20 10 00 00 00 00 00 E8 02' … … 317 320 'FF FE 7F F0 00 00' 318 321 } 322 323 /****************** 324 * Bitmap 325 */ 326 327 IDB_TOOLBAR BITMAP DISCARDABLE 328 {' 329 42 4d 36 08 00 00 00 00 00 00 36 04 00 00 28 00 330 00 00 40 00 00 00 10 00 00 00 01 00 08 00 00 00 331 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 332 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80 333 00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80 334 00 00 c0 c0 c0 00 c0 dc c0 00 f0 ca a6 00 04 04 335 04 00 08 08 08 00 0c 0c 0c 00 11 11 11 00 16 16 336 16 00 1c 1c 1c 00 22 22 22 00 29 29 29 00 55 55 337 55 00 4d 4d 4d 00 42 42 42 00 39 39 39 00 80 7c 338 ff 00 50 50 ff 00 93 00 d6 00 ff ec cc 00 c6 d6 339 ef 00 d6 e7 e7 00 90 a9 ad 00 00 00 33 00 00 00 340 66 00 00 00 99 00 00 00 cc 00 00 33 00 00 00 33 341 33 00 00 33 66 00 00 33 99 00 00 33 cc 00 00 33 342 ff 00 00 66 00 00 00 66 33 00 00 66 66 00 00 66 343 99 00 00 66 cc 00 00 66 ff 00 00 99 00 00 00 99 344 33 00 00 99 66 00 00 99 99 00 00 99 cc 00 00 99 345 ff 00 00 cc 00 00 00 cc 33 00 00 cc 66 00 00 cc 346 99 00 00 cc cc 00 00 cc ff 00 00 ff 66 00 00 ff 347 99 00 00 ff cc 00 33 00 00 00 33 00 33 00 33 00 348 66 00 33 00 99 00 33 00 cc 00 33 00 ff 00 33 33 349 00 00 33 33 33 00 33 33 66 00 33 33 99 00 33 33 350 cc 00 33 33 ff 00 33 66 00 00 33 66 33 00 33 66 351 66 00 33 66 99 00 33 66 cc 00 33 66 ff 00 33 99 352 00 00 33 99 33 00 33 99 66 00 33 99 99 00 33 99 353 cc 00 33 99 ff 00 33 cc 00 00 33 cc 33 00 33 cc 354 66 00 33 cc 99 00 33 cc cc 00 33 cc ff 00 33 ff 355 33 00 33 ff 66 00 33 ff 99 00 33 ff cc 00 33 ff 356 ff 00 66 00 00 00 66 00 33 00 66 00 66 00 66 00 357 99 00 66 00 cc 00 66 00 ff 00 66 33 00 00 66 33 358 33 00 66 33 66 00 66 33 99 00 66 33 cc 00 66 33 359 ff 00 66 66 00 00 66 66 33 00 66 66 66 00 66 66 360 99 00 66 66 cc 00 66 99 00 00 66 99 33 00 66 99 361 66 00 66 99 99 00 66 99 cc 00 66 99 ff 00 66 cc 362 00 00 66 cc 33 00 66 cc 99 00 66 cc cc 00 66 cc 363 ff 00 66 ff 00 00 66 ff 33 00 66 ff 99 00 66 ff 364 cc 00 cc 00 ff 00 ff 00 cc 00 99 99 00 00 99 33 365 99 00 99 00 99 00 99 00 cc 00 99 00 00 00 99 33 366 33 00 99 00 66 00 99 33 cc 00 99 00 ff 00 99 66 367 00 00 99 66 33 00 99 33 66 00 99 66 99 00 99 66 368 cc 00 99 33 ff 00 99 99 33 00 99 99 66 00 99 99 369 99 00 99 99 cc 00 99 99 ff 00 99 cc 00 00 99 cc 370 33 00 66 cc 66 00 99 cc 99 00 99 cc cc 00 99 cc 371 ff 00 99 ff 00 00 99 ff 33 00 99 cc 66 00 99 ff 372 99 00 99 ff cc 00 99 ff ff 00 cc 00 00 00 99 00 373 33 00 cc 00 66 00 cc 00 99 00 cc 00 cc 00 99 33 374 00 00 cc 33 33 00 cc 33 66 00 cc 33 99 00 cc 33 375 cc 00 cc 33 ff 00 cc 66 00 00 cc 66 33 00 99 66 376 66 00 cc 66 99 00 cc 66 cc 00 99 66 ff 00 cc 99 377 00 00 cc 99 33 00 cc 99 66 00 cc 99 99 00 cc 99 378 cc 00 cc 99 ff 00 cc cc 00 00 cc cc 33 00 cc cc 379 66 00 cc cc 99 00 cc cc cc 00 cc cc ff 00 cc ff 380 00 00 cc ff 33 00 99 ff 66 00 cc ff 99 00 cc ff 381 cc 00 cc ff ff 00 cc 00 33 00 ff 00 66 00 ff 00 382 99 00 cc 33 00 00 ff 33 33 00 ff 33 66 00 ff 33 383 99 00 ff 33 cc 00 ff 33 ff 00 ff 66 00 00 ff 66 384 33 00 cc 66 66 00 ff 66 99 00 ff 66 cc 00 cc 66 385 ff 00 ff 99 00 00 ff 99 33 00 ff 99 66 00 ff 99 386 99 00 ff 99 cc 00 ff 99 ff 00 ff cc 00 00 ff cc 387 33 00 ff cc 66 00 ff cc 99 00 ff cc cc 00 ff cc 388 ff 00 ff ff 33 00 cc ff 66 00 ff ff 99 00 ff ff 389 cc 00 66 66 ff 00 66 ff 66 00 66 ff ff 00 ff 66 390 66 00 ff 66 ff 00 ff ff 66 00 21 00 a5 00 5f 5f 391 5f 00 77 77 77 00 86 86 86 00 96 96 96 00 cb cb 392 cb 00 b2 b2 b2 00 d7 d7 d7 00 dd dd dd 00 e3 e3 393 e3 00 ea ea ea 00 f1 f1 f1 00 f8 f8 f8 00 f0 fb 394 ff 00 a4 a0 a0 00 80 80 80 00 00 00 ff 00 00 ff 395 00 00 00 ff ff 00 ff 00 00 00 ff 00 ff 00 ff ff 396 00 00 ff ff ff 00 fa fa fa fa fa fa fa fa fa fa 397 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 398 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 399 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 400 fa fa fa fa fa fa fa fa 92 92 92 92 92 92 92 92 401 92 92 92 92 92 fa fa fa 6d 6d 6d 6d 6d 6d 6d 6d 402 6d 6d 6d 6d 6d fa fa fa 00 00 00 fa fa fa fa fa 403 fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa fa 404 fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 00 405 00 00 00 00 92 fa fa 00 00 00 00 00 00 00 00 00 406 00 00 00 00 6d fa fa fa ff ff 00 fa 00 00 00 00 407 00 00 fa fa fa fa fa ff 00 fa 00 00 00 00 fa 00 408 00 fa 00 00 00 fa fa 00 ff dd dd dd dd d6 d6 d6 409 d6 d6 d6 00 92 fa fa 00 ff dd dd dd dd d6 d6 d6 410 d6 d6 d6 00 6d fa fa fa ff ff 00 fa 00 00 00 00 411 00 00 fa fa fa fa fa ff 00 fa fa fa fa fa fa fa 412 fa fa fa fa fa fa fa 00 ff dd dd dd dd dd dd d6 413 d6 d6 d6 00 92 fa fa 00 ff dd dd dd dd dd dd d6 414 d6 d6 d6 00 6d fa fa fa ff ff 00 fa fa fa fa fa 415 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 416 fa fa fa fa fa fa fa 00 ff dd dd dd dd dd dd dd 417 d6 d6 d6 00 92 fa fa 00 ff dd dd dd dd dd dd dd 418 d6 d6 d6 00 6d fa fa fa fa fa fa fa fa fa fa fa 419 fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa fa 420 fa fa fa fa fa fa fa 00 ff dd dd dd dd 1f 1f 1f 421 d6 d6 d6 00 92 fa fa 00 ff dd dd dd dd dd dd dd 422 d6 fb d6 00 6d fa fa fa 00 00 00 fa fa fa fa fa 423 fa fa fa fa fa fa fa ff 00 fa 00 00 00 00 fa 00 424 00 fa 00 00 00 fa fa 00 ff dd dd dd dd dd dd dd 425 1f d6 d6 00 92 fa fa 00 ff dd dd dd dd dd dd dd 426 d6 fb d6 00 6d fa fa fa ff ff 00 fa 00 00 00 00 427 00 00 fa fa fa fa fa ff 00 fa fa fa fa fa fa fa 428 fa fa fa fa fa fa fa 00 ff dd dd dd dd dd dd dd 429 dd 1f d6 00 92 fa fa 00 ff dd dd dd dd dd fb dd 430 dd fb d6 92 fb fa fa fa ff ff 00 fa 00 00 00 00 431 00 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa 432 fa fa fa fa fa fa fa 00 ff ff ff ff ff ff ff ff 433 ff 1f c3 00 fa fa fa 00 ff ff ff ff ff ff ff fb 434 ff fb c3 fb fa fa fa fa ff ff 00 fa fa fa fa fa 435 fa fa fa fa fa fa fa 00 00 fa fa fa fa fa fa fa 436 fa fa fa fa fa fa fa 00 d6 d6 d6 d6 d6 d6 d6 00 437 00 1f 00 00 fa fa fa 00 d6 d6 d6 d6 d6 d6 d6 92 438 fb fb fb 92 92 fa fa fa fa fa fa fa fa fa fa fa 439 fa fa fa fa fa fa fa ff 00 fa 00 00 00 00 fa 00 440 00 fa 00 00 00 fa fa fa 00 d6 d6 d6 d6 d6 00 fa 441 fa 1f fa fa fa fa fa fa 00 d6 d6 d6 d6 fb fb fb 442 fb fb fb fb fb fb fa fa 00 00 00 fa fa fa fa fa 443 fa fa fa fa fa fa fa ff 00 fa fa fa fa fa fa fa 444 fa fa fa fa fa fa fa fa fa 00 00 00 00 00 fa fa 445 fa 1f fa fa fa fa fa fa fa 00 00 00 00 00 fa 92 446 fb fb fb 92 fa fa fa fa ff ff 00 fa 00 00 00 00 447 00 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa 448 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 1f 449 1f 1f 1f 1f fa fa fa fa fa fa fa fa fa fa ff fb 450 fa fb fa fb 92 fa fa fa ff ff 00 fa 00 00 00 00 451 00 00 fa fa fa fa 92 92 92 92 92 92 92 92 92 92 452 92 92 92 92 92 92 fa fa fa fa fa fa fa fa fa fa 453 1f 1f 1f fa fa fa fa fa fa fa fa fa fa fa fb fa 454 fa fb fa fa fb fa fa fa ff ff 00 fa fa fa fa fa 455 fa fa fa fa fa fa 92 ff ff 92 ff ff ff ff 92 ff 456 ff 92 ff ff ff 92 fa fa fa fa fa fa fa fa fa fa 457 fa 1f fa fa fa fa fa fa fa fa fa fa fa fa fa fa 458 fa fb fa fa fa fa fa fa fa fa fa fa fa fa fa fa 459 fa fa fa fa fa fa 92 92 92 92 92 92 92 92 92 92 460 92 92 92 92 92 92 461 '} 462 -
trunk/src/comdlg32/filedlg95.c
r3216 r3243 1 /* $Id: filedlg95.c,v 1.4 2000-03-26 16:31:41 cbratschi Exp $*/ 1 2 /* 2 3 * COMMDLG - File Open Dialogs Win95 look and feel 3 4 * 5 * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch) 6 * Project Odin Software License can be found in LICENSE.TXT 7 * 8 * Corel WINE 20000324 level 4 9 */ 5 10 #ifdef __WIN32OS2__ … … 48 53 CHAR* szDisplayName; 49 54 INT iIcon; 55 INT iSelIcon; 50 56 HIMAGELIST ilItemImage; 51 57 … … 173 179 HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode); 174 180 HRESULT FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 181 BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPSTR lpstrFileList, UINT nFileCount, UINT sizeUsed); 182 static BOOL BrowseSelectedFolder(HWND hwnd); 175 183 176 184 /*********************************************************************** … … 207 215 lRes = DialogBoxIndirectParamA(COMMDLG_hInstance32, 208 216 (LPDLGTEMPLATEA) template, 209 fodInfos->ofnInfos .hwndOwner,217 fodInfos->ofnInfos->hwndOwner, 210 218 (DLGPROC) FileOpenDlgProc95, 211 219 (LPARAM) fodInfos); … … 229 237 BOOL WINAPI GetFileDialog95A(LPOPENFILENAMEA ofn,UINT iDlgType) 230 238 { 231 232 239 BOOL ret; 233 240 FileOpenDlgInfos *fodInfos; 241 HINSTANCE hInstance; 242 LPCSTR lpstrFilter = NULL; 243 LPSTR lpstrCustomFilter = NULL; 244 LPCSTR lpstrInitialDir = NULL; 245 DWORD dwFlags = 0; 234 246 235 247 /* Initialise FileOpenDlgInfos structure*/ 236 248 fodInfos = (FileOpenDlgInfos*)MemAlloc(sizeof(FileOpenDlgInfos)); 237 memset(&fodInfos->ofnInfos,'\0',sizeof(*ofn)); fodInfos->ofnInfos.lStructSize = sizeof(*ofn); 238 fodInfos->ofnInfos.hwndOwner = ofn->hwndOwner; 239 fodInfos->ofnInfos.hInstance = MapHModuleLS(ofn->hInstance); 249 250 /* Pass in the original ofn */ 251 fodInfos->ofnInfos = ofn; 252 253 /* Save original hInstance value */ 254 hInstance = ofn->hInstance; 255 fodInfos->ofnInfos->hInstance = MapHModuleLS(ofn->hInstance); 256 240 257 if (ofn->lpstrFilter) 241 258 { 242 259 LPSTR s,x; 260 lpstrFilter = ofn->lpstrFilter; 243 261 244 262 /* filter is a list... title\0ext\0......\0\0 */ … … 249 267 x = (LPSTR)MemAlloc(s-ofn->lpstrFilter); 250 268 memcpy(x,ofn->lpstrFilter,s-ofn->lpstrFilter); 251 fodInfos->ofnInfos .lpstrFilter = (LPSTR)x;269 fodInfos->ofnInfos->lpstrFilter = (LPSTR)x; 252 270 } 253 271 if (ofn->lpstrCustomFilter) 254 272 { 255 273 LPSTR s,x; 274 lpstrCustomFilter = ofn->lpstrCustomFilter; 256 275 257 276 /* filter is a list... title\0ext\0......\0\0 */ … … 262 281 x = MemAlloc(s-ofn->lpstrCustomFilter); 263 282 memcpy(x,ofn->lpstrCustomFilter,s-ofn->lpstrCustomFilter); 264 fodInfos->ofnInfos.lpstrCustomFilter = (LPSTR)x; 265 } 266 fodInfos->ofnInfos.nMaxCustFilter = ofn->nMaxCustFilter; 267 fodInfos->ofnInfos.nFilterIndex = ofn->nFilterIndex; 268 if (ofn->nMaxFile) 269 { 270 fodInfos->ofnInfos.lpstrFile = (LPSTR)MemAlloc(ofn->nMaxFile); 271 strcpy((LPSTR)fodInfos->ofnInfos.lpstrFile,ofn->lpstrFile); 272 } 273 fodInfos->ofnInfos.nMaxFile = ofn->nMaxFile; 274 fodInfos->ofnInfos.nMaxFileTitle = ofn->nMaxFileTitle; 275 if (fodInfos->ofnInfos.nMaxFileTitle) 276 fodInfos->ofnInfos.lpstrFileTitle = (LPSTR)MemAlloc(ofn->nMaxFileTitle); 277 if (ofn->lpstrInitialDir) 278 { 279 fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(strlen(ofn->lpstrInitialDir)+1); 280 strcpy((LPSTR)fodInfos->ofnInfos.lpstrInitialDir,ofn->lpstrInitialDir); 281 } 282 283 if (ofn->lpstrTitle) 284 { 285 fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(strlen(ofn->lpstrTitle)+1); 286 strcpy((LPSTR)fodInfos->ofnInfos.lpstrTitle,ofn->lpstrTitle); 287 } 288 289 fodInfos->ofnInfos.Flags = ofn->Flags|OFN_WINE; 290 fodInfos->ofnInfos.nFileOffset = ofn->nFileOffset; 291 fodInfos->ofnInfos.nFileExtension = ofn->nFileExtension; 292 if (ofn->lpstrDefExt) 293 { 294 fodInfos->ofnInfos.lpstrDefExt = MemAlloc(strlen(ofn->lpstrDefExt)+1); 295 strcpy((LPSTR)fodInfos->ofnInfos.lpstrDefExt,ofn->lpstrDefExt); 296 } 297 fodInfos->ofnInfos.lCustData = ofn->lCustData; 298 fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook; 299 300 if (HIWORD(ofn->lpTemplateName)) 301 { 302 fodInfos->ofnInfos.lpTemplateName = MemAlloc(strlen(ofn->lpTemplateName)+1); 303 strcpy ((LPSTR)fodInfos->ofnInfos.lpTemplateName, ofn->lpTemplateName); 304 } 305 else 306 { 307 /* resource id */ 308 fodInfos->ofnInfos.lpTemplateName = ofn->lpTemplateName; 309 } 283 fodInfos->ofnInfos->lpstrCustomFilter = (LPSTR)x; 284 } 285 286 dwFlags = ofn->Flags; 287 fodInfos->ofnInfos->Flags = ofn->Flags|OFN_WINE; 310 288 311 289 /* Replace the NULL lpstrInitialDir by the current folder */ 312 if(!ofn->lpstrInitialDir) 313 { 314 fodInfos->ofnInfos.lpstrInitialDir = MemAlloc(MAX_PATH); 315 GetCurrentDirectoryA(MAX_PATH,(LPSTR)fodInfos->ofnInfos.lpstrInitialDir); 290 lpstrInitialDir = ofn->lpstrInitialDir; 291 if(!lpstrInitialDir) 292 { 293 fodInfos->ofnInfos->lpstrInitialDir = MemAlloc(MAX_PATH); 294 GetCurrentDirectoryA(MAX_PATH,(LPSTR)fodInfos->ofnInfos->lpstrInitialDir); 316 295 } 317 296 … … 333 312 } 334 313 335 ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset; 336 ofn->nFileExtension = fodInfos->ofnInfos.nFileExtension; 337 338 /* 339 Transfer the combo index in the OPENFILENAME structure; 340 No support for custom filters, so nFilterIndex must be one-based. 341 */ 342 ofn->nFilterIndex = fodInfos->ofnInfos.nFilterIndex; 343 344 if (fodInfos->ofnInfos.lpstrFilter) 345 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrFilter)); 346 if (HIWORD(fodInfos->ofnInfos.lpTemplateName)) 347 MemFree((LPVOID)(fodInfos->ofnInfos.lpTemplateName)); 348 if (fodInfos->ofnInfos.lpstrDefExt) 349 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrDefExt)); 350 if (fodInfos->ofnInfos.lpstrTitle) 351 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrTitle)); 352 if (fodInfos->ofnInfos.lpstrInitialDir) 353 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrInitialDir)); 354 if (fodInfos->ofnInfos.lpstrCustomFilter) 355 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrCustomFilter)); 356 357 if (fodInfos->ofnInfos.lpstrFile) 358 { 359 /* 360 * We have to clear the buffer before we copy the filename since we don't 361 * support selecting multiple files. We have to make sure that the caller won't 362 * attempt to read past the first filename. 363 */ 364 memset(ofn->lpstrFile, '\0', ofn->nMaxFile); 365 strcpy(ofn->lpstrFile,fodInfos->ofnInfos.lpstrFile); 366 MemFree((LPVOID)fodInfos->ofnInfos.lpstrFile); 367 } 368 if (fodInfos->ofnInfos.lpstrFileTitle) 369 { 370 if (ofn->lpstrFileTitle) 371 strcpy(ofn->lpstrFileTitle, 372 fodInfos->ofnInfos.lpstrFileTitle); 373 MemFree((LPVOID)fodInfos->ofnInfos.lpstrFileTitle); 314 if (lpstrInitialDir) 315 { 316 MemFree((LPVOID)(fodInfos->ofnInfos->lpstrInitialDir)); 317 fodInfos->ofnInfos->lpstrInitialDir = lpstrInitialDir; 374 318 } 375 319 if (lpstrFilter) 320 { 321 MemFree((LPVOID)(fodInfos->ofnInfos->lpstrFilter)); 322 fodInfos->ofnInfos->lpstrFilter = lpstrFilter; 323 } 324 if (lpstrCustomFilter) 325 { 326 MemFree((LPVOID)(fodInfos->ofnInfos->lpstrCustomFilter)); 327 fodInfos->ofnInfos->lpstrCustomFilter = lpstrCustomFilter; 328 } 329 330 ofn->Flags = dwFlags; 331 ofn->hInstance = hInstance; 376 332 MemFree((LPVOID)(fodInfos)); 377 333 return ret; … … 391 347 BOOL ret; 392 348 FileOpenDlgInfos *fodInfos; 349 HINSTANCE hInstance; 350 LPCSTR lpstrFilter = NULL; 351 LPSTR lpstrCustomFilter = NULL; 352 DWORD dwFlags; 393 353 394 354 /* Initialise FileOpenDlgInfos structure*/ 395 355 fodInfos = (FileOpenDlgInfos*)MemAlloc(sizeof(FileOpenDlgInfos)); 396 memset(&fodInfos->ofnInfos,'\0',sizeof(*ofn)); 397 fodInfos->ofnInfos.lStructSize = sizeof(*ofn); 398 fodInfos->ofnInfos.hwndOwner = ofn->hwndOwner; 399 fodInfos->ofnInfos.hInstance = MapHModuleLS(ofn->hInstance); 356 357 /* Pass in the original ofn */ 358 fodInfos->ofnInfos = (LPOPENFILENAMEA)ofn; 359 360 /* Save hInstance */ 361 hInstance = fodInfos->ofnInfos->hInstance; 362 fodInfos->ofnInfos->hInstance = MapHModuleLS(ofn->hInstance); 363 364 /* Save lpstrFilter */ 400 365 if (ofn->lpstrFilter) 401 366 { … … 403 368 LPSTR x,y; 404 369 int n; 370 371 lpstrFilter = fodInfos->ofnInfos->lpstrFilter; 405 372 406 373 /* filter is a list... title\0ext\0......\0\0 */ … … 419 386 } 420 387 *x=0; 421 fodInfos->ofnInfos.lpstrFilter = (LPSTR)y; 422 } 423 if (ofn->lpstrCustomFilter) { 388 fodInfos->ofnInfos->lpstrFilter = (LPSTR)y; 389 } 390 /* Save lpstrCustomFilter */ 391 if (ofn->lpstrCustomFilter) 392 { 424 393 LPWSTR s; 425 394 LPSTR x,y; 426 395 int n; 427 396 397 lpstrCustomFilter = fodInfos->ofnInfos->lpstrCustomFilter; 428 398 /* filter is a list... title\0ext\0......\0\0 */ 429 399 s = (LPWSTR)ofn->lpstrCustomFilter; … … 440 410 } 441 411 *x=0; 442 fodInfos->ofnInfos.lpstrCustomFilter = (LPSTR)y; 443 } 444 fodInfos->ofnInfos.nMaxCustFilter = ofn->nMaxCustFilter; 445 fodInfos->ofnInfos.nFilterIndex = ofn->nFilterIndex; 446 if (ofn->nMaxFile) 447 fodInfos->ofnInfos.lpstrFile = (LPSTR)MemAlloc(ofn->nMaxFile); 448 fodInfos->ofnInfos.nMaxFile = ofn->nMaxFile; 449 fodInfos->ofnInfos.nMaxFileTitle = ofn->nMaxFileTitle; 450 if (ofn->nMaxFileTitle) 451 fodInfos->ofnInfos.lpstrFileTitle = (LPSTR)MemAlloc(ofn->nMaxFileTitle); 452 if (ofn->lpstrInitialDir) 453 { 454 fodInfos->ofnInfos.lpstrInitialDir = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrInitialDir)+1); 455 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrInitialDir,ofn->lpstrInitialDir); 456 } 457 if (ofn->lpstrTitle) 458 { 459 fodInfos->ofnInfos.lpstrTitle = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrTitle)+1); 460 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrTitle,ofn->lpstrTitle); 461 } 462 fodInfos->ofnInfos.Flags = ofn->Flags|OFN_WINE|OFN_UNICODE; 463 fodInfos->ofnInfos.nFileOffset = ofn->nFileOffset; 464 fodInfos->ofnInfos.nFileExtension = ofn->nFileExtension; 465 if (ofn->lpstrDefExt) 466 { 467 fodInfos->ofnInfos.lpstrDefExt = (LPSTR)MemAlloc(lstrlenW(ofn->lpstrDefExt)+1); 468 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpstrDefExt,ofn->lpstrDefExt); 469 } 470 fodInfos->ofnInfos.lCustData = ofn->lCustData; 471 fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook; 472 473 if (HIWORD(ofn->lpTemplateName)) 474 { 475 fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)+1); 476 lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpTemplateName,ofn->lpTemplateName); 477 } 478 else 479 { 480 /* resource id */ 481 fodInfos->ofnInfos.lpTemplateName = (LPSTR)ofn->lpTemplateName; 482 } 412 fodInfos->ofnInfos->lpstrCustomFilter = (LPSTR)y; 413 } 414 415 /* Save Flags */ 416 dwFlags = fodInfos->ofnInfos->Flags; 417 fodInfos->ofnInfos->Flags = ofn->Flags|OFN_WINE|OFN_UNICODE; 418 483 419 /* Initialise the dialog property */ 484 420 fodInfos->DlgInfos.dwDlgProp = 0; … … 498 434 499 435 /* Cleaning */ 500 ofn->nFileOffset = fodInfos->ofnInfos.nFileOffset; 501 ofn->nFileExtension = fodInfos->ofnInfos.nFileExtension; 502 503 /* 504 Transfer the combo index in the OPENFILENAME structure; 505 No support for custom filters, so nFilterIndex must be one-based. 506 */ 507 ofn->nFilterIndex = fodInfos->ofnInfos.nFilterIndex; 508 509 if (fodInfos->ofnInfos.lpstrFilter) 510 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrFilter)); 511 if (HIWORD(fodInfos->ofnInfos.lpTemplateName)) 512 MemFree((LPVOID)(fodInfos->ofnInfos.lpTemplateName)); 513 if (fodInfos->ofnInfos.lpstrDefExt) 514 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrDefExt)); 515 if (fodInfos->ofnInfos.lpstrTitle) 516 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrTitle)); 517 if (fodInfos->ofnInfos.lpstrInitialDir) 518 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrInitialDir)); 519 if (fodInfos->ofnInfos.lpstrCustomFilter) 520 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrCustomFilter)); 521 522 if (fodInfos->ofnInfos.lpstrFile) 523 { 524 /* 525 * We have to clear the buffer before we copy the filename since we don't 526 * support selecting multiple files. We have to make sure that the caller won't 527 * attempt to read past the first filename. 528 */ 529 memset(ofn->lpstrFile, '\0', ofn->nMaxFile * sizeof(WCHAR) ); 530 lstrcpyAtoW(ofn->lpstrFile,(fodInfos->ofnInfos.lpstrFile)); 531 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrFile)); 532 } 533 534 if (fodInfos->ofnInfos.lpstrFileTitle) { 535 if (ofn->lpstrFileTitle) 536 lstrcpyAtoW(ofn->lpstrFileTitle, 537 (fodInfos->ofnInfos.lpstrFileTitle)); 538 MemFree((LPVOID)(fodInfos->ofnInfos.lpstrFileTitle)); 539 } 436 /* Restore Flags */ 437 fodInfos->ofnInfos->Flags = dwFlags; 438 439 /* Restore lpstrFilter */ 440 if (fodInfos->ofnInfos->lpstrFilter) 441 { 442 MemFree((LPVOID)(fodInfos->ofnInfos->lpstrFilter)); 443 fodInfos->ofnInfos->lpstrFilter = lpstrFilter; 444 } 445 if (fodInfos->ofnInfos->lpstrCustomFilter) 446 { 447 MemFree((LPVOID)(fodInfos->ofnInfos->lpstrCustomFilter)); 448 fodInfos->ofnInfos->lpstrCustomFilter = lpstrCustomFilter; 449 } 450 451 /* Restore hInstance */ 452 fodInfos->ofnInfos->hInstance = hInstance; 540 453 MemFree((LPVOID)(fodInfos)); 541 454 return ret; 542 543 455 } 544 456 … … 688 600 lParam = (LPARAM) &fodInfos->ofnInfos; 689 601 ArrangeCtrlPositions(hwnd,GetParent(hwnd)); 690 if(fodInfos && (fodInfos->ofnInfos .Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos.lpfnHook)691 return CallWindowProcA((WNDPROC)fodInfos->ofnInfos .lpfnHook,hwnd,uMsg,wParam,lParam);602 if(fodInfos && (fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos->lpfnHook) 603 return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam); 692 604 return 0; 693 605 } 694 606 } 695 if(fodInfos && (fodInfos->ofnInfos .Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos.lpfnHook )696 return CallWindowProcA((WNDPROC)fodInfos->ofnInfos .lpfnHook,hwnd,uMsg,wParam,lParam);607 if(fodInfos && (fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK) && fodInfos->ofnInfos->lpfnHook ) 608 return CallWindowProcA((WNDPROC)fodInfos->ofnInfos->lpfnHook,hwnd,uMsg,wParam,lParam); 697 609 return DefWindowProcA(hwnd,uMsg,wParam,lParam); 698 610 } … … 704 616 HANDLE hDlgTmpl = 0; 705 617 HWND hChildDlg = 0; 706 if (fodInfos->ofnInfos .Flags & OFN_ENABLETEMPLATE || fodInfos->ofnInfos.Flags & OFN_ENABLETEMPLATEHANDLE)618 if (fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATE || fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATEHANDLE) 707 619 { 708 if (fodInfos->ofnInfos .Flags & OFN_ENABLETEMPLATEHANDLE)620 if (fodInfos->ofnInfos->Flags & OFN_ENABLETEMPLATEHANDLE) 709 621 { 710 if( !(template = LockResource( fodInfos->ofnInfos .hInstance)))622 if( !(template = LockResource( fodInfos->ofnInfos->hInstance))) 711 623 { 712 624 COMDLG32_SetCommDlgExtendedError(CDERR_LOADRESFAILURE); … … 717 629 else 718 630 { 719 if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos .hInstance),720 (fodInfos->ofnInfos .lpTemplateName), RT_DIALOGA)))631 if (!(hRes = FindResourceA(MapHModuleSL(fodInfos->ofnInfos->hInstance), 632 (fodInfos->ofnInfos->lpTemplateName), RT_DIALOGA))) 721 633 { 722 634 COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); 723 635 return (HWND)NULL; 724 636 } 725 if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos .hInstance),637 if (!(hDlgTmpl = LoadResource( MapHModuleSL(fodInfos->ofnInfos->hInstance), 726 638 hRes )) || 727 639 !(template = LockResource( hDlgTmpl ))) … … 732 644 } 733 645 734 hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos .hInstance,template,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);646 hChildDlg= CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,template,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos); 735 647 if(hChildDlg) 736 648 { … … 739 651 } 740 652 } 741 else if(fodInfos->ofnInfos .Flags & OFN_ENABLEHOOK && fodInfos->ofnInfos.lpfnHook)653 else if(fodInfos->ofnInfos->Flags & OFN_ENABLEHOOK && fodInfos->ofnInfos->lpfnHook) 742 654 { 743 655 RECT rectHwnd; … … 752 664 tmplate.cy = rectHwnd.bottom-rectHwnd.top; 753 665 754 return CreateDialogIndirectParamA(fodInfos->ofnInfos .hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos);666 return CreateDialogIndirectParamA(fodInfos->ofnInfos->hInstance,&tmplate,hwnd,(DLGPROC)FileOpenDlgProcUserTemplate,(LPARAM)fodInfos); 755 667 } 756 668 return (HWND)NULL; … … 774 686 ofnNotify.hdr.idFrom=0; 775 687 ofnNotify.hdr.code = uCode; 776 ofnNotify.lpOFN = &fodInfos->ofnInfos;688 ofnNotify.lpOFN = fodInfos->ofnInfos; 777 689 return SendMessageA(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify); 778 690 } … … 788 700 { 789 701 LPSTR lpstrFileSpec; 790 int reqSize; 791 char lpstrPath[MAX_PATH]; 702 char lpstrCurrentDir[MAX_PATH]=""; 792 703 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); 793 704 if(!fodInfos) 794 return -1;705 return TRUE; 795 706 switch(uMsg) 796 707 { 797 708 case CDM_GETFILEPATH: 709 { 710 char lpstrPathSpec[MAX_PATH]=""; 711 GetDlgItemTextA(hwnd,IDC_FILENAME,(LPSTR)lParam, (int)wParam); 712 lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA((LPSTR)lParam); 713 strcpy(lpstrPathSpec,(LPSTR)lParam); 714 COMDLG32_PathRemoveFileSpecA(lpstrPathSpec); 715 if(!lpstrPathSpec[0]) 716 COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent, 717 lpstrPathSpec); 718 strcat(lpstrPathSpec,"\\"); 719 strcat(lpstrPathSpec,(LPSTR)lParam); 720 strcpy((LPSTR)lParam,(LPSTR)lpstrPathSpec); 721 } 722 return TRUE; 723 case CDM_GETFOLDERPATH: 724 if(lParam) 798 725 { 799 GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrPath, sizeof(lpstrPath)); 800 lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrPath); 801 if (lpstrFileSpec==lpstrPath) { 802 char lpstrCurrentDir[MAX_PATH]; 803 /* Prepend the current path */ 804 COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrCurrentDir); 805 if ((LPSTR)lParam!=NULL) 806 wsnprintfA((LPSTR)lParam,(int)wParam,"%s\\%s",lpstrCurrentDir,lpstrPath); 807 reqSize=strlen(lpstrCurrentDir)+1+strlen(lpstrPath)+1; 808 } else { 809 lstrcpynA((LPSTR)lParam,(LPSTR)lpstrPath,(int)wParam); 810 reqSize=strlen(lpstrPath); 726 if(fodInfos) 727 { 728 COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent, 729 lpstrCurrentDir); 730 strncpy((LPSTR)lParam,lpstrCurrentDir,(int)wParam); 811 731 } 732 else 733 *((LPSTR)lParam)=0; 812 734 } 813 /* return the required buffer size */ 814 return reqSize; 815 case CDM_GETFOLDERPATH: 816 COMDLG32_SHGetPathFromIDListA(fodInfos->ShellInfos.pidlAbsCurrent,lpstrPath); 817 if ((LPSTR)lParam!=NULL) 818 lstrcpynA((LPSTR)lParam,lpstrPath,(int)wParam); 819 return strlen(lpstrPath); 735 return TRUE; 820 736 case CDM_GETSPEC: 821 reqSize=GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrPath, sizeof(lpstrPath)); 822 lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrPath); 823 if ((LPSTR)lParam!=NULL) 824 lstrcpynA((LPSTR)lParam, lpstrFileSpec, (int)wParam); 825 return strlen(lpstrFileSpec); 737 if(lParam) 738 { 739 GetDlgItemTextA(hwnd,IDC_FILENAME,(LPSTR)lParam, (int)wParam); 740 lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA((LPSTR)lParam); 741 if(lpstrFileSpec) 742 strcpy((LPSTR)lParam, lpstrFileSpec); 743 else 744 *((LPSTR)lParam)=0; 745 } 746 return TRUE; 747 case CDM_SETCONTROLTEXT: 748 if ( 0 != lParam ) 749 SetDlgItemTextA( hwnd, (UINT) wParam, (LPSTR) lParam ); 750 return TRUE; 826 751 case CDM_HIDECONTROL: 827 case CDM_SETCONTROLTEXT:828 752 case CDM_SETDEFEXT: 829 753 FIXME("CDM_HIDECONTROL,CDM_SETCONTROLTEXT,CDM_SETDEFEXT not implemented\n"); 830 754 return TRUE; 831 755 } 832 return -1;756 return TRUE; 833 757 } 834 758 … … 869 793 870 794 case WM_DESTROY: 871 RemovePropA(hwnd, FileOpenDlgInfosStr); 795 FILEDLG95_Clean(hwnd); 796 RemovePropA(hwnd, FileOpenDlgInfosStr); 797 return FALSE; 798 799 case WM_NOTIFY: 800 { 801 LPNMHDR lpnmh = (LPNMHDR)lParam; 802 UINT stringId = -1; 803 804 /* set up the button tooltips strings */ 805 if(TTN_GETDISPINFOA == lpnmh->code ) 806 { 807 LPNMTTDISPINFOA lpdi = (LPNMTTDISPINFOA)lParam; 808 switch(lpnmh->idFrom ) 809 { 810 /* Up folder button */ 811 case FCIDM_TB_UPFOLDER: 812 stringId = IDS_UPFOLDER; 813 break; 814 /* New folder button */ 815 case FCIDM_TB_NEWFOLDER: 816 stringId = IDS_NEWFOLDER; 817 break; 818 /* List option button */ 819 case FCIDM_TB_SMALLICON: 820 stringId = IDS_LISTVIEW; 821 break; 822 /* Details option button */ 823 case FCIDM_TB_REPORTVIEW: 824 stringId = IDS_REPORTVIEW; 825 break; 826 } 827 lpdi->hinst = COMMDLG_hInstance32; 828 lpdi->lpszText = (LPSTR) stringId; 829 } 830 return FALSE; 831 } 872 832 873 833 default : … … 887 847 LPITEMIDLIST pidlItemId; 888 848 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam; 849 DWORD count; 889 850 890 851 TRACE("\n"); … … 894 855 InitCommonControls(); 895 856 #endif 896 857 //MessageBox(hwnd,"WM_INITDIALOG",NULL,MB_OK); 858 dprintf(("CB: FILEDLG95_SHELL_Init")); 859 count = GetTickCount(); 897 860 /* Initialise shell objects */ 898 861 FILEDLG95_SHELL_Init(hwnd); 899 862 dprintf(("CB: FILEDLG95_InitUI %d ms",GetTickCount()-count)); 863 count = GetTickCount(); 900 864 /* Initialise dialog UI */ 901 865 FILEDLG95_InitUI(hwnd); 902 866 dprintf(("CB: FILEDLG95_LOOKIN_Init %d",GetTickCount()-count)); 867 count = GetTickCount(); 903 868 /* Initialize the Look In combo box*/ 904 869 FILEDLG95_LOOKIN_Init(fodInfos->DlgInfos.hwndLookInCB); 905 870 dprintf(("CB: FILEDLG95_FILETYPE_Init %d",GetTickCount()-count)); 871 count = GetTickCount(); 906 872 /* Initialize the filter combo box */ 907 873 FILEDLG95_FILETYPE_Init(hwnd); 908 874 dprintf(("CB: FILEDLG95_FILETYPE_Init done %d",GetTickCount()-count)); 875 count = GetTickCount(); 909 876 /* Get the initial directory pidl */ 910 877 911 if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->ofnInfos .lpstrInitialDir)))878 if(!(pidlItemId = GetPidlFromName(fodInfos->Shell.FOIShellFolder,fodInfos->ofnInfos->lpstrInitialDir))) 912 879 { 913 880 char path[MAX_PATH]; … … 918 885 919 886 } 920 887 dprintf(("CB: IShellBrowser_BrowseObject %d",GetTickCount()-count)); 888 count = GetTickCount(); 921 889 /* Browse to the initial directory */ 922 890 IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser,pidlItemId,SBSP_RELATIVE); 923 891 dprintf(("CB: done WM_INITDIALOG %d",GetTickCount()-count)); 924 892 /* Free pidlItem memory */ 925 893 COMDLG32_SHFree(pidlItemId); … … 958 926 /* Cancel button */ 959 927 case IDCANCEL: 960 FILEDLG95_Clean(hwnd);961 928 EndDialog(hwnd, FALSE); 962 929 break; … … 1064 1031 1065 1032 /* Set the window text with the text specified in the OPENFILENAME structure */ 1066 if(fodInfos->ofnInfos .lpstrTitle)1067 { 1068 SetWindowTextA(hwnd,fodInfos->ofnInfos .lpstrTitle);1033 if(fodInfos->ofnInfos->lpstrTitle) 1034 { 1035 SetWindowTextA(hwnd,fodInfos->ofnInfos->lpstrTitle); 1069 1036 } 1070 1037 else if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) … … 1074 1041 1075 1042 /* Initialise the file name edit control */ 1076 if(fodInfos->ofnInfos.lpstrFile) 1077 { 1078 SetDlgItemTextA(hwnd,IDC_FILENAME,fodInfos->ofnInfos.lpstrFile); 1079 } 1043 if(fodInfos->ofnInfos->lpstrFile) 1044 { 1045 /** 1046 * When passed a fully qualified filename, windows removes 1047 * the path component, before showing it in the control 1048 */ 1049 LPSTR lpstrFileName = NULL; 1050 1051 lpstrFileName = (LPSTR)COMDLG32_PathFindFilenameA(fodInfos->ofnInfos->lpstrFile); 1052 if(NULL != lpstrFileName) 1053 SetDlgItemTextA(hwnd,IDC_FILENAME,lpstrFileName); 1054 else 1055 SetDlgItemTextA(hwnd,IDC_FILENAME,""); 1056 } 1057 1080 1058 /* Must the open as read only check box be checked ?*/ 1081 if(fodInfos->ofnInfos .Flags & OFN_READONLY)1059 if(fodInfos->ofnInfos->Flags & OFN_READONLY) 1082 1060 { 1083 1061 SendDlgItemMessageA(hwnd,IDC_OPENREADONLY,BM_SETCHECK,(WPARAM)TRUE,0); 1084 1062 } 1085 1063 /* Must the open as read only check box be hid ?*/ 1086 if(fodInfos->ofnInfos .Flags & OFN_HIDEREADONLY)1064 if(fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY) 1087 1065 { 1088 1066 ShowWindow(GetDlgItem(hwnd,IDC_OPENREADONLY),SW_HIDE); 1067 } 1068 /* Must the help button be hid ?*/ 1069 if (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP)) 1070 { 1071 ShowWindow(GetDlgItem(hwnd, pshHelp), SW_HIDE); 1072 } 1073 /* Resize the height, if open as read only checkbox ad help button 1074 are hidden */ 1075 if ( (fodInfos->ofnInfos->Flags & OFN_HIDEREADONLY) && 1076 (!(fodInfos->ofnInfos->Flags & OFN_SHOWHELP)) ) 1077 { 1078 RECT rectDlg, rectHelp, rectCancel; 1079 GetWindowRect(hwnd, &rectDlg); 1080 GetWindowRect(GetDlgItem(hwnd, pshHelp), &rectHelp); 1081 GetWindowRect(GetDlgItem(hwnd, IDCANCEL), &rectCancel); 1082 /* subtract the height of the help button plus the space between 1083 the help button and the cancel button to the height of the dialog */ 1084 SetWindowPos(hwnd, 0, 0, 0, rectDlg.right-rectDlg.left, 1085 (rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom), 1086 SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER); 1089 1087 } 1090 1088 /* change Open to Save */ … … 1092 1090 { 1093 1091 SetDlgItemTextA(hwnd,IDOK,"Save"); 1092 SetDlgItemTextA(hwnd,IDC_LOOKINSTATIC,"Save &in"); 1094 1093 } 1095 1094 return 0; … … 1097 1096 1098 1097 /*********************************************************************** 1098 * FILEDLG95_OnOpenMultipleFiles 1099 * 1100 * Handles the opening of multiple files. 1101 * 1102 */ 1103 BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPSTR lpstrFileList, UINT nFileCount, UINT sizeUsed) 1104 { 1105 CHAR lpstrPathSpec[MAX_PATH] = ""; 1106 CHAR lpstrTempFileList[MAX_PATH] = ""; 1107 LPSTR lpstrFile; 1108 UINT sizePath; 1109 UINT nCount; 1110 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); 1111 1112 TRACE("\n"); 1113 1114 lpstrFile = fodInfos->ofnInfos->lpstrFile; 1115 1116 COMDLG32_SHGetPathFromIDListA( fodInfos->ShellInfos.pidlAbsCurrent, lpstrPathSpec ); 1117 sizePath = lstrlenA( lpstrPathSpec ); 1118 1119 memset( lpstrFile, 0x0, fodInfos->ofnInfos->nMaxFile * sizeof(CHAR) ); 1120 1121 if ( fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST || 1122 !(fodInfos->ofnInfos->Flags & OFN_EXPLORER )) 1123 { 1124 LPSTR lpstrTemp = lpstrFileList; 1125 1126 for ( nCount = 0; nCount < nFileCount; nCount++ ) 1127 { 1128 WIN32_FIND_DATAA findData; 1129 CHAR lpstrFindFile[MAX_PATH]; 1130 1131 memset( lpstrFindFile, 0x0, MAX_PATH * sizeof(CHAR) ); 1132 1133 lstrcpyA( lpstrFindFile, lpstrPathSpec ); 1134 lstrcatA( lpstrFindFile, "\\" ); 1135 lstrcatA( lpstrFindFile, lpstrTemp ); 1136 1137 if ( FindFirstFileA( lpstrFindFile, &findData ) == INVALID_HANDLE_VALUE ) 1138 { 1139 CHAR lpstrNotFound[100]; 1140 CHAR lpstrMsg[100]; 1141 CHAR tmp[400]; 1142 1143 LoadStringA(COMMDLG_hInstance32, IDS_FILENOTFOUND, lpstrNotFound, 100); 1144 LoadStringA(COMMDLG_hInstance32, IDS_VERIFYFILE, lpstrMsg, 100); 1145 1146 strcpy(tmp, lpstrFindFile); 1147 strcat(tmp, "\n"); 1148 strcat(tmp, lpstrNotFound); 1149 strcat(tmp, "\n"); 1150 strcat(tmp, lpstrMsg); 1151 1152 MessageBoxA(hwnd, 1153 tmp, 1154 fodInfos->ofnInfos->lpstrTitle, 1155 MB_OK | MB_ICONEXCLAMATION); 1156 return FALSE; 1157 } 1158 1159 if (!(fodInfos->ofnInfos->Flags & OFN_EXPLORER )) 1160 { 1161 lstrcatA( lpstrTempFileList, findData.cAlternateFileName); 1162 if ( nCount + 1 < nFileCount) 1163 lstrcatA( lpstrTempFileList, " "); 1164 } 1165 lpstrTemp += strlen(lpstrFileList) + 1; 1166 } 1167 } 1168 1169 if ( fodInfos->ofnInfos->Flags & OFN_EXPLORER ) 1170 { 1171 lstrcpyA( lpstrFile, lpstrPathSpec); 1172 memcpy( lpstrFile + sizePath + 1, lpstrFileList, sizeof(CHAR) * sizeUsed ); 1173 } 1174 else 1175 { 1176 memcpy( lpstrFile, lpstrTempFileList, sizeof(CHAR) * strlen(lpstrTempFileList)); 1177 } 1178 1179 fodInfos->ofnInfos->nFileOffset = sizePath + 1; 1180 fodInfos->ofnInfos->nFileExtension = 0; 1181 1182 /* clean and exit */ 1183 return EndDialog(hwnd,TRUE); 1184 } 1185 1186 /*********************************************************************** 1099 1187 * FILEDLG95_OnOpen 1100 1188 * … … 1105 1193 BOOL FILEDLG95_OnOpen(HWND hwnd) 1106 1194 { 1107 char lpstrSpecifiedByUser[MAX_PATH]; 1195 CHAR lpstrSpecifiedByUser[MAX_PATH] = ""; 1196 CHAR lpstrFileList[MAX_PATH] = ""; 1197 LPSTR lpstrFile; 1198 UINT nStrCharCount = 0; 1199 UINT nFileCount = 0; 1200 UINT nFileIndex = 0; 1201 UINT sizeUsed = 0; 1202 UINT nStrLen = 0; 1203 1108 1204 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); 1109 LPITEMIDLIST pidlSelection;1110 1111 lpstrSpecifiedByUser[0]='\0';1112 1205 1113 1206 TRACE("\n"); 1114 1115 /* Check if there is a selected item in the listview */ 1116 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_USEVIEW) 1117 { 1118 pidlSelection = GetSelectedPidl(fodInfos->Shell.FOIShellView); 1119 GetName(fodInfos->Shell.FOIShellFolder,pidlSelection,SHGDN_NORMAL,lpstrSpecifiedByUser); 1120 COMDLG32_SHFree((LPVOID)pidlSelection); 1121 } 1122 else 1123 /* Get the text from the filename edit */ 1124 GetDlgItemTextA(hwnd,IDC_FILENAME,lpstrSpecifiedByUser,MAX_PATH); 1125 1126 if(strlen(lpstrSpecifiedByUser)) 1207 //CB: optimize this function! 1208 /* If a folder is selected browse folder */ 1209 if (BrowseSelectedFolder(hwnd)) 1210 return FALSE; 1211 1212 lpstrFile = fodInfos->ofnInfos->lpstrFile; 1213 1214 GetDlgItemTextA(hwnd, IDC_FILENAME, lpstrSpecifiedByUser, MAX_PATH); 1215 nStrLen = strlen(lpstrSpecifiedByUser); 1216 1217 while ( nStrCharCount <= nStrLen ) 1218 { 1219 if ( lpstrSpecifiedByUser[nStrCharCount]=='"' ) 1220 { 1221 nStrCharCount++; 1222 1223 while ((lpstrSpecifiedByUser[nStrCharCount]!='"') && 1224 (nStrCharCount <= nStrLen)) 1225 { 1226 lpstrFileList[nFileIndex++] = lpstrSpecifiedByUser[nStrCharCount]; 1227 nStrCharCount++; 1228 sizeUsed++; 1229 } 1230 lpstrFileList[nFileIndex++] = '\0'; 1231 sizeUsed++; 1232 nFileCount++; 1233 } 1234 nStrCharCount++; 1235 } 1236 1237 if(nFileCount > 0) 1238 return FILEDLG95_OnOpenMultipleFiles(hwnd, lpstrFileList, nFileCount, sizeUsed); 1239 1240 if (nStrLen) 1127 1241 { 1128 1242 LPSHELLFOLDER psfDesktop; … … 1130 1244 LPSTR lpstrFileSpec; 1131 1245 LPSTR lpstrTemp; 1132 char lpstrPathSpec[MAX_PATH]; 1133 char lpstrCurrentDir[MAX_PATH]; 1134 char lpstrPathAndFile[MAX_PATH]; 1135 1136 lpstrPathSpec[0] = '\0'; 1137 lpstrCurrentDir[0] = '\0'; 1138 lpstrPathAndFile[0] = '\0'; 1246 char lpstrPathSpec[MAX_PATH] = ""; 1247 char lpstrCurrentDir[MAX_PATH] = ""; 1248 char lpstrPathAndFile[MAX_PATH] = ""; 1139 1249 1140 1250 /* Separate the file spec from the path spec … … 1143 1253 C:\TEXT1\TEXT2 C:\TEXT1 TEXT2 1144 1254 */ 1255 if (nFileCount == 0) 1256 { 1145 1257 lpstrFileSpec = (LPSTR)COMDLG32_PathFindFilenameA(lpstrSpecifiedByUser); 1146 1258 strcpy(lpstrPathSpec,lpstrSpecifiedByUser); 1147 1259 COMDLG32_PathRemoveFileSpecA(lpstrPathSpec); 1260 } 1148 1261 1149 1262 /* Get the index of the selected item in the filetype combo box */ 1150 fodInfos->ofnInfos .nFilterIndex = (DWORD) CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB);1263 fodInfos->ofnInfos->nFilterIndex = (DWORD) CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB); 1151 1264 /* nFilterIndex is 1 based while combo GetCurSel return zero based index */ 1152 fodInfos->ofnInfos .nFilterIndex++;1265 fodInfos->ofnInfos->nFilterIndex++; 1153 1266 1154 1267 /* Get the current directory name */ … … 1164 1277 case '\\': 1165 1278 { 1166 int lenPathSpec=strlen(lpstrPathSpec); 1167 INT iCopy = (lenPathSpec!=0?2:3); 1168 memmove(lpstrPathSpec+iCopy,lpstrPathSpec,lenPathSpec); 1169 strncpy(lpstrPathSpec,lpstrCurrentDir,iCopy); 1279 INT iCopy = 2; 1280 char lpstrTmp[MAX_PATH] = ""; 1281 if(!strlen(lpstrPathSpec)) 1282 iCopy = 3; 1283 strncpy(lpstrTmp,lpstrCurrentDir,iCopy); 1284 strcat(lpstrTmp,lpstrPathSpec); 1285 strcpy(lpstrPathSpec,lpstrTmp); 1170 1286 } 1171 1287 break; … … 1174 1290 { 1175 1291 INT iSize; 1176 char lpstrTmp2[MAX_PATH] ;1292 char lpstrTmp2[MAX_PATH] = ""; 1177 1293 LPSTR lpstrTmp = strrchr(lpstrCurrentDir,'\\'); 1178 1179 1294 iSize = lpstrTmp - lpstrCurrentDir; 1180 1295 strncpy(lpstrTmp2,lpstrCurrentDir,iSize + 1); 1181 1296 if(strlen(lpstrSpecifiedByUser) <= 3) 1182 *lpstrFileSpec='\0';1297 strcpy(lpstrFileSpec,""); 1183 1298 if(strcmp(lpstrPathSpec,"..")) 1184 1299 strcat(lpstrTmp2,&lpstrPathSpec[3]); … … 1188 1303 default: 1189 1304 { 1190 char lpstrTmp[MAX_PATH]; 1191 1305 char lpstrTmp[MAX_PATH] = ""; 1192 1306 if(strcmp(&lpstrCurrentDir[strlen(lpstrCurrentDir)-1],"\\")) 1193 1307 strcat(lpstrCurrentDir,"\\"); … … 1216 1330 { 1217 1331 /* Path does not exist */ 1218 if(fodInfos->ofnInfos .Flags & OFN_PATHMUSTEXIST)1332 if(fodInfos->ofnInfos->Flags & OFN_PATHMUSTEXIST) 1219 1333 { 1220 1334 MessageBoxA(hwnd, 1221 1335 "Path does not exist", 1222 fodInfos->ofnInfos .lpstrTitle,1336 fodInfos->ofnInfos->lpstrTitle, 1223 1337 MB_OK | MB_ICONEXCLAMATION); 1224 1338 return FALSE; … … 1273 1387 } 1274 1388 1389 { 1390 HANDLE hFile; 1391 WIN32_FIND_DATAA stffile; 1275 1392 /* browse if the user specified a directory */ 1393 hFile = FindFirstFileA(lpstrFileSpec, &stffile); 1394 if ( hFile != INVALID_HANDLE_VALUE ) 1395 { 1396 FindClose (hFile); 1397 if (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) 1276 1398 browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder, 1277 1399 lpstrFileSpec); 1400 else 1401 { 1402 // if there is an extention, then get the Pidl otherwise 1403 // we are going to need to add the extention 1404 if(strrchr(lpstrFileSpec,'.')) 1405 browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder, 1406 lpstrFileSpec); 1407 else 1408 browsePidl=NULL; 1409 } 1410 } 1411 else 1412 browsePidl=NULL; 1413 } 1414 1278 1415 if (!browsePidl) /* not a directory check the specified file exists */ 1279 1416 { 1417 int i; 1280 1418 int iExt; 1281 1419 char lpstrFileSpecTemp[MAX_PATH] = ""; … … 1285 1423 iExt = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB); 1286 1424 lpOrg = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, iExt); 1425 if (lpOrg == (LPSTR)-1) 1426 lpOrg = NULL; // we get -1 if the filetype LB is empty 1427 1287 1428 lpstrExt = lpOrg; 1288 1429 1289 1430 /* 1290 add user specified extentions to the file one by one and 1291 check if the file exists 1431 Simply take the first one of the list as default. 1432 Otherwise the user must specify which extention they want. 1433 Also, make sure we don't have a .*, in this case simply 1434 forget about the extention 1292 1435 */ 1293 while(lpOrg)1294 {1295 int i;1296 1436 lpstrExt = strchr(lpOrg, ';'); 1297 1437 if (lpstrExt) … … 1309 1449 if (strchr(lpBuf, '.')) 1310 1450 strcat(lpstrFileSpecTemp, (strchr(lpBuf, '.')) + 1); 1311 } else {1312 if (strchr(lpBuf, '.'))1313 strcat(lpstrFileSpecTemp, strchr(lpBuf, '.'));1314 1451 } 1452 else 1453 strcat(lpstrFileSpecTemp, strchr(lpBuf, '.')); 1315 1454 browsePidl = GetPidlFromName(fodInfos->Shell.FOIShellFolder, 1316 1455 lpstrFileSpecTemp); 1317 1456 MemFree((void *)lpBuf); 1318 1457 if (browsePidl) 1319 {1320 1458 strcpy(lpstrFileSpec,lpstrFileSpecTemp); 1321 break;1322 }1323 1459 if (lpstrExt) 1324 1460 lpOrg = lpstrExt+1; 1325 1461 else 1326 1462 lpOrg = NULL; 1327 }1328 1463 } 1329 1464 … … 1346 1481 SBSP_RELATIVE))) 1347 1482 { 1348 if(fodInfos->ofnInfos .Flags & OFN_PATHMUSTEXIST)1483 if(fodInfos->ofnInfos->Flags & OFN_PATHMUSTEXIST) 1349 1484 { 1350 1485 MessageBoxA(hwnd, 1351 1486 "Path does not exist", 1352 fodInfos->ofnInfos .lpstrTitle,1487 fodInfos->ofnInfos->lpstrTitle, 1353 1488 MB_OK | MB_ICONEXCLAMATION); 1354 1489 COMDLG32_SHFree(browsePidl); … … 1362 1497 /* The file does exist, so ask the user if we should overwrite it */ 1363 1498 if((fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && 1364 (fodInfos->ofnInfos .Flags & OFN_OVERWRITEPROMPT))1499 (fodInfos->ofnInfos->Flags & OFN_OVERWRITEPROMPT)) 1365 1500 { 1366 1501 strcpy(lpstrFileExist, lpstrFileSpec); … … 1369 1504 nMsgBoxRet = MessageBoxA(hwnd, 1370 1505 lpstrFileExist, 1371 fodInfos->ofnInfos .lpstrTitle,1506 fodInfos->ofnInfos->lpstrTitle, 1372 1507 MB_YESNO | MB_ICONEXCLAMATION); 1373 1508 if (nMsgBoxRet == IDNO) … … 1385 1520 /* The selected file does not exist */ 1386 1521 /* Tell the user the selected does not exist */ 1387 if(fodInfos->ofnInfos .Flags & OFN_FILEMUSTEXIST)1522 if(fodInfos->ofnInfos->Flags & OFN_FILEMUSTEXIST) 1388 1523 { 1389 1524 char lpstrNotFound[100]; … … 1400 1535 100); 1401 1536 1402 strcpy(tmp,fodInfos->ofnInfos .lpstrFile);1537 strcpy(tmp,fodInfos->ofnInfos->lpstrFile); 1403 1538 strcat(tmp,"\n"); 1404 1539 strcat(tmp,lpstrNotFound); … … 1408 1543 MessageBoxA(hwnd, 1409 1544 tmp, 1410 fodInfos->ofnInfos .lpstrTitle,1545 fodInfos->ofnInfos->lpstrTitle, 1411 1546 MB_OK | MB_ICONEXCLAMATION); 1412 1547 return FALSE; 1413 1548 } 1414 1549 /* Ask the user if he wants to create the file*/ 1415 if(fodInfos->ofnInfos .Flags & OFN_CREATEPROMPT)1550 if(fodInfos->ofnInfos->Flags & OFN_CREATEPROMPT) 1416 1551 { 1417 1552 char tmp[100]; … … 1419 1554 LoadStringA(COMMDLG_hInstance32,IDS_CREATEFILE,tmp,100); 1420 1555 1421 if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos .lpstrTitle,1556 if(IDYES == MessageBoxA(hwnd,tmp,fodInfos->ofnInfos->lpstrTitle, 1422 1557 MB_YESNO | MB_ICONQUESTION)) 1423 1558 { 1424 1559 /* Create the file, clean and exit */ 1425 FILEDLG95_Clean(hwnd);1426 1560 return EndDialog(hwnd,TRUE); 1427 1561 } … … 1429 1563 } 1430 1564 } 1565 /* check the write access to the current directory before opening the selected file */ 1566 if((fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && (fodInfos->ofnInfos->Flags & OFN_PATHMUSTEXIST)) 1567 { 1568 HANDLE hfile; 1569 char testFile[MAX_PATH]; 1570 1571 strcpy(testFile,lpstrPathSpec); 1572 strcat(testFile,"_tes_13.579"); 1573 1574 hfile = CreateFileA(testFile,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0); 1575 1576 switch(GetLastError()) 1577 { 1578 case ERROR_ACCESS_DENIED: 1579 case ERROR_WRITE_PROTECT: 1580 case ERROR_PATH_NOT_FOUND: 1581 case ERROR_FILE_NOT_FOUND: 1582 { 1583 char strAccessDenied[MAX_PATH + 100]; 1584 strcpy(strAccessDenied,lpstrPathSpec); 1585 strcat(strAccessDenied,lpstrFileSpec); 1586 strcat(strAccessDenied,"\nWrite access denied for this file !"); 1587 MessageBoxA(hwnd,strAccessDenied,fodInfos->ofnInfos->lpstrTitle,MB_OK | MB_ICONEXCLAMATION); 1588 return FALSE; 1589 } 1590 } 1591 1592 if (hfile != INVALID_HANDLE_VALUE) 1593 { 1594 CloseHandle(hfile); 1595 DeleteFileA(testFile); 1596 } 1597 1598 } 1431 1599 1432 1600 /* Open the selected file */ … … 1457 1625 } 1458 1626 1459 if(!strcmp(&lpstrExt[1],"*") && fodInfos->ofnInfos.lpstrDefExt) 1460 { 1461 lpstrExt = MemAlloc(strlen(fodInfos->ofnInfos.lpstrDefExt)+2); 1462 strcat(lpstrExt,"."); 1463 strcat(lpstrExt,(LPSTR) fodInfos->ofnInfos.lpstrDefExt); 1627 if(strcmp(lpstrExt,".*") != 0) 1628 { 1629 /* OPEN DIALOG: Let's see if the file exists with the current extention, 1630 if not return the file without the extention. 1631 SAVE DIALOG: Concatenate the extention to the file. 1632 */ 1633 1634 if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)) 1635 { 1636 LPSTR lpstrFindFile; 1637 WIN32_FIND_DATAA fd; 1638 1639 lpstrFindFile = MemAlloc(strlen(lpstrPathAndFile)+strlen(lpstrExt)); 1640 strcpy(lpstrFindFile, lpstrPathAndFile); 1641 strcat(lpstrFindFile, lpstrExt); 1642 if(FindFirstFileA(lpstrFindFile, &fd) != INVALID_HANDLE_VALUE) 1643 strcat(lpstrPathAndFile,lpstrExt); 1644 MemFree(lpstrFindFile); 1645 } 1646 else 1647 strcat(lpstrPathAndFile,lpstrExt); 1464 1648 } 1465 strcat(lpstrPathAndFile,lpstrExt);1649 MemFree( lpstrExt ); 1466 1650 } 1467 1651 } 1468 1652 /* Check that size size of the file does not exceed buffer size */ 1469 if(strlen(lpstrPathAndFile) > fodInfos->ofnInfos .nMaxFile)1653 if(strlen(lpstrPathAndFile) > fodInfos->ofnInfos->nMaxFile) 1470 1654 { 1471 1655 /* set error FNERR_BUFFERTOSMALL */ 1472 FILEDLG95_Clean(hwnd);1473 1656 return EndDialog(hwnd,FALSE); 1474 1657 } 1475 strcpy(fodInfos->ofnInfos.lpstrFile,lpstrPathAndFile); 1658 strcpy(fodInfos->ofnInfos->lpstrFile,lpstrPathAndFile); 1659 fodInfos->ofnInfos->lpstrFile[strlen(lpstrPathAndFile)] = '\0'; 1660 fodInfos->ofnInfos->lpstrFile[strlen(lpstrPathAndFile)+1] = '\0'; 1476 1661 1477 1662 /* Set the lpstrFileTitle of the OPENFILENAME structure */ 1478 if(fodInfos->ofnInfos .lpstrFileTitle)1479 strncpy(fodInfos->ofnInfos .lpstrFileTitle,1663 if(fodInfos->ofnInfos->lpstrFileTitle) 1664 strncpy(fodInfos->ofnInfos->lpstrFileTitle, 1480 1665 lpstrFileSpec, 1481 fodInfos->ofnInfos .nMaxFileTitle);1666 fodInfos->ofnInfos->nMaxFileTitle); 1482 1667 1483 1668 /* Check if the file is to be opened as read only */ … … 1485 1670 IDC_OPENREADONLY, 1486 1671 BM_GETSTATE,0,0)) 1487 SetFileAttributesA(fodInfos->ofnInfos .lpstrFile,1672 SetFileAttributesA(fodInfos->ofnInfos->lpstrFile, 1488 1673 FILE_ATTRIBUTE_READONLY); 1489 1674 1490 1675 /* nFileExtension and nFileOffset of OPENFILENAME structure */ 1491 lpstrTemp = strrchr(fodInfos->ofnInfos .lpstrFile,'\\');1492 fodInfos->ofnInfos .nFileOffset = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1;1493 lpstrTemp = strrchr(fodInfos->ofnInfos .lpstrFile,'.');1494 fodInfos->ofnInfos .nFileExtension = lpstrTemp - fodInfos->ofnInfos.lpstrFile + 1;1676 lpstrTemp = strrchr(fodInfos->ofnInfos->lpstrFile,'\\'); 1677 fodInfos->ofnInfos->nFileOffset = lpstrTemp - fodInfos->ofnInfos->lpstrFile + 1; 1678 lpstrTemp = strrchr(fodInfos->ofnInfos->lpstrFile,'.'); 1679 fodInfos->ofnInfos->nFileExtension = lpstrTemp - fodInfos->ofnInfos->lpstrFile + 1; 1495 1680 1496 1681 1497 1682 /* clean and exit */ 1498 FILEDLG95_Clean(hwnd);1499 1683 return EndDialog(hwnd,TRUE); 1500 1684 } … … 1527 1711 fodInfos->ShellInfos.hwndOwner = hwnd; 1528 1712 1529 fodInfos->ShellInfos.folderSettings.fFlags = FWF_AUTOARRANGE | FWF_ALIGNLEFT; 1713 fodInfos->ShellInfos.folderSettings.fFlags = 0; 1714 /* Disable multi-select if flag not set */ 1715 if (!(fodInfos->ofnInfos->Flags & OFN_ALLOWMULTISELECT)) 1716 { 1717 fodInfos->ShellInfos.folderSettings.fFlags |= FWF_SINGLESEL; 1718 } 1719 fodInfos->ShellInfos.folderSettings.fFlags |= FWF_AUTOARRANGE | FWF_ALIGNLEFT; 1530 1720 fodInfos->ShellInfos.folderSettings.ViewMode = FVM_LIST; 1531 1721 … … 1654 1844 char lpstrText[128+MAX_PATH]; 1655 1845 char lpstrTempText[128]; 1656 char lpstrCaption[ 256];1846 char lpstrCaption[32]; 1657 1847 1658 1848 /* Cannot Create folder because of permissions */ … … 1695 1885 TRACE("\n"); 1696 1886 1697 if(fodInfos->ofnInfos .lpstrFilter)1887 if(fodInfos->ofnInfos->lpstrFilter) 1698 1888 { 1699 1889 int iStrIndex = 0; … … 1712 1902 1713 1903 /* Get the title */ 1714 lpstrTmp = (&((LPBYTE)fodInfos->ofnInfos .lpstrFilter)[iStrIndex]);1904 lpstrTmp = (&((LPBYTE)fodInfos->ofnInfos->lpstrFilter)[iStrIndex]); 1715 1905 if(!strlen(lpstrTmp)) 1716 1906 break; 1717 1907 iStrIndex += strlen(lpstrTmp) +1; 1718 1908 /* Get the extension */ 1719 lpstrExtTmp = (&((LPBYTE)fodInfos->ofnInfos .lpstrFilter)[iStrIndex]);1909 lpstrExtTmp = (&((LPBYTE)fodInfos->ofnInfos->lpstrFilter)[iStrIndex]); 1720 1910 if(!lpstrExtTmp) 1721 1911 break; … … 1738 1928 1739 1929 /* set default filter index */ 1740 if(fodInfos->ofnInfos .nFilterIndex == 0 && fodInfos->ofnInfos.lpstrCustomFilter == NULL)1741 fodInfos->ofnInfos .nFilterIndex = 1;1930 if(fodInfos->ofnInfos->nFilterIndex == 0 && fodInfos->ofnInfos->lpstrCustomFilter == NULL) 1931 fodInfos->ofnInfos->nFilterIndex = 1; 1742 1932 /* First, check to make sure our index isn't out of bounds. */ 1743 if ( fodInfos->ofnInfos .nFilterIndex > iPos )1744 fodInfos->ofnInfos .nFilterIndex = iPos;1933 if ( fodInfos->ofnInfos->nFilterIndex > iPos ) 1934 fodInfos->ofnInfos->nFilterIndex = iPos; 1745 1935 1746 1936 1747 1937 /* Get the current index selection. */ 1748 1938 CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB, 1749 fodInfos->ofnInfos .nFilterIndex-1);1939 fodInfos->ofnInfos->nFilterIndex-1); 1750 1940 1751 1941 /* Get the corresponding text string from the combo box. */ 1752 1942 lpstrFilter = (LPSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, 1753 fodInfos->ofnInfos.nFilterIndex-1); 1943 fodInfos->ofnInfos->nFilterIndex-1); 1944 1945 if ((INT)lpstrFilter == -1) 1946 lpstrFilter = NULL; // we get -1 if the control is empty 1754 1947 1755 1948 if(lpstrFilter) … … 1774 1967 switch(wNotifyCode) 1775 1968 { 1776 case CBN_ CLOSEUP:1969 case CBN_SELENDOK: 1777 1970 { 1778 1971 LPSTR lpstrFilter; … … 1780 1973 /* Get the current item of the filetype combo box */ 1781 1974 int iItem = CBGetCurSel(fodInfos->DlgInfos.hwndFileTypeCB); 1975 1976 /* set the current filter index - indexed from 1 */ 1977 fodInfos->ofnInfos->nFilterIndex = iItem + 1; 1782 1978 1783 1979 /* Set the current filter with the current selection */ … … 1870 2066 CBSetItemHeight(hwndCombo,0,GetSystemMetrics(SM_CYSMICON)); 1871 2067 2068 #ifndef SHELL_NO_DESKTOP 1872 2069 /* Initialise data of Desktop folder */ 1873 2070 COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DESKTOP,&pidlTmp); 1874 2071 FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND); 1875 2072 COMDLG32_SHFree(pidlTmp); 2073 #endif 1876 2074 1877 2075 COMDLG32_SHGetSpecialFolderLocation(0,CSIDL_DRIVES,&pidlDrives); … … 1934 2132 int iIndentation; 1935 2133 LPSFOLDER tmpFolder; 2134 INT iIcon; 1936 2135 1937 2136 LookInInfos *liInfos = (LookInInfos *)GetPropA(pDIStruct->hwndItem,LookInInfosStr); … … 1942 2141 return 0; 1943 2142 1944 if( !(tmpFolder = (LPSFOLDER) CBGetItemDataPtr(pDIStruct->hwndItem,2143 if((LPSFOLDER)CB_ERR == (tmpFolder = (LPSFOLDER) CBGetItemDataPtr(pDIStruct->hwndItem, 1945 2144 pDIStruct->itemID))) 1946 2145 return 0; … … 1957 2156 &sfi, 1958 2157 sizeof (SHFILEINFOA), 1959 SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_ OPENICON | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME);2158 SHGFI_PIDL | SHGFI_SMALLICON | SHGFI_SYSICONINDEX | SHGFI_DISPLAYNAME); 1960 2159 len = strlen(sfi.szDisplayName)+1; 1961 2160 tmpFolder->szDisplayName = MemAlloc(len); … … 1963 2162 tmpFolder->iIcon = sfi.iIcon; 1964 2163 } 2164 2165 if((pDIStruct->itemID == liInfos->uSelectedItem) || (pDIStruct->itemState & ODS_COMBOBOXEDIT)) 2166 { 2167 if (!tmpFolder->iSelIcon) 2168 { 2169 SHFILEINFOA sfi2; 2170 2171 COMDLG32_SHGetFileInfoA((LPCSTR)tmpFolder->pidlItem,0,&sfi2,sizeof(SHFILEINFOA), 2172 SHGFI_PIDL | SHGFI_SMALLICON | 2173 SHGFI_OPENICON | SHGFI_SYSICONINDEX); 2174 tmpFolder->iSelIcon = sfi2.iIcon; 2175 } 2176 iIcon = tmpFolder->iSelIcon; 2177 } else iIcon = tmpFolder->iIcon; 2178 1965 2179 1966 2180 /* Is this item selected ?*/ … … 2001 2215 /* Draw the icon from the image list */ 2002 2216 COMDLG32_ImageList_Draw(tmpFolder->ilItemImage, 2003 tmpFolder->iIcon,2217 iIcon, 2004 2218 pDIStruct->hDC, 2005 2219 rectIcon.left, … … 2029 2243 switch(wNotifyCode) 2030 2244 { 2031 case CBN_ CLOSEUP:2245 case CBN_SELENDOK: 2032 2246 { 2033 2247 LPSFOLDER tmpFolder; … … 2064 2278 LPITEMIDLIST pidlNext; 2065 2279 SHFILEINFOA sfi; 2066 SFOLDER *tmpFolder = MemAlloc(sizeof(SFOLDER));2280 SFOLDER *tmpFolder; 2067 2281 LookInInfos *liInfos; 2068 2282 2069 2283 TRACE("\n"); 2284 2285 if(!pidl) 2286 return -1; 2070 2287 2071 2288 if(!(liInfos = (LookInInfos *)GetPropA(hwnd,LookInInfosStr))) 2072 2289 return -1; 2073 2290 2291 tmpFolder = MemAlloc(sizeof(SFOLDER)); 2074 2292 tmpFolder->m_iIndent = 0; 2075 2293 tmpFolder->szDisplayName = NULL; 2076 2077 if(!pidl)2078 return -1;2079 2294 2080 2295 /* Calculate the indentation of the item in the lookin*/ … … 2094 2309 &sfi, 2095 2310 sizeof(sfi), 2096 SHGFI_ ATTRIBUTES);2311 SHGFI_PIDL | SHGFI_ATTRIBUTES); 2097 2312 2098 2313 if((sfi.dwAttributes & SFGAO_FILESYSANCESTOR) || (sfi.dwAttributes & SFGAO_FILESYSTEM)) … … 2115 2330 } 2116 2331 2332 MemFree(tmpFolder); 2117 2333 return -1; 2118 2119 2334 } 2120 2335 … … 2433 2648 } 2434 2649 } 2650 2651 /*********************************************************************** 2652 * BrowseSelectedFolder 2653 * 2654 */ 2655 static BOOL BrowseSelectedFolder(HWND hwnd) 2656 { 2657 BOOL bBrowseSelFolder = FALSE; 2658 2659 FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) GetPropA(hwnd,FileOpenDlgInfosStr); 2660 2661 if (GetNumSelected(fodInfos->Shell.FOIShellView) == 1) 2662 { 2663 LPITEMIDLIST pidlSelection; 2664 ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 2665 2666 /* get the file selected */ 2667 EnumSelectedPidls( fodInfos->Shell.FOIShellView, 0, &pidlSelection ); 2668 IShellFolder_GetAttributesOf( fodInfos->Shell.FOIShellFolder, 1, &pidlSelection, &uAttr ); 2669 if ( uAttr & SFGAO_FOLDER ) 2670 { 2671 if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser, 2672 pidlSelection, SBSP_RELATIVE ) ) ) 2673 { 2674 MessageBoxA( hwnd, "Path does not exist", fodInfos->ofnInfos->lpstrTitle, 2675 MB_OK | MB_ICONEXCLAMATION ); 2676 } 2677 2678 bBrowseSelFolder = TRUE; 2679 } 2680 COMDLG32_SHFree( pidlSelection ); 2681 } 2682 2683 return bBrowseSelFolder; 2684 } 2685 -
trunk/src/comdlg32/filedlgbrowser.c
r3216 r3243 1 /* $Id: filedlgbrowser.c,v 1.3 2000-03-26 16:31:42 cbratschi Exp $ */ 1 2 /* 2 3 * Implementation of IShellBrowser for the File Open common dialog 3 4 * 5 * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch) 6 * Project Odin Software License can be found in LICENSE.TXT 7 * 8 * Corel WINE 20000324 level 4 9 */ 5 10 … … 41 46 static ICOM_VTABLE(IShellBrowser) IShellBrowserImpl_Vtbl = 42 47 { 48 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 43 49 /* IUnknown */ 44 50 IShellBrowserImpl_QueryInterface, … … 66 72 static ICOM_VTABLE(ICommDlgBrowser) IShellBrowserImpl_ICommDlgBrowser_Vtbl = 67 73 { 74 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 68 75 /* IUnknown */ 69 76 IShellBrowserImpl_ICommDlgBrowser_QueryInterface, … … 327 334 return NOERROR; 328 335 } 336 #ifdef SHELL_NO_DESKTOP 337 338 if(pidlTmp->mkid.cb == 0x00) 339 { 340 IShellFolder_Release(psfTmp); 341 COMDLG32_SHFree(pidlTmp); 342 return NOERROR; 343 } 344 #endif 329 345 330 346 /* Release the current fodInfos->Shell.FOIShellFolder and update its value */ … … 339 355 { 340 356 HWND hwndView; 357 HWND hDlgWnd; 358 BOOL bViewHasFocus; 359 360 /* Check if listview has focus */ 361 bViewHasFocus = IsChild(fodInfos->ShellInfos.hwndView,GetFocus()); 362 341 363 /* Get the foldersettings from the old view */ 342 364 if(fodInfos->Shell.FOIShellView) … … 383 405 fodInfos->ShellInfos.hwndView = hwndView; 384 406 407 /* changes the tab order of the ListView to reflect the window's File Dialog */ 408 hDlgWnd = GetDlgItem(GetParent(hwndView), IDC_LOOKIN); 409 SetWindowPos(hwndView, hDlgWnd, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE); 410 411 /* Since we destroyed the old view if it had focus set focus 412 to the newly created view */ 413 if (bViewHasFocus) 414 SetFocus(fodInfos->ShellInfos.hwndView); 415 385 416 return NOERROR; 386 417 } … … 662 693 else 663 694 { 664 hRes = FILEDLG95_OnOpen(This->hwndOwner);695 hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L); 665 696 } 666 697 … … 689 720 { 690 721 case CDBOSC_SETFOCUS: 722 /* FIXME: Reset the default button. 723 This should be taken care of by defdlg. If control 724 other than button receives focus the default button 725 should be restored. */ 726 SendMessageA(This->hwndOwner, DM_SETDEFID, IDOK, 0); 691 727 break; 692 728 case CDBOSC_KILLFOCUS: … … 754 790 HRESULT IShellBrowserImpl_ICommDlgBrowser_OnSelChange(ICommDlgBrowser *iface, IShellView *ppshv) 755 791 { 756 LPITEMIDLIST pidl;792 ULONG uAttr; 757 793 FileOpenDlgInfos *fodInfos; 794 UINT nFiles = 0; /* Intial to zero */ 795 UINT nCurrLength; 796 UINT nFileToOpen; 797 UINT nAllLength = 2; /* Include intial '"' and final NULL */ 798 UINT nSize = MAX_PATH; 799 UINT nFileSelected = 0; 800 LPITEMIDLIST pidlSelection; 801 LPSTR lpstrTemp = NULL; 802 LPSTR lpstrAllFile = NULL; 803 char lpstrCurrFile[MAX_PATH]; 804 758 805 _ICOM_THIS_FromICommDlgBrowser(IShellBrowserImpl,iface); 759 806 … … 761 808 TRACE("(%p)\n", This); 762 809 763 pidl = GetSelectedPidl(ppshv); 764 if (pidl) 765 { 766 HRESULT hRes = E_FAIL; 767 char lpstrFileName[MAX_PATH]; 768 ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 769 770 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidl, &ulAttr); 771 if (!ulAttr) 810 /* Locate memory and Get selected item counter */ 811 if((lpstrAllFile = (LPSTR)SHAlloc(nSize * sizeof(char))) != NULL) 812 { 813 ZeroMemory(lpstrAllFile, nSize * sizeof(char)); 814 *lpstrAllFile = '\"'; 815 lpstrTemp = lpstrAllFile + 1; 816 nFileSelected = GetNumSelected(fodInfos->Shell.FOIShellView); /* Get all selected counter */ 817 } 818 819 /* Count all selected files we have */ 820 for(nFileToOpen = 0; nFileToOpen < nFileSelected; nFileToOpen++) 821 { /* get the file selected */ 822 pidlSelection = NULL; 823 uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER; 824 ZeroMemory(lpstrCurrFile, MAX_PATH * sizeof(char)); 825 EnumSelectedPidls(fodInfos->Shell.FOIShellView, nFileToOpen, &pidlSelection); 826 827 /* get the file name and attrib of the selected files*/ 828 GetName(fodInfos->Shell.FOIShellFolder, pidlSelection, SHGDN_NORMAL, lpstrCurrFile); 829 IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, &pidlSelection, &uAttr); 830 COMDLG32_SHFree((LPVOID) pidlSelection); 831 832 if(!uAttr) 833 { /* Get the new file name */ 834 nCurrLength = lstrlenA(lpstrCurrFile); 835 if(nAllLength + nCurrLength + 3 > nSize) 836 { /* increase the memory and transfer string to new location */ 837 nSize += MAX_PATH; 838 if((lpstrTemp = (LPSTR)SHAlloc(nSize * sizeof(char))) != NULL) 839 { /* Transfer old file names */ 840 ZeroMemory(lpstrTemp, nSize * sizeof(char)); 841 lstrcpyA(lpstrTemp, lpstrAllFile); 842 SHFree(lpstrAllFile); 843 lpstrAllFile = lpstrTemp; 844 lpstrTemp = lpstrAllFile + nAllLength - 1; 845 } 846 else 847 { /* if failure, stop the loop to get filename */ 848 nFileSelected = 0; 849 } 850 } 851 852 if(lpstrTemp != NULL) 853 { /* Add the new file name */ 854 nFiles++; 855 lstrcpyA(lpstrTemp, lpstrCurrFile); 856 *(lpstrTemp + nCurrLength) = '\"'; 857 *(lpstrTemp + nCurrLength + 1) = ' '; 858 *(lpstrTemp + nCurrLength + 2) = '\"'; 859 nAllLength += nCurrLength + 3; 860 lpstrTemp = lpstrAllFile + nAllLength - 1; 861 } 862 } 863 } 864 865 if(lpstrAllFile) 866 { 867 if(nFiles > 1) 772 868 { 773 if(SUCCEEDED(hRes = GetName(fodInfos->Shell.FOIShellFolder,pidl,SHGDN_NORMAL,lpstrFileName))) 774 SetWindowTextA(fodInfos->DlgInfos.hwndFileName,lpstrFileName); 775 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) 776 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save"); 869 *(lpstrTemp - 2) = '\0'; 870 SetWindowTextA(fodInfos->DlgInfos.hwndFileName, lpstrAllFile); 777 871 } 778 872 else 779 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Open"); 873 { 874 *(lpstrTemp - 3) = '\0'; 875 SetWindowTextA(fodInfos->DlgInfos.hwndFileName, lpstrAllFile + 1); 876 } 780 877 781 878 fodInfos->DlgInfos.dwDlgProp |= FODPROP_USEVIEW; 782 783 COMDLG32_SHFree((LPVOID)pidl);784 879 SendCustomDlgNotificationMessage(This->hwndOwner, CDN_SELCHANGE); 785 return hRes; 786 } 880 SHFree( lpstrAllFile ); 881 } 882 else 883 { 884 SetWindowTextA(fodInfos->DlgInfos.hwndFileName, ""); 885 } 886 787 887 if(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) 788 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner,IDOK,"&Save"); 888 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner, IDOK, "&Save"); 889 else 890 SetDlgItemTextA(fodInfos->ShellInfos.hwndOwner, IDOK, "&Open"); 789 891 790 892 fodInfos->DlgInfos.dwDlgProp &= ~FODPROP_USEVIEW; 791 return E_FAIL; 893 894 return nFileSelected ? S_OK : E_FAIL; 792 895 } 793 896 … … 841 944 } 842 945 843 844 845 846 946 /*********************************************************************** 947 * EnumSelectedPidls 948 * 949 * Return the pidl(s) of the selected item(s) in the view. 950 * 951 */ 952 BOOL EnumSelectedPidls( IShellView *ppshv, /*[in]*/ 953 UINT nPidlIndex, /*[in]*/ 954 LPITEMIDLIST *pidlSelected /*[out]*/ ) 955 { 956 957 IDataObject *doSelected; 958 BOOL retVal = TRUE; 959 960 /* Get an IDataObject from the view */ 961 if(SUCCEEDED(IShellView_GetItemObject(ppshv, 962 SVGIO_SELECTION, 963 &IID_IDataObject, 964 (LPVOID *)&doSelected))) 965 { 966 STGMEDIUM medium; 967 FORMATETC formatetc; 968 969 /* Set the FORMATETC structure*/ 970 SETDefFormatEtc(formatetc, 971 RegisterClipboardFormatA(CFSTR_SHELLIDLIST), 972 TYMED_HGLOBAL); 973 974 /* Get the pidls from IDataObject */ 975 if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium))) 976 { 977 LPIDA cida = GlobalLock(medium.u.hGlobal); 978 if(nPidlIndex < cida->cidl) 979 { 980 *pidlSelected = COMDLG32_PIDL_ILClone((LPITEMIDLIST)(&((LPBYTE)cida)[cida->aoffset[nPidlIndex + 1]])); 981 } 982 else 983 { 984 retVal = FALSE; 985 } 986 987 if(medium.pUnkForRelease) 988 { 989 IUnknown_Release(medium.pUnkForRelease); 990 } 991 else 992 { 993 GlobalUnlock(medium.u.hGlobal); 994 GlobalFree(medium.u.hGlobal); 995 } 996 } 997 IDataObject_Release(doSelected); 998 return retVal; 999 } 1000 return FALSE; 1001 } 1002 1003 /*********************************************************************** 1004 * GetNumSelected 1005 * 1006 * Return the number of selected items in the view. 1007 * 1008 */ 1009 UINT GetNumSelected( IShellView *ppshv ) 1010 { 1011 IDataObject *doSelected; 1012 UINT retVal = 0; 1013 1014 /* Get an IDataObject from the view */ 1015 if(SUCCEEDED(IShellView_GetItemObject(ppshv, 1016 SVGIO_SELECTION, 1017 &IID_IDataObject, 1018 (LPVOID *)&doSelected))) 1019 { 1020 STGMEDIUM medium; 1021 FORMATETC formatetc; 1022 1023 /* Set the FORMATETC structure*/ 1024 SETDefFormatEtc(formatetc, 1025 RegisterClipboardFormatA(CFSTR_SHELLIDLIST), 1026 TYMED_HGLOBAL); 1027 1028 /* Get the pidls from IDataObject */ 1029 if(SUCCEEDED(IDataObject_GetData(doSelected,&formatetc,&medium))) 1030 { 1031 LPIDA cida = GlobalLock(medium.u.hGlobal); 1032 retVal = cida->cidl; 1033 1034 if(medium.pUnkForRelease) 1035 IUnknown_Release(medium.pUnkForRelease); 1036 else 1037 { 1038 GlobalUnlock(medium.u.hGlobal); 1039 GlobalFree(medium.u.hGlobal); 1040 } 1041 } 1042 IDataObject_Release(doSelected); 1043 return retVal; 1044 } 1045 1046 return 0; 1047 } 1048 1049 1050 -
trunk/src/comdlg32/filedlgbrowser.h
r2607 r3243 1 1 /* 2 2 * Implementation of IShellBrowser for the File Open common dialog 3 *4 3 * 4 * Corel WINE 20000324 level 5 5 */ 6 6 … … 21 21 22 22 #define FODPROP_SAVEDLG 0x0001 /* File dialog is a Save file dialog */ 23 #define FODPROP_USEVIEW 0x0002 /* Indicates the user selection must be taken 24 from the IShellView */23 #define FODPROP_USEVIEW 0x0002 /* Indicates the user selection must be taken 24 from the IShellView */ 25 25 26 26 /*********************************************************************** … … 41 41 typedef struct 42 42 { 43 44 OPENFILENAMEA ofnInfos;43 44 LPOPENFILENAMEA ofnInfos; 45 45 struct { 46 IShellBrowser *FOIShellBrowser; 46 IShellBrowser *FOIShellBrowser; 47 47 IShellFolder *FOIShellFolder; 48 48 IShellView *FOIShellView; … … 62 62 HWND hwndLookInCB; 63 63 HWND hwndFileName; 64 HWND hwndTB;64 HWND hwndTB; 65 65 HWND hwndCustomDlg; 66 DWORD dwDlgProp;66 DWORD dwDlgProp; 67 67 } DlgInfos; 68 68 … … 72 72 * Control ID's 73 73 */ 74 #define IDS_ABOUTBOX 10175 #define IDS_DOCUMENTFOLDERS 10276 #define IDS_PERSONAL 10377 #define IDS_FAVORITES 10478 #define IDS_PATH 10579 #define IDS_DESKTOP 10680 81 #define IDS_FONTS 10882 #define IDS_MYCOMPUTER 11083 #define IDS_SYSTEMFOLDERS 11284 #define IDS_LOCALHARDRIVES 11385 74 #define IDS_FILENOTFOUND 114 86 75 #define IDS_VERIFYFILE 115 … … 89 78 #define IDS_FILEOPEN_CAPTION 118 90 79 80 /* File Dialog Tooltips string IDs */ 81 82 #define IDS_UPFOLDER 150 83 #define IDS_NEWFOLDER 151 84 #define IDS_LISTVIEW 152 85 #define IDS_REPORTVIEW 153 86 91 87 #define IDC_OPENREADONLY chx1 92 88 93 #define IDC_TOOLBARSTATIC stc189 #define IDC_TOOLBARSTATIC stc1 94 90 #define IDC_FILETYPESTATIC stc2 95 91 #define IDC_FILENAMESTATIC stc3 … … 103 99 #define IDC_FILENAME edt1 104 100 105 #define IDC_TOOLBAR ctl1101 #define IDC_TOOLBAR ctl1 106 102 107 103 /*********************************************************************** … … 113 109 /* IUnknown */ 114 110 HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface, 115 REFIID riid, 111 REFIID riid, 116 112 LPVOID *ppvObj); 117 113 … … 121 117 122 118 /* IOleWindow */ 123 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 119 HRESULT WINAPI IShellBrowserImpl_GetWindow(IShellBrowser * iface, 124 120 HWND * phwnd); 125 121 … … 129 125 /* IShellBrowser */ 130 126 131 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, 132 LPCITEMIDLIST pidl, 127 HRESULT WINAPI IShellBrowserImpl_BrowseObject(IShellBrowser *iface, 128 LPCITEMIDLIST pidl, 133 129 UINT wFlags); 134 130 135 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface, 131 HRESULT WINAPI IShellBrowserImpl_EnableModelessSB(IShellBrowser *iface, 136 132 BOOL fEnable); 137 138 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface, 139 UINT id, 133 134 HRESULT WINAPI IShellBrowserImpl_GetControlWindow(IShellBrowser *iface, 135 UINT id, 140 136 HWND *lphwnd); 141 137 142 138 HRESULT WINAPI IShellBrowserImpl_GetViewStateStream(IShellBrowser *iface, 143 DWORD grfMode, 139 DWORD grfMode, 144 140 LPSTREAM *ppStrm); 145 141 … … 150 146 HRESULT WINAPI IShellBrowserImpl_OnViewWindowActive(IShellBrowser *iface, 151 147 IShellView *ppshv); 152 148 153 149 154 150 HRESULT WINAPI IShellBrowserImpl_QueryActiveShellView(IShellBrowser *iface, … … 158 154 HMENU hmenuShared); 159 155 160 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface, 161 UINT id, 162 UINT uMsg, 163 WPARAM wParam, 156 HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface, 157 UINT id, 158 UINT uMsg, 159 WPARAM wParam, 164 160 LPARAM lParam, 165 161 LRESULT *pret); 166 162 167 163 HRESULT WINAPI IShellBrowserImpl_SetMenuSB(IShellBrowser *iface, 168 HMENU hmenuShared, 164 HMENU hmenuShared, 169 165 HOLEMENU holemenuReserved, 170 166 HWND hwndActiveObject); … … 172 168 HRESULT WINAPI IShellBrowserImpl_SetStatusTextSB(IShellBrowser *iface, 173 169 LPCOLESTR lpszStatusText); 174 170 175 171 176 172 HRESULT WINAPI IShellBrowserImpl_SetToolbarItems(IShellBrowser *iface, 177 LPTBBUTTON lpButtons, 178 UINT nButtons, 173 LPTBBUTTON lpButtons, 174 UINT nButtons, 179 175 UINT uFlags); 180 176 181 177 HRESULT WINAPI IShellBrowserImpl_TranslateAcceleratorSB(IShellBrowser *iface, 182 LPMSG lpmsg, 178 LPMSG lpmsg, 183 179 WORD wID); 184 180 … … 187 183 188 184 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_QueryInterface(ICommDlgBrowser *iface, 189 REFIID riid, 185 REFIID riid, 190 186 LPVOID *ppvObj); 191 187 … … 201 197 ULONG uChange); 202 198 203 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, 199 HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBrowser *iface, 204 200 IShellView * ppshv, 205 201 LPCITEMIDLIST pidl); … … 208 204 209 205 LPITEMIDLIST GetSelectedPidl(IShellView *ppshv); 206 BOOL EnumSelectedPidls(IShellView *ppshv, UINT nPidlIndex, LPITEMIDLIST *pidlSelected); 207 UINT GetNumSelected(IShellView *ppshv); 210 208 211 209 #endif /*SHBROWSER_H*/ -
trunk/src/comdlg32/filetitle.c
r2607 r3243 4 4 * Copyright 1994 Martin Ayotte 5 5 * Copyright 1996 Albrecht Kleine 6 * 7 * Corel WINE 20000324 level 6 8 */ 7 9 … … 13 15 #include "debugtools.h" 14 16 15 #include "heap.h" /* Has to go */17 #include "heap.h" /* Has to go */ 16 18 17 19 DEFAULT_DEBUG_CHANNEL(commdlg) … … 24 26 25 27 /*********************************************************************** 26 * GetFileTitleA(COMDLG32.8)28 * GetFileTitleA (COMDLG32.8) 27 29 * 28 30 */ 29 31 short WINAPI GetFileTitleA(LPCSTR lpFile, LPSTR lpTitle, UINT cbBuf) 30 32 { 31 int i, len;33 int i, len; 32 34 33 TRACE("(%p %p %d); \n", lpFile, lpTitle, cbBuf);35 TRACE("(%p %p %d); \n", lpFile, lpTitle, cbBuf); 34 36 35 if(lpFile == NULL || (lpTitle == NULL && cbBuf != 0))36 return -1;37 if(lpFile == NULL || (lpTitle == NULL)) 38 return -1; 37 39 38 len = strlen(lpFile);40 len = strlen(lpFile); 39 41 40 if (len == 0)41 return -1;42 if (len == 0) 43 return -1; 42 44 43 if(strpbrk(lpFile, "*[]"))44 return -1;45 if(strpbrk(lpFile, "*[]")) 46 return -1; 45 47 46 len--;48 len--; 47 49 48 if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':')49 return -1;50 if(lpFile[len] == '/' || lpFile[len] == '\\' || lpFile[len] == ':') 51 return -1; 50 52 51 for(i = len; i >= 0; i--)52 {53 if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':')54 {55 i++;56 break;57 }58 }53 for(i = len; i >= 0; i--) 54 { 55 if (lpFile[i] == '/' || lpFile[i] == '\\' || lpFile[i] == ':') 56 { 57 i++; 58 break; 59 } 60 } 59 61 60 if(i == -1)61 i++;62 if(i == -1) 63 i++; 62 64 63 TRACE("---> '%s' \n", &lpFile[i]); 64 65 len = strlen(lpFile+i)+1; 66 if(cbBuf < len) 67 return len; 65 TRACE("---> '%s' \n", &lpFile[i]); 68 66 69 /* The lpTitle buffer is big enough, perform a simple copy */ 70 strcpy(lpTitle, &lpFile[i]); 71 return 0; 67 len = strlen(lpFile+i)+1; 68 if(cbBuf < len) 69 return len; 70 71 strncpy(lpTitle,&lpFile[i],len); 72 return 0; 72 73 } 73 74 74 75 75 76 /*********************************************************************** 76 * GetFileTitleW(COMDLG32.9)77 * GetFileTitleW (COMDLG32.9) 77 78 * 78 79 */ 79 80 short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, UINT cbBuf) 80 81 { 81 LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile);/* Has to go */82 LPSTR title = HeapAlloc(GetProcessHeap(), 0, cbBuf);83 shortret;82 LPSTR file = HEAP_strdupWtoA(GetProcessHeap(), 0, lpFile); /* Has to go */ 83 LPSTR title = HeapAlloc(GetProcessHeap(), 0, cbBuf); 84 short ret; 84 85 85 ret = GetFileTitleA(file, title, cbBuf);86 ret = GetFileTitleA(file, title, cbBuf); 86 87 87 lstrcpynAtoW(lpTitle, title, cbBuf);88 HeapFree(GetProcessHeap(), 0, file);89 HeapFree(GetProcessHeap(), 0, title);90 return ret;88 lstrcpynAtoW(lpTitle, title, cbBuf); 89 HeapFree(GetProcessHeap(), 0, file); 90 HeapFree(GetProcessHeap(), 0, title); 91 return ret; 91 92 } 92 93 93 94 94 95 /*********************************************************************** 95 * GetFileTitle16(COMMDLG.27)96 * GetFileTitle16 (COMMDLG.27) 96 97 */ 97 98 short WINAPI GetFileTitle16(LPCSTR lpFile, LPSTR lpTitle, UINT16 cbBuf) 98 99 { 99 return GetFileTitleA(lpFile, lpTitle, cbBuf);100 return GetFileTitleA(lpFile, lpTitle, cbBuf); 100 101 } 101 102 -
trunk/src/comdlg32/finddlg32.cpp
r1557 r3243 1 /* $Id: finddlg32.cpp,v 1. 2 1999-11-02 20:37:43 sandervlExp $ */1 /* $Id: finddlg32.cpp,v 1.3 2000-03-26 16:31:44 cbratschi Exp $ */ 2 2 /* 3 3 * Common Dialog Boxes interface (32 bit) (990815) … … 5 5 * 6 6 * Copyright 1998,1999 Bertho A. Stultiens 7 * 8 * Corel WINE 20000324 level 7 9 */ 8 10 … … 24 26 /*-----------------------------------------------------------------------*/ 25 27 26 static UINT FindReplaceMessage;27 static UINT HelpMessage;28 29 #define FR_MASK (FR_DOWN | FR_MATCHCASE | FR_WHOLEWORD | FR_REPLACEALL | FR_REPLACE | FR_FINDNEXT | FR_DIALOGTERM)28 static UINT FindReplaceMessage; 29 static UINT HelpMessage; 30 31 #define FR_MASK (FR_DOWN | FR_MATCHCASE | FR_WHOLEWORD | FR_REPLACEALL | FR_REPLACE | FR_FINDNEXT | FR_DIALOGTERM) 30 32 /* CRITICAL_SECTION COMDLG32_CritSect; */ 31 33 … … 49 51 50 52 /*********************************************************************** 51 * COMDLG32_FR_GetFlags[internal]53 * COMDLG32_FR_GetFlags [internal] 52 54 * Returns the button state that needs to be reported to the caller. 53 * RETURNS54 * Current state of check and radio buttons55 * RETURNS 56 * Current state of check and radio buttons 55 57 */ 56 58 static DWORD COMDLG32_FR_GetFlags(HWND hDlgWnd) 57 59 { 58 DWORD flags = 0;59 if(IsDlgButtonChecked(hDlgWnd, rad2) == BST_CHECKED)60 flags |= FR_DOWN;61 if(IsDlgButtonChecked(hDlgWnd, chx1) == BST_CHECKED)62 flags |= FR_WHOLEWORD;63 if(IsDlgButtonChecked(hDlgWnd, chx2) == BST_CHECKED)64 flags |= FR_MATCHCASE;60 DWORD flags = 0; 61 if(IsDlgButtonChecked(hDlgWnd, rad2) == BST_CHECKED) 62 flags |= FR_DOWN; 63 if(IsDlgButtonChecked(hDlgWnd, chx1) == BST_CHECKED) 64 flags |= FR_WHOLEWORD; 65 if(IsDlgButtonChecked(hDlgWnd, chx2) == BST_CHECKED) 66 flags |= FR_MATCHCASE; 65 67 return flags; 66 68 } 67 69 68 70 /*********************************************************************** 69 * COMDLG32_FR_HandleWMCommand[internal]71 * COMDLG32_FR_HandleWMCommand [internal] 70 72 * Handle WM_COMMAND messages... 71 73 */ 72 74 static void COMDLG32_FR_HandleWMCommand(HWND hDlgWnd, COMDLG32_FR_Data *pData, int Id, int NotifyCode) 73 75 { 74 DWORD flag;75 76 pData->user_fr.fra->Flags &= ~FR_MASK;/* Clear return flags */77 if(pData->fr.Flags & FR_WINE_REPLACE)/* Replace always goes down... */78 pData->user_fr.fra->Flags |= FR_DOWN;79 80 if(NotifyCode == BN_CLICKED)81 { 82 switch(Id)83 {84 case IDOK: /* Find Next */85 if(GetDlgItemTextA(hDlgWnd, edt1, pData->fr.lpstrFindWhat, pData->fr.wFindWhatLen) > 0)76 DWORD flag; 77 78 pData->user_fr.fra->Flags &= ~FR_MASK; /* Clear return flags */ 79 if(pData->fr.Flags & FR_WINE_REPLACE) /* Replace always goes down... */ 80 pData->user_fr.fra->Flags |= FR_DOWN; 81 82 if(NotifyCode == BN_CLICKED) 83 { 84 switch(Id) 85 { 86 case IDOK: /* Find Next */ 87 if(GetDlgItemTextA(hDlgWnd, edt1, pData->fr.lpstrFindWhat, pData->fr.wFindWhatLen) > 0) 86 88 { 87 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_FINDNEXT;89 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_FINDNEXT; 88 90 if(pData->fr.Flags & FR_WINE_UNICODE) 89 91 { 90 lstrcpyAtoW(pData->user_fr.frw->lpstrFindWhat, pData->fr.lpstrFindWhat);92 lstrcpyAtoW(pData->user_fr.frw->lpstrFindWhat, pData->fr.lpstrFindWhat); 91 93 } 92 94 else 93 95 { 94 lstrcpyA(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat);96 lstrcpyA(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat); 95 97 } 96 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);98 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra); 97 99 } 98 break;99 100 case IDCANCEL:101 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_DIALOGTERM;102 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);103 DestroyWindow(hDlgWnd);104 break;100 break; 101 102 case IDCANCEL: 103 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | FR_DIALOGTERM; 104 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra); 105 DestroyWindow(hDlgWnd); 106 break; 105 107 106 108 case psh2: /* Replace All */ 107 flag = FR_REPLACEALL;109 flag = FR_REPLACEALL; 108 110 goto Replace; 109 111 110 112 case psh1: /* Replace */ 111 flag = FR_REPLACE;113 flag = FR_REPLACE; 112 114 Replace: 113 if((pData->fr.Flags & FR_WINE_REPLACE)115 if((pData->fr.Flags & FR_WINE_REPLACE) 114 116 && GetDlgItemTextA(hDlgWnd, edt1, pData->fr.lpstrFindWhat, pData->fr.wFindWhatLen) > 0) 115 117 { 116 pData->fr.lpstrReplaceWith[0] = 0; /* In case the next GetDlgItemText Fails */117 GetDlgItemTextA(hDlgWnd, edt2, pData->fr.lpstrReplaceWith, pData->fr.wReplaceWithLen);118 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | flag;118 pData->fr.lpstrReplaceWith[0] = 0; /* In case the next GetDlgItemText Fails */ 119 GetDlgItemTextA(hDlgWnd, edt2, pData->fr.lpstrReplaceWith, pData->fr.wReplaceWithLen); 120 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd) | flag; 119 121 if(pData->fr.Flags & FR_WINE_UNICODE) 120 122 { 121 lstrcpyAtoW(pData->user_fr.frw->lpstrFindWhat, pData->fr.lpstrFindWhat);122 lstrcpyAtoW(pData->user_fr.frw->lpstrReplaceWith, pData->fr.lpstrReplaceWith);123 lstrcpyAtoW(pData->user_fr.frw->lpstrFindWhat, pData->fr.lpstrFindWhat); 124 lstrcpyAtoW(pData->user_fr.frw->lpstrReplaceWith, pData->fr.lpstrReplaceWith); 123 125 } 124 126 else 125 127 { 126 lstrcpyA(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat);127 lstrcpyA(pData->user_fr.fra->lpstrReplaceWith, pData->fr.lpstrReplaceWith);128 lstrcpyA(pData->user_fr.fra->lpstrFindWhat, pData->fr.lpstrFindWhat); 129 lstrcpyA(pData->user_fr.fra->lpstrReplaceWith, pData->fr.lpstrReplaceWith); 128 130 } 129 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra);131 SendMessageA(pData->fr.hwndOwner, FindReplaceMessage, 0, (LPARAM)pData->user_fr.fra); 130 132 } 131 break;132 133 case pshHelp:134 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd);135 SendMessageA(pData->fr.hwndOwner, HelpMessage, (WPARAM)hDlgWnd, (LPARAM)pData->user_fr.fra);136 break;133 break; 134 135 case pshHelp: 136 pData->user_fr.fra->Flags |= COMDLG32_FR_GetFlags(hDlgWnd); 137 SendMessageA(pData->fr.hwndOwner, HelpMessage, (WPARAM)hDlgWnd, (LPARAM)pData->user_fr.fra); 138 break; 137 139 } 138 140 } 139 141 else if(NotifyCode == EN_CHANGE && Id == edt1) 140 {141 BOOL enable = SendDlgItemMessageA(hDlgWnd, edt1, WM_GETTEXTLENGTH, 0, 0) > 0;142 EnableWindow(GetDlgItem(hDlgWnd, IDOK), enable);142 { 143 BOOL enable = SendDlgItemMessageA(hDlgWnd, edt1, WM_GETTEXTLENGTH, 0, 0) > 0; 144 EnableWindow(GetDlgItem(hDlgWnd, IDOK), enable); 143 145 if(pData->fr.Flags & FR_WINE_REPLACE) 144 146 { 145 EnableWindow(GetDlgItem(hDlgWnd, psh1), enable);146 EnableWindow(GetDlgItem(hDlgWnd, psh2), enable);147 } 148 }149 } 150 151 /*********************************************************************** 152 * COMDLG32_FindReplaceDlgProc[internal]147 EnableWindow(GetDlgItem(hDlgWnd, psh1), enable); 148 EnableWindow(GetDlgItem(hDlgWnd, psh2), enable); 149 } 150 } 151 } 152 153 /*********************************************************************** 154 * COMDLG32_FindReplaceDlgProc [internal] 153 155 * [Find/Replace]Text32[A/W] window procedure. 154 156 */ 155 157 static BOOL CALLBACK COMDLG32_FindReplaceDlgProc(HWND hDlgWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) 156 158 { 157 COMDLG32_FR_Data *pdata = (COMDLG32_FR_Data *)GetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom);158 BOOL retval = TRUE;;159 160 if(iMsg == WM_INITDIALOG)159 COMDLG32_FR_Data *pdata = (COMDLG32_FR_Data *)GetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom); 160 BOOL retval = TRUE;; 161 162 if(iMsg == WM_INITDIALOG) 161 163 { 162 164 pdata = (COMDLG32_FR_Data *)lParam; 163 if(!SetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom, (HANDLE)pdata))164 { 165 ERR("Could not Set prop; invent a gracefull exit?...\n");166 DestroyWindow(hDlgWnd);165 if(!SetPropA(hDlgWnd, (LPSTR)COMDLG32_Atom, (HANDLE)pdata)) 166 { 167 ERR("Could not Set prop; invent a gracefull exit?...\n"); 168 DestroyWindow(hDlgWnd); 167 169 return FALSE; 168 170 } 169 SendDlgItemMessageA(hDlgWnd, edt1, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wFindWhatLen, 0);170 SendDlgItemMessageA(hDlgWnd, edt1, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrFindWhat);171 SendDlgItemMessageA(hDlgWnd, edt1, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wFindWhatLen, 0); 172 SendDlgItemMessageA(hDlgWnd, edt1, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrFindWhat); 171 173 if(pdata->fr.Flags & FR_WINE_REPLACE) 172 174 { 173 SendDlgItemMessageA(hDlgWnd, edt2, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wReplaceWithLen, 0);174 SendDlgItemMessageA(hDlgWnd, edt2, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrReplaceWith);175 } 176 177 if(!(pdata->fr.Flags & FR_SHOWHELP))178 ShowWindow(GetDlgItem(hDlgWnd, pshHelp), SW_HIDE);179 if(pdata->fr.Flags & FR_HIDEUPDOWN)180 {181 ShowWindow(GetDlgItem(hDlgWnd, rad1), SW_HIDE);182 ShowWindow(GetDlgItem(hDlgWnd, rad2), SW_HIDE);183 ShowWindow(GetDlgItem(hDlgWnd, grp1), SW_HIDE);184 }185 else if(pdata->fr.Flags & FR_NOUPDOWN)186 {187 EnableWindow(GetDlgItem(hDlgWnd, rad1), FALSE);188 EnableWindow(GetDlgItem(hDlgWnd, rad2), FALSE);189 EnableWindow(GetDlgItem(hDlgWnd, grp1), FALSE);190 }175 SendDlgItemMessageA(hDlgWnd, edt2, EM_SETLIMITTEXT, (WPARAM)pdata->fr.wReplaceWithLen, 0); 176 SendDlgItemMessageA(hDlgWnd, edt2, WM_SETTEXT, 0, (LPARAM)pdata->fr.lpstrReplaceWith); 177 } 178 179 if(!(pdata->fr.Flags & FR_SHOWHELP)) 180 ShowWindow(GetDlgItem(hDlgWnd, pshHelp), SW_HIDE); 181 if(pdata->fr.Flags & FR_HIDEUPDOWN) 182 { 183 ShowWindow(GetDlgItem(hDlgWnd, rad1), SW_HIDE); 184 ShowWindow(GetDlgItem(hDlgWnd, rad2), SW_HIDE); 185 ShowWindow(GetDlgItem(hDlgWnd, grp1), SW_HIDE); 186 } 187 else if(pdata->fr.Flags & FR_NOUPDOWN) 188 { 189 EnableWindow(GetDlgItem(hDlgWnd, rad1), FALSE); 190 EnableWindow(GetDlgItem(hDlgWnd, rad2), FALSE); 191 EnableWindow(GetDlgItem(hDlgWnd, grp1), FALSE); 192 } 191 193 else 192 194 { 193 SendDlgItemMessageA(hDlgWnd, rad1, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? 0 : BST_CHECKED, 0);194 SendDlgItemMessageA(hDlgWnd, rad2, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? BST_CHECKED : 0, 0);195 } 196 197 if(pdata->fr.Flags & FR_HIDEMATCHCASE)198 ShowWindow(GetDlgItem(hDlgWnd, chx2), SW_HIDE);199 else if(pdata->fr.Flags & FR_NOMATCHCASE)200 EnableWindow(GetDlgItem(hDlgWnd, chx2), FALSE);195 SendDlgItemMessageA(hDlgWnd, rad1, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? 0 : BST_CHECKED, 0); 196 SendDlgItemMessageA(hDlgWnd, rad2, BM_SETCHECK, pdata->fr.Flags & FR_DOWN ? BST_CHECKED : 0, 0); 197 } 198 199 if(pdata->fr.Flags & FR_HIDEMATCHCASE) 200 ShowWindow(GetDlgItem(hDlgWnd, chx2), SW_HIDE); 201 else if(pdata->fr.Flags & FR_NOMATCHCASE) 202 EnableWindow(GetDlgItem(hDlgWnd, chx2), FALSE); 201 203 else 202 SendDlgItemMessageA(hDlgWnd, chx2, BM_SETCHECK, pdata->fr.Flags & FR_MATCHCASE ? BST_CHECKED : 0, 0);203 204 if(pdata->fr.Flags & FR_HIDEWHOLEWORD)205 ShowWindow(GetDlgItem(hDlgWnd, chx1), SW_HIDE);206 else if(pdata->fr.Flags & FR_NOWHOLEWORD)207 EnableWindow(GetDlgItem(hDlgWnd, chx1), FALSE);204 SendDlgItemMessageA(hDlgWnd, chx2, BM_SETCHECK, pdata->fr.Flags & FR_MATCHCASE ? BST_CHECKED : 0, 0); 205 206 if(pdata->fr.Flags & FR_HIDEWHOLEWORD) 207 ShowWindow(GetDlgItem(hDlgWnd, chx1), SW_HIDE); 208 else if(pdata->fr.Flags & FR_NOWHOLEWORD) 209 EnableWindow(GetDlgItem(hDlgWnd, chx1), FALSE); 208 210 else 209 SendDlgItemMessageA(hDlgWnd, chx1, BM_SETCHECK, pdata->fr.Flags & FR_WHOLEWORD ? BST_CHECKED : 0, 0);210 211 /* We did the init here, now call the hook if requested */211 SendDlgItemMessageA(hDlgWnd, chx1, BM_SETCHECK, pdata->fr.Flags & FR_WHOLEWORD ? BST_CHECKED : 0, 0); 212 213 /* We did the init here, now call the hook if requested */ 212 214 #ifdef __WIN32OS2__ 213 //SvL: If hooked and hook returns TRUE, then show dialog214 // -> if not hooked, just display it!215 if(!(pdata->fr.Flags & FR_ENABLEHOOK) ||216 pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, pdata->fr.lCustData))215 //SvL: If hooked and hook returns TRUE, then show dialog 216 // -> if not hooked, just display it! 217 if(!(pdata->fr.Flags & FR_ENABLEHOOK) || 218 pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, pdata->fr.lCustData)) 217 219 #else 218 if((pdata->fr.Flags & FR_ENABLEHOOK)219 && pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, pdata->fr.lCustData))220 if((pdata->fr.Flags & FR_ENABLEHOOK) 221 && pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, pdata->fr.lCustData)) 220 222 #endif 221 {222 ShowWindow(hDlgWnd, SW_SHOWNORMAL);223 UpdateWindow(hDlgWnd);224 }225 /* else the caller is responsible for showing */223 { 224 ShowWindow(hDlgWnd, SW_SHOWNORMAL); 225 UpdateWindow(hDlgWnd); 226 } 227 /* else the caller is responsible for showing */ 226 228 return TRUE; 227 229 } 228 230 229 if(pdata && (pdata->fr.Flags & FR_ENABLEHOOK))230 {231 retval = pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, lParam);232 }233 else234 retval = FALSE;235 236 if(pdata && !retval)237 { 238 retval = TRUE;239 switch(iMsg)240 {241 case WM_COMMAND:242 COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, LOWORD(wParam), HIWORD(wParam));243 break;244 245 case WM_CLOSE:246 COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, IDCANCEL, BN_CLICKED);247 break;248 249 case WM_HELP:250 /* Heeeeelp! */251 FIXME("Got WM_HELP. Who is gonna supply it?\n");252 break;253 254 case WM_CONTEXTMENU:255 /* Heeeeelp! */256 FIXME("Got WM_CONTEXTMENU. Who is gonna supply it?\n");257 break;258 /* FIXME: Handle F1 help */259 260 default:261 retval = FALSE;/* We did not handle the message */262 }231 if(pdata && (pdata->fr.Flags & FR_ENABLEHOOK)) 232 { 233 retval = pdata->fr.lpfnHook(hDlgWnd, iMsg, wParam, lParam); 234 } 235 else 236 retval = FALSE; 237 238 if(pdata && !retval) 239 { 240 retval = TRUE; 241 switch(iMsg) 242 { 243 case WM_COMMAND: 244 COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, LOWORD(wParam), HIWORD(wParam)); 245 break; 246 247 case WM_CLOSE: 248 COMDLG32_FR_HandleWMCommand(hDlgWnd, pdata, IDCANCEL, BN_CLICKED); 249 break; 250 251 case WM_HELP: 252 /* Heeeeelp! */ 253 FIXME("Got WM_HELP. Who is gonna supply it?\n"); 254 break; 255 256 case WM_CONTEXTMENU: 257 /* Heeeeelp! */ 258 FIXME("Got WM_CONTEXTMENU. Who is gonna supply it?\n"); 259 break; 260 /* FIXME: Handle F1 help */ 261 262 default: 263 retval = FALSE; /* We did not handle the message */ 264 } 263 265 } 264 266 … … 269 271 if(iMsg == WM_DESTROY) 270 272 { 271 RemovePropA(hDlgWnd, (LPSTR)COMDLG32_Atom);272 HeapFree(GetProcessHeap(), 0, pdata);273 RemovePropA(hDlgWnd, (LPSTR)COMDLG32_Atom); 274 HeapFree(GetProcessHeap(), 0, pdata); 273 275 } 274 276 … … 277 279 278 280 /*********************************************************************** 279 * COMDLG32_FR_CheckPartial[internal]281 * COMDLG32_FR_CheckPartial [internal] 280 282 * Check various fault conditions in the supplied parameters that 281 283 * cause an extended error to be reported. 282 * RETURNS283 * TRUE: Succes284 * FALSE: Failure284 * RETURNS 285 * TRUE: Succes 286 * FALSE: Failure 285 287 */ 286 288 static BOOL COMDLG32_FR_CheckPartial( 287 LPFINDREPLACEA pfr,/* [in] Find structure */288 BOOL Replace /* [in] True if called as replace */289 LPFINDREPLACEA pfr, /* [in] Find structure */ 290 BOOL Replace /* [in] True if called as replace */ 289 291 ) { 290 if(!pfr)291 { 292 COMDLG32_SetCommDlgExtendedError(CDERR_GENERALCODES);293 return FALSE; 294 }292 if(!pfr) 293 { 294 COMDLG32_SetCommDlgExtendedError(CDERR_GENERALCODES); 295 return FALSE; 296 } 295 297 296 298 if(pfr->lStructSize != sizeof(FINDREPLACEA)) 297 299 { 298 COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE);299 return FALSE;300 COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE); 301 return FALSE; 300 302 } 301 303 302 304 if(!IsWindow(pfr->hwndOwner)) 303 305 { 304 COMDLG32_SetCommDlgExtendedError(CDERR_DIALOGFAILURE);305 return FALSE;306 COMDLG32_SetCommDlgExtendedError(CDERR_DIALOGFAILURE); 307 return FALSE; 306 308 } 307 309 308 310 #ifdef __WIN32OS2__ 309 //SvL: Notepad set this to 32310 if((!pfr->lpstrFindWhat)311 //SvL: Notepad set this to 32 312 if((!pfr->lpstrFindWhat) 311 313 #else 312 if((pfr->wFindWhatLen < 80 || !pfr->lpstrFindWhat)314 if((pfr->wFindWhatLen < 80 || !pfr->lpstrFindWhat) 313 315 #endif 314 316 ||(Replace && (pfr->wReplaceWithLen < 80 || !pfr->lpstrReplaceWith))) 315 317 { 316 COMDLG32_SetCommDlgExtendedError(FRERR_BUFFERLENGTHZERO);317 return FALSE; 318 } 319 320 if((FindReplaceMessage = RegisterWindowMessageA(FINDMSGSTRING)) == 0)321 { 322 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);323 return FALSE; 324 } 325 if((HelpMessage = RegisterWindowMessageA(HELPMSGSTRING)) == 0)326 { 327 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL);318 COMDLG32_SetCommDlgExtendedError(FRERR_BUFFERLENGTHZERO); 319 return FALSE; 320 } 321 322 if((FindReplaceMessage = RegisterWindowMessageA(FINDMSGSTRING)) == 0) 323 { 324 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL); 325 return FALSE; 326 } 327 if((HelpMessage = RegisterWindowMessageA(HELPMSGSTRING)) == 0) 328 { 329 COMDLG32_SetCommDlgExtendedError(CDERR_REGISTERMSGFAIL); 328 330 return FALSE; 329 331 } … … 331 333 if((pfr->Flags & FR_ENABLEHOOK) && !pfr->lpfnHook) 332 334 { 333 COMDLG32_SetCommDlgExtendedError(CDERR_NOHOOK);335 COMDLG32_SetCommDlgExtendedError(CDERR_NOHOOK); 334 336 return FALSE; 335 337 } … … 337 339 if((pfr->Flags & (FR_ENABLETEMPLATE | FR_ENABLETEMPLATEHANDLE)) && !pfr->hInstance) 338 340 { 339 COMDLG32_SetCommDlgExtendedError(CDERR_NOHINSTANCE);341 COMDLG32_SetCommDlgExtendedError(CDERR_NOHINSTANCE); 340 342 return FALSE; 341 343 } … … 343 345 if((pfr->Flags & FR_ENABLETEMPLATE) && !pfr->lpTemplateName) 344 346 { 345 COMDLG32_SetCommDlgExtendedError(CDERR_NOTEMPLATE);346 return FALSE; 347 } 348 349 return TRUE;350 } 351 352 /*********************************************************************** 353 * COMDLG32_FR_DoFindReplace[internal]347 COMDLG32_SetCommDlgExtendedError(CDERR_NOTEMPLATE); 348 return FALSE; 349 } 350 351 return TRUE; 352 } 353 354 /*********************************************************************** 355 * COMDLG32_FR_DoFindReplace [internal] 354 356 * Actual load and creation of the Find/Replace dialog. 355 * RETURNS356 * Window handle to created dialog:Succes357 * NULL:Failure357 * RETURNS 358 * Window handle to created dialog:Succes 359 * NULL:Failure 358 360 */ 359 361 static HWND COMDLG32_FR_DoFindReplace( 360 COMDLG32_FR_Data *pdata/* [in] Internal data structure */362 COMDLG32_FR_Data *pdata /* [in] Internal data structure */ 361 363 ) { 362 HWND hdlgwnd = 0;364 HWND hdlgwnd = 0; 363 365 HGLOBAL loadrc; 364 366 DWORD error; 365 367 LPDLGTEMPLATEW rcs; 366 368 367 TRACE("hInst=%08x, Flags=%08lx\n", pdata->fr.hInstance, pdata->fr.Flags);369 TRACE("hInst=%08x, Flags=%08lx\n", pdata->fr.hInstance, pdata->fr.Flags); 368 370 369 371 if(!(pdata->fr.Flags & FR_ENABLETEMPLATEHANDLE)) 370 372 { 371 HMODULE hmod = COMDLG32_hInstance;372 HRSRC htemplate;373 if(pdata->fr.Flags & FR_ENABLETEMPLATE)374 {375 hmod = (HMODULE)pdata->fr.hInstance;373 HMODULE hmod = COMDLG32_hInstance; 374 HRSRC htemplate; 375 if(pdata->fr.Flags & FR_ENABLETEMPLATE) 376 { 377 hmod = (HMODULE)pdata->fr.hInstance; 376 378 if(pdata->fr.Flags & FR_WINE_UNICODE) 377 379 { 378 htemplate = FindResourceW(hmod, (LPWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOGA);380 htemplate = FindResourceW(hmod, (LPWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOGA); 379 381 } 380 382 else 381 383 { 382 htemplate = FindResourceA(hmod, pdata->fr.lpTemplateName, (LPCSTR)RT_DIALOGA);384 htemplate = FindResourceA(hmod, pdata->fr.lpTemplateName, (LPCSTR)RT_DIALOGA); 383 385 } 384 }385 else386 {387 int rcid = pdata->fr.Flags & FR_WINE_REPLACE ? REPLACEDLGORD388 : FINDDLGORD;389 htemplate = FindResourceA(hmod, MAKEINTRESOURCEA(rcid), (LPCSTR)RT_DIALOGA);390 }391 if(!htemplate)392 {393 error = CDERR_FINDRESFAILURE;394 goto cleanup;395 }396 397 loadrc = LoadResource(hmod, htemplate);386 } 387 else 388 { 389 int rcid = pdata->fr.Flags & FR_WINE_REPLACE ? REPLACEDLGORD 390 : FINDDLGORD; 391 htemplate = FindResourceA(hmod, MAKEINTRESOURCEA(rcid), (LPCSTR)RT_DIALOGA); 392 } 393 if(!htemplate) 394 { 395 error = CDERR_FINDRESFAILURE; 396 goto cleanup; 397 } 398 399 loadrc = LoadResource(hmod, htemplate); 398 400 } 399 401 else 400 402 { 401 loadrc = (HGLOBAL)pdata->fr.hInstance;403 loadrc = (HGLOBAL)pdata->fr.hInstance; 402 404 } 403 405 404 406 if(!loadrc) 405 407 { 406 error = CDERR_LOADRESFAILURE;407 goto cleanup;408 }408 error = CDERR_LOADRESFAILURE; 409 goto cleanup; 410 } 409 411 410 412 if((rcs = (LPDLGTEMPLATEW)LockResource(loadrc)) == NULL) 411 413 { 412 error = CDERR_LOCKRESFAILURE;413 goto cleanup;414 error = CDERR_LOCKRESFAILURE; 415 goto cleanup; 414 416 } 415 417 416 418 hdlgwnd = CreateDialogIndirectParamA(COMDLG32_hInstance, 417 rcs,419 rcs, 418 420 pdata->fr.hwndOwner, 419 421 (DLGPROC)COMDLG32_FindReplaceDlgProc, 420 422 (LPARAM)pdata); 421 if(!hdlgwnd)422 { 423 error = CDERR_DIALOGFAILURE;423 if(!hdlgwnd) 424 { 425 error = CDERR_DIALOGFAILURE; 424 426 cleanup: 425 COMDLG32_SetCommDlgExtendedError(error);427 COMDLG32_SetCommDlgExtendedError(error); 426 428 HeapFree(GetProcessHeap(), 0, pdata); 427 429 } … … 430 432 431 433 /*********************************************************************** 432 * FindText32A[COMDLG32.6]433 * RETURNS434 * Window handle to created dialog: Succes435 * NULL: Failure434 * FindText32A [COMDLG32.6] 435 * RETURNS 436 * Window handle to created dialog: Succes 437 * NULL: Failure 436 438 */ 437 439 HWND WINAPI FindTextA( 438 LPFINDREPLACEA pfr/* [in] Find/replace structure*/440 LPFINDREPLACEA pfr /* [in] Find/replace structure*/ 439 441 ) { 440 COMDLG32_FR_Data *pdata;442 COMDLG32_FR_Data *pdata; 441 443 442 444 dprintf(("FindTextA: LPFINDREPLACE=%p\n", pfr)); 443 445 444 if(!COMDLG32_FR_CheckPartial(pfr, FALSE))445 return 0;446 447 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL)448 return 0; /* Error has been set */446 if(!COMDLG32_FR_CheckPartial(pfr, FALSE)) 447 return 0; 448 449 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL) 450 return 0; /* Error has been set */ 449 451 450 452 pdata->user_fr.fra = pfr; 451 453 pdata->fr = *pfr; 452 return COMDLG32_FR_DoFindReplace(pdata);453 } 454 455 /*********************************************************************** 456 * ReplaceText32A[COMDLG32.19]457 * RETURNS458 * Window handle to created dialog: Succes459 * NULL: Failure454 return COMDLG32_FR_DoFindReplace(pdata); 455 } 456 457 /*********************************************************************** 458 * ReplaceText32A [COMDLG32.19] 459 * RETURNS 460 * Window handle to created dialog: Succes 461 * NULL: Failure 460 462 */ 461 463 HWND WINAPI ReplaceTextA( 462 LPFINDREPLACEA pfr/* [in] Find/replace structure*/464 LPFINDREPLACEA pfr /* [in] Find/replace structure*/ 463 465 ) { 464 COMDLG32_FR_Data *pdata;466 COMDLG32_FR_Data *pdata; 465 467 466 468 dprintf(("ReplaceTextA: LPFINDREPLACE=%p\n", pfr)); 467 469 468 if(!COMDLG32_FR_CheckPartial(pfr, TRUE))469 return 0;470 471 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL)472 return 0; /* Error has been set */470 if(!COMDLG32_FR_CheckPartial(pfr, TRUE)) 471 return 0; 472 473 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data))) == NULL) 474 return 0; /* Error has been set */ 473 475 474 476 pdata->user_fr.fra = pfr; 475 477 pdata->fr = *pfr; 476 pdata->fr.Flags |= FR_WINE_REPLACE;477 return COMDLG32_FR_DoFindReplace(pdata);478 } 479 480 /*********************************************************************** 481 * FinfText32W[COMDLG32.7]482 * RETURNS483 * Window handle to created dialog: Succes484 * NULL: Failure478 pdata->fr.Flags |= FR_WINE_REPLACE; 479 return COMDLG32_FR_DoFindReplace(pdata); 480 } 481 482 /*********************************************************************** 483 * FinfText32W [COMDLG32.7] 484 * RETURNS 485 * Window handle to created dialog: Succes 486 * NULL: Failure 485 487 */ 486 488 HWND WINAPI FindTextW( 487 LPFINDREPLACEW pfr/* [in] Find/replace structure*/489 LPFINDREPLACEW pfr /* [in] Find/replace structure*/ 488 490 ) { 489 COMDLG32_FR_Data *pdata;491 COMDLG32_FR_Data *pdata; 490 492 491 493 dprintf(("FindTextW: LPFINDREPLACE=%p\n", pfr)); 492 494 493 if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE))494 return 0;495 496 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data)497 + pfr->wFindWhatLen)) == NULL)498 return 0; /* Error has been set */495 if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE)) 496 return 0; 497 498 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data) 499 + pfr->wFindWhatLen)) == NULL) 500 return 0; /* Error has been set */ 499 501 500 502 pdata->user_fr.frw = pfr; 501 pdata->fr = *(LPFINDREPLACEA)pfr; /* FINDREPLACEx have same size */502 pdata->fr.Flags |= FR_WINE_UNICODE;503 pdata->fr.lpstrFindWhat = (LPSTR)(((LPFINDREPLACEA)(pdata+1))+1); /* Set string pointer */503 pdata->fr = *(LPFINDREPLACEA)pfr; /* FINDREPLACEx have same size */ 504 pdata->fr.Flags |= FR_WINE_UNICODE; 505 pdata->fr.lpstrFindWhat = (LPSTR)(((LPFINDREPLACEA)(pdata+1))+1); /* Set string pointer */ 504 506 lstrcpynWtoA(pdata->fr.lpstrFindWhat, pfr->lpstrFindWhat, pfr->wFindWhatLen); 505 507 return COMDLG32_FR_DoFindReplace(pdata); … … 507 509 508 510 /*********************************************************************** 509 * ReplaceTextW[COMDLG32.20]510 * RETURNS511 * Window handle to created dialog: Succes512 * NULL: Failure511 * ReplaceTextW [COMDLG32.20] 512 * RETURNS 513 * Window handle to created dialog: Succes 514 * NULL: Failure 513 515 */ 514 516 HWND WINAPI ReplaceTextW( 515 LPFINDREPLACEW pfr/* [in] Find/replace structure*/517 LPFINDREPLACEW pfr /* [in] Find/replace structure*/ 516 518 ) { 517 COMDLG32_FR_Data *pdata;519 COMDLG32_FR_Data *pdata; 518 520 519 521 dprintf(("ReplaceTextW: LPFINDREPLACE=%p\n", pfr)); 520 522 521 if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE))522 return 0;523 524 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data)525 + pfr->wFindWhatLen526 + pfr->wReplaceWithLen)) == NULL)527 528 return 0; /* Error has been set */523 if(!COMDLG32_FR_CheckPartial((LPFINDREPLACEA)pfr, FALSE)) 524 return 0; 525 526 if((pdata = (COMDLG32_FR_Data *)COMDLG32_AllocMem(sizeof(COMDLG32_FR_Data) 527 + pfr->wFindWhatLen 528 + pfr->wReplaceWithLen)) == NULL) 529 530 return 0; /* Error has been set */ 529 531 530 532 pdata->user_fr.frw = pfr; 531 pdata->fr = *(LPFINDREPLACEA)pfr; /* FINDREPLACEx have same size */532 pdata->fr.Flags |= FR_WINE_REPLACE | FR_WINE_UNICODE;533 pdata->fr.lpstrFindWhat = (LPSTR)(((LPFINDREPLACEA)(pdata+1))+1); /* Set string pointers */533 pdata->fr = *(LPFINDREPLACEA)pfr; /* FINDREPLACEx have same size */ 534 pdata->fr.Flags |= FR_WINE_REPLACE | FR_WINE_UNICODE; 535 pdata->fr.lpstrFindWhat = (LPSTR)(((LPFINDREPLACEA)(pdata+1))+1); /* Set string pointers */ 534 536 pdata->fr.lpstrReplaceWith = (LPSTR)(((LPFINDREPLACEA)(pdata+1))+1) + pfr->wFindWhatLen; 535 537 lstrcpynWtoA(pdata->fr.lpstrFindWhat, pfr->lpstrFindWhat, pfr->wFindWhatLen); -
trunk/src/comdlg32/rsrc.orc
r3033 r3243 1 /* $Id: rsrc.orc,v 1. 2 2000-03-06 23:48:25 birdExp $ */1 /* $Id: rsrc.orc,v 1.3 2000-03-26 16:31:45 cbratschi Exp $ */ 2 2 /* 3 3 * Top level resource file for Common Dialogs … … 26 26 * get localized bitmaps for example. 27 27 */ 28 //#include "cdlg_Ca.orc" 29 //#include "cdlg_Cs.orc" 30 //#include "cdlg_Da.orc" 31 //#include "cdlg_De.orc" 28 29 /* TODO TODO FIXME 30 * The localized resources have be pulled out due to 31 * the time required to move some strings from here to 32 * shell32.dll. This is something to deal with 33 * after release 34 */ 35 #if 0 36 #include "cdlg_Ca.orc" 37 #include "cdlg_Cs.orc" 38 #include "cdlg_Da.orc" 39 #include "cdlg_De.orc" 40 #endif 32 41 #include "cdlg_En.orc" 33 //#include "cdlg_Eo.orc" 34 //#include "cdlg_Es.orc" 35 //#include "cdlg_Fi.orc" 36 //#include "cdlg_Fr.orc" 37 //#include "cdlg_Hu.orc" 38 //#include "cdlg_It.orc" 39 //#include "cdlg_Ko.orc" 40 //#include "cdlg_Nl.orc" 41 //#include "cdlg_No.orc" 42 //#include "cdlg_Pl.orc" 43 //#include "cdlg_Pt.orc" 44 //#include "cdlg_Ru.orc" 45 //#include "cdlg_Sv.orc" 46 //#include "cdlg_Wa.orc" 42 #if 0 43 #include "cdlg_Eo.orc" 44 #include "cdlg_Es.orc" 45 #include "cdlg_Fi.orc" 46 #include "cdlg_Fr.orc" 47 #include "cdlg_Hu.orc" 48 #include "cdlg_It.orc" 49 #include "cdlg_Ko.orc" 50 #include "cdlg_Nl.orc" 51 #include "cdlg_No.orc" 52 #include "cdlg_Pl.orc" 53 #include "cdlg_Pt.orc" 54 #include "cdlg_Ru.orc" 55 #include "cdlg_Sv.orc" 56 #include "cdlg_Wa.orc" 57 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
