[PD-cvs] pd/src desire.tk,1.1.2.600.2.73,1.1.2.600.2.74

Mathieu Bouchard matju at users.sourceforge.net
Wed Dec 13 20:01:58 CET 2006


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

Modified Files:
      Tag: desiredata
	desire.tk 
Log Message:
fixed canvas=, children=; rewrote ctrlkey,altkey


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.73
retrieving revision 1.1.2.600.2.74
diff -C2 -d -r1.1.2.600.2.73 -r1.1.2.600.2.74
*** desire.tk	13 Dec 2006 17:16:41 -0000	1.1.2.600.2.73
--- desire.tk	13 Dec 2006 19:01:55 -0000	1.1.2.600.2.74
***************
*** 644,653 ****
  
  def Client init_binds {} {
!     bind . <Control-Key>       {$main ctrlkey %K 0}
!     bind . <Control-Shift-Key> {$main ctrlkey %K 1}
      switch $::OS {
        osx {
!         bind . <Mod1-Key>       {$main ctrlkey %K 0}
!         bind . <Mod1-Shift-Key> {$main ctrlkey %K 1}
        }
      }
--- 644,653 ----
  
  def Client init_binds {} {
!     bind . <Control-Key>       {$main ctrlkey %x %y %K %A 0}
!     bind . <Control-Shift-Key> {$main ctrlkey %x %y %K %A 1}
      switch $::OS {
        osx {
!         bind . <Mod1-Key>       {$main ctrlkey %x %y %K %A 0}
!         bind . <Mod1-Shift-Key> {$main ctrlkey %x %y %K %A 1}
        }
      }
***************
*** 1010,1040 ****
  }
  
! def Menuable ctrlkey {key shift} {
!     global accels
      set key [if {$shift} {string toupper $key} {string tolower $key}]
!     #set key "Ctrl+$key"
!     set key [$self getkey "Ctrl+$key"]
!     puts "*** key::: $key"
!     if {[string length $key]} {
!     	$self eval% "%W $key"
!     } else {return}
!     #if {[dict exists $accels $key]} {
!     #	$self eval% "%W [dict get $accels $key]"
!     #	return
!     #} {puts "ctrlkey: unknown $key"}
  }
  
! def Menuable altkey {key iso shift} {
!     global accels
      set key [if {$shift} {string toupper $key} {string tolower $key}]
!     #set key "Alt+$key"
!     set key [$self getkey "Alt+$key"]
!     if {[string length $key]} {
!     	$self eval% "%W $key"
!     } else {return}
!     #if {[dict exists $accels $key]} {
!     #	$self eval% "%W [dict get $accels $key]"
!     #	return
!     #} {puts "altkey: unknown $key"}
  }
  
--- 1010,1025 ----
  }
  
! def Menuable ctrlkey {x y key iso shift} {
      set key [if {$shift} {string toupper $key} {string tolower $key}]
!     set key "Ctrl+$key"
!     set cmd [$self getkey $key]
!     if {[string length $cmd]} {$self eval% "%W $cmd"} else {post "unknown key $key"}
  }
  
! def Menuable altkey {x y key iso shift} {
      set key [if {$shift} {string toupper $key} {string tolower $key}]
!     set key "Alt+$key
!     set cmd [$self getkey $key]
!     if {[string length $cmd]} {$self eval% "%W $cmd"} else {post "unknown key $key"}
  }
  
***************
*** 1213,1217 ****
  def View canvas= {c} {
  	set @canvas $c
! 	$self subscribe $c; $self changed
  }
  
--- 1198,1205 ----
  def View canvas= {c} {
  	set @canvas $c
! 	# should "subscribe" call "changed"? (or pretend to?)
! 	$self subscribe $c
! 	$self changed
! 	$self outside_of_the_box
  }
  
***************
*** 1331,1335 ****
  }
  
! def Canvas print  {} {
      set filename [tk_getSaveFile -initialfile pd.ps -defaultextension .ps \
         -filetypes { {{postscript} {.ps}} }]
--- 1319,1323 ----
  }
  
! def Canvas print {} {
      set filename [tk_getSaveFile -initialfile pd.ps -defaultextension .ps \
         -filetypes { {{postscript} {.ps}} }]
***************
*** 1426,1430 ****
  # to be called only from Pd side.
  def Canvas editmode= {mode} {
!     set @editmode $mode
  #    catch {.$self.bbar.edit configure -image icon_mode_$mode}
      if {$@mapped} {
--- 1414,1418 ----
  # to be called only from Pd side.
  def Canvas editmode= {mode} {
!     set @editmode $mode; $self changed editmode
  #    catch {.$self.bbar.edit configure -image icon_mode_$mode}
      if {$@mapped} {
***************
*** 1433,1437 ****
        if {[$self look hairstate] && !$@editmode} {$@crosshair erase}
      }
-     $self changed
      # comment's look depends on the value of @editmode
      foreach child $@children {if {[[$child class] <= Comment]} {$child changed}}
--- 1421,1424 ----
***************
*** 1781,1798 ****
  
      # keyboard
!     $self bind <Control-Key>       ctrlkey %K 0
!     $self bind <Control-Shift-Key> ctrlkey %K 1
!     $self bind <Alt-Key>           altkey  %K %A 0
!     $self bind <Alt-Shift-Key>     altkey  %K %A 1
      switch $::OS {
        unix {
! 	$self bind <Mod1-Key>       altkey %K %A 0
! 	$self bind <Mod1-Shift-Key> altkey %K %A 1
! 	$self bind <Mod4-Key>       altkey %K %A 0
! 	$self bind <Mod4-Shift-Key> altkey %K %A 1
        }
        osx {
! 	$self bind <Mod1-Key>       ctrlkey %K 0
! 	$self bind <Mod1-Shift-Key> ctrlkey %K 1
        }
      }
--- 1768,1785 ----
  
      # keyboard
!     $self bind <Control-Key>       ctrlkey %x %y %K %A 0
!     $self bind <Control-Shift-Key> ctrlkey %x %y %K %A 1
!     $self bind <Alt-Key>           altkey  %x %y %K %A 0
!     $self bind <Alt-Shift-Key>     altkey  %x %y %K %A 1
      switch $::OS {
        unix {
! 	$self bind <Mod1-Key>       altkey %x %y %K %A 0
! 	$self bind <Mod1-Shift-Key> altkey %x %y %K %A 1
! 	$self bind <Mod4-Key>       altkey %x %y %K %A 0
! 	$self bind <Mod4-Shift-Key> altkey %x %y %K %A 1
        }
        osx {
! 	$self bind <Mod1-Key>       ctrlkey %x %y %K %A 0
! 	$self bind <Mod1-Shift-Key> ctrlkey %x %y %K %A 1
        }
      }
***************
*** 2084,2089 ****
  def TextBox edit {} {
  	if {$@edit} {return}
! 	set @edit 1
! 	$self changed
  }
  
--- 2071,2075 ----
  def TextBox edit {} {
  	if {$@edit} {return}
! 	set @edit 1; $self changed edit
  }
  
***************
*** 2103,2107 ****
  	set new_size [format %.0f [expr [lindex $font_str 1]*$_($@canvas:zoom)]]
  	set font_str [lreplace $font_str 1 1 $new_size]
- 	#puts "  text to edit::: $@text"
  	set l {};set nl 1;set newline {-1};set i 0;set width 0
  	foreach char [split $@text ""] {lappend l [scan $char %c]}
--- 2089,2092 ----
***************
*** 2294,2298 ****
  	foreach char [split $@text ""] {lappend l [scan $char %c]}
  	netsend [list .$@canvas text_setto $self $l] [list $@canvas new_object_callback]
- 	$self changed
  	if {[$@canvas action] == "insert"} {
  		set wire [$@canvas selection_wire]
--- 2279,2282 ----
***************
*** 2312,2316 ****
  		$@canvas connect [list $obj1_idx 0 $obj2_idx 0]
  		$@canvas deselect_all
- 		
  		$@canvas action= none
  		after 100 $@canvas selection2= $obj2_idx
--- 2296,2299 ----
***************
*** 2321,2325 ****
  	if {!$@edit} {return}
  	if {!$accept} {$@canvas del [$@canvas children_idx $self]}
! 	set @edit 0
  	set c [$@canvas widget]
  	set t $c.${self}text
--- 2304,2308 ----
  	if {!$@edit} {return}
  	if {!$accept} {$@canvas del [$@canvas children_idx $self]}
! 	set @edit 0; $self changed edit
  	set c [$@canvas widget]
  	set t $c.${self}text
***************
*** 2328,2332 ****
  	if {[winfo exists .completion]} {$@action cancel}
  	focus $c
- 	$self changed
  }
  
--- 2311,2314 ----
***************
*** 2335,2342 ****
  def Canvas folder {} {return $@folder}
  def Canvas name=   {name}    {if {!$@mapped} {return}; set @name   $name  ; $self update_title}
! def Canvas folder= {folder}  {
! 	global paste
! 	if {!$@mapped} {return}; set @folder $folder; $self update_title
! }
  
  def Canvas make_title {} {
--- 2317,2321 ----
  def Canvas folder {} {return $@folder}
  def Canvas name=   {name}    {if {!$@mapped} {return}; set @name   $name  ; $self update_title}
! def Canvas folder= {folder}  {if {!$@mapped} {return}; set @folder $folder; $self update_title}
  
  def Canvas make_title {} {
***************
*** 2384,2410 ****
  
  # think of the children!!!
- # should be only called from the server
  # THIS IS NOT WHERE HISTORY ADD IS SUPPOSED TO BE!
  # it's supposed to be on the user end!
  def Canvas children= {children} {
  	set new  [lwithout $children $@children]
  	set dead [lwithout $@children $children]
- 	foreach x [lreverse $dead] {$x unsubscribe $self; $x erase} ;# should use delete instead?
- 	foreach x $new {$x subscribe $self; $x changed; $x canvas= $self}
  	set @children $children
! 	foreach x $@children {$x outside_of_the_box}
! 	$self changed
  }
  
  def Canvas visible_children+= {children} {
  	if {[lsearch $@visible_children $children] < 0} {
  		set @visible_children [lappend @visible_children $children]
  	}
  }
  
  def Canvas visible_children-= {children} {
  	if {[lsearch $@visible_children $children] >= 0} {
  		set @visible_children [lwithout $@visible_children $children]
! 	} else {return}
  }
  
--- 2363,2392 ----
  
  # think of the children!!!
  # THIS IS NOT WHERE HISTORY ADD IS SUPPOSED TO BE!
  # it's supposed to be on the user end!
+ # should be only called from the server
+ # and its use should be limited to the minimum.
  def Canvas children= {children} {
  	set new  [lwithout $children $@children]
  	set dead [lwithout $@children $children]
  	set @children $children
! 	#foreach x $@children {$x outside_of_the_box}
! 	$self changed children
  }
  
+ # this is wrong, arg is called "children" but only accepts one child at a time.
  def Canvas visible_children+= {children} {
  	if {[lsearch $@visible_children $children] < 0} {
  		set @visible_children [lappend @visible_children $children]
+ 		$self changed visible_children
  	}
  }
  
+ # this is wrong, arg is called "children" but only accepts one child at a time.
  def Canvas visible_children-= {children} {
  	if {[lsearch $@visible_children $children] >= 0} {
  		set @visible_children [lwithout $@visible_children $children]
! 		$self changed visible_children
! 	}
  }
  
***************
*** 2444,2448 ****
  	foreach x [lreverse $dead] {$x unsubscribe $self; $x erase} ;# should use delete instead?
  	set @wires $wires
! 	$self changed
  }
  
--- 2426,2430 ----
  	foreach x [lreverse $dead] {$x unsubscribe $self; $x erase} ;# should use delete instead?
  	set @wires $wires
! 	$self changed wires
  }
  
***************
*** 2486,2490 ****
  }
  
! def View position= {xy1} {mset [list @x1 @y1] $xy1}
  
  def View set_orig_xy {x y} {
--- 2468,2472 ----
  }
  
! def View position= {xy1} {mset [list @x1 @y1] $xy1; $self changed x1 y1}
  
  def View set_orig_xy {x y} {
***************
*** 3369,3373 ****
  	if {$@editmode} {
  		switch $@action {
! 			edit {set @obj_in_edit $id; $id edit; set @action none; $id changed}
  			move {$self unclick_move}
  			none {}
--- 3351,3355 ----
  	if {$@editmode} {
  		switch $@action {
! 			edit {set @obj_in_edit $id; $id edit; set @action none; $id changed action}
  			move {$self unclick_move}
  			none {}
***************
*** 3714,3718 ****
  		set y1 [expr $y*$s]
  		$child position= [list $x1 $y1]
- 		$child changed
  		netsend [list .$self object_moveto $child $x1 $y1]
  	}
--- 3696,3699 ----
***************
*** 5861,5865 ****
  	}
  	set class [$self current_class]
- 	puts "completion:::: $class"
  	$@textbox delete 1.0 1.end
  	$@textbox insert 1.0 $class
--- 5842,5845 ----
***************
*** 6963,6967 ****
  							set accels [dict remove $accels $old_key]
  							dict set accels $new_key $cmd
- 							puts "$new_key ::: $cmd"
  						}
  					}
--- 6943,6946 ----





More information about the Pd-cvs mailing list