exerb 6.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/ChangeLog.ja.rd +305 -0
- data/README.en.txt +12 -0
- data/README.ja.html +143 -0
- data/README.ja.txt +6 -0
- data/README.md +50 -0
- data/Rakefile +205 -0
- data/bin/exerb +185 -0
- data/bin/mkexy +47 -0
- data/doc/LGPL +513 -0
- data/doc/class.ja.html +92 -0
- data/doc/command.ja.html +109 -0
- data/doc/core.ja.html +72 -0
- data/doc/example.ja.html +89 -0
- data/doc/faq.ja.html +59 -0
- data/doc/inside.ja.rd +404 -0
- data/doc/license.ja.html +62 -0
- data/doc/logo.gif +0 -0
- data/doc/misc.ja.html +72 -0
- data/doc/navi.gif +0 -0
- data/doc/recipe.ja.html +317 -0
- data/doc/style.css +187 -0
- data/doc/tutorial.ja.html +182 -0
- data/example/Makefile +54 -0
- data/example/cat_n.rb +14 -0
- data/example/exception.rb +9 -0
- data/example/ext/Win32API.so +0 -0
- data/example/ext/swin.so +0 -0
- data/example/msgbox.rb +14 -0
- data/example/rubytk.rb +22 -0
- data/example/runtime.ico +0 -0
- data/example/runtime.rb +19 -0
- data/example/vr/clipboard.rb +106 -0
- data/example/vr/compat/rubycompat.rb +18 -0
- data/example/vr/compat/vrcomctl.rb +12 -0
- data/example/vr/compat/vrcontrol.rb +50 -0
- data/example/vr/compat/vrmmedia.rb +24 -0
- data/example/vr/contrib/inifile.rb +116 -0
- data/example/vr/contrib/msgboxconst.rb +55 -0
- data/example/vr/contrib/toolbar.rb +371 -0
- data/example/vr/contrib/vrctlcolor.rb +110 -0
- data/example/vr/contrib/vrhotkey.rb +35 -0
- data/example/vr/contrib/vrlistviewex.rb +71 -0
- data/example/vr/contrib/vrstdscrollbar.rb +414 -0
- data/example/vr/contrib/vrwincomponent.rb +54 -0
- data/example/vr/dragdropformat.rb +209 -0
- data/example/vr/rscutil.rb +168 -0
- data/example/vr/sysmod.rb +249 -0
- data/example/vr/vractivex.rb +56 -0
- data/example/vr/vrclipboard.rb +53 -0
- data/example/vr/vrcomctl.rb +1819 -0
- data/example/vr/vrcontrol.rb +1374 -0
- data/example/vr/vrdde.rb +623 -0
- data/example/vr/vrddrop.rb +190 -0
- data/example/vr/vrdialog.rb +406 -0
- data/example/vr/vrhandler.rb +195 -0
- data/example/vr/vrlayout.old.rb +209 -0
- data/example/vr/vrlayout.rb +173 -0
- data/example/vr/vrlayout2.rb +340 -0
- data/example/vr/vrmargin.rb +141 -0
- data/example/vr/vrmgdlayout.rb +381 -0
- data/example/vr/vrmmedia.rb +287 -0
- data/example/vr/vrolednd.rb +192 -0
- data/example/vr/vrowndraw.rb +108 -0
- data/example/vr/vrrichedit.rb +366 -0
- data/example/vr/vrtimer.rb +148 -0
- data/example/vr/vrtooltip.rb +273 -0
- data/example/vr/vrtray.rb +143 -0
- data/example/vr/vrtvitem.rb +118 -0
- data/example/vr/vrtwopane.rb +223 -0
- data/example/vr/vruby.rb +1051 -0
- data/example/vr/winconst.rb +158 -0
- data/example/vruby.rb +38 -0
- data/exerb.gemspec +26 -0
- data/extconf.rb +7 -0
- data/lib/exerb/archive.rb +143 -0
- data/lib/exerb/config.rb +51 -0
- data/lib/exerb/error.rb +15 -0
- data/lib/exerb/executable.rb +68 -0
- data/lib/exerb/file_table.rb +189 -0
- data/lib/exerb/mkexy.rb +81 -0
- data/lib/exerb/name_table.rb +120 -0
- data/lib/exerb/recipe.rb +465 -0
- data/lib/exerb/resource.rb +190 -0
- data/lib/exerb/resource/base.rb +29 -0
- data/lib/exerb/resource/binary.rb +31 -0
- data/lib/exerb/resource/dialog.rb +30 -0
- data/lib/exerb/resource/group_icon.rb +85 -0
- data/lib/exerb/resource/icon.rb +52 -0
- data/lib/exerb/resource/version_info.rb +155 -0
- data/lib/exerb/resource_library.rb +120 -0
- data/lib/exerb/utility.rb +95 -0
- data/lib/exerb/utility2.rb +122 -0
- data/lib/exerb/version.rb +13 -0
- data/lib/exerb/win32/const/resource.rb +51 -0
- data/lib/exerb/win32/icon_file.rb +78 -0
- data/lib/exerb/win32/pe_file.rb +59 -0
- data/lib/exerb/win32/resource_directory.rb +105 -0
- data/lib/exerb/win32/resource_directory_root.rb +67 -0
- data/lib/exerb/win32/resource_entry.rb +98 -0
- data/lib/exerb/win32/struct/base.rb +43 -0
- data/lib/exerb/win32/struct/icon_dir_entry.rb +83 -0
- data/lib/exerb/win32/struct/icon_header.rb +43 -0
- data/lib/exerb/win32/struct/icon_res_entry.rb +48 -0
- data/lib/exerb/win32/struct/image_dos_header.rb +73 -0
- data/lib/exerb/win32/struct/image_file_header.rb +47 -0
- data/lib/exerb/win32/struct/image_nt_headers32.rb +53 -0
- data/lib/exerb/win32/struct/image_optional_header32.rb +107 -0
- data/lib/exerb/win32/struct/image_resource_data_entry.rb +45 -0
- data/lib/exerb/win32/struct/image_resource_directory.rb +47 -0
- data/lib/exerb/win32/struct/image_resource_directory_entry.rb +72 -0
- data/lib/exerb/win32/struct/image_section_header.rb +53 -0
- data/lib/exerb/win32/struct/version_info_block.rb +75 -0
- data/lib/exerb/win32/struct/vs_fixed_file_info.rb +62 -0
- data/src/exerb/cui.c +48 -0
- data/src/exerb/default.rb +1 -0
- data/src/exerb/exerb.c +877 -0
- data/src/exerb/exerb.h +92 -0
- data/src/exerb/gui.c +176 -0
- data/src/exerb/module.c +138 -0
- data/src/exerb/module.h +7 -0
- data/src/exerb/patch.c +27 -0
- data/src/exerb/resource.h +22 -0
- data/src/exerb/resource.rc +121 -0
- data/src/exerb/ruby.ico +0 -0
- data/src/exerb/utility.c +263 -0
- data/src/exerb/utility.h +33 -0
- data/test/alltests.rb +16 -0
- data/test/test-argv.rb +26 -0
- data/test/test-argv/test-argv.rb +9 -0
- data/test/test-argv/test-argv.ret +1 -0
- data/test/test-dollarzero.rb +26 -0
- data/test/test-dollarzero/test-dollarzero.rb +10 -0
- data/test/test-dollarzero/test-dollarzero.ret +2 -0
- data/test/test-dot.rb +26 -0
- data/test/test-dot/dot.dot.dot.rb +9 -0
- data/test/test-dot/dot.dot.rb +9 -0
- data/test/test-dot/test-dot.rb +13 -0
- data/test/test-dot/test-dot.ret +5 -0
- data/test/test-exitcode.rb +28 -0
- data/test/test-exitcode/test-exitcode.rb +9 -0
- data/test/test-kcode.rb +43 -0
- data/test/test-kcode/euc.rb +10 -0
- data/test/test-kcode/euc.ret +2 -0
- data/test/test-kcode/none.rb +10 -0
- data/test/test-kcode/none.ret +2 -0
- data/test/test-kcode/sjis.rb +10 -0
- data/test/test-kcode/sjis.ret +2 -0
- data/test/test-kcode/utf8.rb +10 -0
- data/test/test-kcode/utf8.ret +2 -0
- data/test/test-loadpath.rb +24 -0
- data/test/test-loadpath/test-loadpath.rb +9 -0
- data/test/test-nest.rb +18 -0
- data/test/test-nest/foo.rb +1 -0
- data/test/test-nest/foo/bar.rb +2 -0
- data/test/test-nest/foo/foo.rb +1 -0
- data/test/test-nest/test-nest.rb +1 -0
- data/test/test-nest/test-nest.ret +1 -0
- data/test/test-preload.rb +24 -0
- data/test/test-preload/test-preload.rb +9 -0
- data/test/test-regexp.rb +26 -0
- data/test/test-regexp/test-regexp.rb +23 -0
- data/test/test-regexp/test-regexp.ret +13 -0
- data/test/test-require1.rb +26 -0
- data/test/test-require1/require1.rb +9 -0
- data/test/test-require1/require2.rb +9 -0
- data/test/test-require1/require3.rb +9 -0
- data/test/test-require1/require4.rb +9 -0
- data/test/test-require1/require5.rb +9 -0
- data/test/test-require1/require6.rb +9 -0
- data/test/test-require1/test-require1.rb +41 -0
- data/test/test-require1/test-require1.ret +27 -0
- data/test/test-socket.rb +26 -0
- data/test/test-socket/test-socket.rb +7 -0
- data/test/test-socket/test-socket.ret +1 -0
- data/test/testcase.rb +66 -0
- data/vendor/mkexports.rb +167 -0
- metadata +352 -0
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
###################################
|
|
2
|
+
#
|
|
3
|
+
# vrmgdlayout.rb
|
|
4
|
+
#
|
|
5
|
+
# Programmed by yukimi_sake <yukimi_sake@mbi.nifty.com>
|
|
6
|
+
# Copyright 2003-2004 Yukio Sakaue
|
|
7
|
+
#
|
|
8
|
+
###################################
|
|
9
|
+
|
|
10
|
+
require 'vr/vrmargin'
|
|
11
|
+
require 'vr/vrlayout2'
|
|
12
|
+
|
|
13
|
+
module VRMarginedFrameUseable
|
|
14
|
+
=begin
|
|
15
|
+
== VRMarginedFrameUseable
|
|
16
|
+
This is a extension of VRParent for enable to use WM_SIZE message handler.
|
|
17
|
+
=== Extended methods
|
|
18
|
+
--- setMarginedFrame(class,*args)
|
|
19
|
+
Register class on VRParent and setups WM_SIZE message handler.
|
|
20
|
+
=end
|
|
21
|
+
|
|
22
|
+
include VRMessageHandler
|
|
23
|
+
def vrinit
|
|
24
|
+
super
|
|
25
|
+
vrmarginedframe_init
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def vrmarginedframe_init
|
|
29
|
+
addHandler(WMsg::WM_SIZE, "vrmgresize", MSGTYPE::ARGLINTINT,nil)
|
|
30
|
+
acceptEvents [WMsg::WM_SIZE]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def setMarginedFrame(klass,*args)
|
|
34
|
+
raise "Only one margined frame can set this window." if
|
|
35
|
+
@__regsterd_vr_margined_frame
|
|
36
|
+
if klass <= VRTwoPaneFrame
|
|
37
|
+
@__regsterd_vr_margined_frame=klass.new(args[0],args[1]).setup(self)
|
|
38
|
+
elsif klass <= VRGridLayoutFrame
|
|
39
|
+
@__regsterd_vr_margined_frame=klass.new(args[0],args[1])
|
|
40
|
+
else
|
|
41
|
+
@__regsterd_vr_margined_frame=klass.new
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.self_vrmgresize(w,h)
|
|
45
|
+
@__regsterd_vr_margined_frame.move(0,0,w,h) if
|
|
46
|
+
@__regsterd_vr_margined_frame
|
|
47
|
+
end
|
|
48
|
+
sendMessage(WMsg::WM_SIZE, 0, MAKELPARAM(self.w, self.h))
|
|
49
|
+
@__regsterd_vr_margined_frame
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
module VRMgdLayoutFrame
|
|
53
|
+
=begin
|
|
54
|
+
== VRMgdLayoutFrame
|
|
55
|
+
This is the extension of VRLayoutFrame.
|
|
56
|
+
All classes are extended VRMargin which enables client's spacing.
|
|
57
|
+
And following methods are available.
|
|
58
|
+
=== Extended method of instance
|
|
59
|
+
--- VRGridLayoutFrame#register(*cntl)
|
|
60
|
+
Allowd Arrays as arguments
|
|
61
|
+
--- VRMgdFullsizeLayoutFrame#_vr_relayout
|
|
62
|
+
Redefined for that all clients are received same 'move(x,y,w,h)' method.
|
|
63
|
+
=end
|
|
64
|
+
|
|
65
|
+
include VRMargin
|
|
66
|
+
def initialize()
|
|
67
|
+
self.initMargin(0,0,0,0)
|
|
68
|
+
@_vr_layoutclients=[]
|
|
69
|
+
@_vr_lx,@_vr_ly,@_vr_lw,@_vr_lh = 0,0,10,10
|
|
70
|
+
end
|
|
71
|
+
def register(*cntl)
|
|
72
|
+
@_vr_layoutclients.concat(cntl.flatten.map{|i|
|
|
73
|
+
i.extend(VRMargin).initMargin(0,0,0,0)})
|
|
74
|
+
_vr_relayout
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
class VRMgdVertLayoutFrame < VRVertLayoutFrame
|
|
79
|
+
include VRMgdLayoutFrame
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class VRMgdHorizLayoutFrame < VRHorizLayoutFrame
|
|
83
|
+
include VRMgdLayoutFrame
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
class VRMgdFullsizeLayoutFrame < VRFullsizeLayoutFrame
|
|
87
|
+
include VRMgdLayoutFrame
|
|
88
|
+
def _vr_relayout
|
|
89
|
+
return if @_vr_layoutclients.size==0
|
|
90
|
+
@_vr_layoutclients.each_index do |i|
|
|
91
|
+
@_vr_layoutclients[i].move @_vr_lx, @_vr_ly,@_vr_lw,@_vr_lh
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
class VRMgdGridLayoutFrame < VRGridLayoutFrame
|
|
97
|
+
include VRMargin
|
|
98
|
+
def initialize(xs,ys)
|
|
99
|
+
self.initMargin(0,0,0,0)
|
|
100
|
+
super
|
|
101
|
+
end
|
|
102
|
+
def register(*cntl)
|
|
103
|
+
if cntl[0].is_a? Array
|
|
104
|
+
cntl.each{|i| i[0].extend(VRMargin).initMargin(0,0,0,0); super(*i)}
|
|
105
|
+
else
|
|
106
|
+
cntl[0].extend(VRMargin).initMargin(0,0,0,0)
|
|
107
|
+
super
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
module VRMgdTwoPaneFrame
|
|
113
|
+
=begin
|
|
114
|
+
== VRMgdTwoPaneFrame
|
|
115
|
+
This is the extension of VRPaneFrame.
|
|
116
|
+
All classes are extended VRMargin which enables client's spacing.
|
|
117
|
+
And extended class has following methods and constants.
|
|
118
|
+
|
|
119
|
+
=== Extended methods
|
|
120
|
+
---position
|
|
121
|
+
---position=
|
|
122
|
+
Position of splitter.
|
|
123
|
+
If it is a positive integer, it means the distance from the left or top edge.
|
|
124
|
+
If negative, it calculates opposite side.
|
|
125
|
+
If this value sets, 'ratio' will be reseted.
|
|
126
|
+
'ratio' and 'position' are exclusive each other.
|
|
127
|
+
===R/W attributes
|
|
128
|
+
---bevel
|
|
129
|
+
It is the form of the edge of a gap.You can draw it like below.
|
|
130
|
+
bevel=[[0x000000,0xffffff],[0xffffff,0x000000]]
|
|
131
|
+
First one is left/top feature,other is right/botm.
|
|
132
|
+
Drawn line in an order from an outside.
|
|
133
|
+
or
|
|
134
|
+
bevel=VRSplitter::BevelGroove1
|
|
135
|
+
see below constants.
|
|
136
|
+
---gap
|
|
137
|
+
space between panes.
|
|
138
|
+
===Class constants
|
|
139
|
+
---BevelNone
|
|
140
|
+
---BevelGroove1
|
|
141
|
+
---BevelGroove2
|
|
142
|
+
---BevelRaise1
|
|
143
|
+
---BevelRaise2
|
|
144
|
+
---BevelSunken1
|
|
145
|
+
---BevelSunken2
|
|
146
|
+
=end
|
|
147
|
+
include VRMargin
|
|
148
|
+
|
|
149
|
+
BevelNone = [[],[]]
|
|
150
|
+
BevelGroove1 = [[0x666666,0xffffff],[0xffffff,0x666666]]
|
|
151
|
+
BevelGroove2 = [[0x666666,0xffffff,0x666666,0xffffff],
|
|
152
|
+
[0xffffff,0x666666,0xffffff,0x666666]]
|
|
153
|
+
BevelRaise1 = [[0xffffff],[0x666666]]
|
|
154
|
+
BevelRaise2 = [[0xffffff,0xffffff],[0x666666,0x666666]]
|
|
155
|
+
BevelSunken1 = [[0x666666],[0xffffff]]
|
|
156
|
+
BevelSunken2 = [[0x666666,0x666666],[0xffffff,0xffffff]]
|
|
157
|
+
|
|
158
|
+
attr :ratio
|
|
159
|
+
attr :bevel
|
|
160
|
+
attr :position
|
|
161
|
+
|
|
162
|
+
module VRTwoPaneFrame::VRTwoPaneFrameUsable
|
|
163
|
+
def _vr_twopaneframesinit
|
|
164
|
+
return if defined?(@_vr_twopaneframes) # no init twice
|
|
165
|
+
@_vr_twopaneframes = Array.new
|
|
166
|
+
@_vr_current_tpframe=nil
|
|
167
|
+
addHandler(
|
|
168
|
+
WMsg::WM_LBUTTONUP, "vrsepl2buttonup", MSGTYPE::ARGINTSINTSINT,nil)
|
|
169
|
+
addHandler(
|
|
170
|
+
WMsg::WM_LBUTTONDOWN,"vrsepl2buttondown",MSGTYPE::ARGINTSINTSINT,nil)
|
|
171
|
+
addHandler(
|
|
172
|
+
WMsg::WM_MOUSEMOVE, "vrsepl2mousemove", MSGTYPE::ARGINTSINTSINT,nil)
|
|
173
|
+
addHandler(WMsg::WM_PAINT, "vrsepl2paint", MSGTYPE::ARGNONE,nil)
|
|
174
|
+
|
|
175
|
+
acceptEvents [
|
|
176
|
+
WMsg::WM_LBUTTONUP,WMsg::WM_LBUTTONDOWN,WMsg::WM_MOUSEMOVE,
|
|
177
|
+
WMsg::WM_PAINT]
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def self_vrsepl2paint
|
|
181
|
+
@_vr_twopaneframes.each do |f|
|
|
182
|
+
f._vr_draw_bevel(self)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def initialize(pane1,pane2)
|
|
189
|
+
def set_margin_to_panes(pn)
|
|
190
|
+
if pn.is_a? Array
|
|
191
|
+
pn.each{|i| i.extend(VRMargin).initMargin(0,0,0,0)}
|
|
192
|
+
elsif pn
|
|
193
|
+
pn.extend(VRMargin).initMargin(0,0,0,0)
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
super
|
|
197
|
+
self.initMargin(0,0,0,0)
|
|
198
|
+
set_margin_to_panes(@pane1)
|
|
199
|
+
set_margin_to_panes(@pane2)
|
|
200
|
+
@bevel=BevelNone
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def position=(pos)
|
|
204
|
+
return unless pos.is_a?(Integer)
|
|
205
|
+
@position=pos
|
|
206
|
+
@ratio=nil
|
|
207
|
+
self._vr_relayout if @_vr_lw && @_vr_lh
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def ratio=(r)
|
|
211
|
+
return unless r.is_a?(Float) && ((0.0 <= r) && (r <= 1.0))
|
|
212
|
+
@ratio=r
|
|
213
|
+
@position=nil
|
|
214
|
+
self._vr_relayout if @_vr_lw && @_vr_lh
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def bevel=(b)
|
|
218
|
+
@bevel=b
|
|
219
|
+
self._vr_relayout if @_vr_lw && @_vr_lh
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def gap(); @separatorheight; end
|
|
223
|
+
def gap=(h)
|
|
224
|
+
@separatorheight=h
|
|
225
|
+
self._vr_relayout if @_vr_lw && @_vr_lh
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
class VRMgdVertTwoPaneFrame < VRVertTwoPaneFrame
|
|
230
|
+
include VRMgdTwoPaneFrame
|
|
231
|
+
attr :uLimit,1
|
|
232
|
+
attr :lLimit,1
|
|
233
|
+
def initialize(p1,p2)
|
|
234
|
+
super
|
|
235
|
+
@uLimit = 0; @lLimit = 0
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def splitterDragging(x,y)
|
|
239
|
+
return if y<@separatorheight+@_vr_ly+@uLimit or
|
|
240
|
+
y>@_vr_ly+@_vr_lh-@separatorheight-@lLimit
|
|
241
|
+
if @ratio then
|
|
242
|
+
@ratio=(y-@_vr_ly).to_f/@_vr_lh
|
|
243
|
+
elsif @position < 0
|
|
244
|
+
@position = y - @_vr_lh - @_vr_ly
|
|
245
|
+
else
|
|
246
|
+
@position = y - @_vr_ly
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
case(splitter_operation_type)
|
|
250
|
+
when SPLITTER_MOVEWINDOW
|
|
251
|
+
_vr_relayout(y-@_vr_ly)
|
|
252
|
+
when SPLITTER_DRAWLINE
|
|
253
|
+
w = window_parent
|
|
254
|
+
w.dopaint do |hdc|
|
|
255
|
+
w.setBrush(RGB(0x255,0x255,0x255))
|
|
256
|
+
if @_vr_splitter_last then
|
|
257
|
+
VRTwoPaneFrame::PatBlt.call(hdc,*@_vr_splitter_last)
|
|
258
|
+
end
|
|
259
|
+
current=[@_vr_lx,y,@_vr_lw,@separatorheight,0x5a0049] # PATINVERT
|
|
260
|
+
VRTwoPaneFrame::PatBlt.call(hdc,*current)
|
|
261
|
+
@_vr_splitter_last = current
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
def _vr_relayout(ys =
|
|
267
|
+
if @ratio then (@_vr_lh*@ratio).to_i
|
|
268
|
+
elsif @position < 0
|
|
269
|
+
@_vr_lh + @position
|
|
270
|
+
else
|
|
271
|
+
@position
|
|
272
|
+
end )
|
|
273
|
+
sh=(@separatorheight/2).to_i
|
|
274
|
+
@_vr_lxs,@_vr_lxe = @_vr_lx,@_vr_lx+@_vr_lw
|
|
275
|
+
@_vr_lys,@_vr_lye = @_vr_ly+ys-sh,@_vr_ly+ys+sh
|
|
276
|
+
if @pane1.is_a? Array
|
|
277
|
+
@pane1.each{|i| i.move(@_vr_lx,@_vr_ly,@_vr_lw,ys-sh)}
|
|
278
|
+
elsif @pane1
|
|
279
|
+
@pane1.move(@_vr_lx,@_vr_ly,@_vr_lw,ys-sh)
|
|
280
|
+
end
|
|
281
|
+
if @pane2.is_a? Array
|
|
282
|
+
@pane2.each{|i| i.move(@_vr_lx,@_vr_lys+@separatorheight, @_vr_lw,
|
|
283
|
+
@_vr_lh-ys-sh)}
|
|
284
|
+
elsif @pane2
|
|
285
|
+
@pane2.move(@_vr_lx,@_vr_lys+@separatorheight, @_vr_lw,@_vr_lh-ys-sh)
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def _vr_draw_bevel(win)
|
|
290
|
+
return unless @_vr_lxs
|
|
291
|
+
win.dopaint do
|
|
292
|
+
@bevel[0].each_with_index{|cl,idx|
|
|
293
|
+
win.setPen(@bevel[0][idx],1)
|
|
294
|
+
win.grMoveTo(@_vr_lxs+idx,@_vr_lye-idx-1)
|
|
295
|
+
win.grLineTo(@_vr_lxs+idx,@_vr_lys+idx)
|
|
296
|
+
win.grLineTo(@_vr_lxe-idx,@_vr_lys+idx)
|
|
297
|
+
win.setPen(@bevel[1][idx],1)
|
|
298
|
+
win.grMoveTo(@_vr_lxe-idx-1,@_vr_lys+idx)
|
|
299
|
+
win.grLineTo(@_vr_lxe-idx-1,@_vr_lye-idx-1)
|
|
300
|
+
win.grLineTo(@_vr_lxs+idx,@_vr_lye-idx-1)
|
|
301
|
+
}
|
|
302
|
+
end
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
class VRMgdHorizTwoPaneFrame < VRHorizTwoPaneFrame
|
|
307
|
+
include VRMgdTwoPaneFrame
|
|
308
|
+
attr :rLimit,1
|
|
309
|
+
attr :lLimit,1
|
|
310
|
+
def initialize(p1,p2)
|
|
311
|
+
super
|
|
312
|
+
@rLimit = 0; @lLimit = 0
|
|
313
|
+
end
|
|
314
|
+
def splitterDragging(x,y)
|
|
315
|
+
return if x<@separatorheight+@_vr_lx+@lLimit or
|
|
316
|
+
x>@_vr_lx+@_vr_lw-@separatorheight-@rLimit
|
|
317
|
+
if @ratio then
|
|
318
|
+
@ratio=(x-@_vr_lx).to_f/@_vr_lw
|
|
319
|
+
elsif @position < 0
|
|
320
|
+
@position = x - @_vr_lw - @_vr_lx
|
|
321
|
+
else
|
|
322
|
+
@position = x - @_vr_lx
|
|
323
|
+
end
|
|
324
|
+
case splitter_operation_type
|
|
325
|
+
when SPLITTER_MOVEWINDOW
|
|
326
|
+
_vr_relayout(x-@_vr_lx)
|
|
327
|
+
when SPLITTER_DRAWLINE
|
|
328
|
+
w = window_parent
|
|
329
|
+
w.dopaint do |hdc|
|
|
330
|
+
w.setBrush(RGB(0x255,0x255,0x255))
|
|
331
|
+
if @_vr_splitter_last then
|
|
332
|
+
VRTwoPaneFrame::PatBlt.call(hdc,*@_vr_splitter_last)
|
|
333
|
+
end
|
|
334
|
+
current=[x,@_vr_ly,@separatorheight,@_vr_lh,0x5a0049] # PATINVERT
|
|
335
|
+
VRTwoPaneFrame::PatBlt.call(hdc,*current)
|
|
336
|
+
@_vr_splitter_last = current
|
|
337
|
+
end
|
|
338
|
+
end
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
def _vr_relayout(xs =
|
|
342
|
+
if @ratio then (@_vr_lw*@ratio).to_i
|
|
343
|
+
elsif @position < 0
|
|
344
|
+
@_vr_lw + @position
|
|
345
|
+
else
|
|
346
|
+
@position
|
|
347
|
+
end)
|
|
348
|
+
sh=(@separatorheight/2).to_i
|
|
349
|
+
@_vr_lxs,@_vr_lxe = @_vr_lx+xs-sh,@_vr_lx+xs+sh
|
|
350
|
+
@_vr_lys,@_vr_lye = @_vr_ly,@_vr_ly+@_vr_lh
|
|
351
|
+
|
|
352
|
+
if @pane1.is_a? Array then
|
|
353
|
+
@pane1.each{|i| i.move(@_vr_lx,@_vr_ly,xs-sh,@_vr_lh)}
|
|
354
|
+
elsif @pane1
|
|
355
|
+
@pane1.move(@_vr_lx,@_vr_ly,xs-sh,@_vr_lh)
|
|
356
|
+
end
|
|
357
|
+
if @pane2.is_a? Array
|
|
358
|
+
@pane2.each{|i| i.move(@_vr_lxs+@separatorheight,@_vr_ly,
|
|
359
|
+
@_vr_lw-xs-sh, @_vr_lh)}
|
|
360
|
+
elsif @pane2
|
|
361
|
+
@pane2.move(@_vr_lxs+@separatorheight,@_vr_ly, @_vr_lw-xs-sh, @_vr_lh)
|
|
362
|
+
end
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
def _vr_draw_bevel(win)
|
|
366
|
+
return unless @_vr_lxs
|
|
367
|
+
win.dopaint do
|
|
368
|
+
@bevel[0].each_with_index{|cl,idx|
|
|
369
|
+
win.setPen(@bevel[0][idx],1)
|
|
370
|
+
win.grMoveTo(@_vr_lxe-idx-1,@_vr_lys+idx+1)
|
|
371
|
+
win.grLineTo(@_vr_lxs+idx,@_vr_lys+idx+1)
|
|
372
|
+
win.grLineTo(@_vr_lxs+idx,@_vr_lye-idx)
|
|
373
|
+
win.setPen(@bevel[1][idx],1)
|
|
374
|
+
win.grMoveTo(@_vr_lxs+idx,@_vr_ly+@_vr_lh-idx-1)
|
|
375
|
+
win.grLineTo(@_vr_lxe-idx-1,@_vr_lye-idx-1)
|
|
376
|
+
win.grLineTo(@_vr_lxe-idx-1,@_vr_lys+idx)
|
|
377
|
+
}
|
|
378
|
+
end
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
end
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
###################################
|
|
2
|
+
#
|
|
3
|
+
# vrmmedia.rb
|
|
4
|
+
# Programmed by nyasu <nyasu@osk.3web.ne.jp>
|
|
5
|
+
# Copyright 1999-2005 Nishikawa,Yasuhiro
|
|
6
|
+
#
|
|
7
|
+
# More information at http://vruby.sourceforge.net/index.html
|
|
8
|
+
#
|
|
9
|
+
# Good Reference: vfw.h
|
|
10
|
+
#
|
|
11
|
+
###################################
|
|
12
|
+
|
|
13
|
+
VR_DIR="vr/" unless defined?(::VR_DIR)
|
|
14
|
+
require VR_DIR+'vrcontrol'
|
|
15
|
+
require 'Win32API'
|
|
16
|
+
|
|
17
|
+
=begin
|
|
18
|
+
= VisualuRuby(tmp) modules for MCI
|
|
19
|
+
=end
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
#if RUBY_VERSION<"1.4.4" then # Quick Hacking..
|
|
23
|
+
# require 'DLLManager'
|
|
24
|
+
# DLLManager.load("msvfw32.dll")
|
|
25
|
+
#end
|
|
26
|
+
|
|
27
|
+
MCIWndRegisterClass = Win32API.new("msvfw32","MCIWndRegisterClass",[],"I")
|
|
28
|
+
MCIWndRegisterClass.call
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
module VRMediaViewContainer
|
|
32
|
+
=begin
|
|
33
|
+
== VRMediaViewContainer
|
|
34
|
+
This module provides a message handler for MCI messages.
|
|
35
|
+
VRForm includes this module automatically loading "vrmmedia.rb".
|
|
36
|
+
=end
|
|
37
|
+
include VRMessageHandler
|
|
38
|
+
|
|
39
|
+
def vrinit
|
|
40
|
+
super
|
|
41
|
+
mediaviewcontainerinit
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def mediaviewcontainerinit
|
|
45
|
+
addHandler(VRMediaView::MCIWNDM_NOTIFYMODE,
|
|
46
|
+
"mmnotifies",MSGTYPE::ARGPASS,nil)
|
|
47
|
+
addHandler(VRMediaView::MCIWNDM_NOTIFYERROR,
|
|
48
|
+
"mmnotifies",MSGTYPE::ARGPASS,nil)
|
|
49
|
+
addHandler(VRMediaView::MCIWNDM_NOTIFYSIZE,
|
|
50
|
+
"mmnotifies",MSGTYPE::ARGPASS,nil)
|
|
51
|
+
addHandler(VRMediaView::MCIWNDM_NOTIFYMEDIA,
|
|
52
|
+
"mmnotifies",MSGTYPE::ARGPASS,nil)
|
|
53
|
+
acceptEvents [ VRMediaView::MCIWNDM_NOTIFYMODE,
|
|
54
|
+
VRMediaView::MCIWNDM_NOTIFYSIZE,
|
|
55
|
+
VRMediaView::MCIWNDM_NOTIFYMEDIA,
|
|
56
|
+
VRMediaView::MCIWNDM_NOTIFYERROR ]
|
|
57
|
+
|
|
58
|
+
addNoRelayMessages [ VRMediaView::MCIWNDM_NOTIFYMODE,
|
|
59
|
+
VRMediaView::MCIWNDM_NOTIFYSIZE,
|
|
60
|
+
VRMediaView::MCIWNDM_NOTIFYMEDIA,
|
|
61
|
+
VRMediaView::MCIWNDM_NOTIFYERROR ]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def self_mmnotifies(msg)
|
|
65
|
+
ct=@_vr_mediaviewers_hwnd[msg.wParam]
|
|
66
|
+
return unless ct
|
|
67
|
+
messageid=msg.msg
|
|
68
|
+
|
|
69
|
+
return unless ct._vr_mmhandlers and ct._vr_mmhandlers[messageid]
|
|
70
|
+
|
|
71
|
+
ct._vr_mmhandlers[messageid].each do |shandler|
|
|
72
|
+
args=msgarg2handlerarg(shandler[1],msg,shandler[2])
|
|
73
|
+
ct.__send__(shandler[0],*args) if ct.respond_to?(shandler[0])
|
|
74
|
+
msg.retval = controlmsg_dispatching(ct,shandler[0],*args)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def addControl(*args)
|
|
79
|
+
@_vr_mediaviewers_hwnd={} unless defined?(@_vr_mediaviewers_hwnd)
|
|
80
|
+
a=super
|
|
81
|
+
@_vr_mediaviewers_hwnd[a.hWnd]=a if a.is_a?(VRMediaView)
|
|
82
|
+
return a
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
module VRContainersSet
|
|
87
|
+
include VRMediaViewContainer
|
|
88
|
+
INITIALIZERS.push :mediaviewcontainerinit
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
#####
|
|
93
|
+
|
|
94
|
+
module VRMediaViewModeNotifier
|
|
95
|
+
include VRMediaViewContainer
|
|
96
|
+
|
|
97
|
+
=begin
|
|
98
|
+
== VRMediaViewModeNotifier
|
|
99
|
+
This module is to use another event handlers for mci.
|
|
100
|
+
These new handlers are not relayed to parent by VRMessageParentRelayer.
|
|
101
|
+
(Use setnotifier() as setnotifier("cname1_cname2))
|
|
102
|
+
|
|
103
|
+
=== Methods
|
|
104
|
+
--- setnotifier(cname)
|
|
105
|
+
This enables ((<VRMediaView>))'s other event handlers such as cname_stopped,
|
|
106
|
+
cname_playing,cname_paused and cname_open, named after
|
|
107
|
+
((<VRMediaView>))#modestring.
|
|
108
|
+
=end
|
|
109
|
+
|
|
110
|
+
def setnotifier(cname)
|
|
111
|
+
instance_eval(
|
|
112
|
+
"def "+cname+"_modechanged(n)\n" +
|
|
113
|
+
" fname='#{cname}_'+@#{cname}.modestring(n) \n" +
|
|
114
|
+
" __send__(fname) if respond_to?(fname) \n" +
|
|
115
|
+
"end\n"
|
|
116
|
+
)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class VRMediaView < VRControl
|
|
122
|
+
=begin
|
|
123
|
+
== VRMediaView
|
|
124
|
+
This is a control window to play multimedia files.
|
|
125
|
+
|
|
126
|
+
=== Methods
|
|
127
|
+
--- mediaopen(filename,flag=0)
|
|
128
|
+
Open mediafile as filename.
|
|
129
|
+
--- mediaclose
|
|
130
|
+
Close mediafile.
|
|
131
|
+
--- mode
|
|
132
|
+
Return current mode number.
|
|
133
|
+
--- modestring(n)
|
|
134
|
+
Return description for mode number #n
|
|
135
|
+
--- errorstring
|
|
136
|
+
Return error description
|
|
137
|
+
--- play
|
|
138
|
+
--- pause
|
|
139
|
+
--- stop
|
|
140
|
+
--- eject
|
|
141
|
+
--- step(n=1)
|
|
142
|
+
--- seek(pos)
|
|
143
|
+
--- seekHome
|
|
144
|
+
--- seekEnd
|
|
145
|
+
--- playable?
|
|
146
|
+
--- ejectable?
|
|
147
|
+
--- window?
|
|
148
|
+
--- length
|
|
149
|
+
--- position
|
|
150
|
+
--- volume
|
|
151
|
+
--- volume=(vl)
|
|
152
|
+
--- speed
|
|
153
|
+
--- speed=
|
|
154
|
+
--- zoom
|
|
155
|
+
--- zoom=
|
|
156
|
+
|
|
157
|
+
=== Event Handlers
|
|
158
|
+
--- ????_onerror()
|
|
159
|
+
--- ????_modechanged(newmode)
|
|
160
|
+
--- ????_sizechanged()
|
|
161
|
+
--- ????_mediachanged(str)
|
|
162
|
+
=end
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
attr :_vr_mmhandlers
|
|
166
|
+
|
|
167
|
+
MCI_CLOSE = 0x0804
|
|
168
|
+
MCI_PLAY = 0x0806
|
|
169
|
+
MCI_SEEK = 0x0807
|
|
170
|
+
MCI_STOP = 0x0808
|
|
171
|
+
MCI_PAUSE = 0x0809
|
|
172
|
+
MCI_STEP = 0x080E
|
|
173
|
+
|
|
174
|
+
MCIWNDM_GETPOSITION = (WMsg::WM_USER + 102) # A message
|
|
175
|
+
MCIWNDM_GETLENGTH = (WMsg::WM_USER + 104)
|
|
176
|
+
MCIWNDM_GETMODE = (WMsg::WM_USER + 106) # A message
|
|
177
|
+
MCIWNDM_EJECT = (WMsg::WM_USER + 107)
|
|
178
|
+
MCIWNDM_SETZOOM = (WMsg::WM_USER + 108)
|
|
179
|
+
MCIWNDM_GETZOOM = (WMsg::WM_USER + 109)
|
|
180
|
+
MCIWNDM_SETVOLUME = (WMsg::WM_USER + 110)
|
|
181
|
+
MCIWNDM_GETVOLUME = (WMsg::WM_USER + 111)
|
|
182
|
+
MCIWNDM_SETSPEED = (WMsg::WM_USER + 112)
|
|
183
|
+
MCIWNDM_GETSPEED = (WMsg::WM_USER + 113)
|
|
184
|
+
|
|
185
|
+
MCIWNDM_GETERROR = (WMsg::WM_USER + 128) # A message
|
|
186
|
+
|
|
187
|
+
MCIWNDM_CAN_PLAY = (WMsg::WM_USER + 144)
|
|
188
|
+
MCIWNDM_CAN_WINDOW = (WMsg::WM_USER + 145)
|
|
189
|
+
MCIWNDM_CAN_EJECT = (WMsg::WM_USER + 148)
|
|
190
|
+
MCIWNDM_CAN_CONFIG = (WMsg::WM_USER + 149)
|
|
191
|
+
MCIWNDM_SETOWNER = (WMsg::WM_USER + 152)
|
|
192
|
+
MCIWNDM_OPEN = (WMsg::WM_USER + 153) # A message
|
|
193
|
+
|
|
194
|
+
MCIWNDM_NOTIFYMODE = (WMsg::WM_USER + 200) # wparam = hwnd, lparam = mode
|
|
195
|
+
MCIWNDM_NOTIFYSIZE = (WMsg::WM_USER + 202) # wparam = hwnd
|
|
196
|
+
MCIWNDM_NOTIFYMEDIA = (WMsg::WM_USER + 203) # wparam = hwnd, lparam = fn
|
|
197
|
+
MCIWNDM_NOTIFYERROR = (WMsg::WM_USER + 205) # wparam = hwnd, lparam = error
|
|
198
|
+
|
|
199
|
+
MCIWNDF_NOPLAYBAR = 0x0002
|
|
200
|
+
MCIWNDF_NOAUTOSIZEMOVIE = 0x0004
|
|
201
|
+
MCIWNDF_NOMENU = 0x0008
|
|
202
|
+
|
|
203
|
+
MCIWNDF_SIMPLE = 0xe
|
|
204
|
+
|
|
205
|
+
WINCLASSINFO = ["MCIWndClass",0x5500 | 0x400 | 0x880 ]
|
|
206
|
+
#notify:mode,error,size,media
|
|
207
|
+
|
|
208
|
+
def addMMHandler(msg,handlername,handlertype,argparsestr)
|
|
209
|
+
@_vr_mmhandlers={} unless defined? @_vr_mmhandlers
|
|
210
|
+
@_vr_mmhandlers[msg]=[] unless @_vr_mmhandlers[msg]
|
|
211
|
+
@_vr_mmhandlers[msg].push [handlername,handlertype,argparsestr]
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def deleteMMHandler(msg,handlername)
|
|
215
|
+
return false unless defined?(@_vr_mmhandlers) and @_vr_mmhandlers[msg]
|
|
216
|
+
@_vr_mmhandlers.delete_if do |shandler|
|
|
217
|
+
shandler[0] != (PREHANDLERSTR+handlername).intern
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
def vrinit
|
|
222
|
+
super
|
|
223
|
+
addMMHandler(VRMediaView::MCIWNDM_NOTIFYERROR,"onerror",MSGTYPE::ARGINT,nil)
|
|
224
|
+
addMMHandler(VRMediaView::MCIWNDM_NOTIFYMODE,"modechanged",MSGTYPE::ARGINT,nil)
|
|
225
|
+
addMMHandler(VRMediaView::MCIWNDM_NOTIFYSIZE, "sizechanged",MSGTYPE::ARGNONE,nil)
|
|
226
|
+
addMMHandler(VRMediaView::MCIWNDM_NOTIFYMEDIA,"mediachanged",MSGTYPE::ARGSTRING,nil)
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
def mediaopen(filename,flag=0)
|
|
230
|
+
sendMessage MCIWNDM_OPEN,flag,filename
|
|
231
|
+
sendMessage MCIWNDM_SETOWNER,@parent.hWnd,0
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def play() sendMessage MCI_PLAY,0,0 end
|
|
235
|
+
def pause() sendMessage MCI_PAUSE,0,0 end
|
|
236
|
+
def stop() sendMessage MCI_STOP,0,0 end
|
|
237
|
+
def mediaclose() sendMessage MCI_CLOSE,0,0 end
|
|
238
|
+
def eject() sendMessage MCI_EJECT,0,0 end
|
|
239
|
+
def step(n=1) sendMessage MCI_STEP,0,n.to_i end
|
|
240
|
+
def seek(pos) sendMessage MCI_SEEK,0,pos.to_i end
|
|
241
|
+
def seekHome() sendMessage MCI_SEEK,0,-1 end
|
|
242
|
+
def seekEnd() sendMessage MCI_SEEK,0,-2 end
|
|
243
|
+
|
|
244
|
+
def playable?() sendMessage(MCIWNDM_CAN_PLAY,0,0)!=0 end
|
|
245
|
+
def ejectable?() sendMessage(MCIWNDM_CAN_EJECT,0,0)!=0 end
|
|
246
|
+
def window?() sendMessage(MCIWNDM_CAN_WINDOW,0,0)!=0 end
|
|
247
|
+
|
|
248
|
+
def length() sendMessage MCIWNDM_GETLENGTH,0,0 end
|
|
249
|
+
def position() sendMessage MCI_SEEK,0,0 end
|
|
250
|
+
|
|
251
|
+
def volume=(vl) sendMessage MCIWNDM_SETVOLUME,0,vl.to_i end
|
|
252
|
+
def volume() sendMessage MCIWNDM_GETVOLUME,0,0 end
|
|
253
|
+
def speed=(sp) sendMessage MCIWNDM_SETSPEED,0,sp.to_i end
|
|
254
|
+
def speed() sendMessage MCIWNDM_GETSPEED,0,0 end
|
|
255
|
+
def zoom=(zm) sendMessage MCIWNDM_SETZOOM,0,zm.to_i end
|
|
256
|
+
def zoom() sendMessage MCIWNDM_GETZOOM,0,0 end
|
|
257
|
+
|
|
258
|
+
def mode
|
|
259
|
+
p="\0 " #32bytes
|
|
260
|
+
sendMessage MCIWNDM_GETMODE,31,p
|
|
261
|
+
p
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
def modestring(n)
|
|
265
|
+
case n
|
|
266
|
+
when 524; "not_ready"
|
|
267
|
+
when 525; "stopped"
|
|
268
|
+
when 526; "playing"
|
|
269
|
+
when 527; "recording"
|
|
270
|
+
when 528; "seeking"
|
|
271
|
+
when 529; "paused"
|
|
272
|
+
when 530; "open"
|
|
273
|
+
else; "unknown_mode"
|
|
274
|
+
end
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
def errorstring
|
|
278
|
+
p="\0 "*8 #256bytes
|
|
279
|
+
sendMessage MCIWNDM_GETERROR,255,p
|
|
280
|
+
p
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
if VR_COMPATIBILITY_LEVEL then
|
|
286
|
+
require VR_DIR + 'compat/vrmmedia.rb'
|
|
287
|
+
end
|