|
From: <cre...@us...> - 2006-05-05 19:43:43
|
Revision: 1363 Author: creecode Date: 2006-05-05 12:34:47 -0700 (Fri, 05 May 2006) ViewCVS: http://svn.sourceforge.net/frontierkernel/?rev=1363&view=rev Log Message: ----------- changed reference from glue table to apps Table item Modified Paths: -------------- ODBs/trunk/frontierRoot/system/verbs/builtins/app/startWithDocument.fvc Modified: ODBs/trunk/frontierRoot/system/verbs/builtins/app/startWithDocument.fvc =================================================================== --- ODBs/trunk/frontierRoot/system/verbs/builtins/app/startWithDocument.fvc 2006-05-05 19:33:17 UTC (rev 1362) +++ ODBs/trunk/frontierRoot/system/verbs/builtins/app/startWithDocument.fvc 2006-05-05 19:34:47 UTC (rev 1363) @@ -1,47 +1,49 @@ -FrontierVcsFile:1:scpt:system.verbs.builtins.app.startWithDocument +FrontierVcsFile:2:scpt:system.verbs.builtins.app.startWithDocument -on startWithDocument (appTable, docPath) { \xC7start talking with the application, might launch it - \xC7Changes - \xC74/30/05; 9:15:10 AM by TAC - \xC7added mac os x app may be folders to fileIsApp handler, file.creator check - \xC71/7/02; 11:44:10 PM by PBS - \xC7On OS X apps may be folders. If so, then the path to the app is okay, don't prompt for it again. - \xC7v3.0 dmb - \xC7handle difference between nil and the empty string for docPath - \xC7zero means normal launch w/out a specific document - \xC7"" means inhibit default document or open file dialog - \xC7v2.0 dmb - \xC7added document support - \xC7adr is the address of an application's glue table, usually in system.verbs.apps - \xC7if the application isn't running, try to launch it - \xC7if the path isn't the program, use file.getFileDialog - \xC7keep the path updated - \xC7returns true if the application is launched and ready to talk +on startWithDocument (appTable, docPath) { «start talking with the application, might launch it + «Changes + «4/19/06; 7:10:15 PM by TAC + «changed reference from glue table to apps Table item + «4/30/05; 9:15:10 AM by TAC + «added mac os x app may be folders to fileIsApp handler, file.creator check + «1/7/02; 11:44:10 PM by PBS + «On OS X apps may be folders. If so, then the path to the app is okay, don't prompt for it again. + «v3.0 dmb + «handle difference between nil and the empty string for docPath + «zero means normal launch w/out a specific document + «"" means inhibit default document or open file dialog + «v2.0 dmb + «added document support + «adr is the address of an application's glue table, usually in system.verbs.apps + «if the application isn't running, try to launch it + «if the path isn't the program, use file.getFileDialog + «keep the path updated + «returns true if the application is launched and ready to talk appTable = address (appTable); - bundle { \xC7body of app.start - local (infoTable); \xC7the application's appInfo table + bundle { «body of app.start + local (infoTable); «the application's appInfo table local (name, id, path, app1Supported, sharedMenus); - on copyFromInfoTable () { \xC7copy infoTable values into this script's locals + on copyFromInfoTable () { «copy infoTable values into this script's locals name = infoTable^.name; id = infoTable^.id; path = infoTable^.path; app1Supported = infoTable^.app1Supported; sharedMenus = infoTable^.sharedMenus}; - on appRunning () { \xC7return true if the application is running - if defined (app.idnetworkapp) { \xC7registration already taken care of + on appRunning () { «return true if the application is running + if defined (app.idnetworkapp) { «registration already taken care of id = app.idnetworkapp; return (true)}; if sys.appIsRunning (id) { - if string.length (infoTable^.path) == 0 { \xC7hasn't been set yet + if string.length (infoTable^.path) == 0 { «hasn't been set yet infoTable^.path = sys.getAppPath (id)}; return (true)}; return (false)}; - on fileIsApp () { \xC7return true if the path points to our application + on fileIsApp () { «return true if the path points to our application if sizeof (path) == 0 { return (false)}; if not file.exists (path) { @@ -54,7 +56,7 @@ return (false)}}; return (true)}; - on searchForApp () { \xC7returns empty string if we failed, full path if we won + on searchForApp () { «returns empty string if we failed, full path if we won local (folder); folder = file.folderFromPath (Frontier.getFilePath ()) + "UserLand Utilities:"; if file.exists (folder) { @@ -64,23 +66,23 @@ return (f)}}}; return ("")}; - on promptForPath () { \xC7get the application's path from the user + on promptForPath () { «get the application's path from the user local (newpath); newpath = searchForApp (); - if newpath == "" { \xC7our very limited search strategy failed - Frontier.bringToFront (); \xC7be sure Frontier is the frontmost app + if newpath == "" { «our very limited search strategy failed + Frontier.bringToFront (); «be sure Frontier is the frontmost app newpath = file.findApplication (infoTable^.id); if not file.getFileDialog ("Where is " + name + "?", @newpath, 'APPL') { return (false)}}; infoTable^.path = newpath; infoTable^.id = file.creator (newpath); - if sizeof (infoTable^.name) == 0 { \xC7hasn't been set yet + if sizeof (infoTable^.name) == 0 { «hasn't been set yet infoTable^.name = file.fileFromPath (path)}; copyFromInfoTable (); return (true)}; - on launchApp () { \xC7return true if we're able to launch the application + on launchApp () { «return true if we're able to launch the application msg ("Launching " + name + "..."); if typeof (docPath) == unknowntype { if not launch.application (path) { @@ -88,14 +90,14 @@ else { if not launch.appWithDocument (path, docPath) { return (false)}}; - docPath = ""; \xC7clear path so we'll know not to open it again + docPath = ""; «clear path so we'll know not to open it again return (true)}; - bundle { \xC7be sure the app's appInfo table is set up properly - if not defined (appTable^) { \xC7passing in a bogus address - scriptError ("The application doesn't have a Frontier \"glue\" table.")}; + bundle { «be sure the app's appInfo table is set up properly + if not defined (appTable^) { «passing in a bogus address + scriptError ("The application doesn't have an apps Table item.")}; infoTable = @appTable^.appInfo; - if not defined (infoTable^) { \xC7no appInfo table, create one with initial values + if not defined (infoTable^) { «no appInfo table, create one with initial values new (tableType, infoTable); infoTable^.name = nameOf (appTable^); infoTable^.id = '????'; @@ -103,33 +105,33 @@ infoTable^.app1Supported = false; infoTable^.sharedMenus = false}; copyFromInfoTable (); - appTable^.id = id}; \xC7side-effect -- makes life easier for glue scripts + appTable^.id = id}; «side-effect -- makes life easier for glue scripts while (not appRunning ()) { if not fileIsApp () { - if not promptForPath () { \xC7user clicked on Cancel + if not promptForPath () { «user clicked on Cancel return (false)}}; if launchApp () { break}; - path = ""}; \xC7next time try for a different file + path = ""}; «next time try for a different file - bundle { \xC7set up the app table in the object database for this application - app.id = id; \xC7all app verbs are sent to this application - appTable^.id = id; \xC7make life easy for the app's glue scripts - app.adrAppTable = appTable; \xC7the app verbs can refer to current app's info table - \xC7bundle \xC7fuss with the paths table - \xC7local (adr = @system.misc.paths.app1path) - \xC7if app1Supported \xC7app verbs are global - \xC7adr^ = @system.verbs.builtins.app - \xC7else \xC7app verbs are undefined, or require a full path - \xC7if defined (adr^) - \xC7delete (adr)}; + bundle { «set up the app table in the object database for this application + app.id = id; «all app verbs are sent to this application + appTable^.id = id; «make life easy for the app's glue scripts + app.adrAppTable = appTable}; «the app verbs can refer to current app's info table + «bundle «fuss with the paths table + «local (adr = @system.misc.paths.app1path) + «if app1Supported «app verbs are global + «adr^ = @system.verbs.builtins.app + «else «app verbs are undefined, or require a full path + «if defined (adr^) + «delete (adr)}; - if docPath != "" { \xC7tell app to open the document + if docPath != "" { «tell app to open the document required.openDocument (id, docPath)}; - msg (""); \xC7release message area + msg (""); «release message area - return (true)}}; -\xC7bundle // test - \xC7startWithDocument ("Safari", nil) \ No newline at end of file + return (true)}} +«bundle // test + «startWithDocument ("Safari", nil) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |