[PD-cvs] pd/src desire.tk,1.1.2.265,1.1.2.266

Mathieu Bouchard matju at users.sourceforge.net
Thu Jun 29 18:48:43 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
cleanup


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.265
retrieving revision 1.1.2.266
diff -C2 -d -r1.1.2.265 -r1.1.2.266
*** desire.tk	25 Jun 2006 11:36:57 -0000	1.1.2.265
--- desire.tk	29 Jun 2006 16:48:41 -0000	1.1.2.266
***************
*** 1435,1438 ****
--- 1435,1439 ----
      #$self update_size
      global font look
+     super
      mset {x1 y1} [$self xy]
  	set l {}
***************
*** 1565,1575 ****
  }
  
! def* ObjectBox draw {} {
! 	$self update_size
  	set xs $@xs
  	set ys $@ys
  	set ins $@ninlets
  	set outs $@noutlets
-         global look font
          mset {x1 y1} [$self xy]
  	set x2 [expr $x1+$xs]
--- 1566,1576 ----
  }
  
! def ObjectBox draw_box {} {
!         global look font
! 	super
  	set xs $@xs
  	set ys $@ys
  	set ins $@ninlets
  	set outs $@noutlets
          mset {x1 y1} [$self xy]
  	set x2 [expr $x1+$xs]
***************
*** 1581,1584 ****
--- 1582,1592 ----
  	$self item BASE2 line      $xyb -fill $look(objectframe2)
  	$self item BASE3 line      $xyc -fill $look(objectframe3)
+ }
+ 
+ def* ObjectBox draw {} {
+ 	$self update_size
+ 	super
+         global look font
+         mset {x1 y1} [$self xy]
          io_draw $self
          if {[$self selected?]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
***************
*** 2445,2449 ****
  def* Box connect_out {} {}
  def* Box connect_in {} {}
! def Box draw {} {}
  def* Box edit {} {}
  def* Box unedit {} {}
--- 2453,2458 ----
  def* Box connect_out {} {}
  def* Box connect_in {} {}
! def Box draw {} {$self draw_box}
! def Box draw_box {} {}
  def* Box edit {} {}
  def* Box unedit {} {}
***************
*** 2692,2696 ****
  set classinfo(canvas)  {Canvas}
  set classinfo(cnv)     {Cnv}
! set classinfo(text)    {Comment}
  set classinfo(floatatom)   {FloatAtom}
  set classinfo(symbolatom) {SymbolAtom}
--- 2701,2705 ----
  set classinfo(canvas)  {Canvas}
  set classinfo(cnv)     {Cnv}
! set classinfo(comment)       {Comment}
  set classinfo(floatatom)   {FloatAtom}
  set classinfo(symbolatom) {SymbolAtom}
***************
*** 2746,2750 ****
  		}
  		
! 		if {$class == "msg"} {set _($x:text) [join [lrange $d 4 end]];set _($x:class) "msg"}
  
  		$x init
--- 2755,2766 ----
  		}
  		
! 		if {$class == "msg"} {
! 			set _($x:text) [join [lrange $d 4 end]]
! 			set _($x:class) "msg"
! 		}
! 		if {$class == "comment"} {
! 			set _($x:text) [join [lrange $d 4 end]]
! 			set _($x:class) "comment"
! 		}
  
  		$x init
***************
*** 2794,2797 ****
--- 2810,2815 ----
  	
  	if {![info exists fields($class)]} {set class obj}
+ 	if {$class == "comment"}           {set class comment}
+ 
  	set i 0
  	foreach f $fields($class) {
***************
*** 2929,2935 ****
  # it shouldn't have mattered, but super doesn't support proper pruning yet
  class_new AtomBox {Box}
! def* AtomBox draw {} {
  	global font look
- 	$self update_size
  	mset {x1 y1} [$self xy]
  	set x2 [expr $x1+$@xs]
--- 2947,2952 ----
  # it shouldn't have mattered, but super doesn't support proper pruning yet
  class_new AtomBox {Box}
! def* AtomBox draw_box {} {
  	global font look
  	mset {x1 y1} [$self xy]
  	set x2 [expr $x1+$@xs]
***************
*** 2941,2944 ****
--- 2958,2967 ----
  	if {[$self selected?]} {set frcol $look(objectframe4)} {set frcol $look(objectframe3)}
  	.$@canvas.c itemconfigure ${self}BASE -outline $frcol
+ }
+ 
+ def* AtomBox draw {} {
+ 	global font look
+ 	$self update_size
+ 	$self draw_box
  
  	mset {x1 y1} [$self xy]
***************
*** 2958,2963 ****
  
  #class_new Comment {View}
! class_new Comment {Box}
! def Comment draw {} {
  	super
  	# should draw uh...
--- 2981,2986 ----
  
  #class_new Comment {View}
! class_new Comment {TextBox}
! def* Comment draw {} {
  	super
  	# should draw uh...
***************
*** 2967,2971 ****
  #class_new BlueBox {Box Labeled}
  
! def* BlueBox draw {} {
  	global look
  	super
--- 2990,2994 ----
  #class_new BlueBox {Box Labeled}
  
! def* BlueBox draw_box {} {
  	global look
  	super
***************
*** 3515,3520 ****
  def* NumBox motion {x y mod} {
  	set focused [$self == [$@canvas focus]]
! 	if {!$focused} {return}
! 	if {$@clicking} {
  	mset {ox oy} $@mouse
  	set @val [expr $@val-$@rate*($y-$oy)]
--- 3538,3542 ----
  def* NumBox motion {x y mod} {
  	set focused [$self == [$@canvas focus]]
! 	if {!$focused || !$@clicking} {return}
  	mset {ox oy} $@mouse
  	set @val [expr $@val-$@rate*($y-$oy)]
***************
*** 3522,3528 ****
  	set @text $@val
  	set @mouse [list $x $y]
! 	pd .$self float $@val;
! 	pd .$self bang;
! 	}
  }
  
--- 3544,3549 ----
  	set @text $@val
  	set @mouse [list $x $y]
! 	pd .$self float $@val
! 	pd .$self bang
  }
  
***************
*** 3758,3761 ****
--- 3779,3783 ----
  
  def Labeled draw {} {
+ 	super
  	mset {x1 y1} [$self xy]
  	set lx [expr $x1+$@ldx]
***************
*** 3783,3789 ****
  }
  
- def* Bang properties {} {
- }
- 
  def Bang bbox {} {
  	mset {x1 y1} [$self xy]
--- 3805,3808 ----
***************
*** 3795,3806 ****
  	mset {x1 y1 x2 y2} [$self bbox]
  	if {$@flash} {
! 	.$@canvas.c itemconfigure ${self}BUT -fill [bluify [parse_color $@fcol]]
! 	after 100 [list .$@canvas.c itemconfigure ${self}BUT -fill [bluify [parse_color $@bcol]]]
! 	set $@flash 0
  	} else {
! 	set colour [parse_color $@bcol]
! 	$self item BUT oval \
! 		[list [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2]] \
! 		-fill [bluify $colour] -tags "${self}BUT $self"
  	}
  }
--- 3814,3824 ----
  	mset {x1 y1 x2 y2} [$self bbox]
  	if {$@flash} {
! 		.$@canvas.c itemconfigure ${self}BUT -fill [bluify [parse_color $@fcol]]
! 		after 100 [list .$@canvas.c itemconfigure ${self}BUT -fill [bluify [parse_color $@bcol]]]
! 		set $@flash 0
  	} else {
! 		set colour [parse_color $@bcol]
! 		set rect [list [expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2]]
! 		$self item BUT oval $rect -fill [bluify $colour] -tags "${self}BUT $self"
  	}
  }
***************
*** 3812,3816 ****
  	$@canvas focus= $self
  	pd .$self bang
- 	#$self bang
  }
  
--- 3830,3833 ----
***************
*** 3853,3861 ****
  }
  
- #def Toggle erase {} {
- #	io_erase $self
- #	$@canvas delete ${self}BUT ${self}LABEL ${self}X1 ${self}X2
- #}
- 
  def* Toggle click {x y b f} {
  	pd .$self bang
--- 3870,3873 ----
***************
*** 3961,3972 ****
      super
      if {$isnew} {
! 	canvas $@canvas.${self}DROP -width $xs -height $xs -bg $colour -highlightbackground $lcolour -highlightcolor $colour
! 	$@canvas create window [expr $x1 + 7] [expr $y1 - 2] -window $@canvas.${self}DROP -anchor nw -tags $@canvas.${self}window
! 	dnd bindtarget $@canvas.${self}DROP text/uri-list <Drop> "pd \"x[list ${self}] symbol \[ enquote %D \] ;\""
      } {
  	$@canvas coords $@canvas.${self}window [expr $x1 + 7] [expr $y1 - 2]
! 	$@canvas.${self}DROP configure -width $xs -height $xs -bg $colour -highlightbackground $lcolour -highlightcolor $colour
      }
-     return
  }
  
--- 3973,3987 ----
      super
      if {$isnew} {
! 	canvas $@canvas.${self}DROP -width $xs -height $xs -bg $colour \
! 		-highlightbackground $lcolour -highlightcolor $colour
! 	$@canvas create window [expr $x1 + 7] [expr $y1 - 2] \
! 		-window $@canvas.${self}DROP -anchor nw -tags $@canvas.${self}window
! 	dnd bindtarget $@canvas.${self}DROP text/uri-list <Drop> \
! 		"pd \"x[list ${self}] symbol \[ enquote %D \] ;\""
      } {
  	$@canvas coords $@canvas.${self}window [expr $x1 + 7] [expr $y1 - 2]
! 	$@canvas.${self}DROP configure -width $xs -height $xs -bg $colour \
! 		-highlightbackground $lcolour -highlightcolor $colour
      }
  }
  
***************
*** 4247,4261 ****
  def Completion init {name x y textbox} {super $name $x $y $textbox}
  
- 
  def* ClassBrowser cancel {} {$self _delete}
  def* ClassBrowser _delete {} {set @exist 0; super}
  
  def* ClassBrowser init {name x y textbox} {
! 	super
  	set @name $name
  	set @focus ".completion.comp"
  	set @x $x
  	set @y $y
- 	set @size 0
  	set @width 0
  	set @height 0
--- 4262,4274 ----
  def Completion init {name x y textbox} {super $name $x $y $textbox}
  
  def* ClassBrowser cancel {} {$self _delete}
  def* ClassBrowser _delete {} {set @exist 0; super}
  
  def* ClassBrowser init {name x y textbox} {
! 	#super
  	set @name $name
  	set @focus ".completion.comp"
  	set @x $x
  	set @y $y
  	set @width 0
  	set @height 0
***************
*** 4269,4273 ****
  def* ClassBrowser fill_box {s listbox} {
  	global class_list
- 	set n 0
  	$listbox delete 0 end
  	foreach class $class_list {
--- 4282,4285 ----
***************
*** 4279,4300 ****
  			}
  			$listbox insert end $t
- 			set t "$class : [say $class]"
- 			$listbox insert end $t
  			if {[string length $t] > [string length $@width]} {set @width [string length $t]}
- 			incr n
  		}
  	}
- 	if {$@name == "browser"} {
- 		.$self.title configure -text [format [say how_many_object_classes] $n [llength $class_list]]
- 	}
  	$listbox selection set 0 0
! 	set @size [$listbox size]
! 	puts "matches ::: $@size |||| width ::: $@width |||| height ::: $@height"
  	wm maxsize .$self [winfo reqwidth .$self.comp] [winfo reqheight .$self.comp]
  }
  
! def ClassBrowser search_for_externs {} {
! 	global pd_path
  	global class_list
  	foreach dir $pd_path {
  		catch {
--- 4291,4315 ----
  			}
  			$listbox insert end $t
  			if {[string length $t] > [string length $@width]} {set @width [string length $t]}
  		}
  	}
  	$listbox selection set 0 0
! 	puts "matches ::: [$@listbox size] |||| width ::: $@width |||| height ::: $@height"
! }
! 
! def* Completion fill_box {s listbox} {
! 	super $s $listbox
  	wm maxsize .$self [winfo reqwidth .$self.comp] [winfo reqheight .$self.comp]
  }
  
! def* Browser fill_box {s listbox} {
  	global class_list
+ 	super $s $listbox
+ 	.$self.title configure -text [format [say how_many_object_classes] \
+ 		[$listbox size] [llength $class_list]]
+ }
+ 
+ def ClassBrowser search_for_externs {} {
+ 	global pd_path class_list
  	foreach dir $pd_path {
  		catch {
***************
*** 4330,4333 ****
--- 4345,4349 ----
  	text    $f.3 -width 30 -height 20 -yscrollcommand "$f.4 set"
  	scrollbar $f.4 -command "$f.3 yview"
+ 	set @listbox $f.1
  
  	frame $f.5
***************
*** 4366,4369 ****
--- 4382,4386 ----
  	set canvas $@name
  	set f .$self.comp
+ 	set @listbox $f
  	set rootx [winfo rootx .$@name.c]
  	set rooty [winfo rooty .$@name.c]
***************
*** 4372,4390 ****
  		set cut [string first "text" $textself]
  		set textself [string range $textself 0 [expr $cut -1]]
! 		}
  	mset {x1 y1 x2 y2} [$textself bbox]
  	if {$look(showcomp) <= 20} {
  		set @height $look(showcomp)} else {set @height 20}
! 	listbox $f -width $@width -height $@height -relief flat -bg $look(canvasbgedit) \
! 	        -selectbackground [complement $look(objectfg)] -activestyle dotbox -selectforeground $look(objectfg)
  	$self fill_box [$@textbox get 1.0 1.end] $f
  	$f configure -width $@width
! 	set box_width [winfo reqwidth $f] 
! 	set box_height [winfo reqheight $f] 	
! 	pack $f	-side left -expand yes
! 			
  	.$self configure -width $box_width
  	.$self configure -height $box_height
! 			
  	#test the right edge of the screen, assuming the left edge has enough space
  	if {[expr $x1+$rootx+$box_width] < [lindex $max 0]} {
--- 4389,4408 ----
  		set cut [string first "text" $textself]
  		set textself [string range $textself 0 [expr $cut -1]]
! 	}
  	mset {x1 y1 x2 y2} [$textself bbox]
  	if {$look(showcomp) <= 20} {
  		set @height $look(showcomp)} else {set @height 20}
! 	listbox $f -width $@width -height $@height -relief flat \
! 		-bg $look(canvasbgedit) -selectbackground [complement $look(objectfg)] \
! 		-activestyle dotbox -selectforeground $look(objectfg)
  	$self fill_box [$@textbox get 1.0 1.end] $f
  	$f configure -width $@width
! 	set box_width [winfo reqwidth $f]
! 	set box_height [winfo reqheight $f]
! 	pack $f -side left -expand yes
! 
  	.$self configure -width $box_width
  	.$self configure -height $box_height
! 
  	#test the right edge of the screen, assuming the left edge has enough space
  	if {[expr $x1+$rootx+$box_width] < [lindex $max 0]} {
***************
*** 4392,4396 ****
  	} else {
  		set box_x [expr $x2 - $box_width + $rootx]
! 		}
  	#test the lower edge of the screen, assuming the upper edge has enough space
  	if {[expr $y2+$rooty+$box_height] < [lindex $max 1]} {
--- 4410,4414 ----
  	} else {
  		set box_x [expr $x2 - $box_width + $rootx]
! 	}
  	#test the lower edge of the screen, assuming the upper edge has enough space
  	if {[expr $y2+$rooty+$box_height] < [lindex $max 1]} {
***************
*** 4398,4415 ****
  	} else {
  		set box_y [expr $y1 - $box_height - 2 + $rooty]
! 		}
  
  	wm geometry .$self [winfo reqwidth .$self]x[winfo reqheight .$self]+$box_x+$box_y
! 					
  	bind $f <Button-1> "after 1 \"$self focus_switch Up $@textbox $f \""
  	bind $f <KeyPress> "$self focus_switch %K $@textbox $f"
  	bind $f <Return> "after 1 \"$self complete $f \""
  	bind Text <Tab> "$self tab $@textbox $f; continue"
- 	#bind $@textbox <KeyPress> "after 1 \"$self focus_switch %K $@textbox $f \""
  	bind $@textbox <KeyPress> "$self focus_switch %K $@textbox $f"
  	#bind $@textbox <Tab> "after 1 \"$self tab %K $@textbox $f \""
  	focus .$self.comp
- 	
- 	
  }
  
--- 4416,4431 ----
  	} else {
  		set box_y [expr $y1 - $box_height - 2 + $rooty]
! 	}
  
  	wm geometry .$self [winfo reqwidth .$self]x[winfo reqheight .$self]+$box_x+$box_y
! 
  	bind $f <Button-1> "after 1 \"$self focus_switch Up $@textbox $f \""
  	bind $f <KeyPress> "$self focus_switch %K $@textbox $f"
  	bind $f <Return> "after 1 \"$self complete $f \""
+ 	# shouldn't bind Text here! -- matju
  	bind Text <Tab> "$self tab $@textbox $f; continue"
  	bind $@textbox <KeyPress> "$self focus_switch %K $@textbox $f"
  	#bind $@textbox <Tab> "after 1 \"$self tab %K $@textbox $f \""
  	focus .$self.comp
  }
  
***************
*** 4443,4447 ****
  	set $@focus $listbox
  	$self focus_switch Down $textbox $listbox
! 	}
  
  def* ClassBrowser focus_switch {key focus1 focus2} {
--- 4459,4463 ----
  	set $@focus $listbox
  	$self focus_switch Down $textbox $listbox
! }
  
  def* ClassBrowser focus_switch {key focus1 focus2} {
***************
*** 4459,4471 ****
  				browser {.$self.butt.2 insert end $key}
  				completion {
! 				puts "------> focus_switch focus2 receives letter key $key"
! 					$focus1 insert 1.end $key
! 					$textself after_key $@textbox
! 					$self fill_box [$focus1 get 1.0 1.end] $focus2
! 				puts "------> focus_switch focus = $focus1"
! 					focus $focus1
! 					set @focus $focus1	
  				}
- 			  }
  			}
  			
--- 4475,4487 ----
  				browser {.$self.butt.2 insert end $key}
  				completion {
! 					puts "------> focus_switch focus2 receives letter key $key"
! 						$focus1 insert 1.end $key
! 						$textself after_key $@textbox
! 						$self fill_box [$focus1 get 1.0 1.end] $focus2
! 					puts "------> focus_switch focus = $focus1"
! 						focus $focus1
! 						set @focus $focus1	
! 					}
  				}
  			}
  			
***************
*** 4476,4485 ****
  		if {$key == "Tab"} {
  		set next [expr [$focus2 index active] + 1] 
! 		puts "------> focus_switch fuck! move to the item $@select!! [$focus2 index active]"
! 		if {$next >= [expr $@size - 1]} {
! 		$focus2 activate 0} else {
  			#puts "------ [$focus2 yview] ------"
  			$focus2 activate $next
! 			$focus2 selection clear 0 [expr $@size - 1] 
  			$focus2 selection set $next $next 
  			if {$next >= [expr $@height - 1]} {$focus2 yview scroll 1 units}
--- 4492,4502 ----
  		if {$key == "Tab"} {
  		set next [expr [$focus2 index active] + 1] 
! 		puts "------> focus_switch !!! move to the item $@select!! [$focus2 index active]"
! 		if {$next >= [expr [$@listbox size] - 1]} {
! 			$focus2 activate 0
! 		} else {
  			#puts "------ [$focus2 yview] ------"
  			$focus2 activate $next
! 			$focus2 selection clear 0 [expr [$@listbox size] - 1]
  			$focus2 selection set $next $next 
  			if {$next >= [expr $@height - 1]} {$focus2 yview scroll 1 units}
***************
*** 4496,4504 ****
  					#hum, no idea why i need after 1 for it to work...
  					after 1 $textself after_key $@textbox
- 					}
  				}
  			}
! 
! 		
  	} else {
  		focus $focus2
--- 4513,4519 ----
  					#hum, no idea why i need after 1 for it to work...
  					after 1 $textself after_key $@textbox
  				}
  			}
! 		}
  	} else {
  		focus $focus2





More information about the Pd-cvs mailing list