rum 0.0.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/CHANGELOG +3 -0
  2. data/README +30 -0
  3. data/Rakefile +134 -0
  4. data/bin/rum-client +124 -0
  5. data/doc/basic.rb +10 -0
  6. data/doc/doc.html +602 -0
  7. data/doc/example.rb +59 -0
  8. data/doc/reference.rb +415 -0
  9. data/doc/resources/bg.png +0 -0
  10. data/doc/resources/bottom.png +0 -0
  11. data/doc/resources/build.rb +235 -0
  12. data/doc/resources/doc.haml +167 -0
  13. data/doc/resources/emacs-auto-completion.png +0 -0
  14. data/doc/resources/flash.png +0 -0
  15. data/doc/resources/highlight.css +94 -0
  16. data/doc/resources/intro.rb +17 -0
  17. data/doc/resources/left.png +0 -0
  18. data/doc/resources/logo.png +0 -0
  19. data/doc/resources/screen.css +420 -0
  20. data/doc/resources/screenshot.png +0 -0
  21. data/doc/resources/top.png +0 -0
  22. data/ext/mac/keyboard_hook/English.lproj/InfoPlist.strings +0 -0
  23. data/ext/mac/keyboard_hook/Event.h +17 -0
  24. data/ext/mac/keyboard_hook/Event.m +18 -0
  25. data/ext/mac/keyboard_hook/EventTap.h +11 -0
  26. data/ext/mac/keyboard_hook/EventTap.m +77 -0
  27. data/ext/mac/keyboard_hook/Info.plist +26 -0
  28. data/ext/mac/keyboard_hook/KeyboardHook.xcodeproj/TemplateIcon.icns +0 -0
  29. data/ext/mac/keyboard_hook/KeyboardHook.xcodeproj/project.pbxproj +323 -0
  30. data/ext/mac/keyboard_hook/KeyboardHook_Prefix.pch +7 -0
  31. data/ext/mac/keyboard_hook/version.plist +16 -0
  32. data/ext/windows/keyboard_hook/extconf.rb +2 -0
  33. data/ext/windows/keyboard_hook/keyboard_hook.c +126 -0
  34. data/ext/windows/system/autohotkey_stuff.c +255 -0
  35. data/ext/windows/system/autohotkey_stuff.h +2 -0
  36. data/ext/windows/system/clipboard_watcher.c +58 -0
  37. data/ext/windows/system/clipboard_watcher.h +2 -0
  38. data/ext/windows/system/extconf.rb +3 -0
  39. data/ext/windows/system/input_box.c +239 -0
  40. data/ext/windows/system/input_box.h +4 -0
  41. data/ext/windows/system/system.c +273 -0
  42. data/lib/rum.rb +4 -0
  43. data/lib/rum/apps.rb +4 -0
  44. data/lib/rum/barrel.rb +157 -0
  45. data/lib/rum/barrel/emacs.rb +44 -0
  46. data/lib/rum/barrel/emacs_client.rb +74 -0
  47. data/lib/rum/core.rb +125 -0
  48. data/lib/rum/dsl.rb +109 -0
  49. data/lib/rum/gui.rb +93 -0
  50. data/lib/rum/help.rb +128 -0
  51. data/lib/rum/hotkey_core.rb +479 -0
  52. data/lib/rum/mac.rb +18 -0
  53. data/lib/rum/mac/app.rb +4 -0
  54. data/lib/rum/mac/apps.rb +19 -0
  55. data/lib/rum/mac/gui.rb +26 -0
  56. data/lib/rum/mac/gui/growl.rb +54 -0
  57. data/lib/rum/mac/irb/completion.rb +207 -0
  58. data/lib/rum/mac/keyboard_hook.rb +73 -0
  59. data/lib/rum/mac/layouts.rb +146 -0
  60. data/lib/rum/mac/system.rb +45 -0
  61. data/lib/rum/remote.rb +48 -0
  62. data/lib/rum/server.rb +92 -0
  63. data/lib/rum/windows.rb +23 -0
  64. data/lib/rum/windows/app.rb +72 -0
  65. data/lib/rum/windows/apps.rb +25 -0
  66. data/lib/rum/windows/gui.rb +116 -0
  67. data/lib/rum/windows/keyboard.rb +80 -0
  68. data/lib/rum/windows/keyboard_hook.rb +20 -0
  69. data/lib/rum/windows/keyboard_hook.so +0 -0
  70. data/lib/rum/windows/layouts.rb +232 -0
  71. data/lib/rum/windows/system.rb +310 -0
  72. data/lib/rum/windows/system.so +0 -0
  73. data/lib/rum/windows/system_foreign_functions.rb +129 -0
  74. data/rum.gemspec +14 -0
  75. metadata +156 -0
Binary file
@@ -0,0 +1,129 @@
1
+ require_relative 'system.so'
2
+ # The C-extension defines:
3
+ # Rum::System (module methods)
4
+ # enum_windows
5
+ # keybd_event
6
+ # get_console_window
7
+ # Rum::System::Window (class instance methods)
8
+ # show
9
+ # exe_path
10
+ # ...
11
+ # Rum::System::Desktop (module methods)
12
+ # top
13
+ # right
14
+ # bottom
15
+ # left
16
+ # Rum::System::Screen (module methods)
17
+ # width
18
+ # height
19
+ # Rum::System::Clipboard (module methods)
20
+ # install_watcher
21
+ # evaluate_watcher
22
+
23
+ require 'win32/api'
24
+ require 'win32/clipboard'
25
+
26
+ module Rum
27
+ module System
28
+ def self.snake_case str
29
+ str.gsub(/([a-z])([A-Z0-9])/, '\1_\2').downcase
30
+ end
31
+
32
+ def self.def_api(function_name, parameters, return_value, rename=nil)
33
+ api = Win32::API.new function_name, parameters, return_value, 'user32'
34
+ define_method(rename || snake_case(function_name)) do |*args|
35
+ api.call *args
36
+ end
37
+ end
38
+
39
+ def_api 'FindWindow', 'PP', 'L'
40
+ def_api 'FindWindowEx', 'LLPP', 'L'
41
+ def_api 'SendMessage', 'LLLP', 'L', :send_with_buffer
42
+ def_api 'SendMessage', 'LLLL', 'L'
43
+ def_api 'PostMessage', 'LLLL', 'L'
44
+ def_api 'GetDlgItem', 'LL', 'L'
45
+ def_api 'GetWindowRect', 'LP', 'I'
46
+ def_api 'SetCursorPos', 'LL', 'I'
47
+ def_api 'mouse_event', 'LLLLL', 'V'
48
+ def_api 'IsWindow', 'L', 'L'
49
+ def_api 'IsWindowVisible', 'L', 'L'
50
+ def_api 'SetForegroundWindow', 'L', 'L'
51
+
52
+ def_api 'GetWindowLong', 'LI', 'L'
53
+ def_api 'GetForegroundWindow', 'V', 'L'
54
+ def_api 'GetClassName', 'LPI', 'I'
55
+ def_api 'GetWindowText', 'LPI', 'I'
56
+ def_api 'GetWindowTextW', 'LPI', 'I'
57
+ def_api 'ShowWindow', 'LI', 'I'
58
+ def_api 'SetForegroundWindow', 'L', 'I'
59
+ def_api 'IsIconic', 'L', 'L'
60
+ def_api 'IsZoomed', 'L', 'L'
61
+ def_api 'SetWindowPos', 'LLIIIII', 'I'
62
+ def_api 'MoveWindow', 'LIIIIB', 'L'
63
+
64
+ ShellExecute = Win32::API.new('ShellExecute', 'LPPPPI', 'L', 'shell32')
65
+ def start command, parameters=0
66
+ ShellExecute.call(0, 'open', command, parameters, 0, 1)
67
+ end
68
+
69
+ WM_COMMAND = 0x0111
70
+ WM_SYSCOMMAND = 0x0112
71
+
72
+ SC_CLOSE = 0xF060
73
+ SC_RESTORE = 0xF120;
74
+ SC_MAXIMIZE = 0xF030;
75
+ SC_MINIMIZE = 0xF020;
76
+
77
+ WM_GETTEXT = 0x000D
78
+ EM_GETSEL = 0x00B0
79
+ EM_SETSEL = 0x00B1
80
+ SW_HIDE = 0
81
+ SW_SHOWNORMAL = 1
82
+ SW_NORMAL = 1
83
+ SW_SHOWMINIMIZED = 2
84
+ SW_SHOWMAXIMIZED = 3
85
+ SW_MAXIMIZE = 3
86
+ SW_SHOWNOACTIVATE = 4
87
+ SW_SHOW = 5
88
+ SW_MINIMIZE = 6
89
+ SW_SHOWMINNOACTIVE = 7
90
+ SW_SHOWNA = 8
91
+ SW_RESTORE = 9
92
+ SW_SHOWDEFAULT = 10
93
+ SW_FORCEMINIMIZE = 11
94
+ SW_MAX = 11
95
+
96
+ SWP_NOMOVE = 2
97
+ SWP_NOSIZE = 1
98
+ HWND_TOPMOST = -1
99
+ HWND_NOTOPMOST = -2
100
+ GWL_EXSTYLE = -20
101
+ WS_EX_TOPMOST = 8
102
+ end
103
+ end
104
+
105
+ module Win32
106
+ class Clipboard
107
+ def self.get
108
+ begin
109
+ self.open
110
+ return '' unless IsClipboardFormatAvailable(UNICODETEXT)
111
+ handle = GetClipboardData(UNICODETEXT)
112
+ clip_data = 0.chr * GlobalSize(handle)
113
+ memcpy(clip_data, handle, clip_data.size)
114
+ clip_data.force_encoding(Encoding::UTF_16LE)
115
+ clip_data.encode!(Encoding::UTF_8, invalid: :replace, replace: '', \
116
+ universal_newline: true)
117
+ clip_data[ /^[^\0]*/ ]
118
+ ensure
119
+ self.close
120
+ end
121
+ end
122
+
123
+ def self.set str
124
+ data = str.encode(Encoding::UTF_16LE, crlf_newline: true)
125
+ data.force_encoding Encoding::BINARY
126
+ set_data(data, UNICODETEXT)
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'rum'
5
+ spec.version = '0.0.1'
6
+ spec.author = 'nonsequitur'
7
+ spec.license = 'MIT'
8
+ spec.homepage = 'http://nonsequitur.github.com/rum'
9
+ spec.summary = 'A cross-platform Hotkey and Macro utility, running on Windows and Mac OS.'
10
+ spec.required_ruby_version = '>= 1.9.1'
11
+
12
+ spec.executables << 'rum-client'
13
+ spec.extra_rdoc_files = ['README']
14
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rum
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: x86-mingw32
7
+ authors:
8
+ - nonsequitur
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-06-04 00:00:00.000000000 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: ruby_gntp
17
+ requirement: &7846656 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.3.4
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *7846656
26
+ - !ruby/object:Gem::Dependency
27
+ name: win32-api
28
+ requirement: &7846080 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.8
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *7846080
37
+ - !ruby/object:Gem::Dependency
38
+ name: win32-clipboard
39
+ requirement: &7845480 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: 0.5.2
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *7845480
48
+ description:
49
+ email:
50
+ executables:
51
+ - rum-client
52
+ extensions: []
53
+ extra_rdoc_files:
54
+ - README
55
+ files:
56
+ - bin/rum-client
57
+ - CHANGELOG
58
+ - doc/basic.rb
59
+ - doc/doc.html
60
+ - doc/example.rb
61
+ - doc/reference.rb
62
+ - doc/resources/bg.png
63
+ - doc/resources/bottom.png
64
+ - doc/resources/build.rb
65
+ - doc/resources/doc.haml
66
+ - doc/resources/emacs-auto-completion.png
67
+ - doc/resources/flash.png
68
+ - doc/resources/highlight.css
69
+ - doc/resources/intro.rb
70
+ - doc/resources/left.png
71
+ - doc/resources/logo.png
72
+ - doc/resources/screen.css
73
+ - doc/resources/screenshot.png
74
+ - doc/resources/top.png
75
+ - ext/mac/keyboard_hook/English.lproj/InfoPlist.strings
76
+ - ext/mac/keyboard_hook/Event.h
77
+ - ext/mac/keyboard_hook/Event.m
78
+ - ext/mac/keyboard_hook/EventTap.h
79
+ - ext/mac/keyboard_hook/EventTap.m
80
+ - ext/mac/keyboard_hook/Info.plist
81
+ - ext/mac/keyboard_hook/KeyboardHook.xcodeproj/project.pbxproj
82
+ - ext/mac/keyboard_hook/KeyboardHook.xcodeproj/TemplateIcon.icns
83
+ - ext/mac/keyboard_hook/KeyboardHook_Prefix.pch
84
+ - ext/mac/keyboard_hook/version.plist
85
+ - ext/windows/keyboard_hook/extconf.rb
86
+ - ext/windows/keyboard_hook/keyboard_hook.c
87
+ - ext/windows/system/autohotkey_stuff.c
88
+ - ext/windows/system/autohotkey_stuff.h
89
+ - ext/windows/system/clipboard_watcher.c
90
+ - ext/windows/system/clipboard_watcher.h
91
+ - ext/windows/system/extconf.rb
92
+ - ext/windows/system/input_box.c
93
+ - ext/windows/system/input_box.h
94
+ - ext/windows/system/system.c
95
+ - lib/rum/apps.rb
96
+ - lib/rum/barrel/emacs.rb
97
+ - lib/rum/barrel/emacs_client.rb
98
+ - lib/rum/barrel.rb
99
+ - lib/rum/core.rb
100
+ - lib/rum/dsl.rb
101
+ - lib/rum/gui.rb
102
+ - lib/rum/help.rb
103
+ - lib/rum/hotkey_core.rb
104
+ - lib/rum/mac/app.rb
105
+ - lib/rum/mac/apps.rb
106
+ - lib/rum/mac/gui/growl.rb
107
+ - lib/rum/mac/gui.rb
108
+ - lib/rum/mac/irb/completion.rb
109
+ - lib/rum/mac/keyboard_hook.rb
110
+ - lib/rum/mac/layouts.rb
111
+ - lib/rum/mac/system.rb
112
+ - lib/rum/mac.rb
113
+ - lib/rum/remote.rb
114
+ - lib/rum/server.rb
115
+ - lib/rum/windows/app.rb
116
+ - lib/rum/windows/apps.rb
117
+ - lib/rum/windows/gui.rb
118
+ - lib/rum/windows/keyboard.rb
119
+ - lib/rum/windows/keyboard_hook.rb
120
+ - lib/rum/windows/keyboard_hook.so
121
+ - lib/rum/windows/layouts.rb
122
+ - lib/rum/windows/system.rb
123
+ - lib/rum/windows/system.so
124
+ - lib/rum/windows/system_foreign_functions.rb
125
+ - lib/rum/windows.rb
126
+ - lib/rum.rb
127
+ - Rakefile
128
+ - README
129
+ - rum.gemspec
130
+ has_rdoc: true
131
+ homepage: http://nonsequitur.github.com/rum
132
+ licenses:
133
+ - MIT
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ! '>='
142
+ - !ruby/object:Gem::Version
143
+ version: 1.9.1
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 1.5.2
153
+ signing_key:
154
+ specification_version: 3
155
+ summary: A cross-platform Hotkey and Macro utility, running on Windows and Mac OS.
156
+ test_files: []