|
From: <cre...@us...> - 2007-10-03 21:54:26
|
Revision: 1752
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1752&view=rev
Author: creecode
Date: 2007-10-03 14:54:30 -0700 (Wed, 03 Oct 2007)
Log Message:
-----------
rollback to version 1593, changes to filemenu newfunc need deeper examination
Modified Paths:
--------------
Frontier/trunk/Common/source/shellverbs.c
Modified: Frontier/trunk/Common/source/shellverbs.c
===================================================================
--- Frontier/trunk/Common/source/shellverbs.c 2007-10-03 21:50:00 UTC (rev 1751)
+++ Frontier/trunk/Common/source/shellverbs.c 2007-10-03 21:54:30 UTC (rev 1752)
@@ -1056,59 +1056,39 @@
static boolean filemenufunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
-
- //
- // 2007-10-03 creedon: in newfunc case use copyvaluerecord so we don't
- // alter the value record grabbed by getparamvalue
- //
- // 2006-02-05 aradke: re-enabled savecopyfunc case to avoid breakage. verb
- // tokens that have previously been referenced from glue
- // scripts should never be disabled again, like
- // fileMenu.saveCopy in this case. also kept
- // kernelverbs.r and kernelverbs.rc in sync.
- //
- // 2005-10-26 creedon: disabled savecopyfunc case, saveasfunc can do it all
- // added saveasfunc case, it wasn't possible to do a
- // save as for a file-object
- //
- // 2005-09-14 creedon: in closefunc case added fldialog parameter, this
- // might be improved as I only dealt with the situation
- // with one or more parameters are defined
- //
- // 5.1.4 dmb: closefunc takes optional win parameter; savefunc checks hinfo
- // for nil
- //
- // 5.0d18 dmb: closefunc respects the target
- //
- // 5.0d16 dmb: savefunc, newfunc need new (optional) parameters
- //
- // 3.0b15 dmb: quitfunc should just return false and let everything flow
- // normally, instead of yielding here. this could problems
- // calling filemenu.quit from a component menusharing (osa)
- // client... however it doesn't, so this change is disabled
- // for the time being.
- //
- // 1993-06-01 dmb: when vreturned is nil, return whether or not verb token
- // must be run in the Frontier process
- //
- // 1993-05-19 dmb: closefunc uses getfrontwindow, not shellwindow
- //
- // 1991-10-23 dmb: must try to restore globals after revert, so new globals
- // aren't in effect when deferred disposal takes place.
- //
- // 1991-10-03 dmb: split off fileMenu verbs from shell verbs
- //
- // 1991-02-07 dmb: functions that change the current file (closeall, new,
- // open, revert) have to save & restore the language
- // globals. we don't want the language to have to do this
- // on every external call, so we do it selectively here
- //
- // added parameters to new, open & save; added boolean to
- // avoid dialog in various shell routines.
- //
- register boolean fl;
+ /*
+ 2/7/91 dmb: added parameters to new, open & save; added boolean to avoid
+ dialog in various shell routines.
+
+ 2/7/91 dmb: functions that change the current file (closeall, new, open, revert) have
+ to save & restore the language globals. we don't want the language to have
+ to do this on every external call, so we do it selectively here
+
+ 10/3/91 dmb: split off fileMenu verbs from shell verbs
+
+ 10/23/91 dmb: must try to restore globals after revert, so new globals aren't
+ in effect when deferred disposal takes place.
+
+ 5/19/93 dmb: closefunc uses getfrontwindow, not shellwindow
+
+ 6/1/93 dmb: when vreturned is nil, return whether or not verb token must
+ be run in the Frontier process
+
+ 3.0b15 dmb: quitfunc should just return false and let everything flow normally,
+ instead of yielding here. this could problems calling filemenu.quit from a
+ component menusharing (osa) client... however it doesn't, so this change is
+ disabled for the time being.
+
+ 5.0d16 dmb: savefunc, newfunc need new (optional) parameters
+
+ 5.0d18 dmb: closefunc respects the target
+
+ 5.1.4 dmb: closefunc takes optional win parameter; savefunc checks hinfo for nil
+ */
+
register tyvaluerecord *v = vreturned;
+ register boolean fl;
if (v == nil) /*need Frontier process?*/
return (true);
@@ -1118,25 +1098,26 @@
switch (token) { /*these verbs don't need any special globals pushed*/
case newfunc: {
-
- WindowPtr w;
- short ctconsumed = 0, ctpositional;
- tyexternalid id;
+ tyvaluerecord val;
tyfilespec fs;
- tyvaluerecord val, vhidden;
+ tyexternalid id;
+ tyvaluerecord vhidden;
+ short ctconsumed = 0;
+ short ctpositional;
+ WindowPtr w;
if (!getparamvalue (hparam1, ++ctconsumed, &val))
return (false);
-
+
flnextparamislast = true;
ctpositional = ctconsumed;
- setbooleanvalue (false, &vhidden); // default value
+ setbooleanvalue (false, &vhidden); //default value
if (!getoptionalparamvalue (hparam1, &ctconsumed, &ctpositional, str_hidden, &vhidden))
return (false);
-
+
disablelangerror ();
fl = coercetoostype (&val);
@@ -1145,36 +1126,31 @@
if (!fl) { // old style, new database
- if (!copyvaluerecord (val, &val))
- return (false);
-
if (!coercetofilespec (&val))
return (false);
-
- fs = **val.data.filespecvalue;
- langsaveglobals (); // see comment at function head
+ fs = (**val.data.filespecvalue);
+ langsaveglobals (); /*see comment at function head*/
+
fl = shellnewfile (&fs, vhidden.data.flvalue, &w);
if (!langrestoreglobals ())
fl = false;
-
+
if (!fl)
return (false);
}
else {
-
id = (tyexternalid) (langgetvaluetype (val.data.ostypevalue) - outlinevaluetype);
if (!ccnewfilewindow (id, &w, vhidden.data.flvalue))
return (false);
}
-
- return (setwinvalue (w, v));
+ return (setwinvalue (w, v));
}
-
+
case openfunc: {
tyfilespec fs;
@@ -1205,18 +1181,22 @@
return (false);
return (fl && setwinvalue (w, v));
-
}
-
- case closefunc: { // close the frontmost window
+ case closefunc: {
+ /*
+ close the frontmost window
+
+ 2005-09-14 creedon: added fldialog parameter, this might be improved as I only dealt with the situation with one or more parameters are defined
+ */
+
hdlwindowinfo hinfo;
WindowPtr targetwindow = nil;
tyvaluerecord val;
boolean fldialog;
-
+
setbooleanvalue (false, &val); /* defaults to false */
-
+
if (langgetparamcount (hparam1) == 0) { // old style, use the target
if (!langfindtargetwindow (-1, &targetwindow))
@@ -1247,22 +1227,19 @@
//return (langrestoreglobals ());
return (true);
-
}
case closeallfunc:
-
if (!langcheckparamcount (hparam1, 0)) /*shouldn't have any parameters*/
return (false);
-
+
langsaveglobals (); /*see comment at function head*/
(*v).data.flvalue = shellcloseall (nil, false);
return (langrestoreglobals ());
-
- case quitfunc:
+ case quitfunc:
if (!langcheckparamcount (hparam1, 0)) /*shouldn't have any parameters*/
return (false);
@@ -1270,29 +1247,37 @@
#if 0 /*maybe try this out after 3.0*/
- return (false); /*kill the script*/
+ return (false); /*kill the script*/
#else
- processyield (); /*give it a chance to happen*/
-
- (*v).data.flvalue = false; /*we didn't quit -- we got here, didn't we?*/
-
- return (true);
-
- #endif
+ processyield (); /*give it a chance to happen*/
- } // switch
-
+ (*v).data.flvalue = false; /*we didn't quit -- we're got here, didn't we?*/
+
+ return (true);
+
+ #endif
+ } /*switch*/
+
if (!shellpushtargetglobals ())
return (false);
-
+
fl = false; /*default return value for this function*/
switch (token) { /*these verbs assume that the frontmost window's globals are pushed*/
- case savefunc: { /*save the frontmost window*/
+ /*
+ 2005-10-26 creedon: disabled savecopyfunc case, saveasfunc can do it all
+ added saveasfunc case, it wasn't possible to do a save as for a file-object
+ 2006-02-05 aradke: re-enabled savecopyfunc case to avoid breakage.
+ verb tokens that have previously been referenced from glue scripts
+ should never be disabled again, like fileMenu.saveCopy in this case.
+ also kept kernelverbs.r and kernelverbs.rc in sync.
+ */
+
+ case savefunc: { /*save the frontmost window*/
hdlwindowinfo hinfo;
if (langgetparamcount (hparam1) == 0) { // old style, save the root
@@ -1301,7 +1286,6 @@
break;
}
else {
-
flnextparamislast = true;
if (!getwinparam (hparam1, 1, &hinfo))
@@ -1314,17 +1298,15 @@
break;
}
}
-
+
(*v).data.flvalue = shellsave ((**hinfo).macwindow);
fl = true;
break;
-
}
-
- case savecopyfunc: {
+ case savecopyfunc: { /* 2006-02-05 aradke: re-enabled */
tyfilespec fs;
flnextparamislast = true;
@@ -1337,14 +1319,12 @@
fl = true;
break;
-
- }
-
- case revertfunc:
+ }
+ case revertfunc:
if (!langcheckparamcount (hparam1, 0))
break;
-
+
langsaveglobals (); /*see comment at function head*/
(*v).data.flvalue = shellrevert (shellwindow, false);
@@ -1352,9 +1332,8 @@
fl = langrestoreglobals (); /*should return false; script can't continue after a revert*/
break;
-
- case printfunc:
+ case printfunc:
if (!langcheckparamcount (hparam1, 0))
break;
@@ -1363,9 +1342,8 @@
fl = true;
break;
-
+
case saveasfunc: {
-
tyfilespec fs;
short ctconsumed = 0;
short ctpositional = 0;
@@ -1377,15 +1355,13 @@
if (!getoptionalparamvalue (hparam1, &ctconsumed, &ctpositional, BIGSTRING ("\x04""path"), &val))
return (false);
-
- if (val.data.stringvalue) {
+ if (val.data.stringvalue) {
bigstring bs;
texthandletostring (val.data.stringvalue, bs);
pathtofilespec (bs, &fs);
(*v).data.flvalue = shellsaveas (shellwindow, &fs, false);
-
}
else
(*v).data.flvalue = shellsaveas (shellwindow, nil, false);
@@ -1393,16 +1369,14 @@
fl = true;
break;
-
}
- } // switch -- funcs with front globals pushed
-
+ } /*switch -- funcs with front globals pushed*/
+
shellpopglobals ();
return (fl);
-
- } // filemenufunctionvalue
+ } /*filemenufunctionvalue*/
static boolean editmenufunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
@@ -1629,6 +1603,3 @@
return (shellinitbuiltins ());
} /*shellinitverbs*/
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|