Monday, November 08, 2010 at 12:00 AM.
scripting2Suite.editor.opRightClickCallback
on opRightClickCallback (adradrmenu) {
<<Changes
<<11/10/09; 8:07:36 AM by DW
<<Created. Look at Frontier.tools.nodeTypes.callbacks.opRightClick for prior art.
<<speaker.beep ()
if scripting2Suite.editor.isEditingWindow (address (window.frontmost ())) {
local (menuname = "Right-Click Menu", atts, dir = right);
op.attributes.getall (@atts);
bundle { //don't include commands if cursor isn't on the summit of a blog post
if not defined (atts.type) {
return (false)};
if atts.type != "scripting2Post" {
return (false)}};
Frontier.tools.nodeTypes.callbacks.opRightClick (adradrmenu);
bundle { //add our commands to the menu
local (oldtarget = target.set (adradrmenu^));
op.insert ("-", down);
on booleanCommand (attname, string1, string2) {
local (fl = false, scriptstring);
if defined (atts.[attname]) {
fl = boolean (atts.[attname])};
scriptstring = "scripting2Suite.editor.menuCommands.setPostAttribute (\"" + attname + "\", " + string (not fl) + ")";
if fl {
menu.addMenuCommand (adrmenu, menuname, string1, scriptstring)}
else {
menu.addMenuCommand (adrmenu, menuname, string2, scriptstring)}};
booleanCommand ("flNotInChronology", "Make blog post", "Make standalone");
booleanCommand ("flLiveBlog", "Not live-blog", "Make live-blog");
booleanCommand ("flVisibleSubtext", "Hidden sub-text", "Visible sub-text");
op.insert ("-", down);
bundle { //map domain command
local (s);
s = "scripting2Suite.editor.menuCommands.mapDomain ()";
<<s = "scripting2Suite.editor.menuCommands.setStringAttribute (\"domainToMap\", \"Domain to map?\")"
menu.addMenuCommand (adrmenu, menuname, "Map domain...", s)};
target.set (oldtarget)};
adradrmenu^ = adrmenu;
return (false)};
return (false)};
bundle { //test code
local (adrmenu);
opRightClickCallback (@adrmenu);
dialog.alert (adrmenu)}
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.