Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32180
Modified Files: Tag: devel_0_39 desire.tk Log Message: rewrite def* IEMPropertiesDialog init
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.242 retrieving revision 1.1.2.243 diff -C2 -d -r1.1.2.242 -r1.1.2.243 *** desire.tk 13 Jun 2006 17:52:24 -0000 1.1.2.242 --- desire.tk 13 Jun 2006 21:21:58 -0000 1.1.2.243 *************** *** 956,980 **** }
! def* View popup_properties {} { ! global fields ! set class $@class ! if {![info exists fields($class)]} {set class obj} ! puts "this is a $@class class" ! puts "it has [llength $fields($class)] properties" ! ! PagedDialog new_as ${self}prefs ! ! #set f .$self.1 ! #set section 0 ! #set subsection 0 ! #foreach propertie $fields($class) { ! #switch $propertie { ! # bcol { ! # properties_dialog $which_self $which_section ClientPrefsDialog_ok \ ! # [list [lindex $name 0] [say $name] color {}] ! # } ! #} ! #} ! }
# in the future, one View may have several canvases. (??) --- 956,968 ---- }
! #def* View popup_properties {} { ! # global fields ! # set class $@class ! # if {![info exists fields($class)]} {set class obj} ! # puts "this is a $@class class" ! # puts "it has [llength $fields($class)] properties" ! # ! # PagedDialog new_as ${self}prefs ! #}
# in the future, one View may have several canvases. (??) *************** *** 2953,2957 **** }
! def BlueBox popup_properties {} {IEMPropertiesDialog new $self}
class_new PropertiesDialog {Dialog} --- 2941,2945 ---- }
! def* BlueBox popup_properties {} {IEMPropertiesDialog new $self}
class_new PropertiesDialog {Dialog} *************** *** 2964,3032 **** class_new IEMPropertiesDialog {PropertiesDialog}
! def IEMPropertiesDialog init {of} { ! global classinfo fields ! super $of ! ! # cloning contents of the $of object, except for some little exceptions ! foreach var {snd rcv lab} { ! catch {set val $_($@of:$var); switch -- $val { empty {set val ""}}; set @$var $val} ! } ! foreach var {w h hold break ldx ldy fstyle fs is_log steady min max ! on nonzero val change log_height hh isa} { ! catch {set @$var $_($of:$var)} ! } ! foreach var {bcol fcol lcol} { ! catch {set @$var [parse_color $_($of:$var)]} ! } ! ! set @loadbang [expr $@isa & 1] ! set @scale [expr ($@isa>>20) & 1] ! ! set @class $_($of:class) ! post %s "$self = IEMPropertiesDialog $of" ! set id .$self ! wm title $id "$classinfo($@class) Properties" ! wm protocol $id WM_DELETE_WINDOW "iemgui_cancel $id" ! set props {} ! ! set fi $fields($@class) ! ! if {[lsearch $fi w]>=0} {lappend props w "width(px): " integer {-width 7}} ! if {[lsearch $fi h]>=0} {lappend props h "height(px): " integer {-width 7}} ! if {[lsearch $fi hold]>=0} {lappend props hold "hold time(ms): " float {-width 9}} ! if {[lsearch $fi break]>=0} {lappend props break "break time(ms): " float {-width 9}}
! if {[lsearch $fi min]>=0} {lappend props min "minimum value: " float {-width 9}} ! if {[lsearch $fi max]>=0} {lappend props max "maximum value: " float {-width 9}} ! if {[lsearch $fi is_log]>=0} {lappend props is_log [list "Mode: " "linear" "logarithmic"] choice {}} ! if {[lsearch $fi isa]>=0} {lappend props loadbang "init" toggle {}} ! if {[lsearch $fi n]>=0} {lappend props n "n: " integer {-width 4}} ! if {[lsearch $fi steady]>=0} {lappend props steady [list "Steadiness: " "jump on click" "steady on click"] choice {}} ! properties_dialog $self .$self iemgui_ok $props ! set props {} ! if {[lsearch $fi snd]>=0} {lappend props snd "send-symbol: " entry {-width 20}} ! if {[lsearch $fi rcv]>=0} {lappend props rcv "receive-symbol: " entry {-width 20}} ! lappend props lab "label: " entry {-width 20} ! lappend props ldx "label x offset: " entry {-width 5} ! lappend props ldy "label y offset: " entry {-width 5} ! lappend props fstyle {"Typeface: " "courier (typewriter)" "helvetica (sansserif)" "times (serif)"} choice {} ! lappend props fs "font size: " fontsize {-width 5} ! lappend props bcol "background color: " color {} ! if {[lsearch $fi fcol]>=0} {lappend props fcol "foreground color: " color {}} ! lappend props lcol "label color: " color {} ! properties_dialog $self .$self iemgui_ok $props ! ! if {[info tclversion] < 8.4} { ! bind $id <Key-Tab> {tkTabToWindow [tk_focusNext %W]} ! bind $id <<PrevWindow>> {tkTabToWindow [tk_focusPrev %W]} ! } else { ! bind $id <Key-Tab> {tk::TabToWindow [tk_focusNext %W]} ! bind $id <<PrevWindow>> {tk::TabToWindow [tk_focusPrev %W]} ! } ! catch { ! $id.w.entry select from 0 ! $id.w.entry select adjust end ! } ! focus $id.w.entry }
--- 2952,3019 ---- class_new IEMPropertiesDialog {PropertiesDialog}
! def* IEMPropertiesDialog init {of} { ! global classinfo fields ! super $of
! set class $_($of:class) ! if {![info exists fields($class)]} {set class obj} ! puts "this is a $_($of:class) class" ! puts "it has [llength $fields($class)] properties" ! #clone values ! foreach var $fields($class) { ! set val $_($of:$var) ! switch -- $val { empty {set val ""}} ! if {[regexp -nocase {^([a-z])col$} $var]} {set val [parse_color $val]} ! set @$var $val ! } ! set @loadbang [expr $@isa & 1] ! set @scale [expr ($@isa>>20) & 1] ! set @class $_($of:class) ! # the longest label is... ! foreach propertie $fields($class) { ! set label [say $propertie] ! if {[string length $label] > $@max_label} {set @max_label [string length $label]} ! } ! ! foreach propertie $fields($class) { ! #puts "propertie ::: $propertie" ! switch $propertie { ! w {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] integer {-width 7}]} ! h {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] integer {-width 7}]} ! hold {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] float {-width 9}]} ! break {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] float {-width 9}]} ! min {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] float {-width 9}]} ! max {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] float {-width 9}]} ! is_log { ! set options [list [say $propertie] [say linear] [say logarithmic]] ! properties_dialog $self .$self iemgui_ok [list $propertie $options choice {}] ! } ! isa { ! set options [list [say $propertie] [say yes] [say no]] ! properties_dialog $self .$self iemgui_ok [list $propertie $options choice {}] ! } ! n {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] integer {-width 4}]} ! steady { ! set options [list [say $propertie] [say jump] [say steady]] ! properties_dialog $self .$self iemgui_ok [list $propertie $options choice {}] ! } ! snd {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] entry {-width 20}]} ! rcv {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] entry {-width 20}]} ! lab {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] entry {-width 20}]} ! labx {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] entry {-width 5}]} ! laby {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] entry {-width 5}]} ! fstyle { ! set options [list [say $propertie] "courier (typewriter)" "helvetica (sansserif)" "times (serif)"] ! properties_dialog $self .$self iemgui_ok [list $propertie $options choice {}] ! } ! fs {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] fontsize {-width 5}]} ! bcol {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] color {}]} ! fcol {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] color {}]} ! lcol {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] color {}]} ! } ! } ! ! ! #puts "$self = IEMPropertiesDialog $of" }
*************** *** 4219,4223 **** frame $f set i 0 ! pack [label $f.label -text [lindex $label 0]] $f -side left # this which is not good, need to sort it out... set m [menu $f.$name -tearoff 0] --- 4206,4211 ---- frame $f set i 0 ! label $f.label -text [lindex $label 0] ! #pack [label $f.label -text [lindex $label 0]] $f -side left # this which is not good, need to sort it out... set m [menu $f.$name -tearoff 0] *************** *** 4228,4232 **** label $f.label_set -text "default" -relief raised balloon $f.label_set "click to change setting" ! pack $f.label_set -side top -fill x # need to sort this out....... bind $f.label_set <1> "tk_popup $f.$name [expr %X - 100] %Y" --- 4216,4220 ---- label $f.label_set -text "default" -relief raised balloon $f.label_set "click to change setting" ! pack $f.label $f.label_set -side left # need to sort this out....... bind $f.label_set <1> "tk_popup $f.$name [expr %X - 100] %Y" *************** *** 4301,4306 **** } pack $f -side top -fill x ! catch {$f.label configure -width 45 -anchor e} } }
--- 4289,4296 ---- } pack $f -side top -fill x ! #catch {$f.label configure -width 45 -anchor e} ! catch {$f.label configure -width $_($self:max_label) -anchor e} } + }
*************** *** 4381,4384 **** --- 4371,4375 ---- def Dialog init {} { set f .$self + set @max_label 0 toplevel $f frame $f.buttonsep -height 2 -borderwidth 1 -relief sunken *************** *** 4589,4592 **** --- 4580,4584 ---- set babble {} foreach subname $names {lappend babble [say [lindex [split $subname |] 0]]} + puts "babble :::: $babble" properties_dialog $self $f.main.$section ServerPrefsDialog_ok \ [list [lindex $name 0] $babble choice {}] *************** *** 4774,4777 **** --- 4766,4783 ---- set section 0 set subsection 0 + + foreach {type names} $ddrc_options { + set label "" + + if {[llength $names] > 1} { + foreach name $names { + append label " [say $name]" + } + } else { + set label [say $names] + } + if {[string length $label] > $@max_label} {set @max_label [string length $label]} + } + foreach {type names} $ddrc_options { set name [lindex [split $names |] 0]