kentaroi-okayu 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +6 -0
- data/LICENSE +20 -0
- data/README.rdoc +18 -0
- data/Rakefile +63 -0
- data/VERSION +1 -0
- data/bin/okayu +6 -0
- data/lib/app.rb +25 -0
- data/lib/app_dir.rb +29 -0
- data/lib/client.rb +210 -0
- data/lib/controllers/listeners_controller.rb +18 -0
- data/lib/controllers/live_controller.rb +82 -0
- data/lib/controllers/visitors_controller.rb +19 -0
- data/lib/controllers.rb +3 -0
- data/lib/cookie_thief.rb +172 -0
- data/lib/db/migrate/000_create_lives.rb +14 -0
- data/lib/db/migrate/001_create_comments.rb +22 -0
- data/lib/db/migrate/002_create_visitors.rb +15 -0
- data/lib/db/migrate/003_create_listeners.rb +15 -0
- data/lib/db/migrate/004_create_communities.rb +13 -0
- data/lib/db/migrate/005_create_listeners_lives.rb +12 -0
- data/lib/db/migrate/006_create_lives_visitors.rb +13 -0
- data/lib/factory.rb +16 -0
- data/lib/models/comment.rb +22 -0
- data/lib/models/community.rb +3 -0
- data/lib/models/listener.rb +5 -0
- data/lib/models/live.rb +6 -0
- data/lib/models/visitor.rb +5 -0
- data/lib/models.rb +23 -0
- data/lib/okayu.rb +10 -0
- data/lib/player_status.rb +16 -0
- data/lib/sample_msg +2 -0
- data/lib/thread_info.rb +32 -0
- data/lib/user_info.rb +49 -0
- data/lib/views/app_frame.rb +89 -0
- data/lib/views/color_dialog.rb +56 -0
- data/lib/views/colors.rb +168 -0
- data/lib/views/live_panel.rb +335 -0
- data/lib/views/login_dialog.rb +80 -0
- data/lib/views/main_panel.rb +50 -0
- data/lib/views.rb +11 -0
- data/logged_in_page +893 -0
- data/login_error_page +83 -0
- data/okayu.gemspec +126 -0
- data/tcp_log +0 -0
- data/test/client_test.rb +61 -0
- data/test/cookie_thief_test.rb +36 -0
- data/test/ie_cookie.txt +63 -0
- data/test/okayu_test.rb +8 -0
- data/test/player_status_test.rb +61 -0
- data/test/raw_player_status +2 -0
- data/test/raw_player_status_community_only +3 -0
- data/test/raw_player_status_notlogged_in +2 -0
- data/test/test_helper.rb +11 -0
- data/test/thread_info_test.rb +11 -0
- metadata +193 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateLives < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :lives do |t|
|
4
|
+
t.string :live_id, :default => '', :null => false
|
5
|
+
t.datetime :base_time, :default => 0, :null => false
|
6
|
+
t.text :title
|
7
|
+
t.references :community, :default => 0, :null => false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.down
|
12
|
+
drop_table :lives
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateComments < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :comments do |t|
|
4
|
+
t.integer :number, :default => 0, :null => false
|
5
|
+
t.text :message, :default => '', :null => false
|
6
|
+
t.string :mail
|
7
|
+
t.datetime :commented_at
|
8
|
+
t.boolean :premium, :default => false, :null => false
|
9
|
+
t.boolean :owner, :default => false, :null => false
|
10
|
+
t.boolean :command, :default => false, :null => false
|
11
|
+
t.boolean :ng, :default => false, :null => false
|
12
|
+
t.string :ngword, :default => nil
|
13
|
+
t.references :live, :visitor, :default => 0, :null => false
|
14
|
+
t.references :listener
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.down
|
19
|
+
drop_table :comments
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateVisitors < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :visitors do |t|
|
4
|
+
t.string :user_id
|
5
|
+
t.integer :color_index, :default => nil
|
6
|
+
t.references :listener
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
drop_table :visitors
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateListenersLives < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :listeners_lives, :id => false do |t|
|
4
|
+
t.references :listener, :live, :default => 0, :null => false
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
drop_table :listeners_lives
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateLivesVisitors < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :lives_visitors, :id => false do |t|
|
4
|
+
t.references :live, :visitor, :default => 0, :null => false
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
drop_table :lives_visitors
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
|
data/lib/factory.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
class Comment < ActiveRecord::Base
|
4
|
+
belongs_to :community
|
5
|
+
belongs_to :live
|
6
|
+
belongs_to :listener
|
7
|
+
belongs_to :visitor
|
8
|
+
|
9
|
+
attr_accessor :user_id
|
10
|
+
def load_from_xml chat_xml
|
11
|
+
reader = Nokogiri::XML::Reader(chat_xml)
|
12
|
+
reader.read
|
13
|
+
if reader.name == 'chat'
|
14
|
+
self.commented_at = reader.attribute('date').to_i
|
15
|
+
self.command = reader.attribute('mail') || ''
|
16
|
+
self.number = reader.attribute('no')
|
17
|
+
@user_id = reader.attribute('user_id')
|
18
|
+
reader.read
|
19
|
+
self.message = reader.value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/models/live.rb
ADDED
data/lib/models.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
require 'models/community.rb'
|
5
|
+
require 'models/live.rb'
|
6
|
+
require 'models/listener.rb'
|
7
|
+
require 'models/visitor.rb'
|
8
|
+
require 'models/comment.rb'
|
9
|
+
|
10
|
+
module Okayu
|
11
|
+
def self.connect_db
|
12
|
+
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3',
|
13
|
+
:database => "#{AppDir}/data.sqlite3",
|
14
|
+
:pool => 5,
|
15
|
+
:timeout => 5000)
|
16
|
+
|
17
|
+
Dir.mkdir("#{AppDir}/log") unless File.exist? "#{AppDir}/log"
|
18
|
+
ActiveRecord::Base.logger = Logger.new(File.open("#{AppDir}/log/database.log", 'a'))
|
19
|
+
ActiveRecord::Base.logger.level = Logger::ERROR
|
20
|
+
dir = File.dirname(File.expand_path(__FILE__))
|
21
|
+
ActiveRecord::Migrator.migrate("#{dir}/db/migrate")
|
22
|
+
end
|
23
|
+
end
|
data/lib/okayu.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
module Okayu
|
5
|
+
class PlayerStatus
|
6
|
+
attr_reader :status, :data
|
7
|
+
def initialize xml_str
|
8
|
+
@data = Nokogiri::XML(xml_str)
|
9
|
+
@status = @data.root.attribute('status').to_s == 'ok'
|
10
|
+
end
|
11
|
+
|
12
|
+
def method_missing(m, *args)
|
13
|
+
@data.css(m.to_s).text
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/sample_msg
ADDED
data/lib/thread_info.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Okayu
|
2
|
+
class ThreadInfo
|
3
|
+
attr_reader :last_res, :result_code, :revision, :server_time, :thread, :ticket
|
4
|
+
def initialize(str)
|
5
|
+
if /last_res="(\d+)"/ =~ str
|
6
|
+
@last_res = $1
|
7
|
+
end
|
8
|
+
|
9
|
+
if /result_code="(\d+)"/ =~ str
|
10
|
+
@result_code = $1
|
11
|
+
end
|
12
|
+
|
13
|
+
if /revision="(\d+)"/ =~ str
|
14
|
+
@revision = $1
|
15
|
+
end
|
16
|
+
|
17
|
+
if /server_time="(\d+)"/ =~ str
|
18
|
+
@server_time = $1
|
19
|
+
end
|
20
|
+
|
21
|
+
if /thread="(\d+)"/ =~ str
|
22
|
+
@thread = $1
|
23
|
+
end
|
24
|
+
|
25
|
+
if /ticket="(0x[a-f0-9]+)"/ =~ str
|
26
|
+
@ticket = $1
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
data/lib/user_info.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'ruby-debug'
|
4
|
+
|
5
|
+
|
6
|
+
module Okayu
|
7
|
+
|
8
|
+
class UserInfo
|
9
|
+
@@app_dir = AppDir.to_s
|
10
|
+
@@data = Hash.new
|
11
|
+
def self.load
|
12
|
+
if File.exist?(user_info_file)
|
13
|
+
File.open(user_info_file, "r") do |f|
|
14
|
+
@@data = YAML.load(f)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.save
|
20
|
+
File.open(user_info_file, "w") do |f|
|
21
|
+
f.write YAML.dump(@@data)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.set_app_dir app_dir
|
26
|
+
@@app_dir = app_dir
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.user_info_file
|
30
|
+
@@app_dir + '/user_info.yml'
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.[] key
|
34
|
+
@@data[key]
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.[]= key, value
|
38
|
+
@@data[key] = value
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.method_missing(m, *args)
|
42
|
+
if /^(.*)=$/ =~ (m.to_s)
|
43
|
+
@@data[$1.to_sym] = args[0]
|
44
|
+
else
|
45
|
+
@@data[m]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Okayu
|
2
|
+
ID_NOTEBOOK = 1000
|
3
|
+
|
4
|
+
NEW_TAB = 100
|
5
|
+
NEW_URL = 101
|
6
|
+
CLOSE_TAB = 102
|
7
|
+
LOGIN = 200
|
8
|
+
|
9
|
+
class AppFrame < Wx::Frame
|
10
|
+
def initialize(title, left=nil, top=nil, width=nil, height=nil)
|
11
|
+
if UserInfo.left
|
12
|
+
left = UserInfo.left unless left
|
13
|
+
top = UserInfo.top unless top
|
14
|
+
width = UserInfo.width unless width
|
15
|
+
height = UserInfo.height unless height
|
16
|
+
else
|
17
|
+
left = 100 unless left
|
18
|
+
top = 100 unless top
|
19
|
+
width = 500 unless width
|
20
|
+
height = 430 unless height
|
21
|
+
end
|
22
|
+
|
23
|
+
super(nil, -1, title, Wx::Point.new(left, top), Wx::Size.new(width, height))
|
24
|
+
file_menu = Wx::Menu.new
|
25
|
+
file_menu.append(NEW_TAB, "新しいタブ(&T)\tCtrl+T", "新しいタブを開きます")
|
26
|
+
file_menu.append(NEW_URL, "新しいURLを開く(&L)\tCtrl+L", "新しいURLを開きます")
|
27
|
+
file_menu.append(CLOSE_TAB, "タブを閉じる(&C)\tCtrl+W", "現在のタブを閉じます")
|
28
|
+
file_menu.append(Wx::ID_EXIT, "終了(&X)", "おかゆを終了します")
|
29
|
+
|
30
|
+
connection_menu = Wx::Menu.new
|
31
|
+
connection_menu.append(LOGIN, "ログイン(&L)", "ログインします")
|
32
|
+
|
33
|
+
menu_bar = Wx::MenuBar.new
|
34
|
+
menu_bar.append(file_menu, "ファイル(&F)")
|
35
|
+
menu_bar.append(connection_menu, "接続(&C)")
|
36
|
+
|
37
|
+
set_menu_bar(menu_bar)
|
38
|
+
|
39
|
+
rect = get_client_rect
|
40
|
+
@panel = MainPanel.new(self, rect.x, rect.y, rect.width, rect.height)
|
41
|
+
|
42
|
+
evt_menu(NEW_TAB){on_new_tab}
|
43
|
+
evt_menu(NEW_URL){on_new_url}
|
44
|
+
evt_menu(CLOSE_TAB){on_close_tab}
|
45
|
+
evt_menu(LOGIN){on_connect}
|
46
|
+
evt_menu(Wx::ID_EXIT){|event| on_quit(event)}
|
47
|
+
|
48
|
+
evt_move{|event| on_move(event)}
|
49
|
+
evt_size{|event| on_size(event)}
|
50
|
+
end
|
51
|
+
|
52
|
+
def on_new_tab
|
53
|
+
@panel.create_tab
|
54
|
+
end
|
55
|
+
|
56
|
+
def on_close_tab
|
57
|
+
@panel.close_tab
|
58
|
+
end
|
59
|
+
|
60
|
+
def on_new_url
|
61
|
+
@panel.get_current_page.on_new_url
|
62
|
+
end
|
63
|
+
|
64
|
+
def on_connect
|
65
|
+
login_dialog = LoginDialog.new(self)
|
66
|
+
login_dialog.show_modal
|
67
|
+
end
|
68
|
+
|
69
|
+
def on_move event
|
70
|
+
position = get_position
|
71
|
+
UserInfo.left = position.x
|
72
|
+
UserInfo.top = position.y
|
73
|
+
end
|
74
|
+
|
75
|
+
def on_size event
|
76
|
+
@panel.set_size(get_client_size)
|
77
|
+
|
78
|
+
size = get_size
|
79
|
+
UserInfo.width = size.width
|
80
|
+
UserInfo.height = size.height
|
81
|
+
end
|
82
|
+
|
83
|
+
def on_quit event
|
84
|
+
close(TRUE)
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Okayu
|
2
|
+
COLOR_BUTTON_ID_FROM = 3000
|
3
|
+
|
4
|
+
class ColorButton < Wx::Button
|
5
|
+
def initialize parent, color_index
|
6
|
+
color = COLORS[color_index]
|
7
|
+
super(parent,
|
8
|
+
:id => color_index + COLOR_BUTTON_ID_FROM,
|
9
|
+
:size => Wx::Size.new(128, 24),
|
10
|
+
:label => color[:name])
|
11
|
+
set_font(Wx::Font.new(8, Wx::FONTFAMILY_DEFAULT, Wx::FONTSTYLE_NORMAL, Wx::FONTWEIGHT_NORMAL))
|
12
|
+
set_background_colour(color[:color])
|
13
|
+
set_foreground_colour(Wx::Colour.new(255,255,255)) if color[:white_text]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class ColorDialog < Wx::Dialog
|
18
|
+
def initialize parent
|
19
|
+
super(parent, :id => Wx::ID_ANY, :title => "色指定", :style => Wx::DEFAULT_DIALOG_STYLE | Wx::NO_3D)
|
20
|
+
|
21
|
+
h_sizer = Wx::BoxSizer.new(Wx::HORIZONTAL)
|
22
|
+
h_sizer.add(create_color_buttons([:red, :pink]))
|
23
|
+
h_sizer.add(create_color_buttons([:orange, :yellow]))
|
24
|
+
h_sizer.add(create_color_buttons([:purple]))
|
25
|
+
h_sizer.add(create_color_buttons([:green]))
|
26
|
+
h_sizer.add(create_color_buttons([:blue]))
|
27
|
+
h_sizer.add(create_color_buttons([:brown]))
|
28
|
+
h_sizer.add(create_color_buttons([:white]))
|
29
|
+
h_sizer.add(create_color_buttons([:grey]))
|
30
|
+
|
31
|
+
set_sizer(h_sizer)
|
32
|
+
h_sizer.set_size_hints(self)
|
33
|
+
|
34
|
+
evt_button(Wx::ID_ANY){|event| on_button(event)}
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_color_buttons color_group_names
|
38
|
+
sizer = Wx::BoxSizer.new(Wx::VERTICAL)
|
39
|
+
color_group_names.each do |color_group_name|
|
40
|
+
sizer.add(Wx::StaticText.new(self, :id => Wx::ID_ANY, :label => "#{color_group_name.to_s.capitalize} colors"))
|
41
|
+
COLOR_GROUPS[color_group_name].each do |color_index|
|
42
|
+
sizer.add(ColorButton.new(self, color_index))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
sizer
|
46
|
+
end
|
47
|
+
|
48
|
+
def on_button event
|
49
|
+
if event.get_id >= COLOR_BUTTON_ID_FROM && event.get_id < COLOR_BUTTON_ID_FROM + COLORS.length
|
50
|
+
end_modal(event.get_id - COLOR_BUTTON_ID_FROM)
|
51
|
+
else
|
52
|
+
end_modal -1
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/views/colors.rb
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
module Okayu
|
2
|
+
COLORS = Array.new
|
3
|
+
COLORS[0] = { :name => 'IndeanRed', :color => Wx::Colour.new(205, 92, 92), :white_text => true }
|
4
|
+
COLORS[1] = { :name => 'LightCoral', :color => Wx::Colour.new(240, 128, 128), :white_text => false }
|
5
|
+
COLORS[2] = { :name => 'Salmon', :color => Wx::Colour.new(250, 128, 114), :white_text => false }
|
6
|
+
COLORS[3] = { :name => 'DardSalmon', :color => Wx::Colour.new(233, 150, 122), :white_text => false }
|
7
|
+
COLORS[4] = { :name => 'LightSalmon', :color => Wx::Colour.new(255, 160, 122), :white_text => false }
|
8
|
+
COLORS[5] = { :name => 'Crimson', :color => Wx::Colour.new(220, 20, 60), :white_text => true }
|
9
|
+
COLORS[6] = { :name => 'Red', :color => Wx::Colour.new(255, 0, 0), :white_text => true }
|
10
|
+
COLORS[7] = { :name => 'FireBrick', :color => Wx::Colour.new(178, 34, 34), :white_text => true }
|
11
|
+
COLORS[8] = { :name => 'DarkRed', :color => Wx::Colour.new(139, 0, 0), :white_text => true }
|
12
|
+
|
13
|
+
COLORS[9] = { :name => 'Pink', :color => Wx::Colour.new(255, 192, 203), :white_text => false }
|
14
|
+
COLORS[10] = { :name => 'LightPink', :color => Wx::Colour.new(255, 182, 193), :white_text => false }
|
15
|
+
COLORS[11] = { :name => 'HotPink', :color => Wx::Colour.new(255, 105, 180), :white_text => true }
|
16
|
+
COLORS[12] = { :name => 'DeepPink', :color => Wx::Colour.new(255, 20, 147), :white_text => true }
|
17
|
+
COLORS[13] = { :name => 'MediumVioletRed', :color => Wx::Colour.new(199, 21, 133), :white_text => true }
|
18
|
+
COLORS[14] = { :name => 'PaleVioletRed', :color => Wx::Colour.new(219, 112, 147), :white_text => true }
|
19
|
+
|
20
|
+
COLORS[15] = { :name => 'LightSalmon', :color => Wx::Colour.new(255, 160, 122), :white_text => false }
|
21
|
+
COLORS[16] = { :name => 'Coral', :color => Wx::Colour.new(255, 127, 80), :white_text => true }
|
22
|
+
COLORS[17] = { :name => 'Tomato', :color => Wx::Colour.new(255, 99, 71), :white_text => true }
|
23
|
+
COLORS[18] = { :name => 'OrangeRed', :color => Wx::Colour.new(255, 69, 0), :white_text => true }
|
24
|
+
COLORS[19] = { :name => 'DarkOrange', :color => Wx::Colour.new(255, 140, 0), :white_text => true }
|
25
|
+
COLORS[20] = { :name => 'Orange', :color => Wx::Colour.new(255, 165, 0), :white_text => true }
|
26
|
+
|
27
|
+
COLORS[21] = { :name => 'Gold', :color => Wx::Colour.new(255, 215, 0), :white_text => false }
|
28
|
+
COLORS[22] = { :name => 'Yellow', :color => Wx::Colour.new(255, 255, 0), :white_text => false }
|
29
|
+
COLORS[23] = { :name => 'LightYellow', :color => Wx::Colour.new(255, 255, 224), :white_text => false }
|
30
|
+
COLORS[24] = { :name => 'LemonChiffon', :color => Wx::Colour.new(255, 250, 205), :white_text => false }
|
31
|
+
COLORS[25] = { :name => 'LightGoldenrodYellow', :color => Wx::Colour.new(250, 250, 210), :white_text => false }
|
32
|
+
COLORS[26] = { :name => 'PapayaWhip', :color => Wx::Colour.new(255, 239, 213), :white_text => false }
|
33
|
+
COLORS[27] = { :name => 'Moccashin', :color => Wx::Colour.new(255, 228, 181), :white_text => false }
|
34
|
+
COLORS[28] = { :name => 'PeachPuff', :color => Wx::Colour.new(255, 218, 185), :white_text => false }
|
35
|
+
COLORS[29] = { :name => 'PaleGoldenrod', :color => Wx::Colour.new(238, 232, 170), :white_text => false }
|
36
|
+
COLORS[30] = { :name => 'Khaki', :color => Wx::Colour.new(240, 230, 140), :white_text => false }
|
37
|
+
COLORS[31] = { :name => 'DarkKhaki', :color => Wx::Colour.new(189, 183, 107), :white_text => true }
|
38
|
+
|
39
|
+
COLORS[32] = { :name => 'Lavender', :color => Wx::Colour.new(230, 230, 250), :white_text => false }
|
40
|
+
COLORS[33] = { :name => 'Thistle', :color => Wx::Colour.new(216, 191, 216), :white_text => true }
|
41
|
+
COLORS[34] = { :name => 'Plum', :color => Wx::Colour.new(221, 160, 221), :white_text => true }
|
42
|
+
COLORS[35] = { :name => 'Violet', :color => Wx::Colour.new(238, 130, 238), :white_text => true }
|
43
|
+
COLORS[36] = { :name => 'Orchid', :color => Wx::Colour.new(218, 112, 214), :white_text => true }
|
44
|
+
COLORS[37] = { :name => 'Fuchsia / Magenta', :color => Wx::Colour.new(255, 0, 255), :white_text => true }
|
45
|
+
COLORS[38] = { :name => 'MediumOrchid', :color => Wx::Colour.new(186, 85, 211), :white_text => true }
|
46
|
+
COLORS[39] = { :name => 'MediumPurple', :color => Wx::Colour.new(147, 112, 219), :white_text => true }
|
47
|
+
COLORS[40] = { :name => 'Amethyst', :color => Wx::Colour.new(153, 102, 204), :white_text => true }
|
48
|
+
COLORS[41] = { :name => 'BlueViolet', :color => Wx::Colour.new(138, 43, 226), :white_text => true }
|
49
|
+
COLORS[42] = { :name => 'DarkViolet', :color => Wx::Colour.new(148, 0, 211), :white_text => true }
|
50
|
+
COLORS[43] = { :name => 'DarkOrchid', :color => Wx::Colour.new(153, 50, 204), :white_text => true }
|
51
|
+
COLORS[44] = { :name => 'DarkMegenta', :color => Wx::Colour.new(139, 0, 139), :white_text => true }
|
52
|
+
COLORS[45] = { :name => 'Purple', :color => Wx::Colour.new(128, 0, 128), :white_text => true }
|
53
|
+
COLORS[46] = { :name => 'Indigo', :color => Wx::Colour.new( 75, 0, 130), :white_text => true }
|
54
|
+
COLORS[47] = { :name => 'SlateBlue', :color => Wx::Colour.new(106, 90, 205), :white_text => true }
|
55
|
+
COLORS[48] = { :name => 'DarkSlateBule', :color => Wx::Colour.new( 72, 61, 139), :white_text => true }
|
56
|
+
COLORS[49] = { :name => 'MediumSlateBlue', :color => Wx::Colour.new(123, 104, 238), :white_text => true }
|
57
|
+
|
58
|
+
COLORS[50] = { :name => 'GreenYellow', :color => Wx::Colour.new(173, 255, 47), :white_text => false }
|
59
|
+
COLORS[51] = { :name => 'Chartreuse', :color => Wx::Colour.new(127, 255, 0), :white_text => false }
|
60
|
+
COLORS[52] = { :name => 'LawnGreen', :color => Wx::Colour.new(124, 252, 0), :white_text => false }
|
61
|
+
COLORS[53] = { :name => 'Lime', :color => Wx::Colour.new( 0, 255, 0), :white_text => false }
|
62
|
+
COLORS[54] = { :name => 'LimeGreen', :color => Wx::Colour.new( 50, 205, 50), :white_text => false }
|
63
|
+
COLORS[55] = { :name => 'PaleGreen', :color => Wx::Colour.new(152, 251, 152), :white_text => false }
|
64
|
+
COLORS[56] = { :name => 'LightGreen', :color => Wx::Colour.new(144, 238, 144), :white_text => false }
|
65
|
+
COLORS[57] = { :name => 'MediumSpringGreen', :color => Wx::Colour.new( 0, 250, 154), :white_text => false }
|
66
|
+
COLORS[58] = { :name => 'SpringGreen', :color => Wx::Colour.new( 0, 255, 127), :white_text => false }
|
67
|
+
COLORS[59] = { :name => 'MediumSeaGreen', :color => Wx::Colour.new( 60, 179, 133), :white_text => true }
|
68
|
+
COLORS[60] = { :name => 'SeaGreen', :color => Wx::Colour.new( 46, 139, 87), :white_text => true }
|
69
|
+
COLORS[61] = { :name => 'ForestGreen', :color => Wx::Colour.new( 34, 139, 34), :white_text => true }
|
70
|
+
COLORS[62] = { :name => 'Green', :color => Wx::Colour.new( 0, 128, 0), :white_text => true }
|
71
|
+
COLORS[63] = { :name => 'DarkGreen', :color => Wx::Colour.new( 0, 100, 0), :white_text => true }
|
72
|
+
COLORS[64] = { :name => 'YellowGreen', :color => Wx::Colour.new(154, 205, 50), :white_text => true }
|
73
|
+
COLORS[65] = { :name => 'OliveDrab', :color => Wx::Colour.new(107, 142, 35), :white_text => true }
|
74
|
+
COLORS[66] = { :name => 'Olive', :color => Wx::Colour.new(128, 128, 0), :white_text => true }
|
75
|
+
COLORS[67] = { :name => 'DarkOliveGreen', :color => Wx::Colour.new( 85, 107, 47), :white_text => true }
|
76
|
+
COLORS[68] = { :name => 'MediumAquamarine', :color => Wx::Colour.new(102, 205, 170), :white_text => false }
|
77
|
+
COLORS[69] = { :name => 'DarkSeaGreen', :color => Wx::Colour.new(143, 188, 143), :white_text => true }
|
78
|
+
COLORS[70] = { :name => 'LightSeaGreen', :color => Wx::Colour.new( 32, 178, 170), :white_text => true }
|
79
|
+
COLORS[71] = { :name => 'DarkCyan', :color => Wx::Colour.new( 0, 139, 139), :white_text => true }
|
80
|
+
COLORS[72] = { :name => 'Teal', :color => Wx::Colour.new( 0, 128, 128), :white_text => true }
|
81
|
+
|
82
|
+
COLORS[73] = { :name => 'Aqua / Cyan', :color => Wx::Colour.new( 0, 255, 255), :white_text => false }
|
83
|
+
COLORS[74] = { :name => 'LightCyan', :color => Wx::Colour.new(224, 255, 255), :white_text => false }
|
84
|
+
COLORS[75] = { :name => 'PaleTurquoise', :color => Wx::Colour.new(175, 238, 238), :white_text => false }
|
85
|
+
COLORS[76] = { :name => 'Aquamarine', :color => Wx::Colour.new(127, 255, 212), :white_text => false }
|
86
|
+
COLORS[77] = { :name => 'Turquoise', :color => Wx::Colour.new( 64, 224, 208), :white_text => false }
|
87
|
+
COLORS[78] = { :name => 'MediumTurquoise', :color => Wx::Colour.new( 72, 209, 204), :white_text => true }
|
88
|
+
COLORS[79] = { :name => 'DarkTurquoise', :color => Wx::Colour.new( 0, 206, 209), :white_text => true }
|
89
|
+
COLORS[80] = { :name => 'CadetBlue', :color => Wx::Colour.new( 95, 158, 160), :white_text => true }
|
90
|
+
COLORS[81] = { :name => 'SteelBlue', :color => Wx::Colour.new( 70, 130, 180), :white_text => true }
|
91
|
+
COLORS[82] = { :name => 'LightSteelBlue', :color => Wx::Colour.new(176, 196, 222), :white_text => false }
|
92
|
+
COLORS[83] = { :name => 'PowderBlue', :color => Wx::Colour.new(176, 224, 230), :white_text => false }
|
93
|
+
COLORS[84] = { :name => 'LIghtBlue', :color => Wx::Colour.new(173, 216, 230), :white_text => false }
|
94
|
+
COLORS[85] = { :name => 'SkyBlue', :color => Wx::Colour.new(135, 206, 235), :white_text => false }
|
95
|
+
COLORS[86] = { :name => 'LightSkyBlue', :color => Wx::Colour.new(135, 206, 250), :white_text => false }
|
96
|
+
COLORS[87] = { :name => 'DeepSkyBlue', :color => Wx::Colour.new( 0, 191, 255), :white_text => true }
|
97
|
+
COLORS[88] = { :name => 'DodgerBlue', :color => Wx::Colour.new( 30, 144, 255), :white_text => true }
|
98
|
+
COLORS[89] = { :name => 'CornflowerBlue', :color => Wx::Colour.new(100, 149, 237), :white_text => true }
|
99
|
+
COLORS[90] = { :name => 'MediumSlateBlue', :color => Wx::Colour.new(123, 104, 238), :white_text => true }
|
100
|
+
COLORS[91] = { :name => 'RoyalBlue', :color => Wx::Colour.new( 65, 105, 225), :white_text => true }
|
101
|
+
COLORS[92] = { :name => 'Blue', :color => Wx::Colour.new( 0, 0, 255), :white_text => true }
|
102
|
+
COLORS[93] = { :name => 'MediumBlue', :color => Wx::Colour.new( 0, 0, 205), :white_text => true }
|
103
|
+
COLORS[94] = { :name => 'DarkBlue', :color => Wx::Colour.new( 0, 0, 139), :white_text => true }
|
104
|
+
COLORS[95] = { :name => 'Navy', :color => Wx::Colour.new( 0, 0, 128), :white_text => true }
|
105
|
+
COLORS[96] = { :name => 'MidnightBlue', :color => Wx::Colour.new( 25, 25, 112), :white_text => true }
|
106
|
+
|
107
|
+
COLORS[97] = { :name => 'Cornsilk', :color => Wx::Colour.new(255, 248, 220), :white_text => false }
|
108
|
+
COLORS[98] = { :name => 'BlanchedAlmond', :color => Wx::Colour.new(255, 235, 205), :white_text => false }
|
109
|
+
COLORS[99] = { :name => 'Bisque', :color => Wx::Colour.new(255, 228, 196), :white_text => false }
|
110
|
+
COLORS[100] = { :name => 'NavajoWhite', :color => Wx::Colour.new(255, 222, 173), :white_text => false }
|
111
|
+
COLORS[101] = { :name => 'Wheat', :color => Wx::Colour.new(245, 222, 179), :white_text => false }
|
112
|
+
COLORS[102] = { :name => 'BurlyWood', :color => Wx::Colour.new(222, 184, 135), :white_text => true }
|
113
|
+
COLORS[103] = { :name => 'Tan', :color => Wx::Colour.new(210, 180, 140), :white_text => true }
|
114
|
+
COLORS[104] = { :name => 'RosyBrown', :color => Wx::Colour.new(188, 143, 143), :white_text => true }
|
115
|
+
COLORS[105] = { :name => 'SandyBrown', :color => Wx::Colour.new(244, 164, 96), :white_text => true }
|
116
|
+
COLORS[106] = { :name => 'Goldenrod', :color => Wx::Colour.new(218, 165, 32), :white_text => true }
|
117
|
+
COLORS[107] = { :name => 'DarkGoldenrod', :color => Wx::Colour.new(184, 134, 11), :white_text => true }
|
118
|
+
COLORS[108] = { :name => 'Peru', :color => Wx::Colour.new(205, 133, 63), :white_text => true }
|
119
|
+
COLORS[109] = { :name => 'Chocolate', :color => Wx::Colour.new(210, 105, 30), :white_text => true }
|
120
|
+
COLORS[110] = { :name => 'SaddieBrown', :color => Wx::Colour.new(139, 69, 19), :white_text => true }
|
121
|
+
COLORS[111] = { :name => 'Sienna', :color => Wx::Colour.new(160, 82, 45), :white_text => true }
|
122
|
+
COLORS[112] = { :name => 'Brown', :color => Wx::Colour.new(165, 42, 42), :white_text => true }
|
123
|
+
COLORS[113] = { :name => 'Maroon', :color => Wx::Colour.new(128, 0, 0), :white_text => true }
|
124
|
+
|
125
|
+
COLORS[114] = { :name => 'White', :color => Wx::Colour.new(255, 255, 255), :white_text => false }
|
126
|
+
COLORS[115] = { :name => 'Snow', :color => Wx::Colour.new(255, 250, 250), :white_text => false }
|
127
|
+
COLORS[116] = { :name => 'Honeydew', :color => Wx::Colour.new(240, 255, 240), :white_text => false }
|
128
|
+
COLORS[117] = { :name => 'MintCream', :color => Wx::Colour.new(245, 255, 250), :white_text => false }
|
129
|
+
COLORS[118] = { :name => 'Azure', :color => Wx::Colour.new(240, 255, 255), :white_text => false }
|
130
|
+
COLORS[119] = { :name => 'AliceBlue', :color => Wx::Colour.new(240, 248, 255), :white_text => false }
|
131
|
+
COLORS[120] = { :name => 'GhostWhite', :color => Wx::Colour.new(248, 248, 255), :white_text => false }
|
132
|
+
COLORS[121] = { :name => 'WhiteSmoke', :color => Wx::Colour.new(245, 245, 245), :white_text => false }
|
133
|
+
COLORS[122] = { :name => 'Seashell', :color => Wx::Colour.new(255, 245, 238), :white_text => false }
|
134
|
+
COLORS[123] = { :name => 'Beige', :color => Wx::Colour.new(245, 245, 220), :white_text => false }
|
135
|
+
COLORS[124] = { :name => 'OldLace', :color => Wx::Colour.new(253, 245, 230), :white_text => false }
|
136
|
+
COLORS[125] = { :name => 'FloralWhite', :color => Wx::Colour.new(255, 250, 240), :white_text => false }
|
137
|
+
COLORS[126] = { :name => 'Ivory', :color => Wx::Colour.new(255, 255, 240), :white_text => false }
|
138
|
+
COLORS[127] = { :name => 'AntiqueWhite', :color => Wx::Colour.new(250, 235, 215), :white_text => false }
|
139
|
+
COLORS[128] = { :name => 'Linen', :color => Wx::Colour.new(250, 240, 230), :white_text => false }
|
140
|
+
COLORS[129] = { :name => 'LavenderBlush', :color => Wx::Colour.new(255, 240, 245), :white_text => false }
|
141
|
+
COLORS[130] = { :name => 'MistyRose', :color => Wx::Colour.new(255, 228, 225), :white_text => false }
|
142
|
+
|
143
|
+
COLORS[131] = { :name => 'Gainsboro', :color => Wx::Colour.new(220, 220, 220), :white_text => false }
|
144
|
+
COLORS[132] = { :name => 'LightGrey', :color => Wx::Colour.new(211, 211, 211), :white_text => false }
|
145
|
+
COLORS[133] = { :name => 'Silver', :color => Wx::Colour.new(192, 192, 192), :white_text => false }
|
146
|
+
COLORS[134] = { :name => 'DarkGray', :color => Wx::Colour.new(169, 169, 169), :white_text => false }
|
147
|
+
COLORS[135] = { :name => 'Gray', :color => Wx::Colour.new(128, 128, 128), :white_text => false }
|
148
|
+
COLORS[136] = { :name => 'DimGray', :color => Wx::Colour.new(105, 105, 105), :white_text => true }
|
149
|
+
COLORS[137] = { :name => 'LightSlateGray', :color => Wx::Colour.new(119, 136, 153), :white_text => true }
|
150
|
+
COLORS[138] = { :name => 'SlateGray', :color => Wx::Colour.new(112, 128, 144), :white_text => true }
|
151
|
+
COLORS[139] = { :name => 'DarkSlateGray', :color => Wx::Colour.new( 47, 79, 79), :white_text => true }
|
152
|
+
COLORS[140] = { :name => 'Black', :color => Wx::Colour.new( 0, 0, 0), :white_text => true }
|
153
|
+
|
154
|
+
WHITE = 114
|
155
|
+
|
156
|
+
COLOR_GROUPS = {
|
157
|
+
:red => [0, 1, 2, 3, 4, 5, 6, 7, 8],
|
158
|
+
:pink => [9, 10, 11, 12, 13, 14],
|
159
|
+
:orange => [15, 16, 17, 18, 19, 20],
|
160
|
+
:yellow => [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],
|
161
|
+
:purple => [32, 33, 34, 35, 36, 37, 38, 39, 40 ,41, 42, 43, 44, 45, 46, 47, 48, 49],
|
162
|
+
:green => [50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72],
|
163
|
+
:blue => [73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96],
|
164
|
+
:brown => [97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113],
|
165
|
+
:white => [114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130],
|
166
|
+
:grey => [131, 132, 133, 134, 135, 136, 137, 138, 139, 140]
|
167
|
+
}
|
168
|
+
end
|