win32-clipboard 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +91 -81
- data/MANIFEST +12 -8
- data/README +112 -112
- data/Rakefile +40 -15
- data/examples/clipboard_test.rb +28 -28
- data/lib/win32/clipboard.rb +414 -412
- data/lib/win32/html_clipboard.rb +232 -0
- data/lib/win32/windows/constants.rb +10 -0
- data/lib/win32/windows/functions.rb +56 -0
- data/lib/win32/windows/structs.rb +43 -0
- data/test/test_clipboard.rb +155 -135
- data/test/test_html_clipboard.rb +50 -0
- data/win32-clipboard.gemspec +26 -30
- metadata +78 -46
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bae3c43870e2b279fd8fecf2402d492635e84937
|
4
|
+
data.tar.gz: 890236829d55f6cbf2c60ced0422f5cbd8214b0d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 57ab34d912770a26f94b5f368a6a0efd4f7023d939bf42bf9f39d9e6a521afdabc4c4cec340fe01b13ac7f61e78d1f3006a0a1ccd07548c35d2f7c49f96ac9f6
|
7
|
+
data.tar.gz: 7bd917b7b196049f28173bb8aef3b8075eee2ab7a0c4221db791f6adc3306cf85e37ad93a14fa654f4ce728d5fc0b07064f1e721a19bea0e34b7e2d59fdf00d2
|
data/CHANGES
CHANGED
@@ -1,81 +1,91 @@
|
|
1
|
-
== 0.
|
2
|
-
*
|
3
|
-
|
4
|
-
*
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
== 0.5.
|
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
|
-
== 0.4.
|
40
|
-
*
|
41
|
-
*
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
*
|
47
|
-
|
48
|
-
|
49
|
-
== 0.
|
50
|
-
*
|
51
|
-
|
52
|
-
|
53
|
-
== 0.
|
54
|
-
*
|
55
|
-
|
56
|
-
|
57
|
-
* Added
|
58
|
-
|
59
|
-
|
60
|
-
*
|
61
|
-
|
62
|
-
|
63
|
-
== 0.
|
64
|
-
*
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
*
|
70
|
-
*
|
71
|
-
*
|
72
|
-
|
73
|
-
|
74
|
-
*
|
75
|
-
*
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
*
|
1
|
+
== 0.6.0 - 12-Jan-2014
|
2
|
+
* Converted code to use FFI.
|
3
|
+
* Now requires Ruby 1.9.1 or later and Windows Vista or later.
|
4
|
+
* The HtmlClipboard class has been added. This lets you get and set data
|
5
|
+
in html format.
|
6
|
+
* Added the get_html_data and set_html_data methods to the Clipboard class.
|
7
|
+
These are wrappers for the HtmlClipboard methods.
|
8
|
+
* You can now set bitmap data properly as well as retrieve it. Thanks go to
|
9
|
+
Tadashi Kba for the patch.
|
10
|
+
|
11
|
+
== 0.5.2 - 14-Jul-2009
|
12
|
+
* Replaced some missing include's that I thought were unnecessary. Thanks go
|
13
|
+
to Liu Song for the spot.
|
14
|
+
* Changed the license to Artistic 2.0, and set that explicitly in the gemspec.
|
15
|
+
|
16
|
+
== 0.5.1 - 26-Apr-2009
|
17
|
+
* Modified the Clipboard.register_format method to return the integer value
|
18
|
+
of the registered format.
|
19
|
+
* Removed some unnecessary include's.
|
20
|
+
|
21
|
+
== 0.5.0 - 24-Apr-2009
|
22
|
+
* Added the Clipboard.notify_change method, which notifies you if any changes
|
23
|
+
have been made to the clipboard.
|
24
|
+
* Added support for copying file lists, bitmaps and Windows metafiles.
|
25
|
+
* Added the Clipboard.clear alias for Clipboard.empty
|
26
|
+
* The previous documentation for the Clipboard.format_available? method was
|
27
|
+
misleading. It has been corrected.
|
28
|
+
* Added rdoc for modules, classes and constants, and added some inline
|
29
|
+
code examples for some methods.
|
30
|
+
* Gemspec update for handling a deprecated method.
|
31
|
+
|
32
|
+
== 0.4.4 - 26-Aug-2008
|
33
|
+
* Some internal refactoring to ensure that the clipboard is closed on failure
|
34
|
+
in a more robust fashion.
|
35
|
+
* Renamed the test file.
|
36
|
+
* Eliminated the custom memcpy function, since windows-pr now does the right
|
37
|
+
thing. This necessitated bumping the minimum required windows-pr version.
|
38
|
+
|
39
|
+
== 0.4.3 - 25-Jul-2007
|
40
|
+
* Changed ClipboardError to Clipboard::Error
|
41
|
+
* Added a Rakefile with tasks for testing and installation.
|
42
|
+
* Removed the install.rb file since installation is now handled by the Rakefile.
|
43
|
+
* Updates to the README and MANIFEST.
|
44
|
+
|
45
|
+
== 0.4.2 - 27-Jan-2007
|
46
|
+
* Fixes for the clipboard_test.rb example program setup code. Thanks go to
|
47
|
+
Harold Hausman for the spot.
|
48
|
+
|
49
|
+
== 0.4.1 - 30-Jul-2006
|
50
|
+
* Now uses the windows-pr package. No API changes.
|
51
|
+
* Made Clipboard.get_data a true alias (instead of a facade).
|
52
|
+
|
53
|
+
== 0.4.0 - 24-Feb-2006
|
54
|
+
* Removed the C version entirely and replaced it with a pure Ruby version
|
55
|
+
that uses the Win32API package.
|
56
|
+
* Added a gemspec.
|
57
|
+
* Added a install.rb file.
|
58
|
+
|
59
|
+
== 0.3.1 - 2-Feb-2006
|
60
|
+
* Unicode fix to handle characters with null bytes. Thanks go to Brian
|
61
|
+
Marick for the spot.
|
62
|
+
|
63
|
+
== 0.3.0 - 26-May-2005
|
64
|
+
* Changed the Clipboard.data= method to Clipboard.set_data because it does,
|
65
|
+
in fact, take up to two arguments. This API change is the main reason for
|
66
|
+
the VERSION bump.
|
67
|
+
* Added Clipboard.get_data method as an alias for Clipboard.data.
|
68
|
+
* Removed the clipboard.rd file. The Clipboard.txt file is now rdoc friendly.
|
69
|
+
* Now Unicode friendly.
|
70
|
+
* Added more tests, including Unicode test.
|
71
|
+
* General code cleanup.
|
72
|
+
|
73
|
+
== 0.2.1 - 28-Feb-2005
|
74
|
+
* Moved the 'examples' directory to the toplevel directory.
|
75
|
+
* Renamed the sample script to 'clipboard_test.rb'.
|
76
|
+
* Made this document and README rdoc friendly.
|
77
|
+
|
78
|
+
== 0.2.0 - 12-Jul-2004
|
79
|
+
* Made Clipboard a class instead of a module.
|
80
|
+
* Moved the ClipboardError class under the Win32 module.
|
81
|
+
* Added the formats() class method.
|
82
|
+
* Added the register_format class method.
|
83
|
+
* Added the format_available? class method.
|
84
|
+
* Added the format_name class method.
|
85
|
+
* Replaced all instances (1) of the deprecated STR2CSTR() function with the
|
86
|
+
StringValuePtr() function. This means that as of version 0.2.0 this package
|
87
|
+
requires Ruby 1.8.0 or later.
|
88
|
+
* Moved the sample script to doc/examples.
|
89
|
+
|
90
|
+
== 0.1.0 - 19-Nov-2003
|
91
|
+
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
* MANIFEST
|
2
|
-
* CHANGES
|
3
|
-
* README
|
4
|
-
* Rakefile
|
5
|
-
* win32-clipboard.gemspec
|
6
|
-
* examples/clipboard_test.rb
|
7
|
-
* lib/win32/clipboard.rb
|
8
|
-
*
|
1
|
+
* MANIFEST
|
2
|
+
* CHANGES
|
3
|
+
* README
|
4
|
+
* Rakefile
|
5
|
+
* win32-clipboard.gemspec
|
6
|
+
* examples/clipboard_test.rb
|
7
|
+
* lib/win32/clipboard.rb
|
8
|
+
* lib/win32/html_clipboard.rb
|
9
|
+
* lib/win32/windows/constants.rb
|
10
|
+
* lib/win32/windows/functions.rb
|
11
|
+
* lib/win32/windows/structs.rb
|
12
|
+
* test/test_clipboard.rb
|
data/README
CHANGED
@@ -1,112 +1,112 @@
|
|
1
|
-
== Description
|
2
|
-
win32-clipboard - a Ruby library for interacting with the Win32 clipboard.
|
3
|
-
|
4
|
-
== Installation
|
5
|
-
rake test (optional)
|
6
|
-
rake install (non-gem) or rake install_gem (gem)
|
7
|
-
|
8
|
-
== Synopsis
|
9
|
-
require 'win32/clipboard'
|
10
|
-
include Win32
|
11
|
-
|
12
|
-
puts "Data on clipboard: " + Clipboard.data
|
13
|
-
puts "Number of available formats: " + Clipboard.num_formats
|
14
|
-
|
15
|
-
puts "Setting data to 'foobar'"
|
16
|
-
Clipboard.set_data("foobar")
|
17
|
-
|
18
|
-
puts "Clipboard now contains: " + Clipboard.data
|
19
|
-
|
20
|
-
puts "Clearing clipboard"
|
21
|
-
Clipboard.empty
|
22
|
-
|
23
|
-
== Class Methods
|
24
|
-
Clipboard.data(format=nil)
|
25
|
-
Returns the data currently in the clipboard. If +format+ is
|
26
|
-
specified, it will attempt to retrieve the data in that format. The
|
27
|
-
default is Clipboard::TEXT. See the 'Constants' section for
|
28
|
-
the supported formats.
|
29
|
-
|
30
|
-
If there is no data in the clipboard, then an empty string is returned.
|
31
|
-
|
32
|
-
Note that this method does implicit conversions on formats with regards
|
33
|
-
to text data. See the MSDN documentation for more details.
|
34
|
-
|
35
|
-
Clipboard.empty
|
36
|
-
Empty the contents of the clipboard
|
37
|
-
|
38
|
-
Clipboard.format_available?(format_number)
|
39
|
-
Returns true if 'format_number' is currently available on the clipboard,
|
40
|
-
false otherwise.
|
41
|
-
|
42
|
-
Clipboard.format_name(format_number)
|
43
|
-
Returns the corresponding name for the given 'format_number', or nil
|
44
|
-
if it does not exist.
|
45
|
-
|
46
|
-
Clipboard.formats
|
47
|
-
Returns a hash of all the current formats, with the format number as the
|
48
|
-
key and the format name as the value for that key.
|
49
|
-
|
50
|
-
Clipboard.get_data(format=nil)
|
51
|
-
Alias for Clipboard.data.
|
52
|
-
|
53
|
-
Clipboard.num_formats
|
54
|
-
Returns the number of different data formats currently on the clipboard.
|
55
|
-
|
56
|
-
Clipboard.register_format(format)
|
57
|
-
Registers the given 'format' (a String) as a clipboard format, which
|
58
|
-
can then be used as a valid clipboard format.
|
59
|
-
|
60
|
-
If a registered format with the specified name already exists, a new
|
61
|
-
format is not registered and the return value identifies the existing
|
62
|
-
format. This enables more than one application to copy and paste data
|
63
|
-
using the same registered clipboard format. Note that the format name
|
64
|
-
comparison is case-insensitive.
|
65
|
-
|
66
|
-
Registered clipboard formats are identified by values in the range 0xC000
|
67
|
-
through 0xFFFF.
|
68
|
-
|
69
|
-
Clipboard.set_data(data, format=nil)
|
70
|
-
Sets the clipboard contents to the data that you specify. You may
|
71
|
-
optionally specify a clipboard format. The default is Clipboard::TEXT.
|
72
|
-
|
73
|
-
See the 'Constants' section for a list of the supported formats.
|
74
|
-
|
75
|
-
== Error Classes
|
76
|
-
Clipboard::Error
|
77
|
-
Typically only raised if the clipboard fails to open or if you attempt to
|
78
|
-
register an invalid format.
|
79
|
-
|
80
|
-
== Constants
|
81
|
-
=== Standard Constants
|
82
|
-
VERSION
|
83
|
-
Returns the current version number of this package, as a String.
|
84
|
-
|
85
|
-
=== Clipboard Formats
|
86
|
-
Clipboard::OEMTEXT
|
87
|
-
Text format containing characters in the OEM character set. Each line ends
|
88
|
-
with a carriage return/linefeed (CR-LF) combination. A null character
|
89
|
-
signals the end of the data.
|
90
|
-
|
91
|
-
Clipboard::TEXT
|
92
|
-
Text format. Each line ends with a carriage return/linefeed (CR-LF)
|
93
|
-
combination. A null character signals the end of the data. Use this format
|
94
|
-
for ANSI text.
|
95
|
-
|
96
|
-
Clipboard::UNICODETEXT
|
97
|
-
Unicode text format. Each line ends with a carriage return/linefeed
|
98
|
-
(CR-LF) combination. A null character signals the end of the data.
|
99
|
-
|
100
|
-
== Future Plans
|
101
|
-
Add more formatting option contants and related methods.
|
102
|
-
|
103
|
-
== License
|
104
|
-
Ruby's
|
105
|
-
|
106
|
-
== Copyright
|
107
|
-
(C) 2003-2008 Daniel J. Berger
|
108
|
-
All Rights Reserved
|
109
|
-
|
110
|
-
== Authors
|
111
|
-
Daniel J. Berger
|
112
|
-
Park Heesob
|
1
|
+
== Description
|
2
|
+
win32-clipboard - a Ruby library for interacting with the Win32 clipboard.
|
3
|
+
|
4
|
+
== Installation
|
5
|
+
rake test (optional)
|
6
|
+
rake install (non-gem) or rake install_gem (gem)
|
7
|
+
|
8
|
+
== Synopsis
|
9
|
+
require 'win32/clipboard'
|
10
|
+
include Win32
|
11
|
+
|
12
|
+
puts "Data on clipboard: " + Clipboard.data
|
13
|
+
puts "Number of available formats: " + Clipboard.num_formats
|
14
|
+
|
15
|
+
puts "Setting data to 'foobar'"
|
16
|
+
Clipboard.set_data("foobar")
|
17
|
+
|
18
|
+
puts "Clipboard now contains: " + Clipboard.data
|
19
|
+
|
20
|
+
puts "Clearing clipboard"
|
21
|
+
Clipboard.empty
|
22
|
+
|
23
|
+
== Class Methods
|
24
|
+
Clipboard.data(format=nil)
|
25
|
+
Returns the data currently in the clipboard. If +format+ is
|
26
|
+
specified, it will attempt to retrieve the data in that format. The
|
27
|
+
default is Clipboard::TEXT. See the 'Constants' section for
|
28
|
+
the supported formats.
|
29
|
+
|
30
|
+
If there is no data in the clipboard, then an empty string is returned.
|
31
|
+
|
32
|
+
Note that this method does implicit conversions on formats with regards
|
33
|
+
to text data. See the MSDN documentation for more details.
|
34
|
+
|
35
|
+
Clipboard.empty
|
36
|
+
Empty the contents of the clipboard
|
37
|
+
|
38
|
+
Clipboard.format_available?(format_number)
|
39
|
+
Returns true if 'format_number' is currently available on the clipboard,
|
40
|
+
false otherwise.
|
41
|
+
|
42
|
+
Clipboard.format_name(format_number)
|
43
|
+
Returns the corresponding name for the given 'format_number', or nil
|
44
|
+
if it does not exist.
|
45
|
+
|
46
|
+
Clipboard.formats
|
47
|
+
Returns a hash of all the current formats, with the format number as the
|
48
|
+
key and the format name as the value for that key.
|
49
|
+
|
50
|
+
Clipboard.get_data(format=nil)
|
51
|
+
Alias for Clipboard.data.
|
52
|
+
|
53
|
+
Clipboard.num_formats
|
54
|
+
Returns the number of different data formats currently on the clipboard.
|
55
|
+
|
56
|
+
Clipboard.register_format(format)
|
57
|
+
Registers the given 'format' (a String) as a clipboard format, which
|
58
|
+
can then be used as a valid clipboard format.
|
59
|
+
|
60
|
+
If a registered format with the specified name already exists, a new
|
61
|
+
format is not registered and the return value identifies the existing
|
62
|
+
format. This enables more than one application to copy and paste data
|
63
|
+
using the same registered clipboard format. Note that the format name
|
64
|
+
comparison is case-insensitive.
|
65
|
+
|
66
|
+
Registered clipboard formats are identified by values in the range 0xC000
|
67
|
+
through 0xFFFF.
|
68
|
+
|
69
|
+
Clipboard.set_data(data, format=nil)
|
70
|
+
Sets the clipboard contents to the data that you specify. You may
|
71
|
+
optionally specify a clipboard format. The default is Clipboard::TEXT.
|
72
|
+
|
73
|
+
See the 'Constants' section for a list of the supported formats.
|
74
|
+
|
75
|
+
== Error Classes
|
76
|
+
Clipboard::Error
|
77
|
+
Typically only raised if the clipboard fails to open or if you attempt to
|
78
|
+
register an invalid format.
|
79
|
+
|
80
|
+
== Constants
|
81
|
+
=== Standard Constants
|
82
|
+
VERSION
|
83
|
+
Returns the current version number of this package, as a String.
|
84
|
+
|
85
|
+
=== Clipboard Formats
|
86
|
+
Clipboard::OEMTEXT
|
87
|
+
Text format containing characters in the OEM character set. Each line ends
|
88
|
+
with a carriage return/linefeed (CR-LF) combination. A null character
|
89
|
+
signals the end of the data.
|
90
|
+
|
91
|
+
Clipboard::TEXT
|
92
|
+
Text format. Each line ends with a carriage return/linefeed (CR-LF)
|
93
|
+
combination. A null character signals the end of the data. Use this format
|
94
|
+
for ANSI text.
|
95
|
+
|
96
|
+
Clipboard::UNICODETEXT
|
97
|
+
Unicode text format. Each line ends with a carriage return/linefeed
|
98
|
+
(CR-LF) combination. A null character signals the end of the data.
|
99
|
+
|
100
|
+
== Future Plans
|
101
|
+
Add more formatting option contants and related methods.
|
102
|
+
|
103
|
+
== License
|
104
|
+
Ruby's
|
105
|
+
|
106
|
+
== Copyright
|
107
|
+
(C) 2003-2008 Daniel J. Berger
|
108
|
+
All Rights Reserved
|
109
|
+
|
110
|
+
== Authors
|
111
|
+
Daniel J. Berger
|
112
|
+
Park Heesob
|
data/Rakefile
CHANGED
@@ -1,25 +1,50 @@
|
|
1
1
|
require 'rake'
|
2
|
+
require 'rake/clean'
|
2
3
|
require 'rake/testtask'
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
CLEAN.include('**/*.gem', '**/*.rbc')
|
6
|
+
|
7
|
+
namespace :gem do
|
8
|
+
desc "Create the win32-clipboard gem"
|
9
|
+
task :create => [:clean] do
|
10
|
+
spec = eval(IO.read('win32-clipboard.gemspec'))
|
11
|
+
if Gem::VERSION.to_f < 2.0
|
12
|
+
Gem::Builder.new(spec).build
|
13
|
+
else
|
14
|
+
require 'rubygems/package'
|
15
|
+
Gem::Package.build(spec)
|
16
|
+
end
|
17
|
+
end
|
10
18
|
|
11
|
-
desc "Install the win32-clipboard library
|
12
|
-
task :
|
13
|
-
|
14
|
-
|
15
|
-
|
19
|
+
desc "Install the win32-clipboard library"
|
20
|
+
task :install => [:create] do
|
21
|
+
file = Dir["*.gem"].first
|
22
|
+
sh "gem install #{file}"
|
23
|
+
end
|
16
24
|
end
|
17
25
|
|
18
26
|
desc "Run the example program"
|
19
27
|
task :example do
|
20
|
-
|
28
|
+
sh "ruby -Ilib examples/clipboard_test.rb"
|
29
|
+
end
|
21
30
|
|
22
|
-
|
23
|
-
|
24
|
-
|
31
|
+
namespace :test do
|
32
|
+
Rake::TestTask.new(:all) do |t|
|
33
|
+
t.warning = true
|
34
|
+
t.verbose = true
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::TestTask.new(:html) do |t|
|
38
|
+
t.warning = true
|
39
|
+
t.verbose = true
|
40
|
+
t.test_files = FileList['test/test_html_clipboard.rb']
|
41
|
+
end
|
42
|
+
|
43
|
+
Rake::TestTask.new(:std) do |t|
|
44
|
+
t.warning = true
|
45
|
+
t.verbose = true
|
46
|
+
t.test_files = FileList['test/test_clipboard.rb']
|
47
|
+
end
|
25
48
|
end
|
49
|
+
|
50
|
+
task :default => 'test:all'
|