|
From: <cre...@us...> - 2006-08-19 18:39:13
|
Revision: 1482 Author: creecode Date: 2006-08-19 11:39:05 -0700 (Sat, 19 Aug 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1482&view=rev Log Message: ----------- fix problem with open and save dialogs not working properly with items created from the New command of the File menu. Modified Paths: -------------- Frontier/branches/FSRef_Migration/Common/source/filedialog.c Frontier/branches/FSRef_Migration/Common/source/fileverbs.c Frontier/branches/FSRef_Migration/Common/source/shellwindow.c Modified: Frontier/branches/FSRef_Migration/Common/source/filedialog.c =================================================================== --- Frontier/branches/FSRef_Migration/Common/source/filedialog.c 2006-08-19 18:34:18 UTC (rev 1481) +++ Frontier/branches/FSRef_Migration/Common/source/filedialog.c 2006-08-19 18:39:05 UTC (rev 1482) @@ -495,7 +495,7 @@ #ifdef MACVERSION // - // 2006-06-26 creedon: minimally FSRef-ized + // 2006-08-16 creedon: minimally FSRef-ized // // 2005-10-06 creedon: added filecreator parameter, used for get file // dialog @@ -535,13 +535,25 @@ // 8/1/90 dmb: if filetype is zero, show all files by passing zero to SFGetFile // - // Str255 bs; tysfdata sfdata; FSSpec *fs = &sfdata.sfreply.sfFile, fspect; OSErr err = noErr; + + extendfilespec ( fspec, fspec ); + + if ( ( *fspec ).path == NULL ) + FSGetCatalogInfo ( &( *fspec ).fsref, kFSCatInfoNone, NULL, NULL, &fspect, NULL ); + else { + FSCatalogInfo catalogInfo; + + FSGetCatalogInfo ( &( *fspec ).fsref, kFSCatInfoVolume | kFSCatInfoNodeID, &catalogInfo, NULL, NULL, NULL ); + + fspect.vRefNum = catalogInfo.volume; + fspect.parID = catalogInfo.nodeID; + + CFStringRefToStr255 ( ( *fspec ).path, fspect.name ); + } - FSGetCatalogInfo ( &( *fspec ).fsref, kFSCatInfoNone, NULL, NULL, &fspect, NULL ); - #ifdef flcomponent long appA5; @@ -624,11 +636,17 @@ if(oserror(err)) return false; - if (sfdata.sfreply.sfGood) { + if ( sfdata.sfreply.sfGood ) { // canonize + + HFSUniStr255 name; - FSMakeFSRef ( ( *fs ).vRefNum, ( *fs ).parID, ( *fs ).name, &( *fspec ).fsref ); // canonize - - return (true); + FSMakeFSRef ( ( *fs ).vRefNum, ( *fs ).parID, NULL, &( *fspec ).fsref ); + + err = HFSNameGetUnicodeName ( ( *fs ).name, kTextEncodingUnknown, &name ); + + ( *fspec ).path = CFStringCreateWithCharacters ( kCFAllocatorDefault, name.unicode, name.length ); + + return ( true ); } return (false); Modified: Frontier/branches/FSRef_Migration/Common/source/fileverbs.c =================================================================== --- Frontier/branches/FSRef_Migration/Common/source/fileverbs.c 2006-08-19 18:34:18 UTC (rev 1481) +++ Frontier/branches/FSRef_Migration/Common/source/fileverbs.c 2006-08-19 18:39:05 UTC (rev 1482) @@ -717,13 +717,13 @@ // // if it's the getfile dialog, we take a second parameter -- it indicates the type of the file. // - // 2006-06-24 creedon: FSRef-ized + // 2006-08-16 creedon: FSRef-ized // - // 1991-12-27 dmb: in all cases, check the current value of the filename variable, and pass it on to sf dialog so it can - // potentially set default directory. - // // 2005-10-06 creedon: added creator parameter // + // 1991-12-27 dmb: in all cases, check the current value of the filename variable, and pass it on to sf dialog so it can + // potentially set default directory. + // bigstring bsprompt; bigstring bsvarname; @@ -807,8 +807,6 @@ if (!sfdialog (sfverb, bsprompt, typelist, &fs, oscreator)) // user hit cancel return (true); - getfilespecparent ( &fs ); - if (!setfilespecvalue (&fs, &val)) return (false); Modified: Frontier/branches/FSRef_Migration/Common/source/shellwindow.c =================================================================== --- Frontier/branches/FSRef_Migration/Common/source/shellwindow.c 2006-08-19 18:34:18 UTC (rev 1481) +++ Frontier/branches/FSRef_Migration/Common/source/shellwindow.c 2006-08-19 18:39:05 UTC (rev 1482) @@ -506,10 +506,11 @@ boolean windowgetfspec ( WindowPtr w, ptrfilespec fspec ) { - /* - 6.18.97 dmb: return boolean value indicating whether or not the - fspec actually points to an existing file - */ + // + // 2006-08-16 creedon: for Mac, FSRef-ized + // + // 1997-06-18 dmb: return boolean value indicating whether or not the fspec actually points to an existing file + // hdlwindowinfo hinfo; long vnum; @@ -522,11 +523,14 @@ *fspec = (**hinfo).fspec; - if (!getfsvolume (fspec, &vnum)) //don't allow default vol to satisfy fileexists + if (!getfsvolume (fspec, &vnum)) // don't allow default vol to satisfy fileexists return (false); + + extendfilespec ( fspec, fspec ); - return (fileexists (fspec, &flfolder)); - } /*windowgetfspec*/ + return ( fileexists ( fspec, &flfolder ) ); + + } // windowgetfspec boolean windowgetpath (WindowPtr w, bigstring bspath) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |