Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11425
Modified Files: Tag: devel_0_39 desire.tk Log Message: first attempt on the font bomb
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.405 retrieving revision 1.1.2.406 diff -C2 -d -r1.1.2.405 -r1.1.2.406 *** desire.tk 25 Aug 2006 13:46:32 -0000 1.1.2.405 --- desire.tk 25 Aug 2006 16:24:35 -0000 1.1.2.406 *************** *** 509,512 **** --- 509,514 ---- #-----------------------------------------------------------------------------------# set font(size) 12 + set font(name) courier + set font(style) normal set font(str2) "-*-courier-medium--normal--%d-*" set font(str) [format -*-courier-medium--normal--%d-* $font(size)] *************** *** 617,621 **** set key(Canvas:paths) "" set key(Canvas:text_editor) "Ctrl+t" ! set key(Canvas:font_bomb) "" set key(Canvas:audio_on) "Ctrl+slash" set key(Canvas:audio_off) "Ctrl+period" --- 619,623 ---- set key(Canvas:paths) "" set key(Canvas:text_editor) "Ctrl+t" ! set key(Canvas:font_bomb) "Ctrl+F" set key(Canvas:audio_on) "Ctrl+slash" set key(Canvas:audio_off) "Ctrl+period" *************** *** 1445,1448 **** --- 1447,1452 ---- def Canvas history {} {return $@history}
+ def* Canvas font_bomb {} {FontBombDialog new_as fontbomb} + #-----------------------------------------------------------------------------------#
*************** *** 5840,5844 **** --- 5844,5943 ---- $self page_select 1 } + ############ font bomb ###########
+ class_new FontBombDialog {Dialog} + + + def* FontBombDialog get_xlfd {name style size} { + #global bold italic fontsize + set fstring "" + set facename [.$self.font.list.box get [.$self.font.list.box curselection]] + if {$style == "bold"} { + set fstring "*-$facename-bold" + } else { + set fstring "*-$facename-medium" + } + if {$style == "italic"} { + if {$facename == "Helvetica" || $facename == "Courier"} { + set fstring "$fstring-o-normal--$size-*" + } else { + set fstring "$fstring-i-normal--$size-*" + } + } else { + set fstring "$fstring-r-normal--$size-*" + } + return $fstring + } + + def* FontBombDialog resetfont {} { + global font + set xlfd [$self get_xlfd $font(name) $font(style) $@size] + .$self.font2.preview.entry configure -font $xlfd + } + + def* FontBombDialog changesize {y} { + global font + set f .$self + set @size [expr $@size - $y] + $f.font.size.entry delete 0 end + $f.font.size.entry insert 0 $@size + puts "$font(size)" + } + + def* FontBombDialog init {} { + global font + super reset cancel apply ok + #$self add .fontbomb [say "fontbomb"] + set f .$self + #wm geometry $f 346x334 + bind all <KeyPress-F1> help + #set fontsize $font(size) + set @size $font(size) + 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 + + # Insert the font names into the list box + foreach name {Charter Clean Courier Helvetica Lucida LucidaBright\ + LucidaTypewriter {New Century Schoolbook} Symbol Times\ + fixed terminal} { + $f.font.list.box insert end $name + } + + bind $f.font.list.box <ButtonRelease-1> "$self resetfont" + + 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 + pack [scrollbar $f.font.size.scroll -command "$self changesize"] -side right -fill y + $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 resetFont] -side top + pack [checkbutton $f.font.style.italic -text "Italic" -variable italic -command resetFont] -side top + + frame $f.font2 + frame $f.font2.preview + pack [label $f.font2.preview.label -text "Preview:"] -side left -fill y + pack [entry $f.font2.preview.entry -width 10 -relief sunken -textvariable previewtext] -side right + $f.font2.preview.entry insert 0 "D351r3D474" + + + 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 #########