epall-limelight 0.5.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/icons/icon.ico +0 -0
- data/bin/icons/icon_48.gif +0 -0
- data/bin/icons/limelight.icns +0 -0
- data/bin/limelight +5 -0
- data/bin/ll +10 -0
- data/bin/ll.bat +5 -0
- data/lib/init.rb +16 -0
- data/lib/limelight.jar +0 -0
- data/lib/limelight/animation.rb +41 -0
- data/lib/limelight/builtin/players.rb +16 -0
- data/lib/limelight/builtin/players/button.rb +39 -0
- data/lib/limelight/builtin/players/check_box.rb +50 -0
- data/lib/limelight/builtin/players/combo_box.rb +89 -0
- data/lib/limelight/builtin/players/combo_box_popup_list.rb +19 -0
- data/lib/limelight/builtin/players/combo_box_popup_list_item.rb +21 -0
- data/lib/limelight/builtin/players/curtains.rb +23 -0
- data/lib/limelight/builtin/players/image.rb +54 -0
- data/lib/limelight/builtin/players/password_box.rb +34 -0
- data/lib/limelight/builtin/players/radio_button.rb +65 -0
- data/lib/limelight/builtin/players/stage_mover.rb +31 -0
- data/lib/limelight/builtin/players/stage_sizer.rb +34 -0
- data/lib/limelight/builtin/players/text_area.rb +34 -0
- data/lib/limelight/builtin/players/text_box.rb +34 -0
- data/lib/limelight/builtin/styles.rb +35 -0
- data/lib/limelight/builtin/utilities_production/alert/players/alert.rb +11 -0
- data/lib/limelight/builtin/utilities_production/alert/props.rb +8 -0
- data/lib/limelight/builtin/utilities_production/alert/styles.rb +14 -0
- data/lib/limelight/builtin/utilities_production/incompatible_version/props.rb +20 -0
- data/lib/limelight/builtin/utilities_production/incompatible_version/styles.rb +12 -0
- data/lib/limelight/builtin/utilities_production/production.rb +62 -0
- data/lib/limelight/builtin/utilities_production/stages.rb +12 -0
- data/lib/limelight/builtin/utilities_production/styles.rb +53 -0
- data/lib/limelight/button_group_cache.rb +11 -0
- data/lib/limelight/casting_director.rb +112 -0
- data/lib/limelight/client/playbills.rb +86 -0
- data/lib/limelight/commands/command.rb +168 -0
- data/lib/limelight/commands/create_command.rb +98 -0
- data/lib/limelight/commands/freeze_command.rb +131 -0
- data/lib/limelight/commands/help_command.rb +61 -0
- data/lib/limelight/commands/open_command.rb +60 -0
- data/lib/limelight/commands/pack_command.rb +45 -0
- data/lib/limelight/commands/unpack_command.rb +44 -0
- data/lib/limelight/commands/version_command.rb +31 -0
- data/lib/limelight/data.rb +37 -0
- data/lib/limelight/dsl/build_exception.rb +55 -0
- data/lib/limelight/dsl/menu_bar.rb +71 -0
- data/lib/limelight/dsl/prop_builder.rb +155 -0
- data/lib/limelight/dsl/stage_builder.rb +105 -0
- data/lib/limelight/dsl/styles_builder.rb +157 -0
- data/lib/limelight/file_chooser.rb +68 -0
- data/lib/limelight/file_filter.rb +33 -0
- data/lib/limelight/file_loader.rb +46 -0
- data/lib/limelight/gems.rb +51 -0
- data/lib/limelight/java_couplings.rb +66 -0
- data/lib/limelight/java_util.rb +49 -0
- data/lib/limelight/limelight_exception.rb +24 -0
- data/lib/limelight/main.rb +108 -0
- data/lib/limelight/paint_action.rb +27 -0
- data/lib/limelight/pen.rb +83 -0
- data/lib/limelight/producer.rb +179 -0
- data/lib/limelight/production.rb +169 -0
- data/lib/limelight/prop.rb +367 -0
- data/lib/limelight/scene.rb +151 -0
- data/lib/limelight/specs/spec_helper.rb +87 -0
- data/lib/limelight/specs/test_scene_opener.rb +60 -0
- data/lib/limelight/stage.rb +292 -0
- data/lib/limelight/string.rb +38 -0
- data/lib/limelight/studio.rb +185 -0
- data/lib/limelight/styles.rb +347 -0
- data/lib/limelight/templates/production_templater.rb +49 -0
- data/lib/limelight/templates/scene_templater.rb +47 -0
- data/lib/limelight/templates/sources/freezing/limelight_init.rb.template +5 -0
- data/lib/limelight/templates/sources/production/init.rb.template +15 -0
- data/lib/limelight/templates/sources/production/production.rb.template +49 -0
- data/lib/limelight/templates/sources/production/spec/spec_helper.rb.template +12 -0
- data/lib/limelight/templates/sources/production/stages.rb.template +17 -0
- data/lib/limelight/templates/sources/production/styles.rb.template +12 -0
- data/lib/limelight/templates/sources/scene/props.rb.template +6 -0
- data/lib/limelight/templates/sources/scene/styles.rb.template +18 -0
- data/lib/limelight/templates/sources/scene_spec/scene_spec.rb.template +13 -0
- data/lib/limelight/templates/templater.rb +131 -0
- data/lib/limelight/templates/templater_logger.rb +39 -0
- data/lib/limelight/theater.rb +77 -0
- data/lib/limelight/util.rb +65 -0
- data/lib/limelight/util/downloader.rb +115 -0
- data/lib/limelight/version.rb +20 -0
- data/productions/examples/8thlight.com/about/about.txt +24 -0
- data/productions/examples/8thlight.com/about/props.rb +11 -0
- data/productions/examples/8thlight.com/about/styles.rb +2 -0
- data/productions/examples/8thlight.com/footer.rb +6 -0
- data/productions/examples/8thlight.com/home/props.rb +28 -0
- data/productions/examples/8thlight.com/home/styles.rb +2 -0
- data/productions/examples/8thlight.com/images/anvil.jpg +0 -0
- data/productions/examples/8thlight.com/images/bg.jpg +0 -0
- data/productions/examples/8thlight.com/images/botticelli.jpg +0 -0
- data/productions/examples/8thlight.com/images/button_bg.jpg +0 -0
- data/productions/examples/8thlight.com/images/canvas_bg.jpg +0 -0
- data/productions/examples/8thlight.com/images/footer_bg.jpg +0 -0
- data/productions/examples/8thlight.com/images/header.jpg +0 -0
- data/productions/examples/8thlight.com/images/moses.jpg +0 -0
- data/productions/examples/8thlight.com/images/statemachine_thumbnail.png +0 -0
- data/productions/examples/8thlight.com/images/thumbnail_book.jpg +0 -0
- data/productions/examples/8thlight.com/menu.rb +11 -0
- data/productions/examples/8thlight.com/services/props.rb +11 -0
- data/productions/examples/8thlight.com/services/services.txt +8 -0
- data/productions/examples/8thlight.com/services/styles.rb +2 -0
- data/productions/examples/8thlight.com/stages.rb +8 -0
- data/productions/examples/8thlight.com/styles.rb +210 -0
- data/productions/examples/calculator/players/button.rb +24 -0
- data/productions/examples/calculator/players/calculator.rb +15 -0
- data/productions/examples/calculator/players/calculator_model.rb +13 -0
- data/productions/examples/calculator/props.rb +23 -0
- data/productions/examples/calculator/styles.rb +36 -0
- data/productions/examples/langstons_ant/html_javascript/ant.css +39 -0
- data/productions/examples/langstons_ant/html_javascript/ant.html +22 -0
- data/productions/examples/langstons_ant/html_javascript/ant.js +23 -0
- data/productions/examples/langstons_ant/init.rb +4 -0
- data/productions/examples/langstons_ant/players/ant.rb +103 -0
- data/productions/examples/langstons_ant/players/log.rb +29 -0
- data/productions/examples/langstons_ant/players/start_stop_button.rb +37 -0
- data/productions/examples/langstons_ant/players/world.rb +35 -0
- data/productions/examples/langstons_ant/props.rb +22 -0
- data/productions/examples/langstons_ant/styles.rb +104 -0
- data/productions/examples/sandbox/alerts/incompatible_production/default_scene/props.rb +10 -0
- data/productions/examples/sandbox/alerts/incompatible_production/default_scene/styles.rb +32 -0
- data/productions/examples/sandbox/alerts/incompatible_production/production.rb +52 -0
- data/productions/examples/sandbox/alerts/incompatible_production/spec/default_scene/default_scene_spec.rb +16 -0
- data/productions/examples/sandbox/alerts/incompatible_production/spec/spec_helper.rb +8 -0
- data/productions/examples/sandbox/alerts/incompatible_production/stages.rb +20 -0
- data/productions/examples/sandbox/alerts/incompatible_production/styles.rb +15 -0
- data/productions/examples/sandbox/alerts/players/alerts.rb +17 -0
- data/productions/examples/sandbox/alerts/props.rb +10 -0
- data/productions/examples/sandbox/alerts/styles.rb +46 -0
- data/productions/examples/sandbox/background_images/props.rb +22 -0
- data/productions/examples/sandbox/background_images/styles.rb +40 -0
- data/productions/examples/sandbox/click_me/players/chromaton.rb +52 -0
- data/productions/examples/sandbox/click_me/props.rb +8 -0
- data/productions/examples/sandbox/click_me/styles.rb +11 -0
- data/productions/examples/sandbox/floaters/players/floater.rb +108 -0
- data/productions/examples/sandbox/floaters/players/surface.rb +21 -0
- data/productions/examples/sandbox/floaters/props.rb +10 -0
- data/productions/examples/sandbox/floaters/styles.rb +24 -0
- data/productions/examples/sandbox/frameing/players/sandbox.rb +17 -0
- data/productions/examples/sandbox/frameing/props.rb +35 -0
- data/productions/examples/sandbox/frameing/styles.rb +45 -0
- data/productions/examples/sandbox/gradients/players/spinner.rb +20 -0
- data/productions/examples/sandbox/gradients/players/teaser.rb +19 -0
- data/productions/examples/sandbox/gradients/players/wave.rb +19 -0
- data/productions/examples/sandbox/gradients/players/waves.rb +19 -0
- data/productions/examples/sandbox/gradients/props.rb +13 -0
- data/productions/examples/sandbox/gradients/styles.rb +47 -0
- data/productions/examples/sandbox/header.rb +22 -0
- data/productions/examples/sandbox/homer/players/homer.rb +24 -0
- data/productions/examples/sandbox/homer/props.rb +10 -0
- data/productions/examples/sandbox/homer/styles.rb +16 -0
- data/productions/examples/sandbox/images/arch.jpg +0 -0
- data/productions/examples/sandbox/images/beach.jpg +0 -0
- data/productions/examples/sandbox/images/homer.jpg +0 -0
- data/productions/examples/sandbox/images/limelight_spotlight.jpg +0 -0
- data/productions/examples/sandbox/images/logo.png +0 -0
- data/productions/examples/sandbox/images/marilyn.jpg +0 -0
- data/productions/examples/sandbox/images/space.png +0 -0
- data/productions/examples/sandbox/images_scene/props.rb +36 -0
- data/productions/examples/sandbox/images_scene/styles.rb +34 -0
- data/productions/examples/sandbox/inputs/players/button_input.rb +48 -0
- data/productions/examples/sandbox/inputs/players/check_box_input.rb +40 -0
- data/productions/examples/sandbox/inputs/players/combo_box_input.rb +41 -0
- data/productions/examples/sandbox/inputs/players/radio_button_input.rb +43 -0
- data/productions/examples/sandbox/inputs/players/text_area_input.rb +36 -0
- data/productions/examples/sandbox/inputs/players/text_box_input.rb +36 -0
- data/productions/examples/sandbox/inputs/props.rb +40 -0
- data/productions/examples/sandbox/inputs/styles.rb +39 -0
- data/productions/examples/sandbox/kiosk/players/kiosk.rb +39 -0
- data/productions/examples/sandbox/kiosk/props.rb +9 -0
- data/productions/examples/sandbox/kiosk/styles.rb +37 -0
- data/productions/examples/sandbox/players/sandbox.rb +11 -0
- data/productions/examples/sandbox/rounded_corners/players/box.rb +11 -0
- data/productions/examples/sandbox/rounded_corners/props.rb +22 -0
- data/productions/examples/sandbox/rounded_corners/styles.rb +17 -0
- data/productions/examples/sandbox/scrolling/players/add_button.rb +19 -0
- data/productions/examples/sandbox/scrolling/players/cell.rb +15 -0
- data/productions/examples/sandbox/scrolling/props.rb +45 -0
- data/productions/examples/sandbox/scrolling/styles.rb +33 -0
- data/productions/examples/sandbox/sketching/players/sketchpad.rb +46 -0
- data/productions/examples/sandbox/sketching/props.rb +25 -0
- data/productions/examples/sandbox/sketching/styles.rb +35 -0
- data/productions/examples/sandbox/sounds/bird.au +0 -0
- data/productions/examples/sandbox/sounds/cat.au +0 -0
- data/productions/examples/sandbox/sounds/cow.au +0 -0
- data/productions/examples/sandbox/sounds/dog.au +0 -0
- data/productions/examples/sandbox/sounds/donkey.au +0 -0
- data/productions/examples/sandbox/sounds/duck.au +0 -0
- data/productions/examples/sandbox/sounds/players/clip.rb +10 -0
- data/productions/examples/sandbox/sounds/props.rb +10 -0
- data/productions/examples/sandbox/sounds/styles.rb +17 -0
- data/productions/examples/sandbox/spec/alerts/alerts_spec.rb +16 -0
- data/productions/examples/sandbox/stage_handles/players/sizer.rb +35 -0
- data/productions/examples/sandbox/stage_handles/props.rb +17 -0
- data/productions/examples/sandbox/stage_handles/styles.rb +58 -0
- data/productions/examples/sandbox/stages.rb +8 -0
- data/productions/examples/sandbox/styles.rb +35 -0
- data/productions/examples/sandbox/teaser/players/fader.rb +58 -0
- data/productions/examples/sandbox/teaser/props.rb +14 -0
- data/productions/examples/sandbox/teaser/styles.rb +21 -0
- data/productions/examples/tutorials/tutorial_1/players/sample.rb +11 -0
- data/productions/examples/tutorials/tutorial_1/props.rb +9 -0
- data/productions/examples/tutorials/tutorial_1/styles.rb +25 -0
- data/productions/playbills.lll +1 -0
- data/productions/stage_composer/init.rb +10 -0
- data/productions/stage_composer/inspector/players/inspector.rb +80 -0
- data/productions/stage_composer/inspector/players/prop_row.rb +12 -0
- data/productions/stage_composer/inspector/players/prop_tree.rb +33 -0
- data/productions/stage_composer/inspector/players/style_table.rb +12 -0
- data/productions/stage_composer/inspector/players/style_value.rb +16 -0
- data/productions/stage_composer/inspector/props.rb +19 -0
- data/productions/stage_composer/inspector/styles.rb +71 -0
- data/productions/stage_composer/lib/init.rb +5 -0
- data/productions/stage_composer/lib/limelight/composer/controller.rb +51 -0
- data/productions/stage_composer/lib/limelight/composer/lethargy.rb +24 -0
- data/productions/stage_composer/production.rb +6 -0
- data/productions/stage_composer/stages.rb +15 -0
- data/productions/startup/images/logo.png +0 -0
- data/productions/startup/images/splash.png +0 -0
- data/productions/startup/production.rb +52 -0
- data/productions/startup/spec/default_scene/default_scene_spec.rb +16 -0
- data/productions/startup/spec/spec_helper.rb +8 -0
- data/productions/startup/stages.rb +9 -0
- data/productions/startup/styles.rb +15 -0
- data/productions/startup/welcome/players/browse_button.rb +10 -0
- data/productions/startup/welcome/players/download_button.rb +17 -0
- data/productions/startup/welcome/players/sandbox_button.rb +11 -0
- data/productions/startup/welcome/props.rb +23 -0
- data/productions/startup/welcome/styles.rb +103 -0
- data/spec/limelight/builtin/players/button_spec.rb +20 -0
- data/spec/limelight/builtin/players/check_box_spec.rb +29 -0
- data/spec/limelight/builtin/players/combo_box_spec.rb +29 -0
- data/spec/limelight/builtin/players/image_spec.rb +43 -0
- data/spec/limelight/builtin/players/password_box_spec.rb +27 -0
- data/spec/limelight/builtin/players/radio_button_spec.rb +64 -0
- data/spec/limelight/builtin/players/stage_mover_spec.rb +36 -0
- data/spec/limelight/builtin/players/stage_sizer_spec.rb +40 -0
- data/spec/limelight/builtin/players/text_area_spec.rb +27 -0
- data/spec/limelight/builtin/players/text_box_spec.rb +27 -0
- data/spec/limelight/builtin/utilities_production/spec_helper.rb +7 -0
- data/spec/limelight/builtin/utilities_production/utilities_production_spec.rb +146 -0
- data/spec/limelight/casting_director_spec.rb +164 -0
- data/spec/limelight/client/playbills_spec.rb +79 -0
- data/spec/limelight/commands/command_spec.rb +26 -0
- data/spec/limelight/commands/create_command_spec.rb +108 -0
- data/spec/limelight/commands/freeze_command_spec.rb +143 -0
- data/spec/limelight/commands/help_command_spec.rb +42 -0
- data/spec/limelight/commands/open_command_spec.rb +52 -0
- data/spec/limelight/commands/pack_command_spec.rb +26 -0
- data/spec/limelight/commands/unpack_command_spec.rb +47 -0
- data/spec/limelight/data_spec.rb +36 -0
- data/spec/limelight/dsl/prop_builder_spec.rb +245 -0
- data/spec/limelight/dsl/stage_builder_spec.rb +90 -0
- data/spec/limelight/dsl/styles_builder_spec.rb +194 -0
- data/spec/limelight/file_chooser_spec.rb +64 -0
- data/spec/limelight/file_filter_spec.rb +29 -0
- data/spec/limelight/file_loader_spec.rb +28 -0
- data/spec/limelight/gems_spec.rb +92 -0
- data/spec/limelight/java_util_spec.rb +37 -0
- data/spec/limelight/main_spec.rb +40 -0
- data/spec/limelight/paint_action_spec.rb +30 -0
- data/spec/limelight/pen_spec.rb +62 -0
- data/spec/limelight/producer_spec.rb +210 -0
- data/spec/limelight/production_spec.rb +100 -0
- data/spec/limelight/prop_spec.rb +431 -0
- data/spec/limelight/scene_spec.rb +173 -0
- data/spec/limelight/stage_spec.rb +202 -0
- data/spec/limelight/string_spec.rb +38 -0
- data/spec/limelight/studio_spec.rb +157 -0
- data/spec/limelight/styles_spec.rb +53 -0
- data/spec/limelight/templates/production_templater_spec.rb +66 -0
- data/spec/limelight/templates/scene_templater_spec.rb +51 -0
- data/spec/limelight/templates/templater_logger_spec.rb +41 -0
- data/spec/limelight/templates/templater_spec.rb +107 -0
- data/spec/limelight/theater_spec.rb +72 -0
- data/spec/limelight/util/downloader_spec.rb +92 -0
- data/spec/spec_helper.rb +70 -0
- metadata +335 -0
@@ -0,0 +1,87 @@
|
|
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
|
+
|
4
|
+
require 'spec'
|
5
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../init")
|
6
|
+
require 'limelight/scene'
|
7
|
+
require 'limelight/producer'
|
8
|
+
require 'limelight/string'
|
9
|
+
require 'limelight/specs/test_scene_opener'
|
10
|
+
|
11
|
+
module Limelight
|
12
|
+
module Specs
|
13
|
+
|
14
|
+
class << self
|
15
|
+
attr_accessor :producer
|
16
|
+
end
|
17
|
+
|
18
|
+
module SpecHelper
|
19
|
+
def scene
|
20
|
+
if !@scene
|
21
|
+
@scene = TestSceneOpener.new(producer, @ll_spec_options, @prop_block).open_scene
|
22
|
+
end
|
23
|
+
return @scene
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
module Spec
|
30
|
+
module Example
|
31
|
+
class ExampleGroup
|
32
|
+
|
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)
|
38
|
+
include Limelight::Specs::SpecHelper
|
39
|
+
|
40
|
+
before(:each) do
|
41
|
+
@ll_spec_options = options
|
42
|
+
@prop_block = prop_block
|
43
|
+
@player = @scene = nil
|
44
|
+
create_accessor_for(@ll_spec_options[:with_player]) if @ll_spec_options[:with_player]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
after(:suite) do
|
49
|
+
unless Limelight::Specs.producer.nil?
|
50
|
+
Limelight::Specs.producer.theater.stages.each do |stage|
|
51
|
+
# MDM - We do this in a round-about way to reduce the chance of using stubbed or mocked methods.
|
52
|
+
frame = stage.instance_variable_get("@frame")
|
53
|
+
frame.close if frame
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def producer
|
59
|
+
if Limelight::Specs.producer.nil?
|
60
|
+
if $with_ui
|
61
|
+
Limelight::Main.initializeContext
|
62
|
+
else
|
63
|
+
Limelight::Main.initializeTestContext
|
64
|
+
end
|
65
|
+
raise "$PRODUCTION_PATH undefined. Make sure you specify the location of the production in $PRODUCTION_PATH." unless defined?($PRODUCTION_PATH)
|
66
|
+
raise "Could not find production: '#{$PRODUCTION_PATH}'. Check $PRODUCTION_PATH." unless File.exists?($PRODUCTION_PATH)
|
67
|
+
Limelight::Specs.producer = Limelight::Producer.new($PRODUCTION_PATH)
|
68
|
+
Limelight::Specs.producer.load
|
69
|
+
end
|
70
|
+
return Limelight::Specs.producer
|
71
|
+
end
|
72
|
+
|
73
|
+
def production
|
74
|
+
return producer.production
|
75
|
+
end
|
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
|
85
|
+
end
|
86
|
+
end
|
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
|
@@ -0,0 +1,292 @@
|
|
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
|
+
|
4
|
+
#require 'limelight/dsl/menu_bar'
|
5
|
+
require 'limelight/file_chooser'
|
6
|
+
require 'limelight/util'
|
7
|
+
|
8
|
+
module Limelight
|
9
|
+
|
10
|
+
# In the metephorical sense, a Stage is a platform which may hold a scene. In a more, to-the-point sence, a Stage
|
11
|
+
# represents a window on the computer screen. The Stage objects within a Production are configured by the StagesBuilder.
|
12
|
+
# By default a Production will have one Stage. A Stage may open any number of Scenes but it may only have one current
|
13
|
+
# scene loaded at a time.
|
14
|
+
#
|
15
|
+
class Stage
|
16
|
+
attr_accessor :default_scene
|
17
|
+
attr_reader :frame, :current_scene, :name, :theater
|
18
|
+
|
19
|
+
attr_accessor :should_remain_hidden #:nodoc:
|
20
|
+
|
21
|
+
include UI::Api::Stage
|
22
|
+
|
23
|
+
# To create a new Stage, it be given a Theater to which it belongs, and the name is optional. If no name is provided
|
24
|
+
# it will default to 'default'. A stage name must be unique, so it is recommended you provide a name.
|
25
|
+
#
|
26
|
+
def initialize(theater, name, options = {})
|
27
|
+
@theater = theater
|
28
|
+
@name = name
|
29
|
+
build_frame
|
30
|
+
self.title = @name
|
31
|
+
apply_options(options)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns the title that is displayed at the top of the window that this stage represents.
|
35
|
+
#
|
36
|
+
def title
|
37
|
+
return @frame.title
|
38
|
+
end
|
39
|
+
|
40
|
+
# Sets the title that is displayed at the top of the window that this stage represents.
|
41
|
+
#
|
42
|
+
def title=(value)
|
43
|
+
@frame.title = value
|
44
|
+
end
|
45
|
+
|
46
|
+
# Returns the width and height styles of the Stage.
|
47
|
+
#
|
48
|
+
# width, height = stage.size
|
49
|
+
#
|
50
|
+
def size
|
51
|
+
return @frame.width_style.to_s, @frame.height_style.to_s
|
52
|
+
end
|
53
|
+
|
54
|
+
# Sets the width and height styles of the Stage.
|
55
|
+
#
|
56
|
+
# state.size = [100, 200]
|
57
|
+
# state.size = ["50%", "100%"] # consuming 50% of the width and 100% of the height of the screen
|
58
|
+
#
|
59
|
+
def size=(*values)
|
60
|
+
values = values[0] if values.size == 1 && values[0].is_a?(Array)
|
61
|
+
@frame.set_size_styles(values[0], values[1])
|
62
|
+
end
|
63
|
+
|
64
|
+
# The location styles of the Stage.
|
65
|
+
#
|
66
|
+
# x, y = stage.location
|
67
|
+
#
|
68
|
+
def location
|
69
|
+
return @frame.getXLocationStyle.to_s, @frame.getYLocationStyle.to_s
|
70
|
+
end
|
71
|
+
|
72
|
+
# Sets the location styles of the Stage.
|
73
|
+
#
|
74
|
+
# stage.location = [500, 200]
|
75
|
+
#
|
76
|
+
def location=(*values)
|
77
|
+
values = values[0] if values.size == 1 && values[0].is_a?(Array)
|
78
|
+
@frame.set_location_styles(values[0], values[1])
|
79
|
+
end
|
80
|
+
|
81
|
+
# Turns fullscreen mode on and off. In fullscreen mode, the stage will fill the entire screen and appear on top
|
82
|
+
# of all other windows.
|
83
|
+
#
|
84
|
+
# stage.fullscreen = true
|
85
|
+
#
|
86
|
+
|
87
|
+
def fullscreen=(on)
|
88
|
+
@frame.setFullScreen(on)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Returns true if the stage is in fullscreen mode.
|
92
|
+
#
|
93
|
+
def fullscreen?
|
94
|
+
return @frame.isFullScreen()
|
95
|
+
end
|
96
|
+
|
97
|
+
# Turns kiosk mode for this stage on and off. When on, the stage will:
|
98
|
+
# * be fullscreen
|
99
|
+
# * not be frames
|
100
|
+
# * disable OS key commands
|
101
|
+
# * OS X: Cmd-Tab, Cmd-Alt-Esc, etc...
|
102
|
+
# * Windows: Alt-Tab, Ctrl-Esc, etc... (Ctrl-Alt-Del must be disabled through a registry entry)
|
103
|
+
#
|
104
|
+
# stage.kiosk = true
|
105
|
+
#
|
106
|
+
def kiosk=(on)
|
107
|
+
@frame.setKiosk(on)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Return true if the stage is in kiosk mode.
|
111
|
+
#
|
112
|
+
def kiosk?
|
113
|
+
return @frame.isKiosk()
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
# Hides the stage so that it is not visible on the screen without destroying it.
|
118
|
+
#
|
119
|
+
def hide
|
120
|
+
@frame.visible = false
|
121
|
+
end
|
122
|
+
|
123
|
+
# Shows the stage after having hiding it.
|
124
|
+
#
|
125
|
+
def show
|
126
|
+
@frame.visible = true unless @should_remain_hidden
|
127
|
+
end
|
128
|
+
|
129
|
+
# Returns true if the stage is visible on the screen.
|
130
|
+
#
|
131
|
+
def visible?
|
132
|
+
return @frame.visible
|
133
|
+
end
|
134
|
+
|
135
|
+
# Sets the background color of the stage
|
136
|
+
#
|
137
|
+
def background_color=(value)
|
138
|
+
@frame.background_color = value.to_s
|
139
|
+
end
|
140
|
+
|
141
|
+
# Returns the background color of the stage in the format #RRGGBB(AA)
|
142
|
+
#
|
143
|
+
def background_color
|
144
|
+
return @frame.background_color
|
145
|
+
end
|
146
|
+
|
147
|
+
# When true, the stage will be frame with the operating system's standard window frame including close, minimize,
|
148
|
+
# and maximize buttons
|
149
|
+
#
|
150
|
+
def framed=(value)
|
151
|
+
@frame.setUndecorated(!value)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Return true if the stage is framed.
|
155
|
+
#
|
156
|
+
def framed?
|
157
|
+
return !@frame.isUndecorated()
|
158
|
+
end
|
159
|
+
|
160
|
+
# When true, the stage will remain on top of all other windows.
|
161
|
+
#
|
162
|
+
def always_on_top=(value)
|
163
|
+
@frame.always_on_top = value
|
164
|
+
end
|
165
|
+
|
166
|
+
# Return true if the stage has been set to always be on top.
|
167
|
+
#
|
168
|
+
def always_on_top?
|
169
|
+
return @frame.always_on_top
|
170
|
+
end
|
171
|
+
|
172
|
+
# Sets the vitality of the stage. Limelight will not exit while vital frames remain visible.
|
173
|
+
#
|
174
|
+
def vital=(value)
|
175
|
+
@frame.vital = value
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns true if this is a vital stage. Limelight will not exit while vital frames remain visible.
|
179
|
+
#
|
180
|
+
def vital?
|
181
|
+
return @frame.vital?
|
182
|
+
end
|
183
|
+
|
184
|
+
# Opens the Stage and loads the provided Scene.
|
185
|
+
#
|
186
|
+
# See load_scene
|
187
|
+
#
|
188
|
+
def open(scene)
|
189
|
+
scene.stage = self
|
190
|
+
scene.illuminate
|
191
|
+
load_scene(scene)
|
192
|
+
@frame.open unless @should_remain_hidden
|
193
|
+
scene.visible = true
|
194
|
+
scene.scene_opened(self)
|
195
|
+
end
|
196
|
+
|
197
|
+
# Closes the Stage. It's window will no longer be displayed on the screen.
|
198
|
+
#
|
199
|
+
def close
|
200
|
+
@theater.stage_closed(self)
|
201
|
+
@frame.close
|
202
|
+
@current_scene.visible = false if @current_scene
|
203
|
+
@current_scene = nil
|
204
|
+
end
|
205
|
+
|
206
|
+
# Loads a scene on the Stage. If the Stage is currently hosting a Scene, the original Scene will be removed and
|
207
|
+
# the new Scene will replace it.
|
208
|
+
#
|
209
|
+
def load_scene(scene)
|
210
|
+
# @frame.setJMenuBar(scene.menu_bar)
|
211
|
+
@frame.load(scene.panel)
|
212
|
+
if (has_static_size?(scene.style))
|
213
|
+
@frame.set_size(scene.style.compiled_width.value + @frame.getHorizontalInsetWidth, scene.style.compiled_height.value + @frame.getVerticalInsetWidth)
|
214
|
+
end
|
215
|
+
@current_scene = scene
|
216
|
+
end
|
217
|
+
|
218
|
+
# Opens a file chooser window to select a file on the file system. Options may include:
|
219
|
+
# * :description => a string describing the desired file
|
220
|
+
# * :directory => starting directory
|
221
|
+
# * :title => title of the window
|
222
|
+
# * :directories_only => boolean, true if the user must select a directory
|
223
|
+
# * :files_only => boolean, true if the user must select a file
|
224
|
+
#
|
225
|
+
def choose_file(options={}, &block)
|
226
|
+
options[:parent] = @frame
|
227
|
+
chooser = FileChooser.new(options, &block)
|
228
|
+
return chooser.choose_file
|
229
|
+
end
|
230
|
+
|
231
|
+
# Pops up a simple modal dialog with the provided message.
|
232
|
+
#
|
233
|
+
def alert(message)
|
234
|
+
Thread.new do
|
235
|
+
begin
|
236
|
+
Studio.utilities_production.alert(message)
|
237
|
+
rescue StandardError => e
|
238
|
+
puts "Error on alert: #{e}"
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
# Called when the user or system would like to close the stage. The stage will return true, allowing it to be
|
244
|
+
# closed, unless the current_scene defines the allow_close? method in which case the decision it left up to the
|
245
|
+
# current_scene.
|
246
|
+
#
|
247
|
+
def should_allow_close
|
248
|
+
return true if @current_scene.nil?
|
249
|
+
return true if !@current_scene.respond_to?(:allow_close?)
|
250
|
+
return @current_scene.allow_close?
|
251
|
+
end
|
252
|
+
|
253
|
+
def stub_current_scene(scene) #:nodoc:
|
254
|
+
@current_scene = scene
|
255
|
+
end
|
256
|
+
|
257
|
+
protected #############################################
|
258
|
+
|
259
|
+
def new_frame
|
260
|
+
return UI::Model::Frame.new(self)
|
261
|
+
end
|
262
|
+
|
263
|
+
private ###############################################
|
264
|
+
|
265
|
+
def build_frame
|
266
|
+
@frame = new_frame
|
267
|
+
@frame.set_size(800, 800)
|
268
|
+
@frame.set_location(200, 25)
|
269
|
+
@frame.title = title
|
270
|
+
end
|
271
|
+
|
272
|
+
def has_static_size?(style)
|
273
|
+
return is_static?(style.get_width) && is_static?(style.get_height)
|
274
|
+
end
|
275
|
+
|
276
|
+
def is_static?(value)
|
277
|
+
return !(value.to_s.include?("%")) && !(value.to_s == "auto")
|
278
|
+
end
|
279
|
+
|
280
|
+
def apply_options(options)
|
281
|
+
options.each_pair do |key, value|
|
282
|
+
setter_sym = "#{key.to_s}=".to_sym
|
283
|
+
if self.respond_to?(setter_sym)
|
284
|
+
self.send(setter_sym, value)
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|
290
|
+
|
291
|
+
end
|
292
|
+
|
@@ -0,0 +1,38 @@
|
|
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
|
+
|
4
|
+
class String
|
5
|
+
|
6
|
+
# Converts Ruby style names to Java style camal case.
|
7
|
+
#
|
8
|
+
# "four_score".camalized # => "FourScore"
|
9
|
+
# "and_seven_years".camalized(:lower) # => "andSevenYears"
|
10
|
+
#
|
11
|
+
def camalized(starting_case = :upper)
|
12
|
+
value = self.downcase.gsub(/[_| |\-][a-z]/) { |match| match[-1..-1].upcase }
|
13
|
+
value = value[0..0].upcase + value[1..-1] if starting_case == :upper
|
14
|
+
return value
|
15
|
+
end
|
16
|
+
|
17
|
+
# Converts Java camel case names to ruby style underscored names.
|
18
|
+
#
|
19
|
+
# "FourScore".underscored # => "four_score"
|
20
|
+
# "andSevenYears".underscored # => "and_seven_years"
|
21
|
+
#
|
22
|
+
def underscored
|
23
|
+
value = self[0..0].downcase + self[1..-1]
|
24
|
+
value = value.gsub(/[A-Z]/) { |cap| "_#{cap.downcase}" }
|
25
|
+
return value
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
# Converts ruby style and camalcase strings into title strings where every word is capitalized and separated by a space.
|
30
|
+
#
|
31
|
+
# "four_score".titleized # => "Four Score"
|
32
|
+
#
|
33
|
+
def titleized(starting_case = :upper)
|
34
|
+
value = self.gsub(/[a-z0-9][A-Z]/) { |match| "#{match[0..0]} #{match[-1..-1]}" }
|
35
|
+
value = value.gsub(/[_| ][a-z]/) { |match| " #{match[-1..-1].upcase}" }
|
36
|
+
return value[0..0].upcase + value[1..-1]
|
37
|
+
end
|
38
|
+
end
|