[PD-cvs] pd/src desire.tk,1.1.2.244,1.1.2.245

chunlee chunlee at users.sourceforge.net
Wed Jun 14 20:20:49 CEST 2006


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27697

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
more changes/fixes for the properties dialog...


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.244
retrieving revision 1.1.2.245
diff -C2 -d -r1.1.2.244 -r1.1.2.245
*** desire.tk	13 Jun 2006 23:18:59 -0000	1.1.2.244
--- desire.tk	14 Jun 2006 18:20:46 -0000	1.1.2.245
***************
*** 1796,1800 ****
      if {[llength [$c gettags lnew]]} {
  	mset {ox1 oy1 ox2 oy2} [lrange [$c coords lnew] end-3 end]
! 	puts "ox1=$ox1 oy1=$oy1 x=$x y=$y"
  	set l [$c coords lnew]
  	if {[llength $l]<4 || [distance [list $ox1 $oy1] [list $x $y]] < 30} {
--- 1796,1800 ----
      if {[llength [$c gettags lnew]]} {
  	mset {ox1 oy1 ox2 oy2} [lrange [$c coords lnew] end-3 end]
! 	#puts "ox1=$ox1 oy1=$oy1 x=$x y=$y"
  	set l [$c coords lnew]
  	if {[llength $l]<4 || [distance [list $ox1 $oy1] [list $x $y]] < 30} {
***************
*** 2952,2955 ****
--- 2952,2990 ----
  class_new IEMPropertiesDialog {PropertiesDialog}
  
+ def* IEMPropertiesDialog cancel {} {$self _delete}
+ 
+ def* IEMPropertiesDialog apply {} {
+ 	global fields classinfo
+ 	set class $_($@of:class)
+ 	if {![info exists fields($class)]} {set class obj}
+ 	puts "this is a $_($@of:class) class"
+ 	set orig {}
+ 	set props ".$@of reload"
+ 	set props2 {}
+         foreach var [lrange $fields($class) 5 end] {
+ 	
+ 	#puts "$var --from-- $_($@of:$var)  --to-- $@$var"
+ 	lappend orig $_($@of:$var)
+ 	lappend props2 $@$var
+ 	
+ 	switch $var {
+ 		is_log {if {$@$var == "linear"} {set val 1} else { set val 0}}
+ 		isa {if {$@$var == "yes"} {set val 1} else { set val 0}}
+ 		steady {if {$@$var == "jump"} {set val 1} else { set val 0}}
+ 		fstyle {if {$@$var == "yes"} {set val 1} else { set val 0}}
+ 		default {set val $@$var}
+ 		}
+ 	if {[regexp -nocase {^([a-z])col$} $var]} {set val [unparse_color $val]; puts "color ---- > $val"}
+ 	switch -- $val { {} {set val "empty"}}
+ 	set props "$props $val"
+ 	
+ 	} 
+ 	
+ 	puts "orig props:: $orig"
+ 	puts "inter props:: $props2"
+ 	puts "real props:: $props"
+ 	pd $props
+ }
+ 
  def* IEMPropertiesDialog init {of} {
  	global classinfo fields
***************
*** 2968,2972 ****
  			steady {if {$_($of:$var)} {set val "jump"} else { set val "steady"}}
  			fstyle {if {$_($of:$var)} {set val "yes"} else { set val "no"}}
! 			default {set val $_($of:$var); puts "here............."}
  		}
  		#set val $_($of:$var)
--- 3003,3007 ----
  			steady {if {$_($of:$var)} {set val "jump"} else { set val "steady"}}
  			fstyle {if {$_($of:$var)} {set val "yes"} else { set val "no"}}
! 			default {set val $_($of:$var)}
  		}
  		#set val $_($of:$var)
***************
*** 3011,3016 ****
  		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" "helvetica" "times"]
--- 3046,3051 ----
  		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}]}
! 		ldx {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] entry {-width  5}]}
! 		ldy {properties_dialog $self .$self iemgui_ok [list $propertie [say $propertie] entry {-width  5}]}
  		fstyle {
  		set options [list  [say $propertie] "courier" "helvetica" "times"]
***************
*** 4132,4174 ****
  
  ############ properties_dialog #########
- 
- proc color_popup_select {self name c} {
- 	global _ preset_colors
- 	#set _($self:$name) $c
- 	set fg_color [complement [format #%6.6x $c]]
- 	.$self.$name configure \
- 		-background [format #%6.6x $c] -foreground $fg_color -text [format #%6.6x $c]
- 		#-background [format #%6.6x $_($self:$name)] -foreground $fg_color
- 		# somehow this hilites one more pixel outside of what it should be
- 		#-highlightbackground [format #%6.6x $_($self:$name)]
- }
- 
- proc* color_popup {self w name i} {
- 	set self [string trimleft $self .]
- 	set old_w $w.$name
- 	set w $w.$name.popup
- 	if [winfo exists $w] {destroy $w}
- 	menu $w -tearoff false
- 	global preset_colors
- 	for {set i 0} {$i<[llength $preset_colors]} {incr i} {
- 		set c [lindex $preset_colors $i]
- 		$w add command -label "     " \
- 		-background "#$c" -activebackground "#$c" \
- 		-command [list color_popup_select $self $name [expr 0x$c]]
- 	}
- 	tk_popup $w [expr [winfo rootx $old_w]] [expr [winfo rooty $old_w]]
- }
- 
- proc iemgui_choose_col {id var title} {
-     set self [string trimleft $id .]
-     global _ look
-     set c 0xFFFFFF
-     set color [tk_chooseColor -title $title -initialcolor $title]
-     if {$color != ""} {
-     	$id.$var configure -text $color
- 	color_popup_select $self $var [expr [string replace $color 0 0 "0x"]&0xFFFFFF]
-     }
- }
- 
  proc change_entry {self val} {
  	set v [expr [$self get]+$val]
--- 4167,4170 ----
***************
*** 4206,4214 ****
  		set text_color [complement $_($self:$name)]
  		button $f.color -text $_($self:$name) -font {Courier 10} -width 10 -pady 2 -fg $text_color \
! 			-command [list iemgui_choose_col $w $name.color $_($self:$name)] \
  			-relief sunken -background $_($self:$name) \
  			-highlightbackground [format #%6.6x $c] -activebackground [darker $_($self:$name)]
  		set i 10
! 		button $f.preset -text "..." -pady 2 -font {Helvetica 8} -command [list color_popup $w $w $name.color $i]
  		pack  $f.label $f.color $f.preset -side left
  	    }
--- 4202,4210 ----
  		set text_color [complement $_($self:$name)]
  		button $f.color -text $_($self:$name) -font {Courier 10} -width 10 -pady 2 -fg $text_color \
! 			-command [list $self choose_col $f $name $_($self:$name)] \
  			-relief sunken -background $_($self:$name) \
  			-highlightbackground [format #%6.6x $c] -activebackground [darker $_($self:$name)]
  		set i 10
! 		button $f.preset -text "..." -pady 2 -font {Helvetica 8} -command [list $self color_popup $f $name $i]
  		pack  $f.label $f.color $f.preset -side left
  	    }
***************
*** 4221,4228 ****
  		set m [menu $f.$name -tearoff 0]
  		foreach part [lrange $label 1 end] {
! 			$m add command -label [say $part] -command [list dropmenu_set $f [say $part]]
  			
  		}
- 		puts "name ________ $name"
  		label $f.label_set -text [say $_($self:$name)] -relief raised -width 20
  		balloon $f.label_set "click to change setting"
--- 4217,4223 ----
  		set m [menu $f.$name -tearoff 0]
  		foreach part [lrange $label 1 end] {
! 			$m add command -label [say $part] -command [list  $self dropmenu_set $f $name $part]
  			
  		}
  		label $f.label_set -text [say $_($self:$name)] -relief raised -width 20
  		balloon $f.label_set "click to change setting"
***************
*** 4342,4349 ****
  }
  
- proc dropmenu_set {frame name} {
- 	$frame.label_set configure -text $name
- 	puts "$name is selected in the drop down menu!!!"
- }
  
  # this makes the tooltip
--- 4337,4340 ----
***************
*** 4375,4384 ****
  class_new Dialog
  #what's the difference between ok and apply? 
! def Dialog ok      {} {$self apply; $self cancel}
  def Dialog cancel  {} {}
  def Dialog apply   {} {}
  def* Dialog _delete {} {destroy .$self}
  
! def Dialog init {} {
      set f .$self
      set @max_label 0
--- 4366,4375 ----
  class_new Dialog
  #what's the difference between ok and apply? 
! def* Dialog ok      {} {$self apply; $self cancel}
  def Dialog cancel  {} {}
  def Dialog apply   {} {}
  def* Dialog _delete {} {destroy .$self}
  
! def* Dialog init {} {
      set f .$self
      set @max_label 0
***************
*** 4395,4398 ****
--- 4386,4429 ----
  }
  
+ def* Dialog dropmenu_set {frame var val} {
+ 	$frame.label_set configure -text [say $val]
+ 	set _($self:$var) $val
+ }
+ 
+ 
+ def* Dialog color_popup_select {frame var color} {
+ 	global _ preset_colors
+ 	#puts " --------------- self:$self name:$var c:$color"
+ 	set @$var $color
+ 	set fg_color [complement [format #%6.6x $color]]
+ 	$frame.color configure \
+ 		-background [format #%6.6x $color] -foreground $fg_color -text [format #%6.6x $color]
+ }
+ 
+ def* Dialog color_popup {frame var i} {
+ 	set w $frame.color.popup
+ 	if [winfo exists $w] {destroy $w}
+ 	menu $w -tearoff false
+ 	global preset_colors
+ 	for {set i 0} {$i<[llength $preset_colors]} {incr i} {
+ 		set c [lindex $preset_colors $i]
+ 		$w add command -label "     " \
+ 		-background "#$c" -activebackground "#$c" \
+ 		-command [list $self color_popup_select $frame $var [expr 0x$c]]
+ 	}
+ 	tk_popup $w [expr [winfo rootx .$self.$var.color]] [expr [winfo rooty $frame.color]]
+ }
+ 
+ def* Dialog choose_col {frame var val} {
+     global _ look
+     set c 0xFFFFFF
+     set color [tk_chooseColor -title $val -initialcolor $val]
+     if {$color != ""} {
+     	$frame.color configure -text $color
+ 	$self color_popup_select $frame $var [expr [string replace $color 0 0 "0x"]&0xFFFFFF]
+     }
+ }
+ 
+ 
  class_new PagedDialog {Dialog}
  





More information about the Pd-cvs mailing list