limelight 0.4.0-java → 0.5.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. data/lib/limelight.jar +0 -0
  2. data/lib/limelight/animation.rb +4 -3
  3. data/lib/limelight/builtin/players.rb +3 -1
  4. data/lib/limelight/builtin/players/image.rb +4 -0
  5. data/lib/limelight/builtin/players/stage_mover.rb +31 -0
  6. data/lib/limelight/builtin/players/stage_sizer.rb +34 -0
  7. data/lib/limelight/builtin/utilities_production/alert/players/alert.rb +11 -0
  8. data/lib/limelight/builtin/utilities_production/alert/props.rb +3 -0
  9. data/lib/limelight/builtin/utilities_production/alert/styles.rb +7 -0
  10. data/lib/limelight/builtin/utilities_production/incompatible_version/props.rb +3 -0
  11. data/lib/limelight/builtin/utilities_production/incompatible_version/styles.rb +3 -0
  12. data/lib/limelight/builtin/utilities_production/production.rb +3 -0
  13. data/lib/limelight/builtin/utilities_production/stages.rb +3 -0
  14. data/lib/limelight/builtin/utilities_production/styles.rb +3 -0
  15. data/lib/limelight/casting_director.rb +1 -1
  16. data/lib/limelight/commands/create_command.rb +33 -19
  17. data/lib/limelight/commands/freeze_command.rb +20 -5
  18. data/lib/limelight/commands/open_command.rb +2 -1
  19. data/lib/limelight/dsl/styles_builder.rb +40 -18
  20. data/lib/limelight/file_loader.rb +1 -1
  21. data/lib/limelight/gems.rb +3 -1
  22. data/lib/limelight/java_couplings.rb +1 -0
  23. data/lib/limelight/producer.rb +4 -47
  24. data/lib/limelight/production.rb +20 -0
  25. data/lib/limelight/prop.rb +32 -32
  26. data/lib/limelight/scene.rb +2 -1
  27. data/lib/limelight/specs/spec_helper.rb +24 -22
  28. data/lib/limelight/specs/test_scene_opener.rb +60 -0
  29. data/lib/limelight/string.rb +1 -1
  30. data/lib/limelight/studio.rb +28 -9
  31. data/lib/limelight/templates/production_templater.rb +5 -2
  32. data/lib/limelight/templates/scene_templater.rb +7 -6
  33. data/lib/limelight/templates/sources/production/production.rb.template +1 -1
  34. data/lib/limelight/templates/sources/production/spec/spec_helper.rb.template +8 -1
  35. data/lib/limelight/version.rb +1 -1
  36. data/productions/examples/sandbox/alerts/incompatible_production/default_scene/props.rb +3 -0
  37. data/productions/examples/sandbox/alerts/incompatible_production/default_scene/styles.rb +3 -0
  38. data/productions/examples/sandbox/alerts/incompatible_production/production.rb +3 -0
  39. data/productions/examples/sandbox/alerts/incompatible_production/spec/default_scene/default_scene_spec.rb +3 -0
  40. data/productions/examples/sandbox/alerts/incompatible_production/spec/spec_helper.rb +3 -0
  41. data/productions/examples/sandbox/alerts/incompatible_production/stages.rb +3 -0
  42. data/productions/examples/sandbox/alerts/incompatible_production/styles.rb +3 -0
  43. data/productions/examples/sandbox/alerts/players/alerts.rb +3 -0
  44. data/productions/examples/sandbox/alerts/props.rb +3 -0
  45. data/productions/examples/sandbox/alerts/styles.rb +3 -0
  46. data/productions/examples/sandbox/background_images/props.rb +3 -0
  47. data/productions/examples/sandbox/header.rb +1 -0
  48. data/productions/examples/sandbox/images_scene/props.rb +8 -0
  49. data/productions/examples/sandbox/kiosk/players/kiosk.rb +3 -0
  50. data/productions/examples/sandbox/kiosk/props.rb +3 -0
  51. data/productions/examples/sandbox/kiosk/styles.rb +3 -0
  52. data/productions/examples/sandbox/spec/alerts/alerts_spec.rb +3 -0
  53. data/productions/examples/sandbox/stage_handles/players/sizer.rb +35 -0
  54. data/productions/examples/sandbox/stage_handles/props.rb +17 -0
  55. data/productions/examples/sandbox/stage_handles/styles.rb +58 -0
  56. data/productions/playbills.lll +1 -0
  57. data/productions/startup/production.rb +3 -0
  58. data/productions/startup/spec/default_scene/default_scene_spec.rb +3 -0
  59. data/productions/startup/spec/spec_helper.rb +3 -0
  60. data/productions/startup/styles.rb +3 -0
  61. data/spec/{builtin → limelight/builtin}/players/button_spec.rb +1 -1
  62. data/spec/{builtin → limelight/builtin}/players/check_box_spec.rb +1 -1
  63. data/spec/{builtin → limelight/builtin}/players/combo_box_spec.rb +1 -1
  64. data/spec/{builtin → limelight/builtin}/players/image_spec.rb +1 -2
  65. data/spec/{builtin → limelight/builtin}/players/password_box_spec.rb +1 -1
  66. data/spec/{builtin → limelight/builtin}/players/radio_button_spec.rb +1 -1
  67. data/spec/limelight/builtin/players/stage_mover_spec.rb +36 -0
  68. data/spec/limelight/builtin/players/stage_sizer_spec.rb +40 -0
  69. data/spec/{builtin → limelight/builtin}/players/text_area_spec.rb +1 -1
  70. data/spec/{builtin → limelight/builtin}/players/text_box_spec.rb +1 -1
  71. data/spec/limelight/builtin/utilities_production/spec_helper.rb +7 -0
  72. data/spec/{builtin → limelight/builtin}/utilities_production/utilities_production_spec.rb +3 -0
  73. data/spec/{casting_director_spec.rb → limelight/casting_director_spec.rb} +1 -1
  74. data/spec/{client → limelight/client}/playbills_spec.rb +1 -1
  75. data/spec/{commands → limelight/commands}/command_spec.rb +1 -1
  76. data/spec/{commands → limelight/commands}/create_command_spec.rb +23 -19
  77. data/spec/limelight/commands/freeze_command_spec.rb +143 -0
  78. data/spec/{commands → limelight/commands}/help_command_spec.rb +1 -1
  79. data/spec/{commands → limelight/commands}/open_command_spec.rb +1 -1
  80. data/spec/{commands → limelight/commands}/pack_command_spec.rb +1 -1
  81. data/spec/{commands → limelight/commands}/unpack_command_spec.rb +1 -1
  82. data/spec/{data_spec.rb → limelight/data_spec.rb} +1 -1
  83. data/spec/{dsl → limelight/dsl}/prop_builder_spec.rb +1 -1
  84. data/spec/{dsl → limelight/dsl}/stage_builder_spec.rb +1 -1
  85. data/spec/{dsl → limelight/dsl}/styles_builder_spec.rb +52 -13
  86. data/spec/{file_chooser_spec.rb → limelight/file_chooser_spec.rb} +1 -1
  87. data/spec/{file_filter_spec.rb → limelight/file_filter_spec.rb} +1 -1
  88. data/spec/{file_loader_spec.rb → limelight/file_loader_spec.rb} +1 -1
  89. data/spec/{gems_spec.rb → limelight/gems_spec.rb} +10 -4
  90. data/spec/{java_util_spec.rb → limelight/java_util_spec.rb} +1 -1
  91. data/spec/{main_spec.rb → limelight/main_spec.rb} +1 -1
  92. data/spec/{paint_action_spec.rb → limelight/paint_action_spec.rb} +1 -1
  93. data/spec/{pen_spec.rb → limelight/pen_spec.rb} +1 -1
  94. data/spec/{producer_spec.rb → limelight/producer_spec.rb} +4 -12
  95. data/spec/{production_spec.rb → limelight/production_spec.rb} +32 -11
  96. data/spec/{prop_spec.rb → limelight/prop_spec.rb} +30 -2
  97. data/spec/{scene_spec.rb → limelight/scene_spec.rb} +28 -2
  98. data/spec/{stage_spec.rb → limelight/stage_spec.rb} +1 -1
  99. data/spec/{string_spec.rb → limelight/string_spec.rb} +1 -1
  100. data/spec/{studio_spec.rb → limelight/studio_spec.rb} +16 -1
  101. data/spec/{styles_spec.rb → limelight/styles_spec.rb} +1 -1
  102. data/spec/{templates → limelight/templates}/production_templater_spec.rb +17 -6
  103. data/spec/{templates → limelight/templates}/scene_templater_spec.rb +15 -4
  104. data/spec/{templates → limelight/templates}/templater_logger_spec.rb +1 -1
  105. data/spec/{templates → limelight/templates}/templater_spec.rb +1 -1
  106. data/spec/{theater_spec.rb → limelight/theater_spec.rb} +1 -1
  107. data/spec/{util → limelight/util}/downloader_spec.rb +1 -1
  108. data/spec/spec_helper.rb +11 -0
  109. metadata +62 -70
  110. data/lib/limelight/dsl/production_builder.rb +0 -71
  111. data/spec/builtin/utilities_production/spec_helper.rb +0 -4
  112. data/spec/commands/freeze_command_spec.rb +0 -62
  113. data/spec/dsl/production_builder_spec.rb +0 -46
@@ -19,7 +19,7 @@ module Limelight
19
19
  @root = File.expand_path(root)
20
20
  end
21
21
 
22
- def path_to(path)
22
+ def path_to(path)
23
23
  if (path == File.expand_path(path))
24
24
  return path
25
25
  else
@@ -39,7 +39,9 @@ module Limelight
39
39
  end
40
40
  end
41
41
 
42
- self.current_production = nil
42
+ Gem.use_paths(self.current_production.gems_root, Gem.default_path)
43
+
44
+ self.current_production = nil
43
45
  end
44
46
 
45
47
  end
@@ -21,6 +21,7 @@ module Limelight #:nodoc:
21
21
  module Util #:nodoc:
22
22
  Colors = Java::limelight.util.Colors
23
23
  Version = Java::limelight.util.Version
24
+ Debug = Java::limelight.util.Debug
24
25
  end
25
26
 
26
27
  module UI #:nodoc:
@@ -5,7 +5,6 @@ require 'limelight/file_loader'
5
5
  require 'limelight/dsl/prop_builder'
6
6
  require 'limelight/dsl/styles_builder'
7
7
  require 'limelight/dsl/stage_builder'
8
- require 'limelight/dsl/production_builder'
9
8
  require 'limelight/casting_director'
10
9
  require 'limelight/stage'
11
10
  require 'limelight/dsl/build_exception'
@@ -103,7 +102,6 @@ module Limelight
103
102
  scene_name = File.basename(path)
104
103
  scene = load_props(options.merge(:production => @production, :casting_director => casting_director, :path => path, :name => scene_name))
105
104
  styles = load_styles(scene)
106
- merge_with_root_styles(styles)
107
105
  scene.styles = styles
108
106
  stage.open(scene)
109
107
  return scene
@@ -146,45 +144,10 @@ module Limelight
146
144
  # Loads the specified 'styles.rb' file and created a Hash of Styles.
147
145
  #
148
146
  def load_styles(context)
149
- styles = builtin_styles
150
- return styles if not File.exists?(context.styles_file)
151
- content = IO.read(context.styles_file)
152
- return Limelight.build_styles(styles) do
153
- begin
154
- eval content
155
- rescue Exception => e
156
- raise DSL::BuildException.new(context.styles_file, content, e)
157
- end
158
- end
159
- end
160
-
161
- # A production with multiple Scenes may have a 'styles.rb' file in the root directory. This is called the
162
- # root_style. This method loads the root_styles, if they haven't already been loaded, and returns them.
163
- #
164
- def root_styles
165
- return @root_syles if @root_syles
166
- if File.exists?(@production.styles_file)
167
- @root_styles = load_styles(@production)
168
- else
169
- @root_styles = {}
170
- end
171
- return @root_styles
172
- end
173
-
174
- # Returns a hash of all the built-in Limglight Styles
175
- #
176
- def builtin_styles
177
- return @builtin_styles.dup if @builtin_styles
178
- builtin_styles_file = File.join($LIMELIGHT_LIB, "limelight", "builtin", "styles.rb")
179
- content = IO.read(builtin_styles_file)
180
- @builtin_styles = Limelight.build_styles do
181
- begin
182
- eval content
183
- rescue Exception => e
184
- raise BuildException.new(filename, content, e)
185
- end
186
- end
187
- return @builtin_styles.dup
147
+ extendable_styles = Studio.builtin_styles.merge(@production.root_styles)
148
+ return extendable_styles.dup if not File.exists?(context.styles_file)
149
+ new_styles = Limelight.build_styles_from_file(context.styles_file, extendable_styles)
150
+ return extendable_styles.merge(new_styles)
188
151
  end
189
152
 
190
153
  def establish_production #:nodoc:
@@ -204,12 +167,6 @@ module Limelight
204
167
 
205
168
  private ###############################################
206
169
 
207
- def merge_with_root_styles(styles)
208
- root_styles.each_pair do |key, value|
209
- styles[key] = value if !styles.has_key?(key)
210
- end
211
- end
212
-
213
170
  def unpack_production(production_name)
214
171
  packer = Limelight::Util::Packer.new()
215
172
  dest_dir = File.join(Data.productions_dir, rand.to_s.sub("0.", ""))
@@ -73,6 +73,12 @@ module Limelight
73
73
  # Returns the path to the production's gems directory
74
74
  #
75
75
  def gems_directory
76
+ return @root.path_to("__resources/gems/gems")
77
+ end
78
+
79
+ # Returns the path to the productions gems root
80
+ #
81
+ def gems_root
76
82
  return @root.path_to("__resources/gems")
77
83
  end
78
84
 
@@ -144,6 +150,20 @@ module Limelight
144
150
  return :root
145
151
  end
146
152
 
153
+ # A production with multiple Scenes may have a 'styles.rb' file in the root directory. This is called the
154
+ # root_styles. This method loads the root_styles, if they haven't already been loaded, and returns them.
155
+ #
156
+ def root_styles
157
+ unless @root_styles
158
+ if File.exists?(styles_file)
159
+ @root_styles = Limelight.build_styles_from_file(styles_file)
160
+ else
161
+ @root_styles = {}
162
+ end
163
+ end
164
+ return @root_styles
165
+ end
166
+
147
167
  end
148
168
 
149
169
  end
@@ -50,11 +50,10 @@ module Limelight
50
50
  # until the prop is added to a Prop tree with a Scene.
51
51
  #
52
52
  def initialize(hash = {})
53
- @options = hash
53
+ @options = hash || {}
54
54
  @children = []
55
55
  @style = Styles::ScreenableStyle.new
56
56
  @panel = UI::Model::Panel.new(self)
57
- @illuminated = false
58
57
  end
59
58
 
60
59
  # Add a Prop as a child of this Prop.
@@ -139,8 +138,8 @@ module Limelight
139
138
  end
140
139
  end
141
140
 
142
- # Searches all children for Props with the specified name. Returns an Array of matching Props. Returns an
143
- # empty Array is none are found.
141
+ # Searches all descendant of the Prop (including itself) for Props with the specified name.
142
+ # Returns an Array of matching Props. Returns an empty Array if none are found.
144
143
  #
145
144
  def find_by_name(name, results = [])
146
145
  results << self if @name == name
@@ -191,14 +190,16 @@ module Limelight
191
190
  # unusual name because it's not part of public api
192
191
  def set_parent(parent) #:nodoc:
193
192
  @parent = parent
194
- illuminate if @parent.illuminated?
193
+ if @parent.illuminated?
194
+ illuminate
195
+ end
195
196
  end
196
197
 
197
198
  # Allows the addition of extra initialization options. Will raise an exception if the Prop has already been
198
199
  # illuminated (added to a scene).
199
200
  #
200
201
  def add_options(more_options)
201
- raise "Too late to add options" if @options.nil?
202
+ raise "Too late to add options" if illuminated?
202
203
  @options.merge!(more_options)
203
204
  end
204
205
 
@@ -219,6 +220,13 @@ module Limelight
219
220
  return panel.get_box_inside_borders.clone
220
221
  end
221
222
 
223
+ # Returns a Box representing the bounds inside the padding of the prop. This is the area where child props may
224
+ # be located
225
+ #
226
+ def child_area
227
+ return panel.getChildConsumableArea().clone
228
+ end
229
+
222
230
  # Returns a Pen object. Pen objects allow to you to draw directly on the screen, withing to bounds of this Prop.
223
231
  #
224
232
  def pen
@@ -279,31 +287,31 @@ module Limelight
279
287
  event :button_pressed
280
288
  event :value_changed
281
289
 
282
- # TODO Try to get me our of public scope
290
+ # TODO Try to get me out of public scope
283
291
  #
284
- def illuminate #:nodoc:
285
- return if @options.nil?
286
-
287
- set_id(@options.delete(:id))
288
- @name = @options.delete(:name)
289
- @players = @options.delete(:players)
290
- @additional_styles = @options.delete(:styles)
291
-
292
- inherit_styles
293
- scene.casting_director.fill_cast(self)
294
- apply_options
295
-
296
- @options = nil
292
+ def illuminate #:nodoc:
293
+ if illuminated?
294
+ scene.index_prop(self) if @id
295
+ else
296
+ set_id(@options.delete(:id))
297
+ @name = @options.delete(:name)
298
+ @players = @options.delete(:players)
299
+ @additional_styles = @options.delete(:styles)
297
300
 
298
- @illuminated = true
301
+ inherit_styles
302
+ scene.casting_director.fill_cast(self)
303
+ apply_options
299
304
 
305
+ @options = nil
306
+ end
307
+
300
308
  children.each do |child|
301
- child.illuminate unless child.illuminated?
309
+ child.illuminate
302
310
  end
303
311
  end
304
312
 
305
313
  def illuminated? #:nodoc:
306
- return @illuminated
314
+ return @options.nil?
307
315
  end
308
316
 
309
317
  private ###############################################
@@ -340,7 +348,7 @@ module Limelight
340
348
  def inherit_styles
341
349
  style_names = []
342
350
  style_names << @name unless @name.nil?
343
- style_names += @additional_styles.gsub(',', ' ').split(' ') unless @additional_styles.nil?
351
+ style_names += @additional_styles.gsub(',', ' ').split(' ') unless @additional_styles.nil?
344
352
  style_names.each do |style_name|
345
353
  new_style = scene.styles[style_name]
346
354
  @style.add_extension(new_style) if new_style
@@ -355,13 +363,5 @@ module Limelight
355
363
  end
356
364
  end
357
365
 
358
- # Why is this method here? No one appears to use it.
359
- # def disinherit_styles
360
- # return if @name.nil?
361
- # old_style = scene.styles[@name]
362
- # @style.remove_extension(old_style) if old_style
363
- # @hover_style = nil
364
- # end
365
-
366
366
  end
367
367
  end
@@ -124,9 +124,10 @@ module Limelight
124
124
  end
125
125
 
126
126
  def illuminate #:nodoc:
127
- @styles = @options.has_key?(:styles) ? @options.delete(:styles) : (@styles || {})
127
+ @styles = @options.delete(:styles_hash) || @styles || {}
128
128
  @casting_director = @options.delete(:casting_director) if @options.has_key?(:casting_director)
129
129
  @path = @options.delete(:path) if @options.has_key?(:path)
130
+ @production = @options.delete(:production) if @options.has_key?(:production)
130
131
  super
131
132
  end
132
133
 
@@ -5,6 +5,8 @@ require 'spec'
5
5
  require File.expand_path(File.dirname(__FILE__) + "/../../init")
6
6
  require 'limelight/scene'
7
7
  require 'limelight/producer'
8
+ require 'limelight/string'
9
+ require 'limelight/specs/test_scene_opener'
8
10
 
9
11
  module Limelight
10
12
  module Specs
@@ -12,27 +14,14 @@ module Limelight
12
14
  class << self
13
15
  attr_accessor :producer
14
16
  end
15
-
17
+
16
18
  module SpecHelper
17
-
18
- def open_scene
19
- if @ll_spec_options[:stage]
20
- stage = producer.theater[@ll_spec_options[:stage]]
21
- raise "No such stage: '#{@ll_spec_options[:stage]}'" unless stage
22
- else
23
- stage = producer.theater.default_stage
24
- end
25
-
26
- stage.should_remain_hidden = @ll_spec_options[:hidden]
27
-
28
- @scene = producer.open_scene(@scene_name.to_s, stage)
29
- end
30
-
31
19
  def scene
32
- open_scene unless @scene
20
+ if !@scene
21
+ @scene = TestSceneOpener.new(producer, @ll_spec_options, @prop_block).open_scene
22
+ end
33
23
  return @scene
34
24
  end
35
-
36
25
  end
37
26
  end
38
27
  end
@@ -42,12 +31,17 @@ module Spec
42
31
  class ExampleGroup
43
32
 
44
33
  def self.uses_scene(scene_name, options = {})
34
+ uses_limelight({:scene => scene_name}.merge(options))
35
+ end
36
+
37
+ def self.uses_limelight(options, &prop_block)
45
38
  include Limelight::Specs::SpecHelper
46
-
39
+
47
40
  before(:each) do
48
- @scene_name = scene_name
49
41
  @ll_spec_options = options
50
- @scene = nil
42
+ @prop_block = prop_block
43
+ @player = @scene = nil
44
+ create_accessor_for(@ll_spec_options[:with_player]) if @ll_spec_options[:with_player]
51
45
  end
52
46
  end
53
47
 
@@ -60,7 +54,7 @@ module Spec
60
54
  end
61
55
  end
62
56
  end
63
-
57
+
64
58
  def producer
65
59
  if Limelight::Specs.producer.nil?
66
60
  if $with_ui
@@ -79,7 +73,15 @@ module Spec
79
73
  def production
80
74
  return producer.production
81
75
  end
82
-
76
+
77
+ def create_accessor_for(player_name)
78
+ accessor = <<-EOF
79
+ def #{player_name}
80
+ return scene.find('#{player_name}')
81
+ end
82
+ EOF
83
+ eval(accessor)
84
+ end
83
85
  end
84
86
  end
85
87
  end
@@ -0,0 +1,60 @@
1
+ module Limelight
2
+ module Specs
3
+ module SpecHelper
4
+
5
+ class TestSceneOpener
6
+ def initialize(producer, ll_spec_options, prop_block)
7
+ @producer = producer
8
+ @prop_block = prop_block
9
+ @production = producer.production
10
+ @ll_spec_options = ll_spec_options
11
+ end
12
+
13
+ def create_player_helper
14
+ player_name = @ll_spec_options[:with_player]
15
+ Limelight.build_props(@scene, :build_loader => @production.root) do
16
+ __test_prop({:name =>player_name, :players => "#{player_name}", :id => "#{player_name}"})
17
+ end
18
+ end
19
+
20
+ def setup_player_spec
21
+ path = @production.scene_directory(@ll_spec_options[:scene_path])
22
+ @scene = Scene.new(:production => @production, :casting_director => @producer.casting_director, :path => path, :name => @ll_spec_options[:scene_name])
23
+
24
+ if @prop_block
25
+ Limelight.build_props(@scene, :build_loader => @production.root, &@prop_block)
26
+ elsif @ll_spec_options[:with_player]
27
+ create_player_helper
28
+ end
29
+
30
+ styles = @producer.load_styles(@scene)
31
+ @scene.styles = @producer.load_styles(@scene)
32
+ @stage.open(@scene)
33
+ end
34
+
35
+ def setup_stage
36
+ if @ll_spec_options[:stage]
37
+ @stage = @producer.theater[@ll_spec_options[:stage]]
38
+ raise "No such stage: '#{@ll_spec_options[:stage]}'" unless @stage
39
+ else
40
+ @stage = @producer.theater.default_stage
41
+ end
42
+
43
+ @stage.should_remain_hidden = @ll_spec_options[:hidden] || true
44
+ end
45
+
46
+ def open_scene
47
+ setup_stage
48
+
49
+ if @ll_spec_options[:scene]
50
+ @scene = @producer.open_scene(@ll_spec_options[:scene].to_s, @stage)
51
+ elsif @ll_spec_options[:scene_path]
52
+ setup_player_spec
53
+ end
54
+
55
+ return @scene
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -9,7 +9,7 @@ class String
9
9
  # "and_seven_years".camalized(:lower) # => "andSevenYears"
10
10
  #
11
11
  def camalized(starting_case = :upper)
12
- value = self.downcase.gsub(/[_| ][a-z]/) { |match| match[-1..-1].upcase }
12
+ value = self.downcase.gsub(/[_| |\-][a-z]/) { |match| match[-1..-1].upcase }
13
13
  value = value[0..0].upcase + value[1..-1] if starting_case == :upper
14
14
  return value
15
15
  end
@@ -1,4 +1,4 @@
1
- #- Copyright ? 2008-2009 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/producer'
@@ -59,17 +59,15 @@ module Limelight
59
59
 
60
60
  # Opens the production at the specified path.
61
61
  #
62
- def open(production_path)
62
+ def open(production_path)
63
63
  begin
64
64
  producer = Producer.new(production_path)
65
65
  production = producer.production
66
66
  index(production)
67
67
  producer.open
68
68
  return production
69
- rescue Exception => e
70
- # TODO MDM - open the error in a window
71
- puts e
72
- puts e.backtrace
69
+ rescue StandardError => e
70
+ alert_and_shutdown(e)
73
71
  end
74
72
  end
75
73
 
@@ -86,7 +84,7 @@ module Limelight
86
84
  return if @is_shutdown || @is_shutting_down
87
85
  return unless should_allow_shutdown
88
86
  @is_shutting_down = true
89
- @index.each { |production| production.close }
87
+ @index.each { |production| production.close } if @index
90
88
  @utilities_production.close if @utilities_production
91
89
  @is_shutdown = true
92
90
  Thread.new { Context.instance().shutdown }
@@ -95,8 +93,8 @@ module Limelight
95
93
  # Called when a production is closed to notify the studio of the event.
96
94
  #
97
95
  def production_closed(production)
98
- @index.delete(production)
99
- shutdown if(@index.empty?)
96
+ @index.delete(production) if @index
97
+ shutdown if @index && @index.empty?
100
98
  end
101
99
 
102
100
  # Returns an array of all the productions
@@ -122,6 +120,16 @@ module Limelight
122
120
  return @utilities_production
123
121
  end
124
122
 
123
+ # Returns a hash of all the built-in Limglight Styles
124
+ #
125
+ def builtin_styles
126
+ unless @builtin_styles
127
+ builtin_styles_file = File.join($LIMELIGHT_LIB, "limelight", "builtin", "styles.rb")
128
+ @builtin_styles = Limelight.build_styles_from_file(builtin_styles_file)
129
+ end
130
+ return @builtin_styles
131
+ end
132
+
125
133
  private #############################################
126
134
 
127
135
  def assign_unique_name(production) #:nodoc:
@@ -142,6 +150,17 @@ module Limelight
142
150
  production.name = count.to_s
143
151
  end
144
152
 
153
+ def alert_and_shutdown(e)
154
+ begin
155
+ message = "#{e}\n#{e.backtrace.join("\n")}"
156
+ utilities_production.alert(message)
157
+ shutdown if @index.nil? || @index.empty?
158
+ rescue Exception => e
159
+ puts e
160
+ puts e.backtrace
161
+ end
162
+ end
163
+
145
164
  end
146
165
 
147
166
  # Same as the class level method.