Revision: 10523 http://pure-data.svn.sourceforge.net/pure-data/?rev=10523&view=rev Author: eighthave Date: 2009-01-13 00:01:34 +0000 (Tue, 13 Jan 2009)
Log Message: ----------- - made stricter checking of args to make sure pd-gui understands whether pd is starting it, or whether it should start pd
- added filetypes to proc init for each platform
- replaced [concat] with "" where appropriate
Modified Paths: -------------- branches/pd-devel/0.41.4/src/pd.tk branches/pd-devel/0.41.4/src/pd_menucommands.tcl
Modified: branches/pd-devel/0.41.4/src/pd.tk =================================================================== --- branches/pd-devel/0.41.4/src/pd.tk 2009-01-12 23:01:33 UTC (rev 10522) +++ branches/pd-devel/0.41.4/src/pd.tk 2009-01-13 00:01:34 UTC (rev 10523) @@ -1,4 +1,4 @@ -#!/usr/bin/wish +#!/usr/bin/env wish # 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. @@ -92,11 +92,26 @@ catch {tk_getOpenFile -with-invalid-argument} set ::tk::dialog::file::showHiddenBtn 1 set ::tk::dialog::file::showHiddenVar 0 + # set file types that open/save recognize + set filetypes { + {{pd files} {.pd} } + {{max text files} {.pat} } + } } "aqua" { + # set file types that open/save recognize + set filetypes { + {{Pd Files} {.pd} } + {{Max Text Files (.pat)} {.pat} } + } } "win32" { font create menufont -family Tahoma -size -11 + # set file types that open/save recognize + set filetypes { + {{Pd Files} {.pd} } + {{Max Text Files} {.pat} } + } } } } @@ -115,12 +130,19 @@ # canvas support functions
##### routine to ask user if OK and, if so, send a message on to Pd ###### -proc pdtk_check {x message default} { - set answer [tk_messageBox -message $x -type yesno -default $default \ - -icon question] - if {! [string compare $answer yes]} {pd $message} +proc pdtk_check {message reply_to_pd default} { + # TODO this should use -parent and -title, but the hard part is figuring + # out how to get the values for those without changing g_editor.c + set answer [tk_messageBox -type yesno -icon question \ + -default $default -message $message] + if {$answer eq "yes"} { + pd $reply_to_pd + } }
+# TODO it probably makes sense to add a new function for -type yesnocancel +# dialogs that would be useful for "Save, Discard, Cancel" dialogs + proc pdtk_fixwindowmenu {} { #TODO figure out how to do this cleanly puts stderr "Running pdtk_fixwindowmenu" @@ -173,14 +195,9 @@ label .placeholder.label -text "Pd window placeholder" -width 80 -height 15 pack .placeholder.label .placeholder -side top -expand yes -fill both
- if {$argc == 1} { - # 'pd' is starting first, so get the port to connect to - set portnumber [lindex $argv 0] - if { ! [string is int $portnumber]} { - puts stderr "ERROR: port $portnumber is not an int, exiting!" - exit 2 - } - ::pd_connect::to_pd $portnumber + if { $argc == 1 && [string is int [lindex $argv 0]]} { + # 'pd' started first and launched us, so get the port to connect to + ::pd_connect::to_pd [lindex $argv 0] } else { # the GUI is starting first, so create socket and exec 'pd' set portnumber [::pd_connect::create_socket]
Modified: branches/pd-devel/0.41.4/src/pd_menucommands.tcl =================================================================== --- branches/pd-devel/0.41.4/src/pd_menucommands.tcl 2009-01-12 23:01:33 UTC (rev 10522) +++ branches/pd-devel/0.41.4/src/pd_menucommands.tcl 2009-01-13 00:01:34 UTC (rev 10523) @@ -40,54 +40,72 @@ }
proc ::pd_menucommands::menu_open {} { - global pd_opendir + global pd_opendir filetypes set filename [tk_getOpenFile -defaultextension .pd \ - -filetypes { {{pd files} {.pd}} {{max files} {.pat}}} \ - -initialdir $pd_opendir] - if {$filename != ""} {open_file $filename} + -filetypes $filetypes \ + -initialdir $pd_opendir] + if {$filename ne ""} { + open_file $filename + } }
proc ::pd_menucommands::menu_close {name} { - pd [concat $name menuclose 0 ;] + pd "$name menuclose 0 ;" }
+proc ::pd_menucommands::menu_save {name} { + pd "$name menusave ;" +} + +proc ::pd_menucommands::menu_saveas {name} { + pd "$name menusaveas ;" +} + +proc menu_really_quit {} { + pd "pd quit ;" +} + +proc menu_quit {} { + pd "pd verifyquit ;" +} + # ------------------------------------------------------------------------------ # functions called from Edit menu
proc ::pd_menucommands::menu_cut {name} { - pd [concat $name cut ;] + pd "$name cut ;" }
proc ::pd_menucommands::menu_copy {name} { - pd [concat $name copy ;] + pd "$name copy ;" }
proc ::pd_menucommands::menu_paste {name} { - pd [concat $name paste ;] + pd "$name paste ;" }
proc ::pd_menucommands::menu_duplicate {name} { - pd [concat $name duplicate ;] + pd "$name duplicate ;" }
proc ::pd_menucommands::menu_selectall {name} { - pd [concat $name selectall ;] + pd "$name selectall ;" }
proc ::pd_menucommands::menu_texteditor {name} { - pd [concat $name texteditor ;] + pd "$name texteditor ;" }
proc ::pd_menucommands::menu_font {name} { - pd [concat $name menufont ;] + pd "$name menufont ;" }
proc ::pd_menucommands::menu_tidyup {name} { - pd [concat $name tidy ;] + pd "$name tidy ;" }
proc ::pd_menucommands::menu_editmode {name} { - pd [concat $name editmode 0 ;] + pd "$name editmode 0 ;" }
proc ::pd_menucommands::menu_preferences {args} { @@ -101,68 +119,68 @@ # functions called from Put menu
proc ::pd_menucommands::menu_object {name accel} { - pd [concat $name obj $accel ;] + pd "$name obj $accel ;" }
proc ::pd_menucommands::menu_message {name accel} { - pd [concat $name msg $accel ;] + pd "$name msg $accel ;" }
proc ::pd_menucommands::menu_floatatom {name accel} { - pd [concat $name floatatom $accel ;] + pd "$name floatatom $accel ;" }
proc ::pd_menucommands::menu_symbolatom {name accel} { - pd [concat $name symbolatom $accel ;] + pd "$name symbolatom $accel ;" }
proc ::pd_menucommands::menu_comment {name accel} { - pd [concat $name text $accel ;] + pd "$name text $accel ;" }
proc ::pd_menucommands::menu_graph {name} { - pd [concat $name graph ;] + pd "$name graph ;" }
proc ::pd_menucommands::menu_array {name} { - pd [concat $name menuarray ;] + pd "$name menuarray ;" }
############iemlib################## proc ::pd_menucommands::menu_bng {name accel} { - pd [concat $name bng $accel ;] + pd "$name bng $accel ;" }
proc ::pd_menucommands::menu_toggle {name accel} { - pd [concat $name toggle $accel ;] + pd "$name toggle $accel ;" }
proc ::pd_menucommands::menu_numbox {name accel} { - pd [concat $name numbox $accel ;] + pd "$name numbox $accel ;" }
proc ::pd_menucommands::menu_vslider {name accel} { - pd [concat $name vslider $accel ;] + pd "$name vslider $accel ;" }
proc ::pd_menucommands::menu_hslider {name accel} { - pd [concat $name hslider $accel ;] + pd "$name hslider $accel ;" }
proc ::pd_menucommands::menu_hradio {name accel} { - pd [concat $name hradio $accel ;] + pd "$name hradio $accel ;" }
proc ::pd_menucommands::menu_vradio {name accel} { - pd [concat $name vradio $accel ;] + pd "$name vradio $accel ;" }
proc ::pd_menucommands::menu_vumeter {name accel} { - pd [concat $name vumeter $accel ;] + pd "$name vumeter $accel ;" }
proc ::pd_menucommands::menu_mycnv {name accel} { - pd [concat $name mycnv $accel ;] + pd "$name mycnv $accel ;" }
# ------------------------------------------------------------------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.