[PD-cvs] pd/src desire.tk,1.1.2.403,1.1.2.404

chunlee chunlee at users.sourceforge.net
Thu Aug 24 19:14:03 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
more for the ddrc editor with new format, it should work now


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.403
retrieving revision 1.1.2.404
diff -C2 -d -r1.1.2.403 -r1.1.2.404
*** desire.tk	24 Aug 2006 14:39:20 -0000	1.1.2.403
--- desire.tk	24 Aug 2006 17:14:00 -0000	1.1.2.404
***************
*** 5718,5721 ****
--- 5718,5743 ----
  
  def* ClientPrefsDialog read {} {
+ 	global ddrc_options cmdline look key
+ 	set fd [open $cmdline(ddrcfilename) "RDONLY CREAT"]
+ 	set contents [read $fd]
+ 	close $fd
+ 
+ 	foreach category_pair $contents {
+ 		#puts "reading category ---> [lindex $category 0]"
+ 		set category [lindex $category_pair 0]
+ 		foreach class_pair [lindex $category_pair 1] {
+ 			#puts "	reading class ---> [lindex $class 0]"
+ 			set class [lindex $class_pair 0]
+ 			foreach var_pair [lindex $class_pair 1] {
+ 				set var [lindex $var_pair 0]
+ 				set val [lindex $var_pair 1]
+ 				#puts "$category ($class:$var) ::: $val"
+ 				set ${category}($class:$var) $val
+ 			}
+ 		}
+ 	}
+ }
+ 
+ def* ClientPrefsDialog read2 {} {
  	global ddrc_options ddrc_options_h cmdline look key crosshair bar
  	set fd [open $cmdline(ddrcfilename) "RDONLY CREAT"]
***************
*** 5756,5763 ****
  #proc cdr {l} { lindex $l 1 }
  
  def* ClientPrefsDialog write {} {
! 	global ddrc_options ddrc_options_h cmdline look accels key crosshair
! 	#set fd [open $cmdline(ddrcfilename) w]
! 	set fd [open ~/.ddrc2 w]
  	set LOOK [list color crosshair bar]
  	set categories [list $LOOK key]; set categories2 [list look key]; set cat_count 0
--- 5778,5787 ----
  #proc cdr {l} { lindex $l 1 }
  
+ #this writes the ddrc
  def* ClientPrefsDialog write {} {
! 	global ddrc_options cmdline look accels key
! 	$self get_val
! 	set fd [open $cmdline(ddrcfilename) w]
! 	#set fd [open ~/.ddrc2 w]
  	set LOOK [list color crosshair bar]
  	set categories [list $LOOK key]; set categories2 [list look key]; set cat_count 0
***************
*** 5782,5786 ****
  				if {$sub != "key"} {set str "look($class:$y)"
  				} else {set str "key($class:$y)"}
! 				if {[info exists $str]} {lappend tmp2 [list $y [set [set str]]]}
  			}
  		set x [lsearch -start [expr $x+1] $tmp $class]
--- 5806,5812 ----
  				if {$sub != "key"} {set str "look($class:$y)"
  				} else {set str "key($class:$y)"}
! 				if {[info exists $str]} {
! 				lappend tmp2 [list $y [set [set str]]]
! 				}
  			}
  		set x [lsearch -start [expr $x+1] $tmp $class]
***************
*** 5795,5799 ****
  	incr cat_count
  	}
! 	set conf [list $conf]
  	puts $conf
  	puts $fd $conf
--- 5821,5825 ----
  	incr cat_count
  	}
! 	#set conf [list $conf]
  	puts $conf
  	puts $fd $conf
***************
*** 5802,5805 ****
--- 5828,5876 ----
  }
  
+ #this retrives the values set in the editor
+ def* ClientPrefsDialog get_val {} {
+ 	global ddrc_options look key	
+ 	set check_key {}
+ 	foreach {type class name} $ddrc_options {
+ 		switch $type {
+ 			color {
+ 				set str [string tolower $class$name]
+ 				set str2 ${str}path
+ 				set new_color [$@$str2 cget -background]
+ 				set look($class:$name) $new_color 
+ 			}
+ 			key {
+ 				foreach item $name {
+ 				set str [string tolower $class$item]
+ 				set str2 ${str}path
+ 				set new_key [$@$str2 get]
+ 				set old_key $key($class:$item)
+ 				if {$key($class:$item) != $new_key} {
+ 					if {[dict exists $accels $old_key]} {
+ 						set cmd [dict get $accels $old_key]
+ 						set accels [dict remove $accels $old_key]
+ 						dict set accels $new_key $cmd
+ 						puts "$new_key ::: $cmd"
+ 					}
+ 				}
+ 				if {[dict exists $check_key $new_key] && $new_key != ""} {
+ 					error "$new_key already assigned" 
+ 				} else {dict set check_key $new_key key($item)}
+ 					set key($class:$item) $new_key
+ 				}
+ 			
+ 			}
+ 			crosshair {
+ 				set var [string tolower $class$name]
+ 				set look($class:$name) $_($self:$var)
+ 			}
+ 			bar {
+ 				set var [string tolower $class$name]
+ 				set look($class:$name) $_($self:$var)
+ 			}
+ 		}
+ 	}
+ }
+ 
  def* ClientPrefsDialog write2 {} {
  	global ddrc_options ddrc_options_h cmdline look accels key crosshair
***************
*** 5907,5910 ****
--- 5978,5983 ----
  	    	set l {}
  		foreach item $name {
+ 		  set str0 [string tolower [lindex $name 0]]
+ 		  set str0 [string tolower $class$str0]
  		  set str [string tolower $class$item]
  		  set str2 ${str}path
***************
*** 5914,5922 ****
  		  #puts "	@$str /\/\ $key($class:$item)"
  		  #set @$var $which_section.[string tolower [lindex $name 0]].[string tolower $item]
! 		  set @$str2 $which_section.[string tolower [lindex $str 0]].[string tolower $item]
  		  lappend l $str
  		}
  		#$self add $which_section [list $name $type]
  		$self add $which_section [list $l $type]
  	    }
  	    crosshair {
--- 5987,5999 ----
  		  #puts "	@$str /\/\ $key($class:$item)"
  		  #set @$var $which_section.[string tolower [lindex $name 0]].[string tolower $item]
! 		  #set @$str2 $which_section.[string tolower [lindex $str 0]].[string tolower $str]
! 		  set @$str2 $which_section.$str0.[string tolower $str]
! 		  #set @$str2 $which_section.[string tolower [lindex $name 0]].[string tolower $str]
  		  lappend l $str
+ 		  #lappend l $name
  		}
  		#$self add $which_section [list $name $type]
  		$self add $which_section [list $l $type]
+ 		#$self add $which_section [list $l $type]
  	    }
  	    crosshair {





More information about the Pd-cvs mailing list