|
From: <cre...@us...> - 2006-09-18 20:00:40
|
Revision: 1515
http://svn.sourceforge.net/frontierkernel/?rev=1515&view=rev
Author: creecode
Date: 2006-09-18 13:00:38 -0700 (Mon, 18 Sep 2006)
Log Message:
-----------
for Mac, in shelldatabasesaveas and shellnormalsaveas functions set proxy window icon
for Mac, in shellsaveas function, add object type extension to file name
minor formatting tweaks
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-09-18 19:50:50 UTC (rev 1514)
+++ Frontier/branches/FSRef_Migration/Common/source/shellfile.c 2006-09-18 20:00:38 UTC (rev 1515)
@@ -33,9 +33,6 @@
#include "file.h"
#include "kb.h"
#include "launch.h"
-#ifdef MACVERSION
- #include "mac.h"
-#endif
#include "memory.h"
#include "resources.h"
#include "strings.h"
@@ -52,10 +49,17 @@
#include "tablestructure.h"
#ifdef MACVERSION
+
+ #include "mac.h"
+ #include "MoreFilesX.h" // 2006-09-16 creedon
#include <uisharing.h>
+
#endif
+
#ifdef WIN95VERSION
+
#include "FrontierWinMain.h"
+
#endif
#define str_desktopscript BIGSTRING ("\x04" "ftds")
@@ -157,8 +161,6 @@
bigstring bsext, bs;
- ( void ) extendfilespec ( fs, fs );
-
#endif
if (wnew != nil)
@@ -432,18 +434,18 @@
static boolean shelldatabasesaveas (WindowPtr wsave, ptrfilespec fspec) {
- /*
- a save-as designed for applications that work with a file that it reads
- and writes while the user is working.
+ //
+ // a save-as designed for applications that work with a file that it reads and writes while the user is working.
+ //
+ // this routine now actually implements a "save a copy"; the newly-saved file does not become the current file.
+ //
+ // 2006-09-18 creedon: for Mac, set window proxy icon
+ //
+ // 1991-07-05 dmb: use new copyallresources routine to handle the resource fork.
+ //
+ // 1990-10-03 dmb: rewrote
+ //
- 10/3/90 dmb: rewrote
-
- 7/5/91 dmb: use new copyallresources routine to handle the resource fork.
-
- this routine now actually implements a "save a copy"; the newly-saved file
- does not become the current file.
- */
-
register WindowPtr w = wsave;
hdlfilenum fnum;
short rnum;
@@ -455,8 +457,10 @@
rnum = -1;
#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
closefile (fnum);
@@ -466,10 +470,17 @@
getwindowinfo (w, &hinfo);
+#ifdef MACVERSION
+
+ if ( FSRefValid ( &( *fspec ).fsref ) && ( *fspec ).path == NULL )
+ SetWindowProxyCreatorAndType ( w, 'LAND', config.filetype, kOnSystemDisk );
+
+#endif
+
/*
shellbringtofront (hinfo);
- shellclosechildwindows (hinfo); /%Save As can't maintain these, so close them now%/
+ shellclosechildwindows (hinfo); // Save As can't maintain these, so close them now
*/
if (!shellsavefile (w, fspec, fnum, rnum, true, false)) {
@@ -487,18 +498,21 @@
copyallresources ((**hinfo).rnum, rnum);
#ifndef version42orgreater
+
shellsavewindowresource (w, fspec, rnum);
shellsavefontresource (w, fspec, rnum);
+
#endif
- if (!flconvertingolddatabase) { /*close new file; we're really doing a "Save a Copy"*/
+ if (!flconvertingolddatabase) { // close new file; we're really doing a "Save a Copy"
closefile (fnum);
closeresourcefile (rnum);
+
}
- else { /*close old file and re-open newly-converted file*/
+ else { // close old file and re-open newly-converted file
(*shellglobals.closeroutine) ();
@@ -506,9 +520,9 @@
shellclearwindowdata ();
- closewindowfile (w); /*close old file*/
+ closewindowfile (w); // close old file
- (**hinfo).flneversaved = false; /*must do after closewindowfile*/
+ (**hinfo).flneversaved = false; // must do after closewindowfile
windowsetfspec (w, fspec);
@@ -518,7 +532,7 @@
if (!(*shellglobals.loadroutine) (fnum, rnum)) {
- closewindowfile (w); /*close new file*/
+ closewindowfile (w); // close new file
disposeshellwindow (w);
@@ -530,20 +544,23 @@
windowsetchanges (w, false);
}
- flushvolumechanges (fspec, fnum); /*write changes out to disk*/
+ flushvolumechanges (fspec, fnum); // write changes out to disk
return (true);
- } /*shelldatabasesaveas*/
+
+ } // shelldatabasesaveas
static boolean shellnormalsaveas (WindowPtr wsave, ptrfilespec fspec, boolean flrunnable) {
- /*
- 8/20/90 dmb: added resfile support
+ //
+ // 2006-09-18 creedon: for Mac, set window proxy icon
+ //
+ // 5.0.2b19 dmb: special case file type for runnable
+ //
+ // 8/20/90 dmb: added resfile support
+ //
- 5.0.2b19 dmb: special case file type for runnable
- */
-
register WindowPtr w = wsave;
hdlfilenum fnum;
short rnum;
@@ -551,7 +568,7 @@
OSType filetype = config.filetype;
OSType type;
- switch (filetype) { //handle special cases
+ switch (filetype) { // handle special cases
case type_normalscript:
if (flrunnable)
@@ -571,7 +588,8 @@
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
closefile (fnum);
@@ -583,12 +601,16 @@
(**shellwindowinfo).flneversaved = false;
- flushvolumechanges (fspec, fnum); /*write changes out to disk*/
+ flushvolumechanges (fspec, fnum); // write changes out to disk
closefile (windowgetfnum (w));
#ifdef MACVERSION
+
closeresourcefile (windowgetrnum (w));
+
+ SetWindowProxyCreatorAndType ( w, 'LAND', filetype, kOnSystemDisk );
+
#endif
windowsetchanges (w, false);
@@ -601,7 +623,8 @@
}
return (true);
- } /*shellnormalsaveas*/
+
+ } // shellnormalsaveas
boolean shellsaveas (WindowPtr wsave, ptrfilespec fspec, boolean flrunnable) {
@@ -646,20 +669,18 @@
bigstring bsname;
+ #ifdef MACVERSION
+
+ if ( fs.path != NULL )
+ CFStringRefToStr255 ( fs.path, bsname );
+ else
+
+ #endif
+
getdefaultfilename ( bsname );
#ifdef MACVERSION
- bigstring bs;
-
- pushchar ( '.', bsname );
-
- ostypetostring ( config.filetype, bs );
-
- alllower ( bs );
-
- pushstring ( bs, bsname );
-
fs.path = CFStringCreateWithPascalString ( kCFAllocatorDefault, bsname,
kCFStringEncodingMacRoman );
@@ -739,7 +760,7 @@
WindowPtr w = nil;
boolean fl;
- shellpushdefaultglobals (); /*so that config is correct*/
+ shellpushdefaultglobals (); // so that config is correct
if (config.flcreateonnew) {
@@ -786,9 +807,9 @@
error:
- disposeshellwindow (w); /*checks for nil*/
+ disposeshellwindow (w); // checks for nil
- if (fnum != 0) { /*we actually opened a file*/
+ if (fnum != 0) { // we actually opened a file
closefile (fnum);
@@ -802,8 +823,9 @@
shellpopglobals ();
return (false);
- } /*shellnewfile*/
+ } // shellnewfile
+
boolean shellnew (void) {
@@ -890,7 +912,7 @@
shellpopglobals ();
- return (shellsaveas (w, nil, false));
+ return ( shellsaveas ( w, nil, false ) );
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|