Changeset 563


Ignore:
Timestamp:
Dec 4, 2009 5:08:16 PM (14 years ago)
Author:
toby
Message:

# on 2002/02/11 19:32:02, toby did:
add cursor display (livecursor) -- requested by Lachlan

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/liveplot

    • Property rcs:date changed from 2002/01/22 22:16:51 to 2002/02/11 19:32:02
    • Property rcs:lines changed from +616 -183 to +30 -2
    • Property rcs:rev changed from 1.26 to 1.27
    r537 r563  
    18061806}
    18071807
     1808# define a binding to show the cursor location
     1809proc ToggleLiveCursor {} {
     1810    global box graph
     1811    if {[bind $box <Any-Motion>] == ""} {
     1812        .a.options.menu entryconfig $graph(CursorLabel) -label "Hide Cursor Position"
     1813        pack [frame .bot -bd 2 -relief sunken] -side bottom -fill x
     1814        pack [label .bot.val1 -textvariable graph(position)] -side left
     1815        pack [button .bot.close -command ToggleLiveCursor -text "Close cursor display"] -side right
     1816        bind $box <Any-Motion> {FormatLiveCursor %x %y}
     1817    } else {
     1818        .a.options.menu entryconfig $graph(CursorLabel) -label "Show Cursor Position"
     1819        destroy .bot
     1820        bind $box <Any-Motion> {}
     1821    }
     1822}
     1823proc FormatLiveCursor {x y} {
     1824    global graph
     1825    set graph(position) \
     1826            "x=[format %.3f [$graph(blt) xaxis invtransform $x]] y=[format %.3f [$graph(blt) yaxis invtransform $y]]"
     1827}
     1828#-------------------------------------------------------------------------
     1829
     1830
    18081831# override options with locally defined values
    18091832if [file exists [file join $expgui(scriptdir) localconfig]] {
     
    20162039        -variable graph(legend) \
    20172040        -command {setlegend $box $graph(legend)}
     2041.a.options.menu add command -label "Show Cursor Position" \
     2042        -command ToggleLiveCursor
     2043set graph(CursorLabel) [.a.options.menu index "Show Cursor Position"]
    20182044.a.options.menu add command -label "Set PS output" -command setpostscriptout
    20192045.a.options.menu add cascade -menu  .a.options.menu.font \
     
    22052231    set cycle [getcycle];readdata .g
    22062232}
     2233bind . <Key-l> {ToggleLiveCursor}
     2234bind . <Key-L> {ToggleLiveCursor}
    22072235updateifnew
    22082236donewaitmsg
Note: See TracChangeset for help on using the changeset viewer.