limelight 0.3.1-java → 0.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (235) hide show
  1. data/lib/init.rb +5 -2
  2. data/lib/limelight/animation.rb +2 -2
  3. data/lib/limelight/builtin/players/button.rb +1 -1
  4. data/lib/limelight/builtin/players/check_box.rb +1 -1
  5. data/lib/limelight/builtin/players/combo_box.rb +2 -4
  6. data/lib/limelight/builtin/players/combo_box_popup_list.rb +1 -1
  7. data/lib/limelight/builtin/players/combo_box_popup_list_item.rb +1 -1
  8. data/lib/limelight/builtin/players/curtains.rb +1 -1
  9. data/lib/limelight/builtin/players/image.rb +3 -0
  10. data/lib/limelight/builtin/players/password_box.rb +1 -1
  11. data/lib/limelight/builtin/players/radio_button.rb +1 -1
  12. data/lib/limelight/builtin/players/text_area.rb +1 -1
  13. data/lib/limelight/builtin/players/text_box.rb +1 -1
  14. data/lib/limelight/builtin/players.rb +1 -1
  15. data/lib/limelight/builtin/styles.rb +1 -1
  16. data/lib/limelight/builtin/utilities_production/alert/props.rb +5 -0
  17. data/lib/limelight/builtin/utilities_production/alert/styles.rb +7 -0
  18. data/lib/limelight/builtin/utilities_production/incompatible_version/props.rb +17 -0
  19. data/lib/limelight/builtin/utilities_production/incompatible_version/styles.rb +9 -0
  20. data/lib/limelight/builtin/utilities_production/production.rb +59 -0
  21. data/lib/limelight/builtin/utilities_production/stages.rb +9 -0
  22. data/lib/limelight/builtin/utilities_production/styles.rb +50 -0
  23. data/lib/limelight/button_group_cache.rb +1 -1
  24. data/lib/limelight/casting_director.rb +1 -1
  25. data/lib/limelight/client/playbills.rb +3 -0
  26. data/lib/limelight/commands/command.rb +13 -7
  27. data/lib/limelight/commands/create_command.rb +13 -8
  28. data/lib/limelight/commands/freeze_command.rb +3 -0
  29. data/lib/limelight/commands/help_command.rb +12 -1
  30. data/lib/limelight/commands/open_command.rb +11 -1
  31. data/lib/limelight/commands/pack_command.rb +1 -1
  32. data/lib/limelight/commands/unpack_command.rb +1 -1
  33. data/lib/limelight/commands/version_command.rb +1 -1
  34. data/lib/limelight/data.rb +4 -14
  35. data/lib/limelight/dsl/build_exception.rb +12 -8
  36. data/lib/limelight/dsl/menu_bar.rb +1 -1
  37. data/lib/limelight/dsl/production_builder.rb +1 -1
  38. data/lib/limelight/dsl/prop_builder.rb +2 -2
  39. data/lib/limelight/dsl/stage_builder.rb +3 -3
  40. data/lib/limelight/dsl/styles_builder.rb +2 -1
  41. data/lib/limelight/file_chooser.rb +1 -1
  42. data/lib/limelight/file_filter.rb +1 -1
  43. data/lib/limelight/file_loader.rb +1 -1
  44. data/lib/limelight/gems.rb +4 -0
  45. data/lib/limelight/java_couplings.rb +3 -2
  46. data/lib/limelight/java_util.rb +1 -1
  47. data/lib/limelight/limelight_exception.rb +1 -1
  48. data/lib/limelight/main.rb +1 -1
  49. data/lib/limelight/paint_action.rb +1 -1
  50. data/lib/limelight/pen.rb +1 -1
  51. data/lib/limelight/producer.rb +52 -37
  52. data/lib/limelight/production.rb +81 -43
  53. data/lib/limelight/prop.rb +32 -13
  54. data/lib/limelight/scene.rb +19 -14
  55. data/lib/limelight/specs/spec_helper.rb +55 -28
  56. data/lib/limelight/stage.rb +163 -23
  57. data/lib/limelight/string.rb +3 -0
  58. data/lib/limelight/studio.rb +143 -6
  59. data/lib/limelight/styles.rb +14 -1
  60. data/lib/limelight/templates/production_templater.rb +6 -2
  61. data/lib/limelight/templates/scene_templater.rb +12 -7
  62. data/lib/limelight/templates/sources/production/production.rb.template +46 -6
  63. data/lib/limelight/templates/sources/production/spec/spec_helper.rb.template +5 -0
  64. data/lib/limelight/templates/sources/scene_spec/scene_spec.rb.template +13 -0
  65. data/lib/limelight/templates/templater.rb +4 -1
  66. data/lib/limelight/templates/templater_logger.rb +3 -0
  67. data/lib/limelight/theater.rb +15 -6
  68. data/lib/limelight/util/downloader.rb +3 -1
  69. data/lib/limelight/util.rb +8 -7
  70. data/lib/limelight/version.rb +3 -3
  71. data/lib/limelight.jar +0 -0
  72. data/productions/examples/8thlight.com/about/props.rb +1 -1
  73. data/productions/examples/8thlight.com/about/styles.rb +1 -1
  74. data/productions/examples/8thlight.com/footer.rb +1 -1
  75. data/productions/examples/8thlight.com/home/props.rb +1 -1
  76. data/productions/examples/8thlight.com/home/styles.rb +1 -1
  77. data/productions/examples/8thlight.com/menu.rb +1 -1
  78. data/productions/examples/8thlight.com/services/props.rb +1 -1
  79. data/productions/examples/8thlight.com/services/styles.rb +1 -1
  80. data/productions/examples/8thlight.com/stages.rb +1 -1
  81. data/productions/examples/8thlight.com/styles.rb +1 -1
  82. data/productions/examples/calculator/players/button.rb +1 -1
  83. data/productions/examples/calculator/players/calculator.rb +1 -1
  84. data/productions/examples/calculator/players/calculator_model.rb +1 -1
  85. data/productions/examples/calculator/props.rb +1 -1
  86. data/productions/examples/calculator/styles.rb +1 -1
  87. data/productions/examples/langstons_ant/init.rb +3 -0
  88. data/productions/examples/langstons_ant/players/ant.rb +1 -1
  89. data/productions/examples/langstons_ant/players/log.rb +1 -1
  90. data/productions/examples/langstons_ant/players/start_stop_button.rb +1 -1
  91. data/productions/examples/langstons_ant/players/world.rb +1 -1
  92. data/productions/examples/langstons_ant/props.rb +1 -1
  93. data/productions/examples/langstons_ant/styles.rb +1 -1
  94. data/productions/examples/sandbox/alerts/incompatible_production/default_scene/props.rb +7 -0
  95. data/productions/examples/sandbox/alerts/incompatible_production/default_scene/styles.rb +29 -0
  96. data/productions/examples/sandbox/alerts/incompatible_production/production.rb +49 -0
  97. data/productions/examples/sandbox/alerts/incompatible_production/spec/default_scene/default_scene_spec.rb +13 -0
  98. data/productions/examples/sandbox/alerts/incompatible_production/spec/spec_helper.rb +5 -0
  99. data/productions/examples/sandbox/alerts/incompatible_production/stages.rb +17 -0
  100. data/productions/examples/sandbox/alerts/incompatible_production/styles.rb +12 -0
  101. data/productions/examples/sandbox/alerts/players/alerts.rb +14 -0
  102. data/productions/examples/sandbox/alerts/props.rb +7 -0
  103. data/productions/examples/sandbox/alerts/styles.rb +43 -0
  104. data/productions/examples/sandbox/background_images/props.rb +19 -0
  105. data/productions/examples/sandbox/background_images/styles.rb +40 -0
  106. data/productions/examples/sandbox/click_me/players/chromaton.rb +1 -1
  107. data/productions/examples/sandbox/click_me/props.rb +1 -1
  108. data/productions/examples/sandbox/click_me/styles.rb +1 -1
  109. data/productions/examples/sandbox/floaters/players/floater.rb +9 -5
  110. data/productions/examples/sandbox/floaters/players/surface.rb +1 -1
  111. data/productions/examples/sandbox/floaters/props.rb +1 -1
  112. data/productions/examples/sandbox/floaters/styles.rb +13 -13
  113. data/productions/examples/sandbox/frameing/players/sandbox.rb +3 -0
  114. data/productions/examples/sandbox/frameing/props.rb +3 -0
  115. data/productions/examples/sandbox/frameing/styles.rb +3 -0
  116. data/productions/examples/sandbox/gradients/players/spinner.rb +1 -1
  117. data/productions/examples/sandbox/gradients/players/teaser.rb +1 -1
  118. data/productions/examples/sandbox/gradients/players/wave.rb +1 -1
  119. data/productions/examples/sandbox/gradients/players/waves.rb +1 -1
  120. data/productions/examples/sandbox/gradients/props.rb +1 -1
  121. data/productions/examples/sandbox/gradients/styles.rb +1 -1
  122. data/productions/examples/sandbox/header.rb +4 -1
  123. data/productions/examples/sandbox/homer/players/homer.rb +1 -1
  124. data/productions/examples/sandbox/homer/props.rb +1 -1
  125. data/productions/examples/sandbox/homer/styles.rb +2 -2
  126. data/productions/examples/sandbox/images/space.png +0 -0
  127. data/productions/examples/sandbox/images_scene/props.rb +3 -0
  128. data/productions/examples/sandbox/images_scene/styles.rb +3 -0
  129. data/productions/examples/sandbox/inputs/players/button_input.rb +1 -1
  130. data/productions/examples/sandbox/inputs/players/check_box_input.rb +1 -1
  131. data/productions/examples/sandbox/inputs/players/combo_box_input.rb +1 -1
  132. data/productions/examples/sandbox/inputs/players/radio_button_input.rb +1 -1
  133. data/productions/examples/sandbox/inputs/players/text_area_input.rb +1 -1
  134. data/productions/examples/sandbox/inputs/players/text_box_input.rb +1 -1
  135. data/productions/examples/sandbox/inputs/props.rb +1 -1
  136. data/productions/examples/sandbox/inputs/styles.rb +1 -1
  137. data/productions/examples/sandbox/kiosk/players/kiosk.rb +36 -0
  138. data/productions/examples/sandbox/kiosk/props.rb +6 -0
  139. data/productions/examples/sandbox/kiosk/styles.rb +34 -0
  140. data/productions/examples/sandbox/players/sandbox.rb +1 -1
  141. data/productions/examples/sandbox/rounded_corners/players/box.rb +1 -1
  142. data/productions/examples/sandbox/rounded_corners/props.rb +1 -1
  143. data/productions/examples/sandbox/rounded_corners/styles.rb +1 -1
  144. data/productions/examples/sandbox/scrolling/players/add_button.rb +1 -1
  145. data/productions/examples/sandbox/scrolling/players/cell.rb +1 -1
  146. data/productions/examples/sandbox/scrolling/props.rb +1 -1
  147. data/productions/examples/sandbox/scrolling/styles.rb +1 -1
  148. data/productions/examples/sandbox/sketching/players/sketchpad.rb +1 -1
  149. data/productions/examples/sandbox/sketching/props.rb +1 -1
  150. data/productions/examples/sandbox/sketching/styles.rb +1 -1
  151. data/productions/examples/sandbox/sounds/players/clip.rb +1 -1
  152. data/productions/examples/sandbox/sounds/props.rb +1 -1
  153. data/productions/examples/sandbox/sounds/styles.rb +1 -1
  154. data/productions/examples/sandbox/spec/alerts/alerts_spec.rb +13 -0
  155. data/productions/examples/sandbox/stages.rb +2 -1
  156. data/productions/examples/sandbox/styles.rb +1 -1
  157. data/productions/examples/sandbox/teaser/players/fader.rb +1 -1
  158. data/productions/examples/sandbox/teaser/props.rb +1 -1
  159. data/productions/examples/sandbox/teaser/styles.rb +1 -1
  160. data/productions/examples/tutorials/tutorial_1/players/sample.rb +1 -1
  161. data/productions/examples/tutorials/tutorial_1/props.rb +1 -1
  162. data/productions/examples/tutorials/tutorial_1/styles.rb +1 -1
  163. data/productions/stage_composer/init.rb +1 -1
  164. data/productions/stage_composer/inspector/players/inspector.rb +1 -1
  165. data/productions/stage_composer/inspector/players/prop_row.rb +1 -1
  166. data/productions/stage_composer/inspector/players/prop_tree.rb +1 -1
  167. data/productions/stage_composer/inspector/players/style_table.rb +1 -1
  168. data/productions/stage_composer/inspector/players/style_value.rb +1 -1
  169. data/productions/stage_composer/inspector/props.rb +1 -1
  170. data/productions/stage_composer/inspector/styles.rb +1 -1
  171. data/productions/stage_composer/lib/init.rb +1 -1
  172. data/productions/stage_composer/lib/limelight/composer/controller.rb +1 -1
  173. data/productions/stage_composer/lib/limelight/composer/lethargy.rb +1 -1
  174. data/productions/stage_composer/production.rb +1 -1
  175. data/productions/stage_composer/stages.rb +1 -1
  176. data/productions/startup/production.rb +49 -0
  177. data/productions/startup/spec/default_scene/default_scene_spec.rb +13 -0
  178. data/productions/startup/spec/spec_helper.rb +5 -0
  179. data/productions/startup/stages.rb +5 -2
  180. data/productions/startup/styles.rb +12 -0
  181. data/productions/startup/welcome/players/browse_button.rb +1 -1
  182. data/productions/startup/welcome/players/download_button.rb +1 -1
  183. data/productions/startup/welcome/players/sandbox_button.rb +1 -1
  184. data/productions/startup/welcome/props.rb +2 -2
  185. data/productions/startup/welcome/styles.rb +1 -1
  186. data/spec/builtin/players/button_spec.rb +1 -1
  187. data/spec/builtin/players/check_box_spec.rb +1 -1
  188. data/spec/builtin/players/combo_box_spec.rb +1 -1
  189. data/spec/builtin/players/image_spec.rb +3 -0
  190. data/spec/builtin/players/password_box_spec.rb +1 -1
  191. data/spec/builtin/players/radio_button_spec.rb +7 -7
  192. data/spec/builtin/players/text_area_spec.rb +1 -1
  193. data/spec/builtin/players/text_box_spec.rb +1 -1
  194. data/spec/builtin/utilities_production/spec_helper.rb +4 -0
  195. data/spec/builtin/utilities_production/utilities_production_spec.rb +143 -0
  196. data/spec/casting_director_spec.rb +7 -7
  197. data/spec/client/playbills_spec.rb +3 -0
  198. data/spec/commands/command_spec.rb +9 -1
  199. data/spec/commands/create_command_spec.rb +35 -5
  200. data/spec/commands/freeze_command_spec.rb +3 -0
  201. data/spec/commands/help_command_spec.rb +6 -3
  202. data/spec/commands/open_command_spec.rb +24 -2
  203. data/spec/commands/pack_command_spec.rb +3 -0
  204. data/spec/commands/unpack_command_spec.rb +4 -1
  205. data/spec/data_spec.rb +5 -16
  206. data/spec/dsl/production_builder_spec.rb +1 -1
  207. data/spec/dsl/prop_builder_spec.rb +19 -19
  208. data/spec/dsl/stage_builder_spec.rb +1 -1
  209. data/spec/dsl/styles_builder_spec.rb +1 -1
  210. data/spec/file_chooser_spec.rb +1 -1
  211. data/spec/file_filter_spec.rb +1 -1
  212. data/spec/file_loader_spec.rb +1 -1
  213. data/spec/gems_spec.rb +3 -0
  214. data/spec/java_util_spec.rb +1 -1
  215. data/spec/main_spec.rb +4 -1
  216. data/spec/paint_action_spec.rb +1 -1
  217. data/spec/pen_spec.rb +1 -1
  218. data/spec/producer_spec.rb +73 -32
  219. data/spec/production_spec.rb +23 -44
  220. data/spec/prop_spec.rb +102 -64
  221. data/spec/scene_spec.rb +3 -3
  222. data/spec/spec_helper.rb +3 -2
  223. data/spec/stage_spec.rb +172 -36
  224. data/spec/string_spec.rb +3 -0
  225. data/spec/studio_spec.rb +131 -3
  226. data/spec/styles_spec.rb +3 -0
  227. data/spec/templates/production_templater_spec.rb +12 -1
  228. data/spec/templates/scene_templater_spec.rb +17 -2
  229. data/spec/templates/templater_logger_spec.rb +3 -0
  230. data/spec/templates/templater_spec.rb +3 -0
  231. data/spec/theater_spec.rb +16 -1
  232. data/spec/util/downloader_spec.rb +3 -0
  233. metadata +56 -6
  234. data/lib/i4jruntime.jar +0 -0
  235. data/lib/junit-4.4.jar +0 -0
@@ -1,4 +1,4 @@
1
- #- Copyright 2008 8th Light, Inc. All Rights Reserved.
1
+ #- Copyright 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  module Limelight
@@ -1,4 +1,4 @@
1
- #- Copyright 2008 8th Light, Inc. All Rights Reserved.
1
+ #- Copyright 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  module Limelight
@@ -1,3 +1,6 @@
1
+ #- Copyright � 2008-2009 8th Light, Inc. All Rights Reserved.
2
+ #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
+
1
4
  module Limelight
2
5
  module Gems
3
6
 
@@ -17,6 +20,7 @@ module Limelight
17
20
  end
18
21
  end
19
22
 
23
+ #TODO - MDM - This doesn't work when loading gems like: gem 'gem_name'. Need make use of Gem::SourceIndex. See SourceIndex.load_gems_in
20
24
  def install_gems_in_production(production)
21
25
  self.current_production = production
22
26
 
@@ -1,4 +1,4 @@
1
- #- Copyright 2008 8th Light, Inc. All Rights Reserved.
1
+ #- Copyright 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  module Limelight #:nodoc:
@@ -20,6 +20,7 @@ module Limelight #:nodoc:
20
20
 
21
21
  module Util #:nodoc:
22
22
  Colors = Java::limelight.util.Colors
23
+ Version = Java::limelight.util.Version
23
24
  end
24
25
 
25
26
  module UI #:nodoc:
@@ -27,7 +28,7 @@ module Limelight #:nodoc:
27
28
  ButtonGroupCache = Java::limelight.ui.ButtonGroupCache
28
29
 
29
30
  module Model #:nodoc:
30
- Frame = Java::limelight.ui.model.Frame
31
+ Frame = Java::limelight.ui.model.StageFrame
31
32
  Panel = Java::limelight.ui.model.PropPanel
32
33
  ImagePanel = Java::limelight.ui.model.ImagePanel
33
34
 
@@ -1,4 +1,4 @@
1
- #- Copyright 2008 8th Light, Inc. All Rights Reserved.
1
+ #- Copyright 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  require 'limelight/string'
@@ -1,4 +1,4 @@
1
- #- Copyright 2008 8th Light, Inc. All Rights Reserved.
1
+ #- Copyright 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  module Limelight
@@ -1,4 +1,4 @@
1
- #- Copyright 2008 8th Light, Inc. All Rights Reserved.
1
+ #- Copyright 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  require 'limelight/commands/command'
@@ -1,4 +1,4 @@
1
- #- Copyright 2008 8th Light, Inc. All Rights Reserved.
1
+ #- Copyright 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  require 'limelight/pen'
data/lib/limelight/pen.rb CHANGED
@@ -1,4 +1,4 @@
1
- #- Copyright 2008 8th Light, Inc. All Rights Reserved.
1
+ #- Copyright 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  module Limelight
@@ -1,4 +1,4 @@
1
- #- Copyright 2008 8th Light, Inc. All Rights Reserved.
1
+ #- Copyright 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  require 'limelight/file_loader'
@@ -13,6 +13,7 @@ require 'limelight/theater'
13
13
  require 'limelight/production'
14
14
  require 'limelight/gems'
15
15
  require 'limelight/util/downloader'
16
+ require 'limelight/version'
16
17
 
17
18
  module Limelight
18
19
 
@@ -25,12 +26,17 @@ module Limelight
25
26
 
26
27
  # Creates a new Producer and has it open a Production by specified name.
27
28
  #
28
- def self.open(production_name)
29
+ def self.open(production_name, options={})
29
30
  producer = new(production_name)
30
- producer.open
31
+ begin
32
+ producer.open(options)
33
+ rescue Exception => e
34
+ puts e
35
+ puts e.backtrace
36
+ end
31
37
  end
32
38
 
33
- attr_reader :loader, :theater, :production
39
+ attr_reader :theater, :production
34
40
  attr_writer :builtin_styles
35
41
 
36
42
  # A Production name, or root directory, must be provided. If not Theater is provided, one will be created.
@@ -45,49 +51,60 @@ module Limelight
45
51
  root_path = unpack_production(root_path)
46
52
  end
47
53
  @production = production || Production.new(root_path)
48
- @loader = @production.root
49
54
  @theater = theater.nil? ? Theater.new : theater
55
+ establish_production
56
+ end
57
+
58
+ # Returns true if the production's minimum_limelight_version is compatible with the current version.
59
+ #
60
+ def version_compatible?
61
+ current_version = Limelight::Util::Version.new(Limelight::VERSION::STRING)
62
+ required_version = Limelight::Util::Version.new(@production.minimum_limelight_version)
63
+ return required_version.is_less_than_or_equal(current_version)
50
64
  end
51
65
 
52
66
  # Returns the CastingDirector for this Production.
53
67
  #
54
68
  def casting_director
55
- @casting_director = CastingDirector.new(loader) if not @casting_director
69
+ @casting_director = CastingDirector.new(@production.root) if not @casting_director
56
70
  return @casting_director
57
71
  end
58
72
 
59
73
  # Loads the Production without opening it. The Production will be created into memory with all it's stages
60
74
  #
61
75
  def load(options = {})
62
- establish_production
63
- Gems.install_gems_in_production(@production)
76
+ Gems.install_gems_in_production(@production)
64
77
  Kernel.load(@production.init_file) if ( !options[:ignore_init] && File.exists?(@production.init_file) )
65
78
  load_stages if File.exists?(@production.stages_file)
66
79
  end
67
80
 
68
81
  # Opens the Production.
69
82
  #
70
- def open()
83
+ def open(options = {})
84
+ return unless version_compatible? || Studio.utilities_production.proceed_with_incompatible_version?(@production.name, @production.minimum_limelight_version)
85
+ @production.production_opening
71
86
  load
87
+ @production.production_loaded
72
88
  if @theater.has_stages?
73
- @theater.stages.each { |stage| open_scene(stage.default_scene, stage) if stage.default_scene }
74
- else
75
- open_scene(:root, @theater.default_stage)
89
+ @theater.stages.each do |stage|
90
+ open_scene(stage.default_scene.to_s, stage) if stage.default_scene
91
+ end
92
+ elsif @production.default_scene
93
+ open_scene(@production.default_scene, @theater.default_stage)
76
94
  end
77
95
  @casting_director = nil
96
+ @production.production_opened
78
97
  end
79
98
 
80
99
  # Opens the specified Scene onto the Spcified Stage.
81
100
  #
82
- def open_scene(name, stage)
101
+ def open_scene(name, stage, options={})
83
102
  path = @production.scene_directory(name)
84
103
  scene_name = File.basename(path)
85
- scene = load_props(:production => @production, :casting_director => casting_director, :path => path, :name => scene_name)
86
-
104
+ scene = load_props(options.merge(:production => @production, :casting_director => casting_director, :path => path, :name => scene_name))
87
105
  styles = load_styles(scene)
88
106
  merge_with_root_styles(styles)
89
107
  scene.styles = styles
90
-
91
108
  stage.open(scene)
92
109
  return scene
93
110
  end
@@ -114,7 +131,7 @@ module Limelight
114
131
  if File.exists?(scene.props_file)
115
132
  content = IO.read(scene.props_file)
116
133
  options[:build_loader] = @production.root
117
- return Limelight.build_scene(scene, options) do
134
+ return Limelight.build_props(scene, options) do
118
135
  begin
119
136
  eval content
120
137
  rescue Exception => e
@@ -141,25 +158,6 @@ module Limelight
141
158
  end
142
159
  end
143
160
 
144
- # Loads the 'production.rb' file if it exists and configures the Production.
145
- #
146
- def establish_production
147
- @production.producer = self
148
- @production.theater = @theater
149
-
150
- if @production.root.exists?("production.rb")
151
- content = @production.root.load("production.rb")
152
- @production = Limelight.build_production(@production) do
153
- begin
154
- eval content
155
- rescue Exception => e
156
- raise DSL::BuildException.new("production.rb", content, e)
157
- end
158
- end
159
- end
160
-
161
- end
162
-
163
161
  # A production with multiple Scenes may have a 'styles.rb' file in the root directory. This is called the
164
162
  # root_style. This method loads the root_styles, if they haven't already been loaded, and returns them.
165
163
  #
@@ -189,6 +187,21 @@ module Limelight
189
187
  return @builtin_styles.dup
190
188
  end
191
189
 
190
+ def establish_production #:nodoc:
191
+ @production.producer = self
192
+ @production.theater = @theater
193
+
194
+ production_file = @production.production_file
195
+ if File.exists?(production_file)
196
+ tmp_module = Module.new
197
+ content = IO.read(production_file)
198
+ tmp_module.module_eval(content, production_file)
199
+ production_module = tmp_module.const_get("Production")
200
+ raise "production.rb should define a module named 'Production'" if production_module.nil?
201
+ @production.extend(production_module)
202
+ end
203
+ end
204
+
192
205
  private ###############################################
193
206
 
194
207
  def merge_with_root_styles(styles)
@@ -199,7 +212,9 @@ module Limelight
199
212
 
200
213
  def unpack_production(production_name)
201
214
  packer = Limelight::Util::Packer.new()
202
- return packer.unpack(production_name)
215
+ dest_dir = File.join(Data.productions_dir, rand.to_s.sub("0.", ""))
216
+ Dir.mkdir(dest_dir)
217
+ return packer.unpack(production_name, dest_dir)
203
218
  end
204
219
 
205
220
  end
@@ -1,8 +1,10 @@
1
- #- Copyright 2008 8th Light, Inc. All Rights Reserved.
1
+ #- Copyright 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  require 'limelight/limelight_exception'
5
5
  require 'limelight/file_loader'
6
+ require 'limelight/studio'
7
+ require 'drb'
6
8
 
7
9
  module Limelight
8
10
 
@@ -12,60 +14,29 @@ module Limelight
12
14
  # Productions are configured, and attributes are added, by the ProductionBuilder.
13
15
  #
14
16
  class Production
15
-
17
+
16
18
  class << self
17
-
18
- def index(production) #:nodoc:
19
- @index = [] if @index.nil?
20
- if production.name.nil?
21
- assign_name_to(production)
22
- else
23
- error_if_duplicate_name(production.name)
24
- end
25
- @index << production
26
- end
27
-
19
+
28
20
  def [](name) #:nodoc:
29
- return nil if @index.nil?
30
- return @index.find { |production| production.name == name }
31
- end
32
-
33
- def assign_name_to(production) #:nodoc:
34
- count = @index.length + 1
35
- while name_taken?(count.to_s)
36
- count += 1
37
- end
38
- production.name = count.to_s
39
- end
40
-
41
- def name_taken?(name) #:nodoc:
42
- return self[name] != nil
21
+ return Studio[name]
43
22
  end
44
23
 
45
- def clear_index #:nodoc:
46
- @index = []
47
- end
48
-
49
- def error_if_duplicate_name(name) #:nodoc:
50
- raise Limelight::LimelightException.new("Production name '#{name}' is already taken") if name_taken?(name)
51
- end
52
-
53
24
  end
54
-
55
- attr_reader :name, :root
25
+
26
+ attr_reader :name, :root
56
27
  attr_accessor :producer, :theater
57
28
 
58
29
  # Users typically need not create Production objects.
59
30
  #
60
- def initialize(path)
31
+ def initialize(path)
61
32
  @root = FileLoader.for_root(path)
62
- self.class.index(self)
33
+ @name = File.basename(path)
63
34
  end
64
35
 
65
36
  # Sets the name of the Production. The name must be unique amongst all Productions in memory.
66
37
  #
67
38
  def name=(value)
68
- self.class.error_if_duplicate_name(value)
39
+ Studio.error_if_duplicate_name(value)
69
40
  @name = value
70
41
  end
71
42
 
@@ -81,6 +52,12 @@ module Limelight
81
52
  return @root.path_to("init.rb")
82
53
  end
83
54
 
55
+ # Returns the path to the production's production.rb file
56
+ #
57
+ def production_file
58
+ return @root.path_to("production.rb")
59
+ end
60
+
84
61
  # Returns the path to the production's stages file
85
62
  #
86
63
  def stages_file
@@ -103,9 +80,70 @@ module Limelight
103
80
  #
104
81
  def scene_directory(name)
105
82
  return @root.root if name == :root
106
- return @root.path_to(name)
83
+ return @root.path_to(name)
84
+ end
85
+
86
+ # Returns the minimum version of limelight required to run this production. Default: "0.0.0"
87
+ # If the version of limelight used to open this production is less than the minimum,
88
+ # an error will be displayed (starting with version 0.4.0).
89
+ #
90
+ def minimum_limelight_version
91
+ return "0.0.0"
92
+ end
93
+
94
+ # Returns true if the production allows itself to be closed. The system will call this methods when
95
+ # it wishes to close the production, perhaps when the user quits the application. By default the production
96
+ # will always return true.
97
+ #
98
+ def allow_close?
99
+ return true
100
+ end
101
+
102
+ # Called when the production is about to be opened. The default implementation does nothing but you may re-implement
103
+ # it in the production.rb file.
104
+ #
105
+ def production_opening
107
106
  end
108
-
107
+
108
+ # Called when the production has been loaded. That is, when all the gems have been loaded stages have been
109
+ # instantiated.
110
+ #
111
+ def production_loaded
112
+ end
113
+
114
+ # Called when the production is fully opened. The default implementation does nothing but you may re-implement
115
+ # it in the production.rb file.
116
+ #
117
+ def production_opened
118
+ end
119
+
120
+ # Called when the production is about to be closed. The default implementation does nothing but you may re-implement
121
+ # it in the production.rb file.
122
+ #
123
+ def production_closing
124
+ end
125
+
126
+ # Called when the production is fully closed. The default implementation does nothing but you may re-implement
127
+ # it in the production.rb file.
128
+ #
129
+ def production_closed
130
+ end
131
+
132
+ # Closes the production. If there are no more productions open, the Limelight runtime will shutdown.
133
+ #
134
+ def close
135
+ self.production_closing
136
+ Studio.production_closed(self)
137
+ self.production_closed
138
+ end
139
+
140
+ # Returned the name of the default scene. This is only used when there are not stages defined in the production.
141
+ # Defaults to :root, the production's root directory is the default scene. Return nil if there are not defaults.
142
+ #
143
+ def default_scene
144
+ return :root
145
+ end
146
+
109
147
  end
110
-
148
+
111
149
  end
@@ -1,4 +1,4 @@
1
- #- Copyright 2008 8th Light, Inc. All Rights Reserved.
1
+ #- Copyright 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  require 'limelight/java_util'
@@ -30,6 +30,8 @@ module Limelight
30
30
  end
31
31
 
32
32
  def event2(event_symbol)
33
+ @events ||= []
34
+ @events << event_symbol unless @events.include?(event_symbol)
33
35
  define_method("accepts_#{event_symbol}".to_sym) { return self.respond_to?(event_symbol) }
34
36
  end
35
37
 
@@ -37,8 +39,9 @@ module Limelight
37
39
 
38
40
  include UI::Api::Prop
39
41
 
42
+ attr_accessor :style, :hover_style
40
43
  attr_reader :panel #:nodoc:
41
- attr_reader :style, :hover_style, :children, :parent, :name, :id, :players
44
+ attr_reader :children, :parent, :name, :id, :players
42
45
  getters :panel, :style, :hover_style, :name, :scene, :loader #:nodoc:
43
46
 
44
47
  # When creating a Prop, an optional Hash is accepted. These are called initialization options.
@@ -108,7 +111,10 @@ module Limelight
108
111
  # Injects the behavior of the specified Player into the Prop. The Player must be a Module.
109
112
  #
110
113
  def include_player(player_module)
111
- extend player_module unless self.is_a?(player_module)
114
+ unless self.is_a?(player_module)
115
+ extend player_module
116
+ self.casted if player_module.instance_methods.include?("casted")
117
+ end
112
118
  end
113
119
 
114
120
  def update #:nodoc:
@@ -145,7 +151,7 @@ module Limelight
145
151
  # Sets the text of this Prop. If a prop is given text, it will become sterilized (it may not have any more children).
146
152
  # Some Players such as text_box, will cause the text to appear in the text_box.
147
153
  #
148
- def text=(value)
154
+ def text=(value)
149
155
  @panel.text = value.to_s
150
156
  end
151
157
 
@@ -219,13 +225,6 @@ module Limelight
219
225
  return Pen.new(panel.getGraphics)
220
226
  end
221
227
 
222
- # Plays a sound on the computers audio output. The parameter is the filename of a .au sound file.
223
- # This filename should relative to the root directory of the current Production, or an absolute path.
224
- #
225
- def play_sound(filename)
226
- @panel.play_sound(scene.loader.path_to(filename))
227
- end
228
-
229
228
  # Initiate an animation loop. Options may include :name (string), :updates_per_second (int: defaults to 60)
230
229
  # An Animation object is returned.
231
230
  # The provided block will be invoked :updates_per_second times per second until the Animation is stopped.
@@ -243,8 +242,28 @@ module Limelight
243
242
  return animation
244
243
  end
245
244
 
245
+ # Plays a sound on the computers audio output. The parameter is the filename of a .au sound file.
246
+ # This filename should relative to the root directory of the current Production, or an absolute path.
247
+ #
248
+ def play_sound(filename)
249
+ @panel.play_sound(scene.loader.path_to(filename))
250
+ end
251
+
252
+ # Luanches the spcified URL using the OS's default handlers. For example, opening a URL in a browser:
253
+ #
254
+ # launch('http://www.google.com')
255
+ #
256
+ # To create a link prop add an accessor on the player (say url) and use that in the prop definition
257
+ # Ex:
258
+ #
259
+ # link :text => "I am a link", :url => "http://www.8thlight.com"
260
+ def launch(url)
261
+ Context.instance.os.launch(url)
262
+ end
263
+
246
264
  # GUI Events ##########################################
247
265
 
266
+ # TODO MDM - This may be very inefficient. If seems like these methods are generated for each instance of prop.
248
267
  event2 :mouse_clicked
249
268
  event :mouse_entered
250
269
  event :mouse_exited
@@ -285,7 +304,7 @@ module Limelight
285
304
 
286
305
  def illuminated? #:nodoc:
287
306
  return @illuminated
288
- end
307
+ end
289
308
 
290
309
  private ###############################################
291
310
 
@@ -310,7 +329,7 @@ module Limelight
310
329
 
311
330
  def is_event_setter(symbol)
312
331
  string_value = symbol.to_s
313
- return string_value[0..2] == "on_" and self.events.include?(string_value[3..-1].to_sym)
332
+ return string_value[0..2] == "on_" && self.class.events.include?(string_value[3..-1].to_sym)
314
333
  end
315
334
 
316
335
  def define_event(symbol, value)
@@ -1,4 +1,4 @@
1
- #- Copyright 2008 8th Light, Inc. All Rights Reserved.
1
+ #- Copyright 2008-2009 8th Light, Inc. All Rights Reserved.
2
2
  #- Limelight and all included source files are distributed under terms of the GNU LGPL.
3
3
 
4
4
  require 'limelight/java_util'
@@ -7,13 +7,13 @@ require 'limelight/button_group_cache'
7
7
  require 'limelight/limelight_exception'
8
8
  require 'limelight/file_loader'
9
9
 
10
+
10
11
  module Limelight
11
12
 
12
13
  # A Scene is a root Prop. Scenes may be loaded onto a Stage. In addition to being a Prop object, Scenes have a
13
14
  # few extra attributes and behaviors.
14
15
  #
15
- class Scene < Prop
16
-
16
+ class Scene < Prop
17
17
  include UI::Api::Scene
18
18
 
19
19
  attr_reader :button_groups, :casting_director, :cast
@@ -22,6 +22,8 @@ module Limelight
22
22
  setters :stage
23
23
  event :scene_opened
24
24
 
25
+ alias :visible? :visible
26
+
25
27
  def initialize(options={})
26
28
  path = options.delete(:path) || ""
27
29
  @root = FileLoader.for_root(path)
@@ -86,8 +88,7 @@ module Limelight
86
88
  # Creates a new Producer to open the specified Production.
87
89
  #
88
90
  def open_production(production_path)
89
- producer = Producer.new(production_path, @production.theater)
90
- producer.open
91
+ Thread.new { Studio.open(production_path) }
91
92
  end
92
93
 
93
94
  # Opens the specified Scene on the Stage currently occupied by this Scene.
@@ -112,13 +113,7 @@ module Limelight
112
113
  # Removed the Prop from the index.
113
114
  #
114
115
  def unindex_prop(prop)
115
- prop.children.each do |child|
116
- if child.children.empty?
117
- @prop_index.delete(child.id)
118
- else
119
- unindex_prop(child)
120
- end
121
- end
116
+ unindex_child_props(prop)
122
117
  @prop_index.delete(prop.id) if prop.id
123
118
  end
124
119
 
@@ -127,7 +122,7 @@ module Limelight
127
122
  def find(id)
128
123
  return @prop_index[id.to_s]
129
124
  end
130
-
125
+
131
126
  def illuminate #:nodoc:
132
127
  @styles = @options.has_key?(:styles) ? @options.delete(:styles) : (@styles || {})
133
128
  @casting_director = @options.delete(:casting_director) if @options.has_key?(:casting_director)
@@ -136,7 +131,17 @@ module Limelight
136
131
  end
137
132
 
138
133
  private ###############################################
139
-
134
+
135
+ def unindex_child_props(prop)
136
+ prop.children.each do |child|
137
+ if child.children.empty?
138
+ @prop_index.delete(child.id)
139
+ else
140
+ unindex_prop(child)
141
+ end
142
+ end
143
+ end
144
+
140
145
  def reload
141
146
  load(File.basename(path))
142
147
  end