aboutsummaryrefslogtreecommitdiff
path: root/pd/tcl/dialog_path.tcl
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-10-09 16:36:37 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-10-09 16:36:37 +0000
commit21c068f1916330e90f814bed461fe0821d1665ec (patch)
tree949b73696fff09a44b8d3eb01b70bae7174cbd14 /pd/tcl/dialog_path.tcl
parentbf8ced1efe1a032342e864edc635fa4e2676670d (diff)
checked in pd-0.43-0.src.tar.gz
svn path=/trunk/; revision=15557
Diffstat (limited to 'pd/tcl/dialog_path.tcl')
-rw-r--r--pd/tcl/dialog_path.tcl70
1 files changed, 70 insertions, 0 deletions
diff --git a/pd/tcl/dialog_path.tcl b/pd/tcl/dialog_path.tcl
new file mode 100644
index 00000000..40a306ba
--- /dev/null
+++ b/pd/tcl/dialog_path.tcl
@@ -0,0 +1,70 @@
+
+package provide dialog_path 0.1
+
+namespace eval ::dialog_path:: {
+ variable use_standard_extensions_button 1
+ variable verbose_button 0
+
+ namespace export pdtk_path_dialog
+}
+
+############ pdtk_path_dialog -- run a path dialog #########
+
+# set up the panel with the info from pd
+proc ::dialog_path::pdtk_path_dialog {mytoplevel extrapath verbose} {
+ global use_standard_extensions_button
+ global verbose_button
+ set use_standard_extensions_button $extrapath
+ set verbose_button $verbose
+
+ if {[winfo exists $mytoplevel]} {
+ wm deiconify $mytoplevel
+ raise $mytoplevel
+ } else {
+ create_dialog $mytoplevel
+ }
+}
+
+proc ::dialog_path::create_dialog {mytoplevel} {
+
+ scrollboxwindow::make $mytoplevel $::sys_searchpath \
+ dialog_path::add dialog_path::edit dialog_path::commit \
+ [_ "Pd search path for objects, help, fonts, and other files"] \
+ 400 300
+
+ frame $mytoplevel.extraframe
+ pack $mytoplevel.extraframe -side bottom -pady 2m
+ checkbutton $mytoplevel.extraframe.extra -text [_ "Use standard extensions"] \
+ -variable use_standard_extensions_button -anchor w
+ checkbutton $mytoplevel.extraframe.verbose -text [_ "Verbose"] \
+ -variable verbose_button -anchor w
+ pack $mytoplevel.extraframe.extra $mytoplevel.extraframe.verbose \
+ -side left -expand 1
+}
+
+
+
+############ pdtk_path_dialog -- dialog window for search path #########
+proc ::dialog_path::choosePath { currentpath title } {
+ if {$currentpath == ""} {
+ set currentpath "~"
+ }
+ return [tk_chooseDirectory -initialdir $currentpath -title $title]
+}
+
+proc ::dialog_path::add {} {
+ return [::dialog_path::choosePath "" {Add a new path}]
+}
+
+proc ::dialog_path::edit { currentpath } {
+ return [::dialog_path::choosePath $currentpath "Edit existing path \[$currentpath\]"]
+}
+
+proc ::dialog_path::commit { new_path } {
+ global use_standard_extensions_button
+ global verbose_button
+
+ set ::sys_searchpath $new_path
+ pdsend "pd path-dialog $use_standard_extensions_button $verbose_button $::sys_searchpath"
+}
+