limelight 0.0.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/icons/icon.ico +0 -0
- data/bin/icons/icon_48.gif +0 -0
- data/bin/icons/limelight.icns +0 -0
- data/bin/icons/splash.png +0 -0
- data/bin/limelight +6 -0
- data/bin/ll +10 -0
- data/bin/ll.bat +5 -0
- data/lib/init.rb +11 -0
- data/lib/limelight/build_exception.rb +45 -0
- data/lib/limelight/button_group_cache.rb +11 -0
- data/lib/limelight/casting_director.rb +72 -0
- data/lib/limelight/commands.rb +66 -0
- data/lib/limelight/file_chooser.rb +55 -0
- data/lib/limelight/file_filter.rb +26 -0
- data/lib/limelight/java_util.rb +29 -0
- data/lib/limelight/limelight_exception.rb +9 -0
- data/lib/limelight/loaders/file_scene_loader.rb +48 -0
- data/lib/limelight/menu_bar.rb +49 -0
- data/lib/limelight/paint_action.rb +25 -0
- data/lib/limelight/pen.rb +53 -0
- data/lib/limelight/players/button.rb +29 -0
- data/lib/limelight/players/check_box.rb +38 -0
- data/lib/limelight/players/combo_box.rb +44 -0
- data/lib/limelight/players/radio_button.rb +47 -0
- data/lib/limelight/players/text_area.rb +25 -0
- data/lib/limelight/players/text_box.rb +25 -0
- data/lib/limelight/players.rb +9 -0
- data/lib/limelight/producer.rb +141 -0
- data/lib/limelight/production.rb +64 -0
- data/lib/limelight/production_builder.rb +49 -0
- data/lib/limelight/prop.rb +241 -0
- data/lib/limelight/prop_builder.rb +60 -0
- data/lib/limelight/scene.rb +75 -0
- data/lib/limelight/stage.rb +93 -0
- data/lib/limelight/stage_builder.rb +62 -0
- data/lib/limelight/styles.rb +37 -0
- data/lib/limelight/styles_builder.rb +61 -0
- data/lib/limelight/theater.rb +42 -0
- data/lib/limelight/util.rb +26 -0
- data/lib/limelight/version.rb +20 -0
- data/lib/limelight.jar +0 -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 +205 -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 +38 -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/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 +61 -0
- data/productions/examples/langstons_ant/props.rb +22 -0
- data/productions/examples/langstons_ant/styles.rb +105 -0
- data/productions/examples/sandbox/click_me/players/chromaton.rb +47 -0
- data/productions/examples/sandbox/click_me/props.rb +8 -0
- data/productions/examples/sandbox/click_me/styles.rb +12 -0
- data/productions/examples/sandbox/floaters/players/floater.rb +92 -0
- data/productions/examples/sandbox/floaters/players/surface.rb +17 -0
- data/productions/examples/sandbox/floaters/props.rb +10 -0
- data/productions/examples/sandbox/floaters/styles.rb +25 -0
- data/productions/examples/sandbox/gradients/players/spinner.rb +23 -0
- data/productions/examples/sandbox/gradients/players/teaser.rb +26 -0
- data/productions/examples/sandbox/gradients/players/wave.rb +26 -0
- data/productions/examples/sandbox/gradients/players/waves.rb +26 -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 +15 -0
- data/productions/examples/sandbox/homer/players/homer.rb +20 -0
- data/productions/examples/sandbox/homer/props.rb +10 -0
- data/productions/examples/sandbox/homer/styles.rb +17 -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/marilyn.jpg +0 -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/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 +18 -0
- data/productions/examples/sandbox/scrolling/players/cell.rb +16 -0
- data/productions/examples/sandbox/scrolling/props.rb +40 -0
- data/productions/examples/sandbox/scrolling/styles.rb +25 -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 +36 -0
- data/productions/examples/sandbox/stages.rb +6 -0
- data/productions/examples/sandbox/styles.rb +37 -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 +22 -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 +27 -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/props.rb +5 -0
- data/spec/casting_director_spec.rb +94 -0
- data/spec/commands_spec.rb +33 -0
- data/spec/file_chooser_spec.rb +64 -0
- data/spec/file_filter_spec.rb +29 -0
- data/spec/java_util_spec.rb +53 -0
- data/spec/loaders/file_loader_spec.rb +28 -0
- data/spec/paint_action_spec.rb +30 -0
- data/spec/pen_spec.rb +62 -0
- data/spec/players/button_spec.rb +31 -0
- data/spec/players/check_box_spec.rb +40 -0
- data/spec/players/combo_box_spec.rb +39 -0
- data/spec/players/radio_button_spec.rb +75 -0
- data/spec/players/text_area_spec.rb +37 -0
- data/spec/players/text_box_spec.rb +37 -0
- data/spec/producer_spec.rb +157 -0
- data/spec/production_builder_spec.rb +48 -0
- data/spec/production_spec.rb +75 -0
- data/spec/prop_builder_spec.rb +178 -0
- data/spec/prop_spec.rb +216 -0
- data/spec/scene_spec.rb +34 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/stage_builder_spec.rb +90 -0
- data/spec/stage_spec.rb +57 -0
- data/spec/styles_builder_spec.rb +123 -0
- data/spec/theater_spec.rb +66 -0
- metadata +275 -0
data/bin/icons/icon.ico
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/bin/limelight
ADDED
data/bin/ll
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#! /bin/bash
|
|
2
|
+
|
|
3
|
+
JAVA_OPTS=$JAVA_OPTS' -Dapple.laf.useScreenMenuBar=true '
|
|
4
|
+
JAVA_OPTS=$JAVA_OPTS' -Xdock:name=Limelight '
|
|
5
|
+
JAVA_OPTS=$JAVA_OPTS' -Dapple.awt.showGrowBox=true '
|
|
6
|
+
JAVA_OPTS=$JAVA_OPTS-Xdock:icon=$LIMELIGHT_HOME/bin/icons/limelight.icns
|
|
7
|
+
|
|
8
|
+
java -cp $LIMELIGHT_HOME/lib/limelight.jar:$LIMELIGHT_HOME/jruby/lib/jruby.jar $JAVA_OPTS -Dlimelight.home=$LIMELIGHT_HOME limelight.Main $1 $2 $3 $4 $5
|
|
9
|
+
|
|
10
|
+
|
data/bin/ll.bat
ADDED
data/lib/init.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
limelight_require_path = File.expand_path(File.dirname(__FILE__))
|
|
5
|
+
$: << limelight_require_path unless $:.include?(limelight_require_path)
|
|
6
|
+
|
|
7
|
+
require 'java'
|
|
8
|
+
require File.expand_path(File.dirname(__FILE__) + "/limelight.jar")
|
|
9
|
+
|
|
10
|
+
# ENV["GEM_HOME"] = ENV["GEM_PATH"] = File.expand_path(File.dirname(__FILE__) + "/../../jruby/lib/ruby/gems/1.8")
|
|
11
|
+
require 'rubygems'
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
module Limelight
|
|
5
|
+
class BuildException < Exception
|
|
6
|
+
|
|
7
|
+
attr_reader :filename, :line_number
|
|
8
|
+
|
|
9
|
+
def initialize(filename, file_contents, e)
|
|
10
|
+
@filename = filename
|
|
11
|
+
@file_contents = file_contents
|
|
12
|
+
@original_exception = e
|
|
13
|
+
@line_number = find_line_number
|
|
14
|
+
super(build_error_message)
|
|
15
|
+
set_backtrace(e.backtrace)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def find_line_number
|
|
19
|
+
lines = [@original_exception.message].concat @original_exception.backtrace
|
|
20
|
+
line_number = nil
|
|
21
|
+
lines.each do |line|
|
|
22
|
+
match = line.match(/\(eval\):(\d+):/)
|
|
23
|
+
if(match)
|
|
24
|
+
line_number = match[1].to_i
|
|
25
|
+
break
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
return line_number
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def build_error_message
|
|
32
|
+
lines = @file_contents.split("\n")
|
|
33
|
+
start_line = @line_number - 4 < 0 ? 0 : @line_number - 4
|
|
34
|
+
end_line = @line_number + 2 >= lines.size ? lines.size - 1: @line_number + 2
|
|
35
|
+
message = "#{@filename}:#{@line_number}: #{@original_exception.message}"
|
|
36
|
+
message << "\n\t----- #{@filename} lines #{start_line + 1} - #{end_line + 1} -----"
|
|
37
|
+
(start_line..end_line).each do |i|
|
|
38
|
+
message << "\n\t#{i == @line_number - 1 ? "*": " "} #{i+1}: #{lines[i]}"
|
|
39
|
+
end
|
|
40
|
+
message << "\n"
|
|
41
|
+
return message
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
module Limelight
|
|
5
|
+
ButtonGroupCache = Java::limelight.ui.ButtonGroupCache
|
|
6
|
+
class ButtonGroupCache
|
|
7
|
+
def [](key)
|
|
8
|
+
return self.get(key)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
require 'limelight/players'
|
|
5
|
+
|
|
6
|
+
module Limelight
|
|
7
|
+
|
|
8
|
+
class CastingDirector
|
|
9
|
+
|
|
10
|
+
def initialize(loader)
|
|
11
|
+
@loader = loader
|
|
12
|
+
@known_players = {}
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def fill_cast(prop)
|
|
16
|
+
cast_default_player(prop)
|
|
17
|
+
cast_additional_players(prop)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private ###############################################
|
|
21
|
+
|
|
22
|
+
def cast_default_player(prop)
|
|
23
|
+
return if prop.name.nil? || prop.name.empty?
|
|
24
|
+
prop.include_player(@known_players[prop.name]) if player_exists?(prop, prop.name)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def cast_additional_players(prop)
|
|
28
|
+
return if prop.players.nil? || prop.players.empty?
|
|
29
|
+
player_names = prop.players.split(/[ ,]/)
|
|
30
|
+
player_names.each do |player_name|
|
|
31
|
+
apply_player(prop, player_name)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def apply_player(prop, player_name)
|
|
36
|
+
prop.include_player(@known_players[player_name]) if player_exists?(prop, player_name)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def player_exists?(prop, player_name)
|
|
40
|
+
load_player_by_name(prop, player_name) if !@known_players.has_key?(player_name)
|
|
41
|
+
return @known_players[player_name] != :does_not_exist
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def load_player_by_name(prop, player_name)
|
|
45
|
+
load_custom_player(prop, player_name)
|
|
46
|
+
load_builtin_player(player_name) if !@known_players.has_key?(player_name)
|
|
47
|
+
@known_players[player_name] = :does_not_exist if !@known_players.has_key?(player_name)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def load_custom_player(prop, player_name)
|
|
51
|
+
player_filename = File.join([prop.scene.path.to_s, "players", "#{player_name}.rb"])
|
|
52
|
+
return if !@loader.exists?(player_filename)
|
|
53
|
+
|
|
54
|
+
Kernel.load @loader.path_to(player_filename)
|
|
55
|
+
|
|
56
|
+
module_name = player_name.camalized
|
|
57
|
+
return if !Object.const_defined?(module_name)
|
|
58
|
+
|
|
59
|
+
mod = Object.const_get(module_name)
|
|
60
|
+
@known_players[player_name] = mod
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def load_builtin_player(player_name)
|
|
64
|
+
module_name = player_name.camalized
|
|
65
|
+
return if !Limelight::Players.const_defined?(module_name)
|
|
66
|
+
mod = Limelight::Players.const_get(module_name)
|
|
67
|
+
@known_players[player_name] = mod
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
require 'optparse'
|
|
5
|
+
|
|
6
|
+
module Limelight
|
|
7
|
+
|
|
8
|
+
DEFAULT_PRODUCTION = File.expand_path(File.dirname(__FILE__) + "/../../productions/startup")
|
|
9
|
+
|
|
10
|
+
module Commands
|
|
11
|
+
|
|
12
|
+
class OpenProduction
|
|
13
|
+
def self.description
|
|
14
|
+
return "Open a limelight production or scene."
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def run(args)
|
|
18
|
+
Java::limelight::Main.initialize_context
|
|
19
|
+
require 'limelight/producer'
|
|
20
|
+
production = args.length > 0 ? args[0] : DEFAULT_PRODUCTION
|
|
21
|
+
Limelight::Producer.open(production)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class PackProduction
|
|
26
|
+
def self.description
|
|
27
|
+
return "Pack the designated limelight production into a .llp file."
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def run(args)
|
|
31
|
+
packer = Java::limelight::io::Packer.new
|
|
32
|
+
packer.pack(args.shift)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
COMMANDS = {
|
|
37
|
+
"open" => OpenProduction,
|
|
38
|
+
"pack" => PackProduction
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
class << self
|
|
42
|
+
def run(args)
|
|
43
|
+
command_name = args.shift
|
|
44
|
+
command = COMMANDS[command_name]
|
|
45
|
+
if command
|
|
46
|
+
command.new.run(args)
|
|
47
|
+
else
|
|
48
|
+
usage
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def usage
|
|
53
|
+
puts "Usage: limelight <command> [options] [params]"
|
|
54
|
+
puts "commands:"
|
|
55
|
+
COMMANDS.keys.sort.each do |key|
|
|
56
|
+
command = COMMANDS[key]
|
|
57
|
+
puts "\t#{key}\t\t#{command.description}"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
require 'limelight/file_filter'
|
|
5
|
+
|
|
6
|
+
module Limelight
|
|
7
|
+
|
|
8
|
+
class FileChooser
|
|
9
|
+
|
|
10
|
+
attr_reader :chooser, :chosen_file
|
|
11
|
+
|
|
12
|
+
def initialize(options = {}, &filter)
|
|
13
|
+
@options = options
|
|
14
|
+
@parent = options[:parent]
|
|
15
|
+
create_chooser
|
|
16
|
+
@chooser.setFileFilter(FileFilter.new(@options[:description], &filter)) if filter
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def choose_file
|
|
20
|
+
returnVal = @chooser.showOpenDialog(@parent);
|
|
21
|
+
|
|
22
|
+
if(returnVal == javax.swing.JFileChooser::APPROVE_OPTION)
|
|
23
|
+
@chosen_file = @chooser.getSelectedFile().absolute_path
|
|
24
|
+
else
|
|
25
|
+
@chosen_file = nil
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
return @chosen_file
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private ###############################################
|
|
32
|
+
|
|
33
|
+
def create_chooser
|
|
34
|
+
if @options.has_key?(:directory)
|
|
35
|
+
@chooser = javax.swing.JFileChooser.new(@options[:directory])
|
|
36
|
+
else
|
|
37
|
+
@chooser = javax.swing.JFileChooser.new
|
|
38
|
+
end
|
|
39
|
+
configure_file_selection_mode
|
|
40
|
+
@chooser.setDialogTitle(@options[:title]) if @options[:title]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def configure_file_selection_mode
|
|
44
|
+
if(@options[:directories_only])
|
|
45
|
+
@chooser.setFileSelectionMode(javax.swing.JFileChooser::DIRECTORIES_ONLY)
|
|
46
|
+
elsif(@options[:files_only])
|
|
47
|
+
@chooser.setFileSelectionMode(javax.swing.JFileChooser::FILES_ONLY)
|
|
48
|
+
else
|
|
49
|
+
@chooser.setFileSelectionMode(javax.swing.JFileChooser::FILES_AND_DIRECTORIES)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
module Limelight
|
|
5
|
+
|
|
6
|
+
class FileFilter < javax.swing.filechooser::FileFilter
|
|
7
|
+
|
|
8
|
+
attr_reader :description, :filter
|
|
9
|
+
|
|
10
|
+
def initialize(description, &filter)
|
|
11
|
+
super()
|
|
12
|
+
@description = description
|
|
13
|
+
@filter = filter
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def accept(file)
|
|
17
|
+
return @filter.call(file)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def getDescription
|
|
21
|
+
return @description
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
class Class
|
|
5
|
+
|
|
6
|
+
def getters(*symbols)
|
|
7
|
+
symbols.each do |symbol|
|
|
8
|
+
self.class_eval "def get#{symbol.to_s.camalized}; return #{symbol}; end"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def setters(*symbols)
|
|
13
|
+
symbols.each do |symbol|
|
|
14
|
+
self.class_eval "def set#{symbol.to_s.camalized}(value); self.#{symbol} = value; end"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class String
|
|
21
|
+
|
|
22
|
+
def camalized(starting_case = :upper)
|
|
23
|
+
value = self.downcase.gsub(/[_| ]([a-z])/) { |match| match[-1..-1].upcase }
|
|
24
|
+
value = value[0..0].upcase + value[1..-1] if starting_case == :upper
|
|
25
|
+
return value
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
module Limelight
|
|
5
|
+
module Loaders
|
|
6
|
+
|
|
7
|
+
class FileSceneLoader
|
|
8
|
+
|
|
9
|
+
include Java::limelight.SceneLoader
|
|
10
|
+
|
|
11
|
+
attr_reader :root
|
|
12
|
+
|
|
13
|
+
def self.for_root(root)
|
|
14
|
+
loader = new
|
|
15
|
+
loader.reset_on_root(root)
|
|
16
|
+
return loader
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def reset_on_root(root)
|
|
20
|
+
@root = File.expand_path(root)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def path_to(path)
|
|
24
|
+
if(path[0] == "/"[0])
|
|
25
|
+
return path
|
|
26
|
+
else
|
|
27
|
+
return File.expand_path(File.join(@root, path))
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def exists?(path)
|
|
32
|
+
return File.exists?(path_to(path))
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
alias :pathTo :path_to
|
|
36
|
+
|
|
37
|
+
def load(path)
|
|
38
|
+
file_to_load = path_to(path)
|
|
39
|
+
raise LimelightException.new("File not found: #{file_to_load}") if not File.exists?(file_to_load)
|
|
40
|
+
return IO.read(file_to_load)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
alias :read :load
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
module Limelight
|
|
5
|
+
|
|
6
|
+
class AnonymousActionListener
|
|
7
|
+
include java.awt.event.ActionListener
|
|
8
|
+
|
|
9
|
+
def initialize(context, symbol)
|
|
10
|
+
@context = context
|
|
11
|
+
@symbol = symbol
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def actionPerformed(e)
|
|
15
|
+
method = @context.method(@symbol)
|
|
16
|
+
method.call
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class MenuBar
|
|
21
|
+
|
|
22
|
+
def self.build(context, &prop)
|
|
23
|
+
builder = self.new(context)
|
|
24
|
+
builder.instance_eval(&prop)
|
|
25
|
+
return builder.menu_bar
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
attr_reader :menu_bar
|
|
29
|
+
|
|
30
|
+
def initialize(context)
|
|
31
|
+
@context = context
|
|
32
|
+
@menu_bar = javax.swing.JMenuBar.new
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def menu(name)
|
|
36
|
+
@menu = javax.swing.JMenu.new(name)
|
|
37
|
+
@menu_bar.add(@menu)
|
|
38
|
+
yield
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def item(name, symbol)
|
|
42
|
+
menu_item = javax.swing.JMenuItem.new(name)
|
|
43
|
+
@menu.add(menu_item)
|
|
44
|
+
menu_item.addActionListener(AnonymousActionListener.new(@context, symbol))
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
require 'limelight/pen'
|
|
5
|
+
|
|
6
|
+
module Limelight
|
|
7
|
+
|
|
8
|
+
class PaintAction
|
|
9
|
+
|
|
10
|
+
include Java::limelight.ui.painting.PaintAction
|
|
11
|
+
|
|
12
|
+
attr_reader :block
|
|
13
|
+
|
|
14
|
+
def initialize(&block)
|
|
15
|
+
@block = block
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def invoke(graphics)
|
|
19
|
+
pen = Pen.new(graphics)
|
|
20
|
+
@block.call(pen)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
module Limelight
|
|
5
|
+
|
|
6
|
+
class Pen
|
|
7
|
+
|
|
8
|
+
attr_accessor :context
|
|
9
|
+
|
|
10
|
+
def initialize(context)
|
|
11
|
+
@context = context
|
|
12
|
+
self.color = "black"
|
|
13
|
+
self.width = 1
|
|
14
|
+
self.smooth = false
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def color=(value)
|
|
18
|
+
resolve_color = Java::limelight.ui.Colors.resolve(value)
|
|
19
|
+
@context.setColor(resolve_color)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def width=(value)
|
|
23
|
+
@context.setStroke(java.awt.BasicStroke.new(value))
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def smooth=(value)
|
|
27
|
+
hint = value ? java.awt.RenderingHints::VALUE_ANTIALIAS_ON : java.awt.RenderingHints::VALUE_ANTIALIAS_OFF
|
|
28
|
+
@context.setRenderingHint(java.awt.RenderingHints::KEY_ANTIALIASING, hint)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def draw_line(x1, y1, x2, y2)
|
|
32
|
+
@context.drawLine(x1, y1, x2, y2)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def draw_rectangle(x, y, width, height)
|
|
36
|
+
@context.drawRect(x, y, width, height)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def fill_rectangle(x, y, width, height)
|
|
40
|
+
@context.fillRect(x, y, width, height)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def draw_oval(x, y, width, height)
|
|
44
|
+
@context.drawOval(x, y, width, height)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def fill_oval(x, y, width, height)
|
|
48
|
+
@context.fillOval(x, y, width, height)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
module Limelight
|
|
5
|
+
module Players
|
|
6
|
+
|
|
7
|
+
module Button
|
|
8
|
+
class << self
|
|
9
|
+
def extended(prop)
|
|
10
|
+
prop.panel.painters.clear
|
|
11
|
+
painter = Java.limelight.ui.painting.ButtonPainter.new(prop.panel)
|
|
12
|
+
prop.button = painter.button
|
|
13
|
+
prop.panel.painters << painter
|
|
14
|
+
prop.panel.clear_event_listeners
|
|
15
|
+
set_default_styles(prop)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def set_default_styles(prop)
|
|
19
|
+
prop.style.width = "100"
|
|
20
|
+
prop.style.height = "25"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
attr_accessor :button
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
module Limelight
|
|
5
|
+
module Players
|
|
6
|
+
|
|
7
|
+
module CheckBox
|
|
8
|
+
class << self
|
|
9
|
+
def extended(prop)
|
|
10
|
+
prop.panel.painters.clear
|
|
11
|
+
painter = Java.limelight.ui.painting.CheckBoxPainter.new(prop.panel)
|
|
12
|
+
prop.check_box = painter.check_box
|
|
13
|
+
prop.panel.painters << painter
|
|
14
|
+
prop.panel.clear_event_listeners
|
|
15
|
+
set_default_styles(prop)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def set_default_styles(prop)
|
|
19
|
+
prop.style.width = "22"
|
|
20
|
+
prop.style.height = "22"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
attr_accessor :check_box
|
|
25
|
+
|
|
26
|
+
def checked=(value)
|
|
27
|
+
check_box.selected = value
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def checked
|
|
31
|
+
return check_box.is_selected
|
|
32
|
+
end
|
|
33
|
+
alias :checked? :checked
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#- Copyright 2008 8th Light, Inc.
|
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
|
3
|
+
|
|
4
|
+
module Limelight
|
|
5
|
+
module Players
|
|
6
|
+
|
|
7
|
+
module ComboBox
|
|
8
|
+
class << self
|
|
9
|
+
def extended(prop)
|
|
10
|
+
prop.panel.painters.clear
|
|
11
|
+
painter = Java.limelight.ui.painting.ComboBoxPainter.new(prop.panel)
|
|
12
|
+
prop.combo_box = painter.combo_box
|
|
13
|
+
prop.panel.painters << painter
|
|
14
|
+
prop.panel.clear_event_listeners
|
|
15
|
+
set_default_styles(prop)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def set_default_styles(prop)
|
|
19
|
+
prop.style.width = "120"
|
|
20
|
+
prop.style.height = "22"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
attr_accessor :combo_box
|
|
25
|
+
|
|
26
|
+
def choices=(value)
|
|
27
|
+
value = eval(value) if value.is_a? String
|
|
28
|
+
raise "Invalid choices type: #{value.class}. Choices have to be an array." if !value.is_a?(Array)
|
|
29
|
+
combo_box.remove_all_items
|
|
30
|
+
value.each { |choice| combo_box.add_item(choice) }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def value=(text)
|
|
34
|
+
self.text = text
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def value
|
|
38
|
+
return self.text
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
end
|