limelight 0.5.5-java → 0.6.14-java
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +19 -0
- data/bin/limelight +7 -3
- data/ruby/lib/limelight-rb.jar +0 -0
- data/ruby/lib/limelight.jar +0 -0
- data/ruby/lib/limelight.rb +48 -0
- data/{lib → ruby/lib}/limelight/animation.rb +3 -3
- data/ruby/lib/limelight/builtin/players.rb +21 -0
- data/ruby/lib/limelight/builtin/players/button.rb +7 -0
- data/ruby/lib/limelight/builtin/players/check_box.rb +24 -0
- data/ruby/lib/limelight/builtin/players/combo_box.rb +50 -0
- data/ruby/lib/limelight/builtin/players/curtains.rb +12 -0
- data/ruby/lib/limelight/builtin/players/image.rb +38 -0
- data/ruby/lib/limelight/builtin/players/radio_button.rb +36 -0
- data/ruby/lib/limelight/builtin/players/stage_mover.rb +19 -0
- data/ruby/lib/limelight/builtin/players/stage_sizer.rb +23 -0
- data/ruby/lib/limelight/builtin/players/text_area.rb +10 -0
- data/ruby/lib/limelight/builtin/players/text_box.rb +10 -0
- data/{lib → ruby/lib}/limelight/dsl/build_exception.rb +2 -2
- data/{lib → ruby/lib}/limelight/dsl/menu_bar.rb +3 -3
- data/{lib → ruby/lib}/limelight/dsl/prop_builder.rb +25 -16
- data/{lib → ruby/lib}/limelight/dsl/stage_builder.rb +4 -4
- data/{lib → ruby/lib}/limelight/dsl/styles_builder.rb +14 -18
- data/{lib → ruby/lib}/limelight/file_chooser.rb +10 -10
- data/{lib → ruby/lib}/limelight/file_filter.rb +6 -6
- data/ruby/lib/limelight/java_couplings.rb +70 -0
- data/{lib → ruby/lib}/limelight/java_util.rb +6 -6
- data/{lib → ruby/lib}/limelight/limelight_exception.rb +3 -3
- data/ruby/lib/limelight/limelight_init.rb +24 -0
- data/ruby/lib/limelight/main.rb +15 -0
- data/ruby/lib/limelight/mouse.rb +76 -0
- data/ruby/lib/limelight/optionable.rb +42 -0
- data/{lib → ruby/lib}/limelight/paint_action.rb +8 -8
- data/{lib → ruby/lib}/limelight/pen.rb +7 -7
- data/ruby/lib/limelight/player.rb +148 -0
- data/ruby/lib/limelight/player_recruiter.rb +54 -0
- data/ruby/lib/limelight/production.rb +257 -0
- data/ruby/lib/limelight/prop.rb +344 -0
- data/ruby/lib/limelight/scene.rb +120 -0
- data/ruby/lib/limelight/specs/spec_helper.rb +191 -0
- data/ruby/lib/limelight/stage.rb +268 -0
- data/ruby/lib/limelight/string.rb +32 -0
- data/{lib → ruby/lib}/limelight/studio.rb +4 -3
- data/ruby/lib/limelight/style.rb +294 -0
- data/ruby/lib/limelight/templates/sources/features/step_definitions/limelight_steps.rb.template +47 -0
- data/ruby/lib/limelight/templates/sources/features/support/env.rb.template +35 -0
- data/{lib → ruby/lib}/limelight/templates/sources/freezing/limelight_init.rb.template +0 -0
- data/{lib → ruby/lib}/limelight/templates/sources/production/production.rb.template +2 -2
- data/{lib → ruby/lib}/limelight/templates/sources/production/spec/spec_helper.rb.template +0 -0
- data/{lib → ruby/lib}/limelight/templates/sources/production/stages.rb.template +0 -0
- data/{lib → ruby/lib}/limelight/templates/sources/production/styles.rb.template +0 -0
- data/ruby/lib/limelight/templates/sources/project/Rakefile.template +15 -0
- data/ruby/lib/limelight/templates/sources/project/spec_helper.rb.template +12 -0
- data/{lib → ruby/lib}/limelight/templates/sources/scene/props.rb.template +0 -0
- data/{lib → ruby/lib}/limelight/templates/sources/scene/styles.rb.template +0 -0
- data/{lib → ruby/lib}/limelight/templates/sources/scene_spec/scene_spec.rb.template +0 -0
- data/ruby/lib/limelight/theater.rb +76 -0
- data/{lib → ruby/lib}/limelight/util.rb +6 -25
- data/ruby/lib/limelight/util/hashes.rb +39 -0
- data/ruby/lib/limelight/util/map_hash.rb +191 -0
- data/ruby/lib/limelight/util/string_hash.rb +64 -0
- metadata +97 -390
- data/bin/icons/icon.ico +0 -0
- data/bin/icons/icon_48.gif +0 -0
- data/bin/icons/limelight.icns +0 -0
- data/bin/ll +0 -10
- data/bin/ll.bat +0 -5
- data/lib/init.rb +0 -12
- data/lib/limelight.jar +0 -0
- data/lib/limelight/builtin/players.rb +0 -16
- data/lib/limelight/builtin/players/button.rb +0 -39
- data/lib/limelight/builtin/players/check_box.rb +0 -50
- data/lib/limelight/builtin/players/combo_box.rb +0 -89
- data/lib/limelight/builtin/players/combo_box_popup_list.rb +0 -19
- data/lib/limelight/builtin/players/combo_box_popup_list_item.rb +0 -21
- data/lib/limelight/builtin/players/curtains.rb +0 -23
- data/lib/limelight/builtin/players/image.rb +0 -54
- data/lib/limelight/builtin/players/password_box.rb +0 -34
- data/lib/limelight/builtin/players/radio_button.rb +0 -65
- data/lib/limelight/builtin/players/stage_mover.rb +0 -31
- data/lib/limelight/builtin/players/stage_sizer.rb +0 -34
- data/lib/limelight/builtin/players/text_area.rb +0 -34
- data/lib/limelight/builtin/players/text_box.rb +0 -34
- data/lib/limelight/builtin/styles.rb +0 -35
- data/lib/limelight/builtin/utilities_production/alert/players/alert.rb +0 -14
- data/lib/limelight/builtin/utilities_production/alert/props.rb +0 -8
- data/lib/limelight/builtin/utilities_production/alert/styles.rb +0 -14
- data/lib/limelight/builtin/utilities_production/incompatible_version/props.rb +0 -20
- data/lib/limelight/builtin/utilities_production/incompatible_version/styles.rb +0 -12
- data/lib/limelight/builtin/utilities_production/production.rb +0 -66
- data/lib/limelight/builtin/utilities_production/stages.rb +0 -12
- data/lib/limelight/builtin/utilities_production/styles.rb +0 -53
- data/lib/limelight/button_group_cache.rb +0 -11
- data/lib/limelight/casting_director.rb +0 -112
- data/lib/limelight/commands/command.rb +0 -168
- data/lib/limelight/commands/create_command.rb +0 -98
- data/lib/limelight/commands/freeze_command.rb +0 -131
- data/lib/limelight/commands/help_command.rb +0 -61
- data/lib/limelight/commands/open_command.rb +0 -60
- data/lib/limelight/commands/pack_command.rb +0 -53
- data/lib/limelight/commands/unpack_command.rb +0 -44
- data/lib/limelight/commands/version_command.rb +0 -31
- data/lib/limelight/data.rb +0 -37
- data/lib/limelight/file_loader.rb +0 -46
- data/lib/limelight/gems.rb +0 -51
- data/lib/limelight/java_couplings.rb +0 -67
- data/lib/limelight/limelight_init.rb +0 -12
- data/lib/limelight/main.rb +0 -105
- data/lib/limelight/producer.rb +0 -233
- data/lib/limelight/production.rb +0 -203
- data/lib/limelight/prop.rb +0 -367
- data/lib/limelight/scene.rb +0 -151
- data/lib/limelight/specs/spec_helper.rb +0 -136
- data/lib/limelight/specs/test_scene_opener.rb +0 -63
- data/lib/limelight/stage.rb +0 -353
- data/lib/limelight/string.rb +0 -38
- data/lib/limelight/styles/style.rb +0 -288
- data/lib/limelight/templates/production_templater.rb +0 -49
- data/lib/limelight/templates/scene_templater.rb +0 -47
- data/lib/limelight/templates/sources/production/init.rb.template +0 -15
- data/lib/limelight/templates/templater.rb +0 -131
- data/lib/limelight/templates/templater_logger.rb +0 -39
- data/lib/limelight/theater.rb +0 -109
- data/lib/limelight/util/downloader.rb +0 -115
- data/lib/limelight/version.rb +0 -20
- data/productions/examples/8thlight.com/about/about.txt +0 -24
- data/productions/examples/8thlight.com/about/props.rb +0 -11
- data/productions/examples/8thlight.com/about/styles.rb +0 -2
- data/productions/examples/8thlight.com/footer.rb +0 -6
- data/productions/examples/8thlight.com/home/props.rb +0 -28
- data/productions/examples/8thlight.com/home/styles.rb +0 -2
- 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 +0 -11
- data/productions/examples/8thlight.com/services/props.rb +0 -11
- data/productions/examples/8thlight.com/services/services.txt +0 -8
- data/productions/examples/8thlight.com/services/styles.rb +0 -2
- data/productions/examples/8thlight.com/stages.rb +0 -8
- data/productions/examples/8thlight.com/styles.rb +0 -210
- data/productions/examples/calculator/players/button.rb +0 -24
- data/productions/examples/calculator/players/calculator.rb +0 -15
- data/productions/examples/calculator/players/calculator_model.rb +0 -13
- data/productions/examples/calculator/props.rb +0 -23
- data/productions/examples/calculator/styles.rb +0 -36
- data/productions/examples/langstons_ant/html_javascript/ant.css +0 -39
- data/productions/examples/langstons_ant/html_javascript/ant.html +0 -22
- data/productions/examples/langstons_ant/html_javascript/ant.js +0 -23
- data/productions/examples/langstons_ant/init.rb +0 -4
- data/productions/examples/langstons_ant/players/ant.rb +0 -103
- data/productions/examples/langstons_ant/players/log.rb +0 -29
- data/productions/examples/langstons_ant/players/start_stop_button.rb +0 -37
- data/productions/examples/langstons_ant/players/world.rb +0 -35
- data/productions/examples/langstons_ant/props.rb +0 -22
- data/productions/examples/langstons_ant/styles.rb +0 -104
- data/productions/examples/sandbox/alerts/incompatible_production/default_scene/props.rb +0 -10
- data/productions/examples/sandbox/alerts/incompatible_production/default_scene/styles.rb +0 -32
- data/productions/examples/sandbox/alerts/incompatible_production/production.rb +0 -52
- data/productions/examples/sandbox/alerts/incompatible_production/spec/default_scene/default_scene_spec.rb +0 -16
- data/productions/examples/sandbox/alerts/incompatible_production/spec/spec_helper.rb +0 -8
- data/productions/examples/sandbox/alerts/incompatible_production/stages.rb +0 -20
- data/productions/examples/sandbox/alerts/incompatible_production/styles.rb +0 -15
- data/productions/examples/sandbox/alerts/players/alerts.rb +0 -17
- data/productions/examples/sandbox/alerts/props.rb +0 -10
- data/productions/examples/sandbox/alerts/styles.rb +0 -46
- data/productions/examples/sandbox/background_images/props.rb +0 -22
- data/productions/examples/sandbox/background_images/styles.rb +0 -40
- data/productions/examples/sandbox/click_me/players/chromaton.rb +0 -52
- data/productions/examples/sandbox/click_me/props.rb +0 -8
- data/productions/examples/sandbox/click_me/styles.rb +0 -11
- data/productions/examples/sandbox/floaters/players/floater.rb +0 -108
- data/productions/examples/sandbox/floaters/players/surface.rb +0 -21
- data/productions/examples/sandbox/floaters/props.rb +0 -10
- data/productions/examples/sandbox/floaters/styles.rb +0 -24
- data/productions/examples/sandbox/frameing/players/sandbox.rb +0 -17
- data/productions/examples/sandbox/frameing/props.rb +0 -35
- data/productions/examples/sandbox/frameing/styles.rb +0 -45
- data/productions/examples/sandbox/gradients/players/spinner.rb +0 -20
- data/productions/examples/sandbox/gradients/players/teaser.rb +0 -19
- data/productions/examples/sandbox/gradients/players/wave.rb +0 -19
- data/productions/examples/sandbox/gradients/players/waves.rb +0 -19
- data/productions/examples/sandbox/gradients/props.rb +0 -13
- data/productions/examples/sandbox/gradients/styles.rb +0 -47
- data/productions/examples/sandbox/header.rb +0 -22
- data/productions/examples/sandbox/homer/players/homer.rb +0 -24
- data/productions/examples/sandbox/homer/props.rb +0 -10
- data/productions/examples/sandbox/homer/styles.rb +0 -16
- 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 +0 -36
- data/productions/examples/sandbox/images_scene/styles.rb +0 -34
- data/productions/examples/sandbox/inputs/players/button_input.rb +0 -48
- data/productions/examples/sandbox/inputs/players/check_box_input.rb +0 -40
- data/productions/examples/sandbox/inputs/players/combo_box_input.rb +0 -41
- data/productions/examples/sandbox/inputs/players/radio_button_input.rb +0 -43
- data/productions/examples/sandbox/inputs/players/text_area_input.rb +0 -36
- data/productions/examples/sandbox/inputs/players/text_box_input.rb +0 -36
- data/productions/examples/sandbox/inputs/props.rb +0 -40
- data/productions/examples/sandbox/inputs/styles.rb +0 -39
- data/productions/examples/sandbox/kiosk/players/kiosk.rb +0 -39
- data/productions/examples/sandbox/kiosk/props.rb +0 -9
- data/productions/examples/sandbox/kiosk/styles.rb +0 -37
- data/productions/examples/sandbox/players/sandbox.rb +0 -11
- data/productions/examples/sandbox/rounded_corners/players/box.rb +0 -11
- data/productions/examples/sandbox/rounded_corners/props.rb +0 -22
- data/productions/examples/sandbox/rounded_corners/styles.rb +0 -17
- data/productions/examples/sandbox/scrolling/players/add_button.rb +0 -19
- data/productions/examples/sandbox/scrolling/players/cell.rb +0 -15
- data/productions/examples/sandbox/scrolling/props.rb +0 -45
- data/productions/examples/sandbox/scrolling/styles.rb +0 -33
- data/productions/examples/sandbox/sketching/players/sketchpad.rb +0 -46
- data/productions/examples/sandbox/sketching/props.rb +0 -25
- data/productions/examples/sandbox/sketching/styles.rb +0 -35
- 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 +0 -10
- data/productions/examples/sandbox/sounds/props.rb +0 -10
- data/productions/examples/sandbox/sounds/styles.rb +0 -17
- data/productions/examples/sandbox/spec/alerts/alerts_spec.rb +0 -16
- data/productions/examples/sandbox/stage_handles/players/sizer.rb +0 -38
- data/productions/examples/sandbox/stage_handles/props.rb +0 -17
- data/productions/examples/sandbox/stage_handles/styles.rb +0 -58
- data/productions/examples/sandbox/stages.rb +0 -8
- data/productions/examples/sandbox/styles.rb +0 -35
- data/productions/examples/sandbox/teaser/players/fader.rb +0 -58
- data/productions/examples/sandbox/teaser/props.rb +0 -14
- data/productions/examples/sandbox/teaser/styles.rb +0 -21
- data/productions/examples/tutorials/tutorial_1/players/sample.rb +0 -11
- data/productions/examples/tutorials/tutorial_1/props.rb +0 -9
- data/productions/examples/tutorials/tutorial_1/styles.rb +0 -25
- data/productions/stage_composer/init.rb +0 -10
- data/productions/stage_composer/inspector/players/inspector.rb +0 -80
- data/productions/stage_composer/inspector/players/prop_row.rb +0 -12
- data/productions/stage_composer/inspector/players/prop_tree.rb +0 -33
- data/productions/stage_composer/inspector/players/style_table.rb +0 -12
- data/productions/stage_composer/inspector/players/style_value.rb +0 -16
- data/productions/stage_composer/inspector/props.rb +0 -19
- data/productions/stage_composer/inspector/styles.rb +0 -71
- data/productions/stage_composer/lib/init.rb +0 -5
- data/productions/stage_composer/lib/limelight/composer/controller.rb +0 -51
- data/productions/stage_composer/lib/limelight/composer/lethargy.rb +0 -24
- data/productions/stage_composer/production.rb +0 -6
- data/productions/stage_composer/stages.rb +0 -15
- data/productions/startup/images/logo.png +0 -0
- data/productions/startup/images/splash.png +0 -0
- data/productions/startup/production.rb +0 -52
- data/productions/startup/spec/default_scene/default_scene_spec.rb +0 -16
- data/productions/startup/spec/spec_helper.rb +0 -8
- data/productions/startup/stages.rb +0 -9
- data/productions/startup/styles.rb +0 -15
- data/productions/startup/welcome/players/browse_button.rb +0 -10
- data/productions/startup/welcome/players/download_button.rb +0 -17
- data/productions/startup/welcome/players/sandbox_button.rb +0 -11
- data/productions/startup/welcome/props.rb +0 -23
- data/productions/startup/welcome/styles.rb +0 -103
- data/spec/limelight/builtin/players/button_spec.rb +0 -20
- data/spec/limelight/builtin/players/check_box_spec.rb +0 -29
- data/spec/limelight/builtin/players/combo_box_spec.rb +0 -29
- data/spec/limelight/builtin/players/image_spec.rb +0 -43
- data/spec/limelight/builtin/players/password_box_spec.rb +0 -27
- data/spec/limelight/builtin/players/radio_button_spec.rb +0 -64
- data/spec/limelight/builtin/players/stage_mover_spec.rb +0 -36
- data/spec/limelight/builtin/players/stage_sizer_spec.rb +0 -40
- data/spec/limelight/builtin/players/text_area_spec.rb +0 -27
- data/spec/limelight/builtin/players/text_box_spec.rb +0 -27
- data/spec/limelight/builtin/utilities_production/spec_helper.rb +0 -7
- data/spec/limelight/builtin/utilities_production/utilities_production_spec.rb +0 -147
- data/spec/limelight/casting_director_spec.rb +0 -164
- data/spec/limelight/commands/command_spec.rb +0 -26
- data/spec/limelight/commands/create_command_spec.rb +0 -108
- data/spec/limelight/commands/freeze_command_spec.rb +0 -143
- data/spec/limelight/commands/help_command_spec.rb +0 -42
- data/spec/limelight/commands/open_command_spec.rb +0 -53
- data/spec/limelight/commands/pack_command_spec.rb +0 -43
- data/spec/limelight/commands/unpack_command_spec.rb +0 -47
- data/spec/limelight/data_spec.rb +0 -36
- data/spec/limelight/dsl/prop_builder_spec.rb +0 -245
- data/spec/limelight/dsl/stage_builder_spec.rb +0 -90
- data/spec/limelight/dsl/styles_builder_spec.rb +0 -194
- data/spec/limelight/file_chooser_spec.rb +0 -64
- data/spec/limelight/file_filter_spec.rb +0 -29
- data/spec/limelight/file_loader_spec.rb +0 -28
- data/spec/limelight/gems_spec.rb +0 -92
- data/spec/limelight/java_util_spec.rb +0 -37
- data/spec/limelight/main_spec.rb +0 -40
- data/spec/limelight/paint_action_spec.rb +0 -30
- data/spec/limelight/pen_spec.rb +0 -62
- data/spec/limelight/producer_spec.rb +0 -246
- data/spec/limelight/production_spec.rb +0 -97
- data/spec/limelight/prop_spec.rb +0 -431
- data/spec/limelight/scene_spec.rb +0 -173
- data/spec/limelight/stage_spec.rb +0 -247
- data/spec/limelight/string_spec.rb +0 -38
- data/spec/limelight/templates/production_templater_spec.rb +0 -66
- data/spec/limelight/templates/scene_templater_spec.rb +0 -51
- data/spec/limelight/templates/templater_logger_spec.rb +0 -41
- data/spec/limelight/templates/templater_spec.rb +0 -107
- data/spec/limelight/theater_spec.rb +0 -120
- data/spec/limelight/util/downloader_spec.rb +0 -92
- data/spec/spec_helper.rb +0 -64
data/lib/limelight/producer.rb
DELETED
@@ -1,233 +0,0 @@
|
|
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/file_loader'
|
5
|
-
require 'limelight/dsl/prop_builder'
|
6
|
-
require 'limelight/dsl/styles_builder'
|
7
|
-
require 'limelight/dsl/stage_builder'
|
8
|
-
require 'limelight/casting_director'
|
9
|
-
require 'limelight/stage'
|
10
|
-
require 'limelight/dsl/build_exception'
|
11
|
-
require 'limelight/theater'
|
12
|
-
require 'limelight/production'
|
13
|
-
require 'limelight/gems'
|
14
|
-
require 'limelight/util/downloader'
|
15
|
-
require 'limelight/version'
|
16
|
-
require 'drb'
|
17
|
-
|
18
|
-
module Limelight
|
19
|
-
|
20
|
-
# A Producer has the hefty responsibility of producing Productions. Given a directory, it will load the neccessary
|
21
|
-
# files and create all the neccessary objects to bring a Production to life. A producer will produce only
|
22
|
-
# one production.
|
23
|
-
#
|
24
|
-
# For directory structures, see Limelight::Main
|
25
|
-
#
|
26
|
-
class Producer
|
27
|
-
|
28
|
-
class << self
|
29
|
-
# Creates a new Producer and has it open a Production by specified name.
|
30
|
-
#
|
31
|
-
def open(production_name, options={})
|
32
|
-
producer = new(production_name)
|
33
|
-
begin
|
34
|
-
producer.open(options)
|
35
|
-
rescue Exception => e
|
36
|
-
puts e
|
37
|
-
puts e.backtrace
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# Returns a hash of all the built-in Limglight Styles
|
42
|
-
#
|
43
|
-
def builtin_styles
|
44
|
-
unless @builtin_styles
|
45
|
-
builtin_styles_file = File.join($LIMELIGHT_LIB, "limelight", "builtin", "styles.rb")
|
46
|
-
@builtin_styles = Limelight.build_styles_from_file(builtin_styles_file)
|
47
|
-
end
|
48
|
-
return @builtin_styles
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
attr_reader :theater, :production, :drb_service
|
53
|
-
attr_writer :builtin_styles
|
54
|
-
|
55
|
-
# A Production name, or root directory, must be provided. If not Theater is provided, one will be created.
|
56
|
-
# You may also provide an existing Production for which this Producer will interact.
|
57
|
-
#
|
58
|
-
def initialize(root_path, theater=nil, production=nil)
|
59
|
-
if (root_path[-4..-1] == ".lll")
|
60
|
-
url = IO.read(root_path).strip
|
61
|
-
root_path = Util::Downloader.download(url)
|
62
|
-
end
|
63
|
-
if (root_path[-4..-1] == ".llp")
|
64
|
-
root_path = unpack_production(root_path)
|
65
|
-
end
|
66
|
-
@production = production || Production.new(root_path)
|
67
|
-
@theater = theater.nil? ? Theater.new(@production) : theater
|
68
|
-
establish_production
|
69
|
-
end
|
70
|
-
|
71
|
-
# Returns true if the production's minimum_limelight_version is compatible with the current version.
|
72
|
-
#
|
73
|
-
def version_compatible?
|
74
|
-
current_version = Limelight::Util::Version.new(Limelight::VERSION::STRING)
|
75
|
-
required_version = Limelight::Util::Version.new(@production.minimum_limelight_version)
|
76
|
-
return required_version.is_less_than_or_equal(current_version)
|
77
|
-
end
|
78
|
-
|
79
|
-
# Returns the CastingDirector for this Production.
|
80
|
-
#
|
81
|
-
def casting_director
|
82
|
-
@casting_director = CastingDirector.new(@production.root) if not @casting_director
|
83
|
-
return @casting_director
|
84
|
-
end
|
85
|
-
|
86
|
-
# Loads the Production without opening it. The Production will be created into memory with all it's stages
|
87
|
-
#
|
88
|
-
def load(options = {})
|
89
|
-
Gems.install_gems_in_production(@production)
|
90
|
-
Kernel.load(@production.init_file) if ( !options[:ignore_init] && File.exists?(@production.init_file) )
|
91
|
-
load_stages if File.exists?(@production.stages_file)
|
92
|
-
end
|
93
|
-
|
94
|
-
# Returns true if the production is compatible with the current version of Limelight or if the user proceeds
|
95
|
-
# despite the incompatible warning.
|
96
|
-
#
|
97
|
-
def can_proceed_with_compatibility?
|
98
|
-
return true if version_compatible?
|
99
|
-
return true if Context.instance.studio.utilities_production.should_proceed_with_incompatible_version(@production.name, @production.minimum_limelight_version)
|
100
|
-
return false
|
101
|
-
end
|
102
|
-
|
103
|
-
# Opens the Production.
|
104
|
-
#
|
105
|
-
def open(options = {})
|
106
|
-
@production.production_opening
|
107
|
-
load
|
108
|
-
@production.production_loaded
|
109
|
-
if @theater.has_stages?
|
110
|
-
@theater.stages.each do |stage|
|
111
|
-
open_scene(stage.default_scene.to_s, stage) if stage.default_scene
|
112
|
-
end
|
113
|
-
elsif @production.default_scene
|
114
|
-
open_scene(@production.default_scene, @theater.default_stage)
|
115
|
-
end
|
116
|
-
@casting_director = nil
|
117
|
-
@production.production_opened
|
118
|
-
end
|
119
|
-
|
120
|
-
# Opens the specified Scene onto the Spcified Stage.
|
121
|
-
#
|
122
|
-
def open_scene(name, stage, options={})
|
123
|
-
path = @production.scene_directory(name)
|
124
|
-
scene_name = File.basename(path)
|
125
|
-
scene = load_props(options.merge(:production => @production, :casting_director => casting_director, :path => path, :name => scene_name))
|
126
|
-
styles = load_styles(scene)
|
127
|
-
scene.styles = styles
|
128
|
-
stage.open(scene)
|
129
|
-
return scene
|
130
|
-
end
|
131
|
-
|
132
|
-
# Loads the 'stages.rb' file and configures all the Stages in the Production.
|
133
|
-
#
|
134
|
-
def load_stages
|
135
|
-
stages_file = @production.stages_file
|
136
|
-
content = IO.read(stages_file)
|
137
|
-
stages = Limelight.build_stages(@theater) do
|
138
|
-
begin
|
139
|
-
eval content
|
140
|
-
rescue Exception => e
|
141
|
-
raise DSL::BuildException.new(stages_file, content, e)
|
142
|
-
end
|
143
|
-
end
|
144
|
-
return stages
|
145
|
-
end
|
146
|
-
|
147
|
-
# Loads of the 'props.rb' file for a particular Scene and creates all the Prop objects and Scene.
|
148
|
-
#
|
149
|
-
def load_props(options = {})
|
150
|
-
scene = Scene.new(options)
|
151
|
-
if File.exists?(scene.props_file)
|
152
|
-
content = IO.read(scene.props_file)
|
153
|
-
options[:build_loader] = @production.root
|
154
|
-
return Limelight.build_props(scene, options) do
|
155
|
-
begin
|
156
|
-
eval content
|
157
|
-
rescue Exception => e
|
158
|
-
raise DSL::BuildException.new(scene.props_file, content, e)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
else
|
162
|
-
return scene
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
# Loads the specified 'styles.rb' file and created a Hash of Styles.
|
167
|
-
#
|
168
|
-
def load_styles(context)
|
169
|
-
extendable_styles = Producer.builtin_styles.merge(@production.root_styles)
|
170
|
-
return extendable_styles.dup if not File.exists?(context.styles_file)
|
171
|
-
new_styles = Limelight.build_styles_from_file(context.styles_file, extendable_styles)
|
172
|
-
return extendable_styles.merge(new_styles)
|
173
|
-
end
|
174
|
-
|
175
|
-
# Closes the specified production. The producer will trigger the hook, production_closing and production_closed,
|
176
|
-
# to keep the production aware of it's status. The Studio will also be informed of the closure. If no
|
177
|
-
# production remain opened, then the Limelight runtine will exit.
|
178
|
-
#
|
179
|
-
def close
|
180
|
-
return if @production.closed?
|
181
|
-
@production.closed = true
|
182
|
-
return Thread.new do
|
183
|
-
begin
|
184
|
-
Thread.pass
|
185
|
-
@production.production_closing
|
186
|
-
@production.theater.close
|
187
|
-
@production.production_closed
|
188
|
-
@drb_service.stop_service if @drb_service
|
189
|
-
Context.instance.studio.production_closed(@production)
|
190
|
-
rescue StandardError => e
|
191
|
-
puts e
|
192
|
-
puts e.backtrace
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
# Publish the production, using DRb, on the specified port. This is useful for testing or remotely controling
|
198
|
-
# your production. Publilshing productions on DRb is typically accomplished by using the --drb_port option
|
199
|
-
# of the open command. eg.
|
200
|
-
#
|
201
|
-
# jruby -S limelight open --drb_port=9000 my_production
|
202
|
-
#
|
203
|
-
def publish_production_on_drb(port)
|
204
|
-
@drb_service = DRb.start_service("druby://localhost:#{port}", @production)
|
205
|
-
end
|
206
|
-
|
207
|
-
def establish_production #:nodoc:
|
208
|
-
@production.producer = self
|
209
|
-
@production.theater = @theater
|
210
|
-
|
211
|
-
production_file = @production.production_file
|
212
|
-
if File.exists?(production_file)
|
213
|
-
tmp_module = Module.new
|
214
|
-
content = IO.read(production_file)
|
215
|
-
tmp_module.module_eval(content, production_file)
|
216
|
-
production_module = tmp_module.const_get("Production")
|
217
|
-
raise "production.rb should define a module named 'Production'" if production_module.nil?
|
218
|
-
@production.extend(production_module)
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
private ###############################################
|
223
|
-
|
224
|
-
def unpack_production(production_name)
|
225
|
-
packer = Limelight::Util::Packer.new()
|
226
|
-
dest_dir = File.join(Data.productions_dir, rand.to_s.sub("0.", ""))
|
227
|
-
Dir.mkdir(dest_dir)
|
228
|
-
return packer.unpack(production_name, dest_dir)
|
229
|
-
end
|
230
|
-
|
231
|
-
end
|
232
|
-
|
233
|
-
end
|
data/lib/limelight/production.rb
DELETED
@@ -1,203 +0,0 @@
|
|
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/limelight_exception'
|
5
|
-
require 'limelight/file_loader'
|
6
|
-
require 'limelight/dsl/styles_builder'
|
7
|
-
require 'drb'
|
8
|
-
|
9
|
-
|
10
|
-
module Limelight
|
11
|
-
|
12
|
-
# The root object of Limelight Production. Every Prop in a production has access to its Production object.
|
13
|
-
# Therefore it is typical to store reasources in the Production.
|
14
|
-
#
|
15
|
-
# Productions are configured, and attributes are added, by the ProductionBuilder.
|
16
|
-
#
|
17
|
-
class Production
|
18
|
-
|
19
|
-
include UI::Api::Production
|
20
|
-
|
21
|
-
class << self
|
22
|
-
|
23
|
-
def [](name) #:nodoc:
|
24
|
-
return Studio[name]
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
attr_reader :name, :root
|
30
|
-
attr_accessor :producer, :theater
|
31
|
-
attr_accessor :closed #:nodoc:
|
32
|
-
|
33
|
-
|
34
|
-
# Users typically need not create Production objects.
|
35
|
-
#
|
36
|
-
def initialize(path)
|
37
|
-
@root = FileLoader.for_root(path)
|
38
|
-
@name = File.basename(path)
|
39
|
-
end
|
40
|
-
|
41
|
-
# Sets the name of the Production. The name must be unique amongst all Productions in memory.
|
42
|
-
#
|
43
|
-
def name=(value)
|
44
|
-
Context.instance.studio.error_if_duplicate_name(value)
|
45
|
-
@name = value
|
46
|
-
end
|
47
|
-
|
48
|
-
# Return the path to the root directory of the production
|
49
|
-
#
|
50
|
-
def path
|
51
|
-
return @root.root
|
52
|
-
end
|
53
|
-
|
54
|
-
# Returns the path to the production's init file
|
55
|
-
#
|
56
|
-
def init_file
|
57
|
-
return @root.path_to("init.rb")
|
58
|
-
end
|
59
|
-
|
60
|
-
# Returns the path to the production's production.rb file
|
61
|
-
#
|
62
|
-
def production_file
|
63
|
-
return @root.path_to("production.rb")
|
64
|
-
end
|
65
|
-
|
66
|
-
# Returns the path to the production's stages file
|
67
|
-
#
|
68
|
-
def stages_file
|
69
|
-
return @root.path_to("stages.rb")
|
70
|
-
end
|
71
|
-
|
72
|
-
# Returns the path to the production's styles file
|
73
|
-
#
|
74
|
-
def styles_file
|
75
|
-
return @root.path_to("styles.rb")
|
76
|
-
end
|
77
|
-
|
78
|
-
# Returns the path to the production's gems directory
|
79
|
-
#
|
80
|
-
def gems_directory
|
81
|
-
return @root.path_to("__resources/gems/gems")
|
82
|
-
end
|
83
|
-
|
84
|
-
# Returns the path to the productions gems root
|
85
|
-
#
|
86
|
-
def gems_root
|
87
|
-
return @root.path_to("__resources/gems")
|
88
|
-
end
|
89
|
-
|
90
|
-
# Returns the path to the named Scene's directory within the Production
|
91
|
-
#
|
92
|
-
def scene_directory(name)
|
93
|
-
return @root.root if name == :root
|
94
|
-
return @root.path_to(name)
|
95
|
-
end
|
96
|
-
|
97
|
-
# Returns the minimum version of limelight required to run this production. Default: "0.0.0"
|
98
|
-
# If the version of limelight used to open this production is less than the minimum,
|
99
|
-
# an error will be displayed (starting with version 0.4.0).
|
100
|
-
#
|
101
|
-
def minimum_limelight_version
|
102
|
-
return "0.0.0"
|
103
|
-
end
|
104
|
-
|
105
|
-
# Returns true if the production allows itself to be closed. The system will call this methods when
|
106
|
-
# it wishes to close the production, perhaps when the user quits the application. By default the production
|
107
|
-
# will always return true.
|
108
|
-
#
|
109
|
-
def allow_close?
|
110
|
-
return true
|
111
|
-
end
|
112
|
-
|
113
|
-
# Called when the production is about to be opened. The default implementation does nothing but you may re-implement
|
114
|
-
# it in the production.rb file.
|
115
|
-
#
|
116
|
-
def production_opening
|
117
|
-
end
|
118
|
-
|
119
|
-
# Called when the production has been loaded. That is, when all the gems have been loaded stages have been
|
120
|
-
# instantiated.
|
121
|
-
#
|
122
|
-
def production_loaded
|
123
|
-
end
|
124
|
-
|
125
|
-
# Called when the production is fully opened. The default implementation does nothing but you may re-implement
|
126
|
-
# it in the production.rb file.
|
127
|
-
#
|
128
|
-
def production_opened
|
129
|
-
end
|
130
|
-
|
131
|
-
# Called when the production is about to be closed. The default implementation does nothing but you may re-implement
|
132
|
-
# it in the production.rb file.
|
133
|
-
#
|
134
|
-
def production_closing
|
135
|
-
end
|
136
|
-
|
137
|
-
# Called when the production is fully closed. The default implementation does nothing but you may re-implement
|
138
|
-
# it in the production.rb file.
|
139
|
-
#
|
140
|
-
def production_closed
|
141
|
-
end
|
142
|
-
|
143
|
-
# returns true if the production has been closed.
|
144
|
-
#
|
145
|
-
def closed?
|
146
|
-
return @closed
|
147
|
-
end
|
148
|
-
|
149
|
-
# Closes the production. If there are no more productions open, the Limelight runtime will shutdown.
|
150
|
-
# The production will actually delegate to it's producer and the producer will close the production down.
|
151
|
-
#
|
152
|
-
def close
|
153
|
-
@producer.close
|
154
|
-
end
|
155
|
-
|
156
|
-
# Publish this production using DRb on the specified port. The production will delegate to its producer to
|
157
|
-
# actually do the publishing.
|
158
|
-
#
|
159
|
-
def publish_on_drb(port)
|
160
|
-
@producer.publish_production_on_drb(port)
|
161
|
-
end
|
162
|
-
|
163
|
-
# Called when the last stage in this production's theater is closed. If the allow_close? returns true
|
164
|
-
# this production will be closed.
|
165
|
-
#
|
166
|
-
def theater_empty!
|
167
|
-
close if allow_close? && !closed?
|
168
|
-
end
|
169
|
-
|
170
|
-
# Returned the name of the default scene. This is only used when there are not stages defined in the production.
|
171
|
-
# Defaults to :root, the production's root directory is the default scene. Return nil if there are not defaults.
|
172
|
-
#
|
173
|
-
def default_scene
|
174
|
-
return :root
|
175
|
-
end
|
176
|
-
|
177
|
-
# A production with multiple Scenes may have a 'styles.rb' file in the root directory. This is called the
|
178
|
-
# root_styles. This method loads the root_styles, if they haven't already been loaded, and returns them.
|
179
|
-
#
|
180
|
-
def root_styles
|
181
|
-
unless @root_styles
|
182
|
-
if File.exists?(styles_file)
|
183
|
-
@root_styles = Limelight.build_styles_from_file(styles_file)
|
184
|
-
else
|
185
|
-
@root_styles = {}
|
186
|
-
end
|
187
|
-
end
|
188
|
-
return @root_styles
|
189
|
-
end
|
190
|
-
|
191
|
-
alias :getName :name #:nodoc:
|
192
|
-
alias :setName :name= #:nodoc:
|
193
|
-
alias :allowClose :allow_close? #:nodoc:
|
194
|
-
|
195
|
-
def callMethod(name, java_obj_array) #:nodoc:
|
196
|
-
args = []
|
197
|
-
java_obj_array.length.times { |i| args << java_obj_array[i] }
|
198
|
-
send(name.to_sym, *args)
|
199
|
-
end
|
200
|
-
|
201
|
-
end
|
202
|
-
|
203
|
-
end
|
data/lib/limelight/prop.rb
DELETED
@@ -1,367 +0,0 @@
|
|
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/java_util'
|
5
|
-
require 'limelight/pen'
|
6
|
-
require 'limelight/paint_action'
|
7
|
-
require 'limelight/animation'
|
8
|
-
|
9
|
-
module Limelight
|
10
|
-
|
11
|
-
# Prop is the fundamental building block of a scene. A prop represents a rectangular area in the scene, of almost any dimension.
|
12
|
-
# It may have borders, backgrounds, margin, padding, and it may contain other props or text. However it is the props'
|
13
|
-
# Styles that determine their size and appearance.
|
14
|
-
#
|
15
|
-
# A Prop may have one parent and many children. Hense, when put together, they form a tree structure. The Scene is
|
16
|
-
# the root Prop of a tree.
|
17
|
-
#
|
18
|
-
class Prop
|
19
|
-
|
20
|
-
class << self
|
21
|
-
|
22
|
-
def event(event_symbol)
|
23
|
-
@events ||= []
|
24
|
-
@events << event_symbol unless @events.include?(event_symbol)
|
25
|
-
define_method(event_symbol) { |event| } # do nothing by default
|
26
|
-
end
|
27
|
-
|
28
|
-
def events
|
29
|
-
return @events
|
30
|
-
end
|
31
|
-
|
32
|
-
def event2(event_symbol)
|
33
|
-
@events ||= []
|
34
|
-
@events << event_symbol unless @events.include?(event_symbol)
|
35
|
-
define_method("accepts_#{event_symbol}".to_sym) { return self.respond_to?(event_symbol) }
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
include UI::Api::Prop
|
41
|
-
|
42
|
-
attr_accessor :style, :hover_style
|
43
|
-
attr_reader :panel #:nodoc:
|
44
|
-
attr_reader :children, :parent, :name, :id, :players
|
45
|
-
getters :panel, :style, :hover_style, :name, :scene, :loader #:nodoc:
|
46
|
-
|
47
|
-
# When creating a Prop, an optional Hash is accepted. These are called initialization options.
|
48
|
-
# The key/value pairs in the initialiaztion options will be used to
|
49
|
-
# set properties on the Prop, it Style, or included Player properties. These properties are not set
|
50
|
-
# until the prop is added to a Prop tree with a Scene.
|
51
|
-
#
|
52
|
-
def initialize(hash = {})
|
53
|
-
@options = hash || {}
|
54
|
-
@children = []
|
55
|
-
@style = Styles::ScreenableStyle.new
|
56
|
-
@panel = UI::Model::Panel.new(self)
|
57
|
-
end
|
58
|
-
|
59
|
-
# Add a Prop as a child of this Prop.
|
60
|
-
#
|
61
|
-
def add(child)
|
62
|
-
child.set_parent(self)
|
63
|
-
@children << child
|
64
|
-
@panel.add(child.panel)
|
65
|
-
end
|
66
|
-
|
67
|
-
# Same as add. Returns self so adding may be chained.
|
68
|
-
#
|
69
|
-
# prop << child1 << child2 << child3
|
70
|
-
#
|
71
|
-
def <<(child)
|
72
|
-
add(child)
|
73
|
-
return self
|
74
|
-
end
|
75
|
-
|
76
|
-
# Allows the adding of child Props using the PropBuilder DSL.
|
77
|
-
#
|
78
|
-
# prop.build do
|
79
|
-
# child1 do
|
80
|
-
# grand_child
|
81
|
-
# end
|
82
|
-
# child2
|
83
|
-
# end
|
84
|
-
#
|
85
|
-
def build(options = {}, &block)
|
86
|
-
require 'limelight/dsl/prop_builder'
|
87
|
-
builder = Limelight::DSL::PropBuilder.new(self)
|
88
|
-
builder.__install_instance_variables(options)
|
89
|
-
builder.__loader__ = scene.loader
|
90
|
-
builder.instance_eval(&block)
|
91
|
-
end
|
92
|
-
|
93
|
-
# Removes a child Prop. The child Prop will be parentless after removal.
|
94
|
-
#
|
95
|
-
def remove(child)
|
96
|
-
if children.delete(child)
|
97
|
-
scene.unindex_prop(child) if scene
|
98
|
-
@panel.remove(child.panel)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
# Removes all child Props.
|
103
|
-
#
|
104
|
-
def remove_all
|
105
|
-
@panel.remove_all
|
106
|
-
@children.each { |child| scene.unindex_prop(child) } if scene
|
107
|
-
@children = []
|
108
|
-
end
|
109
|
-
|
110
|
-
# Injects the behavior of the specified Player into the Prop. The Player must be a Module.
|
111
|
-
#
|
112
|
-
def include_player(player_module)
|
113
|
-
unless self.is_a?(player_module)
|
114
|
-
extend player_module
|
115
|
-
self.casted if player_module.instance_methods.include?("casted")
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
def update #:nodoc:
|
120
|
-
return if (scene.nil? || !scene.visible)
|
121
|
-
@panel.doLayout
|
122
|
-
@panel.repaint
|
123
|
-
end
|
124
|
-
|
125
|
-
def update_now #:nodoc:
|
126
|
-
return if (scene.nil? || !scene.visible)
|
127
|
-
@panel.doLayout()
|
128
|
-
@panel.paintImmediately(0, 0, @panel.width, @panel.height)
|
129
|
-
end
|
130
|
-
|
131
|
-
# A hook to invoke behavior after a Prop is painted.
|
132
|
-
#
|
133
|
-
def after_painting(flag = true, &block)
|
134
|
-
if flag
|
135
|
-
@panel.after_paint_action = PaintAction.new(&block)
|
136
|
-
else
|
137
|
-
@panel.after_paint_action = nil
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
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.
|
143
|
-
#
|
144
|
-
def find_by_name(name, results = [])
|
145
|
-
results << self if @name == name
|
146
|
-
@children.each { |child| child.find_by_name(name, results) }
|
147
|
-
return results
|
148
|
-
end
|
149
|
-
|
150
|
-
# Sets the text of this Prop. If a prop is given text, it will become sterilized (it may not have any more children).
|
151
|
-
# Some Players such as text_box, will cause the text to appear in the text_box.
|
152
|
-
#
|
153
|
-
def text=(value)
|
154
|
-
@panel.text = value.to_s
|
155
|
-
end
|
156
|
-
|
157
|
-
# Returns the text of the Prop.
|
158
|
-
#
|
159
|
-
def text
|
160
|
-
return panel.text
|
161
|
-
end
|
162
|
-
|
163
|
-
# Returns the scene to which this prop belongs to.
|
164
|
-
#
|
165
|
-
def scene
|
166
|
-
return nil if @parent.nil?
|
167
|
-
@scene = @parent.scene if @scene.nil?
|
168
|
-
return @scene
|
169
|
-
end
|
170
|
-
|
171
|
-
# TODO get rid of me.... The Java Prop interface declares this method.
|
172
|
-
def loader
|
173
|
-
return scene.production.root;
|
174
|
-
end
|
175
|
-
|
176
|
-
# Returns the current Production this Prop lives in.
|
177
|
-
#
|
178
|
-
def production
|
179
|
-
return scene.production
|
180
|
-
end
|
181
|
-
|
182
|
-
def to_s #:nodoc:
|
183
|
-
return "#{self.class.name}[id: #{@id}, name: #{@name}]"
|
184
|
-
end
|
185
|
-
|
186
|
-
def inspect #:nodoc:
|
187
|
-
return self.to_s
|
188
|
-
end
|
189
|
-
|
190
|
-
# unusual name because it's not part of public api
|
191
|
-
def set_parent(parent) #:nodoc:
|
192
|
-
@parent = parent
|
193
|
-
if @parent.illuminated?
|
194
|
-
illuminate
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
# Allows the addition of extra initialization options. Will raise an exception if the Prop has already been
|
199
|
-
# illuminated (added to a scene).
|
200
|
-
#
|
201
|
-
def add_options(more_options)
|
202
|
-
raise "Too late to add options" if illuminated?
|
203
|
-
@options.merge!(more_options)
|
204
|
-
end
|
205
|
-
|
206
|
-
# Returns a Box representing the relative bounds of the Prop. Is useful with usign the Pen.
|
207
|
-
#
|
208
|
-
# box = prop.area
|
209
|
-
# box.x, box.y # represents the Prop's location within its parent Prop
|
210
|
-
# box.width, box.height # represents the Prop's dimensions
|
211
|
-
#
|
212
|
-
def area
|
213
|
-
return panel.get_bounding_box.clone
|
214
|
-
end
|
215
|
-
|
216
|
-
# Returns a Box representing the bounds inside the borders of the prop. If the Prop's style has no margin or
|
217
|
-
# border_width, then this will be equivalant to area.
|
218
|
-
#
|
219
|
-
def bordered_area
|
220
|
-
return panel.get_box_inside_borders.clone
|
221
|
-
end
|
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
|
-
|
230
|
-
# Returns a Pen object. Pen objects allow to you to draw directly on the screen, withing to bounds of this Prop.
|
231
|
-
#
|
232
|
-
def pen
|
233
|
-
return Pen.new(panel.getGraphics)
|
234
|
-
end
|
235
|
-
|
236
|
-
# Initiate an animation loop. Options may include :name (string), :updates_per_second (int: defaults to 60)
|
237
|
-
# An Animation object is returned.
|
238
|
-
# The provided block will be invoked :updates_per_second times per second until the Animation is stopped.
|
239
|
-
#
|
240
|
-
# @animation = prop.animate(:updates_per_second => 20) do
|
241
|
-
# prop.style.border_width = (prop.style.top_border_width.to_i + 1).to_s
|
242
|
-
# @animation.stop if prop.style.top_border_width.to_i > 60
|
243
|
-
# end
|
244
|
-
#
|
245
|
-
# This above example will cause the Prop's border to grow until it is 60 pixels wide.
|
246
|
-
#
|
247
|
-
def animate(options={}, &block)
|
248
|
-
animation = Animation.new(self, block, options)
|
249
|
-
animation.start
|
250
|
-
return animation
|
251
|
-
end
|
252
|
-
|
253
|
-
# Plays a sound on the computers audio output. The parameter is the filename of a .au sound file.
|
254
|
-
# This filename should relative to the root directory of the current Production, or an absolute path.
|
255
|
-
#
|
256
|
-
def play_sound(filename)
|
257
|
-
@panel.play_sound(scene.loader.path_to(filename))
|
258
|
-
end
|
259
|
-
|
260
|
-
# Luanches the spcified URL using the OS's default handlers. For example, opening a URL in a browser:
|
261
|
-
#
|
262
|
-
# launch('http://www.google.com')
|
263
|
-
#
|
264
|
-
# To create a link prop add an accessor on the player (say url) and use that in the prop definition
|
265
|
-
# Ex:
|
266
|
-
#
|
267
|
-
# link :text => "I am a link", :url => "http://www.8thlight.com"
|
268
|
-
def launch(url)
|
269
|
-
Context.instance.os.launch(url)
|
270
|
-
end
|
271
|
-
|
272
|
-
# GUI Events ##########################################
|
273
|
-
|
274
|
-
# TODO MDM - This may be very inefficient. If seems like these methods are generated for each instance of prop.
|
275
|
-
event2 :mouse_clicked
|
276
|
-
event :mouse_entered
|
277
|
-
event :mouse_exited
|
278
|
-
event2 :mouse_pressed
|
279
|
-
event2 :mouse_released
|
280
|
-
event :mouse_dragged
|
281
|
-
event :mouse_moved
|
282
|
-
event :key_typed
|
283
|
-
event :key_pressed
|
284
|
-
event :key_released
|
285
|
-
event :focus_gained
|
286
|
-
event :focus_lost
|
287
|
-
event :button_pressed
|
288
|
-
event :value_changed
|
289
|
-
|
290
|
-
# TODO Try to get me out of public scope
|
291
|
-
#
|
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)
|
300
|
-
|
301
|
-
inherit_styles
|
302
|
-
scene.casting_director.fill_cast(self)
|
303
|
-
apply_options
|
304
|
-
|
305
|
-
@options = nil
|
306
|
-
end
|
307
|
-
|
308
|
-
children.each do |child|
|
309
|
-
child.illuminate
|
310
|
-
end
|
311
|
-
end
|
312
|
-
|
313
|
-
def illuminated? #:nodoc:
|
314
|
-
return @options.nil?
|
315
|
-
end
|
316
|
-
|
317
|
-
private ###############################################
|
318
|
-
|
319
|
-
def set_id(id)
|
320
|
-
return if id.nil? || id.to_s.empty?
|
321
|
-
@id = id.to_s
|
322
|
-
scene.index_prop(self)
|
323
|
-
end
|
324
|
-
|
325
|
-
def apply_options
|
326
|
-
@options.each_pair do |key, value|
|
327
|
-
setter_sym = "#{key.to_s}=".to_sym
|
328
|
-
if self.respond_to?(setter_sym)
|
329
|
-
self.send(setter_sym, value)
|
330
|
-
elsif self.style.respond_to?(setter_sym)
|
331
|
-
self.style.send(setter_sym, value.to_s)
|
332
|
-
elsif is_event_setter(key)
|
333
|
-
define_event(key, value)
|
334
|
-
end
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
|
-
def is_event_setter(symbol)
|
339
|
-
string_value = symbol.to_s
|
340
|
-
return string_value[0..2] == "on_" && self.class.events.include?(string_value[3..-1].to_sym)
|
341
|
-
end
|
342
|
-
|
343
|
-
def define_event(symbol, value)
|
344
|
-
event_name = symbol.to_s[3..-1]
|
345
|
-
self.instance_eval "def #{event_name}(event); #{value}; end"
|
346
|
-
end
|
347
|
-
|
348
|
-
def inherit_styles
|
349
|
-
style_names = []
|
350
|
-
style_names << @name unless @name.nil?
|
351
|
-
style_names += @additional_styles.gsub(',', ' ').split(' ') unless @additional_styles.nil?
|
352
|
-
style_names.each do |style_name|
|
353
|
-
new_style = scene.styles[style_name]
|
354
|
-
@style.add_extension(new_style) if new_style
|
355
|
-
new_hover_style = scene.styles["#{style_name}.hover"]
|
356
|
-
if new_hover_style
|
357
|
-
if @hover_style.nil?
|
358
|
-
@hover_style = new_hover_style
|
359
|
-
else
|
360
|
-
@hover_style.add_extension(new_hover_style)
|
361
|
-
end
|
362
|
-
end
|
363
|
-
end
|
364
|
-
end
|
365
|
-
|
366
|
-
end
|
367
|
-
end
|