win32-clipboard 0.5.0 → 0.5.1
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/CHANGES +5 -0
- data/lib/win32/clipboard.rb +9 -11
- data/test/test_clipboard.rb +3 -2
- data/win32-clipboard.gemspec +1 -1
- metadata +2 -2
data/CHANGES
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 0.5.1 - 26-Apr-2009
|
2
|
+
* Modified the Clipboard.register_format method to return the integer value
|
3
|
+
of the registered format.
|
4
|
+
* Removed some unnecessary include's.
|
5
|
+
|
1
6
|
== 0.5.0 - 24-Apr-2009
|
2
7
|
* Added the Clipboard.notify_change method, which notifies you if any changes
|
3
8
|
have been made to the clipboard.
|
data/lib/win32/clipboard.rb
CHANGED
@@ -21,13 +21,6 @@ module Win32
|
|
21
21
|
include Windows::Clipboard
|
22
22
|
include Windows::Memory
|
23
23
|
include Windows::Error
|
24
|
-
include Windows::Shell
|
25
|
-
include Windows::Library
|
26
|
-
include Windows::Window
|
27
|
-
include Windows::MSVCRT::Buffer
|
28
|
-
include Windows::GDI::MetaFile
|
29
|
-
include Windows::Window::Message
|
30
|
-
include Windows::Window::Classes
|
31
24
|
|
32
25
|
extend Windows::Clipboard
|
33
26
|
extend Windows::Memory
|
@@ -41,7 +34,7 @@ module Win32
|
|
41
34
|
extend Windows::Window::Classes
|
42
35
|
|
43
36
|
# The version of this library
|
44
|
-
VERSION = '0.5.
|
37
|
+
VERSION = '0.5.1'
|
45
38
|
|
46
39
|
# Clipboard formats
|
47
40
|
|
@@ -125,7 +118,7 @@ module Win32
|
|
125
118
|
when TEXT, OEMTEXT, UNICODETEXT
|
126
119
|
clip_data = 0.chr * GlobalSize(handle)
|
127
120
|
memcpy(clip_data, handle, clip_data.size)
|
128
|
-
clip_data
|
121
|
+
clip_data = clip_data[ /^[^\0]*/ ]
|
129
122
|
when HDROP
|
130
123
|
clip_data = get_file_list(handle)
|
131
124
|
when ENHMETAFILE
|
@@ -233,7 +226,8 @@ module Win32
|
|
233
226
|
end
|
234
227
|
|
235
228
|
# Registers the given +format+ (a String) as a clipboard format, which
|
236
|
-
# can then be used as a valid clipboard format.
|
229
|
+
# can then be used as a valid clipboard format. Returns the integer
|
230
|
+
# value of the registered format.
|
237
231
|
#
|
238
232
|
# If a registered format with the specified name already exists, a new
|
239
233
|
# format is not registered and the return value identifies the existing
|
@@ -247,10 +241,14 @@ module Win32
|
|
247
241
|
def self.register_format(format)
|
248
242
|
raise TypeError unless format.is_a?(String)
|
249
243
|
|
250
|
-
|
244
|
+
format_value = RegisterClipboardFormat(format)
|
245
|
+
|
246
|
+
if format_value == 0
|
251
247
|
error = "RegisterClipboardFormat() call failed: " + get_last_error
|
252
248
|
raise Error, error
|
253
249
|
end
|
250
|
+
|
251
|
+
format_value
|
254
252
|
end
|
255
253
|
|
256
254
|
# Sets up a notification loop that will call the provided block whenever
|
data/test/test_clipboard.rb
CHANGED
@@ -16,7 +16,7 @@ include Win32
|
|
16
16
|
|
17
17
|
class TC_Win32_ClipBoard < Test::Unit::TestCase
|
18
18
|
def test_version
|
19
|
-
assert_equal('0.5.
|
19
|
+
assert_equal('0.5.1', Clipboard::VERSION)
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_data
|
@@ -85,7 +85,8 @@ class TC_Win32_ClipBoard < Test::Unit::TestCase
|
|
85
85
|
|
86
86
|
def test_register_format
|
87
87
|
assert_respond_to(Clipboard, :register_format)
|
88
|
-
assert_nothing_raised{ Clipboard.register_format('
|
88
|
+
assert_nothing_raised{ Clipboard.register_format('Ruby') }
|
89
|
+
assert_kind_of(Integer, Clipboard.register_format('Ruby'))
|
89
90
|
end
|
90
91
|
|
91
92
|
def test_register_format_expected_errors
|
data/win32-clipboard.gemspec
CHANGED
@@ -2,7 +2,7 @@ require "rubygems"
|
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'win32-clipboard'
|
5
|
-
gem.version = '0.5.
|
5
|
+
gem.version = '0.5.1'
|
6
6
|
gem.authors = ['Daniel J. Berger', 'Park Heesob']
|
7
7
|
gem.email = 'djberg96@gmail.com'
|
8
8
|
gem.homepage = 'http://www.rubyforge.org/projects/win32utils'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-clipboard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-04-
|
13
|
+
date: 2009-04-26 00:00:00 -06:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|