diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2010-11-30 21:18:47 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2010-11-30 21:18:47 +0000 |
commit | e58f6b3236f51c06e53c407a46d41f5e898c3b3c (patch) | |
tree | 0f591563a53ca78869729ec022f76de692306885 |
added the simple plugins from the pd-gui-rewrite/0.43/startup branchsvn2git-root
svn path=/trunk/scripts/guiplugins/simple_examples/; revision=14540
-rw-r--r-- | add_item_to_popup_menu-plugin.tcl | 6 | ||||
-rw-r--r-- | add_menubar_to_popup_menu-plugin.tcl | 17 | ||||
-rw-r--r-- | add_my_patches_to_media_menu-plugin.tcl | 11 | ||||
-rw-r--r-- | clone_put_menu_into_popup_menu-plugin.tcl | 6 | ||||
-rw-r--r-- | editmode_look-plugin.tcl | 33 | ||||
-rw-r--r-- | font_doesnt_follow_focus-plugin.tcl | 11 | ||||
-rw-r--r-- | global_editmode_0-plugin.tcl | 15 | ||||
-rw-r--r-- | gtklook-plugin.tcl | 41 | ||||
-rw-r--r-- | hide_cords_in_editmode-plugin.tcl | 16 | ||||
-rw-r--r-- | insert_into_popup_menu-plugin.tcl | 26 | ||||
-rw-r--r-- | meters_default_on-plugin.tcl | 3 | ||||
-rw-r--r-- | pdwindow_popup_mode-plugin.tcl | 19 | ||||
-rw-r--r-- | remove_menubar_from_patch_windows-plugin.tcl | 7 | ||||
-rw-r--r-- | set_canvas_minsize-plugin.tcl | 8 | ||||
-rw-r--r-- | set_custom_stored_histories-plugin.tcl | 6 | ||||
-rw-r--r-- | tripleclickobj-plugin.tcl | 9 |
16 files changed, 234 insertions, 0 deletions
diff --git a/add_item_to_popup_menu-plugin.tcl b/add_item_to_popup_menu-plugin.tcl new file mode 100644 index 0000000..04ebd55 --- /dev/null +++ b/add_item_to_popup_menu-plugin.tcl @@ -0,0 +1,6 @@ + + +# for more info: http://tcl.tk/man/tcl8.5/TkCmd/menu.htm +.popup add separator +.popup add command -label "My Favorite Object" \ + -command {pdsend "$::focused_window obj $::popup_xcanvas $::popup_ycanvas osc~"} diff --git a/add_menubar_to_popup_menu-plugin.tcl b/add_menubar_to_popup_menu-plugin.tcl new file mode 100644 index 0000000..ee8149b --- /dev/null +++ b/add_menubar_to_popup_menu-plugin.tcl @@ -0,0 +1,17 @@ +# this scriptlet removes the menubars from all canvas windows. You could also +# create your own custom menu and add it to the canvas windows. + +# TODO ::pd_menus::update_window_menu expects to find ::patch_menubar not "" + +# on Mac OS X, no windows have menubars, so no need to remove for 'aqua' +if {$::windowingsystem ne "aqua"} { + set ::patch_menubar "" +} + +set menulist "file edit put find media window help" +.popup add separator +foreach mymenu $menulist { + .menubar.$mymenu clone .popup.$mymenu normal + .popup add cascade -label [_ [string totitle $mymenu]] \ + -menu .popup.$mymenu +} diff --git a/add_my_patches_to_media_menu-plugin.tcl b/add_my_patches_to_media_menu-plugin.tcl new file mode 100644 index 0000000..bf9f3ab --- /dev/null +++ b/add_my_patches_to_media_menu-plugin.tcl @@ -0,0 +1,11 @@ +# this script searches a folder for Pd patches, then adds them to the bottom +# of the Media menu for quick opening + +# you probably want to set this to something that makes sense for you: +set mypatch_dir ~/Documents/Pd + +.menubar.media add separator + +foreach filename [glob -directory $mypatch_dir -nocomplain -types {f} -- *.pd] { + .menubar.media add command -label [file tail $filename] -command "open_file $filename" +} diff --git a/clone_put_menu_into_popup_menu-plugin.tcl b/clone_put_menu_into_popup_menu-plugin.tcl new file mode 100644 index 0000000..0a1de7a --- /dev/null +++ b/clone_put_menu_into_popup_menu-plugin.tcl @@ -0,0 +1,6 @@ + + +# for more info: http://tcl.tk/man/tcl8.5/TkCmd/menu.htm +.menubar.put clone .popup.create normal +.popup insert 0 cascade -label [_ "Put"] -menu .popup.create +.popup.create configure -tearoff 1 diff --git a/editmode_look-plugin.tcl b/editmode_look-plugin.tcl new file mode 100644 index 0000000..669d03f --- /dev/null +++ b/editmode_look-plugin.tcl @@ -0,0 +1,33 @@ +# this script makes it so that the cords are hidden when not in edit mode + +proc set_cords_by_editmode {mytoplevel} { + if {$mytoplevel eq ".pdwindow"} {return} + set tkcanvas [tkcanvas_name $mytoplevel] + if { ! [winfo exists $mytoplevel] } {return} + if {$::editmode($mytoplevel) == 1} { + $tkcanvas configure -background "#fff" + $tkcanvas itemconfigure graph -fill black + $tkcanvas itemconfigure array -fill black + $tkcanvas itemconfigure array -activefill blue + $tkcanvas itemconfigure label -fill black + $tkcanvas itemconfigure obj -fill black + $tkcanvas itemconfigure msg -activefill black + $tkcanvas itemconfigure atom -activefill black + $tkcanvas itemconfigure cord -fill black + $tkcanvas itemconfigure {inlet || outlet} -outline black + } else { + $tkcanvas configure -background white + $tkcanvas itemconfigure graph -fill magenta + $tkcanvas itemconfigure array -fill cyan + $tkcanvas itemconfigure array -activefill blue + $tkcanvas itemconfigure label -fill "#777777" + $tkcanvas itemconfigure obj -fill grey + $tkcanvas itemconfigure msg -activefill blue + $tkcanvas itemconfigure atom -activefill blue + $tkcanvas itemconfigure cord -fill grey + $tkcanvas itemconfigure {inlet || outlet} -outline white + $tkcanvas lower {inlet || outlet} + } +} + +bind all <<EditMode>> {+set_cords_by_editmode %W} diff --git a/font_doesnt_follow_focus-plugin.tcl b/font_doesnt_follow_focus-plugin.tcl new file mode 100644 index 0000000..a822bd5 --- /dev/null +++ b/font_doesnt_follow_focus-plugin.tcl @@ -0,0 +1,11 @@ +# this plugin disables the following of focused window by overriding a proc + +rename ::dialog_font::update_font_dialog {} +proc ::dialog_font::update_font_dialog {mytoplevel} { + variable canvaswindow + if {[winfo exists .font]} { + wm title .font [format [_ "%s Font"] [lookup_windowname $canvaswindow]] + } else { + set canvaswindow $mytoplevel + } +} diff --git a/global_editmode_0-plugin.tcl b/global_editmode_0-plugin.tcl new file mode 100644 index 0000000..98f7a6a --- /dev/null +++ b/global_editmode_0-plugin.tcl @@ -0,0 +1,15 @@ +# +# this plugin maps Ctrl-Shift-E (Cmd-Shift-E) to switch all open patches to +# Interact Mode (i.e. the opposite of Edit Mode) + +proc global_turn_off_editmode {} { + pdtk_post "$::pd_menus::accelerator-Shift-E: Turning off edit mode for all open windows" + foreach window [winfo children .] { + if {[winfo class $window] eq "PatchWindow"} { + pdsend "$window editmode 0" + } + } +} + +# the "E" needs to be upper case, otherwise it gets missed with the 'Shift' +bind all <$::modifier-Shift-Key-E> global_turn_off_editmode diff --git a/gtklook-plugin.tcl b/gtklook-plugin.tcl new file mode 100644 index 0000000..263c6d4 --- /dev/null +++ b/gtklook-plugin.tcl @@ -0,0 +1,41 @@ +# learn more here: http://www.cs.man.ac.uk/~fellowsd/tcl/option-tutorial.html +if { [tk windowingsystem] == "x11" } { + option add *borderWidth 1 widgetDefault + option add *activeBorderWidth 1 widgetDefault + option add *selectBorderWidth 1 widgetDefault + option add *font -adobe-helvetica-medium-r-normal-*-12-*-*-*-*-*-* + + option add *padX 2 + option add *padY 4 + + option add *Listbox.background white + option add *Listbox.selectBorderWidth 0 + option add *Listbox.selectForeground white + option add *Listbox.selectBackground #4a6984 + + option add *Entry.background white + option add *Entry.foreground black + option add *Entry.selectBorderWidth 0 + option add *Entry.selectForeground white + option add *Entry.selectBackground #4a6984 + + option add *Text.background white + option add *Text.selectBorderWidth 0 + option add *Text.selectForeground white + option add *Text.selectBackground #4a6984 + + option add *Menu.activeBackground #4a6984 + option add *Menu.activeForeground white + option add *Menu.activeBorderWidth 0 + option add *Menu.highlightThickness 0 + option add *Menu.borderWidth 2 + + option add *MenuButton.activeBackground #4a6984 + option add *MenuButton.activeForeground white + option add *MenuButton.activeBorderWidth 0 + option add *MenuButton.highlightThickness 0 + option add *MenuButton.borderWidth 0 + + option add *highlightThickness 0 + option add *troughColor #bdb6ad +} diff --git a/hide_cords_in_editmode-plugin.tcl b/hide_cords_in_editmode-plugin.tcl new file mode 100644 index 0000000..a0cd189 --- /dev/null +++ b/hide_cords_in_editmode-plugin.tcl @@ -0,0 +1,16 @@ +# this script makes it so that the cords are hidden when not in edit mode + +proc set_cords_by_editmode {mytoplevel} { + if {$mytoplevel eq ".pdwindow"} {return} + set tkcanvas [tkcanvas_name $mytoplevel] + if { ! [winfo exists $mytoplevel] } {return} + if {$::editmode($mytoplevel) == 1} { + $tkcanvas itemconfigure cord -fill black + $tkcanvas raise cord + } else { + $tkcanvas itemconfigure cord -fill white + $tkcanvas lower cord + } +} + +bind all <<EditMode>> {+set_cords_by_editmode %W} 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 diff --git a/meters_default_on-plugin.tcl b/meters_default_on-plugin.tcl new file mode 100644 index 0000000..4e8cbd6 --- /dev/null +++ b/meters_default_on-plugin.tcl @@ -0,0 +1,3 @@ +# this makes the meters in the Pd window be on by default +set ::meters 1 +pdsend "pd meters 1" diff --git a/pdwindow_popup_mode-plugin.tcl b/pdwindow_popup_mode-plugin.tcl new file mode 100644 index 0000000..fd1c296 --- /dev/null +++ b/pdwindow_popup_mode-plugin.tcl @@ -0,0 +1,19 @@ +# create an option for a mode where the Pd window pops up whenever anything is +# printed to the text box in the Pd window + +set ::pdwindow::popupmode 0 +rename pdtk_post pdtk_post_original +proc pdtk_post {message} { + if {$::pdwindow::popupmode} { + wm deiconify .pdwindow + raise .pdwindow + } + pdtk_post_original $message +} + +set mymenu .menubar.window +set inserthere [$mymenu index [_ "Parent Window"]] +$mymenu insert $inserthere separator +$mymenu insert $inserthere check -label [_ " Popup mode"] -variable ::pdwindow::popupmode + + diff --git a/remove_menubar_from_patch_windows-plugin.tcl b/remove_menubar_from_patch_windows-plugin.tcl new file mode 100644 index 0000000..124d216 --- /dev/null +++ b/remove_menubar_from_patch_windows-plugin.tcl @@ -0,0 +1,7 @@ +# this scriptlet removes the menubars from all canvas windows. You could also +# create your own custom menu and add it to the canvas windows. + +# on Mac OS X, no windows have menubars, so no need to remove for 'aqua' +if {$::windowingsystem ne "aqua"} { + set ::canvas_menubar "" +} diff --git a/set_canvas_minsize-plugin.tcl b/set_canvas_minsize-plugin.tcl new file mode 100644 index 0000000..3b445ed --- /dev/null +++ b/set_canvas_minsize-plugin.tcl @@ -0,0 +1,8 @@ + +# set the minimum size of canvas windows, so it doesn't hide the menubar +if {$::windowingsystem ne "aqua"} { + set ::canvas_minwidth 310 + set ::canvas_minheight 45 +} + + diff --git a/set_custom_stored_histories-plugin.tcl b/set_custom_stored_histories-plugin.tcl new file mode 100644 index 0000000..1389374 --- /dev/null +++ b/set_custom_stored_histories-plugin.tcl @@ -0,0 +1,6 @@ +# you can preset the histories of various things like the Tcl entry box in the +# Pd window and the messages in the Message dialog. They are lists of messages +# in order of newness, so the newest item is at the end of the list. + +set ::pdwindow::tclentry_history {"menu_message_dialog" "console hide" "console show"} +set ::dialog_message::message_history {"pd dsp 1" "pd dsp 0" "my very custom message"} diff --git a/tripleclickobj-plugin.tcl b/tripleclickobj-plugin.tcl new file mode 100644 index 0000000..715cd56 --- /dev/null +++ b/tripleclickobj-plugin.tcl @@ -0,0 +1,9 @@ +# This is a sketch to demonstrate a Tcl "plugin" for Pd: it binds to +# triple-clicks to trigger the creation of a new object. +proc process_tripleclick {window} { + set mytoplevel [winfo toplevel $window] + if {[winfo class $mytoplevel] == "PatchWindow" && $::editmode($mytoplevel)} { + ::pd_connect::pdsend "$mytoplevel obj" + } +} +bind all <Triple-ButtonRelease-1> {process_tripleclick %W} |