Monday, November 08, 2010 at 12:02 AM.
system.verbs.builtins.Frontier.tools.init
on init () { <<Changes: <<9/17/10; 11:08:22 PM by DW <<New pref, user.tools.prefs.flUseScheduler2, initialized to false. If set true, we use the new scheduler. Eventually this will be set true in userland.cleanroot. <<1/18/10; 9:47:39 AM by DW <<Don't install the Frontier.tools thread, new pref user.tools.prefs.flCheckToolsFolder, defaults true. <<7/17/09; 6:08:29 PM by DW <<Make sure that user.callbacks.opInsert has an element named "tools" that points to Frontier.tools.windowTypes.callbacks.opInsert. <<11/26/01; 5:55:25 PM by JES <<Create callback tables at user.tools.callbacks. Right now, there are four callbacks, beforeInstall, beforeUninstall, afterInstall, and afterUninstall. <<9/19/01; 5:41:45 PM by JES <<Create an empty table at system.temp.Frontier.tools, for storing temporary information about Tools. <<7/1/01; 7:01:01 PM by JES <<Added initialization of windowTypes-related items. <<6/21/01; 1:20:57 AM by JES <<If this is Radio, only check to see if user.menus.tools == @playlist.tools.menu, if playlist.tools.menu is defined. <<04/22/01; 8:58:49 PM by JES <<Be sure the user.html.callbacks.fileWriters.ftp table exists. <<4/18/01; 1:20:35 AM by JES <<Cribbed from playlist.tools from Radio.root. on installCallback (adrcode, name, replaceIfEqualsString=nil, adrCallbacks=@user.callbacks) { local (adrtable = @adrCallbacks^.[name]); if not defined (adrtable^) { new (tableType, adrtable)}; local (adrscript = @adrtable^.tools); if replaceIfEqualsString != nil { if defined (adrscript^) { if string (adrscript^) == replaceIfEqualsString { delete (adrscript)}}}; if not defined (adrscript^) { adrscript^ = @adrcode^.[name]}}; bundle { //init user.tools if not defined (user.tools) { new (tableType, @user.tools)}; if not defined (user.tools.databases) { new (tableType, @user.tools.databases)}; bundle { //prefs if not defined (user.tools.prefs) { new (tableType, @user.tools.prefs)}; if not defined (user.tools.prefs.flCheckToolsFolder) { //1/18/10 by DW user.tools.prefs.flCheckToolsFolder = true}; if not defined (user.tools.prefs.flUseScheduler2) { //9/17/10 by DW user.tools.prefs.flUseScheduler2 = false}}; if system.environment.isPike and defined (playlist.tools.menu) { if user.menus.tools == @playlist.tools.menu { delete (@user.menus.tools)}}; if not defined (user.menus.tools) { user.menus.tools = @Frontier.tools.menu}}; bundle { //init temp.Frontier.tools if not defined (system.temp.Frontier) { new (tableType, @system.temp.Frontier)}; if not defined (system.temp.Frontier.tools) { new (tableType, @system.temp.Frontier.tools)}}; <<bundle //set up Frontier.tools.thread, commented -- 1/18/10 by DW <<if not defined (user.scheduler.threads.tools) <<user.scheduler.threads.tools = @Frontier.tools.thread bundle { //init user.tools.menus if not defined (user.tools.menus) { new (tabletype, @user.tools.menus)}; if not defined (user.tools.menus.rightClickMenu) { new (menubartype, @user.tools.menus.rightClickMenu)}}; bundle { //init user.tools.nodeTypes if not defined (user.tools.nodeTypes) { new (tabletype, @user.tools.nodeTypes)}}; bundle { //make sure nodeTypes-related callbacks are installed local (adrcode = @Frontier.tools.nodeTypes.callbacks); installCallback (adrcode, "opCollapse", "return (Frontier.tools.opExpandCallback ())"); installCallback (adrcode, "opExpand", "return (Frontier.tools.opExpandCallback ())"); installCallback (adrcode, "opRightClick", "on tools (adrmenu) {\r\treturn (Frontier.tools.opRightClickCallback (adrmenu))}")}; <<bundle //old code <<bundle //opCollapse <<local (adrtable = @user.callbacks.opCollapse) <<if not defined (adrtable^) <<new (tableType, adrtable) <<local (adrscript = @adrtable^.tools) <<if defined (adrscript^) <<if string (adrscript^) == "return (Frontier.tools.opExpandCallback ())" <<delete (adrscript) <<if not defined (adrscript^) <<adrscript^ = @adrcode^.opCollapse <<bundle //opExpand <<local (adrtable = @user.callbacks.opExpand) <<if not defined (adrtable^) <<new (tableType, adrtable) <<local (adrscript = @adrtable^.tools) <<if defined (adrscript^) <<if string (adrscript^) == "return (Frontier.tools.opExpandCallback ())" <<delete (adrscript) <<if not defined (adrscript^) <<adrscript^ = @adrcode^.opExpand <<bundle //opRightClick <<local (adrtable = @user.callbacks.opRightClick) <<if not defined (adrtable^) <<new (tableType, adrtable) <<local (adrscript = @adrtable^.tools) <<if defined (adrscript^) <<if string (adrscript^) == "on tools (adrmenu) {\r\treturn (Frontier.tools.opRightClickCallback (adrmenu))}" <<delete (adrscript) <<if not defined (adrscript^) <<adrscript^ = @adrcode^.opRightClick bundle { //make sure the html fileWriters callbacks table exists if not defined (user.html.callbacks) { new (tableType, @user.html.callbacks)}; if not defined (user.html.callbacks.fileWriters) { new (tableType, @user.html.callbacks.fileWriters)}; if not defined (user.html.callbacks.fileWriters.ftp) { new (tableType, @user.html.callbacks.fileWriters.ftp)}}; bundle { //init user.tools.windowTypes if not defined (user.tools.windowTypes) { new (tabletype, @user.tools.windowTypes)}}; bundle { //make sure windowTypes-related callbacks are installed local (adrcode = @Frontier.tools.windowTypes.callbacks); <<Builtin callbacks installCallback (adrcode, "closeWindow"); installCallback (adrcode, "openWindow"); installCallback (adrcode, "saveWindow"); <<Outline callbacks installCallback (adrcode, "opReturnKey"); installCallback (adrcode, "opCursorMoved"); installCallback (adrcode, "opInsert"); //7/17/09 by DW }; bundle { //install commandCallbacks, and create user.tools.callbacks tables on sureTable (adrparent, name) { if not defined (adrparent^.[name]) { new (tableType, @adrparent^.[name])}}; local (adrcallbacks = @user.tools.commandCallbacks); if not defined (adrcallbacks^) { new (tableType, adrcallbacks)}; sureTable (adrcallbacks, "isMenuItemEnabled"); sureTable (adrcallbacks, "close"); sureTable (adrcallbacks, "new"); sureTable (adrcallbacks, "open"); sureTable (adrcallbacks, "openUrl"); sureTable (adrcallbacks, "revert"); sureTable (adrcallbacks, "save"); sureTable (adrcallbacks, "saveAs"); sureTable (adrcallbacks, "saveAsHtml"); sureTable (adrcallbacks, "saveAsPlainText"); sureTable (adrcallbacks, "viewInBrowser"); adrcallbacks = @user.tools.callbacks; if not defined (adrcallbacks^) { new (tableType, adrcallbacks)}; sureTable (adrcallbacks, "beforeInstall"); sureTable (adrcallbacks, "afterInstall"); sureTable (adrcallbacks, "beforeUninstall"); sureTable (adrcallbacks, "afterUninstall")}; bundle { //init manila windowTypes, nodeTypes and editResponder if defined (manila.windowTypes) { manila.windowTypes.init ()}; if defined (manila.nodeTypes) { manila.nodeTypes.init ()}; if system.environment.isRadio { if defined (manila.editResponder) { manila.editResponder.init ()}}}; bundle { //init chatClient, xmlStorageSystem, and bookmarksMenu if defined (chatClient) { chatClient.init ()}; if defined (xmlStorageSystem) { xmlStorageSystem.init ()}; if defined (bookmarksMenu) { bookmarksMenu.init ()}}; bundle { //finish installation if not defined (Frontier.tools.data.flInstalled) { Frontier.tools.data.flInstalled = false}; if not Frontier.tools.data.flInstalled { //install wrapper scripts for file and edit menu calls, and isFileMenuItemChecked/Enabled if system.environment.isRadio { if defined (system.verbs.builtins.pike) { delete (@pike.isFileMenuItemChecked); script.newScriptObject ("on isFileMenuItemChecked (cmd) {return (Frontier.tools.windowTypes.isFileMenuItemChecked (cmd))}", @pike.isFileMenuItemChecked); delete (@pike.isFileMenuItemEnabled); script.newScriptObject ("on isFileMenuItemEnabled (cmd) {return (Frontier.tools.windowTypes.isFileMenuItemEnabled (cmd))}", @pike.isFileMenuItemEnabled); delete (@pike.runFileMenuScript); script.newScriptObject ("on runFileMenuScript (itemname) {return (Frontier.tools.windowTypes.runFileMenuScript (itemname))}", @pike.runFileMenuScript); delete (@pike.runEditMenuScript); script.newScriptObject ("on runEditMenuScript (itemname) {return (Frontier.tools.windowTypes.runEditMenuScript (itemname))}", @pike.runEditMenuScript)}}}; bundle { //delete old callback entries local (adr); for adr in @user.callbacks { if defined (adr^.pike) { delete (@adr^.pike)}; if defined (adr^.playlist) { delete (@adr^.playlist)}}}; Frontier.tools.data.flInstalled = true}}; //only do this once bundle { //test code init ()}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.