[PD-cvs] pd/src desire.tk,1.1.2.229,1.1.2.230

chunlee chunlee at users.sourceforge.net
Mon Jun 12 11:44:31 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
split classbrowser further into Browser and Completion classes, and fixed a few thing that got brok...


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.229
retrieving revision 1.1.2.230
diff -C2 -d -r1.1.2.229 -r1.1.2.230
*** desire.tk	12 Jun 2006 05:57:58 -0000	1.1.2.229
--- desire.tk	12 Jun 2006 09:44:28 -0000	1.1.2.230
***************
*** 414,417 ****
--- 414,420 ----
  set key(crosshair) ""
  set key(editmodeswitch) "Ctrl+e"
+ set key(popup_properties) ""
+ set key(popup_help) ""
+ set key(popup_open) ""
  set accels {}
  ################## set up main window #########################
***************
*** 1057,1061 ****
  }
  
! def Client class_browser {} {ClassBrowser new_as browser browser 0 0 ""}
  
  proc menu_audio {flag} {pd pd dsp $flag}
--- 1060,1064 ----
  }
  
! def Client class_browser {} {Browser new_as browser browser 0 0 ""}
  
  proc menu_audio {flag} {pd pd dsp $flag}
***************
*** 2184,2187 ****
--- 2187,2195 ----
      global canvas
      #set canvas(current) $self
+     if {[winfo exists .completion]} {
+     puts "WARN!!!!! completion box exists................."
+     raise .completion
+     focus .completion.comp
+     } else {
      set c .$self.c
      focus $c
***************
*** 2197,2200 ****
--- 2205,2210 ----
        default {error BORK}
      }
+     }
+     
  }
  
***************
*** 3722,3727 ****
  
  ############ class browser
! 
  class_new ClassBrowser {Dialog}
  def* ClassBrowser init {name x y textbox} {
  	set @name $name
--- 3732,3746 ----
  
  ############ class browser
! # Completion/Browser init can be cleaned up a bit more, do it later...
  class_new ClassBrowser {Dialog}
+ class_new Browser {ClassBrowser}
+ def Browser init {name x y textbox} {super $name $x $y $textbox}
+ class_new Completion {ClassBrowser}
+ 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} {
  	set @name $name
***************
*** 3762,3766 ****
  	$listbox selection set 0 0
  	set @size [$listbox size]
! 	puts "matches ::: $@size |||| width ::: $@width"
  }
  
--- 3781,3786 ----
  	$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]
  }
  
***************
*** 3787,3881 ****
  }
  
! 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" \
! 						 -activestyle none
! 			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 $f.1 \""
! 			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 {
! 			toplevel .$self
! 			#$self test_focus 
! 			#wm overrideredirect .$self 1
! 			set canvas $@name
! 			set f .$self.comp
! 			set rootx [winfo rootx .$@name.c]
! 			set rooty [winfo rooty .$@name.c]
! 			set max [wm maxsize .$self]
! 			if {[regexp {x([0-9a-z]{6,8})text$} $@textbox textself]} {
! 				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 red -selectbackground yellow \
! 					   -activestyle dotbox
! 			$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
  			
! 			.$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]} {
! 				set box_x [expr $x1+$rootx]
! 			} 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]} {
! 				set box_y [expr $y2 + 5 + $rooty]
! 			} 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
! 		}
! 	}
  }
  
--- 3807,3906 ----
  }
  
! def* Browser list_callback {} {
  	global class_list font look
  	$self search_for_externs
  	set class_list [luniq [lsort $class_list]]
! 	
! 	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" \
! 		     -activestyle none
! 	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 $f.1 \""
! 	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"
! }
! 
! def* Completion list_callback {} {
! 	global class_list font look
! 	$self search_for_externs
! 	set class_list [luniq [lsort $class_list]]
! 	
! 	toplevel .$self
! 	wm protocol .$self WM_DELETE_WINDOW "$self cancel"
! 	#$self test_focus 
! 	#wm overrideredirect .$self 1
! 	set canvas $@name
! 	set f .$self.comp
! 	set rootx [winfo rootx .$@name.c]
! 	set rooty [winfo rooty .$@name.c]
! 	set max [wm maxsize .$self]
! 	if {[regexp {x([0-9a-z]{6,8})text$} $@textbox textself]} {
! 		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]} {
! 		set box_x [expr $x1+$rootx]
! 	} 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]} {
! 		set box_y [expr $y2 + 5 + $rooty]
! 	} 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
! 	
! 	
  }
  
***************
*** 3910,3914 ****
  	}
  
! def ClassBrowser focus_switch {key focus1 focus2} {
  	#focus2 = listbox :: focus1 = whatever
  	if {[regexp {x([0-9a-z]{6,8})text$} $@textbox textself]} {
--- 3935,3939 ----
  	}
  
! def* ClassBrowser focus_switch {key focus1 focus2} {
  	#focus2 = listbox :: focus1 = whatever
  	if {[regexp {x([0-9a-z]{6,8})text$} $@textbox textself]} {
***************
*** 3958,3962 ****
  					puts "------> focus_switch receives $key @ $@focus"
  					#if {[regexp {^[a-zA-Z]{1}$} $key]} {$focus1 insert 1.end $key}
! 					$self fill_box [$focus1 get 1.0 1.end] $focus2
  					#hum, no idea why i need after 1 for it to work...
  					after 1 $textself after_key $@textbox
--- 3983,3987 ----
  					puts "------> focus_switch receives $key @ $@focus"
  					#if {[regexp {^[a-zA-Z]{1}$} $key]} {$focus1 insert 1.end $key}
! 					if {[winfo exists .$self]} {$self fill_box [$focus1 get 1.0 1.end] $focus2}
  					#hum, no idea why i need after 1 for it to work...
  					after 1 $textself after_key $@textbox
***************
*** 4026,4030 ****
  	#---------------------------------------
  	mset {x1 y1 x2 y2} [$self bbox]
! 	ClassBrowser new_as completion $@canvas $x1 $y1	$widget
  }
  
--- 4051,4055 ----
  	#---------------------------------------
  	mset {x1 y1 x2 y2} [$self bbox]
! 	Completion new_as completion $@canvas $x1 $y1 $widget
  }
  
***************
*** 4272,4276 ****
  def Dialog cancel  {} {}
  def Dialog apply   {} {}
! def Dialog _delete {} {destroy .$self}
  
  def Dialog init {} {
--- 4297,4301 ----
  def Dialog cancel  {} {}
  def Dialog apply   {} {}
! def* Dialog _delete {} {destroy .$self}
  
  def Dialog init {} {





More information about the Pd-cvs mailing list