ming-ruby 1.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
data/README ADDED
@@ -0,0 +1,26 @@
1
+ Ming/Ruby -- ruby library for generating Adobe Flash (SWF)
2
+ based on Ming
3
+
4
+
5
+ Contributors:
6
+ * IKEGAMI Daisuke <ikegami at madscientist dot jp>
7
+ * Carson Macdonald
8
+ * Richard Fairhurst
9
+ * Kazuki Sakamoto
10
+ * Genki Sugawara
11
+ * Pawel Karwowski
12
+
13
+
14
+ Short description:
15
+ 'Ming/Ruby' is a ruby extension library for generating Adobe
16
+ Flash (SWF). It is a wrapper for Ming [0] which is a C library for
17
+ the same purpose.
18
+
19
+ License:
20
+ License of Ming/Ruby is LGPL because one of Ming is LGPL.
21
+
22
+ Requires:
23
+
24
+ * One Click Ruby installer with rubygems: http://rubyforge.org/projects/rubyinstaller/
25
+ * Windows XP or Windows Vista
26
+
data/TODO ADDED
@@ -0,0 +1,5 @@
1
+ * Documents!
2
+
3
+ Yes, we need documents whenever!
4
+ Please contact us via mailing list 'mingruby-users', or
5
+ on Wiki pages.
@@ -0,0 +1,290 @@
1
+ #!/usr/bin/ruby
2
+
3
+ # SWFMing_T_Scrollbar mixin module for Ming 0.4.
4
+ # Version 0.39 for Ruby.
5
+ # based upon Pipey's code and SWFTools scrollbar code
6
+ # Author Pawel Karwowski pkarwow at fastmail dot fm
7
+
8
+ module SWFMing_T_Scrollbar
9
+
10
+ @PATH = "C:/ruby/lib/ruby/gems/1.8/gems/ming-ruby-1.0-mswin32/lib/pictures"
11
+ if File.directory?(@PATH)
12
+ else
13
+ @PATH = "C:/ruby/lib/ruby/gems/1.8/gems/ming-ruby-1.0-x86-mswin32/lib/pictures"
14
+ end
15
+
16
+
17
+ def self.new(instance, depth, a, b, c, d, border, embedFonts, textadd)
18
+
19
+ @instance = instance
20
+ @depth = depth
21
+ @a = a
22
+ @b = b
23
+ @c = c
24
+ @d = d
25
+ @border = border
26
+ @embedFonts = embedFonts
27
+ @textadd = textadd
28
+
29
+ @arrow_up_inactive = SWFShape.new
30
+ @dbl1 = SWFBitmap.new("#{@PATH}/arrow_up_inactive.dbl")
31
+ @arrow_up_inactive.set_right_fill(@arrow_up_inactive.add_fill(@dbl1, SWFFill::CLIPPED_BITMAP))
32
+ @arrow_up_inactive.draw_line(@dbl1.get_width, 0)
33
+ @arrow_up_inactive.draw_line(0, @dbl1.get_height)
34
+ @arrow_up_inactive.draw_line(-@dbl1.get_width, 0)
35
+ @arrow_up_inactive.draw_line(0, -@dbl1.get_height)
36
+
37
+ @arrow_up_active = SWFShape.new
38
+ @dbl2 = SWFBitmap.new("#{@PATH}/arrow_up_active.dbl");
39
+ @arrow_up_active.set_right_fill(@arrow_up_active.add_fill(@dbl2, SWFFill::CLIPPED_BITMAP))
40
+ @arrow_up_active.draw_line(@dbl2.get_width, 0)
41
+ @arrow_up_active.draw_line(0, @dbl2.get_height)
42
+ @arrow_up_active.draw_line(-@dbl2.get_width, 0)
43
+ @arrow_up_active.draw_line(0, -@dbl2.get_height)
44
+
45
+ @arrow_down_inactive = SWFShape.new
46
+ @dbl3 = SWFBitmap.new("#{@PATH}/arrow_down_inactive.dbl");
47
+ @arrow_down_inactive.set_right_fill(@arrow_down_inactive.add_fill(@dbl3, SWFFill::CLIPPED_BITMAP))
48
+ @arrow_down_inactive.draw_line(@dbl3.get_width, 0);
49
+ @arrow_down_inactive.draw_line(0, @dbl3.get_height);
50
+ @arrow_down_inactive.draw_line(-@dbl3.get_width, 0);
51
+ @arrow_down_inactive.draw_line(0, -@dbl3.get_height);
52
+
53
+ @arrow_down_active = SWFShape.new
54
+ @dbl4 = SWFBitmap.new("#{@PATH}/arrow_down_active.dbl")
55
+ @arrow_down_active.set_right_fill(@arrow_down_active.add_fill(@dbl4, SWFFill::CLIPPED_BITMAP))
56
+ @arrow_down_active.draw_line(@dbl4.get_width, 0)
57
+ @arrow_down_active.draw_line(0, @dbl4.get_height)
58
+ @arrow_down_active.draw_line(-@dbl4.get_width, 0)
59
+ @arrow_down_active.draw_line(0, -@dbl4.get_height)
60
+
61
+ @scrollbar_inactive = SWFShape.new
62
+ @dbl5 = SWFBitmap.new("#{@PATH}/scrollbar_inactive.dbl")
63
+ @scrollbar_inactive.set_right_fill(@scrollbar_inactive.add_fill(@dbl5, SWFFill::CLIPPED_BITMAP))
64
+ @scrollbar_inactive.draw_line(@dbl5.get_width, 0)
65
+ @scrollbar_inactive.draw_line(0, @dbl5.get_height)
66
+ @scrollbar_inactive.draw_line(-@dbl5.get_width, 0)
67
+ @scrollbar_inactive.draw_line(0, -@dbl5.get_height)
68
+
69
+ @scrollbar_active = SWFShape.new
70
+ @dbl6 = SWFBitmap.new("#{@PATH}/scrollbar_active.dbl")
71
+ @scrollbar_active.set_right_fill(@scrollbar_active.add_fill(@dbl6, SWFFill::CLIPPED_BITMAP))
72
+ @scrollbar_active.draw_line(@dbl6.get_width, 0)
73
+ @scrollbar_active.draw_line(0, @dbl6.get_height)
74
+ @scrollbar_active.draw_line(-@dbl6.get_width, 0)
75
+ @scrollbar_active.draw_line(0, -@dbl6.get_height)
76
+
77
+ @backgroundV = SWFShape.new
78
+ @dbl8 = SWFBitmap.new("#{@PATH}/backgroundV.dbl")
79
+ @backgroundV.set_right_fill(@backgroundV.add_fill(@dbl8, SWFFill::CLIPPED_BITMAP))
80
+ @backgroundV.draw_line(@dbl8.get_width, 0)
81
+ @backgroundV.draw_line(0, @dbl8.get_height)
82
+ @backgroundV.draw_line(-@dbl8.get_width, 0)
83
+ @backgroundV.draw_line(0, -@dbl8.get_height)
84
+
85
+ @ib = $movie.add(@backgroundV)
86
+ @ib.set_name("BackgroundV")
87
+ @ib.scale_to(1,0.0625*@d)
88
+ @ib.move_to(@a+@c+2,@b)
89
+
90
+ @backgroundH_gap = SWFShape.new
91
+ @dbl9 = SWFBitmap.new("#{@PATH}/backgroundH_gap.dbl")
92
+ @backgroundH_gap.set_right_fill(@backgroundH_gap.add_fill(@dbl9, SWFFill::CLIPPED_BITMAP))
93
+ @backgroundH_gap.draw_line(@dbl9.get_width, 0)
94
+ @backgroundH_gap.draw_line(0, @dbl9.get_height)
95
+ @backgroundH_gap.draw_line(-@dbl9.get_width, 0)
96
+ @backgroundH_gap.draw_line(0, -@dbl9.get_height)
97
+
98
+ @ic = $movie.add(@backgroundH_gap)
99
+ @ic.set_name("BackgroundH_gap")
100
+ @ic.move_to(@a+@c+2,@b)
101
+
102
+ @backgroundV_gap = SWFShape.new()
103
+ @dbl10 = SWFBitmap.new("#{@PATH}/backgroundV_gap.dbl")
104
+ @backgroundV_gap.set_right_fill(@backgroundV_gap.add_fill(@dbl10, SWFFill::CLIPPED_BITMAP))
105
+ @backgroundV_gap.draw_line(@dbl10.get_width, 0)
106
+ @backgroundV_gap.draw_line(0, @dbl10.get_height)
107
+ @backgroundV_gap.draw_line(-@dbl10.get_width, 0)
108
+ @backgroundV_gap.draw_line(0, -@dbl10.get_height)
109
+
110
+ @id = $movie.add(@backgroundV_gap)
111
+ @id.set_name("BackgroundV_gap")
112
+ @id.move_to(@a+@c+2,@b)
113
+
114
+ @backgroundH_gap2 = SWFShape.new
115
+ @dbl11 = SWFBitmap.new("#{@PATH}/backgroundH_gap2.dbl")
116
+ @backgroundH_gap2.set_right_fill(@backgroundH_gap2.add_fill(@dbl11, SWFFill::CLIPPED_BITMAP))
117
+ @backgroundH_gap2.draw_line(@dbl10.get_width, 0)
118
+ @backgroundH_gap2.draw_line(0, @dbl10.get_height)
119
+ @backgroundH_gap2.draw_line(-@dbl10.get_width, 0)
120
+ @backgroundH_gap2.draw_line(0, -@dbl10.get_height)
121
+
122
+ @ie = $movie.add(@backgroundH_gap2)
123
+ @ie.set_name("BackgroundH_gap2")
124
+ @ie.move_to(@a+@c+2,@b)
125
+
126
+ @backgroundV_gap2 = SWFShape.new
127
+ @dbl12 = SWFBitmap.new("#{@PATH}/backgroundV_gap2.dbl")
128
+ @backgroundV_gap2.set_right_fill(@backgroundV_gap2.add_fill(@dbl12, SWFFill::CLIPPED_BITMAP))
129
+ @backgroundV_gap2.draw_line(@dbl12.get_width, 0)
130
+ @backgroundV_gap2.draw_line(0, @dbl12.get_height)
131
+ @backgroundV_gap2.draw_line(-@dbl12.get_width, 0)
132
+ @backgroundV_gap2.draw_line(0, -@dbl12.get_height)
133
+
134
+ @ikf = $movie.add(@backgroundV_gap2)
135
+ @ikf.set_name("BackgroundV_gap2")
136
+ @ikf.move_to(@a+@c+2,@b)
137
+
138
+ @dragbutton = SWFMovieClip.new
139
+ @but = SWFButton.new
140
+ @but.add_character(@scrollbar_inactive, SWFButton::HIT | SWFButton::UP | SWFButton::OVER)
141
+ @but.add_character(@scrollbar_active, SWFButton::HIT | SWFButton::DOWN)
142
+ @but.add_action(SWFAction.new("
143
+ DragButton#{@instance}._x = #{@a}+#{@c}+3;
144
+ Dragging = true;
145
+ this.startDrag(DragButton#{@instance}, true, _parent.UpButton#{@instance}._y + 16, #{@a}+#{@c}+3, _parent.DownButton#{@instance}._y - 17 , #{@a}+#{@c}+3 );
146
+ Dragging = true;
147
+ idInt_Drag#{@instance} = setInterval(_parent.Revalue#{@instance}, 15);"), SWFButton::MOUSE_DOWN)
148
+ @but.add_action(SWFAction.new("
149
+ Dragging = false;
150
+ clearInterval(idInt_Drag#{@instance});
151
+ this.stopDrag();
152
+ _parent.Revalue#{@instance}();"), SWFButton::MOUSE_UP | SWFButton::MOUSE_UP_OUTSIDE | SWFButton::DRAG_OUT | SWFButton::DRAG_OVER)
153
+ @dragbutton.add(@but)
154
+ @dragbutton.next_frame
155
+
156
+ @ir = $movie.add(@dragbutton)
157
+ @ir.set_name("DragButton#{@instance}")
158
+ @ir.move_to(@a+@c+3,@b+16)
159
+
160
+ @upbutton = SWFButton.new
161
+ @upbutton.add_character(@arrow_up_inactive, SWFButton::HIT | SWFButton::UP | SWFButton::OVER)
162
+ @upbutton.add_character(@arrow_up_active, SWFButton::HIT | SWFButton::DOWN)
163
+ @upbutton.add_action(SWFAction.new("
164
+ Up_pressed#{@instance}();
165
+ function Up_pressed#{@instance}() {
166
+ if (Value#{@instance} > MinValue) {
167
+ Value#{@instance} = Value#{@instance} - Increment;
168
+ }
169
+ if (Value#{@instance} < MinValue) {
170
+ Value#{@instance} = MinValue;
171
+ }
172
+ Reposition#{@instance}();
173
+ }
174
+ idInt_Up_pressed#{@instance} = setInterval(Up_pressed#{@instance}, 100);"), SWFButton::MOUSE_DOWN)
175
+ @upbutton.add_action(SWFAction.new("clearInterval(idInt_Up_pressed#{@instance});"), SWFButton::MOUSE_UP | SWFButton::MOUSE_UP_OUTSIDE)
176
+
177
+ @is=$movie.add(@upbutton)
178
+ @is.set_name("UpButton#{@instance}")
179
+ @is.move_to(@a+@c+3,@b)
180
+
181
+ @downbutton = SWFButton.new
182
+ @downbutton.add_character(@arrow_down_inactive, SWFButton::HIT | SWFButton::UP | SWFButton::OVER)
183
+ @downbutton.add_character(@arrow_down_active, SWFButton::HIT | SWFButton::DOWN)
184
+ @downbutton.add_action(SWFAction.new("
185
+ Down_pressed#{@instance}();
186
+ function Down_pressed#{@instance}() {
187
+ if (Value#{@instance} < MaxValue#{@instance}) {
188
+ Value#{@instance} = Value#{@instance} + Increment;
189
+ }
190
+ if (Value#{@instance} > MaxValue#{@instance}) {
191
+ Value#{@instance} = MaxValue#{@instance};
192
+ }
193
+ Reposition#{@instance}();
194
+ }
195
+ idInt_Down_pressed#{@instance} = setInterval(Down_pressed#{@instance}, 100);"), SWFButton::MOUSE_DOWN)
196
+ @downbutton.add_action(SWFAction.new("clearInterval(idInt_Down_pressed#{@instance});"), SWFButton::MOUSE_UP |SWFButton::DRAG_OUT | SWFButton::MOUSE_UP_OUTSIDE)
197
+
198
+ @iw=$movie.add(@downbutton)
199
+ @iw.set_name("DownButton#{@instance}")
200
+ @iw.move_to(@a+@c+3,@b+@d-15)
201
+
202
+ $movie.add(SWFAction.new("
203
+
204
+
205
+ function updateOutput() {
206
+ txf = TextField.StyleSheet;
207
+ myStyleSheet = new txf();
208
+ myStyleSheet.parseCSS(mycss);
209
+ #{@instance}.styleSheet = myStyleSheet;
210
+ #{@instance}.htmlText = str;
211
+ }
212
+
213
+
214
+ _root.createTextField('#{@instance}',#{@depth},#{@a},#{@b},#{@c},#{@d});
215
+ with(#{@instance}){ #{@border}; html = true; #{@embedFonts}; scroll=1; multiline=true; wordWrap=true;}
216
+ str = '';
217
+ str+='#{@textadd}';
218
+
219
+
220
+ #{@instance}.scrollWheelEnabled = true;
221
+
222
+
223
+ myListener#{@instance} = new Object();
224
+ myListener#{@instance}.onScroller = function() {
225
+ MaxValue#{@instance} = #{@instance}.maxscroll;
226
+ MouseOverText#{@instance}();
227
+ };
228
+
229
+ #{@instance}.addListener(myListener#{@instance});
230
+
231
+
232
+ #{@instance}.htmlText = str;
233
+ updateOutput();
234
+
235
+
236
+ MinValue =1;
237
+ Increment =1;
238
+ TextField#{@instance} = new Object(_root.#{@instance});
239
+ MaxValue#{@instance} = #{@instance}.maxscroll;
240
+ Initialize#{@instance}();
241
+
242
+ function UpdateBar#{@instance}() {
243
+ _parent.#{@instance} = TextField#{@instance}.scroll;
244
+ Value#{@instance} = TextField#{@instance}.scroll;
245
+ DragButton#{@instance}._y = ((Value#{@instance}-MinValue)/(MaxValue#{@instance}-MinValue)*(#{@d}-48));
246
+ Reposition#{@instance}();
247
+ };
248
+
249
+ function MouseOverText#{@instance}() {
250
+ if (TextField#{@instance}._ymouse > 0){
251
+ if (TextField#{@instance}._ymouse < TextField#{@instance}._height) {
252
+ if (TextField#{@instance}._xmouse < TextField#{@instance}._width) {
253
+ if (TextField#{@instance}._xmouse > 0) {
254
+ UpdateBar#{@instance}();
255
+ }
256
+ }
257
+ }
258
+ }
259
+ };
260
+
261
+ function Initialise#{@instance}() {
262
+ DownButton#{@instance}._x = #{@a}+#{@c}+2;
263
+ DownButton#{@instance}._y = #{@d} - 37;
264
+ BackgroundV._yscale = (((#{@d} / 16))*100) + 1;
265
+ BackgroundV_gap2._y = #{@d} - 1;
266
+ Value#{@instance} = MinValue;
267
+ Reposition#{@instance}();
268
+ };
269
+
270
+ function Reposition#{@instance}() {
271
+
272
+ DragButton#{@instance}._y = ((Value#{@instance}-MinValue)/(MaxValue#{@instance}-MinValue)*(#{@d}-48))+#{@b}+16;
273
+ TextField#{@instance}.scroll = Value#{@instance};
274
+ };
275
+
276
+ function Revalue#{@instance}() {
277
+ Value#{@instance} = (((DragButton#{@instance}._y-#{@b}-16)/(#{@d}-48))*(MaxValue#{@instance}-MinValue)) + MinValue;
278
+ DragButton#{@instance}._x = #{@a}+#{@c}+3;
279
+ Value#{@instance} = int(Value#{@instance}/Increment)*Increment;
280
+ TextField#{@instance}.scroll = Value#{@instance};
281
+ if (dragging == 'false') {
282
+ Reposition#{@instance}();
283
+ }
284
+ };
285
+ idmouseText#{@instance} = setInterval(MouseOverText#{@instance}, 300);
286
+
287
+ "));
288
+
289
+ end
290
+ end
data/lib/ming/ming.rb ADDED
@@ -0,0 +1,68 @@
1
+ # ming.rb - a library for generating Macromedia Flash (SWF)
2
+ # Copyright (C) 2004 IKEGAMI Daisuke <ikegami at madscientist dot jp>
3
+ # All rights reserved.
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Library General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Library General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Library General Public
16
+ # License along with this library; if not, write to the
17
+ # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
+ # Boston, MA 02111-1307, USA.
19
+ #
20
+
21
+ require 'ming/mingc'
22
+ require 'find'
23
+
24
+ module Ming
25
+ class SWFFont
26
+ @@font_path = ['.']
27
+
28
+ def SWFFont.font_path
29
+ @@font_path
30
+ end
31
+
32
+ def SWFFont.new(filename)
33
+ realname = SWFFont.search_font(filename)
34
+
35
+ SWFFont.new_from_file(realname)
36
+ end
37
+
38
+ def SWFFont.search_font(filename)
39
+ if File.basename(filename) == filename
40
+ @@font_path.each do |rdir|
41
+ if /(.*)\/\/$/=~ rdir
42
+ Find::find($1) do |path|
43
+ filename = path if File.basename(path) == filename
44
+ end
45
+ else
46
+ dir = Dir.open(rdir)
47
+ dir.each do |path|
48
+ filename = File.join(dir, path) if path == filename
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ unless File.exist?(filename)
55
+ raise MingError, "file #{filename} is not found."
56
+ end
57
+ unless File.file?(filename)
58
+ raise MingError, "file #{filename} is not regular font file."
59
+ end
60
+ unless File.readable?(filename)
61
+ raise MingError, "file #{filename} cannot be read."
62
+ end
63
+
64
+ filename
65
+ end
66
+
67
+ end
68
+ end
data/lib/ming/mingc.so ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: ming-ruby
5
+ version: !ruby/object:Gem::Version
6
+ version: "1.0"
7
+ date: 2009-05-01 00:00:00 +02:00
8
+ summary: "ming-ruby (\xE9\x8B\xB8) is an Ruby extension and wrapper for Ming library, enabling script based creation of the swf files."
9
+ require_paths:
10
+ - - lib/
11
+ email:
12
+ - pkarwow@googlemail.com
13
+ homepage: http://rubyforge.org/projects/mingruby/
14
+ rubyforge_project: ming-ruby
15
+ description: "ming-ruby (\xE9\x8B\xB8) is an swf files generator."
16
+ autorequire:
17
+ default_executable:
18
+ bindir: bin
19
+ has_rdoc: false
20
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
21
+ requirements:
22
+ - - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.0
25
+ version:
26
+ platform: mswin32
27
+ signing_key:
28
+ cert_chain:
29
+ post_install_message:
30
+ authors:
31
+ - Pawel Karwowski
32
+ files:
33
+ - ChangeLog
34
+ - README
35
+ - INSTALL
36
+ - LGPL
37
+ - TODO
38
+ - lib/ming/mingc.so
39
+ - lib/ming/ming.rb
40
+ - lib/SWFMing_T_Scrollbar.rb
41
+ - lib/pictures/arrow_down_active.dbl
42
+ - lib/pictures/arrow_down_inactive.dbl
43
+ - lib/pictures/arrow_up_active.dbl
44
+ - lib/pictures/arrow_up_inactive.dbl
45
+ - lib/pictures/scrollbar_active.dbl
46
+ - lib/pictures/scrollbar_inactive.dbl
47
+ - lib/pictures/backgroundH.dbl
48
+ - lib/pictures/backgroundH_gap.dbl
49
+ - lib/pictures/backgroundH_gap2.dbl
50
+ - lib/pictures/backgroundV.dbl
51
+ - lib/pictures/backgroundV_gap.dbl
52
+ - lib/pictures/backgroundV_gap2.dbl
53
+ test_files: []
54
+
55
+ rdoc_options: []
56
+
57
+ extra_rdoc_files: []
58
+
59
+ executables: []
60
+
61
+ extensions: []
62
+
63
+ requirements: []
64
+
65
+ dependencies: []
66
+