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

chunlee chunlee at users.sourceforge.net
Sat Aug 26 19:16:23 CEST 2006


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

Modified Files:
      Tag: devel_0_39
	desire.tk 
Log Message:
fontbomb in ddrc editor??


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.409
retrieving revision 1.1.2.410
diff -C2 -d -r1.1.2.409 -r1.1.2.410
*** desire.tk	26 Aug 2006 13:47:40 -0000	1.1.2.409
--- desire.tk	26 Aug 2006 17:16:20 -0000	1.1.2.410
***************
*** 4878,4881 ****
--- 4878,4882 ----
  
  class_new Dialog {Thing}
+ 
  def Dialog add {w args} {
      set no_max_label 0
***************
*** 5093,5096 ****
--- 5094,5219 ----
  }
  
+ def* Dialog add_fontbomb {f args} {
+     set no_max_label 0
+     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
+ 	set previewtext "Sample text"
+ 
+ 	frame $f.font
+ 	pack [label $f.font.label -text "Name:" -anchor w] -side top -fill x
+ 	frame $f.font.list
+ 	puts "	$f.font.list.box"
+ 	pack [listbox $f.font.list.box -relief sunken -yscrollcommand "$f.font.list.scroll set"] -side left
+ 	pack [scrollbar $f.font.list.scroll -relief sunken -command "$f.font.list.box yview"] -side right -fill y
+ 	
+ 	foreach name [font families] { $f.font.list.box insert end $name}
+ 	
+ 	bind $f.font.list.box <ButtonRelease-1> "$self font_update $f"
+ 	
+ 	frame $f.font.size
+ 	pack [label $f.font.size.label -text "Size:"] -side left
+ 	pack [entry $f.font.size.entry -relief sunken -textvariable fontsize -width 4] -side left
+ 	bind $f.font.size.entry <KeyPress-Return> "$self font_update_size $f"
+ 	pack [scrollbar $f.font.size.scroll -command "$self font_changesize $f"] -side right -fill y
+ 	$f.font.size.entry delete 0 end
+ 	$f.font.size.entry insert 0 $@size
+ 	
+ 	frame $f.font.style
+ 	pack [label $f.font.style.label -text "Style:"] -side left -fill y
+ 	pack [checkbutton $f.font.style.bold -text "Bold" -variable bold -command "$self font_style $f bold"] -side top
+ 	pack [checkbutton $f.font.style.italic -text "Italic" -variable @italic -command "$self font_style $f italic"] -side top
+ 	
+ 	frame $f.font2
+ 	frame $f.font2.preview
+ 	pack [label $f.font2.preview.label -text "Preview:"] -side left -fill y
+ 	pack [canvas $f.font2.preview.canvas -width 200 -height 50 -relief sunken -borderwidth 1]  -side right
+ 	$f.font2.preview.canvas create text 10 25 -tags ${self}TEXT -anchor w -text "DesireData" -font $@fstr
+ 
+ 	pack $f.font.list -side left -fill y
+ 	pack $f.font.size -side top -fill x
+ 	pack $f.font.style -side top -fill x
+ 	pack $f.font2.preview -side bottom
+ 	pack $f.font -side top
+ 	pack $f.font2 -side bottom
+     #foreach row $args {
+ 	#set name [lindex $row 0]
+ 	#set type [lindex $row 1]
+ 	#set options [lrange $row 2 end]
+ 	#set f $w.$name
+ 	#set label "[say $name]: "
+ 	#set k [lsearch $options -choices]
+ 	#puts "	name: $name | type: $type | option: $options | k: $k"
+ 	#if {$k>=0} {
+ 	#	set choices [lindex   $options    [expr $k+1]]
+ 	#	set options [lreplace $options $k [expr $k+1]]
+ 	#}
+ 	#set v $@$name
+ 	#set v $_($self:$name) ;# bug in objtcl
+        
+ 	#pack $f -side top -fill x
+ 	
+ 	
+ 	#if {!$no_max_label} {
+ 	#	catch {$f.label configure -width $_($self:max_label) -anchor e}
+ 	#}
+     #}
+ }
+ 
+ def* Dialog font_get_xlfd {f name style size} {
+   set fstring ""
+   set list_pos [$f.font.list.box curselection]
+   if {$list_pos != ""} {set @font [$f.font.list.box get [$f.font.list.box curselection]]}
+   if {$style == "bold"} {
+     set fstring "*-$@font-bold"
+   } else {
+     set fstring "*-$@font-medium"
+   }
+   if {$@italic} {
+     if {$@font == "Helvetica" || $@font == "Courier"} {
+       set @str "$fstring-o-normal--$size-*"
+       set @str2 "$fstring-o-normal--%d-*"
+     } else {
+       set @str "$fstring-i-normal--$size-*"
+       set @str2 "$fstring-i-normal--%d-*"
+     }
+   } else {
+     set @str "$fstring-r-normal--$size-*"
+     set @str2 "$fstring-r-normal--%d-*"
+   }
+ }
+ 
+ def* Dialog font_update {f} {
+ 	global font
+ 	$self font_get_xlfd $f $@font $@style $@size
+ 	$f.font2.preview.canvas itemconfigure ${self}TEXT -font $@str
+ }
+ 
+ def* Dialog font_changesize {f y} {
+ 	#set f .$self
+ 	set @size [expr $@size - $y]
+ 	$f.font.size.entry delete 0 end
+ 	$f.font.size.entry insert 0 $@size
+ 	$self font_update $f
+ }
+ 
+ def* Dialog font_style {f style} {
+ 	if {$style != "italic"} {
+ 		if {$style == $@style} { set @style "normal" } else { set @style $style} 
+ 	}
+ 	$self font_update $f
+ }
+ 
+ def* Dialog font_update_size {f} {
+ 	set size [$f.font.size.entry get]
+ 	if [regexp {^[0-9]+$} $size] {set @size $size} 
+ 	$self font_update $f
+ }
+ 
  ############ .pdrc editor
  #Turns #rgb into 3 elem list of decimal vals.
***************
*** 5540,5543 ****
--- 5663,5667 ----
    key Canvas about
  section Client font
+   font Client font
  section Client others
    crosshair Canvas hairstate
***************
*** 5759,5763 ****
  def* ClientPrefsDialog reset {} {
  }
! def ClientPrefsDialog init {} {
  	global ddrc_options look key crosshair bar
  	$self read
--- 5883,5887 ----
  def* ClientPrefsDialog reset {} {
  }
! def* ClientPrefsDialog init {} {
  	global ddrc_options look key crosshair bar
  	$self read
***************
*** 5855,5858 ****
--- 5979,5986 ----
  		$self add $which_section [list [lindex $str 0] toggle]
  	    }
+ 	    font {
+ 	    	puts "	adding font bomb"
+ 	    	$self add_fontbomb $which_section [list [lindex $str 0] toggle]
+ 	    }
  	    default {
  		$self add $which_section [list $name $type]
***************
*** 5865,5921 ****
  
  class_new FontBombDialog {Dialog}
- 
- 
- def* FontBombDialog get_xlfd {name style size} {
-   set fstring ""
-   set list_pos [.$self.font.list.box curselection]
-   if {$list_pos != ""} {set @font [.$self.font.list.box get [.$self.font.list.box curselection]]}
-   if {$style == "bold"} {
-     set fstring "*-$@font-bold"
-   } else {
-     set fstring "*-$@font-medium"
-   }
-   if {$@italic} {
-     if {$@font == "Helvetica" || $@font == "Courier"} {
-       set @str "$fstring-o-normal--$size-*"
-       set @str2 "$fstring-o-normal--%d-*"
-     } else {
-       set @str "$fstring-i-normal--$size-*"
-       set @str2 "$fstring-i-normal--%d-*"
-     }
-   } else {
-     set @str "$fstring-r-normal--$size-*"
-     set @str2 "$fstring-r-normal--%d-*"
-   }
- }
- 
- def* FontBombDialog update {} {
- 	global font
- 	$self get_xlfd $@font $@style $@size
- 	.$self.font2.preview.canvas itemconfigure ${self}TEXT -font $@str
- }
- 
- def* FontBombDialog changesize {y} {
- 	set f .$self
- 	set @size [expr $@size - $y]
- 	$f.font.size.entry delete 0 end
- 	$f.font.size.entry insert 0 $@size
- 	$self update
- }
- 
- def* FontBombDialog style {style} {
- 	if {$style != "italic"} {
- 		if {$style == $@style} { set @style "normal" } else { set @style $style} 
- 	}
- 	$self update
- }
- 
- def* FontBombDialog update_size {} {
- 	set size [.$self.font.size.entry get]
- 	puts "	size $size"
- 	if [regexp {^[0-9]+$} $size] {set @size $size} 
- 	$self update
- }
- 
  def* FontBombDialog apply {} {
  	global look
--- 5993,5996 ----
***************
*** 5942,5991 ****
  	super cancel ok
  	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
! 	set previewtext "Sample text"
! 
! 	frame $f.font
! 	pack [label $f.font.label -text "Name:" -anchor w] -side top -fill x
! 	frame $f.font.list
! 	pack [listbox $f.font.list.box -relief sunken -yscrollcommand "$f.font.list.scroll set"] -side left
! 	pack [scrollbar $f.font.list.scroll -relief sunken -command "$f.font.list.box yview"] -side right -fill y
! 	
! 	foreach name [font families] { $f.font.list.box insert end $name}
! 	
! 	bind $f.font.list.box <ButtonRelease-1> "$self update"
! 	
! 	frame $f.font.size
! 	pack [label $f.font.size.label -text "Size:"] -side left
! 	pack [entry $f.font.size.entry -relief sunken -textvariable fontsize -width 4] -side left
! 	bind $f.font.size.entry <KeyPress-Return> "$self update_size"
! 	pack [scrollbar $f.font.size.scroll -command "$self changesize"] -side right -fill y
! 	$f.font.size.entry delete 0 end
! 	$f.font.size.entry insert 0 $@size
! 	
! 	frame $f.font.style
! 	pack [label $f.font.style.label -text "Style:"] -side left -fill y
! 	pack [checkbutton $f.font.style.bold -text "Bold" -variable bold -command "$self style bold"] -side top
! 	pack [checkbutton $f.font.style.italic -text "Italic" -variable @italic -command "$self style italic"] -side top
! 	
! 	frame $f.font2
! 	frame $f.font2.preview
! 	pack [label $f.font2.preview.label -text "Preview:"] -side left -fill y
! 	pack [canvas $f.font2.preview.canvas -width 200 -height 50 -relief sunken -borderwidth 1]  -side right
! 	$f.font2.preview.canvas create text 10 25 -tags ${self}TEXT -anchor w -text "DesireData" -font $@fstr
! 
! 	pack $f.font.list -side left -fill y
! 	pack $f.font.size -side top -fill x
! 	pack $f.font.style -side top -fill x
! 	pack $f.font2.preview -side bottom
! 	pack $f.font -side top
! 	pack $f.font2 -side bottom
! 
  }
  ############ other stuff #########
--- 6017,6021 ----
  	super cancel ok
  	set f .$self
! 	$self add_fontbomb $f foo 
  }
  ############ other stuff #########





More information about the Pd-cvs mailing list