|
From: creedon <icr...@us...> - 2005-09-16 02:47:29
|
Update of /cvsroot/frontierkernel/odbs/frontierRoot/suites/DuckTape In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21826 Modified Files: Tag: commercial_suite_project-branch newAppsTableItem Log Message: factored table initialization code to DuckTape.initializeNewTerminologyTable Index: newAppsTableItem =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/suites/DuckTape/Attic/newAppsTableItem,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** newAppsTableItem 22 Aug 2005 01:21:42 -0000 1.1.2.2 --- newAppsTableItem 16 Sep 2005 02:47:22 -0000 1.1.2.3 *************** *** 1,3 **** FrontierVcsFile:1:scpt:suites.DuckTape.newAppsTableItem ! ÇChanges Ç8/21/05; 6:14:38 PM by TAC Çin replaceAll handler set user.prefs.search.regularexpression to false to prevent unpredictable replace behaviour Ç8/17/05; 11:07:44 AM by TAC Çbring about window to front so import process can report progress Ç8/16/05; 11:22:18 PM by TAC Çadded call to init Çadded support for user.DuckTape.appIdStyle Çadded support for user.DuckTape.flUseEventInformationTable Ç8/14/05; 7:45:14 PM by TAC Çnotify if new apps table items name is in conflict with other than system.verbs.apps table, example: trying to bring in Mail.app causes a a conflict with suites.mail. Ç8/7/05; 11:51:34 AM by TAC Çcreated, based on the work done by Sean Elfstrom < sel...@im... >. DuckTape.init (); local (f); if file.getFileDialog ("Select the application from which to create a new apps table item...", @f, DuckTape.data.appTypes) { if not (defined (temp.DuckTape)) { new (tableType, @temp.DuckTape)}; bundle { // apps table item name local (s = file.fileFromPath (f)); s = string.replaceAll (s, " ", ""); s = string.popTrailing (s, file.getPathChar ()); // might be an Mac OS X application package if s endsWith ".app" { // might be a Mac OS X application name s = string.popSuffix (s, '.')}; temp.DuckTape.appsTableItemName = s}; if dialog.ask ("New apps table item name:", @temp.DuckTape.appsTableItemName) { local (adrGlueTable = @system.verbs.apps.[temp.DuckTape.appsTableItemName]); try { // 8/14/05; 6:51:45 PM by TAC - notify if conflict with other than system.verbs.apps table, an improvement on this would be to continue to ask the user for new names until they cancel and not make them have to start over. local (adr = address (temp.DuckTape.appsTableItemName)); if adr != adrGlueTable { if defined (adr^) { if dialog.twoWay ("The name \"" + temp.DuckTape.appsTableItemName + "\" conflicts with " + string.popFileFromAddress (adr) + ". Do you want to continue?", "No", "Yes") { return (false)}}}}; if defined (adrGlueTable^) { if dialog.twoWay ("An apps table item with the name of \"" + temp.DuckTape.appsTableItemName + "\" already exists. Are you sure you want to replace it?", "No", "Yes") { return (false)}}; on replaceAll (searchString, replaceString) { local (numReplaced, savedParams); table.assign (@savedParams, user.prefs.search); // save off user.prefs.search.flatSearch = false; user.prefs.search.frontWindowOnly = false; user.prefs.search.regularexpression = false; user.prefs.search.wholeWords = false; user.prefs.search.searchFor = searchString; user.prefs.search.replaceWith = replaceString; search.reset (); numReplaced = search.replaceAll (); table.assign (@user.prefs.search, savedParams); // restore originals return (numReplaced)}; new (tableType, adrGlueTable); table.copyContents (@DuckTape.data.newTable, adrGlueTable); local (adrAppInfo = @adrGlueTable^.appInfo); bundle { // add appInfo table items adrAppInfo^.name = temp.DuckTape.appsTableItemName; ÇadrAppInfo^.sharedMenus = dialog.yesNo ("Does " + temp.DuckTape.appsTableItemName + " support Menu Sharing?") adrAppInfo^.path = f; adrAppInfo^.id = string4 (file.creator (f)); if system.environment.isCarbon { // it might be a package if file.isFolder (f) { adrAppInfo^.id = string4 (string.mid (file.readWholeFile (f + "Contents:PkgInfo"), 5, 4))}}; Çbundle // 8/7/05; 11:50:42 AM by TAC - old code, is this needed anymore? Çif not dialog.ask ("What is " + temp.appname + "'s creator id?", @adrAppInfo^.id) Çreturn ÇadrAppInfo^.id = string4 (adrAppInfo^.id) ÇadrGlueTable^.id = adrAppInfo^.id }; adrGlueTable^.id = string4 (adrAppInfo^.id); bundle { // set up new table target.set (adrGlueTable); replaceAll ("[[sample]]", temp.DuckTape.appsTableItemName); replaceAll ("[[sample.id]]", DuckTape.appIdStyle (temp.DuckTape.appsTableItemName, user.DuckTape.appIdStyle)); target.clear (); sys.systemTask (); // 8/7/05; 11:46:40 AM by TAC - is this needed? }; bundle { // import local (flDoImport = false); try { if rez.countResources (adrAppInfo^.path, 'aete') > 0 { flDoImport = true}}; if system.environment.isCarbon { // it might be a package if file.isFolder (adrAppInfo^.path) { flDoImport = true}}; if flDoImport { window.about (); msg ("DuckTape: "); DuckTape.parseAete (f, adrGlueTable)}}; Çif adrAppInfo^.sharedMenus // 8/7/05; 12:32:34 PM by TAC - old code? Çlocal (adrMenuBar = @system.menus.sharedMenus.[adrAppInfo^.id]) Çif not defined (adrMenuBar^) Çif not dialog.confirm ("Create a new shared menu bar for " + temp.appname + "?") Çreturn Çon linkScript (scriptString) Çlocal (tempscript) Ç Çnew (scriptType, @tempscript) Çtarget.set (@tempscript) ÇeditMenu.setFont (user.prefs.fonts.scriptfont) ÇeditMenu.setFontSize (user.prefs.fonts.scriptfontsize) Çop.setLineText (scriptString) Çop.insert ("Frontier.bringToFront ()", down) Çtarget.clear () Ç Çtarget.set (adrMenuBar) Çmenu.setScript (@tempscript) Ç Çtable.copy (@DuckTapeData.newMenuBar, @system.menus.sharedMenus) Çtable.rename (@system.menus.sharedMenus.newMenuBar, adrAppInfo^.id) Çtarget.set (adrMenuBar) Çop.firstSummit () Çop.expand (infinity) Çop.go (right, 1) Çop.go (down, infinity) Çcursor on "Edit Scripts Table" ÇlinkScript ("edit (@" + temp.appname + ")") Çop.go (up, 1) Çcursor on "Edit Shared Menu" ÇlinkScript ("edit (@" + adrMenuBar + ")") Çop.firstSummit () Çtarget.clear () ÇsomethingCreated = true fileMenu.save ()}} \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:suites.DuckTape.newAppsTableItem ! ÇChanges Ç9/5/05; 6:41:02 PM by TAC Çfactored table initialization code to DuckTape.initializeNewTerminologyTable, factored code improvements include: Çadded support for user.DuckTape.callbacks.afterAppInfoInitialized Çpop .osax for apps table item name Çremove now redundant grabbing appid from mac os x package code Çholding down shift key will allow user to see all files types Çadded support for user.DuckTape.eventInformationTableName Ç8/21/05; 6:14:38 PM by TAC Çin replaceAll handler set user.prefs.search.regularexpression to false to prevent unpredictable replace behaviour Ç8/17/05; 11:07:44 AM by TAC Çbring about window to front so import process can report progress Ç8/16/05; 11:22:18 PM by TAC Çadded call to init Çadded support for user.DuckTape.appIdStyle Çadded support for user.DuckTape.flUseEventInformationTable Ç8/14/05; 7:45:14 PM by TAC Çnotify if new apps table items name is in conflict with other than system.verbs.apps table, example: trying to bring in Mail.app causes a a conflict with suites.mail. Ç8/7/05; 11:51:34 AM by TAC Çcreated, based on the work done by Sean Elfstrom < sel...@im... >. local (adrTerminologyTable, path); if DuckTape.initializeNewTerminologyTable (@path, @adrTerminologyTable) { window.about (); msg ("DuckTape: "); DuckTape.parseAete (path, adrTerminologyTable)} \ No newline at end of file |