/usr/lib/pd-gui/plugins-available/patcherize-plugin/patcherize-plugin.tcl is in pd-iemutils 0.0.20180206-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | # META helper plugin for patcherize-selection
# META DESCRIPTION adds menu to tell the 'patcherize' library to doit
# META AUTHOR IOhannes m zmölnig <zmoelnig@umlaeute.mur.at>
# META VERSION 0.1
package require pdwindow 0.1
if [catch {
package require msgcat
::msgcat::mcload po
}] { puts "iem::punish::patcherize: i18n failed" }
namespace eval ::iem::punish::patcherize:: {
variable label_sub
variable label_abs
proc focus {winid state} {
set menustate [expr $state?"normal":"disabled"]
.menubar.edit entryconfigure "$::iem::punish::patcherize::label_sub" -state $menustate
.menubar.edit entryconfigure "$::iem::punish::patcherize::label_abs" -state $menustate
}
## helper function to pick a filename for saving
# (why isn't there something like this in Pd-GUI?)
proc savepanel {initialdir {initialfile ""} {defaultextension ".pd"} {filetypes $::filetypes} } {
if { "$filetypes" == {$::filetypes} } {
set filetypes $::filetypes
}
if { ! [file isdirectory $initialdir]} {set initialdir $::env(HOME)}
set filename [tk_getSaveFile \
-defaultextension $defaultextension \
-filetypes $filetypes \
-initialfile $initialfile \
-initialdir $initialdir]
return $filename
}
proc patcherize2file {winid} {
set filename [::iem::punish::patcherize::savepanel "." "" ".pd" [list [list [_ "Pd Files"] {.pd} ]]]
if { $filename != "" } {
menu_send $::focused_window "patcherize [enquote_path $filename]"
}
}
proc register {} {
# create an entry for our "print2svg" in the "file" menu
set ::iem::punish::patcherize::label_sub [_ "SubPatcherize Selection"]
set ::iem::punish::patcherize::label_abs [_ "Patcherize Selection..."]
set accelerator $::pd_menus::accelerator
set mymenu .menubar.edit
if {$::windowingsystem eq "aqua"} {
set inserthere 8
set accelerator "$accelerator+Shift"
} else {
set inserthere 8
set accelerator "Shift+$accelerator"
}
set accelerator "$accelerator+P"
$mymenu insert $inserthere command \
-label $::iem::punish::patcherize::label_sub \
-state disabled \
-accelerator "$accelerator" \
-command { menu_send $::focused_window patcherize }
$mymenu insert [incr inserthere] command \
-label $::iem::punish::patcherize::label_abs \
-state disabled \
-command { ::iem::punish::patcherize::patcherize2file $::focused_window }
bind all <$::modifier-Key-P> {menu_send %W patcherize}
bind PatchWindow <FocusIn> "+::iem::punish::patcherize::focus %W 1"
bind PdWindow <FocusIn> "+::iem::punish::patcherize::focus %W 0"
# attempt to load the 'patcherize' library from iem::punish
# (that does all the work)
set lib [string map {" " "\\ "} [file join $::current_plugin_loadpath patcherize]]
pdsend "pd-_float_template declare -lib $lib"
pdtk_post "loaded iem::punish::patcherize-plugin\n"
}
}
::iem::punish::patcherize::register
|