obj method canvaseditor editLine line { $self memory before " [$line restoreCode] $line draw $self select $self select $line " $self select $self select $line $line blink off $self basicBindings off $self statusLine Editing line $line $self buildInfoWindow $line dots show set canvas [my canvas] # set menu $canvas.context.dot destroy $menu menu $menu -tearoff no # $self canvas bind dot <3> [list apply { {self menu x y} { tk_popup $menu $x $y foreach tag [$self canvas gettags current] { if {[string match dot::* $tag]} then { set dot [string range $tag 3 end] proc lastDot args "$dot {*}\$args" break } } } } $self $menu %X %Y] # $menu add cascade -label Move -menu [menu $menu.move -tearoff no] $menu.move add command -label Free\ -command [list apply [list {self canvas line} { $self pointerToDot [lastDot] $line dots show no bind $canvas <Motion> [subst -nocommand { lastDot configure\ -x [$self canvasx %x]\ -y [$self canvasy %y] lastDot lines draw }] bind $canvas <<Click>> " bind $canvas <Motion> {} $line dots show " bind $canvas <<ControlClick>>\ [list apply [list {self canvas x y} { proc pointerXY {} "list $x $y" $self pointerToDot [$self nearestDot -unselected] event generate $canvas <<Motion>> event generate $canvas <<Click>> lastDot configure\ -x [$self nearestDot -unselected cget -x]\ -y [$self nearestDot -unselected cget -y] } [namespace current]] $self $canvas %x %y] } [namespace current]] $self $canvas $line] $menu.move add command -label Horizontal\ -command [list apply [list {self canvas line} { $self pointerToDot [lastDot] $line dots show no bind $canvas <Motion> [subst -nocommand { lastDot configure -x [$self canvasx %x] lastDot lines draw }] bind $canvas <<Click>> " bind $canvas <Motion> {} $line dots show " bind $canvas <<ControlClick>>\ [list apply [list {self canvas x y} { proc pointerXY {} "list $x $y" $self pointerToDot [$self nearestDot -unselected] event generate $canvas <<Motion>> event generate $canvas <<Click>> lastDot configure\ -x [$self nearestDot -unselected cget -x] } [namespace current]] $self $canvas %x %y] } [namespace current]] $self $canvas $line] $menu.move add command -label Vertical\ -command [list apply [list {self canvas line} { $self pointerToDot [lastDot] $line dots show no bind $canvas <Motion> [subst -nocommand { lastDot configure -y [$self canvasy %y] lastDot lines draw }] bind $canvas <<Click>> " bind $canvas <Motion> {} $line dots show " bind $canvas <<ControlClick>>\ [list apply [list {self canvas x y} { proc pointerXY {} "list $x $y" $self pointerToDot [$self nearestDot -unselected] event generate $canvas <<Motion>> event generate $canvas <<Click>> lastDot configure\ -y [$self nearestDot -unselected cget -y] } [namespace current]] $self $canvas %x %y] } [namespace current]] $self $canvas $line] $menu add command -label Smooth -command [list apply { line { $line dots show no if {[$line cget -smooth]} then { $line configure -smooth no } else { $line configure -smooth yes } $line draw $line dots show } } $line] $menu add separator $menu add command -label Done -accelerator Esc -command [list apply { {self line} { $line dots show no $self basicBindings on $self canvas bind dot <3> {} set after " [$line restoreCode] $line draw $self select $self select $line " $self memory after $after $self initUndoRedo [$self memory before] [$self memory after] $self select $self select $line } } $self $line] bind $canvas <<DoubleClick>> "$menu invoke Done" # set done $canvas.context.done destroy $done $canvas.context add cascade -menu [menu $done -tearoff no] $done add command -label Smooth -command "$menu invoke Smooth" $done add separator $done add command -label Done -accelerator Esc -command "$menu invoke Done" bind $canvas <3> [subst -nocommand { if {[$self canvas find withtag current] eq ""} then { tk_popup $done %X %Y } }] bind $canvas <Escape> "$done invoke Done" }
© Wolf-Dieter Busch | Home | Sitemap | Urheber | A-Z