pd-0.45-4/0000775000175000017500000000000012243725267010402 5ustar mspmsppd-0.45-4/tcl/0000775000175000017500000000000012224064116011150 5ustar mspmsppd-0.45-4/tcl/pd_menucommands.tcl0000664000175000017500000002223212222201037015017 0ustar mspmsp package provide pd_menucommands 0.1 namespace eval ::pd_menucommands:: { variable untitled_number "1" namespace export menu_* } # ------------------------------------------------------------------------------ # functions called from File menu proc ::pd_menucommands::menu_new {} { variable untitled_number if { ! [file isdirectory $::filenewdir]} {set ::filenewdir $::env(HOME)} # to localize "Untitled" there will need to be changes in g_canvas.c and # g_readwrite.c, where it tests for the string "Untitled" set untitled_name "Untitled" pdsend "pd menunew $untitled_name-$untitled_number [enquote_path $::filenewdir]" incr untitled_number } proc ::pd_menucommands::menu_open {} { if { ! [file isdirectory $::fileopendir]} {set ::fileopendir $::env(HOME)} set files [tk_getOpenFile -defaultextension .pd \ -multiple true \ -filetypes $::filetypes \ -initialdir $::fileopendir] if {$files ne ""} { foreach filename $files { open_file $filename } set ::fileopendir [file dirname $filename] } } proc ::pd_menucommands::menu_print {mytoplevel} { set filename [tk_getSaveFile -initialfile pd.ps \ -defaultextension .ps \ -filetypes { {{postscript} {.ps}} }] if {$filename ne ""} { set tkcanvas [tkcanvas_name $mytoplevel] $tkcanvas postscript -file $filename } } # ------------------------------------------------------------------------------ # functions called from Edit menu proc ::pd_menucommands::menu_undo {} { if {$::focused_window eq $::undo_toplevel && $::undo_action ne "no"} { pdsend "$::focused_window undo" } } proc ::pd_menucommands::menu_redo {} { if {$::focused_window eq $::undo_toplevel && $::redo_action ne "no"} { pdsend "$::focused_window redo" } } proc ::pd_menucommands::menu_editmode {state} { if {[winfo class $::focused_window] ne "PatchWindow"} {return} set ::editmode_button $state # this shouldn't be necessary because 'pd' will reply with pdtk_canvas_editmode # set ::editmode($::focused_window) $state pdsend "$::focused_window editmode $state" } proc ::pd_menucommands::menu_toggle_editmode {} { menu_editmode [expr {! $::editmode_button}] } # ------------------------------------------------------------------------------ # generic procs for sending menu events # send a message to a pd canvas receiver proc ::pd_menucommands::menu_send {window message} { set mytoplevel [winfo toplevel $window] if {[winfo class $mytoplevel] eq "PatchWindow"} { pdsend "$mytoplevel $message" } elseif {$mytoplevel eq ".pdwindow"} { if {$message eq "copy"} { tk_textCopy .pdwindow.text } elseif {$message eq "selectall"} { .pdwindow.text tag add sel 1.0 end } elseif {$message eq "menusaveas"} { ::pdwindow::save_logbuffer_to_file } } } # send a message to a pd canvas receiver with a float arg proc ::pd_menucommands::menu_send_float {window message float} { set mytoplevel [winfo toplevel $window] if {[winfo class $mytoplevel] eq "PatchWindow"} { pdsend "$mytoplevel $message $float" } } # ------------------------------------------------------------------------------ # open the dialog panels proc ::pd_menucommands::menu_message_dialog {} { ::dialog_message::open_message_dialog $::focused_window } proc ::pd_menucommands::menu_find_dialog {} { ::dialog_find::open_find_dialog $::focused_window } proc ::pd_menucommands::menu_font_dialog {} { if {[winfo exists .font]} { raise .font } elseif {$::focused_window eq ".pdwindow"} { pdtk_canvas_dofont .pdwindow [lindex [.pdwindow.text cget -font] 1] } else { pdsend "$::focused_window menufont" } } proc ::pd_menucommands::menu_path_dialog {} { if {[winfo exists .path]} { raise .path } else { pdsend "pd start-path-dialog" } } proc ::pd_menucommands::menu_startup_dialog {} { if {[winfo exists .startup]} { raise .startup } else { pdsend "pd start-startup-dialog" } } proc ::pd_menucommands::menu_helpbrowser {} { ::helpbrowser::open_helpbrowser } proc ::pd_menucommands::menu_texteditor {} { ::pdwindow::error "the text editor is not implemented" } # ------------------------------------------------------------------------------ # window management functions proc ::pd_menucommands::menu_minimize {window} { wm iconify [winfo toplevel $window] } proc ::pd_menucommands::menu_maximize {window} { wm state [winfo toplevel $window] zoomed } proc ::pd_menucommands::menu_raise_pdwindow {} { if {$::focused_window eq ".pdwindow" && [winfo viewable .pdwindow]} { lower .pdwindow } else { wm deiconify .pdwindow raise .pdwindow } } # used for cycling thru windows of an app proc ::pd_menucommands::menu_raisepreviouswindow {} { lower [lindex [wm stackorder .] end] [lindex [wm stackorder .] 0] focus [lindex [wm stackorder .] end] } # used for cycling thru windows of an app the other direction proc ::pd_menucommands::menu_raisenextwindow {} { set mytoplevel [lindex [wm stackorder .] 0] raise $mytoplevel focus $mytoplevel } # ------------------------------------------------------------------------------ # Pd window functions proc menu_clear_console {} { ::pdwindow::clear_console } # ------------------------------------------------------------------------------ # manage the saving of the directories for the new commands # this gets the dir from the path of a window's title proc ::pd_menucommands::set_filenewdir {mytoplevel} { # TODO add Aqua specifics once g_canvas.c has [wm attributes -titlepath] if {$mytoplevel eq ".pdwindow"} { set ::filenewdir $::fileopendir } else { regexp -- ".+ - (.+)" [wm title $mytoplevel] ignored ::filenewdir } } # parse the textfile for the About Pd page proc ::pd_menucommands::menu_aboutpd {} { set versionstring "Pd $::PD_MAJOR_VERSION.$::PD_MINOR_VERSION.$::PD_BUGFIX_VERSION$::PD_TEST_VERSION" set filename "$::sys_libdir/doc/1.manual/1.introduction.txt" if {[winfo exists .aboutpd]} { wm deiconify .aboutpd raise .aboutpd } else { toplevel .aboutpd -class TextWindow wm title .aboutpd [_ "About Pd"] wm group .aboutpd . .aboutpd configure -menu $::dialog_menubar text .aboutpd.text -relief flat -borderwidth 0 \ -yscrollcommand ".aboutpd.scroll set" -background white scrollbar .aboutpd.scroll -command ".aboutpd.text yview" pack .aboutpd.scroll -side right -fill y pack .aboutpd.text -side left -fill both -expand 1 bind .aboutpd <$::modifier-Key-w> "wm withdraw .aboutpd" set textfile [open $filename] while {![eof $textfile]} { set bigstring [read $textfile 1000] regsub -all PD_BASEDIR $bigstring $::sys_guidir bigstring2 regsub -all PD_VERSION $bigstring2 $versionstring bigstring3 .aboutpd.text insert end $bigstring3 } close $textfile } } # ------------------------------------------------------------------------------ # opening docs as menu items (like the Test Audio and MIDI patch and the manual) proc ::pd_menucommands::menu_doc_open {dir basename} { if {[file pathtype $dir] eq "relative"} { set dirname "$::sys_libdir/$dir" } else { set dirname $dir } set textextension "[string tolower [file extension $basename]]" if {[lsearch -exact [lindex $::filetypes 0 1] $textextension] > -1} { set fullpath [file normalize [file join $dirname $basename]] set dirname [file dirname $fullpath] set basename [file tail $fullpath] pdsend "pd open [enquote_path $basename] [enquote_path $dirname]" } else { ::pd_menucommands::menu_openfile "$dirname/$basename" } } # open HTML docs from the menu using the OS-default HTML viewer proc ::pd_menucommands::menu_openfile {filename} { if {$::tcl_platform(os) eq "Darwin"} { exec sh -c [format "open '%s'" $filename] } elseif {$::tcl_platform(platform) eq "windows"} { exec rundll32 url.dll,FileProtocolHandler [format "%s" $filename] & } else { foreach candidate { gnome-open xdg-open sensible-browser iceweasel firefox \ mozilla galeon konqueror netscape lynx } { set browser [lindex [auto_execok $candidate] 0] if {[string length $browser] != 0} { exec -- sh -c [format "%s '%s'" $browser $filename] & break } } } } # ------------------------------------------------------------------------------ # Mac OS X specific functions proc ::pd_menucommands::menu_bringalltofront {} { # use [winfo children .] here to include windows that are minimized foreach item [winfo children .] { # get all toplevel windows, exclude menubar windows if { [string equal [winfo toplevel $item] $item] && \ [catch {$item cget -tearoff}]} { wm deiconify $item } } wm deiconify . } pd-0.45-4/tcl/pdtk_canvas.tcl0000664000175000017500000003533412224064116014161 0ustar mspmsp package provide pdtk_canvas 0.1 package require pd_bindings namespace eval ::pdtk_canvas:: { namespace export pdtk_canvas_popup namespace export pdtk_canvas_editmode namespace export pdtk_canvas_getscroll namespace export pdtk_canvas_setparents namespace export pdtk_canvas_reflecttitle namespace export pdtk_canvas_menuclose } # One thing that is tricky to understand is the difference between a Tk # 'canvas' and a 'canvas' in terms of Pd's implementation. They are similar, # but not the same thing. In Pd code, a 'canvas' is basically a patch, while # the Tk 'canvas' is the backdrop for drawing everything that is in a patch. # The Tk 'canvas' is contained in a 'toplevel' window. That window has a Tk # class of 'PatchWindow'. # TODO figure out weird frameless window when you open a graph #TODO: http://wiki.tcl.tk/11502 # MS Windows #wm geometry . returns contentswidthxcontentsheight+decorationTop+decorationLeftEdge. #and #winfo rooty . returns contentsTop #winfo rootx . returns contentsLeftEdge # this proc is split out on its own to make it easy to override. This makes it # easy for people to customize these calculations based on their Window # Manager, desires, etc. proc pdtk_canvas_place_window {width height geometry} { set screenwidth [lindex [wm maxsize .] 0] set screenheight [lindex [wm maxsize .] 1] # read back the current geometry +posx+posy into variables scan $geometry {%[+]%d%[+]%d} - x - y # fit the geometry onto screen set x [ expr $x % $screenwidth - $::windowframex] set y [ expr $y % $screenheight - $::windowframey] if {$x < 0} {set x 0} if {$y < 0} {set y 0} if {$width > $screenwidth} { set width $screenwidth set x 0 } if {$height > $screenheight} { set height [expr $screenheight - $::menubarsize - 30] ;# 30 for window framing set y $::menubarsize } return [list $width $height ${width}x$height+$x+$y] } #------------------------------------------------------------------------------# # canvas new/saveas proc pdtk_canvas_new {mytoplevel width height geometry editable} { set l [pdtk_canvas_place_window $width $height $geometry] set width [lindex $l 0] set height [lindex $l 1] set geometry [lindex $l 2] # release the window grab here so that the new window will # properly get the Map and FocusIn events when its created ::pdwindow::busyrelease # set the loaded array for this new window so things can track state set ::loaded($mytoplevel) 0 toplevel $mytoplevel -width $width -height $height -class PatchWindow wm group $mytoplevel . $mytoplevel configure -menu $::patch_menubar # we have to wait until $mytoplevel exists before we can generate # a <> event for it, that's why this is here and not in the # started_loading_file proc. Perhaps this doesn't make sense tho event generate $mytoplevel <> wm geometry $mytoplevel $geometry wm minsize $mytoplevel $::canvas_minwidth $::canvas_minheight set tkcanvas [tkcanvas_name $mytoplevel] canvas $tkcanvas -width $width -height $height \ -highlightthickness 0 -scrollregion [list 0 0 $width $height] \ -xscrollcommand "$mytoplevel.xscroll set" \ -yscrollcommand "$mytoplevel.yscroll set" scrollbar $mytoplevel.xscroll -orient horizontal -command "$tkcanvas xview" scrollbar $mytoplevel.yscroll -orient vertical -command "$tkcanvas yview" pack $tkcanvas -side left -expand 1 -fill both # for some crazy reason, win32 mousewheel scrolling is in units of # 120, and this forces Tk to interpret 120 to mean 1 scroll unit if {$::windowingsystem eq "win32"} { $tkcanvas configure -xscrollincrement 1 -yscrollincrement 1 } ::pd_bindings::patch_bindings $mytoplevel # give focus to the canvas so it gets the events rather than the window focus $tkcanvas # let the scrollbar logic determine if it should make things scrollable set ::xscrollable($tkcanvas) 0 set ::yscrollable($tkcanvas) 0 # init patch properties arrays set ::editingtext($mytoplevel) 0 set ::childwindows($mytoplevel) {} # this should be at the end so that the window and canvas are all ready # before this variable changes. set ::editmode($mytoplevel) $editable } # if the patch canvas window already exists, then make it come to the front proc pdtk_canvas_raise {mytoplevel} { wm deiconify $mytoplevel raise $mytoplevel set mycanvas $mytoplevel.c focus $mycanvas } proc pdtk_canvas_saveas {name initialfile initialdir destroyflag} { if { ! [file isdirectory $initialdir]} {set initialdir $::env(HOME)} set filename [tk_getSaveFile -initialfile $initialfile -initialdir $initialdir \ -defaultextension .pd -filetypes $::filetypes] if {$filename eq ""} return; # they clicked cancel set extension [file extension $filename] set oldfilename $filename set filename [regsub -- "$extension$" $filename [string tolower $extension]] if { ! [regexp -- "\.(pd|pat|mxt)$" $filename]} { # we need the file extention even on Mac OS X set filename $filename.pd } # test again after downcasing and maybe adding a ".pd" on the end if {$filename ne $oldfilename && [file exists $filename]} { set answer [tk_messageBox -type okcancel -icon question -default cancel\ -message [_ "\"$filename\" already exists. Do you want to replace it?"]] if {$answer eq "cancel"} return; # they clicked cancel } set dirname [file dirname $filename] set basename [file tail $filename] pdsend "$name savetofile [enquote_path $basename] [enquote_path $dirname] \ $destroyflag" set ::filenewdir $dirname # add to recentfiles ::pd_guiprefs::update_recentfiles $filename } ##### ask user Save? Discard? Cancel?, and if so, send a message on to Pd ###### proc ::pdtk_canvas::pdtk_canvas_menuclose {mytoplevel reply_to_pd} { raise $mytoplevel set filename [wm title $mytoplevel] set message [format {Do you want to save the changes you made in "%s"?} $filename] set answer [tk_messageBox -message $message -type yesnocancel -default "yes" \ -parent $mytoplevel -icon question] switch -- $answer { yes {pdsend "$mytoplevel menusave 1"} no {pdsend $reply_to_pd} cancel {} } } #------------------------------------------------------------------------------# # mouse usage # TODO put these procs into the pdtk_canvas namespace proc pdtk_canvas_motion {tkcanvas x y mods} { set mytoplevel [winfo toplevel $tkcanvas] pdsend "$mytoplevel motion [$tkcanvas canvasx $x] [$tkcanvas canvasy $y] $mods" } proc pdtk_canvas_mouse {tkcanvas x y b f} { set mytoplevel [winfo toplevel $tkcanvas] pdsend "$mytoplevel mouse [$tkcanvas canvasx $x] [$tkcanvas canvasy $y] $b $f" } proc pdtk_canvas_mouseup {tkcanvas x y b} { set mytoplevel [winfo toplevel $tkcanvas] pdsend "$mytoplevel mouseup [$tkcanvas canvasx $x] [$tkcanvas canvasy $y] $b" } proc pdtk_canvas_rightclick {tkcanvas x y b} { set mytoplevel [winfo toplevel $tkcanvas] pdsend "$mytoplevel mouse [$tkcanvas canvasx $x] [$tkcanvas canvasy $y] $b 8" } # on X11, button 2 pastes from X11 clipboard, so simulate normal paste actions proc pdtk_canvas_clickpaste {tkcanvas x y b} { pdtk_canvas_mouse $tkcanvas $x $y $b 0 pdtk_canvas_mouseup $tkcanvas $x $y $b if { [catch {set pdtk_pastebuffer [selection get]}] } { # no selection... do nothing } else { for {set i 0} {$i < [string length $pdtk_pastebuffer]} {incr i 1} { set cha [string index $pdtk_pastebuffer $i] scan $cha %c keynum pdsend "[winfo toplevel $tkcanvas] key 1 $keynum 0" } } } #------------------------------------------------------------------------------# # canvas popup menu # since there is one popup that is used for all canvas windows, the menu # -commands use {} quotes so that $::focused_window is interpreted when the # menu item is called, not when the command is mapped to the menu item. This # is the same as the menubar in pd_menus.tcl but the opposite of the 'bind' # commands in pd_bindings.tcl proc ::pdtk_canvas::create_popup {} { if { ! [winfo exists .popup]} { # the popup menu for the canvas menu .popup -tearoff false .popup add command -label [_ "Properties"] \ -command {::pdtk_canvas::done_popup $::focused_window 0} .popup add command -label [_ "Open"] \ -command {::pdtk_canvas::done_popup $::focused_window 1} .popup add command -label [_ "Help"] \ -command {::pdtk_canvas::done_popup $::focused_window 2} } } proc ::pdtk_canvas::done_popup {mytoplevel action} { pdsend "$mytoplevel done-popup $action $::popup_xcanvas $::popup_ycanvas" } proc ::pdtk_canvas::pdtk_canvas_popup {mytoplevel xcanvas ycanvas hasproperties hasopen} { set ::popup_xcanvas $xcanvas set ::popup_ycanvas $ycanvas if {$hasproperties} { .popup entryconfigure [_ "Properties"] -state normal } else { .popup entryconfigure [_ "Properties"] -state disabled } if {$hasopen} { .popup entryconfigure [_ "Open"] -state normal } else { .popup entryconfigure [_ "Open"] -state disabled } set tkcanvas [tkcanvas_name $mytoplevel] set scrollregion [$tkcanvas cget -scrollregion] # get the canvas location that is currently the top left corner in the window set left_xview_pix [expr [lindex [$tkcanvas xview] 0] * [lindex $scrollregion 2]] set top_yview_pix [expr [lindex [$tkcanvas yview] 0] * [lindex $scrollregion 3]] # take the mouse clicks in canvas coords, add the root of the canvas # window, and subtract the area that is obscured by scrolling set xpopup [expr int($xcanvas + [winfo rootx $tkcanvas] - $left_xview_pix)] set ypopup [expr int($ycanvas + [winfo rooty $tkcanvas] - $top_yview_pix)] tk_popup .popup $xpopup $ypopup 0 } #------------------------------------------------------------------------------# # procs for when file loading starts/finishes proc ::pdtk_canvas::started_loading_file {patchname} { ::pdwindow::busygrab } # things to run when a patch is finished loading. This is called when # the OS sends the "Map" event for this window. proc ::pdtk_canvas::finished_loading_file {mytoplevel} { # ::pdwindow::busyrelease is in pdtk_canvas_new so that the grab # is released before the new toplevel window gets created. # Otherwise the grab blocks the new window from getting the # FocusIn event on creation. # set editmode to make sure the menu item is in the right state pdtk_canvas_editmode $mytoplevel $::editmode($mytoplevel) set ::loaded($mytoplevel) 1 # send the virtual events now that everything is loaded event generate $mytoplevel <> } #------------------------------------------------------------------------------# # procs for canvas events # check or uncheck the "edit" menu item proc ::pdtk_canvas::pdtk_canvas_editmode {mytoplevel state} { set ::editmode_button $state set ::editmode($mytoplevel) $state event generate $mytoplevel <> } # message from Pd to update the currently available undo/redo action proc pdtk_undomenu {mytoplevel undoaction redoaction} { set ::undo_toplevel $mytoplevel set ::undo_action $undoaction set ::redo_action $redoaction if {$mytoplevel ne "nobody"} { ::pd_menus::update_undo_on_menu $mytoplevel } } # This proc configures the scrollbars whenever anything relevant has # been updated. It should always receive a tkcanvas, which is then # used to generate the mytoplevel, needed to address the scrollbars. proc ::pdtk_canvas::pdtk_canvas_getscroll {tkcanvas} { set mytoplevel [winfo toplevel $tkcanvas] set bbox [$tkcanvas bbox all] if {$bbox eq "" || [llength $bbox] != 4} {return} set xupperleft [lindex $bbox 0] set yupperleft [lindex $bbox 1] if {$xupperleft > 0} {set xupperleft 0} if {$yupperleft > 0} {set yupperleft 0} set scrollregion [concat $xupperleft $yupperleft [lindex $bbox 2] [lindex $bbox 3]] $tkcanvas configure -scrollregion $scrollregion # X scrollbar if {[lindex [$tkcanvas xview] 0] == 0.0 && [lindex [$tkcanvas xview] 1] == 1.0} { set ::xscrollable($tkcanvas) 0 pack forget $mytoplevel.xscroll } else { set ::xscrollable($tkcanvas) 1 pack $mytoplevel.xscroll -side bottom -fill x -before $tkcanvas } # Y scrollbar, it gets touchy at the limit, so say > 0.995 if {[lindex [$tkcanvas yview] 0] == 0.0 && [lindex [$tkcanvas yview] 1] > 0.995} { set ::yscrollable($tkcanvas) 0 pack forget $mytoplevel.yscroll } else { set ::yscrollable($tkcanvas) 1 pack $mytoplevel.yscroll -side right -fill y -before $tkcanvas } } proc ::pdtk_canvas::scroll {tkcanvas axis amount} { if {$axis eq "x" && $::xscrollable($tkcanvas) == 1} { $tkcanvas xview scroll [expr {- ($amount)}] units } if {$axis eq "y" && $::yscrollable($tkcanvas) == 1} { $tkcanvas yview scroll [expr {- ($amount)}] units } } #------------------------------------------------------------------------------# # get patch window child/parent relationships # add a child window ID to the list of children, if it isn't already there proc ::pdtk_canvas::addchild {mytoplevel child} { # if either ::childwindows($mytoplevel) does not exist, or $child does not # exist inside of the ::childwindows($mytoplevel list if { [lsearch -exact [array names ::childwindows $mytoplevel]] == -1 \ || [lsearch -exact $::childwindows($mytoplevel) $child] == -1} { set ::childwindows($mytoplevel) [lappend ::childwindows($mytoplevel) $child] } } # receive a list of all my parent windows from 'pd' proc ::pdtk_canvas::pdtk_canvas_setparents {mytoplevel args} { set ::parentwindows($mytoplevel) $args foreach parent $args { addchild $parent $mytoplevel } } # receive information for setting the info the the title bar of the window proc ::pdtk_canvas::pdtk_canvas_reflecttitle {mytoplevel \ path name arguments dirty} { set ::windowname($mytoplevel) $name ;# TODO add path to this if {$::windowingsystem eq "aqua"} { wm attributes $mytoplevel -modified $dirty if {[file exists "$path/$name"]} { # for some reason -titlepath can still fail so just catch it if [catch {wm attributes $mytoplevel -titlepath "$path/$name"}] { wm title $mytoplevel "$path/$name" } } wm title $mytoplevel "$name$arguments" } else { if {$dirty} {set dirtychar "*"} else {set dirtychar " "} wm title $mytoplevel "$name$dirtychar$arguments - $path" } } pd-0.45-4/tcl/dialog_gatom.tcl0000664000175000017500000001537512222201037014306 0ustar mspmsp package provide dialog_gatom 0.1 package require wheredoesthisgo namespace eval ::dialog_gatom:: { namespace export pdtk_gatom_dialog } # array for communicating the position of the radiobuttons (Tk's # radiobutton widget requires this to be global) array set gatomlabel_radio {} ############ pdtk_gatom_dialog -- run a gatom dialog ######### proc ::dialog_gatom::escape {sym} { if {[string length $sym] == 0} { set ret "-" } else { if {[string equal -length 1 $sym "-"]} { set ret [string replace $sym 0 0 "--"] } else { set ret [string map {"$" "#"} $sym] } } return [unspace_text $ret] } proc ::dialog_gatom::unescape {sym} { if {[string equal -length 1 $sym "-"]} { set ret [string replace $sym 0 0 ""] } else { set ret [string map {"#" "$"} $sym] } return $ret } proc ::dialog_gatom::apply {mytoplevel} { global gatomlabel_radio pdsend "$mytoplevel param \ [$mytoplevel.width.entry get] \ [$mytoplevel.limits.lower.entry get] \ [$mytoplevel.limits.upper.entry get] \ [::dialog_gatom::escape [$mytoplevel.gatomlabel.name.entry get]] \ $gatomlabel_radio($mytoplevel) \ [::dialog_gatom::escape [$mytoplevel.s_r.receive.entry get]] \ [::dialog_gatom::escape [$mytoplevel.s_r.send.entry get]]" } proc ::dialog_gatom::cancel {mytoplevel} { pdsend "$mytoplevel cancel" } proc ::dialog_gatom::ok {mytoplevel} { ::dialog_gatom::apply $mytoplevel ::dialog_gatom::cancel $mytoplevel } # set up the panel with the info from pd proc ::dialog_gatom::pdtk_gatom_dialog {mytoplevel initwidth initlower initupper \ initgatomlabel_radio \ initgatomlabel initreceive initsend} { global gatomlabel_radio set gatomlabel_radio($mytoplevel) $initgatomlabel_radio if {[winfo exists $mytoplevel]} { wm deiconify $mytoplevel raise $mytoplevel } else { create_dialog $mytoplevel } $mytoplevel.width.entry insert 0 $initwidth $mytoplevel.limits.lower.entry insert 0 $initlower $mytoplevel.limits.upper.entry insert 0 $initupper if {$initgatomlabel ne "-"} { $mytoplevel.gatomlabel.name.entry insert 0 \ [::dialog_gatom::unescape $initgatomlabel] } set gatomlabel_radio($mytoplevel) $initgatomlabel_radio if {$initsend ne "-"} { $mytoplevel.s_r.send.entry insert 0 \ [::dialog_gatom::unescape $initsend] } if {$initreceive ne "-"} { $mytoplevel.s_r.receive.entry insert 0 \ [::dialog_gatom::unescape $initreceive] } } proc ::dialog_gatom::create_dialog {mytoplevel} { global gatomlabel_radio toplevel $mytoplevel -class DialogWindow wm title $mytoplevel [_ "Atom Box Properties"] wm group $mytoplevel . wm resizable $mytoplevel 0 0 wm transient $mytoplevel $::focused_window $mytoplevel configure -menu $::dialog_menubar $mytoplevel configure -padx 0 -pady 0 ::pd_bindings::dialog_bindings $mytoplevel "gatom" frame $mytoplevel.width -height 7 pack $mytoplevel.width -side top label $mytoplevel.width.label -text [_ "Width:"] entry $mytoplevel.width.entry -width 4 pack $mytoplevel.width.label $mytoplevel.width.entry -side left labelframe $mytoplevel.limits -text [_ "Limits"] -padx 15 -pady 4 -borderwidth 1 pack $mytoplevel.limits -side top -fill x frame $mytoplevel.limits.lower pack $mytoplevel.limits.lower -side left label $mytoplevel.limits.lower.label -text [_ "Lower:"] entry $mytoplevel.limits.lower.entry -width 7 pack $mytoplevel.limits.lower.label $mytoplevel.limits.lower.entry -side left frame $mytoplevel.limits.upper pack $mytoplevel.limits.upper -side left label $mytoplevel.limits.upper.label -text [_ "Upper:"] entry $mytoplevel.limits.upper.entry -width 7 pack $mytoplevel.limits.upper.label $mytoplevel.limits.upper.entry -side left labelframe $mytoplevel.gatomlabel -text [_ "Label"] -padx 5 -pady 5 -borderwidth 1 pack $mytoplevel.gatomlabel -side top -fill x -pady 5 frame $mytoplevel.gatomlabel.name pack $mytoplevel.gatomlabel.name -side top entry $mytoplevel.gatomlabel.name.entry -width 33 pack $mytoplevel.gatomlabel.name.entry -side left frame $mytoplevel.gatomlabel.radio pack $mytoplevel.gatomlabel.radio -side top radiobutton $mytoplevel.gatomlabel.radio.left -value 0 -text [_ "Left "] \ -variable gatomlabel_radio($mytoplevel) -justify left -takefocus 0 radiobutton $mytoplevel.gatomlabel.radio.right -value 1 -text [_ "Right"] \ -variable gatomlabel_radio($mytoplevel) -justify left -takefocus 0 radiobutton $mytoplevel.gatomlabel.radio.top -value 2 -text [_ "Top"] \ -variable gatomlabel_radio($mytoplevel) -justify left -takefocus 0 radiobutton $mytoplevel.gatomlabel.radio.bottom -value 3 -text [_ "Bottom"] \ -variable gatomlabel_radio($mytoplevel) -justify left -takefocus 0 pack $mytoplevel.gatomlabel.radio.left -side left -anchor w pack $mytoplevel.gatomlabel.radio.right -side right -anchor w pack $mytoplevel.gatomlabel.radio.top -side top -anchor w pack $mytoplevel.gatomlabel.radio.bottom -side bottom -anchor w labelframe $mytoplevel.s_r -text [_ "Messages"] -padx 5 -pady 5 -borderwidth 1 pack $mytoplevel.s_r -side top -fill x frame $mytoplevel.s_r.send pack $mytoplevel.s_r.send -side top -anchor e label $mytoplevel.s_r.send.label -text [_ "Send symbol:"] entry $mytoplevel.s_r.send.entry -width 21 pack $mytoplevel.s_r.send.entry $mytoplevel.s_r.send.label -side right frame $mytoplevel.s_r.receive pack $mytoplevel.s_r.receive -side top -anchor e label $mytoplevel.s_r.receive.label -text [_ "Receive symbol:"] entry $mytoplevel.s_r.receive.entry -width 21 pack $mytoplevel.s_r.receive.entry $mytoplevel.s_r.receive.label -side right frame $mytoplevel.buttonframe -pady 5 pack $mytoplevel.buttonframe -side top -fill x -expand 1 -pady 2m button $mytoplevel.buttonframe.cancel -text [_ "Cancel"] \ -command "::dialog_gatom::cancel $mytoplevel" pack $mytoplevel.buttonframe.cancel -side left -expand 1 -fill x -padx 10 if {$::windowingsystem ne "aqua"} { button $mytoplevel.buttonframe.apply -text [_ "Apply"] \ -command "::dialog_gatom::apply $mytoplevel" pack $mytoplevel.buttonframe.apply -side left -expand 1 -fill x -padx 10 } button $mytoplevel.buttonframe.ok -text [_ "OK"] \ -command "::dialog_gatom::ok $mytoplevel" pack $mytoplevel.buttonframe.ok -side left -expand 1 -fill x -padx 10 $mytoplevel.width.entry select from 0 $mytoplevel.width.entry select adjust end focus $mytoplevel.width.entry } pd-0.45-4/tcl/scrollbox.tcl0000664000175000017500000001563212160204055013667 0ustar mspmsp######### scrollbox -- utility scrollbar with default bindings ####### # scrollbox is used in the Path and Startup dialogs to edit lists of options package provide scrollbox 0.1 namespace eval scrollbox { # This variable keeps track of the last list element we clicked on, # used to implement drag-drop reordering of list items variable lastIdx 0 } proc ::scrollbox::get_curidx { mytoplevel } { set idx [$mytoplevel.listbox.box index active] if {$idx < 0 || \ $idx == [$mytoplevel.listbox.box index end]} { return [expr {[$mytoplevel.listbox.box index end] + 1}] } return [expr $idx] } proc ::scrollbox::insert_item { mytoplevel idx name } { if {$name != ""} { $mytoplevel.listbox.box insert $idx $name set activeIdx [expr {[$mytoplevel.listbox.box index active] + 1}] $mytoplevel.listbox.box see $activeIdx $mytoplevel.listbox.box activate $activeIdx $mytoplevel.listbox.box selection clear 0 end $mytoplevel.listbox.box selection set active focus $mytoplevel.listbox.box } } proc ::scrollbox::add_item { mytoplevel add_method } { set dir [$add_method] insert_item $mytoplevel [expr {[get_curidx $mytoplevel] + 1}] $dir } proc ::scrollbox::edit_item { mytoplevel edit_method } { set idx [expr {[get_curidx $mytoplevel]}] set initialValue [$mytoplevel.listbox.box get $idx] if {$initialValue != ""} { set dir [$edit_method $initialValue] if {$dir != ""} { $mytoplevel.listbox.box delete $idx insert_item $mytoplevel $idx $dir } $mytoplevel.listbox.box activate $idx $mytoplevel.listbox.box selection clear 0 end $mytoplevel.listbox.box selection set active focus $mytoplevel.listbox.box } } proc ::scrollbox::delete_item { mytoplevel } { set cursel [$mytoplevel.listbox.box curselection] foreach idx $cursel { $mytoplevel.listbox.box delete $idx } } # Double-clicking on the listbox should edit the current item, # or add a new one if there is no current proc ::scrollbox::dbl_click { mytoplevel edit_method add_method x y } { if { $x == "" || $y == "" } { return } set curBB [$mytoplevel.listbox.box bbox @$x,$y] # listbox bbox returns an array of 4 items in the order: # left, top, width, height set height [lindex $curBB 3] set top [lindex $curBB 1] if { $height == "" || $top == "" } { # If for some reason we didn't get valid bbox info, # we want to default to adding a new item set height 0 set top 0 set y 1 } set bottom [expr {$height + $top}] if {$y > $bottom} { add_item $mytoplevel $add_method } else { edit_item $mytoplevel $edit_method } } proc ::scrollbox::click { mytoplevel x y } { # record the index of the current element being # clicked on variable ::lastIdx [$mytoplevel.listbox.box index @$x,$y] focus $mytoplevel.listbox.box } # For drag-and-drop reordering, recall the last-clicked index # and move it to the position of the item currently under the mouse proc ::scrollbox::release { mytoplevel x y } { variable lastIdx set curIdx [$mytoplevel.listbox.box index @$x,$y] if { $curIdx != $::lastIdx } { # clear any current selection $mytoplevel.listbox.box selection clear 0 end set oldIdx $::lastIdx set newIdx [expr {$curIdx+1}] set selIdx $curIdx if { $curIdx < $::lastIdx } { set oldIdx [expr {$::lastIdx + 1}] set newIdx $curIdx set selIdx $newIdx } $mytoplevel.listbox.box insert $newIdx [$mytoplevel.listbox.box get $::lastIdx] $mytoplevel.listbox.box delete $oldIdx $mytoplevel.listbox.box activate $newIdx $mytoplevel.listbox.box selection set $selIdx } } # Make a scrollbox widget in a given window and set of data. # # id - the parent window for the scrollbox # listdata - array of data to populate the scrollbox # add_method - method to be called when we add a new item # edit_method - method to be called when we edit an existing item proc ::scrollbox::make { mytoplevel listdata add_method edit_method } { frame $mytoplevel.listbox listbox $mytoplevel.listbox.box \ -selectmode browse -activestyle dotbox \ -yscrollcommand [list "$mytoplevel.listbox.scrollbar" set] # Create a scrollbar and keep it in sync with the current # listbox view pack $mytoplevel.listbox.box [scrollbar "$mytoplevel.listbox.scrollbar" \ -command [list $mytoplevel.listbox.box yview]] \ -side left -fill y -anchor w # Populate the listbox widget foreach item $listdata { $mytoplevel.listbox.box insert end $item } # Standard listbox key/mouse bindings event add <> if { $::windowingsystem eq "aqua" } { event add <> } bind $mytoplevel.listbox.box "::scrollbox::click $mytoplevel %x %y" bind $mytoplevel.listbox.box "::scrollbox::dbl_click $mytoplevel $edit_method $add_method %x %y" bind $mytoplevel.listbox.box "::scrollbox::release $mytoplevel %x %y" bind $mytoplevel.listbox.box "::scrollbox::edit_item $mytoplevel $edit_method" bind $mytoplevel.listbox.box <> "::scrollbox::delete_item $mytoplevel" # is called when the user modifies the window # We use it to capture resize events, to make sure the # currently selected item in the listbox is always visible bind $mytoplevel "$mytoplevel.listbox.box see active" # The listbox should expand to fill its containing window # the "-fill" option specifies which direction (x, y or both) to fill, while # the "-expand" option (false by default) specifies whether the widget # should fill pack $mytoplevel.listbox.box -side left -fill both -expand 1 pack $mytoplevel.listbox -side top -pady 2m -padx 2m -fill both -expand 1 # All widget interactions can be performed without buttons, but # we still need a "New..." button since the currently visible window # might be full (even though the user can still expand it) frame $mytoplevel.actions pack $mytoplevel.actions -side top -padx 2m -fill x button $mytoplevel.actions.add_path -text {New...} \ -command "::scrollbox::add_item $mytoplevel $add_method" button $mytoplevel.actions.edit_path -text {Edit...} \ -command "::scrollbox::edit_item $mytoplevel $edit_method" button $mytoplevel.actions.delete_path -text {Delete} \ -command "::scrollbox::delete_item $mytoplevel" pack $mytoplevel.actions.delete_path -side right -pady 2m pack $mytoplevel.actions.edit_path -side right -pady 2m pack $mytoplevel.actions.add_path -side right -pady 2m $mytoplevel.listbox.box activate end $mytoplevel.listbox.box selection set end focus $mytoplevel.listbox.box } pd-0.45-4/tcl/dialog_font.tcl0000664000175000017500000001173512160204055014145 0ustar mspmsp package provide dialog_font 0.1 namespace eval ::dialog_font:: { variable fontsize 10 variable stretchval 100 variable whichstretch 1 variable canvaswindow variable sizes {8 10 12 16 24 36} namespace export pdtk_canvas_dofont } # TODO this should use the pd_font_$size fonts created in pd-gui.tcl # TODO change pdtk_canvas_dofont to pdtk_font_dialog here and g_editor.c # TODO this should really be changed on the C side so that it doesn't have to # work around gfxstub/x_gui.c. The gfxstub stuff assumes that there are # multiple panels, for properties panels like this, its much easier to use if # there is a single properties panel that adjusts based on which PatchWindow # has focus proc ::dialog_font::apply {mytoplevel myfontsize} { if {$mytoplevel eq ".pdwindow"} { .pdwindow.text configure -font "-size $myfontsize" } else { variable stretchval variable whichstretch pdsend "$mytoplevel font $myfontsize $stretchval $whichstretch" } } proc ::dialog_font::cancel {gfxstub} { if {$gfxstub ne ".pdwindow"} { pdsend "$gfxstub cancel" } destroy .font } proc ::dialog_font::ok {gfxstub} { variable fontsize apply $gfxstub $fontsize cancel $gfxstub } proc ::dialog_font::update_font_dialog {mytoplevel} { variable canvaswindow $mytoplevel if {[winfo exists .font]} { wm title .font [format [_ "%s Font"] [lookup_windowname $mytoplevel]] } } proc ::dialog_font::arrow_fontchange {change} { variable sizes variable fontsize variable canvaswindow set position [expr [lsearch $sizes $fontsize] + $change] if {$position < 0} {set position 0} set max [llength $sizes] if {$position >= $max} {set position [expr $max-1]} set fontsize [lindex $sizes $position] ::dialog_font::apply $canvaswindow $fontsize } # this should be called pdtk_font_dialog like the rest of the panels, but it # is called from the C side, so we'll leave it be proc ::dialog_font::pdtk_canvas_dofont {gfxstub initsize} { variable fontsize $initsize variable whichstretch 1 variable stretchval 100 if {[winfo exists .font]} { wm deiconify .font raise .font # the gfxstub stuff expects multiple font windows, we only have one, # so kill the new gfxstub requests as the come in. We'll save the # original gfxstub for when the font panel gets closed pdsend "$gfxstub cancel" } else { create_dialog $gfxstub } } proc ::dialog_font::create_dialog {gfxstub} { toplevel .font -class DialogWindow .font configure -menu $::dialog_menubar .font configure -padx 10 -pady 5 wm group .font . wm resizable .font 0 0 wm transient .font $::focused_window ::pd_bindings::dialog_bindings .font "font" # replace standard bindings to work around the gfxstub stuff and use # break to prevent the close window command from going to other bindings. # .font won't exist anymore, so it'll cause errors down the line... bind .font "::dialog_font::ok $gfxstub; break" bind .font "::dialog_font::cancel $gfxstub; break" bind .font <$::modifier-Key-w> "::dialog_font::cancel $gfxstub; break" wm protocol .font WM_DELETE_WINDOW "dialog_font::cancel $gfxstub" bind .font "::dialog_font::arrow_fontchange -1" bind .font "::dialog_font::arrow_fontchange 1" frame .font.buttonframe pack .font.buttonframe -side bottom -fill x -pady 2m button .font.buttonframe.ok -text [_ "OK"] \ -command "::dialog_font::ok $gfxstub" pack .font.buttonframe.ok -side left -expand 1 labelframe .font.fontsize -text [_ "Font Size"] -padx 5 -pady 4 -borderwidth 1 \ -width [::msgcat::mcmax "Font Size"] -labelanchor n pack .font.fontsize -side left -padx 5 # this is whacky Tcl at its finest, but I couldn't resist... foreach size $::dialog_font::sizes { radiobutton .font.fontsize.radio$size -value $size -text $size \ -variable ::dialog_font::fontsize \ -command [format {::dialog_font::apply $::dialog_font::canvaswindow %s} $size] pack .font.fontsize.radio$size -side top -anchor w } labelframe .font.stretch -text [_ "Stretch"] -padx 5 -pady 5 -borderwidth 1 \ -width [::msgcat::mcmax "Stretch"] -labelanchor n pack .font.stretch -side left -padx 5 -fill y entry .font.stretch.entry -textvariable ::dialog_font::stretchval -width 5 pack .font.stretch.entry -side top -pady 5 radiobutton .font.stretch.radio1 -text [_ "X and Y"] \ -value 1 -variable ::dialog_font::whichstretch radiobutton .font.stretch.radio2 -text [_ "X only"] \ -value 2 -variable ::dialog_font::whichstretch radiobutton .font.stretch.radio3 -text [_ "Y only"] \ -value 3 -variable ::dialog_font::whichstretch pack .font.stretch.radio1 -side top -anchor w pack .font.stretch.radio2 -side top -anchor w pack .font.stretch.radio3 -side top -anchor w } pd-0.45-4/tcl/scrollboxwindow.tcl0000664000175000017500000000650212160204055015113 0ustar mspmsp ####### scrollboxwindow -- scrollbox window with default bindings ######### ## This is the base dialog behind the Path and Startup dialogs ## This namespace specifies everything the two dialogs have in common, ## with arguments specifying the differences ## ## By default, this creates a dialog centered on the viewing area of the screen ## with cancel, apply, and OK buttons ## which contains a scrollbox widget populated with the given data package provide scrollboxwindow 0.1 package require scrollbox namespace eval scrollboxwindow { } proc ::scrollboxwindow::get_listdata {mytoplevel} { return [$mytoplevel.listbox.box get 0 end] } proc ::scrollboxwindow::do_apply {mytoplevel commit_method listdata} { $commit_method [pdtk_encode $listdata] pdsend "pd save-preferences" } # Cancel button action proc ::scrollboxwindow::cancel {mytoplevel} { pdsend "$mytoplevel cancel" } # Apply button action proc ::scrollboxwindow::apply {mytoplevel commit_method } { do_apply $mytoplevel $commit_method [get_listdata $mytoplevel] } # OK button action # The "commit" action can take a second or more, # long enough to be noticeable, so we only write # the changes after closing the dialog proc ::scrollboxwindow::ok {mytoplevel commit_method } { set listdata [get_listdata $mytoplevel] cancel $mytoplevel do_apply $mytoplevel $commit_method $listdata } # "Constructor" function for building the window # id -- the window id to use # listdata -- the data used to populate the scrollbox # add_method -- a reference to a proc to be called when the user adds a new item # edit_method -- same as above, for editing and existing item # commit_method -- same as above, to commit during the "apply" action # title -- top-level title for the dialog # width, height -- initial width and height dimensions for the window, also minimum size proc ::scrollboxwindow::make {mytoplevel listdata add_method edit_method commit_method title width height } { wm deiconify .pdwindow raise .pdwindow toplevel $mytoplevel -class DialogWindow wm title $mytoplevel $title wm group $mytoplevel . wm transient $mytoplevel .pdwindow wm protocol $mytoplevel WM_DELETE_WINDOW "::scrollboxwindow::cancel $mytoplevel" # Enforce a minimum size for the window wm minsize $mytoplevel $width $height # Set the current dimensions of the window wm geometry $mytoplevel "${width}x${height}" # Add the scrollbox widget ::scrollbox::make $mytoplevel $listdata $add_method $edit_method # Use two frames for the buttons, since we want them both # bottom and right frame $mytoplevel.nb pack $mytoplevel.nb -side bottom -fill x -pady 2m frame $mytoplevel.nb.buttonframe pack $mytoplevel.nb.buttonframe -side right -padx 2m button $mytoplevel.nb.buttonframe.cancel -text [_ "Cancel"]\ -command "::scrollboxwindow::cancel $mytoplevel" button $mytoplevel.nb.buttonframe.apply -text [_ "Apply"]\ -command "::scrollboxwindow::apply $mytoplevel $commit_method" button $mytoplevel.nb.buttonframe.ok -text [_ "OK"]\ -command "::scrollboxwindow::ok $mytoplevel $commit_method" pack $mytoplevel.nb.buttonframe.cancel -side left -expand 1 -padx 2m pack $mytoplevel.nb.buttonframe.apply -side left -expand 1 -padx 2m pack $mytoplevel.nb.buttonframe.ok -side left -expand 1 -padx 2m } pd-0.45-4/tcl/apple_events.tcl0000664000175000017500000000310512160204055014335 0ustar mspmsp package provide apple_events 0.1 package require pdwindow package require wheredoesthisgo # from http://wiki.tcl.tk/12987 set ::tk::mac::CGAntialiasLimit 0 ;# min line thickness to anti-alias (default: 3) set ::tk::mac::antialiasedtext 1 ;# enable anti-aliased text # kAEOpenDocuments proc ::tk::mac::OpenDocument {args} { foreach filename $args { if {$::done_init} { open_file $filename } else { lappend ::filestoopen_list $filename } } set ::pd_menucommands::menu_open_dir [file dirname $filename] } # kEventAppHidden proc ::tk::mac::OnHide {args} { ::pdwindow::verbose 1 "::tk::mac::OnHide $args +++++++++++++++++++++" } # kEventAppShown proc ::tk::mac::OnShow {args} { ::pdwindow::verbose 1 "::tk::mac::OnShow $args +++++++++++++++++++++" } # open About Pd... in Tk/Cocoa proc tkAboutDialog {} { menu_aboutpd } # kAEShowPreferences proc ::tk::mac::ShowPreferences {args} { ::pdwindow::verbose 1 "::tk::mac::ShowPreferences $args ++++++++++++" pdsend "pd start-path-dialog" } # kAEQuitApplication proc ::tk::mac::Quit {args} { pdsend "pd verifyquit" } # on Tk/Cocoa, override the Apple Help menu #proc tk::mac::ShowHelp {args} { #} # these I gleaned by reading the source (tkMacOSXHLEvents.c) proc ::tk::mac::PrintDocument {args} { menu_print $::focused_window } proc ::tk::mac::OpenApplication {args} { ::pdwindow::verbose 1 "::tk::mac::OpenApplication $args ++++++++++++" } proc ::tk::mac::ReopenApplication {args} { ::pdwindow::verbose 1 "::tk::mac::ReopenApplication $args ++++++++++" } pd-0.45-4/tcl/dialog_array.tcl0000664000175000017500000003215712222367057014331 0ustar mspmsppackage provide dialog_array 0.1 namespace eval ::dialog_array:: { namespace export pdtk_array_dialog namespace export pdtk_array_listview_new namespace export pdtk_array_listview_fillpage namespace export pdtk_array_listview_setpage namespace export pdtk_array_listview_closeWindow } # global variables for the listview array set pd_array_listview_entry {} array set pd_array_listview_id {} array set pd_array_listview_page {} set pd_array_listview_pagesize 0 # this stores the state of the "save me" check button array set saveme_button {} # this stores the state of the "draw as" radio buttons array set drawas_button {} # this stores the state of the "in new graph"/"in last graph" radio buttons # and the "delete array" checkbutton array set otherflag_button {} ############ pdtk_array_dialog -- dialog window for arrays ######### proc ::dialog_array::pdtk_array_listview_setpage {arrayName page} { set ::pd_array_listview_page($arrayName) $page } proc ::dialog_array::listview_changepage {arrayName np} { pdtk_array_listview_setpage \ $arrayName [expr $::pd_array_listview_page($arrayName) + $np] pdtk_array_listview_fillpage $arrayName } proc ::dialog_array::pdtk_array_listview_fillpage {arrayName} { set windowName [format ".%sArrayWindow" $arrayName] set topItem [expr [lindex [$windowName.lb yview] 0] * \ [$windowName.lb size]] if {[winfo exists $windowName]} { set cmd "$::pd_array_listview_id($arrayName) \ arrayviewlistfillpage \ $::pd_array_listview_page($arrayName) \ $topItem" pdsend $cmd } } proc ::dialog_array::pdtk_array_listview_new {id arrayName page} { set ::pd_array_listview_page($arrayName) $page set ::pd_array_listview_id($arrayName) $id set windowName [format ".%sArrayWindow" $arrayName] if [winfo exists $windowName] then [destroy $windowName] toplevel $windowName -class DialogWindow wm group $windowName . wm protocol $windowName WM_DELETE_WINDOW \ "::dialog_array::listview_close $id $arrayName" wm title $windowName [concat $arrayName "(list view)"] # FIXME set font 12 set $windowName.lb [listbox $windowName.lb -height 20 -width 25\ -selectmode extended \ -relief solid -background white -borderwidth 1 \ -font [format {{%s} %d %s} $::font_family $font $::font_weight]\ -yscrollcommand "$windowName.lb.sb set"] set $windowName.lb.sb [scrollbar $windowName.lb.sb \ -command "$windowName.lb yview" -orient vertical] place configure $windowName.lb.sb -relheight 1 -relx 0.9 -relwidth 0.1 pack $windowName.lb -expand 1 -fill both bind $windowName.lb \ "::dialog_array::listview_edit $arrayName $page $font" # handle copy/paste switch -- $::windowingsystem { "x11" {selection handle $windowName.lb \ "::dialog_array::listview_lbselection $arrayName"} "win32" {bind $windowName.lb \ "::dialog_array::listview_popup $arrayName"} } set $windowName.prevBtn [button $windowName.prevBtn -text "<-" \ -command "::dialog_array::listview_changepage $arrayName -1"] set $windowName.nextBtn [button $windowName.nextBtn -text "->" \ -command "::dialog_array::listview_changepage $arrayName 1"] pack $windowName.prevBtn -side left -ipadx 20 -pady 10 -anchor s pack $windowName.nextBtn -side right -ipadx 20 -pady 10 -anchor s focus $windowName } proc ::dialog_array::listview_lbselection {arrayName off size} { set windowName [format ".%sArrayWindow" $arrayName] set itemNums [$windowName.lb curselection] set cbString "" for {set i 0} {$i < [expr [llength $itemNums] - 1]} {incr i} { set listItem [$windowName.lb get [lindex $itemNums $i]] append cbString [string range $listItem \ [expr [string first ") " $listItem] + 2] \ end] append cbString "\n" } set listItem [$windowName.lb get [lindex $itemNums $i]] append cbString [string range $listItem \ [expr [string first ") " $listItem] + 2] \ end] set last $cbString } # Win32 uses a popup menu for copy/paste proc ::dialog_array::listview_popup {arrayName} { set windowName [format ".%sArrayWindow" $arrayName] if [winfo exists $windowName.popup] then [destroy $windowName.popup] menu $windowName.popup -tearoff false $windowName.popup add command -label [_ "Copy"] \ -command "::dialog_array::listview_copy $arrayName; \ destroy $windowName.popup" $windowName.popup add command -label [_ "Paste"] \ -command "::dialog_array::listview_paste $arrayName; \ destroy $windowName.popup" tk_popup $windowName.popup [winfo pointerx $windowName] \ [winfo pointery $windowName] 0 } proc ::dialog_array::listview_copy {arrayName} { set windowName [format ".%sArrayWindow" $arrayName] set itemNums [$windowName.lb curselection] set cbString "" for {set i 0} {$i < [expr [llength $itemNums] - 1]} {incr i} { set listItem [$windowName.lb get [lindex $itemNums $i]] append cbString [string range $listItem \ [expr [string first ") " $listItem] + 2] \ end] append cbString "\n" } set listItem [$windowName.lb get [lindex $itemNums $i]] append cbString [string range $listItem \ [expr [string first ") " $listItem] + 2] \ end] clipboard clear clipboard append $cbString } proc ::dialog_array::listview_paste {arrayName} { set cbString [selection get -selection CLIPBOARD] set lbName [format ".%sArrayWindow.lb" $arrayName] set itemNum [lindex [$lbName curselection] 0] set splitChars ", \n" set itemString [split $cbString $splitChars] set flag 1 for {set i 0; set counter 0} {$i < [llength $itemString]} {incr i} { if {[lindex $itemString $i] ne {}} { pdsend "$arrayName [expr $itemNum + \ [expr $counter + \ [expr $::pd_array_listview_pagesize \ * $::pd_array_listview_page($arrayName)]]] \ [lindex $itemString $i]" incr counter set flag 0 } } } proc ::dialog_array::listview_edit {arrayName page font} { set lbName [format ".%sArrayWindow.lb" $arrayName] if {[winfo exists $lbName.entry]} { ::dialog_array::listview_update_entry \ $arrayName $::pd_array_listview_entry($arrayName) unset ::pd_array_listview_entry($arrayName) } set itemNum [$lbName index active] set ::pd_array_listview_entry($arrayName) $itemNum set bbox [$lbName bbox $itemNum] set y [expr [lindex $bbox 1] - 4] set $lbName.entry [entry $lbName.entry \ -font [format {{%s} %d %s} $::font_family $font $::font_weight]] $lbName.entry insert 0 [] place configure $lbName.entry -relx 0 -y $y -relwidth 1 lower $lbName.entry focus $lbName.entry bind $lbName.entry \ "::dialog_array::listview_update_entry $arrayName $itemNum;" } proc ::dialog_array::listview_update_entry {arrayName itemNum} { set lbName [format ".%sArrayWindow.lb" $arrayName] set splitChars ", \n" set itemString [split [$lbName.entry get] $splitChars] set flag 1 for {set i 0; set counter 0} {$i < [llength $itemString]} {incr i} { if {[lindex $itemString $i] ne {}} { pdsend "$arrayName [expr $itemNum + \ [expr $counter + \ [expr $::pd_array_listview_pagesize \ * $::pd_array_listview_page($arrayName)]]] \ [lindex $itemString $i]" incr counter set flag 0 } } pdtk_array_listview_fillpage $arrayName destroy $lbName.entry } proc ::dialog_array::pdtk_array_listview_closeWindow {arrayName} { set mytoplevel [format ".%sArrayWindow" $arrayName] destroy $mytoplevel } proc ::dialog_array::listview_close {mytoplevel arrayName} { pdtk_array_listview_closeWindow $arrayName pdsend "$mytoplevel arrayviewclose" } proc ::dialog_array::apply {mytoplevel} { pdsend "$mytoplevel arraydialog \ [::dialog_gatom::escape [$mytoplevel.name.entry get]] \ [$mytoplevel.size.entry get] \ [expr $::saveme_button($mytoplevel) + (2 * $::drawas_button($mytoplevel))] \ $::otherflag_button($mytoplevel)" } proc ::dialog_array::openlistview {mytoplevel} { pdsend "$mytoplevel arrayviewlistnew" } proc ::dialog_array::cancel {mytoplevel} { pdsend "$mytoplevel cancel" } proc ::dialog_array::ok {mytoplevel} { ::dialog_array::apply $mytoplevel ::dialog_array::cancel $mytoplevel } proc ::dialog_array::pdtk_array_dialog {mytoplevel name size flags newone} { if {[winfo exists $mytoplevel]} { wm deiconify $mytoplevel raise $mytoplevel } else { create_dialog $mytoplevel $newone } $mytoplevel.name.entry insert 0 [::dialog_gatom::unescape $name] $mytoplevel.size.entry insert 0 $size set ::saveme_button($mytoplevel) [expr $flags & 1] set ::drawas_button($mytoplevel) [expr ( $flags & 6 ) >> 1] set ::otherflag_button($mytoplevel) 0 # pd -> tcl # 2 * (int)(template_getfloat(template_findbyname(sc->sc_template), gensym("style"), x->x_scalar->sc_vec, 1))); # tcl->pd # int style = ((flags & 6) >> 1); } proc ::dialog_array::create_dialog {mytoplevel newone} { toplevel $mytoplevel -class DialogWindow wm title $mytoplevel [_ "Array Properties"] wm group $mytoplevel . wm resizable $mytoplevel 0 0 wm transient $mytoplevel $::focused_window $mytoplevel configure -menu $::dialog_menubar $mytoplevel configure -padx 0 -pady 0 ::pd_bindings::dialog_bindings $mytoplevel "array" frame $mytoplevel.name pack $mytoplevel.name -side top label $mytoplevel.name.label -text [_ "Name:"] entry $mytoplevel.name.entry pack $mytoplevel.name.label $mytoplevel.name.entry -anchor w frame $mytoplevel.size pack $mytoplevel.size -side top label $mytoplevel.size.label -text [_ "Size:"] entry $mytoplevel.size.entry pack $mytoplevel.size.label $mytoplevel.size.entry -anchor w checkbutton $mytoplevel.saveme -text [_ "Save contents"] \ -variable ::saveme_button($mytoplevel) -anchor w pack $mytoplevel.saveme -side top labelframe $mytoplevel.drawas -text [_ "Draw as:"] -padx 20 -borderwidth 1 pack $mytoplevel.drawas -side top -fill x radiobutton $mytoplevel.drawas.points -value 0 \ -variable ::drawas_button($mytoplevel) -text [_ "Polygon"] radiobutton $mytoplevel.drawas.polygon -value 1 \ -variable ::drawas_button($mytoplevel) -text [_ "Points"] radiobutton $mytoplevel.drawas.bezier -value 2 \ -variable ::drawas_button($mytoplevel) -text [_ "Bezier curve"] pack $mytoplevel.drawas.points -side top -anchor w pack $mytoplevel.drawas.polygon -side top -anchor w pack $mytoplevel.drawas.bezier -side top -anchor w if {$newone != 0} { labelframe $mytoplevel.radio -text [_ "Put array into:"] -padx 20 -borderwidth 1 pack $mytoplevel.radio -side top -fill x radiobutton $mytoplevel.radio.radio0 -value 0 \ -variable ::otherflag_button($mytoplevel) -text [_ "New graph"] radiobutton $mytoplevel.radio.radio1 -value 1 \ -variable ::otherflag_button($mytoplevel) -text [_ "Last graph"] pack $mytoplevel.radio.radio0 -side top -anchor w pack $mytoplevel.radio.radio1 -side top -anchor w } else { checkbutton $mytoplevel.deletearray -text [_ "Delete array"] \ -variable ::otherflag_button($mytoplevel) -anchor w pack $mytoplevel.deletearray -side top } # jsarlo if {$newone == 0} { button $mytoplevel.listview -text [_ "Open List View..."] \ -command "::dialog_array::openlistview $mytoplevel [$mytoplevel.name.entry get]" pack $mytoplevel.listview -side top } # end jsarlo frame $mytoplevel.buttonframe pack $mytoplevel.buttonframe -side bottom -expand 1 -fill x -pady 2m button $mytoplevel.buttonframe.cancel -text [_ "Cancel"] \ -command "::dialog_array::cancel $mytoplevel" pack $mytoplevel.buttonframe.cancel -side left -expand 1 -fill x -padx 10 if {$newone == 0 && $::windowingsystem ne "aqua"} { button $mytoplevel.buttonframe.apply -text [_ "Apply"] \ -command "::dialog_array::apply $mytoplevel" pack $mytoplevel.buttonframe.apply -side left -expand 1 -fill x -padx 10 } button $mytoplevel.buttonframe.ok -text [_ "OK"]\ -command "::dialog_array::ok $mytoplevel" pack $mytoplevel.buttonframe.ok -side left -expand 1 -fill x -padx 10 } pd-0.45-4/tcl/dialog_message.tcl0000664000175000017500000000562112160204055014620 0ustar mspmsp# the message dialog panel is a bit unusual in that it is created directly by # the Tcl 'pd-gui'. Most dialog panels are created by sending a message to # 'pd', which then sends a message to 'pd-gui' to create the panel. This is # similar to the Find dialog panel. package provide dialog_message 0.1 package require pd_bindings namespace eval ::dialog_message:: { variable message_history {"pd dsp 1"} variable history_position 0 namespace export open_message_dialog } proc ::dialog_message::get_history {direction} { variable message_history variable history_position incr history_position $direction if {$history_position < 0} {set history_position 0} if {$history_position > [llength $message_history]} { set history_position [llength $message_history] } .message.f.entry delete 0 end .message.f.entry insert 0 \ [lindex $message_history end-[expr $history_position - 1]] } # mytoplevel isn't used here, but is kept for compatibility with other dialog ok procs proc ::dialog_message::ok {mytoplevel} { variable message_history set message [.message.f.entry get] if {$message ne ""} { pdsend $message lappend message_history $message .message.f.entry delete 0 end } } # mytoplevel isn't used here, but is kept for compatibility with other dialog cancel procs proc ::dialog_message::cancel {mytoplevel} { wm withdraw .message } # the message panel is opened from the menu and key bindings proc ::dialog_message::open_message_dialog {mytoplevel} { if {[winfo exists .message]} { wm deiconify .message raise .message } else { create_dialog $mytoplevel } } proc ::dialog_message::create_dialog {mytoplevel} { toplevel .message -class DialogWindow wm group .message . wm transient .message wm title .message [_ "Send a Pd message"] wm geometry .message =400x80+150+150 wm resizable .message 1 0 wm minsize .message 250 80 .message configure -menu $::dialog_menubar .message configure -padx 10 -pady 5 ::pd_bindings::dialog_bindings .message "message" # not all Tcl/Tk versions or platforms support -topmost, so catch the error catch {wm attributes $id -topmost 1} # TODO this should use something like 'dialogfont' for the font frame .message.f pack .message.f -side top -fill x -expand 1 entry .message.f.entry -width 54 -font {Helvetica 18} -relief sunken \ -highlightthickness 1 -highlightcolor blue label .message.f.semicolon -text ";" -font {Helvetica 24} pack .message.f.semicolon -side left pack .message.f.entry -side left -padx 10 -fill x -expand 1 focus .message.f.entry label .message.label -text [_ "(use arrow keys for history)"] pack .message.label -side bottom bind .message.f.entry "::dialog_message::get_history 1" bind .message.f.entry "::dialog_message::get_history -1" } pd-0.45-4/tcl/dialog_startup.tcl0000664000175000017500000000574712160204055014707 0ustar mspmsp package provide dialog_startup 0.1 package require scrollboxwindow namespace eval dialog_startup { variable defeatrt_flag 0 namespace export pdtk_startup_dialog } ########## pdtk_startup_dialog -- dialog window for startup options ######### # Create a simple modal window with an entry widget # for editing/adding a startup command # (the next-best-thing to in-place editing) proc ::dialog_startup::chooseCommand { prompt initialValue } { global cmd set cmd $initialValue toplevel .inputbox wm title .inputbox $prompt wm group .inputbox . wm minsize .inputbox 450 30 wm resizable .inputbox 0 0 wm geom .inputbox "450x30" # not all Tcl/Tk versions or platforms support -topmost, so catch the error catch {wm attributes $mytoplevel -topmost 1} button .inputbox.button -text [_ "OK"] -command { destroy .inputbox } \ -width [::msgcat::mcmax [_ "OK"]] entry .inputbox.entry -width 50 -textvariable cmd pack .inputbox.button -side right bind .inputbox.entry { destroy .inputbox } bind .inputbox.entry { destroy .inputbox } pack .inputbox.entry -side right -expand 1 -fill x -padx 2m focus .inputbox.entry raise .inputbox wm transient .inputbox grab .inputbox tkwait window .inputbox return $cmd } proc ::dialog_startup::add {} { return [chooseCommand [_ "Add new library"] ""] } proc ::dialog_startup::edit { current_library } { return [chooseCommand [_ "Edit library"] $current_library] } proc ::dialog_startup::commit { new_startup } { variable defeatrt_button set ::startup_libraries $new_startup pdsend "pd startup-dialog $defeatrt_button [pdtk_encodedialog $::startup_flags] $::startup_libraries" } # set up the panel with the info from pd proc ::dialog_startup::pdtk_startup_dialog {mytoplevel defeatrt flags} { variable defeatrt_button $defeatrt if {$flags ne ""} {variable ::startup_flags $flags} if {[winfo exists $mytoplevel]} { wm deiconify $mytoplevel raise $mytoplevel } else { create_dialog $mytoplevel } } proc ::dialog_startup::create_dialog {mytoplevel} { ::scrollboxwindow::make $mytoplevel $::startup_libraries \ dialog_startup::add dialog_startup::edit dialog_startup::commit \ [_ "Pd libraries to load on startup"] \ 400 300 label $mytoplevel.entryname -text [_ "Startup flags:"] entry $mytoplevel.entry -textvariable ::startup_flags -width 60 pack $mytoplevel.entryname $mytoplevel.entry -side left pack $mytoplevel.entry -side right -padx 2m -fill x -expand 1 frame $mytoplevel.defeatrtframe pack $mytoplevel.defeatrtframe -side bottom -fill x -pady 2m if {$::windowingsystem ne "win32"} { checkbutton $mytoplevel.defeatrtframe.defeatrt -anchor w \ -text [_ "Defeat real-time scheduling"] \ -variable ::dialog_startup::defeatrt_button pack $mytoplevel.defeatrtframe.defeatrt -side left } } pd-0.45-4/tcl/dialog_midi.tcl0000664000175000017500000003005412160204055014114 0ustar mspmsppackage provide dialog_midi 0.1 namespace eval ::dialog_midi:: { namespace export pdtk_midi_dialog namespace export pdtk_alsa_midi_dialog } # TODO this panel really needs some reworking, it works but the code is # very unreadable ####################### midi dialog ################## proc ::dialog_midi::apply {mytoplevel} { global midi_indev1 midi_indev2 midi_indev3 midi_indev4 global midi_outdev1 midi_outdev2 midi_outdev3 midi_outdev4 global midi_alsain midi_alsaout pdsend "pd midi-dialog \ $midi_indev1 \ $midi_indev2 \ $midi_indev3 \ $midi_indev4 \ $midi_outdev1 \ $midi_outdev2 \ $midi_outdev3 \ $midi_outdev4 \ $midi_alsain \ $midi_alsaout" } proc ::dialog_midi::cancel {mytoplevel} { pdsend "$mytoplevel cancel" } proc ::dialog_midi::ok {mytoplevel} { ::dialog_midi::apply $mytoplevel ::dialog_midi::cancel $mytoplevel } # callback from popup menu proc midi_popup_action {buttonname varname devlist index} { global midi_indevlist midi_outdevlist $varname $buttonname configure -text [lindex $devlist $index] set $varname $index } # create a popup menu proc midi_popup {name buttonname varname devlist} { if [winfo exists $name.popup] {destroy $name.popup} menu $name.popup -tearoff false if {$::windowingsystem eq "win32"} { $name.popup configure -font menuFont } # puts stderr [concat $devlist ] for {set x 0} {$x<[llength $devlist]} {incr x} { $name.popup add command -label [lindex $devlist $x] \ -command [list midi_popup_action \ $buttonname $varname $devlist $x] } tk_popup $name.popup [winfo pointerx $name] [winfo pointery $name] 0 } # start a dialog window to select midi devices. "longform" asks us to make # controls for opening several devices; if not, we get an extra button to # turn longform on and restart the dialog. proc ::dialog_midi::pdtk_midi_dialog {id indev1 indev2 indev3 indev4 \ outdev1 outdev2 outdev3 outdev4 longform} { global midi_indev1 midi_indev2 midi_indev3 midi_indev4 global midi_outdev1 midi_outdev2 midi_outdev3 midi_outdev4 global midi_indevlist midi_outdevlist global midi_alsain midi_alsaout set midi_indev1 $indev1 set midi_indev2 $indev2 set midi_indev3 $indev3 set midi_indev4 $indev4 set midi_outdev1 $outdev1 set midi_outdev2 $outdev2 set midi_outdev3 $outdev3 set midi_outdev4 $outdev4 set midi_alsain [llength $midi_indevlist] set midi_alsaout [llength $midi_outdevlist] toplevel $id -class DialogWindow wm title $id [_ "MIDI Settings"] wm group $id . wm resizable $id 0 0 wm transient $id $id configure -menu $::dialog_menubar $id configure -padx 10 -pady 5 ::pd_bindings::dialog_bindings $id "midi" # not all Tcl/Tk versions or platforms support -topmost, so catch the error catch {wm attributes $id -topmost 1} frame $id.buttonframe pack $id.buttonframe -side bottom -fill x -pady 2m button $id.buttonframe.cancel -text [_ "Cancel"]\ -command "::dialog_midi::cancel $id" button $id.buttonframe.apply -text [_ "Apply"]\ -command "::dialog_midi::apply $id" button $id.buttonframe.ok -text [_ "OK"]\ -command "::dialog_midi::ok $id" pack $id.buttonframe.cancel -side left -expand 1 pack $id.buttonframe.apply -side left -expand 1 pack $id.buttonframe.ok -side left -expand 1 # input device 1 frame $id.in1f pack $id.in1f -side top label $id.in1f.l1 -text [_ "Input device 1:"] button $id.in1f.x1 -text [lindex $midi_indevlist $midi_indev1] \ -command [list midi_popup $id $id.in1f.x1 midi_indev1 $midi_indevlist] pack $id.in1f.l1 $id.in1f.x1 -side left # input device 2 if {$longform && [llength $midi_indevlist] > 2} { frame $id.in2f pack $id.in2f -side top label $id.in2f.l1 -text [_ "Input device 2:"] button $id.in2f.x1 -text [lindex $midi_indevlist $midi_indev2] \ -command [list midi_popup $id $id.in2f.x1 midi_indev2 \ $midi_indevlist] pack $id.in2f.l1 $id.in2f.x1 -side left } # input device 3 if {$longform && [llength $midi_indevlist] > 3} { frame $id.in3f pack $id.in3f -side top label $id.in3f.l1 -text [_ "Input device 3:"] button $id.in3f.x1 -text [lindex $midi_indevlist $midi_indev3] \ -command [list midi_popup $id $id.in3f.x1 midi_indev3 \ $midi_indevlist] pack $id.in3f.l1 $id.in3f.x1 -side left } # input device 4 if {$longform && [llength $midi_indevlist] > 4} { frame $id.in4f pack $id.in4f -side top label $id.in4f.l1 -text [_ "Input device 4:"] button $id.in4f.x1 -text [lindex $midi_indevlist $midi_indev4] \ -command [list midi_popup $id $id.in4f.x1 midi_indev4 \ $midi_indevlist] pack $id.in4f.l1 $id.in4f.x1 -side left } # output device 1 frame $id.out1f pack $id.out1f -side top label $id.out1f.l1 -text [_ "Output device 1:"] button $id.out1f.x1 -text [lindex $midi_outdevlist $midi_outdev1] \ -command [list midi_popup $id $id.out1f.x1 midi_outdev1 \ $midi_outdevlist] pack $id.out1f.l1 $id.out1f.x1 -side left # output device 2 if {$longform && [llength $midi_outdevlist] > 2} { frame $id.out2f pack $id.out2f -side top label $id.out2f.l1 -text [_ "Output device 2:"] button $id.out2f.x1 -text [lindex $midi_outdevlist $midi_outdev2] \ -command \ [list midi_popup $id $id.out2f.x1 midi_outdev2 $midi_outdevlist] pack $id.out2f.l1 $id.out2f.x1 -side left } # output device 3 if {$longform && [llength $midi_outdevlist] > 3} { frame $id.out3f pack $id.out3f -side top label $id.out3f.l1 -text [_ "Output device 3:"] button $id.out3f.x1 -text [lindex $midi_outdevlist $midi_outdev3] \ -command \ [list midi_popup $id $id.out3f.x1 midi_outdev3 $midi_outdevlist] pack $id.out3f.l1 $id.out3f.x1 -side left } # output device 4 if {$longform && [llength $midi_outdevlist] > 4} { frame $id.out4f pack $id.out4f -side top label $id.out4f.l1 -text [_ "Output device 4:"] button $id.out4f.x1 -text [lindex $midi_outdevlist $midi_outdev4] \ -command \ [list midi_popup $id $id.out4f.x1 midi_outdev4 $midi_outdevlist] pack $id.out4f.l1 $id.out4f.x1 -side left } # if not the "long form" make a button to # restart with longform set. if {$longform == 0} { frame $id.longbutton pack $id.longbutton -side top button $id.longbutton.b -text [_ "Use multiple devices"] \ -command {pdsend "pd midi-properties 1"} pack $id.longbutton.b } } proc ::dialog_midi::pdtk_alsa_midi_dialog {id indev1 indev2 indev3 indev4 \ outdev1 outdev2 outdev3 outdev4 longform alsa} { global midi_indev1 midi_indev2 midi_indev3 midi_indev4 global midi_outdev1 midi_outdev2 midi_outdev3 midi_outdev4 global midi_indevlist midi_outdevlist global midi_alsain midi_alsaout set midi_indev1 $indev1 set midi_indev2 $indev2 set midi_indev3 $indev3 set midi_indev4 $indev4 set midi_outdev1 $outdev1 set midi_outdev2 $outdev2 set midi_outdev3 $outdev3 set midi_outdev4 $outdev4 set midi_alsain [llength $midi_indevlist] set midi_alsaout [llength $midi_outdevlist] toplevel $id wm title $id [_ "ALSA MIDI Settings"] if {$::windowingsystem eq "aqua"} {$id configure -menu .menubar} ::pd_bindings::dialog_bindings $id "midi" frame $id.buttonframe pack $id.buttonframe -side bottom -fill x -pady 2m button $id.buttonframe.cancel -text [_ "Cancel"]\ -command "::dialog_midi::cancel $id" button $id.buttonframe.apply -text [_ "Apply"]\ -command "::dialog_midi::apply $id" button $id.buttonframe.ok -text [_ "OK"]\ -command "::dialog_midi::ok $id" pack $id.buttonframe.cancel -side left -expand 1 pack $id.buttonframe.apply -side left -expand 1 pack $id.buttonframe.ok -side left -expand 1 frame $id.in1f pack $id.in1f -side top if {$alsa == 0} { # input device 1 label $id.in1f.l1 -text [_ "Input device 1:"] button $id.in1f.x1 -text [lindex $midi_indevlist $midi_indev1] \ -command [list midi_popup $id $id.in1f.x1 midi_indev1 $midi_indevlist] pack $id.in1f.l1 $id.in1f.x1 -side left # input device 2 if {$longform && [llength $midi_indevlist] > 2} { frame $id.in2f pack $id.in2f -side top label $id.in2f.l1 -text [_ "Input device 2:"] button $id.in2f.x1 -text [lindex $midi_indevlist $midi_indev2] \ -command [list midi_popup $id $id.in2f.x1 midi_indev2 \ $midi_indevlist] pack $id.in2f.l1 $id.in2f.x1 -side left } # input device 3 if {$longform && [llength $midi_indevlist] > 3} { frame $id.in3f pack $id.in3f -side top label $id.in3f.l1 -text [_ "Input device 3:"] button $id.in3f.x1 -text [lindex $midi_indevlist $midi_indev3] \ -command [list midi_popup $id $id.in3f.x1 midi_indev3 \ $midi_indevlist] pack $id.in3f.l1 $id.in3f.x1 -side left } # input device 4 if {$longform && [llength $midi_indevlist] > 4} { frame $id.in4f pack $id.in4f -side top label $id.in4f.l1 -text [_ "Input device 4:"] button $id.in4f.x1 -text [lindex $midi_indevlist $midi_indev4] \ -command [list midi_popup $id $id.in4f.x1 midi_indev4 \ $midi_indevlist] pack $id.in4f.l1 $id.in4f.x1 -side left } # output device 1 frame $id.out1f pack $id.out1f -side top label $id.out1f.l1 -text [_ "Output device 1:"] button $id.out1f.x1 -text [lindex $midi_outdevlist $midi_outdev1] \ -command [list midi_popup $id $id.out1f.x1 midi_outdev1 \ $midi_outdevlist] pack $id.out1f.l1 $id.out1f.x1 -side left # output device 2 if {$longform && [llength $midi_outdevlist] > 2} { frame $id.out2f pack $id.out2f -side top label $id.out2f.l1 -text [_ "Output device 2:"] button $id.out2f.x1 -text [lindex $midi_outdevlist $midi_outdev2] \ -command \ [list midi_popup $id $id.out2f.x1 midi_outdev2 $midi_outdevlist] pack $id.out2f.l1 $id.out2f.x1 -side left } # output device 3 if {$longform && [llength $midi_outdevlist] > 3} { frame $id.out3f pack $id.out3f -side top label $id.out3f.l1 -text [_ "Output device 3:"] button $id.out3f.x1 -text [lindex $midi_outdevlist $midi_outdev3] \ -command \ [list midi_popup $id $id.out3f.x1 midi_outdev3 $midi_outdevlist] pack $id.out3f.l1 $id.out3f.x1 -side left } # output device 4 if {$longform && [llength $midi_outdevlist] > 4} { frame $id.out4f pack $id.out4f -side top label $id.out4f.l1 -text [_ "Output device 4:"] button $id.out4f.x1 -text [lindex $midi_outdevlist $midi_outdev4] \ -command \ [list midi_popup $id $id.out4f.x1 midi_outdev4 $midi_outdevlist] pack $id.out4f.l1 $id.out4f.x1 -side left } # if not the "long form" make a button to # restart with longform set. if {$longform == 0} { frame $id.longbutton pack $id.longbutton -side top button $id.longbutton.b -text [_ "Use multiple ALSA devices"] \ -command {pdsend "pd midi-properties 1"} pack $id.longbutton.b } } if {$alsa} { label $id.in1f.l1 -text [_ "In Ports:"] entry $id.in1f.x1 -textvariable midi_alsain -width 4 pack $id.in1f.l1 $id.in1f.x1 -side left label $id.in1f.l2 -text [_ "Out Ports:"] entry $id.in1f.x2 -textvariable midi_alsaout -width 4 pack $id.in1f.l2 $id.in1f.x2 -side left } } pd-0.45-4/tcl/wheredoesthisgo.tcl0000664000175000017500000000635512160204055015065 0ustar mspmsp package provide wheredoesthisgo 0.1 # a place to temporarily store things until they find a home or go away proc open_file {filename} { set directory [file normalize [file dirname $filename]] set basename [file tail $filename] if { [file exists $filename] && [regexp -nocase -- "\.(pd|pat|mxt)$" $filename] } then { ::pdtk_canvas::started_loading_file [format "%s/%s" $basename $filename] pdsend "pd open [enquote_path $basename] [enquote_path $directory]" # now this is done in pd_guiprefs ::pd_guiprefs::update_recentfiles $filename } { ::pdwindow::post [format [_ "Ignoring '%s': doesn't look like a Pd-file"] $filename] } } # ------------------------------------------------------------------------------ # procs for panels (openpanel, savepanel) proc pdtk_openpanel {target localdir} { if {! [file isdirectory $localdir]} { if { ! [file isdirectory $::fileopendir]} { set ::fileopendir $::env(HOME) } set localdir $::fileopendir } set filename [tk_getOpenFile -initialdir $localdir] if {$filename ne ""} { set ::fileopendir [file dirname $filename] pdsend "$target callback [enquote_path $filename]" } } proc pdtk_savepanel {target localdir} { if {! [file isdirectory $localdir]} { if { ! [file isdirectory $::filenewdir]} { set ::filenewdir $::env(HOME) } set localdir $::filenewdir } set filename [tk_getSaveFile -initialdir $localdir] if {$filename ne ""} { pdsend "$target callback [enquote_path $filename]" } } # ------------------------------------------------------------------------------ # window info (name, path, parents, children, etc.) proc lookup_windowname {mytoplevel} { set window [array get ::windowname $mytoplevel] if { $window ne ""} { return [lindex $window 1] } else { return ERROR } } proc tkcanvas_name {mytoplevel} { return "$mytoplevel.c" } # ------------------------------------------------------------------------------ # quoting functions # enquote a string for find, path, and startup dialog panels, to be decoded by # sys_decodedialog() proc pdtk_encodedialog {x} { concat +[string map {" " "+_" "$" "+d" ";" "+s" "," "+c" "+" "++"} $x] } # encode a list with pdtk_encodedialog proc pdtk_encode { listdata } { set outlist {} foreach this_path $listdata { if {0==[string match "" $this_path]} { lappend outlist [pdtk_encodedialog $this_path] } } return $outlist } # TODO enquote a filename to send it to pd, " isn't handled properly tho... proc enquote_path {message} { string map {"," "\\," ";" "\\;" " " "\\ "} $message } #enquote a string to send it to Pd. Blow off semi and comma; alias spaces #we also blow off "{", "}", "\" because they'll just cause bad trouble later. proc unspace_text {x} { set y [string map {" " "_" ";" "" "," "" "{" "" "}" "" "\\" ""} $x] if {$y eq ""} {set y "empty"} concat $y } # ------------------------------------------------------------------------------ # watchdog functions proc pdtk_watchdog {} { pdsend "pd watchdog" after 2000 {pdtk_watchdog} } proc pdtk_ping {} { pdsend "pd ping" } pd-0.45-4/tcl/pd_bindings.tcl0000664000175000017500000003106312222367057014147 0ustar mspmsppackage provide pd_bindings 0.1 package require pd_menucommands package require dialog_find namespace eval ::pd_bindings:: { namespace export global_bindings namespace export dialog_bindings namespace export patch_bindings } # TODO rename pd_bindings to window_bindings after merge is done # Some commands are bound using "" quotations so that the $mytoplevel is # interpreted immediately. Since the command is being bound to $mytoplevel, # it makes sense to have value of $mytoplevel already in the command. This is # the opposite of most menu/bind commands here and in pd_menus.tcl, which use # {} to force execution of any variables (i.e. $::focused_window) until later # binding by class is not recursive, so its useful for window events proc ::pd_bindings::class_bindings {} { # and the Pd window is in a class to itself bind PdWindow "::pd_bindings::window_focusin %W" # bind to all the windows dedicated to patch canvases bind PatchWindow "::pd_bindings::window_focusin %W" bind PatchWindow "::pd_bindings::map %W" bind PatchWindow "::pd_bindings::unmap %W" bind PatchWindow "::pd_bindings::patch_configure %W %w %h %x %y" # dialog panel windows bindings, which behave differently than PatchWindows bind DialogWindow "::pd_bindings::dialog_configure %W" bind DialogWindow "::pd_bindings::dialog_focusin %W" } proc ::pd_bindings::global_bindings {} { # we use 'bind all' everywhere to get as much of Tk's automatic binding # behaviors as possible, things like not sending an event for 'O' when # 'Control-O' is pressed. bind all <$::modifier-Key-a> {menu_send %W selectall} bind all <$::modifier-Key-b> {menu_helpbrowser} bind all <$::modifier-Key-c> {menu_send %W copy} bind all <$::modifier-Key-d> {menu_send %W duplicate} bind all <$::modifier-Key-e> {menu_toggle_editmode} bind all <$::modifier-Key-f> {menu_find_dialog} bind all <$::modifier-Key-g> {menu_send %W findagain} bind all <$::modifier-Key-n> {menu_new} bind all <$::modifier-Key-o> {menu_open} bind all <$::modifier-Key-p> {menu_print $::focused_window} bind all <$::modifier-Key-q> {pdsend "pd verifyquit"} bind all <$::modifier-Key-r> {menu_raise_pdwindow} bind all <$::modifier-Key-s> {menu_send %W menusave} bind all <$::modifier-Key-v> {menu_send %W paste} bind all <$::modifier-Key-w> {menu_send_float %W menuclose 0} bind all <$::modifier-Key-x> {menu_send %W cut} bind all <$::modifier-Key-z> {menu_undo} bind all <$::modifier-Key-1> {menu_send_float %W obj 0} bind all <$::modifier-Key-2> {menu_send_float %W msg 0} bind all <$::modifier-Key-3> {menu_send_float %W floatatom 0} bind all <$::modifier-Key-4> {menu_send_float %W symbolatom 0} bind all <$::modifier-Key-5> {menu_send_float %W text 0} bind all <$::modifier-Key-slash> {pdsend "pd dsp 1"} bind all <$::modifier-Key-period> {pdsend "pd dsp 0"} bind all <$::modifier-greater> {menu_raisenextwindow} bind all <$::modifier-less> {menu_raisepreviouswindow} # annoying, but Tk's bind needs uppercase letter to get the Shift bind all <$::modifier-Shift-Key-B> {menu_send %W bng} bind all <$::modifier-Shift-Key-C> {menu_send %W mycnv} bind all <$::modifier-Shift-Key-D> {menu_send %W vradio} bind all <$::modifier-Shift-Key-H> {menu_send %W hslider} bind all <$::modifier-Shift-Key-I> {menu_send %W hradio} bind all <$::modifier-Shift-Key-L> {menu_clear_console} bind all <$::modifier-Shift-Key-N> {menu_send %W numbox} bind all <$::modifier-Shift-Key-Q> {pdsend "pd quit"} bind all <$::modifier-Shift-Key-S> {menu_send %W menusaveas} bind all <$::modifier-Shift-Key-T> {menu_send %W toggle} bind all <$::modifier-Shift-Key-U> {menu_send %W vumeter} bind all <$::modifier-Shift-Key-V> {menu_send %W vslider} bind all <$::modifier-Shift-Key-W> {menu_send_float %W menuclose 1} bind all <$::modifier-Shift-Key-Z> {menu_redo} # OS-specific bindings if {$::windowingsystem eq "aqua"} { # Cmd-m = Minimize and Cmd-t = Font on Mac OS X for all apps bind all <$::modifier-Key-m> {menu_minimize %W} bind all <$::modifier-Key-t> {menu_font_dialog} bind all <$::modifier-quoteleft> {menu_raisenextwindow} bind all <$::modifier-Shift-Key-M> {menu_message_dialog} } else { bind all <$::modifier-Key-m> {menu_message_dialog} #bind all <$::modifier-Key-t> {menu_texteditor} bind all <$::modifier-Next> {menu_raisenextwindow} ;# PgUp bind all <$::modifier-Prior> {menu_raisepreviouswindow};# PageDown } bind all {::pd_bindings::sendkey %W 1 %K %A 0} bind all {::pd_bindings::sendkey %W 0 %K %A 0} bind all {::pd_bindings::sendkey %W 1 %K %A 1} bind all {::pd_bindings::sendkey %W 0 %K %A 1} } # this is for the dialogs: find, font, sendmessage, gatom properties, array # properties, iemgui properties, canvas properties, data structures # properties, Audio setup, and MIDI setup proc ::pd_bindings::dialog_bindings {mytoplevel dialogname} { variable modifier bind $mytoplevel "dialog_${dialogname}::cancel $mytoplevel" bind $mytoplevel "dialog_${dialogname}::ok $mytoplevel" bind $mytoplevel <$::modifier-Key-w> "dialog_${dialogname}::cancel $mytoplevel" # these aren't supported in the dialog, so alert the user, then break so # that no other key bindings are run bind $mytoplevel <$::modifier-Key-s> {bell; break} bind $mytoplevel <$::modifier-Shift-Key-S> {bell; break} bind $mytoplevel <$::modifier-Key-p> {bell; break} wm protocol $mytoplevel WM_DELETE_WINDOW "dialog_${dialogname}::cancel $mytoplevel" } proc ::pd_bindings::patch_bindings {mytoplevel} { variable modifier set tkcanvas [tkcanvas_name $mytoplevel] # TODO move mouse bindings to global and bind to 'all' # mouse bindings ----------------------------------------------------------- # these need to be bound to $tkcanvas because %W will return $mytoplevel for # events over the window frame and $tkcanvas for events over the canvas bind $tkcanvas "pdtk_canvas_motion %W %x %y 0" bind $tkcanvas <$::modifier-Motion> "pdtk_canvas_motion %W %x %y 2" bind $tkcanvas "pdtk_canvas_mouse %W %x %y %b 0" bind $tkcanvas "pdtk_canvas_mouseup %W %x %y %b" bind $tkcanvas <$::modifier-ButtonPress-1> "pdtk_canvas_mouse %W %x %y %b 2" bind $tkcanvas "pdtk_canvas_mouse %W %x %y %b 1" if {$::windowingsystem eq "x11"} { # from http://wiki.tcl.tk/3893 bind all \ {event generate [focus -displayof %W] -delta 1} bind all \ {event generate [focus -displayof %W] -delta -1} bind all \ {event generate [focus -displayof %W] -delta 1} bind all \ {event generate [focus -displayof %W] -delta -1} } bind $tkcanvas {::pdtk_canvas::scroll %W y %D} bind $tkcanvas {::pdtk_canvas::scroll %W x %D} # "right clicks" are defined differently on each platform switch -- $::windowingsystem { "aqua" { bind $tkcanvas "pdtk_canvas_rightclick %W %x %y %b" # on Mac OS X, make a rightclick with Ctrl-click for 1 button mice bind $tkcanvas "pdtk_canvas_rightclick %W %x %y %b" bind $tkcanvas "pdtk_canvas_mouse %W %x %y %b 3" } "x11" { bind $tkcanvas "pdtk_canvas_rightclick %W %x %y %b" # on X11, button 2 "pastes" from the X windows clipboard bind $tkcanvas "pdtk_canvas_clickpaste %W %x %y %b" bind $tkcanvas "pdtk_canvas_mouse %W %x %y %b 3" } "win32" { bind $tkcanvas "pdtk_canvas_rightclick %W %x %y %b" bind $tkcanvas "pdtk_canvas_mouse %W %x %y %b 3" } } # window protocol bindings wm protocol $mytoplevel WM_DELETE_WINDOW "pdsend \"$mytoplevel menuclose 0\"" bind $tkcanvas "::pd_bindings::window_destroy %W" } #------------------------------------------------------------------------------# # event handlers proc ::pd_bindings::patch_configure {mytoplevel width height x y} { # for some reason, when we create a window, we get an event with a # widthXheight of 1x1 first, then we get the right values, so filter it out if {$width == 1 && $height == 1} {return} pdtk_canvas_getscroll [tkcanvas_name $mytoplevel] # send the size/location of the window and canvas to 'pd' in the form of: # left top right bottom pdsend "$mytoplevel setbounds $x $y [expr $x + $width] [expr $y + $height]" } proc ::pd_bindings::window_destroy {window} { set mytoplevel [winfo toplevel $window] unset ::editmode($mytoplevel) unset ::editingtext($mytoplevel) unset ::loaded($mytoplevel) # unset my entries all of the window data tracking arrays array unset ::windowname $mytoplevel array unset ::parentwindows $mytoplevel array unset ::childwindows $mytoplevel } # do tasks when changing focus (Window menu, scrollbars, etc.) proc ::pd_bindings::window_focusin {mytoplevel} { # focused_window is used throughout for sending bindings, menu commands, # etc. to the correct patch receiver symbol. MSP took out a line that # confusingly redirected the "find" window which might be in mid search set ::focused_window $mytoplevel ::pd_menucommands::set_filenewdir $mytoplevel ::dialog_font::update_font_dialog $mytoplevel if {$mytoplevel eq ".pdwindow"} { ::pd_menus::configure_for_pdwindow } else { ::pd_menus::configure_for_canvas $mytoplevel } if {[winfo exists .font]} {wm transient .font $::focused_window} # if we regain focus from another app, make sure to editmode cursor is right if {$::editmode($mytoplevel)} { $mytoplevel configure -cursor hand2 } # TODO handle enabling/disabling the Cut/Copy/Paste menu items in Edit } proc ::pd_bindings::dialog_configure {mytoplevel} { } proc ::pd_bindings::dialog_focusin {mytoplevel} { # TODO disable things on the menus that don't work for dialogs ::pd_menus::configure_for_dialog $mytoplevel } # "map" event tells us when the canvas becomes visible, and "unmap", # invisible. Invisibility means the Window Manager has minimized us. We # don't get a final "unmap" event when we destroy the window. proc ::pd_bindings::map {mytoplevel} { pdsend "$mytoplevel map 1" ::pdtk_canvas::finished_loading_file $mytoplevel } proc ::pd_bindings::unmap {mytoplevel} { pdsend "$mytoplevel map 0" } #------------------------------------------------------------------------------# # key usage # canvas_key() expects to receive the patch's mytoplevel because key messages # are local to each patch. Therefore, key messages are not send for the # dialog panels, the Pd window, help browser, etc. so we need to filter those # events out. proc ::pd_bindings::sendkey {window state key iso shift} { # TODO canvas_key on the C side should be refactored with this proc as well switch -- $key { "BackSpace" { set iso ""; set key 8 } "Tab" { set iso ""; set key 9 } "Return" { set iso ""; set key 10 } "Escape" { set iso ""; set key 27 } "Space" { set iso ""; set key 32 } "Delete" { set iso ""; set key 127 } "KP_Delete" { set iso ""; set key 127 } } if {$iso ne ""} { scan $iso %c key } # some pop-up panels also bind to keys like the enter, but then disappear, # so ignore their events. The inputbox in the Startup dialog does this. if {! [winfo exists $window]} {return} #$window might be a toplevel or canvas, [winfo toplevel] does the right thing set mytoplevel [winfo toplevel $window] if {[winfo class $mytoplevel] eq "PatchWindow"} { pdsend "$mytoplevel key $state $key $shift" } else { pdsend "pd key $state $key $shift" } } pd-0.45-4/tcl/dialog_iemgui.tcl0000664000175000017500000010263112222367057014465 0ustar mspmsp# For information on usage and redistribution, and for a DISCLAIMER OF ALL # WARRANTIES, see the file, "LICENSE.txt," in this distribution. # Copyright (c) 1997-2009 Miller Puckette. package provide dialog_iemgui 0.1 namespace eval ::dialog_iemgui:: { variable define_min_flashhold 50 variable define_min_flashbreak 10 variable define_min_fontsize 4 namespace export pdtk_iemgui_dialog } # TODO convert Init/No Init and Steady on click/Jump on click to checkbuttons proc ::dialog_iemgui::clip_dim {mytoplevel} { set vid [string trimleft $mytoplevel .] set var_iemgui_wdt [concat iemgui_wdt_$vid] global $var_iemgui_wdt set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid] global $var_iemgui_min_wdt set var_iemgui_hgt [concat iemgui_hgt_$vid] global $var_iemgui_hgt set var_iemgui_min_hgt [concat iemgui_min_hgt_$vid] global $var_iemgui_min_hgt if {[eval concat $$var_iemgui_wdt] < [eval concat $$var_iemgui_min_wdt]} { set $var_iemgui_wdt [eval concat $$var_iemgui_min_wdt] $mytoplevel.dim.w_ent configure -textvariable $var_iemgui_wdt } if {[eval concat $$var_iemgui_hgt] < [eval concat $$var_iemgui_min_hgt]} { set $var_iemgui_hgt [eval concat $$var_iemgui_min_hgt] $mytoplevel.dim.h_ent configure -textvariable $var_iemgui_hgt } } proc ::dialog_iemgui::clip_num {mytoplevel} { set vid [string trimleft $mytoplevel .] set var_iemgui_num [concat iemgui_num_$vid] global $var_iemgui_num if {[eval concat $$var_iemgui_num] > 2000} { set $var_iemgui_num 2000 $mytoplevel.para.num_ent configure -textvariable $var_iemgui_num } if {[eval concat $$var_iemgui_num] < 1} { set $var_iemgui_num 1 $mytoplevel.para.num_ent configure -textvariable $var_iemgui_num } } proc ::dialog_iemgui::sched_rng {mytoplevel} { set vid [string trimleft $mytoplevel .] set var_iemgui_min_rng [concat iemgui_min_rng_$vid] global $var_iemgui_min_rng set var_iemgui_max_rng [concat iemgui_max_rng_$vid] global $var_iemgui_max_rng set var_iemgui_rng_sch [concat iemgui_rng_sch_$vid] global $var_iemgui_rng_sch variable define_min_flashhold variable define_min_flashbreak if {[eval concat $$var_iemgui_rng_sch] == 2} { if {[eval concat $$var_iemgui_max_rng] < [eval concat $$var_iemgui_min_rng]} { set hhh [eval concat $$var_iemgui_min_rng] set $var_iemgui_min_rng [eval concat $$var_iemgui_max_rng] set $var_iemgui_max_rng $hhh $mytoplevel.rng.max_ent configure -textvariable $var_iemgui_max_rng $mytoplevel.rng.min_ent configure -textvariable $var_iemgui_min_rng } if {[eval concat $$var_iemgui_max_rng] < $define_min_flashhold} { set $var_iemgui_max_rng $define_min_flashhold $mytoplevel.rng.max_ent configure -textvariable $var_iemgui_max_rng } if {[eval concat $$var_iemgui_min_rng] < $define_min_flashbreak} { set $var_iemgui_min_rng $define_min_flashbreak $mytoplevel.rng.min_ent configure -textvariable $var_iemgui_min_rng } } if {[eval concat $$var_iemgui_rng_sch] == 1} { if {[eval concat $$var_iemgui_min_rng] == 0.0} { set $var_iemgui_min_rng 1.0 $mytoplevel.rng.min_ent configure -textvariable $var_iemgui_min_rng } } } proc ::dialog_iemgui::verify_rng {mytoplevel} { set vid [string trimleft $mytoplevel .] set var_iemgui_min_rng [concat iemgui_min_rng_$vid] global $var_iemgui_min_rng set var_iemgui_max_rng [concat iemgui_max_rng_$vid] global $var_iemgui_max_rng set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] global $var_iemgui_lin0_log1 if {[eval concat $$var_iemgui_lin0_log1] == 1} { if {[eval concat $$var_iemgui_max_rng] == 0.0 && [eval concat $$var_iemgui_min_rng] == 0.0} { set $var_iemgui_max_rng 1.0 $mytoplevel.rng.max_ent configure -textvariable $var_iemgui_max_rng } if {[eval concat $$var_iemgui_max_rng] > 0} { if {[eval concat $$var_iemgui_min_rng] <= 0} { set $var_iemgui_min_rng [expr [eval concat $$var_iemgui_max_rng] * 0.01] $mytoplevel.rng.min_ent configure -textvariable $var_iemgui_min_rng } } else { if {[eval concat $$var_iemgui_min_rng] > 0} { set $var_iemgui_max_rng [expr [eval concat $$var_iemgui_min_rng] * 0.01] $mytoplevel.rng.max_ent configure -textvariable $var_iemgui_max_rng } } } } proc ::dialog_iemgui::clip_fontsize {mytoplevel} { set vid [string trimleft $mytoplevel .] set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid] global $var_iemgui_gn_fs variable define_min_fontsize if {[eval concat $$var_iemgui_gn_fs] < $define_min_fontsize} { set $var_iemgui_gn_fs $define_min_fontsize $mytoplevel.label.fs_ent configure -textvariable $var_iemgui_gn_fs } } proc ::dialog_iemgui::set_col_example {mytoplevel} { set vid [string trimleft $mytoplevel .] set var_iemgui_bcol [concat iemgui_bcol_$vid] global $var_iemgui_bcol set var_iemgui_fcol [concat iemgui_fcol_$vid] global $var_iemgui_fcol set var_iemgui_lcol [concat iemgui_lcol_$vid] global $var_iemgui_lcol $mytoplevel.colors.sections.lb_bk configure \ -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -foreground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] \ -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_lcol]] if { [eval concat $$var_iemgui_fcol] >= 0 } { $mytoplevel.colors.sections.fr_bk configure \ -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -foreground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] \ -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_fcol]] } else { $mytoplevel.colors.sections.fr_bk configure \ -background [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -activebackground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -foreground [format "#%6.6x" [eval concat $$var_iemgui_bcol]] \ -activeforeground [format "#%6.6x" [eval concat $$var_iemgui_bcol]]} } proc ::dialog_iemgui::preset_col {mytoplevel presetcol} { set vid [string trimleft $mytoplevel .] set var_iemgui_l2_f1_b0 [concat iemgui_l2_f1_b0_$vid] global $var_iemgui_l2_f1_b0 set var_iemgui_bcol [concat iemgui_bcol_$vid] global $var_iemgui_bcol set var_iemgui_fcol [concat iemgui_fcol_$vid] global $var_iemgui_fcol set var_iemgui_lcol [concat iemgui_lcol_$vid] global $var_iemgui_lcol if { [eval concat $$var_iemgui_l2_f1_b0] == 0 } { set $var_iemgui_bcol $presetcol } if { [eval concat $$var_iemgui_l2_f1_b0] == 1 } { set $var_iemgui_fcol $presetcol } if { [eval concat $$var_iemgui_l2_f1_b0] == 2 } { set $var_iemgui_lcol $presetcol } ::dialog_iemgui::set_col_example $mytoplevel } proc ::dialog_iemgui::choose_col_bkfrlb {mytoplevel} { set vid [string trimleft $mytoplevel .] set var_iemgui_l2_f1_b0 [concat iemgui_l2_f1_b0_$vid] global $var_iemgui_l2_f1_b0 set var_iemgui_bcol [concat iemgui_bcol_$vid] global $var_iemgui_bcol set var_iemgui_fcol [concat iemgui_fcol_$vid] global $var_iemgui_fcol set var_iemgui_lcol [concat iemgui_lcol_$vid] global $var_iemgui_lcol if {[eval concat $$var_iemgui_l2_f1_b0] == 0} { set $var_iemgui_bcol [expr [eval concat $$var_iemgui_bcol] & 0xFCFCFC] set helpstring [tk_chooseColor -title [_ "Background color"] -initialcolor [format "#%6.6x" [eval concat $$var_iemgui_bcol]]] if { $helpstring ne "" } { set $var_iemgui_bcol [string replace $helpstring 0 0 "0x"] set $var_iemgui_bcol [expr [eval concat $$var_iemgui_bcol] & 0xFCFCFC] } } if {[eval concat $$var_iemgui_l2_f1_b0] == 1} { set $var_iemgui_fcol [expr [eval concat $$var_iemgui_fcol] & 0xFCFCFC] set helpstring [tk_chooseColor -title [_ "Foreground color"] -initialcolor [format "#%6.6x" [eval concat $$var_iemgui_fcol]]] if { $helpstring ne "" } { set $var_iemgui_fcol [string replace $helpstring 0 0 "0x"] set $var_iemgui_fcol [expr [eval concat $$var_iemgui_fcol] & 0xFCFCFC] } } if {[eval concat $$var_iemgui_l2_f1_b0] == 2} { set $var_iemgui_lcol [expr [eval concat $$var_iemgui_lcol] & 0xFCFCFC] set helpstring [tk_chooseColor -title [_ "Label color"] -initialcolor [format "#%6.6x" [eval concat $$var_iemgui_lcol]]] if { $helpstring ne "" } { set $var_iemgui_lcol [string replace $helpstring 0 0 "0x"] set $var_iemgui_lcol [expr [eval concat $$var_iemgui_lcol] & 0xFCFCFC] } } ::dialog_iemgui::set_col_example $mytoplevel } proc ::dialog_iemgui::lilo {mytoplevel} { set vid [string trimleft $mytoplevel .] set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] global $var_iemgui_lin0_log1 set var_iemgui_lilo0 [concat iemgui_lilo0_$vid] global $var_iemgui_lilo0 set var_iemgui_lilo1 [concat iemgui_lilo1_$vid] global $var_iemgui_lilo1 ::dialog_iemgui::sched_rng $mytoplevel if {[eval concat $$var_iemgui_lin0_log1] == 0} { set $var_iemgui_lin0_log1 1 $mytoplevel.para.lilo configure -text [eval concat $$var_iemgui_lilo1] ::dialog_iemgui::verify_rng $mytoplevel ::dialog_iemgui::sched_rng $mytoplevel } else { set $var_iemgui_lin0_log1 0 $mytoplevel.para.lilo configure -text [eval concat $$var_iemgui_lilo0] } } proc ::dialog_iemgui::toggle_font {mytoplevel gn_f} { set vid [string trimleft $mytoplevel .] set var_iemgui_gn_f [concat iemgui_gn_f_$vid] global $var_iemgui_gn_f set $var_iemgui_gn_f $gn_f switch -- $gn_f { 0 { set current_font $::font_family} 1 { set current_font "Helvetica" } 2 { set current_font "Times" } } set current_font_spec "{$current_font} 16 $::font_weight" $mytoplevel.label.fontpopup_label configure -text $current_font \ -font $current_font_spec $mytoplevel.label.name_entry configure -font $current_font_spec $mytoplevel.colors.sections.fr_bk configure -font $current_font_spec $mytoplevel.colors.sections.lb_bk configure -font $current_font_spec } proc ::dialog_iemgui::lb {mytoplevel} { set vid [string trimleft $mytoplevel .] set var_iemgui_loadbang [concat iemgui_loadbang_$vid] global $var_iemgui_loadbang if {[eval concat $$var_iemgui_loadbang] == 0} { set $var_iemgui_loadbang 1 $mytoplevel.para.lb configure -text [_ "Init"] } else { set $var_iemgui_loadbang 0 $mytoplevel.para.lb configure -text [_ "No init"] } } proc ::dialog_iemgui::stdy_jmp {mytoplevel} { set vid [string trimleft $mytoplevel .] set var_iemgui_steady [concat iemgui_steady_$vid] global $var_iemgui_steady if {[eval concat $$var_iemgui_steady]} { set $var_iemgui_steady 0 $mytoplevel.para.stdy_jmp configure -text [_ "Jump on click"] } else { set $var_iemgui_steady 1 $mytoplevel.para.stdy_jmp configure -text [_ "Steady on click"] } } proc ::dialog_iemgui::apply {mytoplevel} { set vid [string trimleft $mytoplevel .] set var_iemgui_wdt [concat iemgui_wdt_$vid] global $var_iemgui_wdt set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid] global $var_iemgui_min_wdt set var_iemgui_hgt [concat iemgui_hgt_$vid] global $var_iemgui_hgt set var_iemgui_min_hgt [concat iemgui_min_hgt_$vid] global $var_iemgui_min_hgt set var_iemgui_min_rng [concat iemgui_min_rng_$vid] global $var_iemgui_min_rng set var_iemgui_max_rng [concat iemgui_max_rng_$vid] global $var_iemgui_max_rng set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] global $var_iemgui_lin0_log1 set var_iemgui_lilo0 [concat iemgui_lilo0_$vid] global $var_iemgui_lilo0 set var_iemgui_lilo1 [concat iemgui_lilo1_$vid] global $var_iemgui_lilo1 set var_iemgui_loadbang [concat iemgui_loadbang_$vid] global $var_iemgui_loadbang set var_iemgui_num [concat iemgui_num_$vid] global $var_iemgui_num set var_iemgui_steady [concat iemgui_steady_$vid] global $var_iemgui_steady set var_iemgui_snd [concat iemgui_snd_$vid] global $var_iemgui_snd set var_iemgui_rcv [concat iemgui_rcv_$vid] global $var_iemgui_rcv set var_iemgui_gui_nam [concat iemgui_gui_nam_$vid] global $var_iemgui_gui_nam set var_iemgui_gn_dx [concat iemgui_gn_dx_$vid] global $var_iemgui_gn_dx set var_iemgui_gn_dy [concat iemgui_gn_dy_$vid] global $var_iemgui_gn_dy set var_iemgui_gn_f [concat iemgui_gn_f_$vid] global $var_iemgui_gn_f set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid] global $var_iemgui_gn_fs set var_iemgui_bcol [concat iemgui_bcol_$vid] global $var_iemgui_bcol set var_iemgui_fcol [concat iemgui_fcol_$vid] global $var_iemgui_fcol set var_iemgui_lcol [concat iemgui_lcol_$vid] global $var_iemgui_lcol ::dialog_iemgui::clip_dim $mytoplevel ::dialog_iemgui::clip_num $mytoplevel ::dialog_iemgui::sched_rng $mytoplevel ::dialog_iemgui::verify_rng $mytoplevel ::dialog_iemgui::sched_rng $mytoplevel ::dialog_iemgui::clip_fontsize $mytoplevel if {[eval concat $$var_iemgui_snd] == ""} {set hhhsnd "empty"} else {set hhhsnd [eval concat $$var_iemgui_snd]} if {[eval concat $$var_iemgui_rcv] == ""} {set hhhrcv "empty"} else {set hhhrcv [eval concat $$var_iemgui_rcv]} if {[eval concat $$var_iemgui_gui_nam] == ""} {set hhhgui_nam "empty" } else { set hhhgui_nam [eval concat $$var_iemgui_gui_nam]} if {[string index $hhhsnd 0] == "$"} { set hhhsnd [string replace $hhhsnd 0 0 #] } if {[string index $hhhrcv 0] == "$"} { set hhhrcv [string replace $hhhrcv 0 0 #] } if {[string index $hhhgui_nam 0] == "$"} { set hhhgui_nam [string replace $hhhgui_nam 0 0 #] } set hhhsnd [unspace_text $hhhsnd] set hhhrcv [unspace_text $hhhrcv] set hhhgui_nam [unspace_text $hhhgui_nam] # make sure the offset boxes have a value if {[eval concat $$var_iemgui_gn_dx] eq ""} {set $var_iemgui_gn_dx 0} if {[eval concat $$var_iemgui_gn_dy] eq ""} {set $var_iemgui_gn_dy 0} pdsend [concat $mytoplevel dialog \ [eval concat $$var_iemgui_wdt] \ [eval concat $$var_iemgui_hgt] \ [eval concat $$var_iemgui_min_rng] \ [eval concat $$var_iemgui_max_rng] \ [eval concat $$var_iemgui_lin0_log1] \ [eval concat $$var_iemgui_loadbang] \ [eval concat $$var_iemgui_num] \ $hhhsnd \ $hhhrcv \ $hhhgui_nam \ [eval concat $$var_iemgui_gn_dx] \ [eval concat $$var_iemgui_gn_dy] \ [eval concat $$var_iemgui_gn_f] \ [eval concat $$var_iemgui_gn_fs] \ [eval concat $$var_iemgui_bcol] \ [eval concat $$var_iemgui_fcol] \ [eval concat $$var_iemgui_lcol] \ [eval concat $$var_iemgui_steady]] } proc ::dialog_iemgui::cancel {mytoplevel} { pdsend "$mytoplevel cancel" } proc ::dialog_iemgui::ok {mytoplevel} { ::dialog_iemgui::apply $mytoplevel ::dialog_iemgui::cancel $mytoplevel } proc ::dialog_iemgui::pdtk_iemgui_dialog {mytoplevel mainheader dim_header \ wdt min_wdt wdt_label \ hgt min_hgt hgt_label \ rng_header min_rng min_rng_label max_rng \ max_rng_label rng_sched \ lin0_log1 lilo0_label lilo1_label \ loadbang steady num_label num \ snd rcv \ gui_name \ gn_dx gn_dy gn_f gn_fs \ bcol fcol lcol} { set vid [string trimleft $mytoplevel .] set var_iemgui_wdt [concat iemgui_wdt_$vid] global $var_iemgui_wdt set var_iemgui_min_wdt [concat iemgui_min_wdt_$vid] global $var_iemgui_min_wdt set var_iemgui_hgt [concat iemgui_hgt_$vid] global $var_iemgui_hgt set var_iemgui_min_hgt [concat iemgui_min_hgt_$vid] global $var_iemgui_min_hgt set var_iemgui_min_rng [concat iemgui_min_rng_$vid] global $var_iemgui_min_rng set var_iemgui_max_rng [concat iemgui_max_rng_$vid] global $var_iemgui_max_rng set var_iemgui_rng_sch [concat iemgui_rng_sch_$vid] global $var_iemgui_rng_sch set var_iemgui_lin0_log1 [concat iemgui_lin0_log1_$vid] global $var_iemgui_lin0_log1 set var_iemgui_lilo0 [concat iemgui_lilo0_$vid] global $var_iemgui_lilo0 set var_iemgui_lilo1 [concat iemgui_lilo1_$vid] global $var_iemgui_lilo1 set var_iemgui_loadbang [concat iemgui_loadbang_$vid] global $var_iemgui_loadbang set var_iemgui_num [concat iemgui_num_$vid] global $var_iemgui_num set var_iemgui_steady [concat iemgui_steady_$vid] global $var_iemgui_steady set var_iemgui_snd [concat iemgui_snd_$vid] global $var_iemgui_snd set var_iemgui_rcv [concat iemgui_rcv_$vid] global $var_iemgui_rcv set var_iemgui_gui_nam [concat iemgui_gui_nam_$vid] global $var_iemgui_gui_nam set var_iemgui_gn_dx [concat iemgui_gn_dx_$vid] global $var_iemgui_gn_dx set var_iemgui_gn_dy [concat iemgui_gn_dy_$vid] global $var_iemgui_gn_dy set var_iemgui_gn_f [concat iemgui_gn_f_$vid] global $var_iemgui_gn_f set var_iemgui_gn_fs [concat iemgui_gn_fs_$vid] global $var_iemgui_gn_fs set var_iemgui_l2_f1_b0 [concat iemgui_l2_f1_b0_$vid] global $var_iemgui_l2_f1_b0 set var_iemgui_bcol [concat iemgui_bcol_$vid] global $var_iemgui_bcol set var_iemgui_fcol [concat iemgui_fcol_$vid] global $var_iemgui_fcol set var_iemgui_lcol [concat iemgui_lcol_$vid] global $var_iemgui_lcol set $var_iemgui_wdt $wdt set $var_iemgui_min_wdt $min_wdt set $var_iemgui_hgt $hgt set $var_iemgui_min_hgt $min_hgt set $var_iemgui_min_rng $min_rng set $var_iemgui_max_rng $max_rng set $var_iemgui_rng_sch $rng_sched set $var_iemgui_lin0_log1 $lin0_log1 set $var_iemgui_lilo0 $lilo0_label set $var_iemgui_lilo1 $lilo1_label set $var_iemgui_loadbang $loadbang set $var_iemgui_num $num set $var_iemgui_steady $steady if {$snd == "empty"} {set $var_iemgui_snd [format ""] } else {set $var_iemgui_snd [format "%s" $snd]} if {$rcv == "empty"} {set $var_iemgui_rcv [format ""] } else {set $var_iemgui_rcv [format "%s" $rcv]} if {$gui_name == "empty"} {set $var_iemgui_gui_nam [format ""] } else {set $var_iemgui_gui_nam [format "%s" $gui_name]} if {[string index [eval concat $$var_iemgui_snd] 0] == "#"} { set $var_iemgui_snd [string replace [eval concat $$var_iemgui_snd] 0 0 $] } if {[string index [eval concat $$var_iemgui_rcv] 0] == "#"} { set $var_iemgui_rcv [string replace [eval concat $$var_iemgui_rcv] 0 0 $] } if {[string index [eval concat $$var_iemgui_gui_nam] 0] == "#"} { set $var_iemgui_gui_nam [string replace [eval concat $$var_iemgui_gui_nam] 0 0 $] } set $var_iemgui_gn_dx $gn_dx set $var_iemgui_gn_dy $gn_dy set $var_iemgui_gn_f $gn_f set $var_iemgui_gn_fs $gn_fs set $var_iemgui_bcol $bcol set $var_iemgui_fcol $fcol set $var_iemgui_lcol $lcol set $var_iemgui_l2_f1_b0 0 toplevel $mytoplevel -class DialogWindow wm title $mytoplevel [format [_ "%s Properties"] $mainheader] wm group $mytoplevel . wm resizable $mytoplevel 0 0 wm transient $mytoplevel $::focused_window $mytoplevel configure -menu $::dialog_menubar $mytoplevel configure -padx 0 -pady 0 ::pd_bindings::dialog_bindings $mytoplevel "iemgui" frame $mytoplevel.dim pack $mytoplevel.dim -side top label $mytoplevel.dim.head -text [_ $dim_header] label $mytoplevel.dim.w_lab -text [_ $wdt_label] -width 6 entry $mytoplevel.dim.w_ent -textvariable $var_iemgui_wdt -width 5 label $mytoplevel.dim.dummy1 -text " " -width 10 label $mytoplevel.dim.h_lab -text [_ $hgt_label] -width 6 entry $mytoplevel.dim.h_ent -textvariable $var_iemgui_hgt -width 5 pack $mytoplevel.dim.head -side top pack $mytoplevel.dim.w_lab $mytoplevel.dim.w_ent $mytoplevel.dim.dummy1 -side left if { $hgt_label ne "empty" } { pack $mytoplevel.dim.h_lab $mytoplevel.dim.h_ent -side left} frame $mytoplevel.rng pack $mytoplevel.rng -side top label $mytoplevel.rng.head -text [_ $rng_header] label $mytoplevel.rng.min_lab -text [_ $min_rng_label] -width 6 entry $mytoplevel.rng.min_ent -textvariable $var_iemgui_min_rng -width 9 label $mytoplevel.rng.dummy1 -text " " -width 1 label $mytoplevel.rng.max_lab -text [_ $max_rng_label] -width 8 entry $mytoplevel.rng.max_ent -textvariable $var_iemgui_max_rng -width 9 if { $rng_header ne "empty" } { pack $mytoplevel.rng.head -side top if { $min_rng_label ne "empty" } { pack $mytoplevel.rng.min_lab $mytoplevel.rng.min_ent -side left} if { $max_rng_label ne "empty" } { pack $mytoplevel.rng.dummy1 \ $mytoplevel.rng.max_lab $mytoplevel.rng.max_ent -side left} } if { [eval concat $$var_iemgui_lin0_log1] >= 0 || [eval concat $$var_iemgui_loadbang] >= 0 || [eval concat $$var_iemgui_num] > 0 || [eval concat $$var_iemgui_steady] >= 0 } { label $mytoplevel.space1 -text "" pack $mytoplevel.space1 -side top } frame $mytoplevel.para pack $mytoplevel.para -side top label $mytoplevel.para.dummy2 -text "" -width 1 label $mytoplevel.para.dummy3 -text "" -width 1 if {[eval concat $$var_iemgui_lin0_log1] == 0} { button $mytoplevel.para.lilo -text [_ [eval concat $$var_iemgui_lilo0]] -width 5 \ -command "::dialog_iemgui::lilo $mytoplevel" } if {[eval concat $$var_iemgui_lin0_log1] == 1} { button $mytoplevel.para.lilo -text [_ [eval concat $$var_iemgui_lilo1]] -width 5 \ -command "::dialog_iemgui::lilo $mytoplevel" } if {[eval concat $$var_iemgui_loadbang] == 0} { button $mytoplevel.para.lb -text [_ "No init"] \ -command "::dialog_iemgui::lb $mytoplevel" } if {[eval concat $$var_iemgui_loadbang] == 1} { button $mytoplevel.para.lb -text [_ "Save"] \ -command "::dialog_iemgui::lb $mytoplevel" } label $mytoplevel.para.num_lab -text [_ $num_label] -width 9 entry $mytoplevel.para.num_ent -textvariable $var_iemgui_num -width 4 if {[eval concat $$var_iemgui_steady] == 0} { button $mytoplevel.para.stdy_jmp -command "::dialog_iemgui::stdy_jmp $mytoplevel" \ -text [_ "Jump on click"] } if {[eval concat $$var_iemgui_steady] == 1} { button $mytoplevel.para.stdy_jmp -command "::dialog_iemgui::stdy_jmp $mytoplevel" \ -text [_ "Steady on click"] } if {[eval concat $$var_iemgui_lin0_log1] >= 0} { pack $mytoplevel.para.lilo -side left -expand 1} if {[eval concat $$var_iemgui_loadbang] >= 0} { pack $mytoplevel.para.dummy2 $mytoplevel.para.lb -side left -expand 1} if {[eval concat $$var_iemgui_num] > 0} { pack $mytoplevel.para.dummy3 $mytoplevel.para.num_lab $mytoplevel.para.num_ent -side left -expand 1} if {[eval concat $$var_iemgui_steady] >= 0} { pack $mytoplevel.para.dummy3 $mytoplevel.para.stdy_jmp -side left -expand 1} frame $mytoplevel.spacer0 -height 4 pack $mytoplevel.spacer0 -side top labelframe $mytoplevel.s_r -borderwidth 1 -pady 4 -text [_ "Messages"] pack $mytoplevel.s_r -side top -fill x -ipadx 5 frame $mytoplevel.s_r.send pack $mytoplevel.s_r.send -side top -padx 4 -fill x -expand 1 label $mytoplevel.s_r.send.lab -text [_ "Send symbol:"] -justify left entry $mytoplevel.s_r.send.ent -textvariable $var_iemgui_snd -width 22 if { $snd ne "nosndno" } { pack $mytoplevel.s_r.send.lab $mytoplevel.s_r.send.ent -side left \ -fill x -expand 1 } frame $mytoplevel.s_r.receive pack $mytoplevel.s_r.receive -side top -padx 4 -fill x -expand 1 label $mytoplevel.s_r.receive.lab -text [_ "Receive symbol:"] -justify left entry $mytoplevel.s_r.receive.ent -textvariable $var_iemgui_rcv -width 22 if { $rcv ne "norcvno" } { pack $mytoplevel.s_r.receive.lab $mytoplevel.s_r.receive.ent -side left \ -fill x -expand 1 } # get the current font name from the int given from C-space (gn_f) set current_font $::font_family if {[eval concat $$var_iemgui_gn_f] == 1} \ { set current_font "Helvetica" } if {[eval concat $$var_iemgui_gn_f] == 2} \ { set current_font "Times" } frame $mytoplevel.spacer1 -height 7 pack $mytoplevel.spacer1 -side top labelframe $mytoplevel.label -borderwidth 1 -text [_ "Label"] -pady 4 pack $mytoplevel.label -side top -fill x entry $mytoplevel.label.name_entry -textvariable $var_iemgui_gui_nam \ -width 30 -font [list $current_font 12 $::font_weight] pack $mytoplevel.label.name_entry -side top -expand yes -fill both -padx 5 frame $mytoplevel.label.xy -padx 27 -pady 1 pack $mytoplevel.label.xy -side top label $mytoplevel.label.xy.x_lab -text [_ "X offset"] entry $mytoplevel.label.xy.x_entry -textvariable $var_iemgui_gn_dx -width 5 label $mytoplevel.label.xy.dummy1 -text " " -width 2 label $mytoplevel.label.xy.y_lab -text [_ "Y offset"] entry $mytoplevel.label.xy.y_entry -textvariable $var_iemgui_gn_dy -width 5 pack $mytoplevel.label.xy.x_lab $mytoplevel.label.xy.x_entry $mytoplevel.label.xy.dummy1 \ $mytoplevel.label.xy.y_lab $mytoplevel.label.xy.y_entry -side left -anchor e button $mytoplevel.label.fontpopup_label -text $current_font \ -font [list $current_font 16 $::font_weight] pack $mytoplevel.label.fontpopup_label -side left -anchor w \ -expand 1 -fill x -padx 5 label $mytoplevel.label.fontsize_label -text [_ "Size:"] entry $mytoplevel.label.fontsize_entry -textvariable $var_iemgui_gn_fs -width 5 pack $mytoplevel.label.fontsize_entry $mytoplevel.label.fontsize_label \ -side right -anchor e -padx 5 -pady 5 menu $mytoplevel.popup $mytoplevel.popup add command \ -label $::font_family \ -font [format {{%s} 16 %s} $::font_family $::font_weight] \ -command "::dialog_iemgui::toggle_font $mytoplevel 0" $mytoplevel.popup add command \ -label "Helvetica" \ -font [format {Helvetica 16 %s} $::font_weight] \ -command "::dialog_iemgui::toggle_font $mytoplevel 1" $mytoplevel.popup add command \ -label "Times" \ -font [format {Times 16 %s} $::font_weight] \ -command "::dialog_iemgui::toggle_font $mytoplevel 2" bind $mytoplevel.label.fontpopup_label