Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19817
Modified Files: Tag: devel_0_39 desire.tk Log Message: merged the two @obj_in_edit fields together and added an accessor method $canvas obj_in_edit= $self OR $canvas obj_in_edit= {}
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.83 retrieving revision 1.1.2.84 diff -C2 -d -r1.1.2.83 -r1.1.2.84 *** desire.tk 13 Oct 2005 07:03:25 -0000 1.1.2.83 --- desire.tk 13 Oct 2005 08:17:51 -0000 1.1.2.84 *************** *** 662,666 **** set c .x$self.c set focus(canvas) $self - set _(focus) $self toplevel $name -menu $name.m wm geometry $name $geometry --- 662,665 ---- *************** *** 698,701 **** --- 697,701 ---- set @wire_to {} set @children {} + set @obj_in_edit {} }
*************** *** 847,851 **** set name .x$self.c set key [string tolower $key] - set _(focus) $self # for quit/save/undo switch -- $key { --- 847,850 ---- *************** *** 1016,1025 **** }
def* textbox edit {canvas} { global look font if {$@edit} {return} set @edit 1 ! set _($canvas:obj_in_edit_old) $self ! set _($canvas:obj_in_edit) 1 set @selected? 1 .x$canvas.c delete ${self}TEXT --- 1015,1026 ---- }
+ def canvas obj_in_edit {} {return @obj_in_edit} + def canvas obj_in_edit= {v} {set @obj_in_edit $v} + def* textbox edit {canvas} { global look font if {$@edit} {return} set @edit 1 ! $canvas obj_in_edit= $self set @selected? 1 .x$canvas.c delete ${self}TEXT *************** *** 1030,1034 **** -bg ${look(objectbg)} -borderwidth 0 \ -font [format -*-courier-medium--normal--%d-* $font(size)] - set _(focus) $self bind $t <Key> "text_key $self $canvas %W %x %y %K %A 0" bind $t <Control-Return> "text_key $self $canvas %W %x %y 10 %A 0" --- 1031,1034 ---- *************** *** 1069,1073 **** set @edit 0 #if {[info exists _($canvas:selection)]} { ! # if {[info exists _($canvas:obj_in_edit)] && $_($canvas:obj_in_edit)} { # set object [lindex $_($canvas:selection) 0] # $object unedit $canvas --- 1069,1073 ---- set @edit 0 #if {[info exists _($canvas:selection)]} { ! # if {[llength [$canvas obj_in_edit]]} { # set object [lindex $_($canvas:selection) 0] # $object unedit $canvas *************** *** 1078,1083 **** # set _($canvas:selection) {} #} ! #set _($canvas:obj_in_edit) 1 ! #set _($canvas:selection) {} #$canvas selection= $self #puts "new objectbox has text '$@text'" --- 1078,1082 ---- # set _($canvas:selection) {} #} ! #$canvas obj_in_edit= 1 #$canvas selection= $self #puts "new objectbox has text '$@text'" *************** *** 1087,1090 **** --- 1086,1090 ---- # should remove dupes def canvas selection+= {objs} {lappend @selection $objs} + def canvas selection {objs} {return @selection}
def* textbox update_size {} { *************** *** 1189,1196 **** foreach obj $@selection {$obj erase} # before obj is deleted, it will be selected, therefore ! # $@obj_in_edit == 1, so don't forget to set it to 0. # needs to handle obj_in_edit and selection!!! ! set @obj_in_edit 0 ! set @selection 0 }
--- 1189,1196 ---- foreach obj $@selection {$obj erase} # before obj is deleted, it will be selected, therefore ! # $@obj_in_edit != {}, so don't forget to set it to {}. # needs to handle obj_in_edit and selection!!! ! set @obj_in_edit {} ! set @selection {} }
*************** *** 1405,1409 **** $old_obj unedit $self } ! set @obj_in_edit 0 } if {[llength $@selection] > 0} { --- 1405,1409 ---- $old_obj unedit $self } ! set @obj_in_edit {} } if {[llength $@selection] > 0} { *************** *** 1455,1465 **** puts "clicked on black space and in edit mode" # my object edit mode code begins --chun ! if {[info exists @obj_in_edit]} { ! #puts "and some object is being edited" ! if {$@obj_in_edit > 0} { ! [lindex $@selection 0] unedit $self ! set @obj_in_edit 0 ! ! } } if {[llength $@selection] > 0} { --- 1455,1461 ---- puts "clicked on black space and in edit mode" # my object edit mode code begins --chun ! if {[llength $@obj_in_edit]} { ! [lindex $@selection 0] unedit $self ! set @obj_in_edit {} } if {[llength $@selection] > 0} { *************** *** 1599,1604 **** switch $_($@selection:class) { objectbox { ! if {!$@obj_in_edit} { ! set @obj_in_edit 1 [lindex $@selection 0] edit $self } --- 1595,1600 ---- switch $_($@selection:class) { objectbox { ! if {![llength $@obj_in_edit]} { ! set @obj_in_edit [lindex $@selection 1] [lindex $@selection 0] edit $self } *************** *** 2274,2278 **** global offset _ set offset [expr $offset + 1] - set canvas $_(focus) set bang_id [format %x [expr 0x81168b0 - $offset]] #puts "new object id -> $bang_id" --- 2270,2273 ----