File: extra_bindings.tcl

package info (click to toggle)
grass 6.0.2-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 40,044 kB
  • ctags: 31,303
  • sloc: ansic: 321,125; tcl: 25,676; sh: 11,176; cpp: 10,098; makefile: 5,025; fortran: 1,846; yacc: 493; lex: 462; perl: 133; sed: 1
file content (85 lines) | stat: -rw-r--r-- 2,062 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# extra_bindings.tcl --
#
# Right now we put the floating point widget bindings in here


# ----------------------------------------------------------------------
# Class bindings for floatscale widgets.  When strict Motif is requested,
# the bindings use $tk_priv(buttons) and $tk_priv(activeFg) to set the
# -activeforeground color to -foreground when the mouse is in the window
# and restore it when the mouse leaves.
# ----------------------------------------------------------------------

bind FloatScale <Any-Enter> {
    if $tk_strictMotif {
	set tk_priv(activeFg) [lindex [%W config -activeforeground] 4]
	%W config -activeforeground [lindex [%W config -sliderforeground] 4]
    }
}
bind FloatScale <Any-Leave> {
    if {$tk_strictMotif && ($tk_priv(buttons) == 0)} {
	%W config -activeforeground $tk_priv(activeFg)
    }
}
bind FloatScale <Any-ButtonPress> {incr tk_priv(buttons)}
bind FloatScale <Any-ButtonRelease> {incr tk_priv(buttons) -1}

# These bindings added so key events can be detected within sliders
bind FloatScale <Any-Enter> {
    set tk_priv(fs_focus) [focus]
    focus %W
}

bind FloatScale <Any-Leave> {
    focus $tk_priv(fs_focus)
}

bind Scale <Any-Enter> {
    set tk_priv(fs_focus) [focus]
    focus %W
}

bind Scale <Any-Leave> {
    focus $tk_priv(fs_focus)
}


# These routines handle switching the cursors within application
# windows when the application becomes busy/un-busy

proc appBusy {} {
    global Nv_

    . configure -cursor {watch blue}
    .top2 configure -cursor {watch blue}
    $Nv_(AREA).menu.wait_pls configure -fg red -bg black
    grab $Nv_(AREA).menu.wait_pls
    update
}

proc appNotBusy {} {
    global Nv_

    . configure -cursor ""
    .top2 configure -cursor ""
    $Nv_(AREA).menu.wait_pls configure -fg gray90 -bg gray90
    grab release $Nv_(AREA).menu.wait_pls
    update
}

# Extra functions for handling the scripting menu
proc script_handle_on {} {
    global ScriptState

    if {[catch {Nv_set_script_state $ScriptState} err] != 0} then {
	set ScriptState 0
	error "$err"
    }
}