1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
-
|
|
!
-
|
|
!
-
|
|
|
|
!
-
|
!
-
|
|
|
|
|
|
|
|
|
|
|
!
-
|
|
|
|
|
|
|
|
|
|
!
-
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
!
!
-
|
|
!
| #include "hsedsdk.as"
#include "gdi32.as"
#include "user32.as"
#include "kernel32.as"
#packopt name "hsed_infobar"
#packopt hide 1
#packopt runtime "runtime/hsp3c.hrt"
#const HWND_FLAT 0
#const HWND_ABOUT 2
#define HEADER "Light FlatBar ver.0.6\n\n"
#define FOOTER "for HSP script editor powered by \"hsedsdk.as\"\n"+\
"created by kz3"
#module
#uselib "user32.dll"
#func _wsprintf "wsprintfA" var, str, var
#deffunc ClientToClient int hw_from, var v2, int hw_to
ClientToScreen hw_from, varptr(v2)
ScreenToClient hw_to, varptr(v2)
return
#defcfunc rcequal var v1, var v2
EqualRect varptr(v1), varptr(v2)
return stat
#defcfunc strfs str p1, int p2, local s, local r
s = p1: sdim r, strlen(s)+abs(p2)+1
_wsprintf r, "%"+p2+"s", s
return r
#defcfunc getinfo int p1, int p2, int p3, str p4
return strf(" col : %-10d",p1)+strf(", row : %-10d",p2)+strf(", size : %-10d",p3)+", "+strfs(p4,-10)
#global
CreateMutex 0, 0, "hsed_infobar": hMutex = stat
GetLastError: errcode = stat
if errcode = 183 {
if hMutex: CloseHandle hMutex: hMutex = 0
end
}
FindWindow "onipad", 0: if stat = 0: end
repeat
wait 1
hsed_exist: if stat {
hIF = hIF@hsedsdk
break
}
loop
sendmsg hIF, HSED_GETWND, HGW_STATUSBAR, 0 : hStatus = stat
sendmsg hIF, HSED_GETWND, HGW_MAIN, 0 : hMain = stat
LoadIcon 0, 32516: hIcon = stat cr_type = "","CRLF","CR","LF","AUTO" pcx = -1: pcy = -1: psize = -1: pcr = 0
newRect = 0, 0, 0, 0
oldRect = -1, -1, -1, -1
dim rcText, 4
GetClientRect hStatus, varptr(newRect) bgscr HWND_FLAT, ginfo_dispx, newRect.3, 2 hFlatbar = hwnd
ClientToClient hStatus, newRect, hMain
GetWindowLong hwnd, $FFFFFFF0: dwStyle = stat
dwStyle = dwStyle & $80000000 ^ dwStyle dwStyle = dwStyle | $40000000 SetWindowLong hwnd, $FFFFFFF0, dwStyle
SetWindowLong hwnd, $FFFFFFF8, hMain
SetParent hwnd, hMain
MoveWindow hwnd, newRect.0, newRect.1, newRect.2, newRect.3, 1
screen HWND_ABOUT, 320, 140, 2+4: hAbout = hwnd
title "バージョン情報"
GetWindowLong hwnd, $FFFFFFF0: dwStyle = stat
dwStyle = dwStyle & $00080000 ^ dwStyle SetWindowLong hwnd, $FFFFFFF0, dwStyle
SetWindowLong hwnd, $FFFFFFF8, hFlatbar SetWindowPos hwnd, 0, 0, 0, 0, 0, $0027
objsize 100: pos (ginfo_winx-100)/2, ginfo_winy - 24 - 10
button gosub "OK", *about_ok sendmsg objinfo(stat,2), $000000F4, $01, -1 objsel 0
hsed_initduppipe: if stat: end
sendmsg hIF, HSED_GETVER, HGV_HSPCMPVER, hDupWritePipe@hsedsdk
if stat > 0 {
retsize = stat
sdim hsp_ver, retsize
ReadFile@hsedsdk hReadPipe@hsedsdk, hsp_ver, retsize, retsize2, 0
}
else {
hsp_ver = "HSP script preprocessor Undefined version" }
hsed_uninitduppipe
about = HEADER
about += FOOTER
gosub *DrawAbout
oncmd gosub *ON_SETFOCUS, $00000007
oncmd gosub *ON_SETTINGCHANGE, $0000001A
oncmd gosub *ON_SYSCOLORCHANGE, $00000015
onclick gosub *OnAboutDialog onkey gosub *about_ok_key
SetActiveWindow hMain SetFocus hMain
repeat
wait 10
IsWindowVisible hStatus
if stat = 0: gsel HWND_FLAT, -1: else: ShowWindow hFlatbar, 8
GetClientRect hStatus, varptr(newRect): if stat = 0: break
ClientToClient hStatus, newRect, hMain
if rcequal( newRect, oldRect ) = 0 {
CopyRect varptr(oldRect), varptr(newRect)
MoveWindow hFlatbar, newRect.0, newRect.1, newRect.2, newRect.3, 1
info = getinfo( pcx, pcy, psize, cr_type(pcr) )
gosub *DrawFlatbar
}
sendmsg hIF, HSED_GETCARETVPOS, -1, 0: cx = stat
sendmsg hIF, HSED_GETCARETLINE, -1, 0: cy = stat
sendmsg hIF, HSED_GETTEXTLENGTH,-1, 0: size = stat
sendmsg hIF, HSED_GETLINECODE, -1, 0: cr = stat
if( pcx ! cx ) | ( pcy ! cy ) | ( psize ! size ) | ( pcr ! cr ) {
pcx = cx: pcy = cy: psize = size: pcr = cr
CopyRect varptr(newRect), varptr(oldRect)
info = getinfo( cx, cy, size, cr_type(cr) )
gosub *DrawFlatbar
}
loop
if hMutex: CloseHandle hMutex: hMutex = 0
end
*DrawFlatbar
gsel HWND_FLAT
redraw 0
ClientToClient hMain, newRect, hStatus
DrawFrameControl hdc, varptr(newRect), 3, 0x0008
CopyRect varptr(rcText), varptr(newRect)
iconsize = rcText.3-4
DrawIconEx hdc, rcText.0+2, (rcText.3-iconsize)/2, hIcon, iconsize, iconsize, 0, 0, 3
syscolor 18: sysfont 17
rcText.0 = rcText.3: rcText.2 -= rcText.3
DrawText hdc, varptr(info), -1, varptr(rcText), $00008024
redraw 1
return
*DrawAbout
gsel HWND_ABOUT
redraw 0
syscolor 15: boxf
syscolor 18: sysfont 17
GetSystemMetrics $0000000B: cxIcon = stat
GetSystemMetrics $0000000C: cyIcon = stat
DrawIconEx hdc, 10, 10, hIcon, cxIcon, cyIcon, 0, 0, 3
pos 20+cxIcon, 10
mes about
syscolor 21: line ginfo_winx, ginfo_cy+10, 0, ginfo_cy+10
syscolor 20: line ginfo_winx, ginfo_cy+1, 0, ginfo_cy+1
syscolor 18
pos 20+cxIcon
mes ""
mes "on " + hsp_ver
redraw 1
return
*OnAboutDialog
if ginfo_act = HWND_ABOUT: return
if wparam = 2 {
CopyRect varptr(rcText), varptr(newRect)
ClientToClient hMain, rcText, hStatus
rcIcon = rcText.0+2, (rcText.3-iconsize)/2, rcIcon.0+iconsize, rcIcon.1+iconsize
PtInRect varptr(rcIcon), lparam & $ffff, lparam>>16 & $ffff
if stat {
gsel HWND_FLAT
dx = ginfo_wx1 + ( lparam & $ffff ) dy = ginfo_wy1 + ( lparam>>16 & $ffff ) gsel HWND_ABOUT
width 320, 140, dx, dy-ginfo_sizey
EnableWindow hMain, 0
gsel HWND_ABOUT, 1
}
}
return
*about_ok
EnableWindow hMain, 1
gsel HWND_ABOUT, -1
return
*about_ok_key
if ginfo_act ! HWND_ABOUT: return
if wparam = $0d {
gosub *about_ok
}
return
*ON_SETFOCUS
gsel HWND_ABOUT: objsel 0
return
*ON_SETTINGCHANGE
*ON_SYSCOLORCHANGE
gosub *DrawFlatbar
gosub *DrawAbout
return
|