sproutcore 1.0.1003 → 1.0.1008

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. data/Buildfile +15 -3
  2. data/Rakefile +3 -7
  3. data/VERSION.yml +2 -2
  4. data/buildtasks/manifest.rake +2 -0
  5. data/frameworks/sproutcore/Buildfile +2 -0
  6. data/frameworks/sproutcore/HISTORY +218 -203
  7. data/frameworks/sproutcore/README +47 -6
  8. data/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +4 -0
  9. data/frameworks/sproutcore/design/Design Charts.graffle +2945 -4332
  10. data/frameworks/sproutcore/frameworks/bootstrap/README +9 -0
  11. data/frameworks/sproutcore/frameworks/bootstrap/core.js +7 -0
  12. data/frameworks/sproutcore/frameworks/bootstrap/setup_body_class_names.js +10 -0
  13. data/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +28 -0
  14. data/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +45 -0
  15. data/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +9 -8
  16. data/frameworks/sproutcore/frameworks/datastore/models/record.js +49 -9
  17. data/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +9 -0
  18. data/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +3 -2
  19. data/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +81 -8
  20. data/frameworks/sproutcore/frameworks/datastore/system/query.js +26 -5
  21. data/frameworks/sproutcore/frameworks/datastore/system/record_array.js +47 -0
  22. data/frameworks/sproutcore/frameworks/datastore/system/store.js +164 -32
  23. data/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +32 -4
  24. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +56 -0
  25. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +1 -1
  26. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +15 -0
  27. data/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +16 -1
  28. data/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +1 -1
  29. data/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +22 -1
  30. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +32 -1
  31. data/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/core_methods.js +70 -0
  32. data/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +12 -0
  33. data/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +50 -0
  34. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +9 -9
  35. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +8 -1
  36. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +79 -0
  37. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +24 -0
  38. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/error_methods.js +62 -0
  39. data/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +2 -0
  40. data/frameworks/sproutcore/frameworks/debug/core.js +10 -6
  41. data/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +43 -18
  42. data/frameworks/sproutcore/frameworks/designer/core.js +10 -0
  43. data/frameworks/sproutcore/frameworks/designer/english.lproj/selection_handles.css +58 -0
  44. data/frameworks/sproutcore/frameworks/designer/{views/mixins → mixins}/button.js +0 -0
  45. data/frameworks/sproutcore/frameworks/designer/views/{controls/button.js → button.js} +6 -2
  46. data/frameworks/sproutcore/frameworks/designer/views/designer.js +566 -136
  47. data/frameworks/sproutcore/frameworks/designer/views/selection_handles.js +77 -0
  48. data/frameworks/sproutcore/frameworks/desktop/core.js +12 -0
  49. data/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +1 -1
  50. data/frameworks/sproutcore/frameworks/desktop/english.lproj/drag.css +3 -2
  51. data/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -36
  52. data/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +14 -0
  53. data/frameworks/sproutcore/frameworks/desktop/english.lproj/modal.css +4 -0
  54. data/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +2 -0
  55. data/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +0 -4
  56. data/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +8 -5
  57. data/frameworks/sproutcore/frameworks/desktop/panes/alert.js +2 -2
  58. data/frameworks/sproutcore/frameworks/desktop/panes/menu.js +100 -111
  59. data/frameworks/sproutcore/frameworks/desktop/panes/panel.js +1 -1
  60. data/frameworks/sproutcore/frameworks/desktop/panes/picker.js +51 -13
  61. data/frameworks/sproutcore/frameworks/desktop/panes/{drop_down.js → select_button.js} +70 -109
  62. data/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +8 -0
  63. data/frameworks/sproutcore/frameworks/desktop/system/root_responder.js +69 -23
  64. data/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +4 -4
  65. data/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +2 -0
  66. data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/methods.js +15 -11
  67. data/frameworks/sproutcore/frameworks/desktop/tests/panes/{dropDown → select_button}/ui.js +22 -22
  68. data/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +1 -1
  69. data/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +0 -1
  70. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deleteSelection.js +1 -1
  71. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deselect.js +19 -3
  72. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +1 -1
  73. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +53 -28
  74. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/select.js +6 -6
  75. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectNextItem.js +23 -9
  76. data/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +24 -10
  77. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +1 -1
  78. data/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +1 -1
  79. data/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +10 -3
  80. data/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +1 -1
  81. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +50 -28
  82. data/frameworks/sproutcore/frameworks/desktop/tests/views/scroller/methods.js +6 -6
  83. data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +3 -3
  84. data/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +8 -8
  85. data/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +1 -1
  86. data/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +1 -1
  87. data/frameworks/sproutcore/frameworks/desktop/views/button.js +5 -3
  88. data/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +4 -3
  89. data/frameworks/sproutcore/frameworks/desktop/views/collection.js +125 -96
  90. data/frameworks/sproutcore/frameworks/desktop/views/grid.js +1 -0
  91. data/frameworks/sproutcore/frameworks/desktop/views/list.js +68 -18
  92. data/frameworks/sproutcore/frameworks/desktop/views/list_item.js +134 -56
  93. data/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +18 -11
  94. data/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +562 -2
  95. data/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +13 -0
  96. data/frameworks/sproutcore/frameworks/desktop/views/progress.js +11 -8
  97. data/frameworks/sproutcore/frameworks/desktop/views/radio.js +7 -7
  98. data/frameworks/sproutcore/frameworks/desktop/views/scroll.js +99 -33
  99. data/frameworks/sproutcore/frameworks/desktop/views/scroller.js +3 -7
  100. data/frameworks/sproutcore/frameworks/desktop/views/segmented.js +0 -7
  101. data/frameworks/sproutcore/frameworks/desktop/views/separator.js +2 -3
  102. data/frameworks/sproutcore/frameworks/desktop/views/slider.js +0 -8
  103. data/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +1 -1
  104. data/frameworks/sproutcore/frameworks/desktop/views/split.js +27 -7
  105. data/frameworks/sproutcore/frameworks/desktop/views/tab.js +2 -6
  106. data/frameworks/sproutcore/frameworks/foundation/controllers/array.js +15 -10
  107. data/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +20 -1
  108. data/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +1 -1
  109. data/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +3 -6
  110. data/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +3 -0
  111. data/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +8 -0
  112. data/frameworks/sproutcore/frameworks/foundation/english.lproj/inline_editor.css +12 -0
  113. data/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +11 -0
  114. data/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +13 -0
  115. data/frameworks/sproutcore/frameworks/foundation/mixins/button.js +1 -2
  116. data/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +70 -21
  117. data/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +88 -54
  118. data/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +0 -25
  119. data/frameworks/sproutcore/frameworks/foundation/mixins/string.js +23 -2
  120. data/frameworks/sproutcore/frameworks/foundation/panes/pane.js +34 -23
  121. data/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +20 -0
  122. data/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +32 -23
  123. data/frameworks/sproutcore/frameworks/foundation/system/browser.js +2 -2
  124. data/frameworks/sproutcore/frameworks/foundation/system/bundle.js +77 -15
  125. data/frameworks/sproutcore/frameworks/foundation/system/core_query.js +5 -4
  126. data/frameworks/sproutcore/frameworks/foundation/system/cursor.js +1 -1
  127. data/frameworks/sproutcore/frameworks/foundation/system/render_context.js +22 -7
  128. data/frameworks/sproutcore/frameworks/foundation/system/request.js +466 -309
  129. data/frameworks/sproutcore/frameworks/foundation/system/responder.js +2 -1
  130. data/frameworks/sproutcore/frameworks/foundation/system/response.js +457 -0
  131. data/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +66 -15
  132. data/frameworks/sproutcore/frameworks/foundation/system/routes.js +4 -4
  133. data/frameworks/sproutcore/frameworks/foundation/system/timer.js +6 -4
  134. data/frameworks/sproutcore/frameworks/foundation/system/utils.js +46 -8
  135. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +17 -0
  136. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/enum_case.js +18 -5
  137. data/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/null_case.js +1 -1
  138. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +0 -2
  139. data/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js +11 -0
  140. data/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js +14 -14
  141. data/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +2 -2
  142. data/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +15 -3
  143. data/frameworks/sproutcore/frameworks/foundation/tests/system/datetime.js +1 -1
  144. data/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +8 -7
  145. data/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +3 -2
  146. data/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +51 -44
  147. data/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +2 -2
  148. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +4 -4
  149. data/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +2 -0
  150. data/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +9 -9
  151. data/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +2 -2
  152. data/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +3 -3
  153. data/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +10 -3
  154. data/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +2 -2
  155. data/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +14 -0
  156. data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +5 -5
  157. data/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -11
  158. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +2 -2
  159. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +2 -4
  160. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +2 -4
  161. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +1 -1
  162. data/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +0 -2
  163. data/frameworks/sproutcore/frameworks/foundation/validators/password.js +5 -5
  164. data/frameworks/sproutcore/frameworks/foundation/validators/validator.js +4 -2
  165. data/frameworks/sproutcore/frameworks/foundation/views/field.js +5 -8
  166. data/frameworks/sproutcore/frameworks/foundation/views/label.js +21 -5
  167. data/frameworks/sproutcore/frameworks/foundation/views/text_field.js +112 -69
  168. data/frameworks/sproutcore/frameworks/foundation/views/view.js +67 -6
  169. data/frameworks/sproutcore/frameworks/runtime/core.js +51 -2
  170. data/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +4 -1
  171. data/frameworks/sproutcore/frameworks/runtime/system/binding.js +2 -1
  172. data/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +5 -4
  173. data/frameworks/sproutcore/frameworks/runtime/system/index_set.js +6 -1
  174. data/frameworks/sproutcore/frameworks/runtime/system/logger.js +408 -0
  175. data/frameworks/sproutcore/frameworks/runtime/system/object.js +15 -4
  176. data/frameworks/sproutcore/frameworks/runtime/system/selection_set.js +30 -2
  177. data/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +5 -1
  178. data/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +1 -1
  179. data/frameworks/sproutcore/frameworks/runtime/tests/core/compare.js +3 -3
  180. data/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +2 -0
  181. data/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +1 -1
  182. data/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +2 -1
  183. data/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +2 -2
  184. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
  185. data/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -0
  186. data/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +11 -7
  187. data/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +3 -2
  188. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/add.js +18 -1
  189. data/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +1 -1
  190. data/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +165 -0
  191. data/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +3 -0
  192. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/copy.js +1 -1
  193. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/indexSetForSource.js +13 -0
  194. data/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/remove.js +24 -0
  195. data/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +32 -13
  196. data/frameworks/sproutcore/frameworks/testing/english.lproj/runner.css +2 -2
  197. data/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +7 -2
  198. data/frameworks/sproutcore/lib/index.rhtml +6 -20
  199. data/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
  200. data/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +0 -1
  201. data/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +5 -4
  202. data/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +4 -3
  203. data/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +7 -7
  204. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
  205. data/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +38 -0
  206. data/frameworks/sproutcore/themes/standard_theme/english.lproj/menu.css +20 -0
  207. data/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +1 -0
  208. data/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +3 -1
  209. data/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +1 -0
  210. data/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +1 -1
  211. data/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +0 -15
  212. data/gen/data-source/Buildfile +18 -0
  213. data/gen/data-source/README +1 -0
  214. data/gen/data-source/USAGE +15 -0
  215. data/gen/data-source/templates/data_sources/@filename@.js +64 -0
  216. data/lib/sproutcore/builders/combine.rb +23 -0
  217. data/lib/sproutcore/builders/javascript.rb +27 -2
  218. data/lib/sproutcore/buildfile/task.rb +1 -1
  219. data/lib/sproutcore/helpers/entry_sorter.rb +2 -2
  220. data/lib/sproutcore/helpers/static_helper.rb +79 -0
  221. data/lib/sproutcore/models/manifest.rb +2 -2
  222. data/lib/sproutcore/models/target.rb +1 -1
  223. data/lib/sproutcore/tools/build.rb +1 -1
  224. data/lib/sproutcore/tools/docs.rb +3 -3
  225. data/lib/sproutcore/tools/gen.rb +17 -15
  226. data/lib/sproutcore/tools/manifest.rb +9 -9
  227. data/lib/sproutcore/tools/server.rb +3 -3
  228. data/lib/sproutcore/tools.rb +259 -250
  229. data/lib/sproutcore.rb +9 -1
  230. data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +2 -2
  231. data/spec/fixtures/entry_for_project/frameworks/unrelated/PLACEHOLDER +0 -0
  232. data/spec/fixtures/ordered_entries/apps/no_requires/{lproj → english.lproj}/strings.js +0 -0
  233. data/spec/fixtures/ordered_entries/apps/no_requires/main.js +1 -0
  234. data/spec/fixtures/ordered_entries/apps/no_requires/resources/main_page.js +1 -0
  235. data/spec/fixtures/ordered_entries/apps/no_requires/t.js +1 -0
  236. data/spec/lib/models/manifest/find_entry.rb +12 -0
  237. data/spec/lib/tools/gen_spec.rb +1 -0
  238. data/spec/lib/tools/tools_spec.rb +1 -0
  239. data/sproutcore-abbot.gemspec +36 -44
  240. metadata +43 -44
  241. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/indicator.gif +0 -0
  242. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sc-theme-sprite.png +0 -0
  243. data/frameworks/sproutcore/frameworks/desktop/english.lproj/images/sticky-note.png +0 -0
  244. data/frameworks/sproutcore/frameworks/desktop/views/form.js +0 -594
  245. data/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-sprite.png +0 -0
  246. data/lib/thor/CHANGELOG.rdoc +0 -52
  247. data/lib/thor/LICENSE +0 -20
  248. data/lib/thor/README.markdown +0 -76
  249. data/lib/thor/Rakefile +0 -6
  250. data/lib/thor/Thorfile +0 -45
  251. data/lib/thor/bin/rake2thor +0 -83
  252. data/lib/thor/bin/thor +0 -7
  253. data/lib/thor/lib/thor/error.rb +0 -3
  254. data/lib/thor/lib/thor/options.rb +0 -267
  255. data/lib/thor/lib/thor/ordered_hash.rb +0 -64
  256. data/lib/thor/lib/thor/runner.rb +0 -305
  257. data/lib/thor/lib/thor/task.rb +0 -83
  258. data/lib/thor/lib/thor/task_hash.rb +0 -22
  259. data/lib/thor/lib/thor/tasks/package.rb +0 -18
  260. data/lib/thor/lib/thor/tasks.rb +0 -77
  261. data/lib/thor/lib/thor/util.rb +0 -75
  262. data/lib/thor/lib/thor.rb +0 -170
  263. data/lib/thor/script/destroy +0 -14
  264. data/lib/thor/script/generate +0 -14
  265. data/lib/thor/spec/fixtures/task.thor +0 -10
  266. data/lib/thor/spec/options_spec.rb +0 -271
  267. data/lib/thor/spec/ordered_hash_spec.rb +0 -84
  268. data/lib/thor/spec/spec.opts +0 -1
  269. data/lib/thor/spec/spec_helper.rb +0 -30
  270. data/lib/thor/spec/task_spec.rb +0 -11
  271. data/lib/thor/spec/tasks_spec.rb +0 -28
  272. data/lib/thor/spec/thor_runner_spec.rb +0 -194
  273. data/lib/thor/spec/thor_spec.rb +0 -206
  274. data/lib/thor/spec/util_spec.rb +0 -99
  275. data/lib/thor/task.thor +0 -15
  276. data/lib/thor/thor.gemspec +0 -29
@@ -80,6 +80,223 @@ SC.ViewDesigner = SC.Object.extend(
80
80
 
81
81
  concatenatedProperties: ['designProperties', 'localizedProperties'],
82
82
 
83
+
84
+ // ..........................................................
85
+ // SIZE AND POSITIONING SUPPORT
86
+ //
87
+
88
+ /**
89
+ Set to NO to hide horizontal resize handles
90
+ */
91
+ canResizeHorizontal: YES,
92
+
93
+ /**
94
+ Set to NO to resize vertical handles
95
+ */
96
+ canResizeVertical: YES,
97
+
98
+ /**
99
+ Allows moving.
100
+ */
101
+ canReposition: YES,
102
+
103
+ /**
104
+ Determines the minimum allowed width
105
+ */
106
+ minWidth: 10,
107
+
108
+ /**
109
+ Determines the minimum allowed height
110
+ */
111
+ minHeight: 10,
112
+
113
+ /**
114
+ Determines maximum allowed width. null means no limit
115
+ */
116
+ maxWidth: 100000000,
117
+
118
+ /**
119
+ Determines maximum allowed height. null means no limit
120
+ */
121
+ maxHeight: 100000000,
122
+
123
+ /**
124
+ Returns the current layout for the view. Set this property to update
125
+ the layout. Direct properties are exposed a well. You will usually want
126
+ to work with those instead.
127
+
128
+ @property
129
+ @type {Hash}
130
+ */
131
+ layout: function(key, value) {
132
+ var view = this.get('view');
133
+ if (!view) return null;
134
+
135
+ if (value !== undefined) view.set('layout', value);
136
+ return view.get('layout');
137
+ }.property('view').cacheable(),
138
+
139
+ /**
140
+ The current anchor location. This determines which of the other dimension
141
+ metrics are actually used to compute the layout. The value may be one of:
142
+
143
+ TOP_LEFT, TOP_CENTER, TOP_RIGHT, TOP_HEIGHT,
144
+ CENTER_LEFT, CENTER_CENTER, CENTER_RIGHT, CENTER_HEIGHT
145
+ BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT, BOTTOM_HEIGHT,
146
+ WIDTH_LEFT, WIDTH_CENTER, WIDTH_RIGHT, WIDTH_HEIGHT,
147
+ null
148
+
149
+ @property
150
+ @type {Number}
151
+ */
152
+ anchorLocation: function(key, value) {
153
+ var layout = this.get('layout'),
154
+ K = SC.ViewDesigner,
155
+ h, v, frame, view, pview, pframe, ret;
156
+
157
+ if (!layout) return null;
158
+
159
+ // update to refelct new anchor locations...
160
+ if (value !== undefined) {
161
+
162
+ ret = {};
163
+ view = this.get('view');
164
+ frame = view.get('frame');
165
+ pview = view.get('parentView');
166
+ pframe = pview ? pview.get('frame') : null;
167
+ if (!pframe) pframe = SC.RootResponder.responder.computeWindowSize();
168
+
169
+ // compute new layout in each direction
170
+ if (value & K.ANCHOR_LEFT) {
171
+ ret.left = frame.x;
172
+ ret.width = frame.width;
173
+
174
+ } else if (value & K.ANCHOR_RIGHT) {
175
+ ret.right = (pframe.width - SC.maxX(frame));
176
+ ret.width = frame.width;
177
+
178
+ } else if (value & K.ANCHOR_CENTERX) {
179
+ ret.centerX = Math.round(SC.midX(frame) - (pframe.width/2)) ;
180
+ ret.width = frame.width;
181
+
182
+ } else if (value & K.ANCHOR_WIDTH) {
183
+ ret.left = frame.x;
184
+ ret.right = (pframe.width - SC.maxX(frame));
185
+ }
186
+
187
+ // vertical
188
+ if (value & K.ANCHOR_TOP) {
189
+ ret.top = frame.y;
190
+ ret.height = frame.height;
191
+
192
+ } else if (value & K.ANCHOR_BOTTOM) {
193
+ ret.bottom = (pframe.height - SC.maxY(frame));
194
+ ret.height = frame.height;
195
+
196
+ } else if (value & K.ANCHOR_CENTERY) {
197
+ ret.centerY = Math.round(SC.midY(frame) - (pframe.height/2)) ;
198
+ ret.height = frame.height;
199
+
200
+ } else if (value & K.ANCHOR_HEIGHT) {
201
+ ret.top = frame.y;
202
+ ret.bottom = (pframe.height - SC.maxY(frame));
203
+ }
204
+
205
+ this.set('layout', ret);
206
+ layout = ret ;
207
+ }
208
+
209
+ if (!SC.none(layout.left)) {
210
+ h = SC.none(layout.width) ? K.ANCHOR_WIDTH : K.ANCHOR_LEFT;
211
+ } else if (!SC.none(layout.right)) h = K.ANCHOR_RIGHT;
212
+ else if (!SC.none(layout.centerX)) h = K.ANCHOR_CENTERX;
213
+ else h = 0;
214
+
215
+ if (!SC.none(layout.top)) {
216
+ v = SC.none(layout.height) ? K.ANCHOR_HEIGHT : K.ANCHOR_TOP;
217
+ } else if (!SC.none(layout.bottom)) v = K.ANCHOR_BOTTOM ;
218
+ else if (!SC.none(layout.centerY)) v = K.ANCHOR_CENTERY ;
219
+ else v = 0;
220
+
221
+ return v | h;
222
+ }.property('layout').cacheable(),
223
+
224
+ _layoutProperty: function(key, value) {
225
+ var layout = this.get('layout');
226
+ if (!layout) return null;
227
+
228
+ if (!SC.none(layout) && (value !== undefined)) {
229
+ layout = SC.copy(layout);
230
+ layout[key] = value;
231
+ this.set('layout', layout);
232
+ }
233
+
234
+ return layout[key];
235
+ },
236
+
237
+ /**
238
+ Returns the top offset of the current layout or null if not defined
239
+ */
240
+ layoutTop: function(key, value) {
241
+ return this._layoutProperty('top', value);
242
+ }.property('layout').cacheable(),
243
+
244
+ /**
245
+ Returns the bottom offset of the current layout or null if not defined
246
+ */
247
+ layoutBottom: function(key, value) {
248
+ return this._layoutProperty('bottom', value);
249
+ }.property('layout').cacheable(),
250
+
251
+ /**
252
+ Returns the centerY offset of the current layout or null if not defined
253
+ */
254
+ layoutCenterY: function(key, value) {
255
+ return this._layoutProperty('centerY', value);
256
+ }.property('layout').cacheable(),
257
+
258
+ /**
259
+ Returns the height offset of the current layout or null if not defined
260
+ */
261
+ layoutHeight: function(key, value) {
262
+ return this._layoutProperty('height', value);
263
+ }.property('layout').cacheable(),
264
+
265
+ /**
266
+ Returns the top offset of the current layout or null if not defined
267
+ */
268
+ layoutTop: function(key, value) {
269
+ return this._layoutProperty('top', value);
270
+ }.property('layout').cacheable(),
271
+
272
+ /**
273
+ Returns the left offset of the current layout or null if not defined
274
+ */
275
+ layoutLeft: function(key, value) {
276
+ return this._layoutProperty('left', value);
277
+ }.property('layout').cacheable(),
278
+
279
+ /**
280
+ Returns the right offset of the current layout or null if not defined
281
+ */
282
+ layoutRight: function(key, value) {
283
+ return this._layoutProperty('right', value);
284
+ }.property('layout').cacheable(),
285
+
286
+ /**
287
+ Returns the centerX offset of the current layout or null if not defined
288
+ */
289
+ layoutCenterX: function(key, value) {
290
+ return this._layoutProperty('centerX', value);
291
+ }.property('layout').cacheable(),
292
+
293
+ /**
294
+ Returns the width offset of the current layout or null if not defined
295
+ */
296
+ layoutWidth: function(key, value) {
297
+ return this._layoutProperty('width', value);
298
+ }.property('layout').cacheable(),
299
+
83
300
  // ..........................................................
84
301
  // GENERIC PROPERTIES
85
302
  //
@@ -95,9 +312,7 @@ SC.ViewDesigner = SC.Object.extend(
95
312
  the coder. This is used by encodeDesignProperties() and
96
313
  encodeLocalizedProperties().
97
314
  */
98
- encodeSimpleProperties: function(props, coder) {
99
- console.log('encodeSimple: %@'.fmt(props));
100
-
315
+ encodeSimpleProperties: function(props, coder) {
101
316
  var view = this.get('view'), proto = this.get('viewClass').prototype ;
102
317
  props.forEach(function(prop) {
103
318
  var val = view[prop] ; // avoid get() since we don't want to exec props
@@ -116,7 +331,7 @@ SC.ViewDesigner = SC.Object.extend(
116
331
 
117
332
  You can add to this array in your subclasses.
118
333
  */
119
- designProperties: 'isVisible isEnabled styleClass'.w(),
334
+ designProperties: 'layout isVisible isEnabled styleClass'.w(),
120
335
 
121
336
  /**
122
337
  Invoked by a design coder to encode design properties. The default
@@ -128,27 +343,6 @@ SC.ViewDesigner = SC.Object.extend(
128
343
  coder.set('className', SC._object_className(this.get('viewClass')));
129
344
  this.encodeDesignProperties(coder);
130
345
  this.encodeChildViewsDesign(coder);
131
-
132
- // finally, emit the rootElementPath.
133
- var view = this.get('view'), parentView = view.get('parentView');
134
- console.log('parentView = %@'.fmt(parentView));
135
- if (parentView) {
136
- var el = view.rootElement, parentRoot = parentView.rootElement;
137
- var path = [], nodes ;
138
-
139
- while(el && el !== parentRoot) {
140
- // find the index of the parentNode
141
- nodes = SC.$A(el.parentNode.childNodes);
142
- path.unshift(nodes.indexOf(el)); // get the index...
143
-
144
- // go up a level...
145
- el = el.parentNode ;
146
- }
147
-
148
- coder.array('rootElementPath', path);
149
- nodes = el = parentRoot = path = null; // avoid memory leaks
150
- }
151
-
152
346
  return YES ;
153
347
  },
154
348
 
@@ -182,7 +376,7 @@ SC.ViewDesigner = SC.Object.extend(
182
376
 
183
377
  You can add to this array in your subclasses.
184
378
  */
185
- localizedProperties: ['layout'],
379
+ localizedProperties: [],
186
380
 
187
381
  /**
188
382
  Invoked by a localization coder to encode design properties. The default
@@ -256,11 +450,14 @@ SC.ViewDesigner = SC.Object.extend(
256
450
  It will notify all properties changed for '*'. You may override this
257
451
  method with your own behavior if you like.
258
452
  */
259
- viewPropertyDidChange: function(view, key) {
260
- if (key === '*') {
261
- this.allPropertiesDidChange();
262
- } else if (this[key] === undefined) {
263
- this.notifyPropertyChange(key) ;
453
+ viewPropertyDidChange: function(view, key) {
454
+ if (key === '*') this.allPropertiesDidChange();
455
+ else if (this[key] === undefined) this.notifyPropertyChange(key) ;
456
+
457
+ if ((key === '*') || (key === 'layout')) {
458
+ if (this.get('designIsSelected') && this._handles) {
459
+ this._handles.set('layout', SC.clone(view.get('layout')));
460
+ }
264
461
  }
265
462
  },
266
463
 
@@ -304,8 +501,25 @@ SC.ViewDesigner = SC.Object.extend(
304
501
  },
305
502
 
306
503
  designIsSelectedDidChange: function() {
504
+ if (SC.kindOf(this.view, SC.Pane)) return this ;
505
+
307
506
  var isSel = this.get('designIsSelected');
308
- this.view.$().css('outline', (isSel) ? '2px #721492 dashed' : 'none');
507
+ var handles = this._handles;
508
+
509
+ if (isSel) {
510
+
511
+ if (!handles) {
512
+ handles = this._handles = SC.SelectionHandlesView.create({
513
+ designer: this
514
+ });
515
+ }
516
+
517
+ var parent = this.view.get('parentView');
518
+ if (!handles.get('parentView') !== parent) parent.appendChild(handles);
519
+ handles.set('layout', this.view.get('layout'));
520
+ } else if (handles) {
521
+ if (handles.get('parentView')) handles.removeFromParent();
522
+ }
309
523
  }.observes('designIsSelected'),
310
524
 
311
525
  tryToPerform: function(methodName, arg1, arg2) {
@@ -323,145 +537,318 @@ SC.ViewDesigner = SC.Object.extend(
323
537
  },
324
538
 
325
539
  // ..........................................................
326
- // MOUSE HANDLING
540
+ // DRAWING SUPPORT
327
541
  //
542
+
543
+ /**
544
+ Update the layer to add any design-specific marking
545
+ */
546
+ didCreateLayer: function() {},
547
+
548
+ /**
549
+ Update the layer to add any design-specific marking
550
+ */
551
+ didUpdateLayer: function() {},
552
+
553
+ /**
554
+ Update the layer to add any design-specific marking
555
+ */
556
+ willDestroyLayer: function() {},
328
557
 
329
- HOTZONE_THICKNESS: 5,
330
- HEAD_ZONE: 'head',
331
- TAIL_ZONE: 'tail',
332
- NO_ZONE: 'center',
558
+ // ..........................................................
559
+ // MOUSE HANDLING
560
+ //
333
561
 
334
- _zoneForOffset: function(offset, min, max) {
335
- var thick = this.HOTZONE_THICKNESS ;
336
-
337
- return (offset<=(min+thick)) ? this.HEAD_ZONE : (offset>(max-thick)) ? this.TAIL_ZONE : this.NO_ZONE;
338
- },
562
+ HANDLE_MARGIN: 5,
339
563
 
340
564
  /**
341
565
  Select on mouseDown. If metaKey or shiftKey is pressed, add to
342
- selection.
566
+ selection. Otherwise just save starting info for dragging
343
567
  */
344
568
  mouseDown: function(evt) {
345
569
  if (!this.get('designIsEnabled')) return NO ;
346
- this.get('designController').select(this, evt.metaKey || evt.shiftKey);
347
570
 
348
- var v, i, f, offset;
349
-
350
- // save mouseDown information...
351
- v = this.get('view');
352
- if (!v) return YES; // nothing to do...
571
+ // save mouse down info
572
+ var view = this.get('view'),
573
+ info, vert, horiz, repos, frame, pview, margin, canH, canV;
574
+
575
+ if (!view) return NO; // nothing to do
353
576
 
354
- i = (this._mouseDownInfo = SC.clone(v.get('layout')));
355
- i.pageX = evt.pageX; i.pageY = evt.pageY ;
356
- f = v.convertFrameToView(v.get('frame'), null);
577
+ // save mouse down state for later use
578
+ this._mouseDownInfo = info = {
579
+ layout: SC.copy(view.get('layout')),
580
+ selected: this.get('designIsSelected'),
581
+ dragged: NO,
582
+ metaKey: evt.metaKey || evt.shiftKey,
583
+ source: this,
584
+ x: evt.pageX, y: evt.pageY
585
+ };
586
+ info.hanchor = info.vanchor = info.reposition = NO;
587
+
588
+ // detect what operations are available.
589
+ repos = this.get('canReposition');
590
+ horiz = vert = NO ;
591
+ if (info.selected) {
592
+ frame = view.get('frame');
593
+ pview = view.get('parentView');
594
+ if (frame && pview) frame = pview.convertFrameToView(frame, null);
595
+
596
+ margin = this.HANDLE_MARGIN;
597
+
598
+ // detect if we are in any hotzones
599
+ if (frame) {
600
+ if (Math.abs(info.x - SC.minX(frame)) <= margin) {
601
+ horiz = "left";
602
+ } else if (Math.abs(info.x - SC.maxX(frame)) <= margin) {
603
+ horiz = "right";
604
+ }
605
+
606
+ if (Math.abs(info.y - SC.minY(frame)) <= margin) {
607
+ vert = "top";
608
+ } else if (Math.abs(info.y - SC.maxY(frame)) <= margin) {
609
+ vert = "bottom";
610
+ }
611
+ }
612
+
613
+ canH = this.get('canResizeHorizontal');
614
+ canV = this.get('canResizeVertical');
615
+
616
+ // look for corners if can resize in both directions...
617
+ if (canH && canV) {
618
+ if (!vert || !horiz) vert = horiz = NO ;
619
+
620
+ // if can only resize horizonal - must be in middle vertical
621
+ } else if (canH) {
622
+ vert = NO ;
623
+ if (Math.abs(info.y - SC.midY(frame)) > margin) horiz = NO;
624
+
625
+ // if can only resize vertical - must be in middle horizontal
626
+ } else if (canV) {
627
+ horiz = NO ;
628
+ if (Math.abs(info.x - SC.midX(frame)) > margin) vert = NO ;
629
+
630
+ // otherwise, do not allow resizing
631
+ } else horiz = vert = NO ;
632
+ }
633
+
634
+ // now save settings...
635
+ if (horiz) info.hanchor = horiz ;
636
+ if (vert) info.vanchor = vert ;
637
+ if (!horiz && !vert && repos) info.reposition = YES ;
357
638
 
358
- // handle X hotzone
359
- i.zoneX = this._zoneForOffset(i.pageX, SC.minX(f), SC.maxX(f));
360
- i.zoneY = this._zoneForOffset(i.pageY, SC.minY(f), SC.maxY(f));
639
+ // if not yet selected, select item immediately. This way future events
640
+ // will be handled properly
641
+ if (!info.selected) {
642
+ this.get('designController').select(this, info.metaKey);
643
+ }
644
+
645
+ // save initial info on all selected items
646
+ if (info.reposition) this.get('designController').prepareReposition(info);
361
647
 
362
648
  return YES ;
363
649
  },
364
-
365
- _adjustViewLayoutOnDrag: function(view, curZone, altZone, delta, i, headKey, tailKey, centerKey, sizeKey) {
366
-
367
- // collect some useful values...
368
- var HEAD_ZONE = this.HEAD_ZONE, TAIL_ZONE = this.TAIL_ZONE ;
369
- var inAltZone = (altZone === HEAD_ZONE) || (altZone === TAIL_ZONE);
370
- var head = i[headKey], tail = i[tailKey], center = i[centerKey],
371
- size = i[sizeKey];
372
-
373
- switch(curZone) {
374
- case HEAD_ZONE:
375
- // if head aligned, shift head origin...
376
- if (!SC.none(head)) {
377
- view.adjust(headKey, head - delta) ;
378
-
379
- // if we have a SIZE but no HEAD, assume centered or TAIL aligned
380
- } else if (!SC.none(size)) {
381
-
382
- // if centered, adjust by 2x so edge will track properly...
383
- if (!SC.none(center)) delta = delta * 2 ;
384
- view.adjust(sizeKey, size - delta);
385
- }
386
- break;
387
650
 
388
- case TAIL_ZONE:
389
- // if tail aligned, this tail origin...
390
- if (!SC.none(tail)) {
391
- view.adjust(tailKey, tail + delta) ;
392
-
393
- // if we have a SIZE but not TAIL, assume centered or HEAD aligned
394
- } else if (!SC.none(size)) {
395
- if (!SC.none(center)) delta = delta * 2 ;
396
- view.adjust(sizeKey, size + delta) ;
397
- }
398
- break;
399
-
400
- // if we are not in an X hotzone, move in X dir unless we are in a
401
- // Y hotzone or if the view is anchored to the left/right edges (in which
402
- // case you can't move around...you have to resize edges)
403
- default:
404
- if (!inAltZone && !SC.none(size)) {
405
- if (!SC.none(head)) {
406
- view.adjust(headKey, head + delta);
407
- } else if (!SC.none(tail)) {
408
- view.adjust(tailKey, tail - delta) ;
409
- } else if (!SC.none(center)) {
410
- view.adjust(centerKey, center + delta);
411
- }
412
- }
413
- break ;
414
- }
651
+ prepareReposition: function(info) {
652
+ var view = this.get('view'),
653
+ layout = view ? SC.copy(view.get('layout')) : {};
654
+ info[SC.keyFor('layout', SC.guidFor(this))] = layout;
655
+ return this ;
415
656
  },
416
657
 
658
+ /**
659
+ mouse dragged will resize or reposition depending on the settings from
660
+ mousedown.
661
+ */
417
662
  mouseDragged: function(evt) {
418
663
  if (!this.get('designIsEnabled')) return NO ;
419
-
420
- // adjust the layout...
421
- var i = this._mouseDownInfo ;
422
- var deltaX = evt.pageX - i.pageX, deltaY = evt.pageY - i.pageY;
423
-
424
- var view = this.get('view');
425
- this._adjustViewLayoutOnDrag(view, i.zoneX, i.zoneY, deltaX, i, 'left', 'right', 'centerX', 'width') ;
426
- this._adjustViewLayoutOnDrag(view, i.zoneY, i.zoneX, deltaY, i, 'top', 'bottom', 'centerY', 'height') ;
664
+ var info = this._mouseDownInfo,
665
+ view = this.get('view'),
666
+ layout;
427
667
 
428
- // update the cursor...make sure we stick with the current zone...
429
- this.mouseMoved(evt, i.zoneX, i.zoneY);
430
- return YES ;
668
+ if (view && (info.hanchor || info.vanchor)) {
669
+ layout = SC.copy(this.get('layout'));
670
+ if (info.hanchor) this._mouseResize(evt, info, this.HKEYS, layout);
671
+ if (info.vanchor) this._mouseResize(evt, info, this.VKEYS, layout);
672
+ this.set('layout', layout);
673
+
674
+ } else if (info.reposition) {
675
+ this.get('designController').repositionSelection(evt, info);
676
+ }
431
677
  },
432
678
 
679
+ /**
680
+ On mouseUp potentially change selection and cleanup.
681
+ */
433
682
  mouseUp: function(evt) {
434
683
  if (!this.get('designIsEnabled')) return NO ;
435
- console.log('%@: mouseUp'.fmt(this));
684
+
685
+ var info = this._mouseDownInfo;
686
+
687
+ // if selected on mouse down and we didn't do any dragging, then deselect.
688
+ if (info.selected && !info.dragged) {
689
+
690
+ // is the mouse still inside the view? If not, don't do anything...
691
+ var view = this.get('view'),
692
+ frame = view ? view.get('frame') : null,
693
+ pview = view.get('parentView');
694
+
695
+ if (frame && pview) frame = pview.convertFrameToView(frame, null);
696
+
697
+ //debugger;
698
+ if (!frame || SC.pointInRect({ x: evt.pageX, y: evt.pageY }, frame)) {
699
+ var controller = this.get('designController');
700
+ if (info.metaKey) controller.deselect(this);
701
+ else controller.select(this, NO);
702
+ }
703
+ }
704
+
705
+ this._mouseDownInfo = null;
706
+
436
707
  return YES ;
437
708
  },
438
709
 
439
- // Change the CURSOR for the view...
440
- mouseMoved: function(evt, zoneX, zoneY) {
441
- if (!this.get('designIsSelected')) return NO ;
442
-
443
- var HEAD_ZONE = this.HEAD_ZONE, TAIL_ZONE =this.TAIL_ZONE ;
444
- var view, f, zoneX, zoneY, cursor ;
710
+ /**
711
+ Called by designerController to reposition the view
712
+ */
713
+ mouseReposition: function(evt, info) {
714
+ var layout = SC.copy(this.get('layout'));
715
+ this._mouseReposition(evt, info, this.HKEYS, layout);
716
+ this._mouseReposition(evt, info, this.VKEYS, layout);
717
+ this.set('layout', layout);
718
+ return this;
719
+ },
720
+
721
+ HKEYS: {
722
+ evtPoint: "pageX",
723
+ point: "x",
724
+ min: "minWidth",
725
+ max: "maxWidth",
726
+ head: "left",
727
+ tail: "right",
728
+ center: "centerX",
729
+ size: "width",
730
+ anchor: "hanchor"
731
+ },
732
+
733
+ VKEYS: {
734
+ evtPoint: "pageY",
735
+ point: "y",
736
+ min: "minHeight",
737
+ max: "maxHeight",
738
+ head: "top",
739
+ tail: "bottom",
740
+ center: "centerY",
741
+ size: "height",
742
+ anchor: "vanchor"
743
+ },
744
+
745
+ /**
746
+ Generic resizer. Must pass one set of keys: VKEYS, HKEYS
747
+ */
748
+ _mouseResize: function(evt, info, keys, ret) {
445
749
 
446
- view = this.get('view');
447
- f = view.convertFrameToView(view.get('frame'), null);
448
- if (!zoneX) zoneX = this._zoneForOffset(evt.pageX, SC.minX(f), SC.maxX(f));
449
- if (!zoneY) zoneY = this._zoneForOffset(evt.pageY, SC.minY(f), SC.maxY(f));
750
+ var delta = evt[keys.evtPoint] - info[keys.point],
751
+ layout = info.layout,
752
+ view = this.get('view'),
753
+ min = this.get(keys.min),
754
+ max = this.get(keys.max),
755
+
756
+ headKey = keys.head,
757
+ tailKey = keys.tail,
758
+ centerKey = keys.center,
759
+ sizeKey = keys.size,
760
+
761
+ hasHead = !SC.none(layout[keys.head]),
762
+ hasTail = !SC.none(layout[keys.tail]),
763
+ hasCenter = !SC.none(layout[keys.center]),
764
+ hasSize = !SC.none(layout[keys.size]),
765
+ w;
450
766
 
451
- if (zoneX === HEAD_ZONE) {
452
- cursor = (zoneY === HEAD_ZONE) ? 'nw-resize' : (zoneY === TAIL_ZONE) ? 'sw-resize' : 'w-resize' ;
453
- } else if (zoneX === TAIL_ZONE) {
454
- cursor = (zoneY === HEAD_ZONE) ? 'ne-resize' : (zoneY === TAIL_ZONE) ? 'se-resize' : 'e-resize' ;
455
- } else {
456
- cursor = (zoneY === HEAD_ZONE) ? 'n-resize' : (zoneY === TAIL_ZONE) ? 's-resize' : null ;
767
+ if (info[keys.anchor] === headKey) {
768
+
769
+ // if left aligned, adjust left size and width if set.
770
+ if (hasHead) {
771
+ if (hasSize) {
772
+ w = layout[sizeKey];
773
+ ret[sizeKey] = Math.min(max, Math.max(min, Math.floor(layout[sizeKey] - delta)));
774
+ min = (layout[headKey]+w) - min;
775
+ max = (layout[headKey]+w) - max;
776
+
777
+ ret[headKey] = Math.max(max, Math.min(min, Math.floor(layout[headKey]+delta)));
778
+
779
+ } else {
780
+ ret[headKey] = Math.floor(layout[headKey]+delta);
781
+ }
782
+
783
+ // if right aligned or centered, adjust the width...
784
+ } else if (hasTail || hasCenter) {
785
+ if (hasCenter) delta *= 2;
786
+ ret[sizeKey] = Math.max(min, Math.min(max, Math.floor((layout[sizeKey]||0)-delta)));
787
+
788
+ // otherwise, adjust left
789
+ } else ret[headKey] = Math.floor((layout[headKey]||0)+delta);
790
+
791
+ } else if (info[keys.anchor] === tailKey) {
792
+
793
+ // reverse above
794
+ if (hasTail) {
795
+
796
+ if (hasSize) {
797
+ w = layout[sizeKey];
798
+ ret[sizeKey] = Math.min(max, Math.max(min, Math.floor(layout[sizeKey] + delta)));
799
+ min = (layout[tailKey]+w)-min;
800
+ max = (layout[tailKey]+w)-max;
801
+
802
+ ret[tailKey] = Math.max(max, Math.min(min, Math.floor(layout[tailKey]-delta)));
803
+
804
+ } else {
805
+ ret[tailKey] = Math.floor(layout[tailKey]-delta);
806
+ }
807
+
808
+ } else {
809
+ if (hasCenter) delta *= 2;
810
+ ret[sizeKey] = Math.max(min, Math.min(max, Math.floor((layout[sizeKey]||0)+delta)));
811
+ }
457
812
  }
813
+
814
+ return this;
815
+ },
816
+
817
+ _mouseReposition: function(evt, info, keys, ret) {
818
+ var delta = evt[keys.evtPoint] - info[keys.point],
819
+ layout = info[SC.keyFor('layout', SC.guidFor(this))],
820
+ view = this.get('view'),
821
+
822
+ headKey = keys.head,
823
+ tailKey = keys.tail,
824
+ centerKey = keys.center,
825
+ sizeKey = keys.size,
826
+
827
+ hasHead = !SC.none(layout[headKey]),
828
+ hasTail = !SC.none(layout[tailKey]),
829
+ hasCenter = !SC.none(layout[centerKey]),
830
+ hasSize = !SC.none(layout[sizeKey]),
831
+ w;
832
+
833
+ // auto-widths can't be repositioned
834
+ if (hasHead && hasTail && !hasSize) return NO ;
458
835
 
459
- // set cursor value...
460
- view.$().css('cursor', cursor) ;
836
+ // left/top aligned, just adjust top/left location
837
+ if (hasHead) {
838
+ ret[headKey] = layout[headKey]+delta;
839
+
840
+ // right/bottom aligned, adjust bottom/right location
841
+ } else if (hasTail) {
842
+ ret[tailKey] = layout[tailKey]-delta;
843
+
844
+ } else if (hasCenter) {
845
+ ret[centerKey] = layout[centerKey]+delta;
846
+
847
+ } else ret[headKey] = (layout[headKey]||0)+delta;
461
848
 
462
849
  return YES ;
463
850
  }
464
-
851
+
465
852
  }) ;
466
853
 
467
854
  // Set default Designer for view
@@ -475,6 +862,16 @@ if (!SC.View.Designer) SC.View.Designer = SC.ViewDesigner ;
475
862
 
476
863
  SC.ViewDesigner.mixin({
477
864
 
865
+ ANCHOR_LEFT: 0x0001,
866
+ ANCHOR_RIGHT: 0x0002,
867
+ ANCHOR_CENTERX: 0x0004,
868
+ ANCHOR_WIDTH: 0x0010,
869
+
870
+ ANCHOR_TOP: 0x0100,
871
+ ANCHOR_BOTTOM: 0x0200,
872
+ ANCHOR_CENTERY: 0x0400,
873
+ ANCHOR_HEIGHT: 0x1000,
874
+
478
875
  /**
479
876
  Invoked whenever a designed view is loaded. This will save the design
480
877
  attributes for later use by a designer.
@@ -528,6 +925,9 @@ SC.ViewDesigner.mixin({
528
925
 
529
926
  SC.View.prototype._orig_respondsTo = SC.View.prototype.respondsTo;
530
927
  SC.View.prototype._orig_tryToPerform = SC.View.prototype.tryToPerform;
928
+ SC.View.prototype._orig_createLayer = SC.View.prototype.createLayer;
929
+ SC.View.prototype._orig_updateLayer = SC.View.prototype.updateLayer;
930
+ SC.View.prototype._orig_destroyLayer = SC.View.prototype.destroyLayer;
531
931
 
532
932
  /**
533
933
  If the view has a designer, then patch respondsTo...
@@ -567,3 +967,33 @@ SC.View.prototype.tryToPerform = function(methodName, arg1, arg2) {
567
967
  return this._orig_tryToPerform(methodName, arg1, arg2);
568
968
  }
569
969
  };
970
+
971
+
972
+ /*
973
+ If the view has a designer, also call designers didCreateLayer method to
974
+ allow drawing.
975
+ */
976
+ SC.View.prototype.createLayer = function() {
977
+ var ret = this._orig_createLayer.apply(this, arguments);
978
+ if (this.designer) this.designer.didCreateLayer();
979
+ return ret ;
980
+ };
981
+
982
+ /*
983
+ If the view has a designer, also call the designer's didUpdateLayer method
984
+ to allow drawing.
985
+ */
986
+ SC.View.prototype.updateLayer = function() {
987
+ var ret = this._orig_updateLayer.apply(this, arguments);
988
+ if (this.designer) this.designer.didUpdateLayer();
989
+ return ret ;
990
+ };
991
+
992
+ /**
993
+ If the view has a designer, also call the designers willDestroyLayer
994
+ method.
995
+ */
996
+ SC.View.prototype.destroyLayer = function() {
997
+ if (this.designer) this.designer.willDestroyLayer();
998
+ return this._orig_destroyLayer.apply(this, arguments);
999
+ };