VanaClock 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +9 -0
- data/LICENSE +19 -183
- data/Manifest +3 -5
- data/VanaClock.gemspec +30 -21
- data/bin/VanaClock +0 -1
- data/lib/{VanaClock/control.rb → control.rb} +1 -1
- data/lib/vana_clock.rb +6 -4
- data/lib/view.rb +200 -0
- metadata +13 -15
- data/lib/VanaClock/vana_time.rb +0 -139
- data/lib/VanaClock/version.rb +0 -9
- data/lib/VanaClock/view.rb +0 -56
data/CHANGELOG
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 1.0.0 / 2007-09-02
|
2
|
+
|
3
|
+
* updated VanaClock to make use of VanaTime's updated VanaMoon functionality
|
4
|
+
|
5
|
+
== 0.0.2 / 2007-08-24
|
6
|
+
|
7
|
+
* made timing more accurate by using to_f and milliseconds instead of
|
8
|
+
to_i and seconds (now why didnt I do that to begin with -_-)
|
9
|
+
|
1
10
|
== 0.0.1 / 2007-08-20
|
2
11
|
|
3
12
|
* initial version
|
data/LICENSE
CHANGED
@@ -1,183 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
of
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
c) to distribute or communicate copies of the Original Work and
|
22
|
-
Derivative Works to the public, under any license of your choice that
|
23
|
-
does not contradict the terms and conditions, including Licensor's
|
24
|
-
reserved rights and remedies, in this Academic Free License;
|
25
|
-
|
26
|
-
d) to perform the Original Work publicly; and
|
27
|
-
|
28
|
-
e) to display the Original Work publicly.
|
29
|
-
|
30
|
-
2) Grant of Patent License. Licensor grants You a worldwide,
|
31
|
-
royalty-free, non-exclusive, sublicensable license, under patent claims
|
32
|
-
owned or controlled by the Licensor that are embodied in the Original
|
33
|
-
Work as furnished by the Licensor, for the duration of the patents, to
|
34
|
-
make, use, sell, offer for sale, have made, and import the Original Work
|
35
|
-
and Derivative Works.
|
36
|
-
|
37
|
-
3) Grant of Source Code License. The term "Source Code" means the
|
38
|
-
preferred form of the Original Work for making modifications to it and
|
39
|
-
all available documentation describing how to modify the Original Work.
|
40
|
-
Licensor agrees to provide a machine-readable copy of the Source Code of
|
41
|
-
the Original Work along with each copy of the Original Work that
|
42
|
-
Licensor distributes. Licensor reserves the right to satisfy this
|
43
|
-
obligation by placing a machine-readable copy of the Source Code in an
|
44
|
-
information repository reasonably calculated to permit inexpensive and
|
45
|
-
convenient access by You for as long as Licensor continues to distribute
|
46
|
-
the Original Work.
|
47
|
-
|
48
|
-
4) Exclusions From License Grant. Neither the names of Licensor, nor the
|
49
|
-
names of any contributors to the Original Work, nor any of their
|
50
|
-
trademarks or service marks, may be used to endorse or promote products
|
51
|
-
derived from this Original Work without express prior permission of the
|
52
|
-
Licensor. Except as expressly stated herein, nothing in this License
|
53
|
-
grants any license to Licensor's trademarks, copyrights, patents, trade
|
54
|
-
secrets or any other intellectual property. No patent license is granted
|
55
|
-
to make, use, sell, offer for sale, have made, or import embodiments of
|
56
|
-
any patent claims other than the licensed claims defined in Section 2.
|
57
|
-
No license is granted to the trademarks of Licensor even if such marks
|
58
|
-
are included in the Original Work. Nothing in this License shall be
|
59
|
-
interpreted to prohibit Licensor from licensing under terms different
|
60
|
-
from this License any Original Work that Licensor otherwise would have a
|
61
|
-
right to license.
|
62
|
-
|
63
|
-
5) External Deployment. The term "External Deployment" means the use,
|
64
|
-
distribution, or communication of the Original Work or Derivative Works
|
65
|
-
in any way such that the Original Work or Derivative Works may be used
|
66
|
-
by anyone other than You, whether those works are distributed or
|
67
|
-
communicated to those persons or made available as an application
|
68
|
-
intended for use over a network. As an express condition for the grants
|
69
|
-
of license hereunder, You must treat any External Deployment by You of
|
70
|
-
the Original Work or a Derivative Work as a distribution under section
|
71
|
-
1(c).
|
72
|
-
|
73
|
-
6) Attribution Rights. You must retain, in the Source Code of any
|
74
|
-
Derivative Works that You create, all copyright, patent, or trademark
|
75
|
-
notices from the Source Code of the Original Work, as well as any
|
76
|
-
notices of licensing and any descriptive text identified therein as an
|
77
|
-
"Attribution Notice." You must cause the Source Code for any Derivative
|
78
|
-
Works that You create to carry a prominent Attribution Notice reasonably
|
79
|
-
calculated to inform recipients that You have modified the Original
|
80
|
-
Work.
|
81
|
-
|
82
|
-
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants
|
83
|
-
that the copyright in and to the Original Work and the patent rights
|
84
|
-
granted herein by Licensor are owned by the Licensor or are sublicensed
|
85
|
-
to You under the terms of this License with the permission of the
|
86
|
-
contributor(s) of those copyrights and patent rights. Except as
|
87
|
-
expressly stated in the immediately preceding sentence, the Original
|
88
|
-
Work is provided under this License on an "AS IS" BASIS and WITHOUT
|
89
|
-
WARRANTY, either express or implied, including, without limitation, the
|
90
|
-
warranties of non-infringement, merchantability or fitness for a
|
91
|
-
particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL
|
92
|
-
WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential
|
93
|
-
part of this License. No license to the Original Work is granted by this
|
94
|
-
License except under this disclaimer.
|
95
|
-
|
96
|
-
8) Limitation of Liability. Under no circumstances and under no legal
|
97
|
-
theory, whether in tort (including negligence), contract, or otherwise,
|
98
|
-
shall the Licensor be liable to anyone for any indirect, special,
|
99
|
-
incidental, or consequential damages of any character arising as a
|
100
|
-
result of this License or the use of the Original Work including,
|
101
|
-
without limitation, damages for loss of goodwill, work stoppage,
|
102
|
-
computer failure or malfunction, or any and all other commercial damages
|
103
|
-
or losses. This limitation of liability shall not apply to the extent
|
104
|
-
applicable law prohibits such limitation.
|
105
|
-
|
106
|
-
9) Acceptance and Termination. If, at any time, You expressly assented
|
107
|
-
to this License, that assent indicates your clear and irrevocable
|
108
|
-
acceptance of this License and all of its terms and conditions. If You
|
109
|
-
distribute or communicate copies of the Original Work or a Derivative
|
110
|
-
Work, You must make a reasonable effort under the circumstances to
|
111
|
-
obtain the express assent of recipients to the terms of this License.
|
112
|
-
This License conditions your rights to undertake the activities listed
|
113
|
-
in Section 1, including your right to create Derivative Works based upon
|
114
|
-
the Original Work, and doing so without honoring these terms and
|
115
|
-
conditions is prohibited by copyright law and international treaty.
|
116
|
-
Nothing in this License is intended to affect copyright exceptions and
|
117
|
-
limitations (including "fair use" or "fair dealing"). This License shall
|
118
|
-
terminate immediately and You may no longer exercise any of the rights
|
119
|
-
granted to You by this License upon your failure to honor the conditions
|
120
|
-
in Section 1(c).
|
121
|
-
|
122
|
-
10) Termination for Patent Action. This License shall terminate
|
123
|
-
automatically and You may no longer exercise any of the rights granted
|
124
|
-
to You by this License as of the date You commence an action, including
|
125
|
-
a cross-claim or counterclaim, against Licensor or any licensee alleging
|
126
|
-
that the Original Work infringes a patent. This termination provision
|
127
|
-
shall not apply for an action alleging patent infringement by
|
128
|
-
combinations of the Original Work with other software or hardware.
|
129
|
-
|
130
|
-
11) Jurisdiction, Venue and Governing Law. Any action or suit relating
|
131
|
-
to this License may be brought only in the courts of a jurisdiction
|
132
|
-
wherein the Licensor resides or in which Licensor conducts its primary
|
133
|
-
business, and under the laws of that jurisdiction excluding its
|
134
|
-
conflict-of-law provisions. The application of the United Nations
|
135
|
-
Convention on Contracts for the International Sale of Goods is expressly
|
136
|
-
excluded. Any use of the Original Work outside the scope of this License
|
137
|
-
or after its termination shall be subject to the requirements and
|
138
|
-
penalties of copyright or patent law in the appropriate jurisdiction.
|
139
|
-
This section shall survive the termination of this License.
|
140
|
-
|
141
|
-
12) Attorneys' Fees. In any action to enforce the terms of this License
|
142
|
-
or seeking damages relating thereto, the prevailing party shall be
|
143
|
-
entitled to recover its costs and expenses, including, without
|
144
|
-
limitation, reasonable attorneys' fees and costs incurred in connection
|
145
|
-
with such action, including any appeal of such action. This section
|
146
|
-
shall survive the termination of this License.
|
147
|
-
|
148
|
-
13) Miscellaneous. If any provision of this License is held to be
|
149
|
-
unenforceable, such provision shall be reformed only to the extent
|
150
|
-
necessary to make it enforceable.
|
151
|
-
|
152
|
-
14) Definition of "You" in This License. "You" throughout this License,
|
153
|
-
whether in upper or lower case, means an individual or a legal entity
|
154
|
-
exercising rights under, and complying with all of the terms of, this
|
155
|
-
License. For legal entities, "You" includes any entity that controls, is
|
156
|
-
controlled by, or is under common control with you. For purposes of this
|
157
|
-
definition, "control" means (i) the power, direct or indirect, to cause
|
158
|
-
the direction or management of such entity, whether by contract or
|
159
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
160
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
161
|
-
|
162
|
-
15) Right to Use. You may use the Original Work in all ways not
|
163
|
-
otherwise restricted or conditioned by this License or by law, and
|
164
|
-
Licensor promises not to interfere with or be responsible for such uses
|
165
|
-
by You.
|
166
|
-
|
167
|
-
16) Modification of This License. This License is Copyright (c) 2005
|
168
|
-
Lawrence Rosen. Permission is granted to copy, distribute, or
|
169
|
-
communicate this License without modification. Nothing in this License
|
170
|
-
permits You to modify this License as applied to the Original Work or to
|
171
|
-
Derivative Works. However, You may modify the text of this License and
|
172
|
-
copy, distribute or communicate your modified version (the "Modified
|
173
|
-
License") and apply it to other original works of authorship subject to
|
174
|
-
the following conditions: (i) You may not indicate in any way that your
|
175
|
-
Modified License is the "Academic Free License" or "AFL" and you may not
|
176
|
-
use those names in the name of your Modified License; (ii) You must
|
177
|
-
replace the notice specified in the first paragraph above with the
|
178
|
-
notice "Licensed under <insert your license name here>" or with a notice
|
179
|
-
of your own that is not confusingly similar to the notice in this
|
180
|
-
License; and (iii) You may not claim that your original works are open
|
181
|
-
source software unless your Modified License has been approved by Open
|
182
|
-
Source Initiative (OSI) and You comply with its license review and
|
183
|
-
certification process.
|
1
|
+
Copyright (c) 2007 Travis Tilley
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/Manifest
CHANGED
data/VanaClock.gemspec
CHANGED
@@ -1,38 +1,47 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Vanaclock-0.0
|
2
|
+
# Gem::Specification for Vanaclock-1.0.0
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = %q{VanaClock}
|
7
|
-
s.version = "0.0
|
8
|
-
s.date = %q{2007-
|
9
|
-
s.summary = %q{VanaClock is a clock for Final Fantasy Online written in jruby and java swing
|
10
|
-
s.email = %q{}
|
11
|
-
s.homepage = %q{http://vanatime.rubyforge.
|
7
|
+
s.version = "1.0.0"
|
8
|
+
s.date = %q{2007-09-02}
|
9
|
+
s.summary = %q{VanaClock is a clock for Final Fantasy Online written in jruby and java swing. JRuby is required to run this clock.}
|
10
|
+
s.email = %q{ttilley@gmail.com}
|
11
|
+
s.homepage = %q{http://vanatime.rubyforge.org/}
|
12
12
|
s.rubyforge_project = %q{vanatime}
|
13
|
-
s.description = %q{VanaClock is a clock for Final Fantasy Online written in jruby and java swing
|
13
|
+
s.description = %q{VanaClock is a clock for Final Fantasy Online written in jruby and java swing. JRuby is required to run this clock.}
|
14
14
|
s.default_executable = %q{VanaClock}
|
15
15
|
s.has_rdoc = true
|
16
16
|
s.authors = ["Travis Tilley"]
|
17
|
-
s.files = ["README", "Manifest", "LICENSE", "
|
17
|
+
s.files = ["README", "Manifest", "LICENSE", "lib/view.rb", "lib/vana_clock.rb", "lib/control.rb", "CHANGELOG", "bin/VanaClock", "VanaClock.gemspec"]
|
18
18
|
s.executables = ["VanaClock"]
|
19
|
-
s.add_dependency(%q<
|
19
|
+
s.add_dependency(%q<VanaTime>, ["= 1.2.0"])
|
20
20
|
end
|
21
21
|
|
22
22
|
|
23
23
|
# # Original Rakefile source (requires the Echoe gem):
|
24
24
|
#
|
25
|
-
#
|
26
|
-
# require 'echoe'
|
25
|
+
# version = "1.0.0"
|
27
26
|
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
27
|
+
# ENV['RUBY_FLAGS'] = ""
|
28
|
+
#
|
29
|
+
# begin
|
30
|
+
# require 'rubygems'
|
31
|
+
# gem 'echoe', '=2.3'
|
32
|
+
# require 'echoe'
|
33
|
+
#
|
34
|
+
# Echoe.new('VanaClock', version) do |p|
|
35
|
+
# p.rubyforge_name = 'vanatime'
|
36
|
+
# p.summary = "VanaClock is a clock for Final Fantasy Online " +
|
37
|
+
# "written in jruby and java swing. JRuby is required to run this clock."
|
38
|
+
# p.url = "http://vanatime.rubyforge.org/"
|
39
|
+
# p.author = 'Travis Tilley'
|
40
|
+
# p.email = "ttilley@gmail.com"
|
41
|
+
# p.dependencies = ["VanaTime =1.2.0"]
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# rescue LoadError => boom
|
45
|
+
# puts "You are missing a dependency required for meta-operations on this gem."
|
46
|
+
# puts "#{boom.to_s.capitalize}."
|
38
47
|
# end
|
data/bin/VanaClock
CHANGED
data/lib/vana_clock.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
$:.unshift File.dirname(__FILE__)
|
2
2
|
|
3
|
-
require '
|
4
|
-
|
3
|
+
require 'rubygems'
|
4
|
+
gem 'VanaTime', '=1.2.0'
|
5
|
+
require 'vana_time'
|
6
|
+
include FFXI
|
5
7
|
|
6
8
|
if RUBY_PLATFORM =~ /java/
|
7
|
-
require '
|
8
|
-
require '
|
9
|
+
require 'view'
|
10
|
+
require 'control'
|
9
11
|
end
|
data/lib/view.rb
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
module VanaClock
|
2
|
+
module View
|
3
|
+
import 'javax.swing.JFrame'
|
4
|
+
import 'javax.swing.JPanel'
|
5
|
+
import 'javax.swing.JLabel'
|
6
|
+
import 'javax.swing.JTextField'
|
7
|
+
import 'javax.swing.BoxLayout'
|
8
|
+
import 'javax.swing.BorderFactory'
|
9
|
+
import 'javax.swing.border.LineBorder'
|
10
|
+
import 'javax.swing.border.TitledBorder'
|
11
|
+
import 'java.awt.Color'
|
12
|
+
import 'java.awt.Font'
|
13
|
+
import 'java.awt.Dimension'
|
14
|
+
import 'javax.swing.SwingConstants'
|
15
|
+
|
16
|
+
class ClockWindow
|
17
|
+
def initialize
|
18
|
+
# window frame
|
19
|
+
clock_window = JFrame.new "VanaClock"
|
20
|
+
clock_window.setSize(366, 152)
|
21
|
+
clock_window.default_close_operation = JFrame::EXIT_ON_CLOSE
|
22
|
+
clock_window.getContentPane.setLayout(
|
23
|
+
BoxLayout.new(clock_window.getContentPane, BoxLayout::Y_AXIS))
|
24
|
+
|
25
|
+
# create containers
|
26
|
+
clock_container = JPanel.new
|
27
|
+
vana_time_container = JPanel.new
|
28
|
+
earth_time_container = JPanel.new
|
29
|
+
moon_phase_container = JPanel.new
|
30
|
+
next_phase_container = JPanel.new
|
31
|
+
optimal_phase_container = JPanel.new
|
32
|
+
|
33
|
+
# create labels
|
34
|
+
vana_time_label = JLabel.new "Vana'diel Time: "
|
35
|
+
earth_time_label = JLabel.new "Earth Time: "
|
36
|
+
moon_phase_label = JLabel.new "Moon Phase: "
|
37
|
+
next_phase_label = JLabel.new "Next Phase: "
|
38
|
+
optimal_phase_label = JLabel.new "Optimal Phase: "
|
39
|
+
|
40
|
+
# create text fields, all of which we need to be accessible via an
|
41
|
+
# instance variable so that we can set them later
|
42
|
+
@vana_day = JTextField.new
|
43
|
+
@vana_time = JTextField.new
|
44
|
+
@earth_time = JTextField.new
|
45
|
+
@moon_percent = JTextField.new
|
46
|
+
@phase_name = JTextField.new
|
47
|
+
@next_phase_countdown = JTextField.new
|
48
|
+
@next_phase_name = JTextField.new
|
49
|
+
@optimal_phase_countdown = JTextField.new
|
50
|
+
@optimal_phase_name = JTextField.new
|
51
|
+
|
52
|
+
# clock container panel border
|
53
|
+
border_color = Color.new(0, 0, 204)
|
54
|
+
line_border = LineBorder.new(border_color, 1, true)
|
55
|
+
border_title_justification = TitledBorder::CENTER
|
56
|
+
border_title_position = TitledBorder::DEFAULT_POSITION
|
57
|
+
border_title_font = Font.new("Lucida Grande", 1, 12)
|
58
|
+
clock_border = BorderFactory.createTitledBorder(line_border, "clock",
|
59
|
+
border_title_justification, border_title_position, border_title_font,
|
60
|
+
border_color)
|
61
|
+
|
62
|
+
# set up the clock container panel
|
63
|
+
clock_container.setBorder clock_border
|
64
|
+
clock_container.setMinimumSize Dimension.new(366, 152)
|
65
|
+
clock_container.setMaximumSize Dimension.new(366, 152)
|
66
|
+
clock_container.setPreferredSize Dimension.new(366, 152)
|
67
|
+
clock_container.setLayout BoxLayout.new(clock_container,
|
68
|
+
BoxLayout::Y_AXIS)
|
69
|
+
|
70
|
+
# set up the content panels
|
71
|
+
[vana_time_container, earth_time_container, moon_phase_container,
|
72
|
+
next_phase_container, optimal_phase_container].each do |cont|
|
73
|
+
cont.setMinimumSize Dimension.new(366, 24)
|
74
|
+
cont.setMaximumSize Dimension.new(32767, 24)
|
75
|
+
cont.setPreferredSize Dimension.new(366, 24)
|
76
|
+
cont.setLayout BoxLayout.new(cont, BoxLayout::X_AXIS)
|
77
|
+
end
|
78
|
+
|
79
|
+
# set up the labels
|
80
|
+
[vana_time_label, earth_time_label, moon_phase_label, next_phase_label,
|
81
|
+
optimal_phase_label].each do |label|
|
82
|
+
label.setHorizontalAlignment(SwingConstants::LEFT)
|
83
|
+
label.setMaximumSize Dimension.new(110,16)
|
84
|
+
label.setMinimumSize Dimension.new(110, 16)
|
85
|
+
label.setPreferredSize Dimension.new(110, 16)
|
86
|
+
end
|
87
|
+
|
88
|
+
# set up all the text fields
|
89
|
+
@vana_day.setMaximumSize Dimension.new(94, 22)
|
90
|
+
@vana_day.setMinimumSize Dimension.new(94, 22)
|
91
|
+
@vana_day.setPreferredSize Dimension.new(94, 22)
|
92
|
+
@vana_day.setEditable false
|
93
|
+
@vana_time.setMaximumSize Dimension.new(32767, 22)
|
94
|
+
@vana_time.setPreferredSize Dimension.new(150, 22)
|
95
|
+
@vana_time.setEditable false
|
96
|
+
@earth_time.setMaximumSize Dimension.new(32767, 22)
|
97
|
+
@earth_time.setEditable false
|
98
|
+
@moon_percent.setMinimumSize Dimension.new(42, 22)
|
99
|
+
@moon_percent.setMaximumSize Dimension.new(42, 22)
|
100
|
+
@moon_percent.setPreferredSize Dimension.new(42, 22)
|
101
|
+
@moon_percent.setEditable false
|
102
|
+
@phase_name.setMaximumSize Dimension.new(32767, 22)
|
103
|
+
@phase_name.setPreferredSize Dimension.new(202, 22)
|
104
|
+
@phase_name.setEditable false
|
105
|
+
@next_phase_countdown.setHorizontalAlignment(JTextField::RIGHT)
|
106
|
+
@next_phase_countdown.setMaximumSize Dimension.new(86, 22)
|
107
|
+
@next_phase_countdown.setMinimumSize Dimension.new(86, 22)
|
108
|
+
@next_phase_countdown.setPreferredSize Dimension.new(86, 22)
|
109
|
+
@next_phase_countdown.setEditable false
|
110
|
+
@next_phase_name.setMaximumSize Dimension.new(32767, 22)
|
111
|
+
@next_phase_name.setPreferredSize Dimension.new(158, 22)
|
112
|
+
@next_phase_name.setEditable false
|
113
|
+
@optimal_phase_countdown.setHorizontalAlignment(JTextField::RIGHT)
|
114
|
+
@optimal_phase_countdown.setMaximumSize Dimension.new(86, 22)
|
115
|
+
@optimal_phase_countdown.setMinimumSize Dimension.new(86, 22)
|
116
|
+
@optimal_phase_countdown.setPreferredSize Dimension.new(86, 22)
|
117
|
+
@optimal_phase_countdown.setEditable false
|
118
|
+
@optimal_phase_name.setMaximumSize Dimension.new(32767, 22)
|
119
|
+
@optimal_phase_name.setPreferredSize Dimension.new(158, 22)
|
120
|
+
@optimal_phase_name.setEditable false
|
121
|
+
|
122
|
+
# attach everything
|
123
|
+
vana_time_container.add vana_time_label
|
124
|
+
vana_time_container.add @vana_day
|
125
|
+
vana_time_container.add @vana_time
|
126
|
+
clock_container.add vana_time_container
|
127
|
+
earth_time_container.add earth_time_label
|
128
|
+
earth_time_container.add @earth_time
|
129
|
+
clock_container.add earth_time_container
|
130
|
+
moon_phase_container.add moon_phase_label
|
131
|
+
moon_phase_container.add @moon_percent
|
132
|
+
moon_phase_container.add @phase_name
|
133
|
+
clock_container.add moon_phase_container
|
134
|
+
next_phase_container.add next_phase_label
|
135
|
+
next_phase_container.add @next_phase_countdown
|
136
|
+
next_phase_container.add @next_phase_name
|
137
|
+
clock_container.add next_phase_container
|
138
|
+
optimal_phase_container.add optimal_phase_label
|
139
|
+
optimal_phase_container.add @optimal_phase_countdown
|
140
|
+
optimal_phase_container.add @optimal_phase_name
|
141
|
+
clock_container.add optimal_phase_container
|
142
|
+
clock_window.getContentPane.add clock_container
|
143
|
+
|
144
|
+
# pack and set visible
|
145
|
+
clock_window.pack
|
146
|
+
clock_window.visible = true
|
147
|
+
end
|
148
|
+
|
149
|
+
def update(vt)
|
150
|
+
raise "I can only update with a VanaTime" if ! vt.is_a? FFXI::VanaTime
|
151
|
+
|
152
|
+
self.vana_day = vt.day.to_s
|
153
|
+
self.vana_time = vt.to_s
|
154
|
+
self.earth_time = vt.earth_time.to_s
|
155
|
+
self.moon_percent = vt.moon.percent
|
156
|
+
self.phase_name = vt.moon.phase
|
157
|
+
self.next_phase_countdown = vt.moon.to_next
|
158
|
+
self.next_phase_name = vt.moon.next_phase
|
159
|
+
self.optimal_phase_countdown = vt.moon.to_optimal
|
160
|
+
self.optimal_phase_name = vt.moon.optimal_phase
|
161
|
+
end
|
162
|
+
|
163
|
+
def earth_time=(text)
|
164
|
+
@earth_time.setText text
|
165
|
+
end
|
166
|
+
|
167
|
+
def moon_percent=(text)
|
168
|
+
@moon_percent.setText text
|
169
|
+
end
|
170
|
+
|
171
|
+
def next_phase_countdown=(text)
|
172
|
+
@next_phase_countdown.setText text
|
173
|
+
end
|
174
|
+
|
175
|
+
def next_phase_name=(text)
|
176
|
+
@next_phase_name.setText text
|
177
|
+
end
|
178
|
+
|
179
|
+
def optimal_phase_countdown=(text)
|
180
|
+
@optimal_phase_countdown.setText text
|
181
|
+
end
|
182
|
+
|
183
|
+
def optimal_phase_name=(text)
|
184
|
+
@optimal_phase_name.setText text
|
185
|
+
end
|
186
|
+
|
187
|
+
def phase_name=(text)
|
188
|
+
@phase_name.setText text
|
189
|
+
end
|
190
|
+
|
191
|
+
def vana_day=(text)
|
192
|
+
@vana_day.setText text
|
193
|
+
end
|
194
|
+
|
195
|
+
def vana_time=(text)
|
196
|
+
@vana_time.setText text
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
metadata
CHANGED
@@ -1,23 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
homepage: http://vanatime.rubyforge.
|
2
|
+
homepage: http://vanatime.rubyforge.org/
|
3
3
|
extensions: []
|
4
4
|
executables:
|
5
5
|
- VanaClock
|
6
6
|
version: !ruby/object:Gem::Version
|
7
|
-
version: 0.0
|
7
|
+
version: 1.0.0
|
8
8
|
post_install_message:
|
9
|
-
date: 2007-
|
9
|
+
date: 2007-09-02 04:00:00 +00:00
|
10
10
|
files:
|
11
11
|
- README
|
12
12
|
- Manifest
|
13
13
|
- LICENSE
|
14
|
-
-
|
15
|
-
- lib/VanaClock/view.rb
|
16
|
-
- lib/VanaClock/version.rb
|
17
|
-
- lib/VanaClock/vana_time.rb
|
18
|
-
- lib/VanaClock/control.rb
|
14
|
+
- lib/view.rb
|
19
15
|
- lib/vana_clock.rb
|
16
|
+
- lib/control.rb
|
20
17
|
- CHANGELOG
|
18
|
+
- bin/VanaClock
|
21
19
|
- VanaClock.gemspec
|
22
20
|
rubygems_version: 0.9.4
|
23
21
|
rdoc_options: []
|
@@ -26,8 +24,8 @@ cert_chain:
|
|
26
24
|
name: VanaClock
|
27
25
|
has_rdoc: true
|
28
26
|
platform: ruby
|
29
|
-
summary: VanaClock is a clock for Final Fantasy Online written in jruby and java swing
|
30
|
-
|
27
|
+
summary: VanaClock is a clock for Final Fantasy Online written in jruby and java swing.
|
28
|
+
JRuby is required to run this clock.
|
31
29
|
default_executable:
|
32
30
|
bindir: bin
|
33
31
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
@@ -42,19 +40,19 @@ specification_version: 1
|
|
42
40
|
test_files: []
|
43
41
|
dependencies:
|
44
42
|
- !ruby/object:Gem::Dependency
|
45
|
-
name:
|
43
|
+
name: VanaTime
|
46
44
|
version_requirement:
|
47
45
|
version_requirements: !ruby/object:Gem::Version::Requirement
|
48
46
|
version:
|
49
47
|
requirements:
|
50
|
-
- -
|
48
|
+
- - !str =
|
51
49
|
- !ruby/object:Gem::Version
|
52
|
-
version: 1.
|
50
|
+
version: 1.2.0
|
53
51
|
description: VanaClock is a clock for Final Fantasy Online written in jruby and java
|
54
|
-
swing
|
52
|
+
swing. JRuby is required to run this clock.
|
55
53
|
authors:
|
56
54
|
- Travis Tilley
|
57
|
-
email:
|
55
|
+
email: ttilley@gmail.com
|
58
56
|
extra_rdoc_files: []
|
59
57
|
requirements: []
|
60
58
|
rubyforge_project: vanatime
|
data/lib/VanaClock/vana_time.rb
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
module VanaClock
|
2
|
-
|
3
|
-
# constants relevant to vana time
|
4
|
-
SECONDS_REAL_DAY = (24 * 60 * 60)
|
5
|
-
BASIS_DATE = Time.utc(2002,6,23,15,0,0,0)
|
6
|
-
|
7
|
-
# constants relevant to moon phase
|
8
|
-
SECONDS_GAME_DAY = (24 * 60 * 60 / 25)
|
9
|
-
MOON_DATE = Time.utc(2004,1,25,2,31,12,0)
|
10
|
-
|
11
|
-
# days of the week
|
12
|
-
VANA_DAYS = ["Firesday", "Earthsday", "Watersday", "Windsday", "Iceday",
|
13
|
-
"Lightningday", "Lightsday", "Darksday"]
|
14
|
-
|
15
|
-
class VanaDay
|
16
|
-
|
17
|
-
def initialize(vana_time)
|
18
|
-
@vana_time = vana_time
|
19
|
-
@vanaDay = ((@vana_time % (8 * SECONDS_REAL_DAY)) / (SECONDS_REAL_DAY))
|
20
|
-
end
|
21
|
-
|
22
|
-
attr_reader :vana_time
|
23
|
-
|
24
|
-
def to_i
|
25
|
-
@vanaDay
|
26
|
-
end
|
27
|
-
|
28
|
-
def to_s
|
29
|
-
VANA_DAYS[@vanaDay]
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
class VanaMoon
|
34
|
-
|
35
|
-
def initialize(time)
|
36
|
-
moon_days = ((time.to_i - MOON_DATE.to_i) / SECONDS_GAME_DAY).floor % 84
|
37
|
-
moon_days += 84 if moon_days < 0
|
38
|
-
@moonPercent = - ((42 - moon_days).to_f / 42 * 100).round
|
39
|
-
end
|
40
|
-
|
41
|
-
def to_i
|
42
|
-
@moonPercent
|
43
|
-
end
|
44
|
-
|
45
|
-
def to_s
|
46
|
-
if (@moonPercent == -100)
|
47
|
-
"100% Full Moon"
|
48
|
-
elsif (@moonPercent == 0)
|
49
|
-
"0% New Moon"
|
50
|
-
elsif (@moonPercent < 0)
|
51
|
-
"#{-@moonPercent}% Waning"
|
52
|
-
elsif (@moonPercent > 0)
|
53
|
-
"#{@moonPercent}% Waxing"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
class VanaTime
|
59
|
-
|
60
|
-
def initialize(time = Time.now)
|
61
|
-
self.earth_time = time
|
62
|
-
end
|
63
|
-
|
64
|
-
def earth_time=(time)
|
65
|
-
raise "Input was not a Time object" if ! time.is_a?(Time)
|
66
|
-
|
67
|
-
@earth_time = time
|
68
|
-
@vana_time = ((898 * 360 + 30) * SECONDS_REAL_DAY) +
|
69
|
-
(@earth_time.to_i - BASIS_DATE.to_i) * 25
|
70
|
-
|
71
|
-
@vDate = @vDay = @vHour = @vMin = @vMon = @vMoon = @vSec = @vYear = nil
|
72
|
-
end
|
73
|
-
|
74
|
-
attr_reader :earth_time
|
75
|
-
|
76
|
-
def self.vana_to_earth(vana_time)
|
77
|
-
((vana_time - ((898 * 360 + 30) * SECONDS_REAL_DAY)) / 25) + BASIS_DATE.to_i
|
78
|
-
end
|
79
|
-
|
80
|
-
def vana_time=(vana_time)
|
81
|
-
@vana_time = vana_time
|
82
|
-
@earth_time = Time.at(self.class.vana_to_earth(vana_time))
|
83
|
-
|
84
|
-
@vDate = @vDay = @vHour = @vMin = @vMon = @vMoon = @vSec = @vYear = nil
|
85
|
-
end
|
86
|
-
|
87
|
-
def self.at(vana_time)
|
88
|
-
self.new(Time.at(self.vana_to_earth(vana_time)))
|
89
|
-
end
|
90
|
-
|
91
|
-
def to_i
|
92
|
-
@vana_time
|
93
|
-
end
|
94
|
-
|
95
|
-
def year
|
96
|
-
@vYear ||= (@vana_time / (360 * SECONDS_REAL_DAY))
|
97
|
-
end
|
98
|
-
|
99
|
-
def month
|
100
|
-
@vMon ||= ((@vana_time % (360 * SECONDS_REAL_DAY)) /
|
101
|
-
(30 * SECONDS_REAL_DAY)) + 1
|
102
|
-
end
|
103
|
-
|
104
|
-
def date
|
105
|
-
@vDate ||= ((@vana_time % (30 * SECONDS_REAL_DAY)) /
|
106
|
-
(SECONDS_REAL_DAY)) + 1
|
107
|
-
end
|
108
|
-
|
109
|
-
def hour
|
110
|
-
@vHour ||= ((@vana_time % (SECONDS_REAL_DAY)) / (60 * 60))
|
111
|
-
end
|
112
|
-
|
113
|
-
def minute
|
114
|
-
@vMin ||= ((@vana_time % (60 * 60)) / (60))
|
115
|
-
end
|
116
|
-
|
117
|
-
def second
|
118
|
-
@vSec ||= (@vana_time % 60)
|
119
|
-
end
|
120
|
-
|
121
|
-
def day
|
122
|
-
@vDay ||= VanaDay.new(@vana_time)
|
123
|
-
end
|
124
|
-
|
125
|
-
def moon_phase
|
126
|
-
@vMoon ||= VanaMoon.new(@earth_time)
|
127
|
-
end
|
128
|
-
|
129
|
-
def self.now
|
130
|
-
self.new
|
131
|
-
end
|
132
|
-
|
133
|
-
def to_s
|
134
|
-
"#{day} #{year}-#{month}-#{date}" +
|
135
|
-
" #{hour}:#{minute}:#{second}"
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
end
|
data/lib/VanaClock/version.rb
DELETED
data/lib/VanaClock/view.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'profligacy/swing'
|
3
|
-
require 'profligacy/lel'
|
4
|
-
|
5
|
-
module VanaClock
|
6
|
-
module View
|
7
|
-
class ClockWindow
|
8
|
-
include_package 'javax.swing'
|
9
|
-
include_package 'javax.swing.text'
|
10
|
-
include Profligacy
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
layout = "[<(18)earth_label|<(240)*earth_time]
|
14
|
-
[<(18)vana_label|<(240)*vana_time]
|
15
|
-
[<(18)moon_label|<(240)*moon_phase]"
|
16
|
-
|
17
|
-
@ui = Swing::LEL.new(JFrame,layout) do |c,i|
|
18
|
-
c.vana_label = JLabel.new "Vana'diel Time: "
|
19
|
-
c.moon_label = JLabel.new "Moon Phase: "
|
20
|
-
c.earth_label = JLabel.new "Earth Time: "
|
21
|
-
c.vana_time = JTextField.new
|
22
|
-
c.moon_phase = JTextField.new
|
23
|
-
c.earth_time = JTextField.new
|
24
|
-
end
|
25
|
-
|
26
|
-
@ui.build(:args => "VanaClock")
|
27
|
-
|
28
|
-
@ui.vana_time.setEditable false
|
29
|
-
@ui.moon_phase.setEditable false
|
30
|
-
@ui.earth_time.setEditable false
|
31
|
-
end
|
32
|
-
|
33
|
-
def vana_time=(vana_time)
|
34
|
-
@ui.vana_time.setText vana_time
|
35
|
-
end
|
36
|
-
|
37
|
-
def moon_phase=(moon_phase)
|
38
|
-
@ui.moon_phase.setText moon_phase
|
39
|
-
end
|
40
|
-
|
41
|
-
def earth_time=(earth_time)
|
42
|
-
@ui.earth_time.setText earth_time
|
43
|
-
end
|
44
|
-
|
45
|
-
def update(with)
|
46
|
-
if with.is_a? VanaTime
|
47
|
-
self.vana_time = with.to_s
|
48
|
-
self.moon_phase = with.moon_phase.to_s
|
49
|
-
self.earth_time = with.earth_time.to_s
|
50
|
-
else
|
51
|
-
raise "update with what?"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|