[PD-cvs] pd/src desire.tk,1.1.2.408,1.1.2.409

chunlee chunlee at users.sourceforge.net
Sat Aug 26 15:47:43 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
merged font(*) to look(Thing:font*)


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.408
retrieving revision 1.1.2.409
diff -C2 -d -r1.1.2.408 -r1.1.2.409
*** desire.tk	25 Aug 2006 23:18:26 -0000	1.1.2.408
--- desire.tk	26 Aug 2006 13:47:40 -0000	1.1.2.409
***************
*** 508,526 ****
  }
  #-----------------------------------------------------------------------------------#
- set font(size) 12
- set font(name) courier
- set font(style) normal
- set font(italic) 0
- set font(str2) "-*-courier-medium--normal--%d-*"
- set font(str) [format -*-courier-medium--normal--%d-* $font(size)]
- set font(width)  [font measure $font(str) W]
- set font(height) [font metrics $font(str) -linespace]
- set font(pady) 3
- set font(padx) 5
- #-----------------------------------------------------------------------------------#
  set look(extrapix) [switch $OS {
          osx     {concat 2}
          default {concat 1}}]
  
  set look(View:tooltip) 1
  set look(View:iowidth) 7
--- 508,527 ----
  }
  #-----------------------------------------------------------------------------------#
  set look(extrapix) [switch $OS {
          osx     {concat 2}
          default {concat 1}}]
  
+ #font is defined as Thing for now, as fontbomb and (later on the completion) needs
+ #to get to these ones. 
+ set look(Thing:fontsize) 12
+ set look(Thing:fontfamily) courier
+ set look(Thing:fontstyle) normal
+ set look(Thing:fontitalic) 0
+ set look(Thing:fontstr2) "-*-courier-medium--normal--%d-*"
+ set look(Thing:fontstr) [format -*-courier-medium--normal--%d-* $look(Thing:fontsize)]
+ set look(Thing:fontwidth)  [font measure $look(Thing:fontstr) W]
+ set look(Thing:fontheight) [font metrics $look(Thing:fontstr) -linespace]
+ set look(Thing:fontpady) 3
+ set look(Thing:fontpadx) 5
  set look(View:tooltip) 1
  set look(View:iowidth) 7
***************
*** 1103,1106 ****
--- 1104,1108 ----
  def* View unclick {x y f target} {}
  def  View  motion {x y f target} {}
+ #class that are not view but need to look are: completionbox, dialog
  def Thing look {k} {
  	global look
***************
*** 1145,1150 ****
  		set find [lsearch $args "-font"]
  		if {$find >= 0} {
! 			set new_size [format %.0f [expr $font(size)*$scale]]
! 			set s [format $font(str2) $new_size]
  			set args [lreplace $args [expr $find + 1] [expr $find + 1] $s]
  		}
--- 1147,1154 ----
  		set find [lsearch $args "-font"]
  		if {$find >= 0} {
! 			#set new_size [format %.0f [expr $font(size)*$scale]]
! 			set new_size [format %.0f [expr [$self look fontsize]*$scale]]
! 			#set s [format $font(str2) $new_size]
! 			set s [format [$self look fontstr2] $new_size]
  			set args [lreplace $args [expr $find + 1] [expr $find + 1] $s]
  		}
***************
*** 1686,1691 ****
  	$t configure -width [string length [$t get 0.0 end]]
      } {
  	$self item TEXT text [l+ {2 2} [list $x1 $y1]] \
! 		-font $font(str) -text $@text -fill [$self look fg] -anchor nw
      }
      $self update_size
--- 1690,1697 ----
  	$t configure -width [string length [$t get 0.0 end]]
      } {
+ 	#$self item TEXT text [l+ {2 2} [list $x1 $y1]] \
+ 	#	-font $font(str) -text $@text -fill [$self look fg] -anchor nw
  	$self item TEXT text [l+ {2 2} [list $x1 $y1]] \
! 		-font [$self look fontstr] -text $@text -fill [$self look fg] -anchor nw
      }
      $self update_size
***************
*** 1708,1719 ****
  	$self update_size
  	#bind Text <Tab> "$self tab; continue"
! 	set new_size [format %.0f [expr $font(size)*$_($@canvas:scale)]]
! 	set font_str [format $font(str2) $new_size]
  	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 [$self look fg]
- 	#text $t -height 1 -width [expr [string length $@text]+1] -relief flat \
- 	#	-bg [$self look bg] -borderwidth 0 -highlightthickness 0\
- 	#	-font $font_str -fg [$self look fg]
  	bind $t <Key>            "$self key %W %x %y %K %A 0"
  	bind $t <Control-Return> "$self key %W %x %y 10 %A 0"
--- 1714,1724 ----
  	$self update_size
  	#bind Text <Tab> "$self tab; continue"
! 	#set new_size [format %.0f [expr $font(size)*$_($@canvas:scale)]]
! 	set new_size [format %.0f [expr [$self look fontsize]*$_($@canvas:scale)]]
! 	#set font_str [format $font(str2) $new_size]
! 	set font_str [format [$self look fontstr2] $new_size]
  	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 [$self look fg]
  	bind $t <Key>            "$self key %W %x %y %K %A 0"
  	bind $t <Control-Return> "$self key %W %x %y 10 %A 0"
***************
*** 1746,1753 ****
  	global font
  	set n [string length $@text]
! 	set textwidth [expr $font(padx)+$font(width)*($n+$@edit)]
  	if {[llength [.$@canvas.c gettags ${self}TEXT]]} {
  		mset {x1 y1 x2 y2} [.$@canvas.c bbox ${self}TEXT]
! 		set textwidth [expr (($x2 - $x1)/[$@canvas scale])+$font(padx)]
  	}
  	#if {[llength [.$@canvas.c gettags ${self}text]]} {
--- 1751,1760 ----
  	global font
  	set n [string length $@text]
! 	set padx [$self look fontpadx];set pady [$self look fontpady]
! 	set width [$self look fontwidth];set height [$self look fontheight]
! 	set textwidth [expr $padx+$width*($n+$@edit)]
  	if {[llength [.$@canvas.c gettags ${self}TEXT]]} {
  		mset {x1 y1 x2 y2} [.$@canvas.c bbox ${self}TEXT]
! 		set textwidth [expr (($x2 - $x1)/[$@canvas scale])+$padx]
  	}
  	#if {[llength [.$@canvas.c gettags ${self}text]]} {
***************
*** 1755,1759 ****
  		set n [expr [string length [.$@canvas.c.${self}text get 1.0 1.end]] -1]
  		mset {x1 y1 w h} [.$@canvas.c.${self}text bbox 1.$n]
! 		set textwidth [expr ($font(padx) + $x1 + ($w * 2)+$font(padx)+2) / [$@canvas scale]]	
  	}
  	#}
--- 1762,1766 ----
  		set n [expr [string length [.$@canvas.c.${self}text get 1.0 1.end]] -1]
  		mset {x1 y1 w h} [.$@canvas.c.${self}text bbox 1.$n]
! 		set textwidth [expr ($padx + $x1 + ($w * 2)+$padx+2) / [$@canvas scale]]	
  	}
  	#}
***************
*** 1762,1766 ****
  	set bottomwidth [expr (2*$@noutlets-1) * [$self look iowidth]]
  	set @xs [max [$self look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
! 	set @ys [expr $font(pady)+$font(height)]
  }
  #-----------------------------------------------------------------------------------
--- 1769,1773 ----
  	set bottomwidth [expr (2*$@noutlets-1) * [$self look iowidth]]
  	set @xs [max [$self look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
! 	set @ys [expr $pady+$height]
  }
  #-----------------------------------------------------------------------------------
***************
*** 3311,3316 ****
  		set string [string range $@text 0 [expr $@w-1]]
  	}
  	$self item TEXT text [l+ {2 2} [list $x1 $y1]] \
! 		-text $string -fill [$self look fg] -font $font(str) -anchor nw
  }
  
--- 3318,3325 ----
  		set string [string range $@text 0 [expr $@w-1]]
  	}
+ 	#$self item TEXT text [l+ {2 2} [list $x1 $y1]] \
+ 	#	-text $string -fill [$self look fg] -font $font(str) -anchor nw
  	$self item TEXT text [l+ {2 2} [list $x1 $y1]] \
! 		-text $string -fill [$self look fg] -font [$self look fontstr] -anchor nw
  }
  
***************
*** 3668,3676 ****
  	global font
  	if {!$@w} {set @w 5}
! 	set textwidth [expr $font(padx)+$font(width)*$@w]
  	set topwidth    [expr (2* $@ninlets-1) * [$self look iowidth]]
  	set bottomwidth [expr (2*$@noutlets-1) * [$self look iowidth]]
  	set @xs [max [$self look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
! 	set @ys [expr $font(pady)+$font(height)]
  }
  
--- 3677,3687 ----
  	global font
  	if {!$@w} {set @w 5}
! 	set padx [$self look fontpadx];set pady [$self look fontpady]
! 	set width [$self look fontwidth];set height [$self look fontheight]
! 	set textwidth [expr $padx+$width*$@w]
  	set topwidth    [expr (2* $@ninlets-1) * [$self look iowidth]]
  	set bottomwidth [expr (2*$@noutlets-1) * [$self look iowidth]]
  	set @xs [max [$self look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
! 	set @ys [expr $pady+$height]
  }
  
***************
*** 3724,3732 ****
  def NumBox update_size {} {
  	global font
! 	set textwidth [expr $font(padx)+$font(width)*[string length $@buf]]
  	set topwidth    [expr (2* $@ninlets-1) * [$self look iowidth]]
  	set bottomwidth [expr (2*$@noutlets-1) * [$self look iowidth]]
  	set @xs [max [$self look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
! 	set @ys  [expr $font(pady)+$font(height)]
  }
  
--- 3735,3745 ----
  def NumBox update_size {} {
  	global font
! 	set padx [$self look fontpadx];set pady [$self look fontpady]
! 	set width [$self look fontwidth];set height [$self look fontheight]
! 	set textwidth [expr $padx+$width*[string length $@buf]]
  	set topwidth    [expr (2* $@ninlets-1) * [$self look iowidth]]
  	set bottomwidth [expr (2*$@noutlets-1) * [$self look iowidth]]
  	set @xs [max [$self look minobjwidth] [max $bottomwidth [max $topwidth $textwidth]]]
! 	set @ys  [expr $pady+$height]
  }
  
***************
*** 3750,3757 ****
  	$self item BASE   polygon $points  -fill [parse_color $@bcol] -outline [$self look frame3]
  	$self item BASE4  polygon $points2 -fill $color4 -outline [$self look frame3]
! 	#$self item NUMBER text [list $xt $yt] -anchor w -text [$self ftoa] \
  	#	-font $font(str) -fill [parse_color $@fcol]
  	$self item NUMBER text [list $xt $yt] -anchor w -text $@text \
! 		-font $font(str) -fill [parse_color $@fcol]
  	$c delete ${self}CURS
  	if {[string length $@buf]>0} {
--- 3763,3770 ----
  	$self item BASE   polygon $points  -fill [parse_color $@bcol] -outline [$self look frame3]
  	$self item BASE4  polygon $points2 -fill $color4 -outline [$self look frame3]
! 	#$self item NUMBER text [list $xt $yt] -anchor w -text $@text \
  	#	-font $font(str) -fill [parse_color $@fcol]
  	$self item NUMBER text [list $xt $yt] -anchor w -text $@text \
! 		-font [$self look fontstr] -fill [parse_color $@fcol]
  	$c delete ${self}CURS
  	if {[string length $@buf]>0} {
***************
*** 4248,4253 ****
  	mset {x1 y1} {0 0}
  	set @name (unknown)
  	$self item TEXT text [list $x1 $y1] \
! 		-font $font(str) -text "an array named '$@name' should appear in this patch" \
  		-fill [$self look fg] -anchor nw
  }
--- 4261,4269 ----
  	mset {x1 y1} {0 0}
  	set @name (unknown)
+ 	#$self item TEXT text [list $x1 $y1] \
+ 	#	-font $font(str) -text "an array named '$@name' should appear in this patch" \
+ 	#	-fill [$self look fg] -anchor nw
  	$self item TEXT text [list $x1 $y1] \
! 		-font [$self look fontstr] -text "an array named '$@name' should appear in this patch" \
  		-fill [$self look fg] -anchor nw
  }
***************
*** 5523,5526 ****
--- 5539,5543 ----
    key Canvas {load_meter latency_meter}
    key Canvas about
+ section Client font
  section Client others
    crosshair Canvas hairstate
***************
*** 5880,5884 ****
  
  def* FontBombDialog changesize {y} {
- 	global font
  	set f .$self
  	set @size [expr $@size - $y]
--- 5897,5900 ----
***************
*** 5886,5890 ****
  	$f.font.size.entry insert 0 $@size
  	$self update
- 	puts "$font(size)"
  }
  
--- 5902,5905 ----
***************
*** 5904,5917 ****
  
  def* FontBombDialog apply {} {
! 	global font
  	$self get_xlfd $@font $@style $@size
! 	set font(size) $@size
! 	set font(name) $@font
! 	set font(style) $@style
! 	set font(italic) $@italic
! 	set font(str) $@str
! 	set font(str2) $@str2
! 	set font(width)  [font measure $@str W]
! 	set font(height) [font metrics $@str -linespace]
  	puts "	font :: $@font"
  	puts "	size :: $@size"
--- 5919,5932 ----
  
  def* FontBombDialog apply {} {
! 	global look
  	$self get_xlfd $@font $@style $@size
! 	set look(Thing:fontsize) $@size
! 	set look(Thing:fontfamily) $@font
! 	set look(Thing:fontstyle) $@style
! 	set look(Thing:fontitalic) $@italic
! 	set look(Thing:fontstr) $@str
! 	set look(Thing:fontstr2) $@str2
! 	set look(Thing:fontwidth)  [font measure $@str W]
! 	set look(Thing:fontheight) [font metrics $@str -linespace]
  	puts "	font :: $@font"
  	puts "	size :: $@size"
***************
*** 5928,5936 ****
  	set f .$self
  	bind all <KeyPress-F1> help
! 	set @size $font(size)
! 	set @font $font(name)
! 	set @style $font(style)
! 	set @italic $font(italic)
! 	set @fstr $font(str)
  	set bold 0
  	set italic 0
--- 5943,5951 ----
  	set f .$self
  	bind all <KeyPress-F1> help
! 	set @size [$self look fontsize]
! 	set @font [$self look fontfamily]
! 	set @style [$self look fontstyle]
! 	set @italic [$self look fontitalic]
! 	set @fstr [$self look fontstr]
  	set bold 0
  	set italic 0





More information about the Pd-cvs mailing list