|
From: <cre...@us...> - 2006-06-24 02:08:09
|
Revision: 1411 Author: creecode Date: 2006-06-23 19:08:06 -0700 (Fri, 23 Jun 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1411&view=rev Log Message: ----------- FSRef-ized Modified Paths: -------------- Frontier/branches/FSRef_Migration/Common/source/shellfile.c Modified: Frontier/branches/FSRef_Migration/Common/source/shellfile.c =================================================================== --- Frontier/branches/FSRef_Migration/Common/source/shellfile.c 2006-06-24 01:43:34 UTC (rev 1410) +++ Frontier/branches/FSRef_Migration/Common/source/shellfile.c 2006-06-24 02:08:06 UTC (rev 1411) @@ -115,48 +115,54 @@ } /*findfilevisit*/ -boolean shellopenfile (ptrfilespec fspec, boolean flhidden, WindowPtr *wnew) { +boolean shellopenfile (ptrfilespec fs, boolean flhidden, WindowPtr *wnew) { - /* - open the specified file in a new window. + // + // open the specified file in a new window. + // + // 2006-06-23 creedon: for Mac, FSRef-ized + // + // 6.0a11 dmb: fixed wnew handling for already-open windows + // + // 3.0.2 dmb: if asked to open a file that's already open in a root window, just bring it to the front and return true + // + // 2.1b3 dmb: resolve alias files + // + // 1992-08-20 dmb: since handling of update events can push/pop globals, we need to re-establish default globals + // after calling partialeventloop + // + // 1992-07-29 dmb: moved handling of update events after loadspecial handler, so that is can see what kind of event + // triggered the open + // + // 1990-11-08 dmb: push default globals so that caller doesn't have to + // + // 1990-08-31 DW: replace setglobals calls with shellpush/popglobals. also commented out the call to + // shellfrontglobals. + // + // 1990-08-20 dmb: added resfile support. + // + // show window after success (window now initially invisible). + // - dmb 8/20/90: show window after success (window now initially invisible). - - dmb 8/20/90: added resfile support. - - 8/31/90 DW: replace setglobals calls with shellpush/popglobals. also commented - out the call to shellfrontglobals. - - 11/8/90 dmb: push default globals so that caller doesn't have to - - 7/29/92 dmb: moved handling of update events after loadspecial handler, so that - is can see what kind of event triggered the open - - 8/20/92 dmb: since handling of update events can push/pop globals, we need to - re-establish default globals after calling partialeventloop - - 2.1b3 dmb: resolve alias files - - 3.0.2 dmb: if asked to open a file that's already open in a root window, - just bring it to the front and return true - - 6.0a11 dmb: fixed wnew handling for already-open windows - */ - WindowPtr w; hdlfilenum fnum; short rnum; boolean fl; OSType filetype; tyfindvisitinfo info; -#ifdef MACVERSION - bigstring bsext; -#endif + + #ifdef MACVERSION + bigstring bsext, bs; + + ( void ) extendfilespec ( fs, fs ); + + #endif + if (wnew != nil) *wnew = nil; - info.fsfind = fspec; + info.fsfind = fs; info.wfound = wnew; info.flhidden = flhidden; @@ -165,26 +171,29 @@ initbeachball (right); - if (!fileresolvealias (fspec)) + if (!fileresolvealias (fs)) return (false); - if (!getfiletype (fspec, &filetype)) + if (!getfiletype (fs, &filetype)) return (false); -#ifdef MACVERSION + #ifdef MACVERSION - lastword (fspec->name, '.', bsext); + getfsfile ( fs, bs ); - if (equalidentifiers (bsext, "\proot")) - filetype = 'TABL'; -#endif + lastword ( bs, '.', bsext); + + if (equalidentifiers (bsext, "\proot")) + filetype = 'TABL'; + + #endif if (!shellpushdefaultglobals ()) return (false); if (filetype != config.filetype) { - fl = (*shellglobals.loadspecialroutine) (fspec, filetype); + fl = (*shellglobals.loadspecialroutine) (fs, filetype); shellpopglobals (); @@ -201,16 +210,19 @@ rnum = -1; - if (!openfile (fspec, &fnum, false)) + if (!openfile (fs, &fnum, false)) goto error; -#ifdef MACVERSION - if (config.flopenresfile) - if (!openresourcefile (fspec, &rnum, resourcefork)) /* 2005-09-02 creedon - added support for fork parameter, see resources.c: openresourcefile and pushresourcefile */ - goto error; -#endif + #ifdef MACVERSION - if (!newfilewindow (fspec, fnum, rnum, flhidden, &w)) + if (config.flopenresfile) + if (!openresourcefile (fs, &rnum, resourcefork)) // 2005-09-02 creedon - added support for fork parameter, + // see resources.c: openresourcefile and pushresourcefile + goto error; + + #endif + + if (!newfilewindow (fs, fnum, rnum, flhidden, &w)) goto error; if (wnew != nil) @@ -246,13 +258,16 @@ closefile (fnum); -#ifdef MACVERSION - closeresourcefile (rnum); -#endif + #ifdef MACVERSION + closeresourcefile (rnum); + + #endif + return (false); - } /*shellopenfile*/ + } // shellopenfile + static boolean clickersvisit (hdlhashnode hnode, ptrvoid refcon) { @@ -281,11 +296,11 @@ 5.0d3 dmb: look in clickers table for types we can actually open */ - tyconfigrecord lconfig; - tyfilespec fspec; - tysftypelist filetypes; - ptrsftypelist ptypes = nil; - hdlhashtable htable; + tyconfigrecord lconfig; + tyfilespec fspec; + tysftypelist filetypes; + ptrsftypelist ptypes = nil; + hdlhashtable htable; bigstring bs; boolean fl; hdlwindowinfo hdummy; @@ -583,17 +598,18 @@ boolean shellsaveas (WindowPtr wsave, ptrfilespec fspec, boolean flrunnable) { - /* - if we're given a path, save the current file to that location with no - dialog. + // + // if we're given a path, save the current file to that location with no dialog. + // + // if bspath is nil, use standard file to determine the new file location + // + // 2006-06-23 creedon: for Mac FSRef-ized + // + // 5.0d8 dmb: pass file type to sfdialog for Win + // + // 1991-12-12 dmb: make sure we don't use a full path as the default file name + // - if bspath is nil, use standard file to determine the new file location - - 12/12/91 dmb: make sure we don't use a full path as the default file name - - 5.0d8 dmb: pass file type to sfdialog for Win - */ - // #if TARGET_API_MAC_CARBON == 1 /*7.0b50 PBS: set window title icon*/ // OSStatus err = noErr; // #endif @@ -616,9 +632,16 @@ } else { - if (!windowgetfspec (w, &fs)) - getdefaultfilename (fsname (&fs)); + if (!windowgetfspec (w, &fs)) { + bigstring bs; + + getfsfile ( &fs, bs ); + + getdefaultfilename ( bs ); + + } + filetypes.cttypes = 1; filetypes.types [0] = config.filetype; @@ -692,10 +715,13 @@ goto error; #ifdef MACVERSION + if (config.flopenresfile) - if (!openresourcefile (fspec, &rnum, resourcefork)) /* 2005-09-02 creedon - added support for fork parameter, see resources.c: openresourcefile and pushresourcefile */ + if (!openresourcefile (fspec, &rnum, resourcefork)) // 2005-09-02 creedon - added support for fork parameter, + // see resources.c: openresourcefile and pushresourcefile goto error; #endif + } if (!newfilewindow (fspec, fnum, rnum, flhidden, wnew)) @@ -743,37 +769,45 @@ boolean shellnew (void) { - /* - new front end to shellnewfile, isolates user interface - - 5.0d8 dmb: pass file type to sfdialog for Win - */ + // + // new front end to shellnewfile, isolates user interface + // + // 2006-06-23 creedon: for Mac, FSRef-ized + // + // 2005-10-06 creedon - added 'LAND' to sfdialog call + // + // 5.0d8 dmb: pass file type to sfdialog for Win + // tyconfigrecord lconfig; tyfilespec fspec; tysftypelist filetypes; WindowPtr w; + bigstring bs; shellgetconfig (iddefaultconfig, &lconfig); clearbytes (&fspec, sizeof (fspec)); - getuntitledfilename (fsname (&fspec)); + getfsfile ( &fspec, bs ); + getuntitledfilename ( bs ); + if (lconfig.flcreateonnew) { filetypes.cttypes = 1; filetypes.types [0] = lconfig.filetype; - if (!sfdialog (sfputfileverb, nil, &filetypes, &fspec, 'LAND')) /* 2005-10-06 creedon - added 'LAND' */ /*user canceled*/ + if (!sfdialog (sfputfileverb, nil, &filetypes, &fspec, 'LAND')) // user canceled return (false); } return (shellnewfile (&fspec, false, &w)); - } /*shellnew*/ + } // shellnew + boolean shellsave (WindowPtr wsave) { /* @@ -1270,23 +1304,22 @@ boolean shellopendefaultfile (void) { - /* - no files were selected to be open from the finder. we either open a new - file, or we try to open the default startup file -- similar to autoexec.bat - from MS-DOS and System.Startup from UCSD Pascal. + // + // no files were selected to be open from the finder. we either open a new file, or we try to open the default startup file -- + // similar to autoexec.bat from MS-DOS and System.Startup from UCSD Pascal. + // + // 2006-06-18 creedon: for Mac, FSRef-ized + // + // 7.30.97 dmb: use defaultpath instead of application filespec, and use new setfsfile to plug in default file name + // + // 5/19/92 dmb: always return a value; explicitly return boolean + // + // 4/24/92 dmb: use filegetapplicationvnum rather than zero (the default volume) when opening the default file. + // otherwise, if the default volume changes later, the file info won't be adequate to locate the file. + // + // 5/20/91 dmb: if the option key is down, just do a normal open file + // - 5/20/91 dmb: if the option key is down, just do a normal open file - - 4/24/92 dmb: use filegetapplicationvnum rather than zero (the default volume) - when opening the default file. otherwise, if the default volume changes later, - the file info won't be adequate to locate the file. - - 5/19/92 dmb: always return a value; explicitly return boolean - - 7.30.97 dmb: use defaultpath instead of application filespec, - and use new setfsfile to plug in default file name - */ - tyfilespec fs; boolean fl = false; boolean flfolder; @@ -1295,14 +1328,15 @@ if (optionkeydown ()) return (shellopen ()); - shellpushdefaultglobals (); /*so config is correct*/ + shellpushdefaultglobals (); // so config is correct if (config.flnewonlaunch) fl = shellnew (); else { - getapplicationfilespec (nil, &fs); /*get our own app fspec*/ - // - + getapplicationfilespec (nil, &fs); // get our own app filespec + + ( void ) extendfilespec ( &fs, &fs ); + if (getstringlist (defaultlistnumber, startupfilename, bsdefault)) { setfsfile (&fs, bsdefault); @@ -1329,44 +1363,6 @@ } /*shellopendefaultfile*/ -#ifdef flsystem6 - -void shellopeninitialfiles (void) { - - /* - if the user double-clicked on the applications with files selected, - then we open the files. otherwise we try to open the default startup - file -- similar to autoexec.bat from MS-DOS and System.Startup from - UCSD Pascal. - */ - - bigstring bs; - register short ctfiles; - short vnum; - - ctfiles = countinitialfiles (); - - if (ctfiles > 0) { /*one or more files selected on launch*/ - - register short i; - - for (i = 1; i <= ctfiles; i++) { - - getinitialfile (i, bs, &vnum); - - shellopenfile (bs, vnum, nil); - } /*for*/ - } - - else { /*zero files selected on launch*/ - - shellopendefaultfile (); - } - } /*shellopeninitialfiles*/ - -#endif - - #ifdef WIN95VERSION void shellopeninitialfiles (void) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |