From e58f6b3236f51c06e53c407a46d41f5e898c3b3c Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 30 Nov 2010 21:18:47 +0000 Subject: added the simple plugins from the pd-gui-rewrite/0.43/startup branch svn path=/trunk/scripts/guiplugins/simple_examples/; revision=14540 --- insert_into_popup_menu-plugin.tcl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 insert_into_popup_menu-plugin.tcl (limited to 'insert_into_popup_menu-plugin.tcl') diff --git a/insert_into_popup_menu-plugin.tcl b/insert_into_popup_menu-plugin.tcl new file mode 100644 index 0000000..71384f8 --- /dev/null +++ b/insert_into_popup_menu-plugin.tcl @@ -0,0 +1,26 @@ + +# for more info: http://tcl.tk/man/tcl8.5/TkCmd/menu.htm + +# create the item, then stick it to the canvas using a 'mouseup' message +proc popup_create_put {putitem} { + pdsend "$::focused_window $putitem" + pdsend "$::focused_window mouseup $::popup_xpix $::popup_ypix 1" +} + +# create our submenu +menu .popup.create +# fix menu font size on Windows with tk scaling = 1 +if {$::windowingsystem eq "win32"} {.popup.create configure -font menufont} + +# add items to our submenu +# (wrapping the label like [_ ""] means that text will be localized) +.popup.create add command -label [_ "Object"] -command {popup_create_put "obj"} +.popup.create add command -label [_ "Message"] -command {popup_create_put "msg"} +.popup.create add command -label [_ "Number"] -command {popup_create_put "floatatom"} +.popup.create add command -label [_ "Symbol"] -command {popup_create_put "symbolatom"} +.popup.create add command -label [_ "Comment"] -command {popup_create_put "text"} +.popup.create add separator +.popup.create add command -label [_ "Array"] -command {pdsend "$::focused_window menuarray"} + +# insert our submenu as the 0th element on the popup +.popup insert 0 cascade -label [_ "Put"] -menu .popup.create -- cgit v1.2.1