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.
- data/lib/init.rb +5 -2
- data/lib/limelight/animation.rb +2 -2
- data/lib/limelight/builtin/players/button.rb +1 -1
- data/lib/limelight/builtin/players/check_box.rb +1 -1
- data/lib/limelight/builtin/players/combo_box.rb +2 -4
- data/lib/limelight/builtin/players/combo_box_popup_list.rb +1 -1
- data/lib/limelight/builtin/players/combo_box_popup_list_item.rb +1 -1
- data/lib/limelight/builtin/players/curtains.rb +1 -1
- data/lib/limelight/builtin/players/image.rb +3 -0
- data/lib/limelight/builtin/players/password_box.rb +1 -1
- data/lib/limelight/builtin/players/radio_button.rb +1 -1
- data/lib/limelight/builtin/players/text_area.rb +1 -1
- data/lib/limelight/builtin/players/text_box.rb +1 -1
- data/lib/limelight/builtin/players.rb +1 -1
- data/lib/limelight/builtin/styles.rb +1 -1
- data/lib/limelight/builtin/utilities_production/alert/props.rb +5 -0
- data/lib/limelight/builtin/utilities_production/alert/styles.rb +7 -0
- data/lib/limelight/builtin/utilities_production/incompatible_version/props.rb +17 -0
- data/lib/limelight/builtin/utilities_production/incompatible_version/styles.rb +9 -0
- data/lib/limelight/builtin/utilities_production/production.rb +59 -0
- data/lib/limelight/builtin/utilities_production/stages.rb +9 -0
- data/lib/limelight/builtin/utilities_production/styles.rb +50 -0
- data/lib/limelight/button_group_cache.rb +1 -1
- data/lib/limelight/casting_director.rb +1 -1
- data/lib/limelight/client/playbills.rb +3 -0
- data/lib/limelight/commands/command.rb +13 -7
- data/lib/limelight/commands/create_command.rb +13 -8
- data/lib/limelight/commands/freeze_command.rb +3 -0
- data/lib/limelight/commands/help_command.rb +12 -1
- data/lib/limelight/commands/open_command.rb +11 -1
- data/lib/limelight/commands/pack_command.rb +1 -1
- data/lib/limelight/commands/unpack_command.rb +1 -1
- data/lib/limelight/commands/version_command.rb +1 -1
- data/lib/limelight/data.rb +4 -14
- data/lib/limelight/dsl/build_exception.rb +12 -8
- data/lib/limelight/dsl/menu_bar.rb +1 -1
- data/lib/limelight/dsl/production_builder.rb +1 -1
- data/lib/limelight/dsl/prop_builder.rb +2 -2
- data/lib/limelight/dsl/stage_builder.rb +3 -3
- data/lib/limelight/dsl/styles_builder.rb +2 -1
- data/lib/limelight/file_chooser.rb +1 -1
- data/lib/limelight/file_filter.rb +1 -1
- data/lib/limelight/file_loader.rb +1 -1
- data/lib/limelight/gems.rb +4 -0
- data/lib/limelight/java_couplings.rb +3 -2
- data/lib/limelight/java_util.rb +1 -1
- data/lib/limelight/limelight_exception.rb +1 -1
- data/lib/limelight/main.rb +1 -1
- data/lib/limelight/paint_action.rb +1 -1
- data/lib/limelight/pen.rb +1 -1
- data/lib/limelight/producer.rb +52 -37
- data/lib/limelight/production.rb +81 -43
- data/lib/limelight/prop.rb +32 -13
- data/lib/limelight/scene.rb +19 -14
- data/lib/limelight/specs/spec_helper.rb +55 -28
- data/lib/limelight/stage.rb +163 -23
- data/lib/limelight/string.rb +3 -0
- data/lib/limelight/studio.rb +143 -6
- data/lib/limelight/styles.rb +14 -1
- data/lib/limelight/templates/production_templater.rb +6 -2
- data/lib/limelight/templates/scene_templater.rb +12 -7
- data/lib/limelight/templates/sources/production/production.rb.template +46 -6
- data/lib/limelight/templates/sources/production/spec/spec_helper.rb.template +5 -0
- data/lib/limelight/templates/sources/scene_spec/scene_spec.rb.template +13 -0
- data/lib/limelight/templates/templater.rb +4 -1
- data/lib/limelight/templates/templater_logger.rb +3 -0
- data/lib/limelight/theater.rb +15 -6
- data/lib/limelight/util/downloader.rb +3 -1
- data/lib/limelight/util.rb +8 -7
- data/lib/limelight/version.rb +3 -3
- data/lib/limelight.jar +0 -0
- data/productions/examples/8thlight.com/about/props.rb +1 -1
- data/productions/examples/8thlight.com/about/styles.rb +1 -1
- data/productions/examples/8thlight.com/footer.rb +1 -1
- data/productions/examples/8thlight.com/home/props.rb +1 -1
- data/productions/examples/8thlight.com/home/styles.rb +1 -1
- data/productions/examples/8thlight.com/menu.rb +1 -1
- data/productions/examples/8thlight.com/services/props.rb +1 -1
- data/productions/examples/8thlight.com/services/styles.rb +1 -1
- data/productions/examples/8thlight.com/stages.rb +1 -1
- data/productions/examples/8thlight.com/styles.rb +1 -1
- data/productions/examples/calculator/players/button.rb +1 -1
- data/productions/examples/calculator/players/calculator.rb +1 -1
- data/productions/examples/calculator/players/calculator_model.rb +1 -1
- data/productions/examples/calculator/props.rb +1 -1
- data/productions/examples/calculator/styles.rb +1 -1
- data/productions/examples/langstons_ant/init.rb +3 -0
- data/productions/examples/langstons_ant/players/ant.rb +1 -1
- data/productions/examples/langstons_ant/players/log.rb +1 -1
- data/productions/examples/langstons_ant/players/start_stop_button.rb +1 -1
- data/productions/examples/langstons_ant/players/world.rb +1 -1
- data/productions/examples/langstons_ant/props.rb +1 -1
- data/productions/examples/langstons_ant/styles.rb +1 -1
- data/productions/examples/sandbox/alerts/incompatible_production/default_scene/props.rb +7 -0
- data/productions/examples/sandbox/alerts/incompatible_production/default_scene/styles.rb +29 -0
- data/productions/examples/sandbox/alerts/incompatible_production/production.rb +49 -0
- data/productions/examples/sandbox/alerts/incompatible_production/spec/default_scene/default_scene_spec.rb +13 -0
- data/productions/examples/sandbox/alerts/incompatible_production/spec/spec_helper.rb +5 -0
- data/productions/examples/sandbox/alerts/incompatible_production/stages.rb +17 -0
- data/productions/examples/sandbox/alerts/incompatible_production/styles.rb +12 -0
- data/productions/examples/sandbox/alerts/players/alerts.rb +14 -0
- data/productions/examples/sandbox/alerts/props.rb +7 -0
- data/productions/examples/sandbox/alerts/styles.rb +43 -0
- data/productions/examples/sandbox/background_images/props.rb +19 -0
- data/productions/examples/sandbox/background_images/styles.rb +40 -0
- data/productions/examples/sandbox/click_me/players/chromaton.rb +1 -1
- data/productions/examples/sandbox/click_me/props.rb +1 -1
- data/productions/examples/sandbox/click_me/styles.rb +1 -1
- data/productions/examples/sandbox/floaters/players/floater.rb +9 -5
- data/productions/examples/sandbox/floaters/players/surface.rb +1 -1
- data/productions/examples/sandbox/floaters/props.rb +1 -1
- data/productions/examples/sandbox/floaters/styles.rb +13 -13
- data/productions/examples/sandbox/frameing/players/sandbox.rb +3 -0
- data/productions/examples/sandbox/frameing/props.rb +3 -0
- data/productions/examples/sandbox/frameing/styles.rb +3 -0
- data/productions/examples/sandbox/gradients/players/spinner.rb +1 -1
- data/productions/examples/sandbox/gradients/players/teaser.rb +1 -1
- data/productions/examples/sandbox/gradients/players/wave.rb +1 -1
- data/productions/examples/sandbox/gradients/players/waves.rb +1 -1
- data/productions/examples/sandbox/gradients/props.rb +1 -1
- data/productions/examples/sandbox/gradients/styles.rb +1 -1
- data/productions/examples/sandbox/header.rb +4 -1
- data/productions/examples/sandbox/homer/players/homer.rb +1 -1
- data/productions/examples/sandbox/homer/props.rb +1 -1
- data/productions/examples/sandbox/homer/styles.rb +2 -2
- data/productions/examples/sandbox/images/space.png +0 -0
- data/productions/examples/sandbox/images_scene/props.rb +3 -0
- data/productions/examples/sandbox/images_scene/styles.rb +3 -0
- data/productions/examples/sandbox/inputs/players/button_input.rb +1 -1
- data/productions/examples/sandbox/inputs/players/check_box_input.rb +1 -1
- data/productions/examples/sandbox/inputs/players/combo_box_input.rb +1 -1
- data/productions/examples/sandbox/inputs/players/radio_button_input.rb +1 -1
- data/productions/examples/sandbox/inputs/players/text_area_input.rb +1 -1
- data/productions/examples/sandbox/inputs/players/text_box_input.rb +1 -1
- data/productions/examples/sandbox/inputs/props.rb +1 -1
- data/productions/examples/sandbox/inputs/styles.rb +1 -1
- data/productions/examples/sandbox/kiosk/players/kiosk.rb +36 -0
- data/productions/examples/sandbox/kiosk/props.rb +6 -0
- data/productions/examples/sandbox/kiosk/styles.rb +34 -0
- data/productions/examples/sandbox/players/sandbox.rb +1 -1
- data/productions/examples/sandbox/rounded_corners/players/box.rb +1 -1
- data/productions/examples/sandbox/rounded_corners/props.rb +1 -1
- data/productions/examples/sandbox/rounded_corners/styles.rb +1 -1
- data/productions/examples/sandbox/scrolling/players/add_button.rb +1 -1
- data/productions/examples/sandbox/scrolling/players/cell.rb +1 -1
- data/productions/examples/sandbox/scrolling/props.rb +1 -1
- data/productions/examples/sandbox/scrolling/styles.rb +1 -1
- data/productions/examples/sandbox/sketching/players/sketchpad.rb +1 -1
- data/productions/examples/sandbox/sketching/props.rb +1 -1
- data/productions/examples/sandbox/sketching/styles.rb +1 -1
- data/productions/examples/sandbox/sounds/players/clip.rb +1 -1
- data/productions/examples/sandbox/sounds/props.rb +1 -1
- data/productions/examples/sandbox/sounds/styles.rb +1 -1
- data/productions/examples/sandbox/spec/alerts/alerts_spec.rb +13 -0
- data/productions/examples/sandbox/stages.rb +2 -1
- data/productions/examples/sandbox/styles.rb +1 -1
- data/productions/examples/sandbox/teaser/players/fader.rb +1 -1
- data/productions/examples/sandbox/teaser/props.rb +1 -1
- data/productions/examples/sandbox/teaser/styles.rb +1 -1
- data/productions/examples/tutorials/tutorial_1/players/sample.rb +1 -1
- data/productions/examples/tutorials/tutorial_1/props.rb +1 -1
- data/productions/examples/tutorials/tutorial_1/styles.rb +1 -1
- data/productions/stage_composer/init.rb +1 -1
- data/productions/stage_composer/inspector/players/inspector.rb +1 -1
- data/productions/stage_composer/inspector/players/prop_row.rb +1 -1
- data/productions/stage_composer/inspector/players/prop_tree.rb +1 -1
- data/productions/stage_composer/inspector/players/style_table.rb +1 -1
- data/productions/stage_composer/inspector/players/style_value.rb +1 -1
- data/productions/stage_composer/inspector/props.rb +1 -1
- data/productions/stage_composer/inspector/styles.rb +1 -1
- data/productions/stage_composer/lib/init.rb +1 -1
- data/productions/stage_composer/lib/limelight/composer/controller.rb +1 -1
- data/productions/stage_composer/lib/limelight/composer/lethargy.rb +1 -1
- data/productions/stage_composer/production.rb +1 -1
- data/productions/stage_composer/stages.rb +1 -1
- data/productions/startup/production.rb +49 -0
- data/productions/startup/spec/default_scene/default_scene_spec.rb +13 -0
- data/productions/startup/spec/spec_helper.rb +5 -0
- data/productions/startup/stages.rb +5 -2
- data/productions/startup/styles.rb +12 -0
- data/productions/startup/welcome/players/browse_button.rb +1 -1
- data/productions/startup/welcome/players/download_button.rb +1 -1
- data/productions/startup/welcome/players/sandbox_button.rb +1 -1
- data/productions/startup/welcome/props.rb +2 -2
- data/productions/startup/welcome/styles.rb +1 -1
- data/spec/builtin/players/button_spec.rb +1 -1
- data/spec/builtin/players/check_box_spec.rb +1 -1
- data/spec/builtin/players/combo_box_spec.rb +1 -1
- data/spec/builtin/players/image_spec.rb +3 -0
- data/spec/builtin/players/password_box_spec.rb +1 -1
- data/spec/builtin/players/radio_button_spec.rb +7 -7
- data/spec/builtin/players/text_area_spec.rb +1 -1
- data/spec/builtin/players/text_box_spec.rb +1 -1
- data/spec/builtin/utilities_production/spec_helper.rb +4 -0
- data/spec/builtin/utilities_production/utilities_production_spec.rb +143 -0
- data/spec/casting_director_spec.rb +7 -7
- data/spec/client/playbills_spec.rb +3 -0
- data/spec/commands/command_spec.rb +9 -1
- data/spec/commands/create_command_spec.rb +35 -5
- data/spec/commands/freeze_command_spec.rb +3 -0
- data/spec/commands/help_command_spec.rb +6 -3
- data/spec/commands/open_command_spec.rb +24 -2
- data/spec/commands/pack_command_spec.rb +3 -0
- data/spec/commands/unpack_command_spec.rb +4 -1
- data/spec/data_spec.rb +5 -16
- data/spec/dsl/production_builder_spec.rb +1 -1
- data/spec/dsl/prop_builder_spec.rb +19 -19
- data/spec/dsl/stage_builder_spec.rb +1 -1
- data/spec/dsl/styles_builder_spec.rb +1 -1
- data/spec/file_chooser_spec.rb +1 -1
- data/spec/file_filter_spec.rb +1 -1
- data/spec/file_loader_spec.rb +1 -1
- data/spec/gems_spec.rb +3 -0
- data/spec/java_util_spec.rb +1 -1
- data/spec/main_spec.rb +4 -1
- data/spec/paint_action_spec.rb +1 -1
- data/spec/pen_spec.rb +1 -1
- data/spec/producer_spec.rb +73 -32
- data/spec/production_spec.rb +23 -44
- data/spec/prop_spec.rb +102 -64
- data/spec/scene_spec.rb +3 -3
- data/spec/spec_helper.rb +3 -2
- data/spec/stage_spec.rb +172 -36
- data/spec/string_spec.rb +3 -0
- data/spec/studio_spec.rb +131 -3
- data/spec/styles_spec.rb +3 -0
- data/spec/templates/production_templater_spec.rb +12 -1
- data/spec/templates/scene_templater_spec.rb +17 -2
- data/spec/templates/templater_logger_spec.rb +3 -0
- data/spec/templates/templater_spec.rb +3 -0
- data/spec/theater_spec.rb +16 -1
- data/spec/util/downloader_spec.rb +3 -0
- metadata +56 -6
- data/lib/i4jruntime.jar +0 -0
- data/lib/junit-4.4.jar +0 -0
@@ -1,58 +1,85 @@
|
|
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
|
require 'spec'
|
2
5
|
require File.expand_path(File.dirname(__FILE__) + "/../../init")
|
3
6
|
require 'limelight/scene'
|
4
7
|
require 'limelight/producer'
|
5
8
|
|
6
|
-
|
7
|
-
|
9
|
+
module Limelight
|
10
|
+
module Specs
|
11
|
+
|
12
|
+
class << self
|
13
|
+
attr_accessor :producer
|
14
|
+
end
|
15
|
+
|
16
|
+
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
|
+
def scene
|
32
|
+
open_scene unless @scene
|
33
|
+
return @scene
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
8
39
|
|
9
40
|
module Spec
|
10
41
|
module Example
|
11
42
|
class ExampleGroup
|
12
43
|
|
13
|
-
def self.uses_scene(scene_name)
|
44
|
+
def self.uses_scene(scene_name, options = {})
|
45
|
+
include Limelight::Specs::SpecHelper
|
46
|
+
|
14
47
|
before(:each) do
|
15
|
-
@
|
48
|
+
@scene_name = scene_name
|
49
|
+
@ll_spec_options = options
|
50
|
+
@scene = nil
|
16
51
|
end
|
17
|
-
|
18
|
-
attr_reader :scene
|
19
52
|
end
|
20
53
|
|
21
54
|
after(:suite) do
|
22
|
-
|
55
|
+
unless Limelight::Specs.producer.nil?
|
56
|
+
Limelight::Specs.producer.theater.stages.each do |stage|
|
57
|
+
# MDM - We do this in a round-about way to reduce the chance of using stubbed or mocked methods.
|
58
|
+
frame = stage.instance_variable_get("@frame")
|
59
|
+
frame.close if frame
|
60
|
+
end
|
61
|
+
end
|
23
62
|
end
|
24
63
|
|
25
64
|
def producer
|
26
|
-
if
|
65
|
+
if Limelight::Specs.producer.nil?
|
27
66
|
if $with_ui
|
28
67
|
Limelight::Main.initializeContext
|
29
68
|
else
|
30
69
|
Limelight::Main.initializeTestContext
|
31
70
|
end
|
32
|
-
$
|
33
|
-
$
|
71
|
+
raise "$PRODUCTION_PATH undefined. Make sure you specify the location of the production in $PRODUCTION_PATH." unless defined?($PRODUCTION_PATH)
|
72
|
+
raise "Could not find production: '#{$PRODUCTION_PATH}'. Check $PRODUCTION_PATH." unless File.exists?($PRODUCTION_PATH)
|
73
|
+
Limelight::Specs.producer = Limelight::Producer.new($PRODUCTION_PATH)
|
74
|
+
Limelight::Specs.producer.load
|
34
75
|
end
|
35
|
-
return
|
76
|
+
return Limelight::Specs.producer
|
36
77
|
end
|
37
78
|
|
38
|
-
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
if !$with_ui
|
43
|
-
module Limelight
|
44
|
-
module UI
|
45
|
-
module Model
|
46
|
-
|
47
|
-
class Frame
|
48
|
-
|
49
|
-
def open
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
|
79
|
+
def production
|
80
|
+
return producer.production
|
55
81
|
end
|
82
|
+
|
56
83
|
end
|
57
84
|
end
|
58
85
|
end
|
data/lib/limelight/stage.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
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
|
-
require 'limelight/dsl/menu_bar'
|
4
|
+
#require 'limelight/dsl/menu_bar'
|
5
5
|
require 'limelight/file_chooser'
|
6
6
|
require 'limelight/util'
|
7
7
|
|
@@ -15,17 +15,20 @@ module Limelight
|
|
15
15
|
class Stage
|
16
16
|
attr_accessor :default_scene
|
17
17
|
attr_reader :frame, :current_scene, :name, :theater
|
18
|
-
|
18
|
+
|
19
|
+
attr_accessor :should_remain_hidden #:nodoc:
|
20
|
+
|
19
21
|
include UI::Api::Stage
|
20
22
|
|
21
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
|
22
24
|
# it will default to 'default'. A stage name must be unique, so it is recommended you provide a name.
|
23
25
|
#
|
24
|
-
def initialize(theater, name=
|
26
|
+
def initialize(theater, name, options = {})
|
25
27
|
@theater = theater
|
26
28
|
@name = name
|
27
29
|
build_frame
|
28
30
|
self.title = @name
|
31
|
+
apply_options(options)
|
29
32
|
end
|
30
33
|
|
31
34
|
# Returns the title that is displayed at the top of the window that this stage represents.
|
@@ -40,36 +43,142 @@ module Limelight
|
|
40
43
|
@frame.title = value
|
41
44
|
end
|
42
45
|
|
43
|
-
# Returns the width and height of the Stage.
|
46
|
+
# Returns the width and height styles of the Stage.
|
44
47
|
#
|
45
48
|
# width, height = stage.size
|
46
49
|
#
|
47
50
|
def size
|
48
|
-
return @frame.
|
51
|
+
return @frame.width_style.to_s, @frame.height_style.to_s
|
49
52
|
end
|
50
53
|
|
51
|
-
# Sets the width and height of the Stage.
|
54
|
+
# Sets the width and height styles of the Stage.
|
52
55
|
#
|
53
56
|
# state.size = [100, 200]
|
57
|
+
# state.size = ["50%", "100%"] # consuming 50% of the width and 100% of the height of the screen
|
54
58
|
#
|
55
|
-
def size=(values)
|
56
|
-
|
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])
|
57
62
|
end
|
58
63
|
|
59
|
-
# The location of the Stage
|
64
|
+
# The location styles of the Stage.
|
60
65
|
#
|
61
66
|
# x, y = stage.location
|
62
67
|
#
|
63
68
|
def location
|
64
|
-
return @frame.
|
69
|
+
return @frame.getXLocationStyle.to_s, @frame.getYLocationStyle.to_s
|
65
70
|
end
|
66
71
|
|
67
|
-
# Sets the location of the Stage
|
72
|
+
# Sets the location styles of the Stage.
|
68
73
|
#
|
69
74
|
# stage.location = [500, 200]
|
70
75
|
#
|
71
|
-
def location=
|
72
|
-
|
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?
|
73
182
|
end
|
74
183
|
|
75
184
|
# Opens the Stage and loads the provided Scene.
|
@@ -77,9 +186,10 @@ module Limelight
|
|
77
186
|
# See load_scene
|
78
187
|
#
|
79
188
|
def open(scene)
|
189
|
+
scene.stage = self
|
80
190
|
scene.illuminate
|
81
191
|
load_scene(scene)
|
82
|
-
@frame.open
|
192
|
+
@frame.open unless @should_remain_hidden
|
83
193
|
scene.visible = true
|
84
194
|
scene.scene_opened(self)
|
85
195
|
end
|
@@ -87,18 +197,19 @@ module Limelight
|
|
87
197
|
# Closes the Stage. It's window will no longer be displayed on the screen.
|
88
198
|
#
|
89
199
|
def close
|
200
|
+
@theater.stage_closed(self)
|
90
201
|
@frame.close
|
202
|
+
@current_scene.visible = false if @current_scene
|
203
|
+
@current_scene = nil
|
91
204
|
end
|
92
205
|
|
93
206
|
# Loads a scene on the Stage. If the Stage is currently hosting a Scene, the original Scene will be removed and
|
94
207
|
# the new Scene will replace it.
|
95
208
|
#
|
96
209
|
def load_scene(scene)
|
97
|
-
@frame.setJMenuBar(scene.menu_bar)
|
210
|
+
# @frame.setJMenuBar(scene.menu_bar)
|
98
211
|
@frame.load(scene.panel)
|
99
|
-
scene.
|
100
|
-
# scene.panel.snap_to_size # What's this for?
|
101
|
-
if(has_static_size?(scene.style))
|
212
|
+
if (has_static_size?(scene.style))
|
102
213
|
@frame.set_size(scene.style.compiled_width.value + @frame.getHorizontalInsetWidth, scene.style.compiled_height.value + @frame.getVerticalInsetWidth)
|
103
214
|
end
|
104
215
|
@current_scene = scene
|
@@ -120,7 +231,27 @@ module Limelight
|
|
120
231
|
# Pops up a simple modal dialog with the provided message.
|
121
232
|
#
|
122
233
|
def alert(message)
|
123
|
-
|
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
|
124
255
|
end
|
125
256
|
|
126
257
|
protected #############################################
|
@@ -130,7 +261,7 @@ module Limelight
|
|
130
261
|
end
|
131
262
|
|
132
263
|
private ###############################################
|
133
|
-
|
264
|
+
|
134
265
|
def build_frame
|
135
266
|
@frame = new_frame
|
136
267
|
@frame.set_size(800, 800)
|
@@ -145,8 +276,17 @@ module Limelight
|
|
145
276
|
def is_static?(value)
|
146
277
|
return !(value.to_s.include?("%")) && !(value.to_s == "auto")
|
147
278
|
end
|
148
|
-
|
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
|
+
|
149
289
|
end
|
150
|
-
|
290
|
+
|
151
291
|
end
|
152
292
|
|
data/lib/limelight/string.rb
CHANGED
data/lib/limelight/studio.rb
CHANGED
@@ -1,29 +1,166 @@
|
|
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
|
require 'limelight/producer'
|
2
5
|
|
3
6
|
module Limelight
|
4
7
|
|
8
|
+
# A Studio creates Productions. There is only one instance of Studio per Limelight runtime. All open productions
|
9
|
+
# are opened by the studio.
|
10
|
+
#
|
5
11
|
class Studio
|
6
12
|
|
7
13
|
include Limelight::UI::Api::Studio
|
8
14
|
|
9
15
|
class << self
|
10
16
|
|
11
|
-
def install
|
12
|
-
Context.instance.studio = instance
|
17
|
+
def install #:nodoc:
|
18
|
+
Context.instance.studio = instance
|
13
19
|
end
|
14
20
|
|
15
|
-
def instance
|
21
|
+
def instance #:nodoc:
|
16
22
|
@studio = self.new if @studio.nil?
|
17
23
|
return @studio
|
18
24
|
end
|
19
25
|
|
26
|
+
def index(production) #:nodoc:
|
27
|
+
@index = [] if @index.nil?
|
28
|
+
if name_taken?(production.name)
|
29
|
+
assign_unique_name(production)
|
30
|
+
elsif production.name.nil?
|
31
|
+
assign_name_to(production)
|
32
|
+
else
|
33
|
+
error_if_duplicate_name(production.name)
|
34
|
+
end
|
35
|
+
@index << production
|
36
|
+
end
|
37
|
+
|
38
|
+
# Returns the production with the specified name that was previously opened but the Studio.
|
39
|
+
#
|
40
|
+
def [](name)
|
41
|
+
return nil if @index.nil?
|
42
|
+
return @index.find { |production| production.name == name }
|
43
|
+
end
|
44
|
+
|
45
|
+
def name_taken?(name) #:nodoc:
|
46
|
+
return self[name] != nil
|
47
|
+
end
|
48
|
+
|
49
|
+
def reset #:nodoc:
|
50
|
+
@index = []
|
51
|
+
@is_shutdown = false
|
52
|
+
@is_shutting_down = false
|
53
|
+
@studio = nil
|
54
|
+
end
|
55
|
+
|
56
|
+
def error_if_duplicate_name(name) #:nodoc:
|
57
|
+
raise Limelight::LimelightException.new("Production name '#{name}' is already taken") if name_taken?(name)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Opens the production at the specified path.
|
61
|
+
#
|
62
|
+
def open(production_path)
|
63
|
+
begin
|
64
|
+
producer = Producer.new(production_path)
|
65
|
+
production = producer.production
|
66
|
+
index(production)
|
67
|
+
producer.open
|
68
|
+
return production
|
69
|
+
rescue Exception => e
|
70
|
+
# TODO MDM - open the error in a window
|
71
|
+
puts e
|
72
|
+
puts e.backtrace
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Returns true if all of the open productions allow closing.
|
77
|
+
#
|
78
|
+
def should_allow_shutdown
|
79
|
+
return true if @index.nil?
|
80
|
+
return @index.all? { |production| production.allow_close? }
|
81
|
+
end
|
82
|
+
|
83
|
+
# If allowed (should_allow_shutdown), this will close all open productions and shutdown the limelight runtime.
|
84
|
+
#
|
85
|
+
def shutdown
|
86
|
+
return if @is_shutdown || @is_shutting_down
|
87
|
+
return unless should_allow_shutdown
|
88
|
+
@is_shutting_down = true
|
89
|
+
@index.each { |production| production.close }
|
90
|
+
@utilities_production.close if @utilities_production
|
91
|
+
@is_shutdown = true
|
92
|
+
Thread.new { Context.instance().shutdown }
|
93
|
+
end
|
94
|
+
|
95
|
+
# Called when a production is closed to notify the studio of the event.
|
96
|
+
#
|
97
|
+
def production_closed(production)
|
98
|
+
@index.delete(production)
|
99
|
+
shutdown if(@index.empty?)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Returns an array of all the productions
|
103
|
+
#
|
104
|
+
def productions
|
105
|
+
return @index.nil? ? [] : @index.dup
|
106
|
+
end
|
107
|
+
|
108
|
+
# Publish the Studio, using DRb, on the specified port.
|
109
|
+
#
|
110
|
+
def publish_on_drb(port)
|
111
|
+
@drb_server = DRb.start_service("druby://0.0.0.0:#{port}", self)
|
112
|
+
end
|
113
|
+
|
114
|
+
# Returns the utilities production; a production used by limelight.
|
115
|
+
#
|
116
|
+
def utilities_production
|
117
|
+
if @utilities_production == nil
|
118
|
+
producer = Producer.new(File.join($LIMELIGHT_LIB, "limelight", "builtin", "utilities_production"))
|
119
|
+
@utilities_production = producer.production
|
120
|
+
producer.open
|
121
|
+
end
|
122
|
+
return @utilities_production
|
123
|
+
end
|
124
|
+
|
125
|
+
private #############################################
|
126
|
+
|
127
|
+
def assign_unique_name(production) #:nodoc:
|
128
|
+
count = 2
|
129
|
+
name = production.name
|
130
|
+
while name_taken?(name)
|
131
|
+
name = "#{production.name}_#{count}"
|
132
|
+
count += 1
|
133
|
+
end
|
134
|
+
production.name = name
|
135
|
+
end
|
136
|
+
|
137
|
+
def assign_name_to(production) #:nodoc:
|
138
|
+
count = @index.length + 1
|
139
|
+
while name_taken?(count.to_s)
|
140
|
+
count += 1
|
141
|
+
end
|
142
|
+
production.name = count.to_s
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
# Same as the class level method.
|
148
|
+
#
|
149
|
+
def open(production_path)
|
150
|
+
self.class.open(production_path)
|
20
151
|
end
|
21
152
|
|
22
|
-
|
23
|
-
|
24
|
-
|
153
|
+
# Same as the class level method.
|
154
|
+
#
|
155
|
+
def should_allow_shutdown
|
156
|
+
return self.class.should_allow_shutdown
|
25
157
|
end
|
26
158
|
|
159
|
+
# Same as the class level method.
|
160
|
+
#
|
161
|
+
def shutdown
|
162
|
+
self.class.shutdown()
|
163
|
+
end
|
27
164
|
end
|
28
165
|
|
29
166
|
end
|
data/lib/limelight/styles.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
|
@@ -329,6 +329,19 @@ module Limelight
|
|
329
329
|
# style.y = <value>
|
330
330
|
#
|
331
331
|
Y = Limelight::Styles::Style::STYLE_LIST.get(53)
|
332
|
+
|
333
|
+
# Specifies the starting X coordinate of background images.
|
334
|
+
#
|
335
|
+
# style.background_image_x = <value>
|
336
|
+
#
|
337
|
+
BackgroundImageX = Limelight::Styles::Style::STYLE_LIST.get(54)
|
338
|
+
|
339
|
+
# Specifies the Y of a prop.
|
340
|
+
#
|
341
|
+
# style.background_images_y = <value>
|
342
|
+
#
|
343
|
+
BackgroundImageY = Limelight::Styles::Style::STYLE_LIST.get(55)
|
344
|
+
|
332
345
|
end
|
333
346
|
|
334
347
|
end
|
@@ -1,5 +1,9 @@
|
|
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
|
require 'limelight/templates/templater'
|
2
5
|
require 'limelight/string'
|
6
|
+
require 'limelight/version'
|
3
7
|
|
4
8
|
module Limelight
|
5
9
|
module Templates
|
@@ -9,7 +13,6 @@ module Limelight
|
|
9
13
|
#
|
10
14
|
# creating directory: ./love_story
|
11
15
|
# creating file: ./love_story/production.rb
|
12
|
-
# creating file: ./love_story/init.rb
|
13
16
|
# creating file: ./love_story/stages.rb
|
14
17
|
# creating file: ./love_story/styles.rb
|
15
18
|
#
|
@@ -25,15 +28,16 @@ module Limelight
|
|
25
28
|
@tokens = {}
|
26
29
|
@tokens[:DEFAULT_SCENE_NAME] = default_scene_name
|
27
30
|
@tokens[:PRODUCTION_NAME] = File.basename(production_path).titleized
|
31
|
+
@tokens[:CURRENT_VERSION] = Limelight::VERSION::STRING
|
28
32
|
end
|
29
33
|
|
30
34
|
# Generates the files
|
31
35
|
#
|
32
36
|
def generate
|
33
37
|
file(File.join(@production_path, "production.rb"), "production/production.rb.template", @tokens)
|
34
|
-
file(File.join(@production_path, "init.rb"), "production/init.rb.template", @tokens)
|
35
38
|
file(File.join(@production_path, "stages.rb"), "production/stages.rb.template", @tokens)
|
36
39
|
file(File.join(@production_path, "styles.rb"), "production/styles.rb.template", @tokens)
|
40
|
+
file(File.join(@production_path, "spec", "spec_helper.rb"), "production/spec/spec_helper.rb.template", @tokens)
|
37
41
|
end
|
38
42
|
|
39
43
|
end
|
@@ -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
|
require 'limelight/templates/templater'
|
2
5
|
require 'limelight/string'
|
3
6
|
|
@@ -18,21 +21,23 @@ module Limelight
|
|
18
21
|
|
19
22
|
# The scene_path should be path to a desired scene inside a production directory.
|
20
23
|
#
|
21
|
-
def initialize(scene_path)
|
22
|
-
super(
|
23
|
-
@
|
24
|
-
|
24
|
+
def initialize(production_path, scene_path)
|
25
|
+
super(production_path, Templater.source_dir)
|
26
|
+
@production_path = production_path
|
27
|
+
@scene_path = scene_path
|
28
|
+
@scene_name = File.basename(scene_path)
|
25
29
|
@tokens = {}
|
26
|
-
@tokens[:SCENE_NAME] = scene_name
|
27
|
-
@tokens[:SCENE_TITLE] = scene_name.titleized
|
30
|
+
@tokens[:SCENE_NAME] = @scene_name
|
31
|
+
@tokens[:SCENE_TITLE] = @scene_name.titleized
|
28
32
|
end
|
29
33
|
|
30
|
-
#
|
34
|
+
# Generates the files
|
31
35
|
#
|
32
36
|
def generate
|
33
37
|
file(File.join(@scene_path, "props.rb"), "scene/props.rb.template", @tokens)
|
34
38
|
file(File.join(@scene_path, "styles.rb"), "scene/styles.rb.template", @tokens)
|
35
39
|
directory(File.join(@scene_path, "players"))
|
40
|
+
file(File.join("spec", @scene_path, "#{@scene_name}_spec.rb"), "scene_spec/scene_spec.rb.template", @tokens)
|
36
41
|
end
|
37
42
|
|
38
43
|
end
|