Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30814
Modified Files: Tag: desiredata desire.tk Log Message: add Canvas save_geometry
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.344 retrieving revision 1.1.2.600.2.345 diff -C2 -d -r1.1.2.600.2.344 -r1.1.2.600.2.345 *** desire.tk 11 Aug 2007 18:12:32 -0000 1.1.2.600.2.344 --- desire.tk 11 Aug 2007 22:13:17 -0000 1.1.2.600.2.345 *************** *** 1505,1512 **** --- 1505,1521 ---- }
+ def Canvas save_geometry {} { + set geometry [wm geometry .$self] + puts "geometry $geometry" + foreach {size x y} [split $geometry "+"] {mset {w h} [split $size "x"]; set x1 $x; set y1 $y} + netsend [list .$self bounds $x1 $y1 [expr $x1+$w] [expr $y1+$h]] + } + def Canvas save {} { if {$@subpatch} {return [$@canvas save]} $self checkgeometry + set c [$self widget] if {![regexp {^Untitled-[0-9]} $@name]} { + $self save_geometry netsend [list .$self savetofile $@name $@folder] } else { *************** *** 1521,1524 **** --- 1530,1534 ---- set @file [string range $filename [expr [string last / $filename]+1] end] set @folder [string range $filename 0 [expr [string last / $filename]-1]] + $self save_geometry puts "save $@file dir to $@folder" netsend [list .$self savetofile $@file $@folder] *************** *** 2489,2492 **** --- 2499,2503 ---- # the text should be drawn before, so that update_size works at the right time. mset {x1 y1} [$self xy] + set z [$@canvas zoom] if {$@edit} { $self draw_edit *************** *** 2496,2501 **** 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 -width [expr ($fw*$@max_width)-1] # set width with -1 because text item seem to be inclusive at wrap point # where as the text widget is exclusive --- 2507,2512 ---- 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 [$self look font] -text $text \ ! -fill [$self look fg] -anchor nw -width [expr ($fw*$@max_width)-1] # set width with -1 because text item seem to be inclusive at wrap point # where as the text widget is exclusive *************** *** 2536,2545 **** obj_hist histi= 0 set @selected? 1 ! #set z [$@canvas zoom] ! set z 1 set font_height [font metrics [$self look font] -linespace] if {[$c bbox ${self}TEXT] != ""} { ! mset {ix1 iy1 ix2 iy2} [$c bbox ${self}TEXT] ! if {$iy2-$iy1 > $font_height} {set @multi 1} } else { set ix1 0; set iy1 0 --- 2547,2555 ---- obj_hist histi= 0 set @selected? 1 ! set z [$@canvas zoom] set font_height [font metrics [$self look font] -linespace] if {[$c bbox ${self}TEXT] != ""} { ! mset {ix1 iy1 ix2 iy2} [lmap / [$c bbox ${self}TEXT] $z] ! if {($iy2-$iy1)/$z > $font_height} {set @multi 1} } else { set ix1 0; set iy1 0 *************** *** 2570,2575 **** set t $c.${self}text #set z [$@canvas zoom] - set z 1 - mset {x1 y1 x2 y2} [$c bbox ${self}text] set pix_height [$t count -update -ypixels 1.0 end] set pix_width [font measure [$self look font] [$t get 1.0 end]] --- 2580,2583 ---- *************** *** 2671,2683 **** set w2 0; set h2 0 set xpad 2; set ypad 3 ! #set z [$@canvas zoom] ! set z 1 if {[winfo exists $t_widget]} { ! set textwidth [expr [winfo reqwidth $t_widget]+$xpad] ! set height [expr [winfo reqheight $t_widget]+$ypad] } else { mset {x1 y1 x2 y2} [[[$self canvas] widget] bbox ${self}TEXT] ! set textwidth [expr $x2-$x1+$xpad] ! set height [expr $y2-$y1+$ypad] } set iowidth [$self look iowidth] --- 2679,2690 ---- set w2 0; set h2 0 set xpad 2; set ypad 3 ! set z [$@canvas zoom] if {[winfo exists $t_widget]} { ! set textwidth [expr ([winfo reqwidth $t_widget]+$xpad)/$z] ! set height [expr ([winfo reqheight $t_widget]+$ypad)/$z] } else { mset {x1 y1 x2 y2} [[[$self canvas] widget] bbox ${self}TEXT] ! set textwidth [expr ($x2-$x1+$xpad)/$z] ! set height [expr ($y2-$y1+$ypad)/$z] } set iowidth [$self look iowidth]