hotcocoa 0.5.1 → 0.6.0pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +14 -0
- data/History.txt +21 -0
- data/README.markdown +84 -0
- data/Rakefile +47 -0
- data/bin/hotcocoa +20 -10
- data/docs/Contributors.markdown +25 -0
- data/docs/Mappings.markdown +352 -0
- data/docs/MappingsExplained.markdown +22 -0
- data/docs/Overview.markdown +58 -0
- data/docs/Resources.markdown +25 -0
- data/docs/Tutorial.markdown +3 -0
- data/lib/hotcocoa/application/builder.rb +237 -0
- data/lib/hotcocoa/application/specification.rb +373 -0
- data/lib/hotcocoa/application_builder.rb +338 -242
- data/lib/hotcocoa/attributed_string_helpers.rb +128 -0
- data/lib/hotcocoa/behaviors.rb +39 -6
- data/lib/hotcocoa/core_extensions/kernel.rb +67 -0
- data/lib/hotcocoa/core_extensions/nsarray.rb +15 -0
- data/lib/hotcocoa/core_extensions/nsmutable_attributed_string.rb +74 -0
- data/lib/hotcocoa/core_extensions/nsstring.rb +36 -0
- data/lib/hotcocoa/core_extensions/nsurl.rb +6 -0
- data/lib/hotcocoa/core_extensions/numeric.rb +9 -0
- data/lib/hotcocoa/core_extensions/object.rb +36 -0
- data/lib/hotcocoa/core_extensions/range.rb +30 -0
- data/lib/hotcocoa/core_extensions.rb +8 -0
- data/lib/hotcocoa/data_sources/combo_box_data_source.rb +38 -38
- data/lib/hotcocoa/data_sources/outline_view_data_source.rb +33 -0
- data/lib/hotcocoa/data_sources/table_data_source.rb +12 -13
- data/lib/hotcocoa/data_sources.rb +3 -0
- data/lib/hotcocoa/delegate_builder.rb +114 -79
- data/lib/hotcocoa/graphics/canvas.rb +211 -214
- data/lib/hotcocoa/graphics/color.rb +89 -91
- data/lib/hotcocoa/graphics/elements/particle.rb +16 -19
- data/lib/hotcocoa/graphics/elements/rope.rb +12 -14
- data/lib/hotcocoa/graphics/elements/sandpainter.rb +11 -13
- data/lib/hotcocoa/graphics/gradient.rb +13 -14
- data/lib/hotcocoa/graphics/image.rb +110 -83
- data/lib/hotcocoa/graphics/path.rb +44 -50
- data/lib/hotcocoa/graphics/pdf.rb +17 -19
- data/lib/hotcocoa/graphics.rb +21 -20
- data/lib/hotcocoa/kvo_accessors.rb +10 -11
- data/lib/hotcocoa/layout_view.rb +394 -379
- data/lib/hotcocoa/mapper.rb +346 -207
- data/lib/hotcocoa/mapping_methods.rb +107 -37
- data/lib/hotcocoa/mappings/appkit/alert.rb +25 -0
- data/lib/hotcocoa/mappings/appkit/application.rb +112 -0
- data/lib/hotcocoa/mappings/{array_controller.rb → appkit/array_controller.rb} +33 -35
- data/lib/hotcocoa/mappings/appkit/box.rb +37 -0
- data/lib/hotcocoa/mappings/appkit/button.rb +88 -0
- data/lib/hotcocoa/mappings/appkit/collection_view.rb +42 -0
- data/lib/hotcocoa/mappings/appkit/color.rb +40 -0
- data/lib/hotcocoa/mappings/appkit/column.rb +19 -0
- data/lib/hotcocoa/mappings/appkit/combo_box.rb +22 -0
- data/lib/hotcocoa/mappings/appkit/control.rb +31 -0
- data/lib/hotcocoa/mappings/appkit/font.rb +58 -0
- data/lib/hotcocoa/mappings/appkit/gradient.rb +19 -0
- data/lib/hotcocoa/mappings/appkit/image.rb +15 -0
- data/lib/hotcocoa/mappings/appkit/image_view.rb +41 -0
- data/lib/hotcocoa/mappings/appkit/label.rb +23 -0
- data/lib/hotcocoa/mappings/appkit/layout_view.rb +9 -0
- data/lib/hotcocoa/mappings/appkit/line.rb +16 -0
- data/lib/hotcocoa/mappings/appkit/menu.rb +78 -0
- data/lib/hotcocoa/mappings/appkit/menu_item.rb +47 -0
- data/lib/hotcocoa/mappings/appkit/outline_view.rb +62 -0
- data/lib/hotcocoa/mappings/appkit/popup.rb +106 -0
- data/lib/hotcocoa/mappings/appkit/progress_indicator.rb +61 -0
- data/lib/hotcocoa/mappings/appkit/scroll_view.rb +28 -0
- data/lib/hotcocoa/mappings/appkit/search_field.rb +9 -0
- data/lib/hotcocoa/mappings/appkit/secure_text_field.rb +15 -0
- data/lib/hotcocoa/mappings/appkit/segmented_control.rb +103 -0
- data/lib/hotcocoa/mappings/appkit/slider.rb +23 -0
- data/lib/hotcocoa/mappings/appkit/sound.rb +9 -0
- data/lib/hotcocoa/mappings/appkit/speech_synthesizer.rb +22 -0
- data/lib/hotcocoa/mappings/appkit/split_view.rb +19 -0
- data/lib/hotcocoa/mappings/appkit/status_bar.rb +7 -0
- data/lib/hotcocoa/mappings/appkit/status_item.rb +9 -0
- data/lib/hotcocoa/mappings/appkit/table_view.rb +108 -0
- data/lib/hotcocoa/mappings/appkit/text_field.rb +36 -0
- data/lib/hotcocoa/mappings/appkit/text_view.rb +13 -0
- data/lib/hotcocoa/mappings/appkit/toolbar.rb +99 -0
- data/lib/hotcocoa/mappings/appkit/toolbar_item.rb +36 -0
- data/lib/hotcocoa/mappings/appkit/tracking_area.rb +24 -0
- data/lib/hotcocoa/mappings/appkit/view.rb +65 -0
- data/lib/hotcocoa/mappings/appkit/window.rb +124 -0
- data/lib/hotcocoa/mappings/foundation/net_service.rb +65 -0
- data/lib/hotcocoa/mappings/foundation/net_service_browser.rb +27 -0
- data/lib/hotcocoa/mappings/foundation/notification.rb +24 -0
- data/lib/hotcocoa/mappings/foundation/sort_descriptor.rb +17 -0
- data/lib/hotcocoa/mappings/foundation/timer.rb +38 -0
- data/lib/hotcocoa/mappings/foundation/user_defaults.rb +43 -0
- data/lib/hotcocoa/mappings/foundation/xml_parser.rb +44 -0
- data/lib/hotcocoa/mappings/qtkit/movie.rb +15 -0
- data/lib/hotcocoa/mappings/qtkit/movie_view.rb +28 -0
- data/lib/hotcocoa/mappings/webkit/web_view.rb +20 -0
- data/lib/hotcocoa/mappings.rb +57 -111
- data/lib/hotcocoa/mvc.rb +90 -81
- data/lib/hotcocoa/notification_listener.rb +135 -58
- data/lib/hotcocoa/standard_rake_tasks.rb +17 -9
- data/lib/hotcocoa/target_action_convenience.rb +39 -0
- data/lib/hotcocoa/template.rb +90 -21
- data/lib/hotcocoa/version.rb +3 -0
- data/lib/hotcocoa.rb +12 -14
- data/template/Rakefile +31 -3
- data/template/__APPLICATION_NAME__.appspec +8 -0
- data/template/lib/application.rb +14 -17
- data/template/lib/menu.rb +11 -11
- data/test/application/test_builder.rb +28 -0
- data/test/application/test_specification.rb +280 -0
- data/test/core_extensions/test_kernel.rb +66 -0
- data/test/core_extensions/test_nsarray.rb +9 -0
- data/test/core_extensions/test_nsmutable_attributed_string.rb +86 -0
- data/test/core_extensions/test_nsstring.rb +20 -0
- data/test/core_extensions/test_nsurl.rb +9 -0
- data/test/core_extensions/test_numeric.rb +10 -0
- data/test/core_extensions/test_object.rb +37 -0
- data/test/core_extensions/test_range.rb +28 -0
- data/test/helper.rb +30 -0
- data/test/mappings/test_bonjour.rb +79 -0
- data/test/mappings/test_color.rb +16 -0
- data/test/mappings/test_font.rb +21 -0
- data/test/mappings/test_tracking_area.rb +18 -0
- data/test/test_application_builder.rb +95 -0
- data/test/test_attributed_string_helpers.rb +63 -0
- data/test/test_behaviours.rb +26 -0
- data/test/test_bin.rb +75 -0
- data/test/test_mapper.rb +100 -0
- data/test/test_mapping_methods.rb +67 -0
- data/test/test_mappings.rb +68 -0
- data/test/test_notification_listener.rb +19 -0
- data/test/test_template.rb +65 -0
- metadata +217 -90
- data/lib/hotcocoa/attributed_string.rb +0 -143
- data/lib/hotcocoa/kernel_ext.rb +0 -14
- data/lib/hotcocoa/mappings/alert.rb +0 -25
- data/lib/hotcocoa/mappings/application.rb +0 -112
- data/lib/hotcocoa/mappings/box.rb +0 -39
- data/lib/hotcocoa/mappings/button.rb +0 -92
- data/lib/hotcocoa/mappings/collection_view.rb +0 -44
- data/lib/hotcocoa/mappings/color.rb +0 -28
- data/lib/hotcocoa/mappings/column.rb +0 -21
- data/lib/hotcocoa/mappings/combo_box.rb +0 -24
- data/lib/hotcocoa/mappings/control.rb +0 -33
- data/lib/hotcocoa/mappings/font.rb +0 -44
- data/lib/hotcocoa/mappings/gradient.rb +0 -15
- data/lib/hotcocoa/mappings/image.rb +0 -15
- data/lib/hotcocoa/mappings/image_view.rb +0 -43
- data/lib/hotcocoa/mappings/label.rb +0 -25
- data/lib/hotcocoa/mappings/layout_view.rb +0 -9
- data/lib/hotcocoa/mappings/menu.rb +0 -71
- data/lib/hotcocoa/mappings/menu_item.rb +0 -47
- data/lib/hotcocoa/mappings/movie.rb +0 -13
- data/lib/hotcocoa/mappings/movie_view.rb +0 -27
- data/lib/hotcocoa/mappings/notification.rb +0 -17
- data/lib/hotcocoa/mappings/popup.rb +0 -110
- data/lib/hotcocoa/mappings/progress_indicator.rb +0 -68
- data/lib/hotcocoa/mappings/scroll_view.rb +0 -29
- data/lib/hotcocoa/mappings/search_field.rb +0 -9
- data/lib/hotcocoa/mappings/secure_text_field.rb +0 -17
- data/lib/hotcocoa/mappings/segmented_control.rb +0 -97
- data/lib/hotcocoa/mappings/slider.rb +0 -25
- data/lib/hotcocoa/mappings/sort_descriptor.rb +0 -13
- data/lib/hotcocoa/mappings/sound.rb +0 -9
- data/lib/hotcocoa/mappings/speech_synthesizer.rb +0 -25
- data/lib/hotcocoa/mappings/split_view.rb +0 -21
- data/lib/hotcocoa/mappings/status_bar.rb +0 -7
- data/lib/hotcocoa/mappings/status_item.rb +0 -9
- data/lib/hotcocoa/mappings/table_view.rb +0 -110
- data/lib/hotcocoa/mappings/text_field.rb +0 -41
- data/lib/hotcocoa/mappings/text_view.rb +0 -13
- data/lib/hotcocoa/mappings/timer.rb +0 -25
- data/lib/hotcocoa/mappings/toolbar.rb +0 -100
- data/lib/hotcocoa/mappings/toolbar_item.rb +0 -36
- data/lib/hotcocoa/mappings/view.rb +0 -67
- data/lib/hotcocoa/mappings/web_view.rb +0 -22
- data/lib/hotcocoa/mappings/window.rb +0 -118
- data/lib/hotcocoa/mappings/xml_parser.rb +0 -41
- data/lib/hotcocoa/object_ext.rb +0 -22
- data/lib/hotcocoa/plist.rb +0 -45
- data/template/config/build.yml +0 -8
- data/test/test_helper.rb +0 -3
- data/test/test_hotcocoa.rb +0 -11
@@ -0,0 +1,68 @@
|
|
1
|
+
# Originally imported from the MacRuby sources
|
2
|
+
|
3
|
+
|
4
|
+
class TestMappings < MiniTest::Unit::TestCase
|
5
|
+
include HotCocoa
|
6
|
+
|
7
|
+
def test_keeps_a_cache_of_mappers_for_mappings
|
8
|
+
assert_instance_of Hash, Mappings.mappings
|
9
|
+
assert_instance_of Symbol, Mappings.mappings.keys.sample
|
10
|
+
assert_instance_of Mappings::Mapper, Mappings.mappings.values.sample
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_map_reload_loads_all_mappings
|
14
|
+
file = File.join(SOURCE_ROOT, 'lib/hotcocoa/mappings/appkit/test_mapping.rb')
|
15
|
+
File.open(file,'w') { |f| f.puts 'class MyReloadingTestClass; end' }
|
16
|
+
|
17
|
+
HotCocoa::Mappings.reload
|
18
|
+
assert defined?(:MyReloadingTestClass), 'mappings not loaded'
|
19
|
+
ensure
|
20
|
+
FileUtils.rm file
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_map_loads_framework_on_demand
|
24
|
+
dir = File.join(SOURCE_ROOT, 'lib/hotcocoa/mappings/opencl')
|
25
|
+
FileUtils.mkdir dir # this will fail if it already exists, which is a good safety
|
26
|
+
|
27
|
+
file = File.join(dir, 'crazy_mapping.rb')
|
28
|
+
File.open(file,'w') { |f| f.puts 'class MyLazyLoadingTestClass; end' }
|
29
|
+
framework 'OpenCL'
|
30
|
+
|
31
|
+
FileUtils.rm_rf dir
|
32
|
+
|
33
|
+
assert defined?(:MyLazyLoadingTestClass), 'mappings not loaded'
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
class TestMappingsMappings < MiniTest::Unit::TestCase
|
40
|
+
include HotCocoa
|
41
|
+
|
42
|
+
def teardown
|
43
|
+
Mappings.mappings.delete :klass
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_caches_a_mapper_with_given_arguments_to_map
|
47
|
+
Mappings.map(klass: SampleClass) { }
|
48
|
+
assert_equal SampleClass, Mappings.mappings[:klass].control_class
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_registers_the_first_key_in_the_options_given_to_map_as_the_builder_method
|
52
|
+
Mappings.map(klass: SampleClass) { }
|
53
|
+
assert_equal Mappings.mappings[:klass].builder_method, :klass
|
54
|
+
|
55
|
+
Mappings.map(klass: SampleClass, other_key: 'value') { }
|
56
|
+
assert_equal Mappings.mappings[:klass].builder_method, :klass
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_uses_the_block_given_to_map_as_the_control_module_body
|
60
|
+
Mappings.map(klass: SampleClass) do
|
61
|
+
def a_control_module_instance_method; end
|
62
|
+
end
|
63
|
+
|
64
|
+
assert_includes Mappings.mappings[:klass].control_module.
|
65
|
+
instance_methods, :a_control_module_instance_method
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'hotcocoa/template'
|
3
|
+
|
4
|
+
|
5
|
+
# feels weird to have a test class with only one test...
|
6
|
+
class TestHotCocoaTemplateDir < MiniTest::Unit::TestCase
|
7
|
+
|
8
|
+
# important due to differences in compiled code
|
9
|
+
def test_template_directory_is_correct
|
10
|
+
what_git_thinks = File.join(SOURCE_ROOT, 'template')
|
11
|
+
what_hotcocoa_thinks = HotCocoa::Template.template_directory
|
12
|
+
assert_equal what_git_thinks, what_hotcocoa_thinks
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
class TestHotCocoaTemplateMaker < MiniTest::Unit::TestCase
|
19
|
+
|
20
|
+
def setup
|
21
|
+
@dir = File.join(ENV['TMPDIR'], 'template_test')
|
22
|
+
@template = HotCocoa::Template.new @dir, app_name
|
23
|
+
@template.copy!
|
24
|
+
end
|
25
|
+
|
26
|
+
def teardown
|
27
|
+
FileUtils.rm_rf @dir
|
28
|
+
end
|
29
|
+
|
30
|
+
def app_name
|
31
|
+
'AWESOME SAUCE'
|
32
|
+
end
|
33
|
+
|
34
|
+
def all_files_in dir
|
35
|
+
Dir.glob(File.join(dir, '**/*'))
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_uses_app_name_for_appspec_file
|
39
|
+
assert File.exists? File.join(@dir,"#{app_name}.appspec")
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_copy_to_substitutes_app_name_properly
|
43
|
+
content = ''
|
44
|
+
all_files_in(@dir).each do |file|
|
45
|
+
next if File.extname(file) == '.icns'
|
46
|
+
next if File.directory? file
|
47
|
+
content << IO.read(file)
|
48
|
+
end
|
49
|
+
refute_match /__APPLICATION_NAME__/, content
|
50
|
+
# this is a weak assertion, what can we do to make it stronger?
|
51
|
+
assert_match /#{app_name}/, content
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_copy_to_copies_everything
|
55
|
+
template = all_files_in(File.join(SOURCE_ROOT, 'template'))
|
56
|
+
template.map! { |file| file.sub /^#{File.join(SOURCE_ROOT, 'template')}/, '' }
|
57
|
+
|
58
|
+
copy = all_files_in(@dir)
|
59
|
+
copy.map! { |file| file.sub @dir, '' }
|
60
|
+
copy.reject! { |file| file.match /appspec/ } # appspec is a special case
|
61
|
+
|
62
|
+
assert_empty copy - template
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
metadata
CHANGED
@@ -1,32 +1,105 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: hotcocoa
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: 5
|
5
|
+
version: 0.6.0pre
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Richard Kilmer
|
9
|
+
- Mark Rada
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
date: 2011-10-04 00:00:00 -04:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: minitest
|
18
|
+
prerelease: false
|
19
|
+
requirement: !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "2.5"
|
25
|
+
type: :development
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ~>
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: "2.5"
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: yard
|
34
|
+
prerelease: false
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.7.2
|
41
|
+
type: :development
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.7.2
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: redcarpet
|
50
|
+
prerelease: false
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "1.17"
|
57
|
+
type: :development
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ~>
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "1.17"
|
64
|
+
description: HotCocoa is a Cocoa mapping library for MacRuby. It simplifies the use
|
65
|
+
of complex Cocoa classes using DSL techniques.
|
66
|
+
email:
|
67
|
+
- rich@infoether.com
|
68
|
+
- mrada@marketcircle.com
|
69
|
+
executables:
|
19
70
|
- hotcocoa
|
20
71
|
extensions: []
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
72
|
+
extra_rdoc_files:
|
73
|
+
- README.markdown
|
74
|
+
- History.txt
|
75
|
+
- docs/Contributors.markdown
|
76
|
+
- docs/Mappings.markdown
|
77
|
+
- docs/MappingsExplained.markdown
|
78
|
+
- docs/Overview.markdown
|
79
|
+
- docs/Resources.markdown
|
80
|
+
- docs/Tutorial.markdown
|
81
|
+
files:
|
82
|
+
- Rakefile
|
83
|
+
- .yardopts
|
84
|
+
- bin/hotcocoa
|
85
|
+
- lib/hotcocoa/application/builder.rb
|
86
|
+
- lib/hotcocoa/application/specification.rb
|
25
87
|
- lib/hotcocoa/application_builder.rb
|
26
|
-
- lib/hotcocoa/
|
88
|
+
- lib/hotcocoa/attributed_string_helpers.rb
|
27
89
|
- lib/hotcocoa/behaviors.rb
|
90
|
+
- lib/hotcocoa/core_extensions/kernel.rb
|
91
|
+
- lib/hotcocoa/core_extensions/nsarray.rb
|
92
|
+
- lib/hotcocoa/core_extensions/nsmutable_attributed_string.rb
|
93
|
+
- lib/hotcocoa/core_extensions/nsstring.rb
|
94
|
+
- lib/hotcocoa/core_extensions/nsurl.rb
|
95
|
+
- lib/hotcocoa/core_extensions/numeric.rb
|
96
|
+
- lib/hotcocoa/core_extensions/object.rb
|
97
|
+
- lib/hotcocoa/core_extensions/range.rb
|
98
|
+
- lib/hotcocoa/core_extensions.rb
|
28
99
|
- lib/hotcocoa/data_sources/combo_box_data_source.rb
|
100
|
+
- lib/hotcocoa/data_sources/outline_view_data_source.rb
|
29
101
|
- lib/hotcocoa/data_sources/table_data_source.rb
|
102
|
+
- lib/hotcocoa/data_sources.rb
|
30
103
|
- lib/hotcocoa/delegate_builder.rb
|
31
104
|
- lib/hotcocoa/graphics/canvas.rb
|
32
105
|
- lib/hotcocoa/graphics/color.rb
|
@@ -38,99 +111,153 @@ files:
|
|
38
111
|
- lib/hotcocoa/graphics/path.rb
|
39
112
|
- lib/hotcocoa/graphics/pdf.rb
|
40
113
|
- lib/hotcocoa/graphics.rb
|
41
|
-
- lib/hotcocoa/kernel_ext.rb
|
42
114
|
- lib/hotcocoa/kvo_accessors.rb
|
43
115
|
- lib/hotcocoa/layout_view.rb
|
44
116
|
- lib/hotcocoa/mapper.rb
|
45
117
|
- lib/hotcocoa/mapping_methods.rb
|
46
|
-
- lib/hotcocoa/mappings/alert.rb
|
47
|
-
- lib/hotcocoa/mappings/application.rb
|
48
|
-
- lib/hotcocoa/mappings/array_controller.rb
|
49
|
-
- lib/hotcocoa/mappings/box.rb
|
50
|
-
- lib/hotcocoa/mappings/button.rb
|
51
|
-
- lib/hotcocoa/mappings/collection_view.rb
|
52
|
-
- lib/hotcocoa/mappings/color.rb
|
53
|
-
- lib/hotcocoa/mappings/column.rb
|
54
|
-
- lib/hotcocoa/mappings/combo_box.rb
|
55
|
-
- lib/hotcocoa/mappings/control.rb
|
56
|
-
- lib/hotcocoa/mappings/font.rb
|
57
|
-
- lib/hotcocoa/mappings/gradient.rb
|
58
|
-
- lib/hotcocoa/mappings/image.rb
|
59
|
-
- lib/hotcocoa/mappings/image_view.rb
|
60
|
-
- lib/hotcocoa/mappings/label.rb
|
61
|
-
- lib/hotcocoa/mappings/layout_view.rb
|
62
|
-
- lib/hotcocoa/mappings/
|
63
|
-
- lib/hotcocoa/mappings/
|
64
|
-
- lib/hotcocoa/mappings/
|
65
|
-
- lib/hotcocoa/mappings/
|
66
|
-
- lib/hotcocoa/mappings/
|
67
|
-
- lib/hotcocoa/mappings/
|
68
|
-
- lib/hotcocoa/mappings/
|
69
|
-
- lib/hotcocoa/mappings/
|
70
|
-
- lib/hotcocoa/mappings/
|
71
|
-
- lib/hotcocoa/mappings/
|
72
|
-
- lib/hotcocoa/mappings/
|
73
|
-
- lib/hotcocoa/mappings/
|
74
|
-
- lib/hotcocoa/mappings/
|
75
|
-
- lib/hotcocoa/mappings/
|
76
|
-
- lib/hotcocoa/mappings/
|
77
|
-
- lib/hotcocoa/mappings/
|
78
|
-
- lib/hotcocoa/mappings/
|
79
|
-
- lib/hotcocoa/mappings/
|
80
|
-
- lib/hotcocoa/mappings/
|
81
|
-
- lib/hotcocoa/mappings/
|
82
|
-
- lib/hotcocoa/mappings/
|
83
|
-
- lib/hotcocoa/mappings/
|
84
|
-
- lib/hotcocoa/mappings/
|
85
|
-
- lib/hotcocoa/mappings/
|
86
|
-
- lib/hotcocoa/mappings/
|
87
|
-
- lib/hotcocoa/mappings/
|
88
|
-
- lib/hotcocoa/mappings/
|
89
|
-
- lib/hotcocoa/mappings/
|
118
|
+
- lib/hotcocoa/mappings/appkit/alert.rb
|
119
|
+
- lib/hotcocoa/mappings/appkit/application.rb
|
120
|
+
- lib/hotcocoa/mappings/appkit/array_controller.rb
|
121
|
+
- lib/hotcocoa/mappings/appkit/box.rb
|
122
|
+
- lib/hotcocoa/mappings/appkit/button.rb
|
123
|
+
- lib/hotcocoa/mappings/appkit/collection_view.rb
|
124
|
+
- lib/hotcocoa/mappings/appkit/color.rb
|
125
|
+
- lib/hotcocoa/mappings/appkit/column.rb
|
126
|
+
- lib/hotcocoa/mappings/appkit/combo_box.rb
|
127
|
+
- lib/hotcocoa/mappings/appkit/control.rb
|
128
|
+
- lib/hotcocoa/mappings/appkit/font.rb
|
129
|
+
- lib/hotcocoa/mappings/appkit/gradient.rb
|
130
|
+
- lib/hotcocoa/mappings/appkit/image.rb
|
131
|
+
- lib/hotcocoa/mappings/appkit/image_view.rb
|
132
|
+
- lib/hotcocoa/mappings/appkit/label.rb
|
133
|
+
- lib/hotcocoa/mappings/appkit/layout_view.rb
|
134
|
+
- lib/hotcocoa/mappings/appkit/line.rb
|
135
|
+
- lib/hotcocoa/mappings/appkit/menu.rb
|
136
|
+
- lib/hotcocoa/mappings/appkit/menu_item.rb
|
137
|
+
- lib/hotcocoa/mappings/appkit/outline_view.rb
|
138
|
+
- lib/hotcocoa/mappings/appkit/popup.rb
|
139
|
+
- lib/hotcocoa/mappings/appkit/progress_indicator.rb
|
140
|
+
- lib/hotcocoa/mappings/appkit/scroll_view.rb
|
141
|
+
- lib/hotcocoa/mappings/appkit/search_field.rb
|
142
|
+
- lib/hotcocoa/mappings/appkit/secure_text_field.rb
|
143
|
+
- lib/hotcocoa/mappings/appkit/segmented_control.rb
|
144
|
+
- lib/hotcocoa/mappings/appkit/slider.rb
|
145
|
+
- lib/hotcocoa/mappings/appkit/sound.rb
|
146
|
+
- lib/hotcocoa/mappings/appkit/speech_synthesizer.rb
|
147
|
+
- lib/hotcocoa/mappings/appkit/split_view.rb
|
148
|
+
- lib/hotcocoa/mappings/appkit/status_bar.rb
|
149
|
+
- lib/hotcocoa/mappings/appkit/status_item.rb
|
150
|
+
- lib/hotcocoa/mappings/appkit/table_view.rb
|
151
|
+
- lib/hotcocoa/mappings/appkit/text_field.rb
|
152
|
+
- lib/hotcocoa/mappings/appkit/text_view.rb
|
153
|
+
- lib/hotcocoa/mappings/appkit/toolbar.rb
|
154
|
+
- lib/hotcocoa/mappings/appkit/toolbar_item.rb
|
155
|
+
- lib/hotcocoa/mappings/appkit/tracking_area.rb
|
156
|
+
- lib/hotcocoa/mappings/appkit/view.rb
|
157
|
+
- lib/hotcocoa/mappings/appkit/window.rb
|
158
|
+
- lib/hotcocoa/mappings/foundation/net_service.rb
|
159
|
+
- lib/hotcocoa/mappings/foundation/net_service_browser.rb
|
160
|
+
- lib/hotcocoa/mappings/foundation/notification.rb
|
161
|
+
- lib/hotcocoa/mappings/foundation/sort_descriptor.rb
|
162
|
+
- lib/hotcocoa/mappings/foundation/timer.rb
|
163
|
+
- lib/hotcocoa/mappings/foundation/user_defaults.rb
|
164
|
+
- lib/hotcocoa/mappings/foundation/xml_parser.rb
|
165
|
+
- lib/hotcocoa/mappings/qtkit/movie.rb
|
166
|
+
- lib/hotcocoa/mappings/qtkit/movie_view.rb
|
167
|
+
- lib/hotcocoa/mappings/webkit/web_view.rb
|
90
168
|
- lib/hotcocoa/mappings.rb
|
91
169
|
- lib/hotcocoa/mvc.rb
|
92
170
|
- lib/hotcocoa/notification_listener.rb
|
93
|
-
- lib/hotcocoa/object_ext.rb
|
94
|
-
- lib/hotcocoa/plist.rb
|
95
171
|
- lib/hotcocoa/standard_rake_tasks.rb
|
172
|
+
- lib/hotcocoa/target_action_convenience.rb
|
96
173
|
- lib/hotcocoa/template.rb
|
174
|
+
- lib/hotcocoa/version.rb
|
97
175
|
- lib/hotcocoa.rb
|
98
|
-
- template/
|
176
|
+
- template/__APPLICATION_NAME__.appspec
|
99
177
|
- template/lib/application.rb
|
100
178
|
- template/lib/menu.rb
|
101
179
|
- template/Rakefile
|
102
180
|
- template/resources/HotCocoa.icns
|
103
|
-
- test/
|
104
|
-
- test/
|
105
|
-
-
|
181
|
+
- test/application/test_builder.rb
|
182
|
+
- test/application/test_specification.rb
|
183
|
+
- test/core_extensions/test_kernel.rb
|
184
|
+
- test/core_extensions/test_nsarray.rb
|
185
|
+
- test/core_extensions/test_nsmutable_attributed_string.rb
|
186
|
+
- test/core_extensions/test_nsstring.rb
|
187
|
+
- test/core_extensions/test_nsurl.rb
|
188
|
+
- test/core_extensions/test_numeric.rb
|
189
|
+
- test/core_extensions/test_object.rb
|
190
|
+
- test/core_extensions/test_range.rb
|
191
|
+
- test/helper.rb
|
192
|
+
- test/mappings/test_bonjour.rb
|
193
|
+
- test/mappings/test_color.rb
|
194
|
+
- test/mappings/test_font.rb
|
195
|
+
- test/mappings/test_tracking_area.rb
|
196
|
+
- test/test_application_builder.rb
|
197
|
+
- test/test_attributed_string_helpers.rb
|
198
|
+
- test/test_behaviours.rb
|
199
|
+
- test/test_bin.rb
|
200
|
+
- test/test_mapper.rb
|
201
|
+
- test/test_mapping_methods.rb
|
202
|
+
- test/test_mappings.rb
|
203
|
+
- test/test_notification_listener.rb
|
204
|
+
- test/test_template.rb
|
205
|
+
- README.markdown
|
106
206
|
- History.txt
|
207
|
+
- docs/Contributors.markdown
|
208
|
+
- docs/Mappings.markdown
|
209
|
+
- docs/MappingsExplained.markdown
|
210
|
+
- docs/Overview.markdown
|
211
|
+
- docs/Resources.markdown
|
212
|
+
- docs/Tutorial.markdown
|
107
213
|
has_rdoc: true
|
108
|
-
homepage: http://github.com/
|
109
|
-
licenses:
|
110
|
-
|
214
|
+
homepage: http://github.com/ferrous26/hotcocoa
|
215
|
+
licenses:
|
216
|
+
- MIT
|
111
217
|
post_install_message:
|
112
218
|
rdoc_options: []
|
113
|
-
|
114
|
-
require_paths:
|
219
|
+
require_paths:
|
115
220
|
- lib
|
116
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
version:
|
122
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
-
requirements:
|
124
|
-
- - ">="
|
125
|
-
- !ruby/object:Gem::Version
|
221
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
222
|
+
none: false
|
223
|
+
requirements:
|
224
|
+
- - '>='
|
225
|
+
- !ruby/object:Gem::Version
|
126
226
|
version: "0"
|
127
|
-
|
227
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
|
+
none: false
|
229
|
+
requirements:
|
230
|
+
- - '>'
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: 1.3.1
|
128
233
|
requirements: []
|
129
|
-
|
130
|
-
|
131
|
-
rubygems_version: 1.3.5
|
234
|
+
rubyforge_project:
|
235
|
+
rubygems_version: 1.4.2
|
132
236
|
signing_key:
|
133
237
|
specification_version: 3
|
134
|
-
summary:
|
135
|
-
test_files:
|
136
|
-
|
238
|
+
summary: Cocoa mapping library for MacRuby
|
239
|
+
test_files:
|
240
|
+
- test/application/test_builder.rb
|
241
|
+
- test/application/test_specification.rb
|
242
|
+
- test/core_extensions/test_kernel.rb
|
243
|
+
- test/core_extensions/test_nsarray.rb
|
244
|
+
- test/core_extensions/test_nsmutable_attributed_string.rb
|
245
|
+
- test/core_extensions/test_nsstring.rb
|
246
|
+
- test/core_extensions/test_nsurl.rb
|
247
|
+
- test/core_extensions/test_numeric.rb
|
248
|
+
- test/core_extensions/test_object.rb
|
249
|
+
- test/core_extensions/test_range.rb
|
250
|
+
- test/helper.rb
|
251
|
+
- test/mappings/test_bonjour.rb
|
252
|
+
- test/mappings/test_color.rb
|
253
|
+
- test/mappings/test_font.rb
|
254
|
+
- test/mappings/test_tracking_area.rb
|
255
|
+
- test/test_application_builder.rb
|
256
|
+
- test/test_attributed_string_helpers.rb
|
257
|
+
- test/test_behaviours.rb
|
258
|
+
- test/test_bin.rb
|
259
|
+
- test/test_mapper.rb
|
260
|
+
- test/test_mapping_methods.rb
|
261
|
+
- test/test_mappings.rb
|
262
|
+
- test/test_notification_listener.rb
|
263
|
+
- test/test_template.rb
|
@@ -1,143 +0,0 @@
|
|
1
|
-
module HotCocoa
|
2
|
-
class NSRangedProxyAttributeHash
|
3
|
-
ATTRIBUTE_KEYS = { :font => NSFontAttributeName,
|
4
|
-
:paragraph_style => NSParagraphStyleAttributeName,
|
5
|
-
:color => NSForegroundColorAttributeName,
|
6
|
-
:underline_style => NSUnderlineStyleAttributeName,
|
7
|
-
:superscript => NSSuperscriptAttributeName,
|
8
|
-
:background_color => NSBackgroundColorAttributeName,
|
9
|
-
:attachment => NSAttachmentAttributeName,
|
10
|
-
:ligature => NSLigatureAttributeName,
|
11
|
-
:baseline_offset => NSBaselineOffsetAttributeName,
|
12
|
-
:kerning => NSKernAttributeName,
|
13
|
-
:link => NSLinkAttributeName,
|
14
|
-
:stroke_width => NSStrokeWidthAttributeName,
|
15
|
-
:stroke_color => NSStrokeColorAttributeName,
|
16
|
-
:underline_color => NSUnderlineColorAttributeName,
|
17
|
-
:strikethrough_style => NSStrikethroughStyleAttributeName,
|
18
|
-
:strikethrough_color => NSStrikethroughColorAttributeName,
|
19
|
-
:shadow => NSShadowAttributeName,
|
20
|
-
:obliqueness => NSObliquenessAttributeName,
|
21
|
-
:expansion_factor => NSExpansionAttributeName,
|
22
|
-
:cursor => NSCursorAttributeName,
|
23
|
-
:tool_tip => NSToolTipAttributeName,
|
24
|
-
:character_shape => NSCharacterShapeAttributeName,
|
25
|
-
:glyph_info => NSGlyphInfoAttributeName,
|
26
|
-
:marked_clause_segment => NSMarkedClauseSegmentAttributeName,
|
27
|
-
:spelling_state => NSSpellingStateAttributeName }
|
28
|
-
|
29
|
-
|
30
|
-
def initialize(proxy)
|
31
|
-
@proxy = proxy
|
32
|
-
end
|
33
|
-
|
34
|
-
def [](k)
|
35
|
-
k = attribute_for_key(k)
|
36
|
-
@proxy.string.attribute(k, atIndex:@proxy.range.first, effectiveRange:nil)
|
37
|
-
end
|
38
|
-
|
39
|
-
def []=(k,v)
|
40
|
-
k = attribute_for_key(k)
|
41
|
-
@proxy.string.removeAttribute(k, range:@proxy.range.to_NSRange(@proxy.string.length - 1))
|
42
|
-
@proxy.string.addAttribute(k, value:v, range:@proxy.range.to_NSRange(@proxy.string.length - 1))
|
43
|
-
end
|
44
|
-
|
45
|
-
def <<(attributes)
|
46
|
-
attributes.each_pair do |k, v|
|
47
|
-
self[k] = v
|
48
|
-
end
|
49
|
-
self
|
50
|
-
end
|
51
|
-
alias :merge :<<
|
52
|
-
|
53
|
-
def to_hash
|
54
|
-
@proxy.string.attributesAtIndex(@proxy.range.first, effectiveRange:nil).inject({}) do |h, pair|
|
55
|
-
h[key_for_attribute(pair.first)] = pair.last
|
56
|
-
h
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def inspect
|
61
|
-
to_hash.inspect
|
62
|
-
end
|
63
|
-
|
64
|
-
private
|
65
|
-
def key_for_attribute(attribute)
|
66
|
-
(ATTRIBUTE_KEYS.select { |k,v| v == attribute }.first || [attribute]).first
|
67
|
-
end
|
68
|
-
|
69
|
-
def attribute_for_key(key)
|
70
|
-
ATTRIBUTE_KEYS[key] || key
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
class NSRangedProxyAttributedString
|
75
|
-
attr_reader :string, :range
|
76
|
-
def initialize(string, range)
|
77
|
-
@string = string
|
78
|
-
@range = range
|
79
|
-
end
|
80
|
-
|
81
|
-
def attributes
|
82
|
-
NSRangedProxyAttributeHash.new(self)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
class String
|
88
|
-
def with_attributes(attributes = {})
|
89
|
-
attributed_string = NSMutableAttributedString.alloc.initWithString(self)
|
90
|
-
attributed_string.attributes << attributes
|
91
|
-
attributed_string
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
class Range
|
96
|
-
def to_NSRange(max = nil)
|
97
|
-
location = first
|
98
|
-
if last == -1 and max
|
99
|
-
length = max - first + 1
|
100
|
-
else
|
101
|
-
length = last - first + 1
|
102
|
-
end
|
103
|
-
NSRange.new(location, length)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
class NSMutableAttributedString
|
108
|
-
def with_attributes(attributes = {})
|
109
|
-
string.with_attributes(attributes)
|
110
|
-
end
|
111
|
-
|
112
|
-
def <<(s)
|
113
|
-
case s
|
114
|
-
when String
|
115
|
-
mutableString.appendString s
|
116
|
-
else
|
117
|
-
appendAttributedString s
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
def +(s)
|
122
|
-
attributed_string = mutableCopy
|
123
|
-
attributed_string << s
|
124
|
-
attributed_string
|
125
|
-
end
|
126
|
-
|
127
|
-
def attributes
|
128
|
-
HotCocoa::NSRangedProxyAttributedString.new(self, 0..-1).attributes
|
129
|
-
end
|
130
|
-
|
131
|
-
def [](r)
|
132
|
-
HotCocoa::NSRangedProxyAttributedString.new(self, r)
|
133
|
-
end
|
134
|
-
|
135
|
-
def []=(r, s)
|
136
|
-
case s
|
137
|
-
when String
|
138
|
-
replaceCharactersInRange(r.to_NSRange(length - 1), :withString => s)
|
139
|
-
else
|
140
|
-
replaceCharactersInRange(r.to_NSRange(length - 1), :withAttributedString => s)
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
data/lib/hotcocoa/kernel_ext.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
HotCocoa::Mappings.map :alert => :NSAlert do
|
2
|
-
|
3
|
-
defaults :default => "OK", :alternate => nil, :other => nil, :info => "", :show => true
|
4
|
-
|
5
|
-
def alloc_with_options(options)
|
6
|
-
if options[:message]
|
7
|
-
alert = NSAlert.alertWithMessageText options.delete(:message),
|
8
|
-
defaultButton:options.delete(:default),
|
9
|
-
alternateButton:options.delete(:alternate),
|
10
|
-
otherButton:options.delete(:other),
|
11
|
-
informativeTextWithFormat:options.delete(:info)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
custom_methods do
|
16
|
-
|
17
|
-
def show
|
18
|
-
runModal
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
delegating "alertShowHelp:", :to => :show_help?
|
24
|
-
|
25
|
-
end
|