[PD-cvs] pd/src desire.tk,1.1.2.201,1.1.2.202

chunlee chunlee at users.sourceforge.net
Mon May 8 01:56:56 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
hum, i thought i had commited the auto completion code....


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.201
retrieving revision 1.1.2.202
diff -C2 -d -r1.1.2.201 -r1.1.2.202
*** desire.tk	7 May 2006 23:47:48 -0000	1.1.2.201
--- desire.tk	7 May 2006 23:56:54 -0000	1.1.2.202
***************
*** 976,980 ****
  }
  
! def Client class_browser {} {ClassBrowser new_as browser browser}
  
  proc menu_audio {flag} {pd pd dsp $flag}
--- 976,980 ----
  }
  
! def Client class_browser {} {ClassBrowser new_as browser browser 0 0 ""}
  
  proc menu_audio {flag} {pd pd dsp $flag}
***************
*** 1699,1702 ****
--- 1699,1703 ----
  #    }
      mset {type id} [$self identify_target $x $y -1 -1 "move "]
+ 	#puts "id :::: $id"
      #puts "type :: $type"
      switch $type {
***************
*** 3274,3297 ****
  
  class_new ClassBrowser {Dialog}
! def ClassBrowser init {name} {
  	set @name $name
  	set @focus ""
  	pd pd update-path
          pd pd update-class-list $self list_callback
  }
  
! def ClassBrowser fill_box {s} {
! 	set f .browser.cl
  	global class_list
  	set n 0
! 	$f.1 delete 0 end
  	foreach class $class_list {
  		if {[string length $s]==0 || [string first $s $class]>=0} {
! 			$f.1 insert end "$class : [say $class]"
  			incr n
  		}
  	}
! 	.browser.title configure -text [format [say "%d of %d object classes"] $n [llength $class_list]]
! 	$f.1 selection set 0 0
  }
  
--- 3275,3306 ----
  
  class_new ClassBrowser {Dialog}
! def* ClassBrowser init {name x y textbox} {
  	set @name $name
  	set @focus ""
+ 	set @x $x
+ 	set @y $y
+ 	# so that in completion mode, it know which textbox to switch the focus to
+ 	set @textbox $textbox
  	pd pd update-path
          pd pd update-class-list $self list_callback
  }
  
! def ClassBrowser fill_box {s listbox} {
! 	set f .$self.cl
  	global class_list
  	set n 0
! 	#$f.1 delete 0 end
! 	$listbox delete 0 end
  	foreach class $class_list {
  		if {[string length $s]==0 || [string first $s $class]>=0} {
! 			#$f.1 insert end "$class : [say $class]"
! 			$listbox insert end "$class : [say $class]"
  			incr n
  		}
  	}
! 	if {$@name == "browser"} {
! 	.$self.title configure -text [format [say "%d of %d object classes"] $n [llength $class_list]]
! 	}
! 	$listbox selection set 0 0
  }
  
***************
*** 3319,3374 ****
  }
  
! def ClassBrowser list_callback {} {
! 	global class_list
  	$self search_for_externs
  	set class_list [luniq [lsort $class_list]]
! 	toplevel .browser
! 	set f .browser.cl
! 	pack [frame $f] -side top -fill both -expand yes
! 	pack [label .browser.title -text ""] -side top
! 	listbox $f.1 -width 50 -height 20 -yscrollcommand "$f.2 set"
! 	scrollbar $f.2 -command "$f.1 yview"
! 	text    $f.3 -width 30 -height 20 -yscrollcommand "$f.4 set"
! 	scrollbar $f.4 -command "$f.3 yview"
  
! 	frame $f.5
! 	button $f.5.help -text [say help] -command "pd pd help \[$f.1 get \[$f.1 curselection\]\]"
! 	pack $f.5.help -side top
! 	pack $f.5 -side left -fill    y -expand no
! 	pack $f.1 -side left -fill both -expand yes
! 	pack $f.2 -side left -fill    y -expand no
! 	pack $f.3 -side left -fill both -expand yes
! 	pack $f.4 -side left -fill    y -expand no
  
! 	set b .browser.butt
! 	frame $b
! 	pack [label $b.1 -text "[say filter]: "] -side left
! 	pack [entry $b.2 -width 15] -side left
! 	pack [button $b.close -text [say close] -command "destroy .browser"] -side right
! 	pack $b -side bottom -fill x -expand no
! 	$self fill_box ""
! 	#bind $f.1 <Button-1> "after 1 \"$self info\""
! 	bind $f.1 <Button-1> "after 1 \"$self focus_switch Up\""
! 	bind $f.1 <KeyPress> "after 1 \"$self focus_switch %K\""
! 	#bind $b.2 <KeyPress> {after 1 "browser fill_box \[.browser.butt.2 get\]"}
! 	bind $b.2 <KeyPress> "after 1 \"$self focus_switch %K\""
! 	#after 1 "focus $b.2"
  }
  
! def ClassBrowser focus_switch {key} {
  	if {$key != "Down" & $key != "Up"} {
! 		if {$@focus == "listbox"} {
  		if {[regexp {^[a-zA-Z]{1}$} $key]} {.$self.butt.2 insert end $key}
  		}
! 		focus .$self.butt.2
! 		set @focus "entry"
! 		$self fill_box [.$self.butt.2 get]
  	} else {
! 		focus .$self.cl.1
! 		set @focus "listbox"
! 		$self info
  	}
- 
- 
  }
  
--- 3328,3401 ----
  }
  
! def* ClassBrowser list_callback {} {
! 	global class_list font look
  	$self search_for_externs
  	set class_list [luniq [lsort $class_list]]
! 	switch $self { 
! 		browser {
! 			toplevel .$self
! 			set f .$self.cl
! 			pack [frame $f] -side top -fill both -expand yes
! 			pack [label .$self.title -text ""] -side top
! 			listbox $f.1 -width 50 -height 20 -yscrollcommand "$f.2 set"
! 			scrollbar $f.2 -command "$f.1 yview"
! 			text    $f.3 -width 30 -height 20 -yscrollcommand "$f.4 set"
! 			scrollbar $f.4 -command "$f.3 yview"
  
! 			frame $f.5
! 			button $f.5.help -text [say help] -command "pd pd help \[$f.1 get \[$f.1 curselection\]\]"
! 			pack $f.5.help -side top
! 			pack $f.5 -side left -fill    y -expand no
! 			pack $f.1 -side left -fill both -expand yes
! 			pack $f.2 -side left -fill    y -expand no
! 			pack $f.3 -side left -fill both -expand yes
! 			pack $f.4 -side left -fill    y -expand no
  
! 			set b .$self.butt
! 			frame $b
! 			pack [label $b.1 -text "[say filter]: "] -side left
! 			pack [entry $b.2 -width 15] -side left
! 			pack [button $b.close -text [say close] -command "destroy .$self"] -side right
! 			pack $b -side bottom -fill x -expand no
! 			$self fill_box "" $f.1
! 			#bind $f.1 <Button-1> "after 1 \"$self info\""
! 			bind $f.1 <Button-1> "after 1 \"$self focus_switch Up $b.2 $f.1 \""
! 			bind $f.1 <KeyPress> "after 1 \"$self focus_switch %K $b.2 $f.1 \""
! 			#bind $b.2 <KeyPress> {after 1 "$self fill_box \[.$self.butt.2 get\] $f.1"}
! 			bind $b.2 <KeyPress> "after 1 \"$self focus_switch %K $b.2 $f.1 \""
! 			#after 1 "focus $b.2"
! 		}
! 		completion {
! 			#puts "name ::: $@name | textbox :: $@textbox"
! 			set canvas $@name
! 			set f .$@name.c.comp
! 			listbox $f -width 20 -height 10 -relief raised -bg red
! 			
! 			.$@name.c create window [expr $@x+2] [expr $@y+2] \
! 			-window $f -anchor nw -tags "$self"
! 			#-window $f -anchor nw -tags "${canvas}Completebox $canvas"
! 			$self fill_box "" $f
! 			bind $f <Button-1> "after 1 \"$self focus_switch Up $@textbox $f \""
! 			bind $f <KeyPress> "after 1 \"$self focus_switch %K $@textbox $f \""
! 			bind $@textbox <KeyPress> "after 1 \"$self focus_switch %K $@textbox $f \""
! 			
! 		}
! 	}
  }
  
! def* ClassBrowser focus_switch {key focus1 focus2} {
! 	#focus2 = listbox :: focus1 = whatever
  	if {$key != "Down" & $key != "Up"} {
! 		if {$@focus == $focus2} {
  		if {[regexp {^[a-zA-Z]{1}$} $key]} {.$self.butt.2 insert end $key}
  		}
! 		focus $focus1
! 		set @focus $focus1
! 		$self fill_box [$focus1 get] $focus2
  	} else {
! 		focus $focus2
! 		set @focus $focus2
! 		if {$@name == "browser"} {$self info}	
  	}
  }
  
***************
*** 3386,3419 ****
  
  ############ completions
- 
- def* Canvas show_completions {x y text {on_hide ""}} {
- 	global font look
- 	set f .$self.comp
- 	listbox $f -width 5 -height 5 -relief raised -bg red
- 	.$self.c create window [expr $x+2] [expr $y+2] \
- 	-window $f -anchor nw -tags "${self}completebox $self"
- #	-window $f -anchor nw -tags "${self}completebox $self" -height [expr $font(height) * 22] -width [expr $font(height) * 22]
- #	global tooltip
- #	if {$tooltip(visible) && [string compare $text $tooltip(text)]==0} {return}
- #	$self hide_tooltip
- #	set border 4
- #	set x [expr $x+$border+4]
- #	set c .$self.c
- #	$c create text $x $y -text $text -anchor w -tags tooltip_fg
- #	mset {x1 y1 x2 y2} [$c bbox tooltip_fg]
- #	set w 0
- #	set h 0
- #	$c create rectangle \
- #		[expr $x1-$border] [expr $y1-$border] \
- #		[expr $x2+$border] [expr $y2+$border] \
- #		-fill "#ffffcc" -outline "#000000" -tags tooltip_bg
- #	$c lower tooltip_bg tooltip_fg
- #	set tooltip(curpos) $@curpos
- #	set tooltip(canvas) $self
- #	set tooltip(visible) 1
- #	set tooltip(text) $text
- #	set tooltip(on_hide) $on_hide
- }
- 
  def TextBox propose_completions {} {
  	global class_list
--- 3413,3416 ----
***************
*** 3455,3459 ****
  	#---------------------------------------
  	mset {x1 y1 x2 y2} [$self bbox]
! 	$@canvas show_completions $x2 $y1 $r	
  }
  
--- 3452,3456 ----
  	#---------------------------------------
  	mset {x1 y1 x2 y2} [$self bbox]
! 	ClassBrowser new_as completion $@canvas $x2 $y1	$widget
  }
  





More information about the Pd-cvs mailing list