Subversion Repositories Kolibri OS

Rev

Rev 2354 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2354 Rev 3353
1
;**************************************************************
1
;**************************************************************
2
; ScrollBar Macro for Kolibri OS
2
; ScrollBar Macro for Kolibri OS
3
; Copyright (c) 2009-2012, Marat Zakiyanov aka Mario79, aka Mario
3
; Copyright (c) 2009-2012, Marat Zakiyanov aka Mario79, aka Mario
4
; All rights reserved.
4
; All rights reserved.
5
;
5
;
6
; Redistribution and use in source and binary forms, with or without
6
; Redistribution and use in source and binary forms, with or without
7
; modification, are permitted provided that the following conditions are met:
7
; modification, are permitted provided that the following conditions are met:
8
;	 * Redistributions of source code must retain the above copyright
8
;	 * Redistributions of source code must retain the above copyright
9
;	 notice, this list of conditions and the following disclaimer.
9
;	 notice, this list of conditions and the following disclaimer.
10
;	 * Redistributions in binary form must reproduce the above copyright
10
;	 * Redistributions in binary form must reproduce the above copyright
11
;	 notice, this list of conditions and the following disclaimer in the
11
;	 notice, this list of conditions and the following disclaimer in the
12
;	 documentation and/or other materials provided with the distribution.
12
;	 documentation and/or other materials provided with the distribution.
13
;	 * Neither the name of the  nor the
13
;	 * Neither the name of the  nor the
14
;	 names of its contributors may be used to endorse or promote products
14
;	 names of its contributors may be used to endorse or promote products
15
;	 derived from this software without specific prior written permission.
15
;	 derived from this software without specific prior written permission.
16
;
16
;
17
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
17
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
18
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
20
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
21
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
;*****************************************************************************
27
;*****************************************************************************
28
; 15.11.2011 add scroll type 1 by IgorA
28
; 15.11.2011 add scroll type 1 by IgorA
29
;*****************************************************************************
29
;*****************************************************************************
30
macro scroll_bar_exit
30
macro scroll_bar_exit
31
{
31
{
32
popa
32
popa
33
ret 4
33
ret 4
34
}
34
}
35
;*****************************************************************************
35
;*****************************************************************************
36
macro draw_up_arrow_vertical
36
macro draw_up_arrow_vertical
37
{
37
{
38
	push	ebx
38
	push	ebx
39
	
39
	
40
	xor	eax,eax
40
	xor	eax,eax
41
	mov	ax,sb_size_x
41
	mov	ax,sb_size_x
42
	shr	eax,1
42
	shr	eax,1
43
	shl	eax,16
43
	shl	eax,16
44
	add	ebx,eax
44
	add	ebx,eax
45
	
45
	
46
	xor	eax,eax
46
	xor	eax,eax
47
	mov	ax,sb_btn_high
47
	mov	ax,sb_btn_high
48
	shr	eax,1
48
	shr	eax,1
49
	shl	eax,16
49
	shl	eax,16
50
	add	ecx,eax
50
	add	ecx,eax
51
	
51
	
52
	mov	edx,sb_line_col
52
	mov	edx,sb_line_col
53
	sub	ebx,4 shl 16
53
	sub	ebx,4 shl 16
54
	mov	bx,7
54
	mov	bx,7
55
	mov	cx,1
55
	mov	cx,1
56
	mov	eax,13
56
	mov	eax,13
57
	int	0x40
57
	int	0x40
58
	sub	ecx,1 shl 16
58
	sub	ecx,1 shl 16
59
	add	ebx,1 shl 16
59
	add	ebx,1 shl 16
60
	mov	bx,5
60
	mov	bx,5
61
	int	0x40
61
	int	0x40
62
	sub	ecx,1 shl 16
62
	sub	ecx,1 shl 16
63
	add	ebx,1 shl 16
63
	add	ebx,1 shl 16
64
	mov	bx,3
64
	mov	bx,3
65
	int	0x40
65
	int	0x40
66
	sub	ecx,1 shl 16
66
	sub	ecx,1 shl 16
67
	add	ebx,1 shl 16
67
	add	ebx,1 shl 16
68
	mov	bx,1
68
	mov	bx,1
69
	int	0x40
69
	int	0x40
70
	pop	ebx
70
	pop	ebx
71
}
71
}
72
;*****************************************************************************
72
;*****************************************************************************
73
macro draw_up_arrow_vertical_type2
73
macro draw_up_arrow_vertical_type2
74
{
74
{
75
	push	ebx
75
	push	ebx
76
	
76
	
77
	mov	bx,sb_size_x
77
	mov	bx,sb_size_x
78
	shr	bx,1
78
	shr	bx,1
79
	add	bx,sb_start_x
79
	add	bx,sb_start_x
80
 
80
 
81
	mov	cx,sb_btn_high
81
	mov	cx,sb_btn_high
82
	shr	cx,1
82
	shr	cx,1
83
	add	cx,sb_start_y
83
	add	cx,sb_start_y
84
	
84
	
85
	mov	ax,bx
85
	mov	ax,bx
86
	shl	eax,16
86
	shl	eax,16
87
	mov	ax,cx
87
	mov	ax,cx
88
	
88
	
89
	sub	cx,2
89
	sub	cx,2
90
	
90
	
91
	shl	ebx,16
91
	shl	ebx,16
92
	shl	ecx,16
92
	shl	ecx,16
93
	
93
	
94
	mov	cx,ax
94
	mov	cx,ax
95
	shr	eax,16
95
	shr	eax,16
96
	mov	bx,ax
96
	mov	bx,ax
97
	
97
	
98
	add	cx,1
98
	add	cx,1
99
	sub	bx,3
99
	sub	bx,3
100
 
100
 
101
	mcall	38,,,sb_line_col
101
	mcall	38,,,sb_line_col
102
 
102
 
103
	add	bx,6
103
	add	bx,6
104
	
104
	
105
	mcall
105
	mcall
106
	pop	ebx
106
	pop	ebx
107
}
107
}
108
;*****************************************************************************
108
;*****************************************************************************
109
macro draw_down_arrow_vertical
109
macro draw_down_arrow_vertical
110
{
110
{
111
	push	ebx
111
	push	ebx
112
	
112
	
113
	xor	eax,eax
113
	xor	eax,eax
114
	mov	ax,sb_size_x
114
	mov	ax,sb_size_x
115
	shr	eax,1
115
	shr	eax,1
116
	shl	eax,16
116
	shl	eax,16
117
	add	ebx,eax
117
	add	ebx,eax
118
	
118
	
119
	xor	eax,eax
119
	xor	eax,eax
120
	mov	ax,sb_btn_high
120
	mov	ax,sb_btn_high
121
	shr	eax,1
121
	shr	eax,1
122
	shl	eax,16
122
	shl	eax,16
123
	add	ecx,eax
123
	add	ecx,eax
124
	
124
	
125
	mov	edx,sb_line_col
125
	mov	edx,sb_line_col
126
	sub	ebx,4 shl 16
126
	sub	ebx,4 shl 16
127
	mov	bx,7
127
	mov	bx,7
128
	sub	ecx,2 shl 16
128
	sub	ecx,2 shl 16
129
	mov	cx,1
129
	mov	cx,1
130
	mov	eax,13
130
	mov	eax,13
131
	int	0x40
131
	int	0x40
132
	add	ecx,1 shl 16
132
	add	ecx,1 shl 16
133
	add	ebx,1 shl 16
133
	add	ebx,1 shl 16
134
	mov	bx,5
134
	mov	bx,5
135
	int	0x40
135
	int	0x40
136
	add	ecx,1 shl 16
136
	add	ecx,1 shl 16
137
	add	ebx,1 shl 16
137
	add	ebx,1 shl 16
138
	mov	bx,3
138
	mov	bx,3
139
	int	0x40
139
	int	0x40
140
	add	ecx,1 shl 16
140
	add	ecx,1 shl 16
141
	add	ebx,1 shl 16
141
	add	ebx,1 shl 16
142
	mov	bx,1
142
	mov	bx,1
143
	int	0x40
143
	int	0x40
144
	pop	ebx
144
	pop	ebx
145
}
145
}
146
;*****************************************************************************
146
;*****************************************************************************
147
macro draw_down_arrow_vertical_type2
147
macro draw_down_arrow_vertical_type2
148
{
148
{
149
	push	ebx
149
	push	ebx
150
	
150
	
151
	mov	bx,sb_size_x
151
	mov	bx,sb_size_x
152
	shr	bx,1
152
	shr	bx,1
153
	add	bx,sb_start_x
153
	add	bx,sb_start_x
154
 
154
 
155
	mov	ax,sb_btn_high
155
	mov	ax,sb_btn_high
156
	shr	ax,1
156
	shr	ax,1
157
	mov	cx,sb_start_y
157
	mov	cx,sb_start_y
158
	add	cx,sb_size_y
158
	add	cx,sb_size_y
159
	sub	cx,ax
159
	sub	cx,ax
160
	
160
	
161
	mov	ax,bx
161
	mov	ax,bx
162
	shl	eax,16
162
	shl	eax,16
163
	mov	ax,cx
163
	mov	ax,cx
164
	
164
	
165
	add	cx,1
165
	add	cx,1
166
	
166
	
167
	shl	ebx,16
167
	shl	ebx,16
168
	shl	ecx,16
168
	shl	ecx,16
169
	
169
	
170
	mov	cx,ax
170
	mov	cx,ax
171
	shr	eax,16
171
	shr	eax,16
172
	mov	bx,ax
172
	mov	bx,ax
173
	
173
	
174
	sub	cx,2
174
	sub	cx,2
175
	sub	bx,3
175
	sub	bx,3
176
 
176
 
177
	mcall	38,,,sb_line_col
177
	mcall	38,,,sb_line_col
178
 
178
 
179
	add	bx,6
179
	add	bx,6
180
	
180
	
181
	mcall
181
	mcall
182
	pop	ebx
182
	pop	ebx
183
}
183
}
184
;*****************************************************************************
184
;*****************************************************************************
185
macro draw_runner_center_vertical
185
macro draw_runner_center_vertical
186
{
186
{
187
	push	ebx
187
	push	ebx
188
	push	ecx
188
	push	ecx
189
	
189
	
190
	xor	eax,eax
190
	xor	eax,eax
191
	mov	ax,sb_size_x
191
	mov	ax,sb_size_x
192
	shr	eax,1
192
	shr	eax,1
193
	shl	eax,16
193
	shl	eax,16
194
	add	ebx,eax
194
	add	ebx,eax
195
	
195
	
196
	mov	edx,sb_run_size
196
	mov	edx,sb_run_size
197
	shr	edx,1
197
	shr	edx,1
198
	shl	edx,16
198
	shl	edx,16
199
	add	ecx,edx
199
	add	ecx,edx
200
	mov	edx,sb_line_col
200
	mov	edx,sb_line_col
201
	sub	ecx,8 shl 16
201
	sub	ecx,8 shl 16
202
	sub	ebx,5 shl 16
202
	sub	ebx,5 shl 16
203
	mov	bx,10
203
	mov	bx,10
204
	add	ecx,4 shl 16
204
	add	ecx,4 shl 16
205
	mov	cx,1
205
	mov	cx,1
206
	mov	eax,13
206
	mov	eax,13
207
	int	0x40
207
	int	0x40
208
	add	ecx,3 shl 16
208
	add	ecx,3 shl 16
209
	sub	ebx,1 shl 16
209
	sub	ebx,1 shl 16
210
	mov	bx,12
210
	mov	bx,12
211
	int	0x40
211
	int	0x40
212
	add	ebx,1 shl 16
212
	add	ebx,1 shl 16
213
	mov	bx,10
213
	mov	bx,10
214
	add	ecx,3 shl 16
214
	add	ecx,3 shl 16
215
	int	0x40
215
	int	0x40
216
	pop	ecx
216
	pop	ecx
217
	pop	ebx
217
	pop	ebx
218
}
218
}
219
;*****************************************************************************
219
;*****************************************************************************
220
macro draw_up_arrow_horizontal
220
macro draw_up_arrow_horizontal
221
{
221
{
222
	push	ecx
222
	push	ecx
223
	
223
	
224
	xor	eax,eax
224
	xor	eax,eax
225
	mov	ax,sb_btn_high
225
	mov	ax,sb_btn_high
226
	shr	eax,1
226
	shr	eax,1
227
	shl	eax,16
227
	shl	eax,16
228
	add	ebx,eax
228
	add	ebx,eax
229
	
229
	
230
	xor	eax,eax
230
	xor	eax,eax
231
	mov	ax,sb_size_y
231
	mov	ax,sb_size_y
232
	shr	eax,1
232
	shr	eax,1
233
	shl	eax,16
233
	shl	eax,16
234
	add	ecx,eax
234
	add	ecx,eax
235
	
235
	
236
	mov	edx,sb_line_col
236
	mov	edx,sb_line_col
237
	sub	ecx,4 shl 16
237
	sub	ecx,4 shl 16
238
	mov	cx,7
238
	mov	cx,7
239
	mov	bx,1
239
	mov	bx,1
240
	
240
	
241
	mov	eax,13
241
	mov	eax,13
242
	int	0x40
242
	int	0x40
243
	sub	ebx,1 shl 16
243
	sub	ebx,1 shl 16
244
	add	ecx,1 shl 16
244
	add	ecx,1 shl 16
245
	mov	cx,5
245
	mov	cx,5
246
	int	0x40
246
	int	0x40
247
	sub	ebx,1 shl 16
247
	sub	ebx,1 shl 16
248
	add	ecx,1 shl 16
248
	add	ecx,1 shl 16
249
	mov	cx,3
249
	mov	cx,3
250
	int	0x40
250
	int	0x40
251
	sub	ebx,1 shl 16
251
	sub	ebx,1 shl 16
252
	add	ecx,1 shl 16
252
	add	ecx,1 shl 16
253
	mov	cx,1
253
	mov	cx,1
254
	int	0x40
254
	int	0x40
255
	pop	ecx
255
	pop	ecx
256
}
256
}
257
;*****************************************************************************
257
;*****************************************************************************
258
macro draw_up_arrow_horizontal_type2
258
macro draw_up_arrow_horizontal_type2
259
{
259
{
260
	push	ebx ecx
260
	push	ebx ecx
261
	
261
	
262
	mov	bx,sb_btn_high
262
	mov	bx,sb_btn_high
263
	shr	bx,1
263
	shr	bx,1
264
	add	bx,sb_start_x
264
	add	bx,sb_start_x
265
 
265
 
266
	mov	cx,sb_size_y
266
	mov	cx,sb_size_y
267
	shr	cx,1
267
	shr	cx,1
268
	add	cx,sb_start_y
268
	add	cx,sb_start_y
269
	
269
	
270
	mov	ax,bx
270
	mov	ax,bx
271
	shl	eax,16
271
	shl	eax,16
272
	mov	ax,cx
272
	mov	ax,cx
273
	
273
	
274
	sub	bx,2
274
	sub	bx,2
275
	
275
	
276
	shl	ebx,16
276
	shl	ebx,16
277
	shl	ecx,16
277
	shl	ecx,16
278
	
278
	
279
	mov	cx,ax
279
	mov	cx,ax
280
	shr	eax,16
280
	shr	eax,16
281
	mov	bx,ax
281
	mov	bx,ax
282
	
282
	
283
	add	bx,1
283
	add	bx,1
284
	sub	cx,3
284
	sub	cx,3
285
 
285
 
286
	mcall	38,,,sb_line_col
286
	mcall	38,,,sb_line_col
287
 
287
 
288
	add	cx,6
288
	add	cx,6
289
	
289
	
290
	mcall
290
	mcall
291
	pop	ecx ebx
291
	pop	ecx ebx
292
}
292
}
293
;*****************************************************************************
293
;*****************************************************************************
294
macro draw_down_arrow_horizontal
294
macro draw_down_arrow_horizontal
295
{
295
{
296
	push	ecx
296
	push	ecx
297
	
297
	
298
	xor	eax,eax
298
	xor	eax,eax
299
	mov	ax,sb_btn_high
299
	mov	ax,sb_btn_high
300
	shr	eax,1
300
	shr	eax,1
301
	shl	eax,16
301
	shl	eax,16
302
	add	ebx,eax
302
	add	ebx,eax
303
	
303
	
304
	xor	eax,eax
304
	xor	eax,eax
305
	mov	ax,sb_size_y
305
	mov	ax,sb_size_y
306
	shr	eax,1
306
	shr	eax,1
307
	shl	eax,16
307
	shl	eax,16
308
	add	ecx,eax
308
	add	ecx,eax
309
	
309
	
310
	mov	edx,sb_line_col
310
	mov	edx,sb_line_col
311
	sub	ecx,4 shl 16
311
	sub	ecx,4 shl 16
312
	mov	cx,7
312
	mov	cx,7
313
	sub	ebx,2 shl 16
313
	sub	ebx,2 shl 16
314
	mov	bx,1
314
	mov	bx,1
315
	mov	eax,13
315
	mov	eax,13
316
	int	0x40
316
	int	0x40
317
	add	ebx,1 shl 16
317
	add	ebx,1 shl 16
318
	add	ecx,1 shl 16
318
	add	ecx,1 shl 16
319
	mov	cx,5
319
	mov	cx,5
320
	int	0x40
320
	int	0x40
321
	add	ebx,1 shl 16
321
	add	ebx,1 shl 16
322
	add	ecx,1 shl 16
322
	add	ecx,1 shl 16
323
	mov	cx,3
323
	mov	cx,3
324
	int	0x40
324
	int	0x40
325
	add	ecx,1 shl 16
325
	add	ecx,1 shl 16
326
	add	ebx,1 shl 16
326
	add	ebx,1 shl 16
327
	mov	cx,1
327
	mov	cx,1
328
	int	0x40
328
	int	0x40
329
	pop	ecx
329
	pop	ecx
330
}
330
}
331
;*****************************************************************************
331
;*****************************************************************************
332
macro draw_down_arrow_horizontal_type2
332
macro draw_down_arrow_horizontal_type2
333
{
333
{
334
	push	ebx ecx
334
	push	ebx ecx
335
	
335
	
336
	mov	ax,sb_btn_high
336
	mov	ax,sb_btn_high
337
	shr	ax,1
337
	shr	ax,1
338
	mov	bx,sb_start_x
338
	mov	bx,sb_start_x
339
	add	bx,sb_size_x
339
	add	bx,sb_size_x
340
	sub	bx,ax
340
	sub	bx,ax
341
	
341
	
342
	mov	cx,sb_size_y
342
	mov	cx,sb_size_y
343
	shr	cx,1
343
	shr	cx,1
344
	add	cx,sb_start_y
344
	add	cx,sb_start_y
345
	
345
	
346
	mov	ax,bx
346
	mov	ax,bx
347
	shl	eax,16
347
	shl	eax,16
348
	mov	ax,cx
348
	mov	ax,cx
349
	
349
	
350
	add	cx,1
350
	add	cx,1
351
	
351
	
352
	shl	ebx,16
352
	shl	ebx,16
353
	shl	ecx,16
353
	shl	ecx,16
354
	
354
	
355
	mov	cx,ax
355
	mov	cx,ax
356
	shr	eax,16
356
	shr	eax,16
357
	mov	bx,ax
357
	mov	bx,ax
358
	
358
	
359
	sub	cx,2
359
	sub	cx,2
360
	sub	bx,3
360
	sub	bx,3
361
 
361
 
362
	mcall	38,,,sb_line_col
362
	mcall	38,,,sb_line_col
363
 
363
 
364
	add	cx,6
364
	add	cx,6
365
	
365
	
366
	mcall
366
	mcall
367
	pop	ecx ebx
367
	pop	ecx ebx
368
}
368
}
369
;*****************************************************************************
369
;*****************************************************************************
370
macro draw_runner_center_horizontal
370
macro draw_runner_center_horizontal
371
{
371
{
372
	push	ebx
372
	push	ebx
373
	push	ecx
373
	push	ecx
374
	
374
	
375
	xor	eax,eax
375
	xor	eax,eax
376
	mov	ax,sb_size_y
376
	mov	ax,sb_size_y
377
	shr	eax,1
377
	shr	eax,1
378
	shl	eax,16
378
	shl	eax,16
379
	add	ecx,eax
379
	add	ecx,eax
380
	
380
	
381
	mov	edx,sb_run_size
381
	mov	edx,sb_run_size
382
	shr	edx,1
382
	shr	edx,1
383
	shl	edx,16
383
	shl	edx,16
384
	add	ebx,edx
384
	add	ebx,edx
385
	mov	edx,sb_line_col
385
	mov	edx,sb_line_col
386
	sub	ebx,8 shl 16
386
	sub	ebx,8 shl 16
387
	sub	ecx,5 shl 16
387
	sub	ecx,5 shl 16
388
	mov	cx,10
388
	mov	cx,10
389
	add	ebx,4 shl 16
389
	add	ebx,4 shl 16
390
	mov	bx,1
390
	mov	bx,1
391
	mov	eax,13
391
	mov	eax,13
392
	int	0x40
392
	int	0x40
393
	add	ebx,3 shl 16
393
	add	ebx,3 shl 16
394
	sub	ecx,1 shl 16
394
	sub	ecx,1 shl 16
395
	mov	cx,12
395
	mov	cx,12
396
	int	0x40
396
	int	0x40
397
	add	ecx,1 shl 16
397
	add	ecx,1 shl 16
398
	mov	cx,10
398
	mov	cx,10
399
	add	ebx,3 shl 16
399
	add	ebx,3 shl 16
400
	int	0x40
400
	int	0x40
401
	pop	ecx
401
	pop	ecx
402
	pop	ebx
402
	pop	ebx
403
}
403
}
404
;*****************************************************************************
404
;*****************************************************************************
405
macro use_scroll_bar
405
macro use_scroll_bar
406
{
406
{
407
scroll_bar:
407
scroll_bar:
408
sb_size_x	equ [edi]
408
sb_size_x	equ [edi]
409
sb_start_x	equ [edi+2]
409
sb_start_x	equ [edi+2]
410
sb_size_y	equ [edi+4]
410
sb_size_y	equ [edi+4]
411
sb_start_y	equ [edi+6]
411
sb_start_y	equ [edi+6]
412
sb_btn_high	equ [edi+8]
412
sb_btn_high	equ [edi+8]
413
sb_type		equ [edi+12]
413
sb_type		equ [edi+12]
414
sb_max_area	equ [edi+16]
414
sb_max_area	equ [edi+16]
415
sb_cur_area	equ [edi+20]
415
sb_cur_area	equ [edi+20]
416
sb_position	equ [edi+24]
416
sb_position	equ [edi+24]
417
sb_bckg_col	equ [edi+28]
417
sb_bckg_col	equ [edi+28]
418
sb_frnt_col	equ [edi+32]
418
sb_frnt_col	equ [edi+32]
419
sb_line_col	equ [edi+36]
419
sb_line_col	equ [edi+36]
420
sb_redraw	equ [edi+40]
420
sb_redraw	equ [edi+40]
421
sb_delta	equ [edi+44]
421
sb_delta	equ [edi+44]
422
sb_delta2	equ [edi+46]
422
sb_delta2	equ [edi+46]
423
sb_r_size_x	equ [edi+48]
423
sb_r_size_x	equ [edi+48]
424
sb_r_start_x	equ [edi+50]
424
sb_r_start_x	equ [edi+50]
425
sb_r_size_y	equ [edi+52]
425
sb_r_size_y	equ [edi+52]
426
sb_r_start_y	equ [edi+54]
426
sb_r_start_y	equ [edi+54]
427
sb_m_pos	equ [edi+56]
427
sb_m_pos	equ [edi+56]
428
sb_m_pos_2	equ [edi+60]
428
sb_m_pos_2	equ [edi+60]
429
sb_m_keys	equ [edi+64]
429
sb_m_keys	equ [edi+64]
430
sb_run_size	equ [edi+68]
430
sb_run_size	equ [edi+68]
431
sb_position2	equ [edi+72]
431
sb_position2	equ [edi+72]
432
sb_work_size	equ [edi+76]
432
sb_work_size	equ [edi+76]
433
sb_all_redraw	equ [edi+80]
433
sb_all_redraw	equ [edi+80]
434
sb_ar_offset	equ [edi+84]
434
sb_ar_offset	equ [edi+84]
435
}
435
}
436
;*****************************************************************************
436
;*****************************************************************************
437
;*****************************************************************************
437
;*****************************************************************************
438
; draw event
438
; draw event
439
;*****************************************************************************
439
;*****************************************************************************
440
;*****************************************************************************
440
;*****************************************************************************
441
macro use_scroll_bar_vertical
441
macro use_scroll_bar_vertical
442
{
442
{
443
scroll_bar_vertical:
443
scroll_bar_vertical:
444
.draw:
444
.draw:
445
	pusha
445
	pusha
446
	mov	edi,dword [esp+36]
446
	mov	edi,dword [esp+36]
447
	mov	sb_delta,word 0
447
	mov	sb_delta,word 0
448
	call	.draw_1
448
	call	.draw_1
449
	mov	sb_all_redraw,dword 0
449
	mov	sb_all_redraw,dword 0
450
scroll_bar_exit
450
scroll_bar_exit
451
.draw_1:
451
.draw_1:
452
	pusha
452
	pusha
453
;*********************************
453
;*********************************
454
	xor	eax,eax
454
	xor	eax,eax
455
	mov	ax,sb_size_y
455
	mov	ax,sb_size_y
456
	mov	edx,sb_btn_high
456
	mov	edx,sb_btn_high
457
	shl	edx,1
457
	shl	edx,1
458
	sub	eax,edx
458
	sub	eax,edx
459
	mov	sb_work_size,eax
459
	mov	sb_work_size,eax
460
;*********************************
460
;*********************************
461
	mov	eax,sb_work_size
461
	mov	eax,sb_work_size
462
	mov	ebx,sb_max_area
462
	mov	ebx,sb_max_area
463
	cmp	ebx,sb_cur_area
463
	cmp	ebx,sb_cur_area
464
	ja	@f
464
	ja	@f
465
	jmp	.no_size
465
	jmp	.no_size
466
 
466
 
467
@@: 
467
@@: 
468
	imul	eax,sb_cur_area
468
	imul	eax,sb_cur_area
469
	xor	edx,edx
469
	xor	edx,edx
470
	div	ebx
470
	div	ebx
-
 
471
	shl	edx,1
-
 
472
	cmp	edx,ebx
-
 
473
	jb	@f
-
 
474
	
-
 
475
	inc	eax
-
 
476
	
-
 
477
@@:
471
	cmp	eax,10
478
	cmp	eax,10
472
	jae	@f
479
	jae	@f
473
	mov	eax,10
480
	mov	eax,10
474
@@:
481
@@:
475
.no_size:
482
.no_size:
476
	mov	sb_run_size,eax
483
	mov	sb_run_size,eax
477
;*********************************
484
;*********************************
478
	cmp	word sb_delta,1
485
	cmp	word sb_delta,1
479
	je	.@@_3
486
	je	.@@_3
480
	mov	eax,sb_work_size
487
	mov	eax,sb_work_size
481
	sub	eax,sb_run_size
488
	sub	eax,sb_run_size
482
	mov	ebx,sb_max_area
489
	mov	ebx,sb_max_area
483
	cmp	ebx,sb_cur_area
490
	cmp	ebx,sb_cur_area
484
	ja	@f
491
	ja	@f
485
	xor	eax,eax
492
	xor	eax,eax
486
	jmp	.@@_1
493
	jmp	.@@_1
487
@@:
494
@@:
488
	sub	ebx,sb_cur_area
495
	sub	ebx,sb_cur_area
489
	imul	eax,sb_position
496
	imul	eax,sb_position
490
	xor	edx,edx
497
	xor	edx,edx
491
	div	ebx
498
	div	ebx
-
 
499
	shl	edx,1
-
 
500
	cmp	edx,ebx
-
 
501
	jb	@f
-
 
502
	
-
 
503
	inc	eax
-
 
504
	
-
 
505
@@:
492
.@@_1:
506
.@@_1:
493
	mov	sb_position2,eax
507
	mov	sb_position2,eax
494
	xor	edx,edx
508
	xor	edx,edx
495
	mov	dx,sb_size_y
509
	mov	dx,sb_size_y
496
	sub	edx,sb_btn_high
510
	sub	edx,sb_btn_high
497
	sub	edx,sb_btn_high
511
	sub	edx,sb_btn_high
498
	sub	edx,sb_run_size
512
	sub	edx,sb_run_size
499
	cmp	sb_position2,edx
513
	cmp	sb_position2,edx
500
	jbe	.@@_3
514
	jbe	.@@_3
501
	mov	sb_position2,edx
515
	mov	sb_position2,edx
502
.@@_3:
516
.@@_3:
503
;*********************************	
517
;*********************************	
504
	mov	ebx,sb_start_x
518
	mov	ebx,sb_start_x
505
	shl	ebx,16
519
	shl	ebx,16
506
	inc	ebx
520
	inc	ebx
507
	mov	ecx,sb_size_y
521
	mov	ecx,sb_size_y
508
	mov	edx,sb_line_col
522
	mov	edx,sb_line_col
509
	mov	eax,13
523
	mov	eax,13
510
	cmp	dword sb_all_redraw,0
524
	cmp	dword sb_all_redraw,0
511
	je	@f
525
	je	@f
512
	int	0x40	; left extreme line
526
	int	0x40	; left extreme line
513
@@:
527
@@:
514
	push	ebx
528
	push	ebx
515
	ror	ebx,16
529
	ror	ebx,16
516
	add	bx,sb_size_x
530
	add	bx,sb_size_x
517
	rol	ebx,16
531
	rol	ebx,16
518
	cmp	dword sb_all_redraw,0
532
	cmp	dword sb_all_redraw,0
519
	je	@f
533
	je	@f
520
	int	0x40	; right extreme line
534
	int	0x40	; right extreme line
521
@@:
535
@@:
522
	pop	ebx
536
	pop	ebx
523
 
537
 
524
	push	ecx
538
	push	ecx
525
	
539
	
526
	add	ebx,1 shl 16
540
	add	ebx,1 shl 16
527
	mov	bx,sb_size_x
541
	mov	bx,sb_size_x
528
	dec	ebx	
542
	dec	ebx	
529
	mov	cx,1
543
	mov	cx,1
530
	cmp	dword sb_all_redraw,0
544
	cmp	dword sb_all_redraw,0
531
	je	@f
545
	je	@f
532
	int	0x40	; top button - extreme line
546
	int	0x40	; top button - extreme line
533
@@:
547
@@:
534
	push	ecx
548
	push	ecx
535
	add	ecx,1 shl 16
549
	add	ecx,1 shl 16
536
	add	ecx,sb_btn_high
550
	add	ecx,sb_btn_high
537
	sub	ecx,2
551
	sub	ecx,2
538
	mov	edx,sb_frnt_col
552
	mov	edx,sb_frnt_col
539
	cmp	dword sb_all_redraw,0
553
	cmp	dword sb_all_redraw,0
540
	je	.no_draw_top_button
554
	je	.no_draw_top_button
541
	int	0x40	; top button filling
555
	int	0x40	; top button filling
542
;-----------------------------------------------------------------------------
556
;-----------------------------------------------------------------------------
543
; scrollbar type 2
557
; scrollbar type 2
544
	cmp	word sb_type,2
558
	cmp	word sb_type,2
545
	jne	.no_type2
559
	jne	.no_type2
546
;*********************************
560
;*********************************
547
draw_up_arrow_vertical_type2
561
draw_up_arrow_vertical_type2
548
;*********************************
562
;*********************************
549
	jmp	.no_draw_top_button
563
	jmp	.no_draw_top_button
550
.no_type2:
564
.no_type2:
551
;*********************************
565
;*********************************
552
draw_up_arrow_vertical
566
draw_up_arrow_vertical
553
;*********************************
567
;*********************************
554
.no_draw_top_button:
568
.no_draw_top_button:
555
	pop	ecx
569
	pop	ecx
556
	
570
	
557
	ror	ecx,16
571
	ror	ecx,16
558
	add	ecx,sb_btn_high  ;14 shl 16
572
	add	ecx,sb_btn_high  ;14 shl 16
559
	rol	ecx,16
573
	rol	ecx,16
560
	mov	edx,sb_line_col
574
	mov	edx,sb_line_col
561
	cmp	dword sb_all_redraw,0
575
	cmp	dword sb_all_redraw,0
562
	je	@f
576
	je	@f
563
	mcall	13	;  top button - bottom line
577
	mcall	13	;  top button - bottom line
564
@@:
578
@@:
565
	pop	ecx
579
	pop	ecx
566
;********************************* 
580
;********************************* 
567
	ror	ecx,16	
581
	ror	ecx,16	
568
	add	ecx,sb_btn_high  ;15 shl 16
582
	add	ecx,sb_btn_high  ;15 shl 16
569
	inc	ecx
583
	inc	ecx
570
	rol	ecx,16
584
	rol	ecx,16
571
	sub	ecx,sb_btn_high  ;30
585
	sub	ecx,sb_btn_high  ;30
572
	sub	ecx,sb_btn_high
586
	sub	ecx,sb_btn_high
573
	push	ecx
587
	push	ecx
574
	mov	cx,0
588
	mov	cx,0
575
	add	ecx,sb_position2
589
	add	ecx,sb_position2
576
	dec	cx
590
	dec	cx
577
	mov	eax,13
591
	mov	eax,13
578
	test	cx,0x8000
592
	test	cx,0x8000
579
	jnz	@f
593
	jnz	@f
580
	mov	edx,sb_bckg_col
594
	mov	edx,sb_bckg_col
581
	int	0x40	; top interval
595
	int	0x40	; top interval
582
@@:
596
@@:
583
;********************************* 
597
;********************************* 
584
	shr	ecx,16
598
	shr	ecx,16
585
	add	ecx,sb_position2
599
	add	ecx,sb_position2
586
	dec	ecx
600
	dec	ecx
587
	shl	ecx,16
601
	shl	ecx,16
588
	inc	ecx
602
	inc	ecx
589
	mov	edx,sb_line_col
603
	mov	edx,sb_line_col
590
	int	0x40	; runner - top extreme line
604
	int	0x40	; runner - top extreme line
591
	
605
	
592
	add	ecx,1 shl 16
606
	add	ecx,1 shl 16
593
	mov	cx,0
607
	mov	cx,0
594
	add	ecx,sb_run_size
608
	add	ecx,sb_run_size
595
	mov	sb_r_size_x,ebx
609
	mov	sb_r_size_x,ebx
596
	mov	sb_r_size_y,ecx
610
	mov	sb_r_size_y,ecx
597
	sub	ecx,2
611
	sub	ecx,2
598
	mov	edx,sb_frnt_col
612
	mov	edx,sb_frnt_col
599
	int	0x40	; runner filling
613
	int	0x40	; runner filling
600
;-----------------------------------------------------------------------------
614
;-----------------------------------------------------------------------------
601
; scrollbar type 2
615
; scrollbar type 2
602
	cmp	word sb_type,2
616
	cmp	word sb_type,2
603
	je	@f
617
	je	@f
604
;*********************************
618
;*********************************
605
draw_runner_center_vertical
619
draw_runner_center_vertical
606
;********************************* 
620
;********************************* 
607
@@:
621
@@:
608
;-----------------------------------------------------------------------------
622
;-----------------------------------------------------------------------------
609
; scrollbar type 1 - stylish frame
623
; scrollbar type 1 - stylish frame
610
	cmp	word sb_type,1
624
	cmp	word sb_type,1
611
	jne	@f
625
	jne	@f
612
	push	eax ebx ecx edx
626
	push	eax ebx ecx edx
613
	movzx	eax,word sb_start_x
627
	movzx	eax,word sb_start_x
614
	xor	ebx,ebx
628
	xor	ebx,ebx
615
	add	bx,sb_r_start_y
629
	add	bx,sb_r_start_y
616
	dec	ebx
630
	dec	ebx
617
	movzx	ecx,word sb_size_x
631
	movzx	ecx,word sb_size_x
618
	mov	edx,sb_run_size
632
	mov	edx,sb_run_size
619
	dec	edx
633
	dec	edx
620
	; drawing a stylish frame on the slider
634
	; drawing a stylish frame on the slider
621
	stdcall draw_edge,eax,ebx,ecx,edx,sb_bckg_col,sb_frnt_col,sb_line_col
635
	stdcall draw_edge,eax,ebx,ecx,edx,sb_bckg_col,sb_frnt_col,sb_line_col
622
	pop	edx ecx ebx eax
636
	pop	edx ecx ebx eax
623
@@:
637
@@:
624
;-----------------------------------------------------------------------------
638
;-----------------------------------------------------------------------------
625
	shr	ecx,16
639
	shr	ecx,16
626
	add	ecx,sb_run_size
640
	add	ecx,sb_run_size
627
	sub	ecx,2
641
	sub	ecx,2
628
	shl	ecx,16  
642
	shl	ecx,16  
629
	inc	ecx
643
	inc	ecx
630
	mov	edx,sb_line_col
644
	mov	edx,sb_line_col
631
	int	0x40	; runner - bottom extreme line
645
	int	0x40	; runner - bottom extreme line
632
	
646
	
633
	add	ecx,1 shl 16
647
	add	ecx,1 shl 16
634
	mov	cx,sb_start_y
648
	mov	cx,sb_start_y
635
	add	cx,sb_size_y
649
	add	cx,sb_size_y
636
	sub	ecx,sb_btn_high
650
	sub	ecx,sb_btn_high
637
	dec	ecx
651
	dec	ecx
638
	mov	eax,ecx
652
	mov	eax,ecx
639
	shr	eax,16
653
	shr	eax,16
640
	sub	cx,ax
654
	sub	cx,ax
641
	test	cx,0x8000
655
	test	cx,0x8000
642
	jnz	@f
656
	jnz	@f
643
	mov	edx,sb_bckg_col
657
	mov	edx,sb_bckg_col
644
	mov	eax,13
658
	mov	eax,13
645
	int	0x40	; bottom interval
659
	int	0x40	; bottom interval
646
@@:	
660
@@:	
647
	pop	ecx	
661
	pop	ecx	
648
;*********************************	
662
;*********************************	
649
	mov	ax,cx
663
	mov	ax,cx
650
	shr	ecx,16
664
	shr	ecx,16
651
	add	cx,ax
665
	add	cx,ax
652
	sub	ecx,2
666
	sub	ecx,2
653
	shl	ecx,16
667
	shl	ecx,16
654
	inc	ecx
668
	inc	ecx
655
	mov	edx,sb_line_col
669
	mov	edx,sb_line_col
656
	mov	eax,13
670
	mov	eax,13
657
	cmp	dword sb_all_redraw,0
671
	cmp	dword sb_all_redraw,0
658
	je	@f
672
	je	@f
659
	int	0x40	; bottom button - top line
673
	int	0x40	; bottom button - top line
660
@@:
674
@@:
661
	push	ecx
675
	push	ecx
662
	add	ecx,1 shl 16
676
	add	ecx,1 shl 16
663
	add	cx,sb_btn_high
677
	add	cx,sb_btn_high
664
	sub	ecx,2
678
	sub	ecx,2
665
	mov	edx,sb_frnt_col
679
	mov	edx,sb_frnt_col
666
	cmp	dword sb_all_redraw,0
680
	cmp	dword sb_all_redraw,0
667
	je	.no_draw_bottom_button
681
	je	.no_draw_bottom_button
668
	int	0x40	; bottom button filling
682
	int	0x40	; bottom button filling
669
;-----------------------------------------------------------------------------
683
;-----------------------------------------------------------------------------
670
; scrollbar type 2
684
; scrollbar type 2
671
	cmp	word sb_type,2
685
	cmp	word sb_type,2
672
	jne	.no_type2_1
686
	jne	.no_type2_1
673
;*********************************
687
;*********************************
674
draw_down_arrow_vertical_type2
688
draw_down_arrow_vertical_type2
675
;*********************************
689
;*********************************
676
	jmp	.no_draw_bottom_button
690
	jmp	.no_draw_bottom_button
677
.no_type2_1:
691
.no_type2_1:
678
;********************************* 
692
;********************************* 
679
draw_down_arrow_vertical
693
draw_down_arrow_vertical
680
;********************************* 
694
;********************************* 
681
.no_draw_bottom_button:
695
.no_draw_bottom_button:
682
	pop	ecx
696
	pop	ecx
683
	
697
	
684
	ror	ecx,16
698
	ror	ecx,16
685
	add	ecx,sb_btn_high
699
	add	ecx,sb_btn_high
686
	rol	ecx,16
700
	rol	ecx,16
687
	
701
	
688
	mov	edx,sb_line_col
702
	mov	edx,sb_line_col
689
	mov	cx,1
703
	mov	cx,1
690
	cmp	dword sb_all_redraw,0
704
	cmp	dword sb_all_redraw,0
691
	je	@f
705
	je	@f
692
	mcall	13	; bottom button - extreme line
706
	mcall	13	; bottom button - extreme line
693
;-----------------------------------------------------------------------------
707
;-----------------------------------------------------------------------------
694
; scrollbar type 1 - stylish frame
708
; scrollbar type 1 - stylish frame
695
	cmp	word sb_type,1
709
	cmp	word sb_type,1
696
	jne	@f
710
	jne	@f
697
	movzx	eax,word sb_start_x
711
	movzx	eax,word sb_start_x
698
	movzx	ebx,word sb_start_y
712
	movzx	ebx,word sb_start_y
699
	movzx	ecx,word sb_size_x
713
	movzx	ecx,word sb_size_x
700
	; drawing a stylish frame on the top button
714
	; drawing a stylish frame on the top button
701
	stdcall	draw_edge,eax,ebx,ecx,sb_btn_high,\
715
	stdcall	draw_edge,eax,ebx,ecx,sb_btn_high,\
702
		sb_bckg_col,sb_frnt_col,sb_line_col
716
		sb_bckg_col,sb_frnt_col,sb_line_col
703
	add	bx,sb_size_y
717
	add	bx,sb_size_y
704
	sub	ebx,sb_btn_high
718
	sub	ebx,sb_btn_high
705
	dec	ebx
719
	dec	ebx
706
	; drawing a stylish frame on the bottom  button
720
	; drawing a stylish frame on the bottom  button
707
	stdcall	draw_edge,eax,ebx,ecx,sb_btn_high,\
721
	stdcall	draw_edge,eax,ebx,ecx,sb_btn_high,\
708
		sb_bckg_col,sb_frnt_col,sb_line_col
722
		sb_bckg_col,sb_frnt_col,sb_line_col
709
@@:
723
@@:
710
;-----------------------------------------------------------------------------
724
;-----------------------------------------------------------------------------
711
	popa
725
	popa
712
	ret
726
	ret
713
;*****************************************************************************
727
;*****************************************************************************
714
;*****************************************************************************
728
;*****************************************************************************
715
; mouse event
729
; mouse event
716
;*****************************************************************************
730
;*****************************************************************************
717
;*****************************************************************************
731
;*****************************************************************************
718
.mouse:
732
.mouse:
719
	pusha
733
	pusha
720
	mov	edi,dword [esp+36]
734
	mov	edi,dword [esp+36]
721
	mcall	37,1
735
	mcall	37,1
722
	mov	sb_m_pos,eax
736
	mov	sb_m_pos,eax
723
	cmp	dword sb_m_pos_2,0
737
	cmp	dword sb_m_pos_2,0
724
	jne	@f
738
	jne	@f
725
	
739
	
726
	mov	sb_m_pos_2,eax	
740
	mov	sb_m_pos_2,eax	
727
@@:
741
@@:
728
	mcall	37,2
742
	mcall	37,2
729
	mov	sb_m_keys,eax	
743
	mov	sb_m_keys,eax	
730
 
744
 
731
	cmp	sb_m_keys,eax
745
	cmp	sb_m_keys,eax
732
	je	@f
746
	je	@f
733
	
747
	
734
	mov	sb_m_keys,eax
748
	mov	sb_m_keys,eax
735
	mov	sb_delta,dword 0
749
	mov	sb_delta,dword 0
736
	mov	eax,sb_m_pos
750
	mov	eax,sb_m_pos
737
	mov	sb_m_pos_2,eax
751
	mov	sb_m_pos_2,eax
738
	jmp	.continue_2
752
	jmp	.continue_2
739
@@:
753
@@:
740
	cmp	dword sb_m_keys,0
754
	cmp	dword sb_m_keys,0
741
	jne	 @f
755
	jne	 @f
742
	mov	eax,sb_m_pos
756
	mov	eax,sb_m_pos
743
	mov	sb_m_pos_2,eax
757
	mov	sb_m_pos_2,eax
744
	jmp	.correct_1	;.exit_sb	
758
	jmp	.correct_1	;.exit_sb	
745
@@:
759
@@:
746
	mov	sb_delta,word 1
760
	mov	sb_delta,word 1
747
 
761
 
748
.continue_2:
762
.continue_2:
749
	mov	eax,sb_m_pos
763
	mov	eax,sb_m_pos
750
	test	eax,0x80000000
764
	test	eax,0x80000000
751
	jnz	.exit_sb
765
	jnz	.exit_sb
752
	
766
	
753
	test	eax,0x8000
767
	test	eax,0x8000
754
	jnz	.exit_sb
768
	jnz	.exit_sb
755
	
769
	
756
	mov	ebx,eax
770
	mov	ebx,eax
757
	shr	ebx,16	; x position
771
	shr	ebx,16	; x position
758
	shl	eax,16
772
	shl	eax,16
759
	shr	eax,16	; y position
773
	shr	eax,16	; y position
760
 
774
 
761
	mov	cx,sb_start_y
775
	mov	cx,sb_start_y
762
	cmp	ax,cx
776
	cmp	ax,cx
763
	jb	.exit_sb
777
	jb	.exit_sb
764
	
778
	
765
	cmp	word sb_delta2,0
779
	cmp	word sb_delta2,0
766
	je	@f
780
	je	@f
767
	push	ecx
781
	push	ecx
768
	add	cx,sb_btn_high
782
	add	cx,sb_btn_high
769
	cmp	ax,cx
783
	cmp	ax,cx
770
	pop	ecx
784
	pop	ecx
771
	jb	.exit_sb
785
	jb	.exit_sb
772
	
786
	
773
@@:
787
@@:
774
	add	cx,sb_size_y
788
	add	cx,sb_size_y
775
	cmp	ax,cx
789
	cmp	ax,cx
776
	ja	.exit_sb
790
	ja	.exit_sb
777
 
791
 
778
	cmp	word sb_delta2,0
792
	cmp	word sb_delta2,0
779
	je	@f
793
	je	@f
780
	sub	cx,sb_btn_high
794
	sub	cx,sb_btn_high
781
	cmp	ax,cx
795
	cmp	ax,cx
782
	ja	.exit_sb
796
	ja	.exit_sb
783
	
797
	
784
@@:
798
@@:
785
	cmp	word sb_delta2,1
799
	cmp	word sb_delta2,1
786
	je	@f
800
	je	@f
787
	
801
	
788
	cmp	dword sb_m_keys,0
802
	cmp	dword sb_m_keys,0
789
	je	.exit_sb
803
	je	.exit_sb
790
	
804
	
791
	mov	cx,sb_start_x
805
	mov	cx,sb_start_x
792
	cmp	bx,cx
806
	cmp	bx,cx
793
	jb	.exit_sb
807
	jb	.exit_sb
794
	
808
	
795
	add	cx,sb_size_x
809
	add	cx,sb_size_x
796
	cmp	bx,cx
810
	cmp	bx,cx
797
	ja	.exit_sb
811
	ja	.exit_sb
798
 
812
 
799
	mov	cx,sb_r_start_y
813
	mov	cx,sb_r_start_y
800
	cmp	ax,cx
814
	cmp	ax,cx
801
	jb	.no_runner
815
	jb	.no_runner
802
	
816
	
803
	add	cx,sb_r_size_y
817
	add	cx,sb_r_size_y
804
	cmp	ax,cx
818
	cmp	ax,cx
805
	ja	.no_runner
819
	ja	.no_runner
806
 
820
 
807
	mov	sb_delta2,word 1	
821
	mov	sb_delta2,word 1	
808
@@:
822
@@:
809
	push	eax
823
	push	eax
810
	mov	ax,sb_m_pos
824
	mov	ax,sb_m_pos
811
	cmp	ax,sb_m_pos_2
825
	cmp	ax,sb_m_pos_2
812
	je	.correct	
826
	je	.correct	
813
	
827
	
814
	shl	eax,16
828
	shl	eax,16
815
	shr	eax,16
829
	shr	eax,16
816
	mov	ebx,sb_m_pos_2
830
	mov	ebx,sb_m_pos_2
817
	shl	ebx,16
831
	shl	ebx,16
818
	shr	ebx,16
832
	shr	ebx,16
819
	cmp	eax,ebx
833
	cmp	eax,ebx
820
	jb	.sub
834
	jb	.sub
821
	
835
	
822
	sub	eax,ebx
836
	sub	eax,ebx
823
	mov	ebx,eax
837
	mov	ebx,eax
824
	add	sb_position2,ebx
838
	add	sb_position2,ebx
825
	xor	eax,eax
839
	xor	eax,eax
826
	mov	ax,sb_size_y
840
	mov	ax,sb_size_y
827
	sub	eax,sb_btn_high
841
	sub	eax,sb_btn_high
828
	sub	eax,sb_btn_high
842
	sub	eax,sb_btn_high
829
	sub	eax,sb_run_size
843
	sub	eax,sb_run_size
830
	cmp	sb_position2,eax
844
	cmp	sb_position2,eax
831
	jbe	@f
845
	jbe	@f
832
	
846
	
833
	mov	sb_position2,eax
847
	mov	sb_position2,eax
834
@@:
848
@@:
835
	mov	eax,sb_m_pos
849
	mov	eax,sb_m_pos
836
	mov	sb_m_pos_2,eax
850
	mov	sb_m_pos_2,eax
837
	pop	eax
851
	pop	eax
838
	call	.draw_1
852
	call	.draw_1
839
	jmp	.no_runner_1
853
	jmp	.no_runner_1
840
	
854
	
841
.correct:
855
.correct:
842
	pop	eax
856
	pop	eax
843
	jmp	.exit_sb
857
	jmp	.exit_sb
844
.correct_1:
858
.correct_1:
845
	mov	sb_delta,dword 0
859
	mov	sb_delta,dword 0
846
	jmp	.exit_sb
860
	jmp	.exit_sb
847
 
861
 
848
.sub:
862
.sub:
849
	sub	ebx,eax
863
	sub	ebx,eax
850
	sub	sb_position2,ebx
864
	sub	sb_position2,ebx
851
	test	sb_position2,dword 0x80000000
865
	test	sb_position2,dword 0x80000000
852
	jz	@f
866
	jz	@f
853
	
867
	
854
	mov	sb_position2,dword 0
868
	mov	sb_position2,dword 0
855
@@:
869
@@:
856
	mov	eax,sb_m_pos
870
	mov	eax,sb_m_pos
857
	mov	sb_m_pos_2,eax
871
	mov	sb_m_pos_2,eax
858
	pop	eax
872
	pop	eax
859
	call	.draw_1
873
	call	.draw_1
860
	jmp	.no_runner_1
874
	jmp	.no_runner_1
861
 
875
 
862
;*****************************************************************************
876
;*****************************************************************************
863
.no_runner:
877
.no_runner:
864
	mov	sb_delta,dword 0
878
	mov	sb_delta,dword 0
865
.no_runner_1:
879
.no_runner_1:
866
	xor	ecx,ecx
880
	xor	ecx,ecx
867
	mov	cx,sb_start_y
881
	mov	cx,sb_start_y
868
	add	cx,sb_btn_high	;15
882
	add	cx,sb_btn_high	;15
869
	cmp	word sb_delta,1
883
	cmp	word sb_delta,1
870
	je	.scroll_sb
884
	je	.scroll_sb
871
	
885
	
872
	cmp	ax,cx
886
	cmp	ax,cx
873
	ja	.scroll_sb
887
	ja	.scroll_sb
874
	
888
	
875
	cmp	dword sb_m_keys,0
889
	cmp	dword sb_m_keys,0
876
	je	.exit_sb
890
	je	.exit_sb
877
	
891
	
878
	mov	eax,sb_ar_offset
892
	mov	eax,sb_ar_offset
879
	cmp	sb_position,eax  ;dword 0
893
	cmp	sb_position,eax  ;dword 0
880
	jbe	@f
894
	jbe	@f
881
	
895
	
882
	sub	sb_position,eax
896
	sub	sb_position,eax
883
	jmp	.all_sb
897
	jmp	.all_sb
884
@@:
898
@@:
885
	xor	eax,eax
899
	xor	eax,eax
886
	mov	sb_position,eax ;dword 0
900
	mov	sb_position,eax ;dword 0
887
	mov	sb_position2,eax ;dword 0
901
	mov	sb_position2,eax ;dword 0
888
	jmp	.all_sb
902
	jmp	.all_sb
889
;*****************************************************************************
903
;*****************************************************************************
890
.scroll_sb:
904
.scroll_sb:
891
	add	cx,sb_size_y
905
	add	cx,sb_size_y
892
	sub	cx,sb_btn_high
906
	sub	cx,sb_btn_high
893
	sub	cx,sb_btn_high
907
	sub	cx,sb_btn_high
894
	cmp	word sb_delta,1
908
	cmp	word sb_delta,1
895
	je	@f
909
	je	@f
896
	
910
	
897
	cmp	ax,cx
911
	cmp	ax,cx
898
	ja	.down_sb
912
	ja	.down_sb
899
	
913
	
900
@@:
914
@@:
901
	mov	ebx,sb_btn_high	;16  ;15
915
	mov	ebx,sb_btn_high	;16  ;15
902
	add	bx,sb_start_y
916
	add	bx,sb_start_y
903
	sub	cx,bx
917
	sub	cx,bx
904
	sub	ax,bx
918
	sub	ax,bx
905
	
919
	
906
.scroll_sb_1:	
920
.scroll_sb_1:	
907
	mov	ebx,sb_run_size
921
	mov	ebx,sb_run_size
908
;*****************************************************************************	
922
;*****************************************************************************	
909
	cmp	word sb_delta,1
923
	cmp	word sb_delta,1
910
	je	.continue
924
	je	.continue
911
	
925
	
912
@@:
926
@@:
913
	mov	edx,eax
927
	mov	edx,eax
914
	push	ebx
928
	push	ebx
915
	shr	ebx,1 
929
	shr	ebx,1 
916
	sub	edx,ebx
930
	sub	edx,ebx
917
	pop	ebx
931
	pop	ebx
918
	mov	sb_position2,edx
932
	mov	sb_position2,edx
919
	test	sb_position2,dword 0x80000000
933
	test	sb_position2,dword 0x80000000
920
	jz	.test_1
934
	jz	.test_1
921
	
935
	
922
	mov	sb_position2,dword 0
936
	mov	sb_position2,dword 0
923
	jmp	.continue
937
	jmp	.continue
924
	
938
	
925
.test_1: 
939
.test_1: 
926
	xor	edx,edx
940
	xor	edx,edx
927
	mov	dx,sb_size_y
941
	mov	dx,sb_size_y
928
	sub	edx,sb_btn_high
942
	sub	edx,sb_btn_high
929
	sub	edx,sb_btn_high
943
	sub	edx,sb_btn_high
930
	sub	edx,sb_run_size
944
	sub	edx,sb_run_size
931
	cmp	sb_position2,edx
945
	cmp	sb_position2,edx
932
	jbe	.continue
946
	jbe	.continue
933
	
947
	
934
	mov	sb_position2,edx
948
	mov	sb_position2,edx
935
 
949
 
936
.continue:	
950
.continue:	
937
	mov	eax,sb_position2
951
	mov	eax,sb_position2
938
	sub	ecx,ebx
952
	sub	ecx,ebx
939
.continue_1:
953
.continue_1:
940
;*****************************************************************************  
954
;*****************************************************************************  
941
	mov	ebx,eax
955
	mov	ebx,eax
942
 
956
 
943
	mov	eax,sb_max_area
957
	mov	eax,sb_max_area
944
	cmp	eax,sb_cur_area
958
	cmp	eax,sb_cur_area
945
	ja	@f
959
	ja	@f
946
 
960
 
947
	xor	eax,eax
961
	xor	eax,eax
948
	inc	eax
962
	inc	eax
949
	mov	sb_position2,eax
963
	mov	sb_position2,eax
950
	jmp	.all_sb
964
	jmp	.all_sb
951
@@:
965
@@:
952
	sub	eax,sb_cur_area
966
	sub	eax,sb_cur_area
953
	inc	eax
967
	inc	eax
954
	shl	eax,10
968
	shl	eax,10
955
	xor	edx,edx
969
	xor	edx,edx
956
	div	ecx
970
	div	ecx
957
	shl	edx,1
971
	shl	edx,1
958
	cmp	edx,ecx
972
	cmp	edx,ecx
959
	jb	@f
973
	jb	@f
960
	
974
	
961
	inc	eax
975
	inc	eax
962
	
976
	
963
@@:
977
@@:
964
	imul	eax,ebx
978
	imul	eax,ebx
965
	shr	eax,10
979
	shr	eax,10
966
	
980
	
967
	cmp	sb_position,eax
981
	cmp	sb_position,eax
968
	je	.exit_sb
982
	je	.exit_sb
969
	
983
	
970
	cmp	eax,0
984
	cmp	eax,0
971
	ja	@f
985
	ja	@f
972
	
986
	
973
	xor	eax,eax
987
	xor	eax,eax
974
	
988
	
975
@@:
989
@@:
976
.store_position:
990
.store_position:
-
 
991
	mov	edx,sb_max_area
-
 
992
	sub	edx,sb_cur_area
-
 
993
	cmp	edx,eax
-
 
994
	ja	@f
-
 
995
 
-
 
996
	mov	sb_position,edx
-
 
997
	jmp	.all_sb
-
 
998
 
-
 
999
@@:
977
	mov	sb_position,eax
1000
	mov	sb_position,eax
978
.all_sb:
1001
.all_sb:
979
	mov	sb_redraw,dword 1
1002
	mov	sb_redraw,dword 1
980
	call	.draw_1
1003
	call	.draw_1
981
	mov	eax,sb_m_pos
1004
	mov	eax,sb_m_pos
982
	mov	sb_m_pos_2,eax
1005
	mov	sb_m_pos_2,eax
983
	jmp	.exit_sb
1006
	jmp	.exit_sb
984
;*****************************************************************************
1007
;*****************************************************************************
985
.down_sb:
1008
.down_sb:
986
	cmp	dword sb_m_keys,0
1009
	cmp	dword sb_m_keys,0
987
	je	.exit_sb
1010
	je	.exit_sb
988
	
1011
	
989
	mov	eax,sb_max_area
1012
	mov	eax,sb_max_area
990
	mov	ebx,sb_ar_offset
1013
	mov	ebx,sb_ar_offset
991
	sub	eax,sb_cur_area
1014
	sub	eax,sb_cur_area
992
	push	eax
1015
	push	eax
993
	sub	eax,ebx
1016
	sub	eax,ebx
994
	cmp	sb_position,eax
1017
	cmp	sb_position,eax
995
	pop	eax
1018
	pop	eax
996
	jae	@f
1019
	jae	@f
997
	
1020
	
998
	add	sb_position,ebx
1021
	add	sb_position,ebx
999
	jmp	.all_sb
1022
	jmp	.all_sb
1000
@@:
1023
@@:
1001
	mov	sb_position,eax
1024
	mov	sb_position,eax
1002
	xor	eax,eax
1025
	xor	eax,eax
1003
	mov	ax,sb_size_y
1026
	mov	ax,sb_size_y
1004
	sub	eax,sb_btn_high
1027
	sub	eax,sb_btn_high
1005
	sub	eax,sb_btn_high
1028
	sub	eax,sb_btn_high
1006
	sub	eax,sb_run_size
1029
	sub	eax,sb_run_size
1007
	mov	sb_position2,eax
1030
	mov	sb_position2,eax
1008
	jmp	.all_sb	
1031
	jmp	.all_sb	
1009
.exit_sb:	
1032
.exit_sb:	
1010
scroll_bar_exit
1033
scroll_bar_exit
1011
}
1034
}
1012
 
1035
 
1013
;*****************************************************************************
1036
;*****************************************************************************
1014
;*****************************************************************************
1037
;*****************************************************************************
1015
;*****************************************************************************
1038
;*****************************************************************************
1016
;*****************************************************************************
1039
;*****************************************************************************
1017
;*****************************************************************************
1040
;*****************************************************************************
1018
macro use_scroll_bar_horizontal
1041
macro use_scroll_bar_horizontal
1019
{
1042
{
1020
scroll_bar_horizontal:
1043
scroll_bar_horizontal:
1021
.draw:
1044
.draw:
1022
	pusha
1045
	pusha
1023
	mov	edi,dword [esp+36]
1046
	mov	edi,dword [esp+36]
1024
	mov	sb_delta,word 0
1047
	mov	sb_delta,word 0
1025
	call	.draw_1
1048
	call	.draw_1
1026
	mov	sb_all_redraw,dword 0
1049
	mov	sb_all_redraw,dword 0
1027
scroll_bar_exit
1050
scroll_bar_exit
1028
.draw_1:
1051
.draw_1:
1029
	pusha
1052
	pusha
1030
;*********************************
1053
;*********************************
1031
	xor	eax,eax
1054
	xor	eax,eax
1032
	mov	ax,sb_size_x	;sb_size_y
1055
	mov	ax,sb_size_x	;sb_size_y
1033
	mov	edx,sb_btn_high
1056
	mov	edx,sb_btn_high
1034
	shl	edx,1
1057
	shl	edx,1
1035
	sub	eax,edx
1058
	sub	eax,edx
1036
	mov	sb_work_size,eax
1059
	mov	sb_work_size,eax
1037
;*********************************
1060
;*********************************
1038
	mov	eax,sb_work_size	;sb_max_area
1061
	mov	eax,sb_work_size	;sb_max_area
1039
	mov	ebx,sb_max_area
1062
	mov	ebx,sb_max_area
1040
	cmp	ebx,sb_cur_area
1063
	cmp	ebx,sb_cur_area
1041
	ja	@f
1064
	ja	@f
1042
 
1065
 
1043
	jmp	.no_size
1066
	jmp	.no_size
1044
 
1067
 
1045
@@: 
1068
@@: 
1046
	imul	eax,sb_cur_area
1069
	imul	eax,sb_cur_area
1047
	xor	edx,edx
1070
	xor	edx,edx
1048
	div	ebx
1071
	div	ebx
-
 
1072
	shl	edx,1
-
 
1073
	cmp	edx,ebx
-
 
1074
	jb	@f
-
 
1075
	
-
 
1076
	inc	eax
-
 
1077
	
-
 
1078
@@:
1049
	cmp	eax,10
1079
	cmp	eax,10
1050
	jae	@f
1080
	jae	@f
1051
	mov	eax,10
1081
	mov	eax,10
1052
@@:
1082
@@:
1053
.no_size:
1083
.no_size:
1054
	mov	sb_run_size,eax
1084
	mov	sb_run_size,eax
1055
;*********************************
1085
;*********************************
1056
	cmp	word sb_delta,1
1086
	cmp	word sb_delta,1
1057
	je	.@@_3
1087
	je	.@@_3
1058
	mov	eax,sb_work_size
1088
	mov	eax,sb_work_size
1059
	sub	eax,sb_run_size
1089
	sub	eax,sb_run_size
1060
	mov	ebx,sb_max_area
1090
	mov	ebx,sb_max_area
1061
	cmp	ebx,sb_cur_area
1091
	cmp	ebx,sb_cur_area
1062
	ja	@f
1092
	ja	@f
1063
	xor	eax,eax
1093
	xor	eax,eax
1064
	jmp	.@@_1
1094
	jmp	.@@_1
1065
@@:
1095
@@:
1066
	sub	ebx,sb_cur_area
1096
	sub	ebx,sb_cur_area
1067
	imul	eax,sb_position
1097
	imul	eax,sb_position
1068
	xor	edx,edx
1098
	xor	edx,edx
1069
	div	ebx
1099
	div	ebx
-
 
1100
	shl	edx,1
-
 
1101
	cmp	edx,ebx
-
 
1102
	jb	@f
-
 
1103
	
-
 
1104
	inc	eax
-
 
1105
	
-
 
1106
@@:
1070
.@@_1:
1107
.@@_1:
1071
	mov	sb_position2,eax
1108
	mov	sb_position2,eax
1072
	xor	edx,edx
1109
	xor	edx,edx
1073
	mov	dx,sb_size_x
1110
	mov	dx,sb_size_x
1074
	sub	edx,sb_btn_high
1111
	sub	edx,sb_btn_high
1075
	sub	edx,sb_btn_high
1112
	sub	edx,sb_btn_high
1076
	sub	edx,sb_run_size
1113
	sub	edx,sb_run_size
1077
	cmp	sb_position2,edx
1114
	cmp	sb_position2,edx
1078
	jbe	.@@_3
1115
	jbe	.@@_3
1079
	mov	sb_position2,edx
1116
	mov	sb_position2,edx
1080
.@@_3:
1117
.@@_3:
1081
;*********************************	
1118
;*********************************	
1082
	mov	ebx,sb_size_x
1119
	mov	ebx,sb_size_x
1083
	mov	ecx,sb_start_y
1120
	mov	ecx,sb_start_y
1084
	shl	ecx,16
1121
	shl	ecx,16
1085
	inc	ecx	
1122
	inc	ecx	
1086
	mov	edx,sb_line_col
1123
	mov	edx,sb_line_col
1087
	mov	eax,13
1124
	mov	eax,13
1088
	cmp	dword sb_all_redraw,0
1125
	cmp	dword sb_all_redraw,0
1089
	je	@f
1126
	je	@f
1090
	int	0x40	; top extreme line
1127
	int	0x40	; top extreme line
1091
@@:
1128
@@:
1092
	push	ecx
1129
	push	ecx
1093
	ror	ecx,16
1130
	ror	ecx,16
1094
	add	cx,sb_size_y
1131
	add	cx,sb_size_y
1095
	rol	ecx,16
1132
	rol	ecx,16
1096
	cmp	dword sb_all_redraw,0
1133
	cmp	dword sb_all_redraw,0
1097
	je	@f
1134
	je	@f
1098
	int	0x40	; bottom extreme line
1135
	int	0x40	; bottom extreme line
1099
@@:
1136
@@:
1100
	pop	ecx
1137
	pop	ecx
1101
 
1138
 
1102
	push	ebx
1139
	push	ebx
1103
	
1140
	
1104
	add	ecx,1 shl 16
1141
	add	ecx,1 shl 16
1105
	mov	cx,sb_size_y
1142
	mov	cx,sb_size_y
1106
	dec	ecx	
1143
	dec	ecx	
1107
	mov	bx,1
1144
	mov	bx,1
1108
	cmp	dword sb_all_redraw,0
1145
	cmp	dword sb_all_redraw,0
1109
	je	@f
1146
	je	@f
1110
	int	0x40	; left button - extreme line
1147
	int	0x40	; left button - extreme line
1111
@@:
1148
@@:
1112
	push	ebx
1149
	push	ebx
1113
	add	ebx,1 shl 16
1150
	add	ebx,1 shl 16
1114
	add	ebx,sb_btn_high
1151
	add	ebx,sb_btn_high
1115
	sub	ebx,2
1152
	sub	ebx,2
1116
	mov	edx,sb_frnt_col
1153
	mov	edx,sb_frnt_col
1117
	cmp	dword sb_all_redraw,0
1154
	cmp	dword sb_all_redraw,0
1118
	je	.no_draw_top_button
1155
	je	.no_draw_top_button
1119
	int	0x40	; left  button filling
1156
	int	0x40	; left  button filling
1120
;-----------------------------------------------------------------------------
1157
;-----------------------------------------------------------------------------
1121
; scrollbar type 2
1158
; scrollbar type 2
1122
	cmp	word sb_type,2
1159
	cmp	word sb_type,2
1123
	jne	.no_type2
1160
	jne	.no_type2
1124
;*********************************
1161
;*********************************
1125
draw_up_arrow_horizontal_type2
1162
draw_up_arrow_horizontal_type2
1126
;*********************************
1163
;*********************************
1127
	jmp	.no_draw_top_button
1164
	jmp	.no_draw_top_button
1128
.no_type2:
1165
.no_type2:
1129
;*********************************	
1166
;*********************************	
1130
draw_up_arrow_horizontal
1167
draw_up_arrow_horizontal
1131
;********************************* 
1168
;********************************* 
1132
.no_draw_top_button:
1169
.no_draw_top_button:
1133
	pop	ebx
1170
	pop	ebx
1134
	
1171
	
1135
	ror	ebx,16
1172
	ror	ebx,16
1136
	add	ebx,sb_btn_high  ;14 shl 16
1173
	add	ebx,sb_btn_high  ;14 shl 16
1137
	rol	ebx,16
1174
	rol	ebx,16
1138
	mov	edx,sb_line_col
1175
	mov	edx,sb_line_col
1139
	cmp	dword sb_all_redraw,0
1176
	cmp	dword sb_all_redraw,0
1140
	je	@f
1177
	je	@f
1141
	mcall	13	;  left  button - right line
1178
	mcall	13	;  left  button - right line
1142
@@:
1179
@@:
1143
	pop	ebx
1180
	pop	ebx
1144
;********************************* 
1181
;********************************* 
1145
	ror	ebx,16	
1182
	ror	ebx,16	
1146
	add	ebx,sb_btn_high  ;15 shl 16
1183
	add	ebx,sb_btn_high  ;15 shl 16
1147
	inc	ebx
1184
	inc	ebx
1148
	rol	ebx,16
1185
	rol	ebx,16
1149
	sub	ebx,sb_btn_high  ;30
1186
	sub	ebx,sb_btn_high  ;30
1150
	sub	ebx,sb_btn_high
1187
	sub	ebx,sb_btn_high
1151
	push	ebx
1188
	push	ebx
1152
	mov	bx,0
1189
	mov	bx,0
1153
	add	ebx,sb_position2
1190
	add	ebx,sb_position2
1154
	dec	bx
1191
	dec	bx
1155
	mov	eax,13
1192
	mov	eax,13
1156
	test	bx,0x8000
1193
	test	bx,0x8000
1157
	jnz	@f
1194
	jnz	@f
1158
	mov	edx,sb_bckg_col
1195
	mov	edx,sb_bckg_col
1159
	int	0x40	; left interval
1196
	int	0x40	; left interval
1160
@@:
1197
@@:
1161
;********************************* 
1198
;********************************* 
1162
	shr	ebx,16
1199
	shr	ebx,16
1163
	add	ebx,sb_position2
1200
	add	ebx,sb_position2
1164
	dec	ebx
1201
	dec	ebx
1165
	shl	ebx,16
1202
	shl	ebx,16
1166
	inc	ebx
1203
	inc	ebx
1167
	mov	edx,sb_line_col
1204
	mov	edx,sb_line_col
1168
	int	0x40	; runner - left extreme line
1205
	int	0x40	; runner - left extreme line
1169
	
1206
	
1170
	add	ebx,1 shl 16
1207
	add	ebx,1 shl 16
1171
	mov	bx,0
1208
	mov	bx,0
1172
	add	ebx,sb_run_size
1209
	add	ebx,sb_run_size
1173
	mov	sb_r_size_x,ebx
1210
	mov	sb_r_size_x,ebx
1174
	mov	sb_r_size_y,ecx
1211
	mov	sb_r_size_y,ecx
1175
	sub	ebx,2
1212
	sub	ebx,2
1176
	mov	edx,sb_frnt_col
1213
	mov	edx,sb_frnt_col
1177
	int	0x40	; runner filling
1214
	int	0x40	; runner filling
1178
;-----------------------------------------------------------------------------
1215
;-----------------------------------------------------------------------------
1179
; scrollbar type 2
1216
; scrollbar type 2
1180
	cmp	word sb_type,2
1217
	cmp	word sb_type,2
1181
	je	@f
1218
	je	@f
1182
;*********************************
1219
;*********************************
1183
draw_runner_center_horizontal
1220
draw_runner_center_horizontal
1184
;********************************* 
1221
;********************************* 
1185
@@:	
1222
@@:	
1186
;-----------------------------------------------------------------------------
1223
;-----------------------------------------------------------------------------
1187
; scrollbar type 1 - stylish frame
1224
; scrollbar type 1 - stylish frame
1188
	cmp	word sb_type,1
1225
	cmp	word sb_type,1
1189
	jne	@f
1226
	jne	@f
1190
	push	eax ebx ecx edx
1227
	push	eax ebx ecx edx
1191
	xor	eax,eax
1228
	xor	eax,eax
1192
	add	ax,sb_r_start_x
1229
	add	ax,sb_r_start_x
1193
	dec	eax
1230
	dec	eax
1194
	movzx	ebx,word sb_start_y
1231
	movzx	ebx,word sb_start_y
1195
	mov	ecx,sb_run_size
1232
	mov	ecx,sb_run_size
1196
	dec	ecx
1233
	dec	ecx
1197
	movzx	edx,word sb_size_y
1234
	movzx	edx,word sb_size_y
1198
	; drawing a stylish frame on the slider
1235
	; drawing a stylish frame on the slider
1199
	stdcall	draw_edge,eax,ebx,ecx,edx,\
1236
	stdcall	draw_edge,eax,ebx,ecx,edx,\
1200
		sb_bckg_col,sb_frnt_col,sb_line_col
1237
		sb_bckg_col,sb_frnt_col,sb_line_col
1201
	pop	edx ecx ebx eax
1238
	pop	edx ecx ebx eax
1202
@@:
1239
@@:
1203
;-----------------------------------------------------------------------------
1240
;-----------------------------------------------------------------------------
1204
	shr	ebx,16
1241
	shr	ebx,16
1205
	add	ebx,sb_run_size
1242
	add	ebx,sb_run_size
1206
	sub	ebx,2
1243
	sub	ebx,2
1207
	shl	ebx,16  
1244
	shl	ebx,16  
1208
	inc	ebx
1245
	inc	ebx
1209
	mov	edx,sb_line_col
1246
	mov	edx,sb_line_col
1210
	int	0x40	; runner - bottom extreme line
1247
	int	0x40	; runner - bottom extreme line
1211
	
1248
	
1212
	add	ebx,1 shl 16
1249
	add	ebx,1 shl 16
1213
	mov	bx,sb_start_x
1250
	mov	bx,sb_start_x
1214
	add	bx,sb_size_x
1251
	add	bx,sb_size_x
1215
	sub	ebx,sb_btn_high
1252
	sub	ebx,sb_btn_high
1216
	dec	ebx
1253
	dec	ebx
1217
	mov	eax,ebx
1254
	mov	eax,ebx
1218
	shr	eax,16
1255
	shr	eax,16
1219
	sub	bx,ax
1256
	sub	bx,ax
1220
	test	bx,0x8000
1257
	test	bx,0x8000
1221
	jnz	@f
1258
	jnz	@f
1222
	mov	edx,sb_bckg_col
1259
	mov	edx,sb_bckg_col
1223
	mov	eax,13
1260
	mov	eax,13
1224
	int	0x40	; bottom interval
1261
	int	0x40	; bottom interval
1225
@@:
1262
@@:
1226
	pop	ebx	
1263
	pop	ebx	
1227
;*********************************	
1264
;*********************************	
1228
	mov	ax,bx
1265
	mov	ax,bx
1229
	shr	ebx,16
1266
	shr	ebx,16
1230
	add	bx,ax
1267
	add	bx,ax
1231
	sub	ebx,2
1268
	sub	ebx,2
1232
	shl	ebx,16
1269
	shl	ebx,16
1233
	inc	ebx
1270
	inc	ebx
1234
	mov	edx,sb_line_col
1271
	mov	edx,sb_line_col
1235
	mov	eax,13
1272
	mov	eax,13
1236
	cmp	dword sb_all_redraw,0
1273
	cmp	dword sb_all_redraw,0
1237
	je	@f
1274
	je	@f
1238
	int	0x40	; bottom button - top line
1275
	int	0x40	; bottom button - top line
1239
@@:
1276
@@:
1240
	push	ebx
1277
	push	ebx
1241
	add	ebx,1 shl 16
1278
	add	ebx,1 shl 16
1242
	add	bx,sb_btn_high
1279
	add	bx,sb_btn_high
1243
	sub	ebx,2
1280
	sub	ebx,2
1244
	mov	edx,sb_frnt_col
1281
	mov	edx,sb_frnt_col
1245
	cmp	dword sb_all_redraw,0
1282
	cmp	dword sb_all_redraw,0
1246
	je	.no_draw_bottom_button
1283
	je	.no_draw_bottom_button
1247
	int	0x40	; bottom button filling
1284
	int	0x40	; bottom button filling
1248
;-----------------------------------------------------------------------------
1285
;-----------------------------------------------------------------------------
1249
; scrollbar type 2
1286
; scrollbar type 2
1250
	cmp	word sb_type,2
1287
	cmp	word sb_type,2
1251
	jne	.no_type2_1
1288
	jne	.no_type2_1
1252
;*********************************
1289
;*********************************
1253
draw_down_arrow_horizontal_type2
1290
draw_down_arrow_horizontal_type2
1254
;*********************************
1291
;*********************************
1255
	jmp	.no_draw_bottom_button
1292
	jmp	.no_draw_bottom_button
1256
.no_type2_1:
1293
.no_type2_1:
1257
;********************************* 
1294
;********************************* 
1258
draw_down_arrow_horizontal
1295
draw_down_arrow_horizontal
1259
;*********************************
1296
;*********************************
1260
.no_draw_bottom_button: 
1297
.no_draw_bottom_button: 
1261
	pop	ebx
1298
	pop	ebx
1262
	
1299
	
1263
	ror	ebx,16
1300
	ror	ebx,16
1264
	add	ebx,sb_btn_high  ;14 shl 16
1301
	add	ebx,sb_btn_high  ;14 shl 16
1265
	rol	ebx,16
1302
	rol	ebx,16
1266
	
1303
	
1267
	mov	edx,sb_line_col
1304
	mov	edx,sb_line_col
1268
	mov	bx,1
1305
	mov	bx,1
1269
	cmp	dword sb_all_redraw,0
1306
	cmp	dword sb_all_redraw,0
1270
	je	@f
1307
	je	@f
1271
	mcall	13	; bottom button - extreme line
1308
	mcall	13	; bottom button - extreme line
1272
;-----------------------------------------------------------------------------
1309
;-----------------------------------------------------------------------------
1273
; scrollbar type 1 - stylish frame
1310
; scrollbar type 1 - stylish frame
1274
	cmp	word sb_type,1
1311
	cmp	word sb_type,1
1275
	jne	@f
1312
	jne	@f
1276
	; drawing a stylish frame on the left button
1313
	; drawing a stylish frame on the left button
1277
	movzx	eax,word sb_start_x
1314
	movzx	eax,word sb_start_x
1278
	movzx	ebx,word sb_start_y
1315
	movzx	ebx,word sb_start_y
1279
	movzx	edx,word sb_size_y
1316
	movzx	edx,word sb_size_y
1280
	stdcall	draw_edge,eax,ebx,sb_btn_high,edx,\
1317
	stdcall	draw_edge,eax,ebx,sb_btn_high,edx,\
1281
		sb_bckg_col,sb_frnt_col,sb_line_col
1318
		sb_bckg_col,sb_frnt_col,sb_line_col
1282
	
1319
	
1283
	movzx	eax,word sb_start_x
1320
	movzx	eax,word sb_start_x
1284
	add	ax,sb_size_x
1321
	add	ax,sb_size_x
1285
	sub	eax,sb_btn_high
1322
	sub	eax,sb_btn_high
1286
	dec	eax
1323
	dec	eax
1287
	; drawing a stylish frame on the right button
1324
	; drawing a stylish frame on the right button
1288
	stdcall	draw_edge,eax,ebx,sb_btn_high,edx,\
1325
	stdcall	draw_edge,eax,ebx,sb_btn_high,edx,\
1289
		sb_bckg_col,sb_frnt_col,sb_line_col
1326
		sb_bckg_col,sb_frnt_col,sb_line_col
1290
@@:
1327
@@:
1291
;-----------------------------------------------------------------------------
1328
;-----------------------------------------------------------------------------
1292
	popa
1329
	popa
1293
	ret
1330
	ret
1294
;*****************************************************************************
1331
;*****************************************************************************
1295
; mouse event
1332
; mouse event
1296
;*****************************************************************************
1333
;*****************************************************************************
1297
.mouse:
1334
.mouse:
1298
	pusha
1335
	pusha
1299
	mov	 edi,dword [esp+36]
1336
	mov	 edi,dword [esp+36]
1300
	mcall	37,1
1337
	mcall	37,1
1301
	mov	sb_m_pos,eax
1338
	mov	sb_m_pos,eax
1302
	cmp	dword sb_m_pos_2,0
1339
	cmp	dword sb_m_pos_2,0
1303
	jne	@f
1340
	jne	@f
1304
	
1341
	
1305
	mov	sb_m_pos_2,eax	
1342
	mov	sb_m_pos_2,eax	
1306
@@:
1343
@@:
1307
	mcall	37,2
1344
	mcall	37,2
1308
	mov	sb_m_keys,eax	
1345
	mov	sb_m_keys,eax	
1309
 
1346
 
1310
	cmp	sb_m_keys,eax
1347
	cmp	sb_m_keys,eax
1311
	je	@f
1348
	je	@f
1312
	
1349
	
1313
	mov	sb_m_keys,eax
1350
	mov	sb_m_keys,eax
1314
 
1351
 
1315
	mov	sb_delta,dword 0
1352
	mov	sb_delta,dword 0
1316
	
1353
	
1317
	mov	eax,sb_m_pos
1354
	mov	eax,sb_m_pos
1318
	mov	sb_m_pos_2,eax
1355
	mov	sb_m_pos_2,eax
1319
	jmp	.continue_2
1356
	jmp	.continue_2
1320
	
1357
	
1321
@@:
1358
@@:
1322
	cmp	dword sb_m_keys,0
1359
	cmp	dword sb_m_keys,0
1323
	jne	 @f
1360
	jne	 @f
1324
	mov	eax,sb_m_pos
1361
	mov	eax,sb_m_pos
1325
	mov	sb_m_pos_2,eax
1362
	mov	sb_m_pos_2,eax
1326
	jmp	.correct_1	;.exit_sb
1363
	jmp	.correct_1	;.exit_sb
1327
@@:
1364
@@:
1328
	mov	sb_delta,word 1
1365
	mov	sb_delta,word 1
1329
 
1366
 
1330
.continue_2:
1367
.continue_2:
1331
	mov	eax,sb_m_pos
1368
	mov	eax,sb_m_pos
1332
	test	eax,0x80000000
1369
	test	eax,0x80000000
1333
	jnz	.exit_sb
1370
	jnz	.exit_sb
1334
	
1371
	
1335
	test	eax,0x8000
1372
	test	eax,0x8000
1336
	jnz	.exit_sb
1373
	jnz	.exit_sb
1337
	
1374
	
1338
	mov	ebx,eax
1375
	mov	ebx,eax
1339
	shr	eax,16	; x position
1376
	shr	eax,16	; x position
1340
	shl	ebx,16
1377
	shl	ebx,16
1341
	shr	ebx,16	; y position
1378
	shr	ebx,16	; y position
1342
 
1379
 
1343
	mov	cx,sb_start_x	;y
1380
	mov	cx,sb_start_x	;y
1344
	cmp	ax,cx
1381
	cmp	ax,cx
1345
	jb	.exit_sb
1382
	jb	.exit_sb
1346
	
1383
	
1347
	cmp	word sb_delta2,0
1384
	cmp	word sb_delta2,0
1348
	je	@f
1385
	je	@f
1349
	push	ecx
1386
	push	ecx
1350
	add	cx,sb_btn_high
1387
	add	cx,sb_btn_high
1351
	cmp	ax,cx
1388
	cmp	ax,cx
1352
	pop	ecx
1389
	pop	ecx
1353
	jb	.exit_sb
1390
	jb	.exit_sb
1354
	
1391
	
1355
@@:
1392
@@:
1356
	add	cx,sb_size_x	;y
1393
	add	cx,sb_size_x	;y
1357
	cmp	ax,cx
1394
	cmp	ax,cx
1358
	ja	.exit_sb
1395
	ja	.exit_sb
1359
 
1396
 
1360
	cmp	word sb_delta2,0
1397
	cmp	word sb_delta2,0
1361
	je	@f
1398
	je	@f
1362
	sub	cx,sb_btn_high
1399
	sub	cx,sb_btn_high
1363
	cmp	ax,cx
1400
	cmp	ax,cx
1364
	ja	.exit_sb
1401
	ja	.exit_sb
1365
	
1402
	
1366
@@:
1403
@@:
1367
	cmp	word sb_delta2,1
1404
	cmp	word sb_delta2,1
1368
	je	@f
1405
	je	@f
1369
	
1406
	
1370
	cmp	dword sb_m_keys,0
1407
	cmp	dword sb_m_keys,0
1371
	je	.exit_sb
1408
	je	.exit_sb
1372
	
1409
	
1373
	mov	cx,sb_start_y	;x
1410
	mov	cx,sb_start_y	;x
1374
	cmp	bx,cx
1411
	cmp	bx,cx
1375
	jb	.exit_sb
1412
	jb	.exit_sb
1376
	
1413
	
1377
	add	cx,sb_size_y	;x
1414
	add	cx,sb_size_y	;x
1378
	cmp	bx,cx
1415
	cmp	bx,cx
1379
	ja	.exit_sb
1416
	ja	.exit_sb
1380
	
1417
	
1381
	mov	cx,sb_r_start_x
1418
	mov	cx,sb_r_start_x
1382
	cmp	ax,cx
1419
	cmp	ax,cx
1383
	jb	.no_runner
1420
	jb	.no_runner
1384
	
1421
	
1385
	add	cx,sb_r_size_x
1422
	add	cx,sb_r_size_x
1386
	cmp	ax,cx
1423
	cmp	ax,cx
1387
	ja	.no_runner
1424
	ja	.no_runner
1388
 
1425
 
1389
	mov	sb_delta2,word 1
1426
	mov	sb_delta2,word 1
1390
@@:
1427
@@:
1391
	push	eax
1428
	push	eax
1392
	mov	eax,sb_m_pos
1429
	mov	eax,sb_m_pos
1393
	mov	ebx,sb_m_pos_2
1430
	mov	ebx,sb_m_pos_2
1394
	shr	eax,16
1431
	shr	eax,16
1395
	shr	ebx,16
1432
	shr	ebx,16
1396
	cmp	eax,ebx
1433
	cmp	eax,ebx
1397
	je	.correct	
1434
	je	.correct	
1398
	
1435
	
1399
;	shl	eax,16
1436
;	shl	eax,16
1400
;	shr	eax,16
1437
;	shr	eax,16
1401
;	mov	ebx,sb_m_pos_2
1438
;	mov	ebx,sb_m_pos_2
1402
;	shl	ebx,16
1439
;	shl	ebx,16
1403
;	shr	ebx,16
1440
;	shr	ebx,16
1404
;	cmp	eax,ebx
1441
;	cmp	eax,ebx
1405
	jb	.sub
1442
	jb	.sub
1406
	
1443
	
1407
	sub	eax,ebx
1444
	sub	eax,ebx
1408
	mov	ebx,eax
1445
	mov	ebx,eax
1409
	add	sb_position2,ebx
1446
	add	sb_position2,ebx
1410
	xor	eax,eax
1447
	xor	eax,eax
1411
	mov	ax,sb_size_x	;y
1448
	mov	ax,sb_size_x	;y
1412
	sub	eax,sb_btn_high
1449
	sub	eax,sb_btn_high
1413
	sub	eax,sb_btn_high
1450
	sub	eax,sb_btn_high
1414
	sub	eax,sb_run_size
1451
	sub	eax,sb_run_size
1415
	cmp	sb_position2,eax
1452
	cmp	sb_position2,eax
1416
	jbe	@f
1453
	jbe	@f
1417
	
1454
	
1418
	mov	sb_position2,eax
1455
	mov	sb_position2,eax
1419
@@:
1456
@@:
1420
	mov	eax,sb_m_pos
1457
	mov	eax,sb_m_pos
1421
	mov	sb_m_pos_2,eax
1458
	mov	sb_m_pos_2,eax
1422
	pop	eax
1459
	pop	eax
1423
	call	.draw_1
1460
	call	.draw_1
1424
	jmp	.no_runner_1
1461
	jmp	.no_runner_1
1425
	
1462
	
1426
.correct:
1463
.correct:
1427
	pop	eax
1464
	pop	eax
1428
	jmp	.exit_sb
1465
	jmp	.exit_sb
1429
.correct_1:
1466
.correct_1:
1430
	mov	sb_delta,dword 0
1467
	mov	sb_delta,dword 0
1431
	jmp	.exit_sb
1468
	jmp	.exit_sb
1432
 
1469
 
1433
.sub:
1470
.sub:
1434
	sub	ebx,eax
1471
	sub	ebx,eax
1435
	sub	sb_position2,ebx
1472
	sub	sb_position2,ebx
1436
	test	sb_position2,dword 0x80000000
1473
	test	sb_position2,dword 0x80000000
1437
	jz	@f
1474
	jz	@f
1438
	
1475
	
1439
	mov	sb_position2,dword 0
1476
	mov	sb_position2,dword 0
1440
@@:
1477
@@:
1441
	mov	eax,sb_m_pos
1478
	mov	eax,sb_m_pos
1442
	mov	sb_m_pos_2,eax
1479
	mov	sb_m_pos_2,eax
1443
	pop	eax
1480
	pop	eax
1444
	call	.draw_1
1481
	call	.draw_1
1445
	jmp	.no_runner_1
1482
	jmp	.no_runner_1
1446
 
1483
 
1447
;*****************************************************************************
1484
;*****************************************************************************
1448
.no_runner:
1485
.no_runner:
1449
	mov	sb_delta,dword 0
1486
	mov	sb_delta,dword 0
1450
.no_runner_1:
1487
.no_runner_1:
1451
	xor	ecx,ecx
1488
	xor	ecx,ecx
1452
	mov	cx,sb_start_x	;y
1489
	mov	cx,sb_start_x	;y
1453
	add	cx,sb_btn_high	;15
1490
	add	cx,sb_btn_high	;15
1454
	cmp	word sb_delta,1
1491
	cmp	word sb_delta,1
1455
	je	.scroll_sb
1492
	je	.scroll_sb
1456
	
1493
	
1457
	cmp	ax,cx
1494
	cmp	ax,cx
1458
	ja	.scroll_sb
1495
	ja	.scroll_sb
1459
	
1496
	
1460
	cmp	dword sb_m_keys,0
1497
	cmp	dword sb_m_keys,0
1461
	je	.exit_sb
1498
	je	.exit_sb
1462
	
1499
	
1463
	mov	eax,sb_ar_offset
1500
	mov	eax,sb_ar_offset
1464
	cmp	sb_position,eax  ;dword 0
1501
	cmp	sb_position,eax  ;dword 0
1465
	jbe	@f
1502
	jbe	@f
1466
	
1503
	
1467
	sub	sb_position,eax
1504
	sub	sb_position,eax
1468
	jmp	.all_sb
1505
	jmp	.all_sb
1469
@@:
1506
@@:
1470
	xor	eax,eax
1507
	xor	eax,eax
1471
	mov	sb_position,eax ;dword 0
1508
	mov	sb_position,eax ;dword 0
1472
	mov	sb_position2,eax  ;dword 0
1509
	mov	sb_position2,eax  ;dword 0
1473
	jmp	.all_sb
1510
	jmp	.all_sb
1474
;*****************************************************************************
1511
;*****************************************************************************
1475
.scroll_sb:
1512
.scroll_sb:
1476
	add	cx,sb_size_x	;y
1513
	add	cx,sb_size_x	;y
1477
	sub	cx,sb_btn_high
1514
	sub	cx,sb_btn_high
1478
	sub	cx,sb_btn_high
1515
	sub	cx,sb_btn_high
1479
	cmp	word sb_delta,1
1516
	cmp	word sb_delta,1
1480
	je	@f
1517
	je	@f
1481
	
1518
	
1482
	cmp	ax,cx
1519
	cmp	ax,cx
1483
	ja	.down_sb
1520
	ja	.down_sb
1484
	
1521
	
1485
@@:
1522
@@:
1486
	mov	ebx,sb_btn_high	;16  ;15
1523
	mov	ebx,sb_btn_high	;16  ;15
1487
	add	bx,sb_start_x	;y
1524
	add	bx,sb_start_x	;y
1488
	sub	cx,bx
1525
	sub	cx,bx
1489
	sub	ax,bx
1526
	sub	ax,bx
1490
	
1527
	
1491
.scroll_sb_1:	
1528
.scroll_sb_1:	
1492
	mov	ebx,sb_run_size
1529
	mov	ebx,sb_run_size
1493
;*****************************************************************************	
1530
;*****************************************************************************	
1494
	cmp	word sb_delta,1
1531
	cmp	word sb_delta,1
1495
	je	.continue
1532
	je	.continue
1496
	
1533
	
1497
@@:
1534
@@:
1498
	mov	edx,eax
1535
	mov	edx,eax
1499
 
1536
 
1500
	push	ebx
1537
	push	ebx
1501
	shr	ebx,1 
1538
	shr	ebx,1 
1502
	sub	edx,ebx
1539
	sub	edx,ebx
1503
	pop	ebx
1540
	pop	ebx
1504
	mov	sb_position2,edx
1541
	mov	sb_position2,edx
1505
	test	sb_position2,dword 0x80000000
1542
	test	sb_position2,dword 0x80000000
1506
	jz	 .test_1
1543
	jz	 .test_1
1507
	
1544
	
1508
	mov	sb_position2,dword 0
1545
	mov	sb_position2,dword 0
1509
	jmp	.continue
1546
	jmp	.continue
1510
	
1547
	
1511
.test_1: 
1548
.test_1: 
1512
	xor	edx,edx
1549
	xor	edx,edx
1513
	mov	dx,sb_size_x	 ;y
1550
	mov	dx,sb_size_x	 ;y
1514
	sub	edx,sb_btn_high
1551
	sub	edx,sb_btn_high
1515
	sub	edx,sb_btn_high
1552
	sub	edx,sb_btn_high
1516
	sub	edx,sb_run_size
1553
	sub	edx,sb_run_size
1517
	cmp	sb_position2,edx
1554
	cmp	sb_position2,edx
1518
	jbe	.continue
1555
	jbe	.continue
1519
	
1556
	
1520
	mov	sb_position2,edx
1557
	mov	sb_position2,edx
1521
 
1558
 
1522
.continue:	
1559
.continue:	
1523
	mov	eax,sb_position2
1560
	mov	eax,sb_position2
1524
	sub	ecx,ebx
1561
	sub	ecx,ebx
1525
.continue_1:
1562
.continue_1:
1526
;*****************************************************************************  
1563
;*****************************************************************************  
1527
	mov	ebx,eax
1564
	mov	ebx,eax
1528
 
1565
 
1529
	mov	eax,sb_max_area
1566
	mov	eax,sb_max_area
1530
	cmp	eax,sb_cur_area
1567
	cmp	eax,sb_cur_area
1531
	ja	@f
1568
	ja	@f
1532
 
1569
 
1533
	xor	eax,eax
1570
	xor	eax,eax
1534
	inc	eax
1571
	inc	eax
1535
	mov	sb_position2,eax
1572
	mov	sb_position2,eax
1536
	jmp	.all_sb
1573
	jmp	.all_sb
1537
@@:
1574
@@:
1538
	sub	eax,sb_cur_area
1575
	sub	eax,sb_cur_area
1539
	inc	eax
1576
	inc	eax
1540
	shl	eax,10
1577
	shl	eax,10
1541
	xor	edx,edx
1578
	xor	edx,edx
1542
	div	ecx
1579
	div	ecx
1543
	shl	edx,1
1580
	shl	edx,1
1544
	cmp	edx,ecx
1581
	cmp	edx,ecx
1545
	jb	@f
1582
	jb	@f
1546
	
1583
	
1547
	inc	eax
1584
	inc	eax
1548
	
1585
	
1549
@@:
1586
@@:
1550
	imul  eax,ebx
1587
	imul  eax,ebx
1551
	shr	eax,10
1588
	shr	eax,10
1552
	
1589
	
1553
	cmp	sb_position,eax
1590
	cmp	sb_position,eax
1554
	je	.exit_sb
1591
	je	.exit_sb
1555
	
1592
	
1556
	cmp	eax,0
1593
	cmp	eax,0
1557
	ja	@f
1594
	ja	@f
1558
	
1595
	
1559
	xor	eax,eax
1596
	xor	eax,eax
1560
	
1597
	
1561
@@:
1598
@@:
1562
.store_position:
1599
.store_position:
-
 
1600
	mov	edx,sb_max_area
-
 
1601
	sub	edx,sb_cur_area
-
 
1602
	cmp	edx,eax
-
 
1603
	ja	@f
-
 
1604
 
-
 
1605
	mov	sb_position,edx
-
 
1606
	jmp	.all_sb
-
 
1607
 
-
 
1608
@@:
1563
	mov	sb_position,eax
1609
	mov	sb_position,eax
1564
.all_sb:
1610
.all_sb:
1565
	mov	sb_redraw,dword 1
1611
	mov	sb_redraw,dword 1
1566
	call	.draw_1
1612
	call	.draw_1
1567
	mov	eax,sb_m_pos
1613
	mov	eax,sb_m_pos
1568
	mov	sb_m_pos_2,eax
1614
	mov	sb_m_pos_2,eax
1569
	jmp	.exit_sb
1615
	jmp	.exit_sb
1570
;*****************************************************************************
1616
;*****************************************************************************
1571
.down_sb:
1617
.down_sb:
1572
	cmp	dword sb_m_keys,0
1618
	cmp	dword sb_m_keys,0
1573
	je	.exit_sb
1619
	je	.exit_sb
1574
	
1620
	
1575
	mov	eax,sb_max_area
1621
	mov	eax,sb_max_area
1576
	mov	ebx,sb_ar_offset
1622
	mov	ebx,sb_ar_offset
1577
	sub	eax,sb_cur_area
1623
	sub	eax,sb_cur_area
1578
	push	eax
1624
	push	eax
1579
	sub	eax,ebx
1625
	sub	eax,ebx
1580
	cmp	sb_position,eax
1626
	cmp	sb_position,eax
1581
	pop	eax
1627
	pop	eax
1582
	jae	@f
1628
	jae	@f
1583
	
1629
	
1584
	add	sb_position,ebx
1630
	add	sb_position,ebx
1585
	jmp	.all_sb
1631
	jmp	.all_sb
1586
@@:
1632
@@:
1587
	mov	sb_position,eax
1633
	mov	sb_position,eax
1588
	xor	eax,eax
1634
	xor	eax,eax
1589
	mov	ax,sb_size_x
1635
	mov	ax,sb_size_x
1590
	sub	eax,sb_btn_high
1636
	sub	eax,sb_btn_high
1591
	sub	eax,sb_btn_high
1637
	sub	eax,sb_btn_high
1592
	sub	eax,sb_run_size
1638
	sub	eax,sb_run_size
1593
	mov	sb_position2,eax
1639
	mov	sb_position2,eax
1594
	jmp	.all_sb
1640
	jmp	.all_sb
1595
;*****************************************************************************
1641
;*****************************************************************************
1596
.exit_sb:
1642
.exit_sb:
1597
scroll_bar_exit
1643
scroll_bar_exit
1598
}
1644
}