hilfer 0.9.5 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +154 -100
- data/History.txt +6 -1
- data/Manifest.txt +2 -0
- data/README.txt +11 -4
- data/TODO +6 -2
- data/bin/hilfer +1 -1
- data/lib/hilfer/extensions.rb +64 -0
- data/lib/hilfer/scite_editor.rb +166 -131
- data/lib/hilfer/tree_viewer.rb +37 -45
- data/lib/hilfer/tree_viewer_window.rb +4 -4
- data/lib/hilfer/version.rb +1 -1
- data/lib/hilfer/window.rb +26 -0
- data/lib/hilfer/xfce_terminal.rb +1 -1
- data/test/test_key_matcher.rb +25 -0
- metadata +20 -8
data/ChangeLog
CHANGED
@@ -1,256 +1,310 @@
|
|
1
|
+
2009-08-01 18:28 panic
|
2
|
+
|
3
|
+
* [r4351] bin/hilfer, lib/hilfer/extensions.rb,
|
4
|
+
lib/hilfer/scite_editor.rb, lib/hilfer/tree_viewer.rb,
|
5
|
+
lib/hilfer/window.rb:
|
6
|
+
Pass options to SciteEditor. Fix single-char event name matching.
|
7
|
+
make sure wmctrl -l is matched with hex digits. Use puts instead
|
8
|
+
of print.
|
9
|
+
|
10
|
+
2009-08-01 17:56 panic
|
11
|
+
|
12
|
+
* [r4350] README.txt, lib/hilfer/extensions.rb,
|
13
|
+
lib/hilfer/tree_viewer.rb, test, test/test_key_matcher.rb:
|
14
|
+
Don't use scancodes anymore. Make keystroke checking more modular
|
15
|
+
for easier testing.
|
16
|
+
|
17
|
+
2009-08-01 17:27 panic
|
18
|
+
|
19
|
+
* [r4349] test, test-dir:
|
20
|
+
move out of the way
|
21
|
+
|
22
|
+
2009-08-01 15:54 panic
|
23
|
+
|
24
|
+
* [r4348] History.txt, Manifest.txt, TODO,
|
25
|
+
lib/hilfer/scite_editor.rb, lib/hilfer/tree_viewer_window.rb,
|
26
|
+
lib/hilfer/version.rb, lib/hilfer/window.rb,
|
27
|
+
lib/hilfer/xfce_terminal.rb:
|
28
|
+
raise window using wmctrl when files opened
|
29
|
+
|
30
|
+
2009-02-05 14:37 panic
|
31
|
+
|
32
|
+
* [r4083] History.txt, lib/hilfer/tree_viewer.rb,
|
33
|
+
lib/hilfer/version.rb:
|
34
|
+
hack for Desktop Comfort Laser
|
35
|
+
|
1
36
|
2008-04-11 13:37 panic
|
2
37
|
|
3
|
-
* [r3487]
|
4
|
-
trunk/lib/hilfer/version.rb:
|
38
|
+
* [r3487] Manifest.txt, Rakefile, lib/hilfer/version.rb:
|
5
39
|
add xfce_terminal to Manifest.txt
|
6
40
|
|
7
41
|
2008-04-11 09:36 panic
|
8
42
|
|
9
|
-
* [r3486]
|
43
|
+
* [r3486] Rakefile:
|
10
44
|
clean up ChangeLog'
|
11
45
|
|
12
46
|
2008-04-11 09:27 panic
|
13
47
|
|
14
|
-
* [r3485]
|
48
|
+
* [r3485] README.txt:
|
15
49
|
fix home page link
|
16
50
|
|
17
51
|
2008-04-11 09:17 panic
|
18
52
|
|
19
|
-
* [r3483]
|
20
|
-
|
21
|
-
trunk/lib/hilfer/xfce_terminal.rb:
|
53
|
+
* [r3483] History.txt, Rakefile, lib/hilfer/tree_viewer.rb,
|
54
|
+
lib/hilfer/version.rb, lib/hilfer/xfce_terminal.rb:
|
22
55
|
0.9.4. ad xfce terminal. add version flag. fix ChangeLog issues
|
23
56
|
|
24
57
|
2008-04-11 08:47 panic
|
25
58
|
|
26
|
-
* [r3482]
|
59
|
+
* [r3482] bin/hilfer:
|
27
60
|
add version flag
|
28
61
|
|
29
62
|
2008-04-10 13:20 panic
|
30
63
|
|
31
|
-
* [r3480]
|
32
|
-
trunk/lib/hilfer/version.rb:
|
64
|
+
* [r3480] History.txt, Rakefile, lib/hilfer/version.rb:
|
33
65
|
Remove text-format dependency. Increase version
|
34
66
|
|
35
67
|
2008-04-10 12:56 panic
|
36
68
|
|
37
|
-
* [r3479]
|
38
|
-
trunk/README.txt, trunk/Rakefile:
|
69
|
+
* [r3479] ., History.txt, Manifest.txt, README.txt, Rakefile:
|
39
70
|
clean up packaging and docs files
|
40
71
|
|
41
72
|
2008-04-10 12:33 panic
|
42
73
|
|
43
|
-
* [r3476]
|
74
|
+
* [r3476] History.txt:
|
44
75
|
history changes
|
45
76
|
|
46
77
|
2008-04-10 12:27 panic
|
47
78
|
|
48
|
-
* [r3475]
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
trunk/lib/hilfer/svn_colours.rb,
|
56
|
-
trunk/lib/hilfer/tree_viewer.rb,
|
57
|
-
trunk/lib/hilfer/tree_viewer_window.rb,
|
58
|
-
trunk/lib/hilfer/version.rb, trunk/lib/hilfer/xterm.rb:
|
79
|
+
* [r3475] History.txt, Manifest.txt, README.txt, Rakefile, TODO,
|
80
|
+
bin/hilfer, bin/ssc, lib/hilfer/gnome_terminal.rb,
|
81
|
+
lib/hilfer/hilfer_config.rb, lib/hilfer/hilfer_item.rb,
|
82
|
+
lib/hilfer/hilfer_model.rb, lib/hilfer/rails_locator.rb,
|
83
|
+
lib/hilfer/svn_colours.rb, lib/hilfer/tree_viewer.rb,
|
84
|
+
lib/hilfer/tree_viewer_window.rb, lib/hilfer/version.rb,
|
85
|
+
lib/hilfer/xterm.rb:
|
59
86
|
Implement graceful failure for optional dependencies. Move
|
60
87
|
classes to separate files.
|
61
88
|
|
62
89
|
2008-04-02 08:21 panic
|
63
90
|
|
64
|
-
* [r3457]
|
91
|
+
* [r3457] lib/hilfer/tree_viewer.rb:
|
65
92
|
alt-q toggles editor shutdown
|
66
93
|
|
67
94
|
2008-04-01 21:28 panic
|
68
95
|
|
69
|
-
* [r3456]
|
70
|
-
|
71
|
-
trunk/lib/hilfer/tree_viewer.rb:
|
96
|
+
* [r3456] Rakefile, bin/hilfer, lib/hilfer/svn_colours.rb,
|
97
|
+
lib/hilfer/tree_viewer.rb:
|
72
98
|
allow loading of svn/client to fail gracefully. output modifier
|
73
99
|
mask in debug. Don't use -w, because of all the activerecord
|
74
100
|
verbiage.
|
75
101
|
|
76
102
|
2008-04-01 20:21 panic
|
77
103
|
|
78
|
-
* [r3455]
|
104
|
+
* [r3455] README.txt:
|
79
105
|
link to RubyForge project from docs pages
|
80
106
|
|
81
107
|
2008-04-01 18:37 panic
|
82
108
|
|
83
|
-
* [r3454]
|
109
|
+
* [r3454] History.txt, Rakefile:
|
84
110
|
dependencies were the wrong way round
|
85
111
|
|
86
112
|
2008-04-01 18:18 panic
|
87
113
|
|
88
|
-
* [r3453]
|
114
|
+
* [r3453] Rakefile:
|
89
115
|
bump version
|
90
|
-
|
91
|
-
|
116
|
+
|
117
|
+
2008-04-01 18:18 panic
|
118
|
+
|
119
|
+
* [r3452] Rakefile, bin/hilfer, lib/hilfer/tree_viewer.rb:
|
92
120
|
ruby-gtk is not a gem. find icon properly. fix enter key.
|
93
121
|
|
94
122
|
2008-04-01 15:31 panic
|
95
123
|
|
96
|
-
* [r3451]
|
97
|
-
|
98
|
-
|
99
|
-
trunk/lib/hilfer/scite_editor.rb,
|
100
|
-
trunk/lib/hilfer/svn_colours.rb:
|
124
|
+
* [r3451] ., History.txt, Manifest.txt, README.txt, Rakefile, TODO,
|
125
|
+
bin/hilfer-icon.png, lib/hilfer/hilfer-icon.png,
|
126
|
+
lib/hilfer/scite_editor.rb, lib/hilfer/svn_colours.rb:
|
101
127
|
documentation
|
102
128
|
|
103
129
|
2008-04-01 14:45 panic
|
104
130
|
|
105
|
-
* [r3450]
|
131
|
+
* [r3450] ext:
|
106
132
|
remove old bash files
|
107
|
-
|
108
|
-
|
109
|
-
|
133
|
+
|
134
|
+
2008-04-01 14:45 panic
|
135
|
+
|
136
|
+
* [r3449] Manifest.txt, README.txt, Rakefile, bin/ssc,
|
137
|
+
ext/Rakefile, ext/bin/ec, ext/bin/sd:
|
110
138
|
add ssc. Rakefile for ext/bin
|
111
139
|
|
112
140
|
2008-04-01 09:38 panic
|
113
141
|
|
114
|
-
* [r3448]
|
142
|
+
* [r3448] bin/hilfer, lib/hilfer/scite_editor.rb:
|
115
143
|
fix scite quitting
|
116
144
|
|
117
145
|
2008-03-31 19:54 panic
|
118
146
|
|
119
|
-
* [r3446]
|
120
|
-
|
121
|
-
trunk/ext/sd, trunk/ext/setup.rb:
|
147
|
+
* [r3446] ext, ext/bin, ext/bin/ec, ext/bin/sd, ext/ec,
|
148
|
+
ext/extconf.rb, ext/sd, ext/setup.rb:
|
122
149
|
first attempt at installing bash scripts
|
123
150
|
|
124
151
|
2008-03-31 19:17 panic
|
125
152
|
|
126
|
-
* [r3445]
|
127
|
-
|
128
|
-
trunk/extconf.rb:
|
153
|
+
* [r3445] Rakefile, TODO, bin/ec, bin/sd, ext, ext/ec,
|
154
|
+
ext/extconf.rb, ext/sd, extconf.rb:
|
129
155
|
create ext dir for bash scripts
|
130
156
|
|
131
157
|
2008-03-31 15:17 panic
|
132
158
|
|
133
|
-
* [r3444]
|
159
|
+
* [r3444] Rakefile:
|
134
160
|
bump version
|
135
161
|
|
136
162
|
2008-03-31 15:16 panic
|
137
163
|
|
138
|
-
* [r3443]
|
139
|
-
|
140
|
-
trunk/lib/hilfer/tree_viewer.rb:
|
164
|
+
* [r3443] Rakefile, TODO, bin/hilfer, dev/listen.rb,
|
165
|
+
lib/hilfer/scite_editor.rb, lib/hilfer/tree_viewer.rb:
|
141
166
|
copy files to editor. Improve cleanup. Option to quit editor on
|
142
167
|
close. Relative paths for paste.
|
143
168
|
|
144
169
|
2008-03-31 12:22 panic
|
145
170
|
|
146
|
-
* [r3442]
|
171
|
+
* [r3442] Manifest.txt:
|
147
172
|
add svn_colours
|
148
|
-
|
173
|
+
|
174
|
+
2008-03-31 12:22 panic
|
175
|
+
|
176
|
+
* [r3441] bin/ed:
|
149
177
|
remove
|
150
178
|
|
151
179
|
2008-03-31 12:21 panic
|
152
180
|
|
153
|
-
* [r3440]
|
181
|
+
* [r3440] bin/hilfer:
|
154
182
|
remove tabs
|
155
183
|
make sure app operates without the icon
|
156
184
|
|
157
185
|
2008-03-31 12:20 panic
|
158
186
|
|
159
|
-
* [r3439]
|
187
|
+
* [r3439] lib/hilfer/tree_viewer.rb:
|
160
188
|
make sure Ctrl-Enter on a top-level file doesn't cause crash
|
161
189
|
|
162
190
|
2008-03-31 12:19 panic
|
163
191
|
|
164
|
-
* [r3438]
|
192
|
+
* [r3438] Rakefile:
|
165
193
|
remove commented lines
|
166
194
|
add a run and an irb task
|
167
195
|
|
168
196
|
2008-03-10 21:14 panic
|
169
197
|
|
170
|
-
* [r3389]
|
198
|
+
* [r3389] TODO:
|
171
199
|
done
|
172
200
|
|
173
201
|
2008-03-10 21:05 panic
|
174
202
|
|
175
|
-
* [r3388]
|
176
|
-
|
177
|
-
|
203
|
+
* [r3388] History.txt, Manifest.txt, README.txt, Rakefile,
|
204
|
+
bin/hilfer, bin/hilfer-icon.png, lib/hilfer/hilfer-icon.png,
|
205
|
+
lib/hilfer/hilfer.rb:
|
178
206
|
get gem creation working with Hoe
|
179
207
|
|
180
208
|
2008-03-09 21:15 panic
|
181
209
|
|
182
|
-
* [r3387]
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
trunk/lib/hilfer/hilfer-icon.png, trunk/lib/hilfer/hilfer.rb,
|
187
|
-
trunk/lib/hilfer/tree_viewer.rb, trunk/sd:
|
210
|
+
* [r3387] ., Rakefile, bin, bin/ec, bin/ed, bin/hilfer, bin/sd,
|
211
|
+
dev/hilfer.png, ec, ed, hilfer, hilfer-icon.png, hilfer.png,
|
212
|
+
lib/hilfer/hilfer-icon.png, lib/hilfer/hilfer.rb,
|
213
|
+
lib/hilfer/tree_viewer.rb, sd:
|
188
214
|
do gem-compatible directory structure
|
189
215
|
|
190
216
|
2008-03-09 20:13 panic
|
191
217
|
|
192
|
-
* [r3386]
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
trunk/scite_editor.rb, trunk/svn_colours.rb,
|
197
|
-
trunk/tree_viewer.rb:
|
218
|
+
* [r3386] Rakefile, dev, dev/listen.rb, hilfer.rb,
|
219
|
+
lib/hilfer/extconf.rb, lib/hilfer/rails_locator.rb, listen.rb,
|
220
|
+
model.rb, model/model.rb, rails_locator.rb, scite_editor.rb,
|
221
|
+
svn_colours.rb, tree_viewer.rb:
|
198
222
|
remove old unused files
|
199
223
|
|
200
224
|
2007-06-14 10:55 panic
|
201
225
|
|
202
|
-
* [r3283]
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
trunk/lib/hilfer/tree_viewer.rb, trunk/tree_viewer.rb:
|
226
|
+
* [r3283] Rakefile, extconf.rb, lib, lib/hilfer,
|
227
|
+
lib/hilfer/extconf.rb, lib/hilfer/hilfer.rb,
|
228
|
+
lib/hilfer/rails_locator.rb, lib/hilfer/scite_editor.rb,
|
229
|
+
lib/hilfer/svn_colours.rb, lib/hilfer/tree_viewer.rb,
|
230
|
+
tree_viewer.rb:
|
208
231
|
add missing files
|
209
232
|
|
210
233
|
2007-06-04 13:25 panic
|
211
234
|
|
212
|
-
* [r3270]
|
213
|
-
|
214
|
-
trunk/scite_editor.rb, trunk/sd, trunk/svn_colours.rb:
|
235
|
+
* [r3270] ., TODO, ec, hilfer.rb, hilfer_options.rb,
|
236
|
+
rails_locator.rb, scite_editor.rb, sd, svn_colours.rb:
|
215
237
|
merged from no-model
|
216
238
|
|
217
239
|
2006-08-12 11:36 panic
|
218
240
|
|
219
|
-
* [r2384]
|
220
|
-
|
221
|
-
|
222
|
-
trunk/model/sec-custom-model-code.html:
|
241
|
+
* [r2384] model, model/custom-list.c, model/custom-list.h,
|
242
|
+
model/hilfer_tree_model.c, model/hilfer_tree_model.h,
|
243
|
+
model/sec-custom-model-code.html:
|
223
244
|
add model code
|
224
245
|
|
225
246
|
2006-08-12 11:34 root
|
226
247
|
|
227
|
-
* [r2383] test
|
248
|
+
* [r2383] test:
|
228
249
|
fix trunk oops
|
229
|
-
|
250
|
+
|
251
|
+
2006-08-12 11:34 root
|
252
|
+
|
253
|
+
* [r2382] scite_editor.rb:
|
230
254
|
fix trunk oops
|
231
|
-
|
255
|
+
|
256
|
+
2006-08-12 11:34 root
|
257
|
+
|
258
|
+
* [r2381] model.rb:
|
232
259
|
fix trunk oops
|
233
|
-
|
260
|
+
|
261
|
+
2006-08-12 11:34 root
|
262
|
+
|
263
|
+
* [r2380] listen.rb:
|
234
264
|
fix trunk oops
|
235
|
-
|
265
|
+
|
266
|
+
2006-08-12 11:34 root
|
267
|
+
|
268
|
+
* [r2379] hilfer_options.rb:
|
236
269
|
fix trunk oops
|
237
|
-
|
270
|
+
|
271
|
+
2006-08-12 11:34 root
|
272
|
+
|
273
|
+
* [r2378] hilfer.rb:
|
238
274
|
fix trunk oops
|
239
|
-
|
275
|
+
|
276
|
+
2006-08-12 11:34 root
|
277
|
+
|
278
|
+
* [r2377] hilfer.png:
|
240
279
|
fix trunk oops
|
241
|
-
|
280
|
+
|
281
|
+
2006-08-12 11:34 root
|
282
|
+
|
283
|
+
* [r2376] hilfer-icon.png:
|
242
284
|
fix trunk oops
|
243
|
-
|
285
|
+
|
286
|
+
2006-08-12 11:34 root
|
287
|
+
|
288
|
+
* [r2375] hilfer:
|
244
289
|
fix trunk oops
|
245
|
-
|
290
|
+
|
291
|
+
2006-08-12 11:34 root
|
292
|
+
|
293
|
+
* [r2374] ed:
|
246
294
|
fix trunk oops
|
247
|
-
|
295
|
+
|
296
|
+
2006-08-12 11:34 root
|
297
|
+
|
298
|
+
* [r2373] ec:
|
248
299
|
fix trunk oops
|
249
|
-
|
300
|
+
|
301
|
+
2006-08-12 11:34 root
|
302
|
+
|
303
|
+
* [r2372] TODO:
|
250
304
|
fix trunk oops
|
251
305
|
|
252
306
|
2006-08-12 11:22 panic
|
253
307
|
|
254
|
-
* [r2368]
|
308
|
+
* [r2368] .:
|
255
309
|
make trunk
|
256
310
|
|
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
=== 0.10.0 / 2009-08-01
|
2
|
+
|
3
|
+
* Use wmctrl to raise SciTE window.
|
4
|
+
* Don't use hardware scan codes
|
5
|
+
|
1
6
|
=== 0.9.5 / 2008-04-11
|
2
7
|
|
3
8
|
* include xfce_terminal.rb in Manifest.txt. Doh.
|
@@ -6,7 +11,7 @@
|
|
6
11
|
|
7
12
|
* add --version flag
|
8
13
|
* fix ChangeLog problem with gem
|
9
|
-
* add
|
14
|
+
* add Xfce Terminal
|
10
15
|
|
11
16
|
=== 0.9.3 / 2008-04-10
|
12
17
|
|
data/Manifest.txt
CHANGED
@@ -6,6 +6,7 @@ Rakefile
|
|
6
6
|
TODO
|
7
7
|
bin/hilfer
|
8
8
|
bin/ssc
|
9
|
+
lib/hilfer/extensions.rb
|
9
10
|
lib/hilfer/gnome_terminal.rb
|
10
11
|
lib/hilfer/hilfer-icon.png
|
11
12
|
lib/hilfer/hilfer_config.rb
|
@@ -17,5 +18,6 @@ lib/hilfer/svn_colours.rb
|
|
17
18
|
lib/hilfer/tree_viewer.rb
|
18
19
|
lib/hilfer/tree_viewer_window.rb
|
19
20
|
lib/hilfer/version.rb
|
21
|
+
lib/hilfer/window.rb
|
20
22
|
lib/hilfer/xterm.rb
|
21
23
|
lib/hilfer/xfce_terminal.rb
|
data/README.txt
CHANGED
@@ -19,8 +19,10 @@ I wrote hilfer.
|
|
19
19
|
- Incremental keyboard search - just start typing in the window
|
20
20
|
- Editable & hideable location bar showing current directory
|
21
21
|
- multiple selections usually do The Right Thing.
|
22
|
-
-
|
23
|
-
-
|
22
|
+
- Can track which file is currently in front in the editor.
|
23
|
+
- Can open new windows for other directories, but the same editor.
|
24
|
+
- launch Gnome Terminal or Xfce Terminal or xterm in a directory
|
25
|
+
- close scite on shutdown
|
24
26
|
|
25
27
|
=== Keyboard Shortcuts
|
26
28
|
|
@@ -39,6 +41,7 @@ I wrote hilfer.
|
|
39
41
|
- ctrl-r refreshes from filesystem
|
40
42
|
- ctrl-t opens a terminal window on the given directorties.
|
41
43
|
- alt-l toggles the location bar
|
44
|
+
- alt-q toggles whether shutdown is automatic or not
|
42
45
|
- ctrl-* on keypad means expand the entire tree
|
43
46
|
- * on keypad expands subtrees
|
44
47
|
- shift-/ on keypad means collapse the entire tree
|
@@ -87,6 +90,9 @@ hilfer.
|
|
87
90
|
|
88
91
|
== PROBLEMS
|
89
92
|
|
93
|
+
These may or may not be problems, as you like. No drag-and-drop. No
|
94
|
+
icon themes. Can't create new files. Only opens files in SciTE.
|
95
|
+
|
90
96
|
See TODO file
|
91
97
|
|
92
98
|
== SYNOPSIS
|
@@ -106,8 +112,9 @@ See TODO file
|
|
106
112
|
|
107
113
|
* text-format for ssc to display extended scite director commands
|
108
114
|
* subversion-ruby to display colour highlighted subversion status
|
109
|
-
* gnome-terminal executable
|
115
|
+
* gnome-terminal or Xfce Terminal executable
|
110
116
|
* ActiveSupport to enable rails-specific shortcuts
|
117
|
+
* wmctrl to raise SciTE editor window when files are opened
|
111
118
|
|
112
119
|
== INSTALL:
|
113
120
|
|
@@ -117,7 +124,7 @@ sudo gem install
|
|
117
124
|
|
118
125
|
(The MIT License)
|
119
126
|
|
120
|
-
Copyright (c) John Anderson
|
127
|
+
Copyright (c) John Anderson 2006 - 2009
|
121
128
|
|
122
129
|
Permission is hereby granted, free of charge, to any person obtaining
|
123
130
|
a copy of this software and associated documentation files (the
|
data/TODO
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
menu
|
2
2
|
working sets, like eclipse
|
3
|
-
option to connect to existing scite
|
3
|
+
option to connect to existing scite, by pid?
|
4
4
|
Sort by directories, then files. Needs Options.
|
5
5
|
fix multiple selection editing, ie when several files are selected?
|
6
6
|
shift-* to select all descendants
|
@@ -97,3 +97,7 @@ svn status highlighting
|
|
97
97
|
11-mar-2008
|
98
98
|
-----------
|
99
99
|
package using Hoe
|
100
|
+
|
101
|
+
01-aug-2009
|
102
|
+
-----------
|
103
|
+
switch focus to editor when opening files. wmctrl. EMWH and ICCCM to control windows
|
data/bin/hilfer
CHANGED
@@ -0,0 +1,64 @@
|
|
1
|
+
module Gdk
|
2
|
+
module Keyval
|
3
|
+
def self.symbol( keyval )
|
4
|
+
if @lookup.nil?
|
5
|
+
@lookup = {}
|
6
|
+
constants.each do |c|
|
7
|
+
val = eval( c )
|
8
|
+
@lookup[val] = c
|
9
|
+
end
|
10
|
+
end
|
11
|
+
@lookup[keyval]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# mainly for testing Gdk::EventKey, cos they're hard to
|
16
|
+
# instantiate
|
17
|
+
module KeyMatcher
|
18
|
+
def key_name
|
19
|
+
self.gdk_symbol[4..-1]
|
20
|
+
end
|
21
|
+
|
22
|
+
def gdk_symbol
|
23
|
+
Gdk::Keyval.symbol( keyval )
|
24
|
+
end
|
25
|
+
|
26
|
+
def match( *args )
|
27
|
+
bools = args.map do |arg|
|
28
|
+
case arg
|
29
|
+
when String
|
30
|
+
key_name == arg
|
31
|
+
when Regexp
|
32
|
+
!arg.match( key_name ).nil?
|
33
|
+
when Symbol
|
34
|
+
arg.to_s.downcase == key_name.downcase
|
35
|
+
end
|
36
|
+
end
|
37
|
+
return bools.include?( true )
|
38
|
+
end
|
39
|
+
|
40
|
+
def =~( arg )
|
41
|
+
match( arg )
|
42
|
+
end
|
43
|
+
|
44
|
+
def method_missing( meth, *args, &block )
|
45
|
+
if meth.to_s[-1] == "?"[0]
|
46
|
+
possible_key = meth.to_s[0..-2]
|
47
|
+
if possible_key.size == 1
|
48
|
+
key_name == possible_key || key_name == possible_key.upcase
|
49
|
+
else
|
50
|
+
key_name == possible_key.capitalize
|
51
|
+
end
|
52
|
+
else
|
53
|
+
super
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class EventKey
|
59
|
+
include KeyMatcher
|
60
|
+
def inspect
|
61
|
+
"#<Gdk::EventKey #{key_name}(#{keyval}) state=#{state.inspect}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|