[PD-cvs] pd/src desire.tk,1.1.2.600.2.61,1.1.2.600.2.62

chunlee chunlee at users.sourceforge.net
Tue Dec 12 18:09:41 CET 2006


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

Modified Files:
      Tag: desiredata
	desire.tk 
Log Message:
fixes for variable width font, Numbox triangle, crosshair 


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.61
retrieving revision 1.1.2.600.2.62
diff -C2 -d -r1.1.2.600.2.61 -r1.1.2.600.2.62
*** desire.tk	12 Dec 2006 06:41:26 -0000	1.1.2.600.2.61
--- desire.tk	12 Dec 2006 17:09:36 -0000	1.1.2.600.2.62
***************
*** 559,571 ****
    it|italiano       {list italiano}
    nb|norsk|bokmal   {list bokmal}
    default {error huh??? unknown lang (locale)}
  }].tcl
  
  if {[file exists $langfile]} {
!   source $langfile
  } else {
    source [file join [file dirname [file dirname $argh0]] lib/pd/bin/$langfile]
  }
! 
  #-----------------------------------------------------------------------------------#
  
--- 559,573 ----
    it|italiano       {list italiano}
    nb|norsk|bokmal   {list bokmal}
+   ch|chinese        {list chinese}
    default {error huh??? unknown lang (locale)}
  }].tcl
  
  if {[file exists $langfile]} {
! 	#source -encoding utf-8 $langfile
! 	source $langfile
  } else {
    source [file join [file dirname [file dirname $argh0]] lib/pd/bin/$langfile]
  }
!   
  #-----------------------------------------------------------------------------------#
  
***************
*** 678,685 ****
  
  def Client init_controls {} {
      menu .mbar
      pack [frame .controls] -side top -fill x
      foreach t {file find window help} {
! 	.mbar add cascade -label [say $t] -menu [menu .mbar.$t -tearoff $::pd_tearoff]
      }
      .mbar.window configure -postcommand "$self fix_window_menu"
--- 680,688 ----
  
  def Client init_controls {} {
+     global pd_tearoff
      menu .mbar
      pack [frame .controls] -side top -fill x
      foreach t {file find window help} {
! 	.mbar add cascade -label [say $t] -menu [menu .mbar.$t -tearoff $pd_tearoff]
      }
      .mbar.window configure -postcommand "$self fix_window_menu"
***************
*** 703,716 ****
  		-variable $y -anchor w -command $z] -side left
      }
!     pack [button .controls.clear -text [say console_clear] -command {.log.1 delete 0.0 end} -padx 5] -side right
!     pack [button .controls.switches.dio -text [say io_errors] -command {netsend [list pd audiostatus]} -padx 5]
      pack .controls.switches -side right
!     if {$::debug} {
! 	frame .debug
! 	pack [label .debug.1 -anchor w -text ""] -side left
! 	pack [entry .debug.3 -textvariable ::serial -width 5] -side right
! 	pack [label .debug.2 -text "obj.serial: " -justify right] -side right
! 	pack .debug -side bottom -fill x
!     }
  #    set @book [Notebook new_as book]
  #    $@book add_section 1 [say posts]
--- 706,715 ----
  		-variable $y -anchor w -command $z] -side left
      }
! 	pack [button .controls.switches.dio -text [say io_errors] -command {netsend [list pd audiostatus]} -padx 5]
      pack .controls.switches -side right
!     frame .debug
! #    pack [label .debug.1 -anchor w -text ""] -side left
!     pack [entry .controls.3 -textvariable ::serial -width 5] -side right
!     pack [label .controls.2 -text "obj.serial: " -justify right] -side right
  #    set @book [Notebook new_as book]
  #    $@book add_section 1 [say posts]
***************
*** 721,724 ****
--- 720,724 ----
  	set ::console [Console new .log]
      }
+     pack .debug -side bottom -fill x
      . configure -menu .mbar
      wm title . "DesireData"
***************
*** 942,946 ****
  		}
  		$menu add command -label [say $name] -command "$self $name" \
! 			-accelerator [accel_munge $k]
  	}
  }
--- 942,946 ----
  		}
  		$menu add command -label [say $name] -command "$self $name" \
! 		    -accelerator [accel_munge $k]
  	}
  }
***************
*** 1921,1928 ****
  def Canvas new_menubar {} {
      set name .$self
!     global pd_opendir cmdline key accels
      set m $name.m
      menu $m
!     foreach x {file edit view put window help} {menu $m.$x -tearoff $::pd_tearoff}
      $self populate_menu file {
  	new_file open_file {}
--- 1921,1928 ----
  def Canvas new_menubar {} {
      set name .$self
!     global pd_opendir pd_tearoff cmdline key accels
      set m $name.m
      menu $m
!     foreach x {file edit view put window help} {menu $m.$x -tearoff $pd_tearoff}
      $self populate_menu file {
  	new_file open_file {}
***************
*** 2040,2043 ****
--- 2040,2048 ----
  	set @text $text
  	set @longline 0
+ 	# @textoffset is for offseting the text item/widget, ie, ObjectBox vs NumBox
+ 	switch [$self class] {
+ 		NumBox {set @textoffset [list 10 2]}
+ 		default {set @textoffset [list 2 2]}
+ 	}
  }
  
***************
*** 2052,2061 ****
  		set t [$@canvas widget].${self}text
  		if {![winfo exists $t]} {$self draw_edit}
! 		$self item text window [list [expr {$x1+2}] [expr {$y1+2}]] \
  		-window $t -anchor nw -tags "${self}text $self text"
  	} {
  		set text $@text
  		if {$::leet} {set text [string map -nocase {a 4 e 3 t 7 s 5 i 1 o 0 g 9} $text]}
! 		$self item TEXT text [l+ {2 2} [list $x1 $y1]] \
  		    -font [View_look $self font] -text $text \
  		    -fill [View_look $self fg] -anchor nw
--- 2057,2066 ----
  		set t [$@canvas widget].${self}text
  		if {![winfo exists $t]} {$self draw_edit}
! 		$self item text window [l+ $@textoffset [$self xy]] \
  		-window $t -anchor nw -tags "${self}text $self text"
  	} {
  		set text $@text
  		if {$::leet} {set text [string map -nocase {a 4 e 3 t 7 s 5 i 1 o 0 g 9} $text]}
! 		$self item TEXT text [l+ $@textoffset [$self xy]] \
  		    -font [View_look $self font] -text $text \
  		    -fill [View_look $self fg] -anchor nw
***************
*** 2105,2111 ****
  	bind $t <Escape>         "$self unedit 0"
  	mset {cx cy} [$self xy]
! 	$self item text window [list [expr $cx+2] [expr $cy+2]] \
  		-window $t -anchor nw -tags "${self}text $self text"
! 	$t configure -pady 0 -padx 1
  	$t insert 1.0 $@text
  	$self resize none
--- 2110,2116 ----
  	bind $t <Escape>         "$self unedit 0"
  	mset {cx cy} [$self xy]
! 	$self item text window [l+ $@textoffset [$self xy]] \
  		-window $t -anchor nw -tags "${self}text $self text"
! 	$t configure -pady 0 -padx 0
  	$t insert 1.0 $@text
  	$self resize none
***************
*** 2117,2121 ****
  	set t $c.${self}text
  	$self long_line
! 	set width [string length [$t get $@longline.0 "$@longline.end + 1 chars"]]
  	if {$key == "BackSpace"} {set width [expr $width - 1]}
  	$t configure -width $width
--- 2122,2134 ----
  	set t $c.${self}text
  	$self long_line
! 	set fixed [font metrics [$self look font] -fixed]
! 	set text [$t get $@longline.0 "$@longline.end + 1 chars"]
! 	if {$fixed} {
! 		set width [string length $text]
! 	} else {
! 		set textpix [font measure [$self look font] $text]
! 		set fwidth [font measure [$self look font] 0]
! 		set width [expr ($textpix+$fwidth-1)/$fwidth]
! 	}
  	if {$key == "BackSpace"} {set width [expr $width - 1]}
  	$t configure -width $width
***************
*** 2167,2174 ****
  	set c [$@canvas widget]
  	set t $c.${self}text
- 	set padx [$self look fontpadx]
- 	set pady [$self look fontpady]
  	set width [font measure [$self look font] W]
- 	#set width [$self look fontwidth];set height [$self look fontheight]
  	set ls [font metrics [$self look font] -linespace]
  	if {[winfo exists $c.${self}text]} {
--- 2180,2184 ----
***************
*** 2178,2189 ****
  	set height [expr {$nl*$ls}]
  	#set height [expr [font metrics [$self look font] -linespace] * $nl]
! 	set textwidth [expr {$padx+$width*($n+$@edit)}]
  	if {[llength [$c gettags ${self}TEXT]]} {
  		mset {x1 y1 x2 y2} [$c bbox ${self}TEXT]
! 		set textwidth [expr {(($x2 - $x1)/[$@canvas zoom])+$padx}]
  	}
  	catch {
  		set text [$c.${self}text get $@longline.0 $@longline.end]
! 		set textwidth [expr {[font measure [$self look font] $text]+$padx*2+2}]
  	}
  	set iowidth [$self look iowidth]
--- 2188,2200 ----
  	set height [expr {$nl*$ls}]
  	#set height [expr [font metrics [$self look font] -linespace] * $nl]
! 	set textwidth [expr {$width*($n+$@edit)}]
  	if {[llength [$c gettags ${self}TEXT]]} {
  		mset {x1 y1 x2 y2} [$c bbox ${self}TEXT]
! 		set textwidth [expr {(($x2 - $x1)/[$@canvas zoom])}]
  	}
  	catch {
+ 		
  		set text [$c.${self}text get $@longline.0 $@longline.end]
! 		set textwidth [expr {[font measure [$self look font] $text]+20}];#+20 hack
  	}
  	set iowidth [$self look iowidth]
***************
*** 2191,2195 ****
  	set bottomwidth [expr {(2*$@noutlets-1)*$iowidth}]
  	set @xs [max [$self look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
! 	set @ys [expr {$pady+$height}]
  }
  #-----------------------------------------------------------------------------------
--- 2202,2206 ----
  	set bottomwidth [expr {(2*$@noutlets-1)*$iowidth}]
  	set @xs [max [$self look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
! 	set @ys [expr {3+$height}]
  }
  #-----------------------------------------------------------------------------------
***************
*** 2272,2276 ****
  	set @text $text
  	set l {}
! 	foreach char [split $@textn ""] {lappend l [scan $char %c]}
  	netsend [list .$@canvas text_setto $self $l] [list $@canvas new_object_callback]
  	$self changed
--- 2283,2287 ----
  	set @text $text
  	set l {}
! 	foreach char [split $@text ""] {lappend l [scan $char %c]}
  	netsend [list .$@canvas text_setto $self $l] [list $@canvas new_object_callback]
  	$self changed
***************
*** 4842,4850 ****
  	set @clickpos {}
  	set @key_input 0
- 	set padx [$self look fontpadx];set pady [$self look fontpady]
  	set width [font measure [$self look font] W]
  	set height [font metrics [$self look font] -linespace]
! 	set @xs [expr $padx+$width*$@w]
! 	set @ys [expr $pady+$height]
  }
  
--- 4853,4860 ----
  	set @clickpos {}
  	set @key_input 0
  	set width [font measure [$self look font] W]
  	set height [font metrics [$self look font] -linespace]
! 	set @xs [expr ($width*$@w)+3]
! 	set @ys [expr $height+3]
  }
  
***************
*** 4933,4938 ****
  }
  
  class_new NumBox {Labeled AtomBox}
! def NumBox popup_properties {} {IEMPropertiesDialog new $self}
  
  def NumBox init {mess} {
--- 4943,4949 ----
  }
  
+ #class_new NumBox {Labeled Box}
  class_new NumBox {Labeled AtomBox}
! def Box popup_properties {} {IEMPropertiesDialog new $self}
  
  def NumBox init {mess} {
***************
*** 4963,4966 ****
--- 4974,4978 ----
  	if {$focused} {set color4 #00ff00} {set color4 [$self look bg]}
  	$self item BASE4  polygon $points2 -outline [$self look frame3] -fill $color4
+ 	$c raise ${self}BASE4
  	if {!$focused} {set @text $@val}
  }
***************
*** 5628,5635 ****
  	set w [expr (1 / ($r - $l)) * $width]
  	set h [expr (1 / ($b - $t)) * $height]
! 	set x1 [expr ($w*$l+$cx1)/$z]
! 	set y1 [expr ($h*$t+$cy1)/$z]
! 	set x2 [expr $x1+$width-7]
! 	set y2 [expr $height+$y1-7]
  	set h1 [list $x1 $y $x2 $y]
         	set v1 [list $x $y1 $x $y2]
--- 5640,5648 ----
  	set w [expr (1 / ($r - $l)) * $width]
  	set h [expr (1 / ($b - $t)) * $height]
! 	set x1 [expr ($w*$l+$cx1+7)/$z]
! 	set y1 [expr ($h*$t+$cy1+7)/$z]
! 	set x2 [expr $x1+$width-14]
! 	set y2 [expr $height+$y1-14]
! 
  	set h1 [list $x1 $y $x2 $y]
         	set v1 [list $x $y1 $x $y2]





More information about the Pd-cvs mailing list