pimento 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/.gitignore +3 -0
  2. data/{spec/spec.opts → .rspec} +0 -0
  3. data/Gemfile +4 -0
  4. data/README.rdoc +6 -5
  5. data/Rakefile +6 -41
  6. data/examples/banner.rb +74 -0
  7. data/lib/pimento.rb +4 -2
  8. data/lib/pimento/canvas.rb +55 -13
  9. data/lib/pimento/component.rb +69 -0
  10. data/lib/pimento/component/bevel_button.rb +5 -0
  11. data/lib/pimento/component/check_box.rb +5 -0
  12. data/lib/pimento/component/circular_progress_indicator.rb +7 -0
  13. data/lib/pimento/component/disclosure_button.rb +5 -0
  14. data/lib/pimento/component/disclosure_triangle.rb +5 -0
  15. data/lib/pimento/component/help_button.rb +5 -0
  16. data/lib/pimento/component/horizontal_slider.rb +5 -0
  17. data/lib/pimento/component/popup_button.rb +5 -0
  18. data/lib/pimento/component/progress_indicator.rb +7 -0
  19. data/lib/pimento/component/round_button.rb +5 -0
  20. data/lib/pimento/component/rounded_rect_button.rb +5 -0
  21. data/lib/pimento/component/search_field.rb +5 -0
  22. data/lib/pimento/component/vertical_slider.rb +5 -0
  23. data/lib/pimento/renderable.rb +8 -0
  24. data/lib/pimento/util.rb +11 -0
  25. data/pimento.gemspec +17 -59
  26. data/spec/fixtures/1dot.xib +207 -222
  27. data/spec/fixtures/empty.xib +164 -174
  28. data/spec/pimento_spec.rb +2 -0
  29. data/spec/spec_helper.rb +7 -4
  30. data/template/bevel_button_ro.xml.erb +24 -0
  31. data/template/{canvas.xib.erb → canvas.xml.erb} +15 -52
  32. data/template/check_box_ro.xml.erb +31 -0
  33. data/template/circular_progress_indicator_ro.xml.erb +10 -0
  34. data/template/disclosure_button_ro.xml.erb +44 -0
  35. data/template/disclosure_triangle_ro.xml.erb +24 -0
  36. data/template/help_button_ro.xml.erb +24 -0
  37. data/template/horizontal_slider_ro.xml.erb +27 -0
  38. data/template/or_1.xml.erb +5 -0
  39. data/template/or_2.xml.erb +14 -0
  40. data/template/popup_button_ro.xml.erb +23 -0
  41. data/template/progress_indicator_ro.xml.erb +10 -0
  42. data/template/round_button_ro.xml.erb +24 -0
  43. data/template/rounded_rect_button_ro.xml.erb +24 -0
  44. data/template/search_field_ro.xml.erb +39 -0
  45. data/template/vertical_slider_ro.xml.erb +26 -0
  46. metadata +98 -69
  47. data/.document +0 -5
  48. data/examples/hello.rb +0 -32
  49. data/lib/pimento/dot.rb +0 -12
@@ -1,177 +1,167 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
3
- <data>
4
- <int key="IBDocument.SystemTarget">1050</int>
5
- <string key="IBDocument.SystemVersion">9L30</string>
6
- <string key="IBDocument.InterfaceBuilderVersion">677</string>
7
- <string key="IBDocument.AppKitVersion">949.54</string>
8
- <string key="IBDocument.HIToolboxVersion">353.00</string>
9
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
10
- <bool key="EncodedWithXMLCoder">YES</bool>
11
-
12
- <integer value="1" id="9"/>
13
-
14
- </object>
15
- <object class="NSArray" key="IBDocument.PluginDependencies">
16
- <bool key="EncodedWithXMLCoder">YES</bool>
17
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
18
- </object>
19
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
20
- <bool key="EncodedWithXMLCoder">YES</bool>
21
- <object class="NSArray" key="dict.sortedKeys">
22
- <bool key="EncodedWithXMLCoder">YES</bool>
23
- </object>
24
- <object class="NSMutableArray" key="dict.values">
25
- <bool key="EncodedWithXMLCoder">YES</bool>
26
- </object>
27
- </object>
28
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
29
- <bool key="EncodedWithXMLCoder">YES</bool>
30
- <object class="NSCustomObject" id="1001">
31
- <string key="NSClassName">NSObject</string>
32
- </object>
33
- <object class="NSCustomObject" id="1003">
34
- <string key="NSClassName">FirstResponder</string>
35
- </object>
36
- <object class="NSCustomObject" id="1004">
37
- <string key="NSClassName">NSApplication</string>
38
- </object>
39
- <object class="NSWindowTemplate" id="1005">
40
- <int key="NSWindowStyleMask">15</int>
41
- <int key="NSWindowBacking">2</int>
42
- <string key="NSWindowRect">{{120, 240}, {100, 200}}</string>
43
- <int key="NSWTFlags">536870912</int>
44
- <string key="NSWindowTitle">Window</string>
45
- <string key="NSWindowClass">NSWindow</string>
46
- <nil key="NSViewClass"/>
47
- <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
48
- <object class="NSView" key="NSWindowView" id="1006">
49
- <reference key="NSNextResponder"/>
50
- <int key="NSvFlags">256</int>
51
- <object class="NSMutableArray" key="NSSubviews">
52
- <bool key="EncodedWithXMLCoder">YES</bool>
53
-
54
- </object>
55
- <string key="NSFrameSize">{100, 200}</string>
56
- <reference key="NSSuperview"/>
57
- </object>
58
- <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
59
- <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
60
- </object>
61
- </object>
62
- <object class="IBObjectContainer" key="IBDocument.Objects">
63
- <object class="NSMutableArray" key="connectionRecords">
64
- <bool key="EncodedWithXMLCoder">YES</bool>
65
- </object>
66
- <object class="IBMutableOrderedSet" key="objectRecords">
67
- <object class="NSArray" key="orderedObjects">
68
- <bool key="EncodedWithXMLCoder">YES</bool>
69
- <object class="IBObjectRecord">
70
- <int key="objectID">0</int>
71
- <object class="NSArray" key="object" id="1002">
72
- <bool key="EncodedWithXMLCoder">YES</bool>
73
- </object>
74
- <reference key="children" ref="1000"/>
75
- <nil key="parent"/>
76
- </object>
77
- <object class="IBObjectRecord">
78
- <int key="objectID">-2</int>
79
- <reference key="object" ref="1001"/>
80
- <reference key="parent" ref="1002"/>
81
- <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
82
- </object>
83
- <object class="IBObjectRecord">
84
- <int key="objectID">-1</int>
85
- <reference key="object" ref="1003"/>
86
- <reference key="parent" ref="1002"/>
87
- <string key="objectName">First Responder</string>
88
- </object>
89
- <object class="IBObjectRecord">
90
- <int key="objectID">-3</int>
91
- <reference key="object" ref="1004"/>
92
- <reference key="parent" ref="1002"/>
93
- <string key="objectName">Application</string>
94
- </object>
95
- <object class="IBObjectRecord">
96
- <int key="objectID">1</int>
97
- <reference key="object" ref="1005"/>
98
- <object class="NSMutableArray" key="children">
99
- <bool key="EncodedWithXMLCoder">YES</bool>
100
- <reference ref="1006"/>
101
- </object>
102
- <reference key="parent" ref="1002"/>
103
- </object>
104
- <object class="IBObjectRecord">
105
- <int key="objectID">2</int>
106
- <reference key="object" ref="1006"/>
107
- <object class="NSMutableArray" key="children">
108
- <bool key="EncodedWithXMLCoder">YES</bool>
109
-
110
- </object>
111
- <reference key="parent" ref="1005"/>
112
- </object>
113
-
114
- </object>
115
- </object>
116
- <object class="NSMutableDictionary" key="flattenedProperties">
117
- <bool key="EncodedWithXMLCoder">YES</bool>
118
- <object class="NSMutableArray" key="dict.sortedKeys">
119
- <bool key="EncodedWithXMLCoder">YES</bool>
120
- <string>-1.IBPluginDependency</string>
121
- <string>-2.IBPluginDependency</string>
122
- <string>-3.IBPluginDependency</string>
123
- <string>1.IBEditorWindowLastContentRect</string>
124
- <string>1.IBPluginDependency</string>
125
- <string>1.IBWindowTemplateEditedContentRect</string>
126
- <string>1.NSWindowTemplate.visibleAtLaunch</string>
127
- <string>1.WindowOrigin</string>
128
- <string>1.editorWindowContentRectSynchronizationRect</string>
129
- <string>2.IBPluginDependency</string>
130
-
131
- </object>
132
- <object class="NSMutableArray" key="dict.values">
133
- <bool key="EncodedWithXMLCoder">YES</bool>
134
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
135
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
136
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
137
- <string>{{0, 475}, {100, 200}}</string>
138
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
139
- <string>{{0, 475}, {100, 200}}</string>
140
-
141
-
142
- <reference ref="9"/>
143
-
144
- <string>{120, 240}</string>
145
- <string>{{357, 418}, {100, 200}}</string>
146
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
147
-
148
- </object>
149
- </object>
150
- <object class="NSMutableDictionary" key="unlocalizedProperties">
151
- <bool key="EncodedWithXMLCoder">YES</bool>
152
- <object class="NSArray" key="dict.sortedKeys">
153
- <bool key="EncodedWithXMLCoder">YES</bool>
154
- </object>
155
- <object class="NSMutableArray" key="dict.values">
156
- <bool key="EncodedWithXMLCoder">YES</bool>
157
- </object>
158
- </object>
159
- <nil key="activeLocalization"/>
160
- <object class="NSMutableDictionary" key="localizations">
161
- <bool key="EncodedWithXMLCoder">YES</bool>
162
- <object class="NSArray" key="dict.sortedKeys">
163
- <bool key="EncodedWithXMLCoder">YES</bool>
164
- </object>
165
- <object class="NSMutableArray" key="dict.values">
166
- <bool key="EncodedWithXMLCoder">YES</bool>
167
- </object>
168
- </object>
169
- <nil key="sourceID"/>
170
- <int key="maxID">2</int>
171
- </object>
172
- <object class="IBClassDescriber" key="IBDocument.Classes"/>
173
- <int key="IBDocument.localizationMode">0</int>
174
- <nil key="IBDocument.LastKnownRelativeProjectPath"/>
175
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
176
- </data>
3
+ <data>
4
+ <int key="IBDocument.SystemTarget">1050</int>
5
+ <string key="IBDocument.SystemVersion">9L30</string>
6
+ <string key="IBDocument.InterfaceBuilderVersion">677</string>
7
+ <string key="IBDocument.AppKitVersion">949.54</string>
8
+ <string key="IBDocument.HIToolboxVersion">353.00</string>
9
+ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
10
+ <bool key="EncodedWithXMLCoder">YES</bool>
11
+ <integer value="1" id="9"/>
12
+ </object>
13
+ <object class="NSArray" key="IBDocument.PluginDependencies">
14
+ <bool key="EncodedWithXMLCoder">YES</bool>
15
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
16
+ </object>
17
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
18
+ <bool key="EncodedWithXMLCoder">YES</bool>
19
+ <object class="NSArray" key="dict.sortedKeys">
20
+ <bool key="EncodedWithXMLCoder">YES</bool>
21
+ </object>
22
+ <object class="NSMutableArray" key="dict.values">
23
+ <bool key="EncodedWithXMLCoder">YES</bool>
24
+ </object>
25
+ </object>
26
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
27
+ <bool key="EncodedWithXMLCoder">YES</bool>
28
+ <object class="NSCustomObject" id="1001">
29
+ <string key="NSClassName">NSObject</string>
30
+ </object>
31
+ <object class="NSCustomObject" id="1003">
32
+ <string key="NSClassName">FirstResponder</string>
33
+ </object>
34
+ <object class="NSCustomObject" id="1004">
35
+ <string key="NSClassName">NSApplication</string>
36
+ </object>
37
+ <object class="NSWindowTemplate" id="1005">
38
+ <int key="NSWindowStyleMask">15</int>
39
+ <int key="NSWindowBacking">2</int>
40
+ <string key="NSWindowRect">{{120, 240}, {100, 200}}</string>
41
+ <int key="NSWTFlags">536870912</int>
42
+ <string key="NSWindowTitle">Window</string>
43
+ <string key="NSWindowClass">NSWindow</string>
44
+ <nil key="NSViewClass"/>
45
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
46
+ <object class="NSView" key="NSWindowView" id="1006">
47
+ <reference key="NSNextResponder"/>
48
+ <int key="NSvFlags">256</int>
49
+ <object class="NSMutableArray" key="NSSubviews">
50
+ <bool key="EncodedWithXMLCoder">YES</bool>
51
+ </object>
52
+ <string key="NSFrameSize">{100, 200}</string>
53
+ <reference key="NSSuperview"/>
54
+ </object>
55
+ <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
56
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
57
+ </object>
58
+ </object>
59
+ <object class="IBObjectContainer" key="IBDocument.Objects">
60
+ <object class="NSMutableArray" key="connectionRecords">
61
+ <bool key="EncodedWithXMLCoder">YES</bool>
62
+ </object>
63
+ <object class="IBMutableOrderedSet" key="objectRecords">
64
+ <object class="NSArray" key="orderedObjects">
65
+ <bool key="EncodedWithXMLCoder">YES</bool>
66
+ <object class="IBObjectRecord">
67
+ <int key="objectID">0</int>
68
+ <object class="NSArray" key="object" id="1002">
69
+ <bool key="EncodedWithXMLCoder">YES</bool>
70
+ </object>
71
+ <reference key="children" ref="1000"/>
72
+ <nil key="parent"/>
73
+ </object>
74
+ <object class="IBObjectRecord">
75
+ <int key="objectID">-2</int>
76
+ <reference key="object" ref="1001"/>
77
+ <reference key="parent" ref="1002"/>
78
+ <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
79
+ </object>
80
+ <object class="IBObjectRecord">
81
+ <int key="objectID">-1</int>
82
+ <reference key="object" ref="1003"/>
83
+ <reference key="parent" ref="1002"/>
84
+ <string key="objectName">First Responder</string>
85
+ </object>
86
+ <object class="IBObjectRecord">
87
+ <int key="objectID">-3</int>
88
+ <reference key="object" ref="1004"/>
89
+ <reference key="parent" ref="1002"/>
90
+ <string key="objectName">Application</string>
91
+ </object>
92
+ <object class="IBObjectRecord">
93
+ <int key="objectID">1</int>
94
+ <reference key="object" ref="1005"/>
95
+ <object class="NSMutableArray" key="children">
96
+ <bool key="EncodedWithXMLCoder">YES</bool>
97
+ <reference ref="1006"/>
98
+ </object>
99
+ <reference key="parent" ref="1002"/>
100
+ </object>
101
+ <object class="IBObjectRecord">
102
+ <int key="objectID">2</int>
103
+ <reference key="object" ref="1006"/>
104
+ <object class="NSMutableArray" key="children">
105
+ <bool key="EncodedWithXMLCoder">YES</bool>
106
+ </object>
107
+ <reference key="parent" ref="1005"/>
108
+ </object>
109
+ </object>
110
+ </object>
111
+ <object class="NSMutableDictionary" key="flattenedProperties">
112
+ <bool key="EncodedWithXMLCoder">YES</bool>
113
+ <object class="NSMutableArray" key="dict.sortedKeys">
114
+ <bool key="EncodedWithXMLCoder">YES</bool>
115
+ <string>-1.IBPluginDependency</string>
116
+ <string>-2.IBPluginDependency</string>
117
+ <string>-3.IBPluginDependency</string>
118
+ <string>1.IBEditorWindowLastContentRect</string>
119
+ <string>1.IBPluginDependency</string>
120
+ <string>1.IBWindowTemplateEditedContentRect</string>
121
+ <string>1.NSWindowTemplate.visibleAtLaunch</string>
122
+ <string>1.WindowOrigin</string>
123
+ <string>1.editorWindowContentRectSynchronizationRect</string>
124
+ <string>2.IBPluginDependency</string>
125
+ </object>
126
+ <object class="NSMutableArray" key="dict.values">
127
+ <bool key="EncodedWithXMLCoder">YES</bool>
128
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
129
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
130
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
131
+ <string>{{0, 475}, {100, 200}}</string>
132
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
133
+ <string>{{0, 475}, {100, 200}}</string>
134
+ <reference ref="9"/>
135
+ <string>{120, 240}</string>
136
+ <string>{{357, 418}, {100, 200}}</string>
137
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
138
+ </object>
139
+ </object>
140
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
141
+ <bool key="EncodedWithXMLCoder">YES</bool>
142
+ <object class="NSArray" key="dict.sortedKeys">
143
+ <bool key="EncodedWithXMLCoder">YES</bool>
144
+ </object>
145
+ <object class="NSMutableArray" key="dict.values">
146
+ <bool key="EncodedWithXMLCoder">YES</bool>
147
+ </object>
148
+ </object>
149
+ <nil key="activeLocalization"/>
150
+ <object class="NSMutableDictionary" key="localizations">
151
+ <bool key="EncodedWithXMLCoder">YES</bool>
152
+ <object class="NSArray" key="dict.sortedKeys">
153
+ <bool key="EncodedWithXMLCoder">YES</bool>
154
+ </object>
155
+ <object class="NSMutableArray" key="dict.values">
156
+ <bool key="EncodedWithXMLCoder">YES</bool>
157
+ </object>
158
+ </object>
159
+ <nil key="sourceID"/>
160
+ <int key="maxID">3</int>
161
+ </object>
162
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
163
+ <int key="IBDocument.localizationMode">0</int>
164
+ <nil key="IBDocument.LastKnownRelativeProjectPath"/>
165
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
166
+ </data>
177
167
  </archive>
data/spec/pimento_spec.rb CHANGED
@@ -14,6 +14,8 @@ describe Pimento::Canvas do
14
14
  end
15
15
 
16
16
  it 'should point' do
17
+ Pimento::Component.should_receive(:for).with(:dot).and_return(Pimento::RoundButton)
18
+
17
19
  @canvas.point(15, 25)
18
20
  @canvas.to_xml.to_s.should eql(open(fixture('1dot.xib')).read)
19
21
  end
data/spec/spec_helper.rb CHANGED
@@ -1,10 +1,13 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__))
2
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+
3
+ require 'rubygems'
3
4
  require 'pimento'
4
- require 'spec'
5
- require 'spec/autorun'
6
5
 
7
- Spec::Runner.configure do |config|
6
+ RSpec.configure do |config|
7
+ config.treat_symbols_as_metadata_keys_with_true_values = true
8
+ config.run_all_when_everything_filtered = true
9
+ config.filter_run :focus
10
+
8
11
  def fixture(filename)
9
12
  File.dirname(__FILE__) + '/fixtures/' + filename
10
13
  end
@@ -0,0 +1,24 @@
1
+ <object class="NSButton" id="<%= options[:id_offset] %>">
2
+ <reference key="NSNextResponder" ref="1006"/>
3
+ <int key="NSvFlags">268</int>
4
+ <string key="NSFrame">{{<%= x - 12 %>, <%= @canvas.height - y - height - 10 %>}, {25, <%= height + 20 %>}}</string>
5
+ <reference key="NSSuperview" ref="1006"/>
6
+ <bool key="NSEnabled">YES</bool>
7
+ <object class="NSButtonCell" key="NSCell" id="<%= options[:id_offset] + 1 %>">
8
+ <int key="NSCellFlags">67239424</int>
9
+ <int key="NSCellFlags2">134217728</int>
10
+ <string key="NSContents"/>
11
+ <object class="NSFont" key="NSSupport">
12
+ <string key="NSName">LucidaGrande</string>
13
+ <double key="NSSize">1.000000e+01</double>
14
+ <int key="NSfFlags">16</int>
15
+ </object>
16
+ <reference key="NSControlView" ref="<%= options[:id_offset] %>"/>
17
+ <int key="NSButtonFlags">-2033958657</int>
18
+ <int key="NSButtonFlags2">130</int>
19
+ <string key="NSAlternateContents"/>
20
+ <string key="NSKeyEquivalent"/>
21
+ <int key="NSPeriodicDelay">400</int>
22
+ <int key="NSPeriodicInterval">75</int>
23
+ </object>
24
+ </object>
@@ -8,7 +8,7 @@
8
8
  <string key="IBDocument.HIToolboxVersion">353.00</string>
9
9
  <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
10
10
  <bool key="EncodedWithXMLCoder">YES</bool>
11
- <% if @dots.empty? %>
11
+ <% if @components.empty? %>
12
12
  <integer value="1" id="9"/>
13
13
  <% else %>
14
14
  <integer value="2"/>
@@ -52,32 +52,7 @@
52
52
  <int key="NSvFlags">256</int>
53
53
  <object class="NSMutableArray" key="NSSubviews">
54
54
  <bool key="EncodedWithXMLCoder">YES</bool>
55
- <% @dots.each do |dot| %>
56
- <object class="NSButton" id="<%= dot.id %>">
57
- <reference key="NSNextResponder" ref="1006"/>
58
- <int key="NSvFlags">268</int>
59
- <string key="NSFrame">{{<%= dot.x - 19 %>, <%= @height - dot.y - 19 %>}, {39, 38}}</string>
60
- <reference key="NSSuperview" ref="1006"/>
61
- <bool key="NSEnabled">YES</bool>
62
- <object class="NSButtonCell" key="NSCell" id="<%= dot.cell_id %>">
63
- <int key="NSCellFlags">67239424</int>
64
- <int key="NSCellFlags2">0</int>
65
- <string key="NSContents"/>
66
- <object class="NSFont" key="NSSupport">
67
- <string key="NSName">LucidaGrande</string>
68
- <double key="NSSize">1.000000e+01</double>
69
- <int key="NSfFlags">2843</int>
70
- </object>
71
- <reference key="NSControlView" ref="<%= dot.id %>"/>
72
- <int key="NSButtonFlags">-2037645057</int>
73
- <int key="NSButtonFlags2">135</int>
74
- <string key="NSAlternateContents"/>
75
- <string key="NSKeyEquivalent"/>
76
- <int key="NSPeriodicDelay">200</int>
77
- <int key="NSPeriodicInterval">25</int>
78
- </object>
79
- </object>
80
- <% end %>
55
+ <%= render_objects %>
81
56
  </object>
82
57
  <string key="NSFrameSize">{<%= @width %>, <%= @height %>}</string>
83
58
  <reference key="NSSuperview"/>
@@ -133,28 +108,14 @@
133
108
  <reference key="object" ref="1006"/>
134
109
  <object class="NSMutableArray" key="children">
135
110
  <bool key="EncodedWithXMLCoder">YES</bool>
136
- <% @dots.each do |dot| %>
137
- <reference ref="<%= dot.id %>"/>
111
+ <% index = Pimento::Canvas::FIRST_ID; @components.each do |component| %>
112
+ <reference ref="<%= index %>"/>
113
+ <% index += component.num_objects %>
138
114
  <% end %>
139
115
  </object>
140
116
  <reference key="parent" ref="1005"/>
141
117
  </object>
142
- <% index = 3; @dots.each do |dot| %>
143
- <object class="IBObjectRecord">
144
- <int key="objectID"><%= index += 1 %></int>
145
- <reference key="object" ref="<%= dot.id %>"/>
146
- <object class="NSMutableArray" key="children">
147
- <bool key="EncodedWithXMLCoder">YES</bool>
148
- <reference ref="<%= dot.cell_id %>"/>
149
- </object>
150
- <reference key="parent" ref="1006"/>
151
- </object>
152
- <object class="IBObjectRecord">
153
- <int key="objectID"><%= index += 1 %></int>
154
- <reference key="object" ref="<%= dot.cell_id %>"/>
155
- <reference key="parent" ref="<%= dot.id %>"/>
156
- </object>
157
- <% end %>
118
+ <%= render_object_records %>
158
119
  </object>
159
120
  </object>
160
121
  <object class="NSMutableDictionary" key="flattenedProperties">
@@ -171,9 +132,10 @@
171
132
  <string>1.WindowOrigin</string>
172
133
  <string>1.editorWindowContentRectSynchronizationRect</string>
173
134
  <string>2.IBPluginDependency</string>
174
- <% index = 3; @dots.each do |dot| %>
175
- <string><%= index += 1 %>.IBPluginDependency</string>
176
- <string><%= index += 1 %>.IBPluginDependency</string>
135
+ <% index = Pimento::Canvas::FIRST_OBJ + 1; @components.each do |component| %>
136
+ <% component.num_objects.times do |i| %>
137
+ <string><%= index + i %>.IBPluginDependency</string>
138
+ <% end %>
177
139
  <% end %>
178
140
  </object>
179
141
  <object class="NSMutableArray" key="dict.values">
@@ -185,7 +147,7 @@
185
147
  <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
186
148
  <string>{{0, 475}, {<%= @width %>, <%= @height %>}}</string>
187
149
 
188
- <% if @dots.empty? %>
150
+ <% if @components.empty? %>
189
151
  <reference ref="9"/>
190
152
  <% else %>
191
153
  <integer value="1"/>
@@ -193,9 +155,10 @@
193
155
  <string>{<%= @top %>, <%= @left %>}</string>
194
156
  <string>{{357, 418}, {<%= @width %>, <%= @height %>}}</string>
195
157
  <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
196
- <% @dots.each do |dot| %>
197
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
158
+ <% @components.each do |component| %>
159
+ <% component.num_objects.times do |i| %>
198
160
  <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
161
+ <% end %>
199
162
  <% end %>
200
163
  </object>
201
164
  </object>
@@ -219,7 +182,7 @@
219
182
  </object>
220
183
  </object>
221
184
  <nil key="sourceID"/>
222
- <int key="maxID"><%= (@dots.size * 2) + 2 %></int>
185
+ <int key="maxID"><%= (@components.inject(0) {|memo, component| memo + component.num_objects }) + 3 %></int>
223
186
  </object>
224
187
  <object class="IBClassDescriber" key="IBDocument.Classes"/>
225
188
  <int key="IBDocument.localizationMode">0</int>