Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16436
Modified Files: Tag: devel_0_39 desire.tk Log Message: removed "ok" arg in properties_dialog and more bug fixing of pdrc read/write
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.298 retrieving revision 1.1.2.299 diff -C2 -d -r1.1.2.298 -r1.1.2.299 *** desire.tk 8 Aug 2006 16:22:47 -0000 1.1.2.298 --- desire.tk 8 Aug 2006 16:41:59 -0000 1.1.2.299 *************** *** 3317,3321 **** foreach prop [lrange $fields($class) 5 end] { - #puts "prop ::: $prop" switch $prop { w {set d [list $prop [say $prop] integer {-width 7}]} --- 3317,3320 ---- *************** *** 3353,3357 **** default {set d [list $prop "huh, [say $prop]" integer {}]} } ! properties_dialog $self .$self iemgui_ok $d } --- 3352,3356 ---- default {set d [list $prop "huh, [say $prop]" integer {}]} } ! properties_dialog $self .$self $d } *************** *** 3372,3376 **** yscale "Y units/px: " entry {-width 10} } ! properties_dialog $self .$self canvas_ok $props pack [checkbutton .$self.graphme -text "graph on parent" \ -variable @graphme -anchor w] -side top --- 3371,3375 ---- yscale "Y units/px: " entry {-width 10} } ! properties_dialog $self .$self $props pack [checkbutton .$self.graphme -text "graph on parent" \ -variable @graphme -anchor w] -side top *************** *** 3433,3437 **** wm title .$self "Atom" global properties ! properties_dialog $self .$self dogatom_ok $properties(gatom) foreach name {hi lo width} { bind .$self.$name.entry <KeyPress-Return> "$self ok" --- 3432,3436 ---- wm title .$self "Atom" global properties ! properties_dialog $self .$self $properties(gatom) foreach name {hi lo width} { bind .$self.$name.entry <KeyPress-Return> "$self ok" *************** *** 3465,3469 **** pack [label .$self.label -text "GRAPH BOUNDS"] -side top global properties ! properties_dialog $self .$self graph_ok $properties(graph) #.$self.xrangef.x2 select from 0 #.$self.xrangef.x2 select adjust end --- 3464,3468 ---- pack [label .$self.label -text "GRAPH BOUNDS"] -side top global properties ! properties_dialog $self .$self $properties(graph) #.$self.xrangef.x2 select from 0 #.$self.xrangef.x2 select adjust end *************** *** 3491,3495 **** n "size: " entry {} } ! properties_dialog $self .$self array_ok $props
pack [checkbutton .$self.saveme -text "save contents" -variable @saveit -anchor w] -side top --- 3490,3494 ---- n "size: " entry {} } ! properties_dialog $self .$self $props
pack [checkbutton .$self.saveme -text "save contents" -variable @saveit -anchor w] -side top *************** *** 4807,4811 **** }
! proc properties_dialog {self w ok struct} { #puts "self::: $self" #puts "w::: $w" --- 4806,4810 ---- }
! proc properties_dialog {self w struct} { #puts "self::: $self" #puts "w::: $w" *************** *** 4936,4943 **** pack $f.b -side top ! } libraries { ! set no_max_label 1 ! frame $f frame $f.a pack [label $f.label -text $label -width 20 -anchor e] -side left --- 4935,4942 ---- pack $f.b -side top ! } libraries { ! set no_max_label 1 ! frame $f frame $f.a pack [label $f.label -text $label -width 20 -anchor e] -side left *************** *** 4991,4995 **** 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 { --- 4990,4994 ---- eval "entry $f.entry -textvariable _($self:$name) $options" pack $f.entry -side left ! bind $f.entry <Return> "$self ok" switch -regexp -- $type { integer|float|fontsize { *************** *** 5321,5334 **** def ServerPrefsDialog apply {} {$self write}
! def* ServerPrefsDialog read {} { ! global pdrc_options pdrc_options_h cmdline ! set fd [open $cmdline(rcfilename) "RDONLY CREAT"] ! #set contents [split [string map {"\n" " "} [read $fd]] " "] ! set contents {} ! foreach line [split [read $fd] "\n"] { ! if {[string index $line 0] != "#"} {lappend contents $line} ! } ! close $fd ! set contents [concat [join $contents " "]] ;# concat casts to list type (faster) foreach {type names} $pdrc_options { switch $type { --- 5320,5325 ---- def ServerPrefsDialog apply {} {$self write}
! def* ServerPrefsDialog init_reverse_hash {} { ! global pdrc_options pdrc_options_h foreach {type names} $pdrc_options { switch $type { *************** *** 5341,5349 **** } } set i 0 while {$i < [llength $contents]} { set op [lindex $contents $i] - puts "op ::: $op" if {[string length $op]==0} {break} if {![info exists pdrc_options_h($op)]} { --- 5332,5350 ---- } } + } + + def* ServerPrefsDialog read {} { + global pdrc_options pdrc_options_h cmdline + set fd [open $cmdline(rcfilename) "RDONLY CREAT"] + set contents {} + foreach line [split [read $fd] "\n"] { + if {[string index $line 0] != "#"} {lappend contents $line} + } + close $fd + set contents [concat [join $contents " "]] ;# concat casts to list type (faster) set i 0 while {$i < [llength $contents]} { set op [lindex $contents $i] if {[string length $op]==0} {break} if {![info exists pdrc_options_h($op)]} { *************** *** 5379,5384 **** #files {foreach item $v {puts $fd "$name $item"}} void {if {$v != ""} {if {$v} {puts $fd $name}}} ! #radio {if {$v} {set t [lindex $names $v]; puts [split $t |]}} ! radio {puts $fd "$v"} default {if {[string length $v]} {puts $fd "$name $v"}} } --- 5380,5384 ---- #files {foreach item $v {puts $fd "$name $item"}} void {if {$v != ""} {if {$v} {puts $fd $name}}} ! radio {if {$v != "" && $v != "default"} {puts $fd "$v"}} default {if {[string length $v]} {puts $fd "$name $v"}} } *************** *** 5391,5394 **** --- 5391,5395 ---- def* ServerPrefsDialog init {} { global pdrc_options + $self init_reverse_hash $self read super *************** *** 5397,5409 **** foreach {type names} $pdrc_options { ! set label "" ! if {[llength $names] > 1} { ! set label [say [lindex $names 0]] ! puts "label::::: $label" ! } else { ! set name [lindex [split $names |] 0] ! set label [say $name] ! } ! if {[string length $label] > $@max_label} {set @max_label [string length $label]} } puts "max_label:::: $@max_label" --- 5398,5409 ---- foreach {type names} $pdrc_options { ! set label "" ! if {[llength $names] > 1} { ! set label [say [lindex $names 0]] ! } else { ! set name [lindex [split $names |] 0] ! set label [say $name] ! } ! if {[string length $label] > $@max_label} {set @max_label [string length $label]} } puts "max_label:::: $@max_label" *************** *** 5418,5437 **** foreach subname $names {lappend babble [lindex [split $subname |] 0]} puts "babble :::: $babble" ! properties_dialog $self $f.main.$section ServerPrefsDialog_ok \ ! [list $name $names choice {}] ! } ! folders { ! properties_dialog $self $f.main.$section ServerPrefsDialog_ok \ ! [list $name [say $name] $type {}] ! } ! libraries { ! properties_dialog $self $f.main.$section ServerPrefsDialog_ok \ ! [list $name [say $name] $type {}] ! } ! default { ! properties_dialog $self $f.main.$section ServerPrefsDialog_ok \ ! [list $name [say $name] $type {}] } ! } } --- 5418,5424 ---- foreach subname $names {lappend babble [lindex [split $subname |] 0]} puts "babble :::: $babble" ! properties_dialog $self $f.main.$section [list $name $names choice {}] } ! default {properties_dialog $self $f.main.$section [list $name [say $name] $type {}]} } } *************** *** 5445,5449 **** set ddrc_options { section section_color ! subsection canvas_color color canvasbgedit color canvasbgrun --- 5432,5436 ---- set ddrc_options { section section_color ! subsection canvas_color color canvasbgedit color canvasbgrun *************** *** 5643,5648 **** alias {} radio { ! properties_dialog $self $which_section ClientPrefsDialog_ok \ ! [list [lindex $name 0] "$desc" choice {}] } color { --- 5630,5634 ---- alias {} radio { ! properties_dialog $self $which_section [list [lindex $name 0] "$desc" choice {}] } color { *************** *** 5651,5656 **** set @$var $which_section.$name.color set @$name $look($name) ! properties_dialog $self $which_section ClientPrefsDialog_ok \ ! [list [lindex $name 0] [say $name] color {}] } key { --- 5637,5641 ---- set @$var $which_section.$name.color set @$name $look($name) ! properties_dialog $self $which_section [list [lindex $name 0] [say $name] color {}] } key { *************** *** 5660,5669 **** set @$var $which_section.[string tolower [lindex $name 0]].[string tolower $item] } ! properties_dialog $self $which_section ClientPrefsDialog_ok \ ! [list $name $name $type {}] } default { ! properties_dialog $self $which_section ClientPrefsDialog_ok \ ! [list $name [say $name] $type {}] } } --- 5645,5652 ---- set @$var $which_section.[string tolower [lindex $name 0]].[string tolower $item] } ! properties_dialog $self $which_section [list $name $name $type {}] } default { ! properties_dialog $self $which_section [list $name [say $name] $type {}] } }