File: base.tcl

package info (click to toggle)
tkmail 4.0beta9-8.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,444 kB
  • ctags: 923
  • sloc: tcl: 13,262; ansic: 6,998; makefile: 351; sh: 88; sed: 57
file content (172 lines) | stat: -rw-r--r-- 3,946 bytes parent folder | download | duplicates (3)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# BASE bindings for entries
global tkBind tkEntry tk_strictMotif

# Standard Motif bindings:

bind Entry <Button> {
  if {!(%b == 1 || %b == 3)} break
  tkEntryButton%b %W %x
  %W selection clear
}
bind Entry <B1-Motion> {
  set tkPriv(x) %x
  tkEntryMouseSelect %W %x
}
bind Entry <B3-Motion> {
  set tkPriv(x) %x
  tkEntryMouseSelect %W %x
}
bind Entry <Double-Button> {
  if {!(%b == 1 || %b == 3)} break
  set tkPriv(selectMode) word
  tkEntryMouseSelect %W %x
  if {%b == 1} { catch {%W icursor sel.first} }
}
bind Entry <Triple-Button> {
  if {!(%b == 1 || %b == 3)} break
  set tkPriv(selectMode) line
  tkEntryMouseSelect %W %x
  if {%b == 1} { %W icursor 0 }
}
bind Entry <Shift-Button> {
  if {!(%b == 1 || %b == 3)} break
  set tkPriv(selectMode) char
  %W selection adjust @%x
}
bind Entry <Double-Shift-Button> {
 if {!(%b == 1 || %b == 3)} break
  set tkPriv(selectMode) word
  tkEntryMouseSelect %W %x
}
bind Entry <Triple-Shift-Button> {
  if {!(%b == 1 || %b == 3)} break
  set tkPriv(selectMode) line
  tkEntryMouseSelect %W %x
}
bind Entry <B1-Leave> {
  set tkPriv(x) %x
  tkEntryAutoScan %W
}
bind Entry <B1-Enter> {
  tkCancelRepeat
}
bind Entry <B3-Leave> {
  set tkPriv(x) %x
  tkEntryAutoScan %W
}
bind Entry <B3-Enter> {
  tkCancelRepeat
}
bind Entry <ButtonRelease> {
  if {!(%b == 1 || %b == 3)} break
  tkCancelRepeat
  if {[selection own -displayof %W] == "%W" &&
      [%W selection present]} {
    clipboard clear -displayof %W
    clipboard append -displayof %W [selection get -displayof %W]
  }
}
bind Entry <Control-1> {
  %W icursor @%x
}

if !$tk_strictMotif {
  bind Entry <2> {
    %W scan mark %x
    set tkPriv(x) %x
    set tkPriv(y) %y
    set tkPriv(mouseMoved) 0
  }
  bind Entry <B2-Motion> {
    if {abs(%x-$tkPriv(x)) > 2} {
      set tkPriv(mouseMoved) 1
    }
    if $tkPriv(mouseMoved) {
      %W scan dragto %x
    }
  }
  bind Entry <ButtonRelease-2> {
    if !$tkPriv(mouseMoved) {tkEntryButtonInsert %W %x}
  }
}

# Standard key binding

bind Entry <Left> {
  tkEntrySetCursor %W [tkEntryPlaceChar %W -]
}
bind Entry <Right> {
  tkEntrySetCursor %W [tkEntryPlaceChar %W +]
}
bind Entry <Shift-Left> {
  tkEntryKeySelect %W [tkEntryPlaceChar %W -]
}
bind Entry <Shift-Right> {
  tkEntryKeySelect %W [tkEntryPlaceChar %W +]
}
bind Entry <Control-Left> {
  tkEntrySetCursor %W [tkEntryPlaceWord %W -]
}
bind Entry <Control-Right> {
  tkEntrySetCursor %W [tkEntryPlaceWord %W +]
}
bind Entry <Shift-Control-Left> {
  tkEntryKeySelect %W [tkEntryPlaceWord %W -]
}
bind Entry <Shift-Control-Right> {
  tkEntryKeySelect %W [tkEntryPlaceWord %W +]
}
bind Entry <Home> {
  tkEntrySetCursor %W 0
}
bind Entry <Shift-Home> {
  tkEntryKeySelect %W 0
}
bind Entry <End> {
  tkEntrySetCursor %W end
}
bind Entry <Shift-End> {
  tkEntryKeySelect %W end
}

bind Entry <Delete> {
  tkEntryDelete %W insert [tkEntryPlaceChar %W +] $tkBind(delSel) 0
}
bind Entry <BackSpace> {
  tkEntryDelete %W insert [tkEntryPlaceChar %W -] $tkBind(delSel) 0
}

bind Entry <Control-backslash> {tkEntryKeyCancel %W}

bind Entry <Control-i> {
  tkEntryInsertChar %W \t
}
bind Entry <Insert> {
  set tkEntry(%W,ovwrt) [expr !$tkEntry(%W,ovwrt)]
  if $tkEntry(%W,ovwrt) {
    set $tkBind(%W,mesgvar) "Entering overwrite mode."
  } else {
    set $tkBind(%W,mesgvar) "Leaving overwrite mode."
  }
}
bind Entry <KeyPress> {
  if [string length %A] {
    tkEntryInsertChar %W %A
  } else {
    tkBindNoBind %W %K %s
  }
}

# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
# Otherwise, if a widget binding for one of these is defined, the
# <KeyPress> class binding will also fire and insert the character,
# which is wrong.  Ditto for Escape, Return, and Tab.

bind Entry <Alt-KeyPress> {# nothing}
bind Entry <Meta-KeyPress> {# nothing}
bind Entry <Control-KeyPress> {# nothing}
bind Entry <Escape> {# nothing}
bind Entry <Return> {# nothing}
bind Entry <KP_Enter> {# nothing}
bind Entry <Tab> {# nothing}