[PD-cvs] pd/src desire.tk,1.1.2.303,1.1.2.304

Mathieu Bouchard matju at users.sourceforge.net
Wed Aug 9 01:02:35 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
introducing comment boxes (#X text)


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.303
retrieving revision 1.1.2.304
diff -C2 -d -r1.1.2.303 -r1.1.2.304
*** desire.tk	8 Aug 2006 21:15:16 -0000	1.1.2.303
--- desire.tk	8 Aug 2006 23:02:33 -0000	1.1.2.304
***************
*** 161,165 ****
  def Manager call {} {
  	global poolset
! 	if {[llength $@q]} {post "client queue %d" [llength $@q]}
  	foreach o $@q {
  		post %s "$o: $poolset($o)"
--- 161,165 ----
  def Manager call {} {
  	global poolset
! 	#if {[llength $@q]} {post "client queue %d" [llength $@q]}
  	foreach o $@q {
  		post %s "$o: $poolset($o)"
***************
*** 832,835 ****
--- 832,842 ----
  set look(objectframe3) #000000
  set look(objectframe4) #0080ff
+ set look(commentfg) #000000
+ set look(commentbg) #cccccc
+ set look(commentframe1) #ffffff
+ set look(commentframe2) #888888
+ set look(commentframe3) #000000
+ set look(commentframe4) #0080ff
+ 
  set look(canvasbgrun) #ffffff
  set look(canvasbgedit) #dddddd
***************
*** 1358,1376 ****
  }
  
! # correct edit menu, enabling or disabling undo/redo
  # LATER also cut/copy/paste
  def Canvas fix_edit_menu {} {
      set e .$self.m.edit
      set t [say undo]
      if {[$@history can_undo?]} {
! 	$e entryconfigure $t -state normal   -label "$t [$@history next_undo_name]"
      } else {
! 	$e entryconfigure $t -state disabled -label "[say cannot] $t"
      }
      set t [say redo]
      if {[$@history can_redo?]} {
! 	$e entryconfigure $t -state normal   -label "$t [$@history next_redo_name]"
      } else {
! 	$e entryconfigure $t -state disabled -label "[say cannot] $t"
      }
  }
--- 1365,1386 ----
  }
  
! # corrects edit menu, enabling or disabling undo/redo
  # LATER also cut/copy/paste
  def Canvas fix_edit_menu {} {
+     global OS
      set e .$self.m.edit
+     switch $OS {osx {set i 0} default {set i 1}}
      set t [say undo]
      if {[$@history can_undo?]} {
! 	$e entryconfigure $i -state normal   -label "$t [$@history next_undo_name]"
      } else {
! 	$e entryconfigure $i -state disabled -label "[say cannot] $t"
      }
+     incr i
      set t [say redo]
      if {[$@history can_redo?]} {
! 	$e entryconfigure $i -state normal   -label "$t [$@history next_redo_name]"
      } else {
! 	$e entryconfigure $i -state disabled -label "[say cannot] $t"
      }
  }
***************
*** 1438,1445 ****
--- 1448,1462 ----
  class_new TextBox {Box}
  
+ def TextBox init {} {
+ 	super
+ 	set @edit 0
+ 	set @valid 0
+ }
+ 
  def TextBox text= {text} {set @text $text; $self update_size}
  def TextBox text {} {return $text}
  
  def* TextBox draw {} {
+     $self update_size
      # TEXT = the text label
      # text = the input text field
***************
*** 1468,1474 ****
  	set t .$@canvas.c.${self}text
  	if {[info exists @isnew]} {set @isnew 0}
! 	#--------------------------------------- label completion
! 	#set propose .$@canvas.c.${self}propose
! 	#---------------------------------------
  	set @edit 1
  	set @tab_repeats 0 
--- 1485,1489 ----
  	set t .$@canvas.c.${self}text
  	if {[info exists @isnew]} {set @isnew 0}
! 	# set propose .$@canvas.c.${self}propose ;# label completion
  	set @edit 1
  	set @tab_repeats 0 
***************
*** 1476,1490 ****
  	set @selected? 1
  	.$@canvas.c delete ${self}TEXT
! 	#set @oldtext $@text
  	$self update_size
! 	#$self changed
! 	#--------------------------------------- label completion
! 	#text $propose -height 1 -width [expr [string length $@text]+1] -relief flat \
  	#	-bg $look(objectbg) -borderwidth 0 -highlightthickness 0\
! 	#	-font $font(str) -fg red
! 	#---------------------------------------
  	bind Text <Tab> "$self tab; continue"
  	text $t -height 1 -width [expr [string length $@text]+1] -relief flat \
! 		-bg [look objectbg] -borderwidth 0 -highlightthickness 0\
  		-font $font(str) -fg [look objectfg]
  	bind $t <Key>            "$self key %W %x %y %K %A 0"
--- 1491,1503 ----
  	set @selected? 1
  	.$@canvas.c delete ${self}TEXT
! 	# set @oldtext $@text
  	$self update_size
! 	# $self changed
! 	# text $propose -height 1 -width [expr [string length $@text]+1] -relief flat \
  	#	-bg $look(objectbg) -borderwidth 0 -highlightthickness 0\
! 	#	-font $font(str) -fg red ;# label completion
  	bind Text <Tab> "$self tab; continue"
  	text $t -height 1 -width [expr [string length $@text]+1] -relief flat \
! 		-bg [.$@canvas.c itemcget ${self}BASE -fill] -borderwidth 0 -highlightthickness 0\
  		-font $font(str) -fg [look objectfg]
  	bind $t <Key>            "$self key %W %x %y %K %A 0"
***************
*** 1504,1508 ****
  	#$self draw
  	$t configure -pady 0 -padx 1
!     $t insert 1.0 $@text
  	#set @entered [$t get 1.0 1.end]
  	focus $t
--- 1517,1521 ----
  	#$self draw
  	$t configure -pady 0 -padx 1
! 	$t insert 1.0 $@text
  	#set @entered [$t get 1.0 1.end]
  	focus $t
***************
*** 1567,1571 ****
  	set @noutlets 0
  	set @pdclass ""
- 	set @edit 0
  }
  
--- 1580,1583 ----
***************
*** 1579,1617 ****
          global font
  	super
- 	set xs $@xs
- 	set ys $@ys
- 	set ins $@ninlets
- 	set outs $@noutlets
          mset {x1 y1} [$self xy]
! 	set x2 [expr $x1+$xs]
!         set y2 [expr $y1+$ys]
          set xya [list $x1 $y1 $x2 $y2]
  	set xyb [l+ [list $x2 $y1 $x1 $y1 $x1 $y2] [list -1 +1 +1 +1 +1 -1]]
  	set xyc [l+ [list $x2 $y1 $x2 $y2 $x1 $y2] [list -1 +1 -1 -1 +1 -1]]
  	$self item BASE  rectangle $xya -fill [look objectbg]
! 	$self item BASE2 line      $xyb -fill [look objectframe2]
! 	$self item BASE3 line      $xyc -fill [look objectframe3]
  }
  
  def* ObjectBox draw {} {
- 	$self update_size
  	super
-         global font
-         mset {x1 y1} [$self xy]
          io_draw $self
          if {[$self selected?]} {set frcol [look objectframe4]} {set frcol [look objectframe3]}
  	set c .$@canvas.c
! 	$c itemconfigure ${self}BASE -outline $frcol -dash \
! 		[if {$@valid} {list 8 8 8 8} {list}]
! 	$c itemconfigure ${self}BASE2 -fill $frcol
! 	$c itemconfigure ${self}BASE3 -fill $frcol 
! 	#super
! 	if {$@isnew} {$self edit}
! 	catch {$c raise ${self}TEXT $self}
! 	
! 	$self draw_wires
  }
  
! def ObjectBox unedit {} {
  	if {!$@edit} {return}
  	set @edit 0
--- 1591,1617 ----
          global font
  	super
          mset {x1 y1} [$self xy]
! 	set x2 [expr $x1+$@xs]
!         set y2 [expr $y1+$@ys]
          set xya [list $x1 $y1 $x2 $y2]
  	set xyb [l+ [list $x2 $y1 $x1 $y1 $x1 $y2] [list -1 +1 +1 +1 +1 -1]]
  	set xyc [l+ [list $x2 $y1 $x2 $y2 $x1 $y2] [list -1 +1 -1 -1 +1 -1]]
  	$self item BASE  rectangle $xya -fill [look objectbg]
! 	$self item BASE1 line      $xyb -fill [look objectframe1]
! 	$self item BASE2 line      $xyc -fill [look objectframe2]
  }
  
  def* ObjectBox draw {} {
  	super
          io_draw $self
          if {[$self selected?]} {set frcol [look objectframe4]} {set frcol [look objectframe3]}
  	set c .$@canvas.c
! 	$c itemconfigure ${self}BASE -outline $frcol -dash [if {$@valid} {list 8 8 8 8} {list}]
! 	if {$@isnew} {$self edit} ;# why this here ?
! 	catch {$c raise ${self}TEXT $self} ;# shouldn't this be in $self edit ?
! 	$self draw_wires ;# why this here ?
  }
  
! def TextBox unedit {} {
  	if {!$@edit} {return}
  	set @edit 0
***************
*** 1622,1628 ****
          $self erase
  	after 1 "destroy $t"
- 	#--------------------------------------- label completion
  	#after 1 "destroy $propose"
- 	#---------------------------------------
  	set l {}
  	foreach char [split $@text ""] {lappend l [scan $char %c]}
--- 1622,1626 ----
***************
*** 1661,1671 ****
  	
  	foreach x $born {
! 	if {[info exists _($x:valid)]} {
! 	$x subscribe $self; $x changed; $x canvas= $self	
  	} else {
! 	puts "$x not been borned yet............."
! 	set @unborn [lappend @unborn $x]}
  	}
- 	
  	set dead [lwithout $@children $children]
  	foreach x $dead {$x unsubscribe $self; $x erase}
--- 1659,1668 ----
  	
  	foreach x $born {
! 	if {[info exists _($x:_class)]} {
! 		$x subscribe $self; $x changed; $x canvas= $self
  	} else {
! 		puts "$x not born yet"
! 		set @unborn [lappend @unborn $x]}
  	}
  	set dead [lwithout $@children $children]
  	foreach x $dead {$x unsubscribe $self; $x erase}
***************
*** 1795,1799 ****
  }
  
! def* View position= {xy1} {mset [list @x1 @y1] $xy1}
  
  def View move {dx dy} {
--- 1792,1796 ----
  }
  
! def View position= {xy1} {mset [list @x1 @y1] $xy1}
  
  def View move {dx dy} {
***************
*** 2976,2980 ****
  set classinfo(canvas)  Canvas
  set classinfo(cnv)     Cnv
! set classinfo(comment)       Comment
  set classinfo(floatatom)   FloatAtom
  set classinfo(symbolatom) SymbolAtom
--- 2973,2978 ----
  set classinfo(canvas)  Canvas
  set classinfo(cnv)     Cnv
! #set classinfo(comment)       Comment
! set classinfo(text)          Comment
  set classinfo(floatatom)   FloatAtom
  set classinfo(symbolatom) SymbolAtom
***************
*** 3022,3029 ****
  	$self noutlets= $noutlets
  	switch -- $class {
  	  obj        {$self text= [join [lrange $mess 4 end]]}
  	  msg        {$self text= [join [lrange $mess 4 end]]}
- 	  floatatom  {$self text= [lindex $d 4]}
- 	  symbolatom {$self text= [lindex $d 4]}
  	  text       {$self text= [join [lrange $mess 4 end]]}
  	  restore    {$self text= [join [lrange $mess 4 end]]}
--- 3020,3027 ----
  	$self noutlets= $noutlets
  	switch -- $class {
+ 	  floatatom  {}
+ 	  symbolatom {}
  	  obj        {$self text= [join [lrange $mess 4 end]]}
  	  msg        {$self text= [join [lrange $mess 4 end]]}
  	  text       {$self text= [join [lrange $mess 4 end]]}
  	  restore    {$self text= [join [lrange $mess 4 end]]}
***************
*** 3133,3142 ****
  	set @xs $@w
  	set @ys $@w
- 	set @edit 0
  	set @text ""
  }
  
! def* MessageBox draw {} {
! 	$self update_size
  	mset {x1 y1} [$self xy]
  	set x2 [expr $x1+$@xs]
--- 3131,3138 ----
  	set @xs $@w
  	set @ys $@w
  	set @text ""
  }
  
! def* MessageBox draw_box {} {
  	mset {x1 y1} [$self xy]
  	set x2 [expr $x1+$@xs]
***************
*** 3145,3148 ****
--- 3141,3148 ----
  		[expr $x2+4] $y2 $x1 $y2 $x2 $y2 $x1 $y2]
  	$self item BASE polygon $points -fill [look objectbg] -outline [look objectframe3]
+ }
+ 
+ def* MessageBox draw {} {
+ 	super
  	io_draw $self
  	if {[$self selected?]} {set frcol [look objectframe4]} {set frcol [look objectframe3]}
***************
*** 3156,3175 ****
  }
  
- def* MessageBox unedit {} {
- 	if {!$@edit} {return}
- 	set @edit 0
- 	set c .$@canvas.c
- 	set t $c.${self}text
- 	set @text [$t get 1.0 1.end]
-         #$self delete
- 	$self selected?= 0
- 	after 1 "destroy $t"
- 	set l {}
- 	foreach char [split $@text ""] {lappend l [scan $char %c]}
- 	pd .$@canvas text_setto !$self $l
- 	$self draw
- 	focus $c
- }
- 
  def* MessageBox click {x y b f} {
  	$self bang 1
--- 3156,3159 ----
***************
*** 3206,3211 ****
  def* AtomBox draw {} {
  	global font
! 	$self update_size
! 	$self draw_box
  
  	mset {x1 y1} [$self xy]
--- 3190,3194 ----
  def* AtomBox draw {} {
  	global font
! 	super
  
  	mset {x1 y1} [$self xy]
***************
*** 3224,3232 ****
  }
  
- #class_new Comment {View}
  class_new Comment {TextBox}
! def* Comment draw {} {
  	super
! 	# should draw uh...
  }
  
--- 3207,3227 ----
  }
  
  class_new Comment {TextBox}
! 
! def* Comment init {} {
  	super
! }
! 
! def Comment draw_box {} {
! 	super
!         mset {x1 y1} [$self xy]
! 	set x2 [expr $x1+$@xs]
!         set y2 [expr $y1+$@ys]
!         set xya [list $x1 $y1 $x2 $y2]
! 	set xyb [l+ [list $x2 $y1 $x1 $y1 $x1 $y2] [list -1 +1 +1 +1 +1 -1]]
! 	set xyc [l+ [list $x2 $y1 $x2 $y2 $x1 $y2] [list -1 +1 -1 -1 +1 -1]]
! 	$self item BASE  rectangle $xya -fill [look commentbg]
! 	$self item BASE1 line      $xyb -fill [look commentframe1]
! 	$self item BASE2 line      $xyc -fill [look commentframe2]
  }
  
***************
*** 3543,3547 ****
  	set @clickpos {}
  	set @key_input 0
- 	set @edit 0
  	#set @isnew 1
  }
--- 3538,3541 ----
***************
*** 3549,3559 ****
  def* FloatAtom init {args} {
  	eval [concat [list super] $args]
! 	#set @text 0
! 	pd .$self set $@text
  }
  
  def SymbolAtom init {args} {
  	eval [concat [list super] $args]
! 	set @text ""
  }
  
--- 3543,3552 ----
  def* FloatAtom init {args} {
  	eval [concat [list super] $args]
! 	set @text 0
  }
  
  def SymbolAtom init {args} {
  	eval [concat [list super] $args]
! 	set @text "symbol"
  }
  
***************
*** 5454,5463 ****
    color canvasbgrun
   subsection object_color
    color objectframe1
    color objectframe2
    color objectframe3
    color objectframe4
!   color objectbg
!   color objectfg
   subsection wire_color
    color wirefg
--- 5447,5462 ----
    color canvasbgrun
   subsection object_color
+   color objectbg
+   color objectfg
    color objectframe1
    color objectframe2
    color objectframe3
    color objectframe4
!   color commentbg
!   color commentfg
!   color commentframe1
!   color commentframe2
!   color commentframe3
!   color commentframe4
   subsection wire_color
    color wirefg





More information about the Pd-cvs mailing list