Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7221
Modified Files: Tag: devel_0_39 desire.tk Log Message: split pdrc_editor class in three: Dialog, PagedDialog, PrefsDialog
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.167 retrieving revision 1.1.2.168 diff -C2 -d -r1.1.2.167 -r1.1.2.168 *** desire.tk 20 Apr 2006 01:42:41 -0000 1.1.2.167 --- desire.tk 20 Apr 2006 18:18:52 -0000 1.1.2.168 *************** *** 567,571 **** }
- proc menu_really_quit {} {pd pd quit} def Client quit {} { set answer [tk_messageBox -message "Do you really wish to quit?" -type yesno -icon question] --- 567,570 ---- *************** *** 573,576 **** --- 572,577 ---- }
+ def Client pdrc_editor {} {PrefsDialog new_as pdrc} + proc menu_pop_pd {} {raise .} proc menu_audio {flag} {pd pd dsp $flag} *************** *** 3444,3448 **** eval "entry $f.entry -textvariable _($self:$name) $options" pack $f.entry -side left ! bind $f.entry <Return> "$ok $w" switch -regexp -- $type { integer|float|fontsize { --- 3445,3449 ---- eval "entry $f.entry -textvariable _($self:$name) $options" pack $f.entry -side left ! bind $f.entry <Return> "$ok $self" switch -regexp -- $type { integer|float|fontsize { *************** *** 3500,3514 **** }
! # this proc might be obsolete ! proc cancel_apply_ok {self procprefix} { ! frame .$self.buttonsep -height 2 -borderwidth 1 -relief sunken ! frame .$self.buttonframe ! foreach {a b} {cancel "Cancel" apply "Apply" ok "OK"} { ! button .$self.buttonframe.$a -text $b -command "${procprefix}_$a .$self" ! pack .$self.buttonframe.$a -side left -expand 1 } ! pack .$self.buttonframe -side bottom -fill x -pady 2m ! pack .$self.buttonsep -side bottom -fill x }
--- 3501,3556 ---- }
+ class_new Dialog + def Dialog ok {} {$self cancel; $self apply} + def Dialog cancel {} {} + def Dialog apply {} {} + def Dialog _delete {} {destroy .$self}
! def Dialog init {} { ! set f .$self ! toplevel $f ! frame $f.buttonsep -height 2 -borderwidth 1 -relief sunken ! frame $f.buttonframe ! foreach {a} {cancel apply ok} { ! button $f.buttonframe.$a -text [say $a] -command "$self $a" ! pack $f.buttonframe.$a -side left -expand 1 } ! pack $f.buttonframe -side bottom -fill x -pady 2m ! pack $f.buttonsep -side bottom -fill x ! wm protocol $f WM_DELETE_WINDOW "$self cancel" ! } ! ! ! class_new PagedDialog {Dialog} ! ! def PagedDialog init {} { ! super ! set f .$self.1 ! frame $f ! pack [frame $f.bar] -fill x ! #pack [frame $f.buttonsep -height 2 -borderwidth 1 -relief sunken] ! pack [frame $f.main -borderwidth 1 -relief raised \ ! -width 600 -height 350] -fill both -expand yes ! pack $f ! } ! ! def PagedDialog page_select {i} { ! set f .$self.1 ! catch { ! $f.bar.$@section configure -relief raised ! place forget $f.main.$@section ! pack $f.bar.$@section -pady {4 4} ! } ! set @section $i ! place $f.main.$@section -x 0 -y 0 ! $f.bar.$@section configure -relief sunken ! pack $f.bar.$@section -pady {8 0} ! } ! ! def PagedDialog add_section {section text} { ! set f .$self.1 ! frame $f.main.$section ! pack [button $f.bar.$section -text $text \ ! -command [list $self page_select $section]] -side left -pady {4 4} }
*************** *** 3579,3603 **** }
! class_new pdrc_editor ! ! proc pdrc_editor_ok {self} {pdrc_editor_apply $self; pdrc_editor_cancel $self} ! proc pdrc_editor_cancel {self} {destroy $self} ! proc pdrc_editor_apply {self} { ! set self [string trimleft $self .] ! pdrc_editor_write $self ! } ! ! def pdrc_editor page_select {i} { ! set f .$self.1 ! catch { ! $f.bar.$@section configure -relief raised ! place forget $f.main.$@section ! } ! set @section $i ! place $f.main.$@section -x 0 -y 0 ! $f.bar.$@section configure -relief sunken ! }
! def pdrc_editor read {} { global pdrc_options pdrc_options_h cmdline set fd [open $cmdline(rcfilename) "RDONLY CREAT"] --- 3621,3629 ---- }
! class_new PrefsDialog {PagedDialog} ! def PrefsDialog cancel {} {$self _delete} ! def PrefsDialog apply {} {$self write}
! def PrefsDialog read {} { global pdrc_options pdrc_options_h cmdline set fd [open $cmdline(rcfilename) "RDONLY CREAT"] *************** *** 3605,3609 **** close $fd foreach {type name desc} $pdrc_options { ! set _($self:$name) "" foreach subname [split $name |] { set pdrc_options_h($subname) [list $type $name $desc] --- 3631,3635 ---- close $fd foreach {type name desc} $pdrc_options { ! set @$name "" foreach subname [split $name |] { set pdrc_options_h($subname) [list $type $name $desc] *************** *** 3620,3627 **** foreach {type name desc} $pdrc_options_h($op) {} switch $type { ! folders {incr i; lappend _($self:$name) [lindex $contents $i]} ! files {incr i; lappend _($self:$name) [lindex $contents $i]} ! void {set _($self:$name) 1} ! default {incr i; set _($self:$name) [lindex $contents $i]} } incr i --- 3646,3653 ---- foreach {type name desc} $pdrc_options_h($op) {} switch $type { ! folders {incr i; lappend @$name [lindex $contents $i]} ! files {incr i; lappend @$name [lindex $contents $i]} ! void {set @$name 1} ! default {incr i; set @$name [lindex $contents $i]} } incr i *************** *** 3629,3637 **** }
! def pdrc_editor write {} { global pdrc_options pdrc_options_h cmdline set fd [open $cmdline(rcfilename) w] foreach {type name desc} $pdrc_options { ! set v $_($self:$name) set op [lindex [split $name |] 0] switch $type { --- 3655,3663 ---- }
! def PrefsDialog write {} { global pdrc_options pdrc_options_h cmdline set fd [open $cmdline(rcfilename) w] foreach {type name desc} $pdrc_options { ! set v $@$name set op [lindex [split $name |] 0] switch $type { *************** *** 3645,3689 **** }
! def pdrc_editor init {} { ! global _ pdrc_options $self read ! toplevel .$self set f .$self.1 - frame $f - frame $f.bar - frame $f.buttonsep -height 2 -borderwidth 1 -relief sunken - frame $f.main -borderwidth 1 -relief raised -width 600 -height 350 set section 0 foreach {type name desc} $pdrc_options { switch $type { void { set type toggle }} switch $type { ! section { ! incr section ! frame $f.main.$section ! pack [button $f.bar.$section -text $desc \ ! -command [list $self page_select $section]] -side left ! } alias {} radio { ! properties_dialog $self $f.main.$section pdrc_editor_ok \ [list [lindex $name 0] "$desc" choice {}] } default { ! #properties_dialog $self .$self.1.main.$section pdrc_editor_ok \ # [list $name "$name: $desc" $type {}] ! properties_dialog $self $f.main.$section pdrc_editor_ok \ [list $name $desc $type {}] } } } - cancel_apply_ok $self pdrc_editor $self page_select 1 - pack $f.bar -fill x - pack $f.buttonsep - pack $f.main -fill both -expand yes - pack $f }
! def Client pdrc_editor {} {pdrc_editor new_as pdrc}
############ other stuff ######### --- 3671,3701 ---- }
! def PrefsDialog init {} { ! global pdrc_options $self read ! super set f .$self.1 set section 0 foreach {type name desc} $pdrc_options { switch $type { void { set type toggle }} switch $type { ! section {$self add_section [incr section] $desc} alias {} radio { ! properties_dialog $self $f.main.$section PrefsDialog_ok \ [list [lindex $name 0] "$desc" choice {}] } default { ! #properties_dialog $self $f.main.$section PrefsDialog_ok \ # [list $name "$name: $desc" $type {}] ! properties_dialog $self $f.main.$section PrefsDialog_ok \ [list $name $desc $type {}] } } } $self page_select 1 }
! def PrefsDialog _delete {} {super; catch {destroy .popupMenu}}
############ other stuff #########