Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1792 yogev_ezra 1
;---------------------------------------------------------------------
2
check_scroll_left_event:
3
     pusha
4
     mov  eax,[mouse_scroll_data]
5
     test eax,eax
6
     jz  .end
7
     test ax,0x8000
8
     jnz  .decr
9
     shr  eax,16
10
     test ax,0x8000
11
     jnz  .decr_1
12
     mov   eax,[left_folder_block]
13
     sub   eax,[max_panel_line]
14
     cmp   [left_start_draw_line],eax
15
     jae   .end
16
     movzx   eax,[mouse_scroll_data.vertical]
17
     test eax,eax
18
     jnz   @f
19
     movzx   eax,[mouse_scroll_data.horizontal]
20
@@:
21
     add   [left_start_draw_line],eax
22
     jmp   .draw
23
.decr:
24
     movzx   eax,[mouse_scroll_data.vertical]
25
     jmp    @f
26
.decr_1:
27
     movzx   eax,[mouse_scroll_data.horizontal]
28
@@:
29
     cmp   [left_start_draw_line],0
30
     je   .end
31
     mov  ebx,0xffff
32
     sub  ebx,eax
33
     inc   ebx
34
     sub   [left_start_draw_line],ebx
35
     cmp   [left_start_draw_line],0
36
     jae   .draw
37
     mov   [left_start_draw_line],0
38
.draw:
39
     call draw_left_panel
40
     mov   [scroll_bar_event],1
41
.end:
42
     popa
43
     ret
44
;---------------------------------------------------------------------
45
check_scroll_right_event:
46
     pusha
47
     mov  eax,[mouse_scroll_data]
48
     test eax,eax
49
     jz  .end
50
     test ax,0x8000
51
     jnz  .decr
52
     shr  eax,16
53
     test ax,0x8000
54
     jnz  .decr_1
55
     mov   eax,[right_folder_block]
56
     sub   eax,[max_panel_line]
57
     cmp   [right_start_draw_line],eax
58
     jae   .end
59
     movzx   eax,[mouse_scroll_data.vertical]
60
     test eax,eax
61
     jnz   @f
62
     movzx   eax,[mouse_scroll_data.horizontal]
63
@@:
64
     add   [right_start_draw_line],eax
65
     jmp   .draw
66
.decr:
67
     movzx   eax,[mouse_scroll_data.vertical]
68
     jmp    @f
69
.decr_1:
70
     movzx   eax,[mouse_scroll_data.horizontal]
71
@@:
72
     cmp   [right_start_draw_line],0
73
     je   .end
74
     mov  ebx,0xffff
75
     sub  ebx,eax
76
     inc   ebx
77
     sub   [right_start_draw_line],ebx
78
     cmp   [right_start_draw_line],0
79
     jae   .draw
80
     mov   [right_start_draw_line],0
81
.draw:
82
     call draw_right_panel
83
     mov   [scroll_bar_event],1
84
.end:
85
     popa
86
 
87
     ret
88
;---------------------------------------------------------------------
89
check_scroll_bar_left_event:
90
     mov   [scroll_pointer],1
91
     cmp   [mouse_keys_delta],0
92
     je    @f
93
     cmp   [mouse_keys],0
94
     jz    .exit
95
@@:
96
     sub   ecx,15
97
     cmp   bx,cx
98
     jb    .exit
99
@@:
100
     cmp  [select_panel_counter],0
101
     je   @f
102
     mov  [select_panel_counter],0
103
     call  draw_all_panels_for_scroll_bar
104
@@:
105
     mov   [scroll_bar_event],1
106
     mov   cx,[left_panel_y.start_y]
107
     add   cx,15
108
     cmp   ax,cx
109
     ja    .scroll
110
     cmp   [left_start_draw_line],0
111
     jne   @f
112
     ret
113
@@:
114
     dec   [left_start_draw_line]
115
     jmp   .all
116
.scroll:
117
     add   cx,[left_panel_y.size_y]
118
     sub   cx,30
119
     cmp   ax,cx
120
     ja    .down
121
     mov   ebx,16  ;15
122
     add   bx,[left_panel_y.start_y]
123
     sub   cx,bx
124
     sub   ax,bx
125
     mov   ebx,eax
126
     mov   eax,[left_folder_block]
127
     call  calculate_for_scroll_bar
128
     cmp   [left_start_draw_line],eax
129
     je    .exit
130
     mov   [left_start_draw_line],eax
131
.all:
132
     call draw_left_panel
133
.exit:
134
     ret
135
.down:
136
     mov   eax,[left_folder_block]
137
     sub   eax,[max_panel_line]
138
     cmp   [left_start_draw_line],eax
139
     jb   @f
140
     ret
141
@@:
142
     inc   [left_start_draw_line]
143
     jmp   .all
144
;---------------------------------------------------------------------
145
draw_all_panels_for_scroll_bar:
146
     push eax
147
     push ebx
148
     call draw_right_panel
149
     call draw_left_panel
150
     pop  ebx
151
     pop  eax
152
     ret
153
;---------------------------------------------------------------------
154
calculate_for_scroll_bar:
155
     sub   eax,[max_panel_line]
156
     inc   eax
157
     shl   eax,10
158
     xor   edx,edx
159
     div   ecx
160
     shl   edx,1
161
     cmp   edx,ebx
162
     jb    @f
163
     inc   eax
164
@@:
165
     imul  eax,ebx
166
     shr   eax,10
167
     ret
168
;---------------------------------------------------------------------
169
check_scroll_bar_right_event:
170
     mov   [scroll_pointer],2
171
     cmp   [mouse_keys_delta],0
172
     je    @f
173
     cmp   [mouse_keys],0
174
     jz    .exit
175
@@:
176
     sub   ecx,15
177
     cmp   bx,cx
178
     jb    .exit
179
@@:
180
     cmp  [select_panel_counter],1
181
     je   @f
182
     mov  [select_panel_counter],1
183
     call  draw_all_panels_for_scroll_bar
184
@@:
185
     mov   [scroll_bar_event],1
186
     mov   cx,[right_panel_y.start_y]
187
     add   cx,15
188
     cmp   ax,cx
189
     ja    .scroll
190
     cmp   [right_start_draw_line],0
191
     jne   @f
192
     ret
193
@@:
194
     dec   [right_start_draw_line]
195
     jmp   .all
196
.scroll:
197
     add   cx,[right_panel_y.size_y]
198
     sub   cx,30
199
     cmp   ax,cx
200
     ja    .down
201
     mov   ebx,16  ;15
202
     add   bx,[right_panel_y.start_y]
203
     sub   cx,bx
204
     sub   ax,bx
205
     mov   ebx,eax
206
     mov   eax,[right_folder_block]
207
     call  calculate_for_scroll_bar
208
     cmp   [right_start_draw_line],eax
209
     je    .exit
210
     mov   [right_start_draw_line],eax
211
.all:
212
     call draw_right_panel
213
.exit:
214
     ret
215
.down:
216
     mov   eax,[right_folder_block]
217
     sub   eax,[max_panel_line]
218
     cmp   [right_start_draw_line],eax
219
     jb   @f
220
     ret
221
@@:
222
     inc   [right_start_draw_line]
223
     jmp   .all
224
;---------------------------------------------------------------------
225
draw_scroll_bar_left:
226
     pusha
227
     mov   eax,[left_folder_block]
228
     cmp   eax,0
229
     jne   @f
230
     inc   eax
231
@@:
232
     mov   ebx,[max_panel_line]
233
     xor   edx,edx
234
     div   ebx
235
     cmp   eax,0
236
     jne   @f
237
     inc   eax
238
@@:
239
     mov   ebx,eax
240
     xor   eax,eax
241
     mov   ax,[left_panel_x.size_x]
242
     sub   eax,30
243
     xor   edx,edx
244
     div   ebx
245
     shr   eax,1
246
     cmp   eax,5
247
     jae    @f
248
     mov   eax,5
249
@@:
250
     mov   [left_scroll_compens],eax
251
     popa
252
 
253
     mov   [scroll_pointer_1],1
254
     pusha
255
     mov   bx,[left_panel_x.start_x]
256
     add   bx,[left_panel_x.size_x]
257
     sub   bx,15
258
     shl   ebx,16
259
     mov   bx,15
260
     mov   ecx,[left_panel_y]
261
     call  calculate_for_draw_scroll_bar
262
     push  ecx
263
     mov   ax,[left_panel_y.size_y]
264
     sub   eax,30  ;45
265
     sub   eax,[left_scroll_compens]
266
     sub   eax,[left_scroll_compens]
267
     shl   eax,10
268
     push  ebx
269
     mov   ebx,[left_folder_block]
270
     call  calculate_for_draw_scroll_bar_2
271
     mov   ebx,[left_start_draw_line]
272
     imul  eax,ebx
273
     pop   ebx
274
     call  calculate_for_draw_scroll_bar_1
275
     pop   ecx
276
     ror   ecx,16
277
     add   cx,[left_panel_y.size_y]
278
     call  calculate_for_draw_scroll_bar_3
279
     popa
280
     ret
281
;---------------------------------------------------------------------
282
draw_scroll_bar_right:
283
     pusha
284
     mov   eax,[right_folder_block]
285
     cmp   eax,0
286
     jne   @f
287
     inc   eax
288
@@:
289
     mov   ebx,[max_panel_line]
290
     xor   edx,edx
291
     div   ebx
292
     cmp   eax,0
293
     jne   @f
294
     inc   eax
295
@@:
296
     mov   ebx,eax
297
     xor   eax,eax
298
     mov   ax,[right_panel_x.size_x]
299
     sub   eax,30
300
     xor   edx,edx
301
     div   ebx
302
     shr   eax,1
303
     cmp   eax,5
304
     jae    @f
305
     mov   eax,5
306
@@:
307
     mov   [right_scroll_compens],eax
308
     popa
309
     mov   [scroll_pointer_1],2
310
     pusha
311
     mov   bx,[right_panel_x.start_x]
312
     add   bx,[right_panel_x.size_x]
313
     sub   bx,15
314
     shl   ebx,16
315
     mov   bx,15
316
     mov   ecx,[right_panel_y]
317
     call  calculate_for_draw_scroll_bar
318
     push  ecx
319
     mov   ax,[right_panel_y.size_y]
320
     sub   eax,30  ;45
321
     sub   eax,[right_scroll_compens]
322
     sub   eax,[right_scroll_compens]
323
     shl   eax,10
324
     push  ebx
325
     mov   ebx,[right_folder_block]
326
     call  calculate_for_draw_scroll_bar_2
327
     mov   ebx,[right_start_draw_line]
328
     imul  eax,ebx
329
     pop   ebx
330
     call  calculate_for_draw_scroll_bar_1
331
     pop   ecx
332
     ror   ecx,16
333
     add   cx,[right_panel_y.size_y]
334
     call  calculate_for_draw_scroll_bar_3
335
     popa
336
     ret
337
;---------------------------------------------------------------------
338
calculate_for_draw_scroll_bar:
339
     mov   edx,0xeeeeee
340
     mov   eax,13
341
     pusha
342
     add   ebx,1 shl 16
343
     mov   bx,14
344
     add   ecx,16 shl 16
345
     sub   cx,31
346
     int   0x40
347
     popa
348
     xor   edx,edx
349
     push  ebx
350
     mov   bx,1
351
     int   0x40
352
     push  ecx
353
     add   ebx,15 shl 16
354
     int   0x40
355
     pop   ecx
356
     pop   ebx
357
     mov   [draw_scroll_character],1
358
     call  draw_scroll_bar_srectangle
359
     xor  eax,eax
360
     ret
361
;---------------------------------------------------------------------
362
calculate_for_draw_scroll_bar_1:
363
     shr   eax,10
364
     ror   ecx,16
365
     add   cx,15
366
     cmp   [scroll_pointer_1],1
367
     jne   .right
368
     add   ecx,[left_scroll_compens]
369
     jmp   @f
370
.right:
371
     add   ecx,[right_scroll_compens]
372
@@:
373
     add   cx,ax
374
     rol   ecx,16
375
     mov   [draw_scroll_character],2
376
     call  draw_scroll_bar_srectangle
377
     ret
378
;---------------------------------------------------------------------
379
calculate_for_draw_scroll_bar_2:
380
     sub   ebx,[max_panel_line]
381
     cmp  ebx,0
382
     ja    @f
383
     mov   ebx,1
384
@@:
385
     xor   edx,edx
386
     div   ebx
387
     shl   edx,1
388
     cmp   edx,ebx
389
     jb    @f
390
     inc   eax
391
@@:
392
     ret
393
;---------------------------------------------------------------------
394
calculate_for_draw_scroll_bar_3:
395
     sub   cx,16
396
     rol   ecx,16
397
     mov   [draw_scroll_character],3
398
     call  draw_scroll_bar_srectangle
399
     ret
400
;---------------------------------------------------------------------
401
;calculate_for_draw_scroll_bar_4:
402
;     push  eax
403
;     push  ebx
404
;;     shr   eax,10
405
;     mov   ebx,eax
406
;     xor   eax,eax
407
;     mov   ax,[left_panel_y.size_y]
408
;     xor   edx,edx
409
;     div   ebx
410
;;     mov   esi,eax
411
;     pop   ebx
412
;     pop   eax
413
;     ret
414
;---------------------------------------------------------------------
415
draw_scroll_bar_srectangle:
416
     push  ecx
417
     xor   edx,edx
418
     mov   eax,13
419
     mov   cx,1
420
     cmp   [draw_scroll_character],2
421
     je   .draw_center
422
     int   0x40
423
     pusha
424
     add   ecx,1 shl 16
425
     add   ebx,1 shl 16
426
     mov   cx,14
427
     mov   bx,14
428
     mov   edx,0xbbddff
429
     int   0x40
430
     xor   edx,edx
431
     cmp   [draw_scroll_character],1
432
     jne   .draw_down
433
     add   ebx,3 shl 16
434
     mov   bx,7
435
     add   ecx,8 shl 16
436
     mov   cx,1
437
     int   0x40
438
     sub   ecx,1 shl 16
439
     add   ebx,1 shl 16
440
     mov   bx,5
441
     int   0x40
442
     sub   ecx,1 shl 16
443
     add   ebx,1 shl 16
444
     mov   bx,3
445
     int   0x40
446
     sub   ecx,1 shl 16
447
     add   ebx,1 shl 16
448
     mov   bx,1
449
     int   0x40
450
     jmp   .continue
451
.draw_down:
452
     add   ebx,3 shl 16
453
     mov   bx,7
454
     add   ecx,5 shl 16
455
     mov   cx,1
456
     int   0x40
457
     add   ecx,1 shl 16
458
     add   ebx,1 shl 16
459
     mov   bx,5
460
     int   0x40
461
     add   ecx,1 shl 16
462
     add   ebx,1 shl 16
463
     mov   bx,3
464
     int   0x40
465
     add   ecx,1 shl 16
466
     add   ebx,1 shl 16
467
     mov   bx,1
468
     int   0x40
469
.continue:
470
     popa
471
     add   ecx,15 shl 16
472
     int   0x40
473
     pop   ecx
474
     ret
475
 
476
.draw_center:
477
     pusha
478
     add   ecx,1 shl 16
479
     add   ebx,1 shl 16
480
     push  ecx
481
     cmp   [scroll_pointer_1],1
482
     jne   .right
483
     ror   ecx,16
484
     sub   ecx,[left_scroll_compens]
485
     rol   ecx,16
486
     xor   cx,cx
487
     add   ecx,[left_scroll_compens]
488
     shl   cx,1
489
     jmp   .draw_center_continue
490
.right:
491
     ror   ecx,16
492
     sub   ecx,[right_scroll_compens]
493
     rol   ecx,16
494
     xor   cx,cx
495
     add   ecx,[right_scroll_compens]
496
     shl   cx,1
497
.draw_center_continue:
498
     mov   bx,14
499
     mov   edx,0xbbddff
500
     int   0x40
501
     xor   edx,edx
502
     mov   cx,1
503
     sub   ecx,1 shl 16
504
     int   0x40
505
     pop   ecx
506
     cmp   [scroll_pointer_1],1
507
     jne   .right_1
508
     cmp   [left_scroll_compens],8
509
     jb    .continue_1
510
     jmp   .draw_center_continue_1
511
.right_1:
512
     cmp   [right_scroll_compens],8
513
     jb    .continue_1
514
.draw_center_continue_1:
515
     sub   ecx,8 shl 16
516
     add   ebx,2 shl 16
517
     mov   bx,10
518
     add   ecx,4 shl 16
519
     mov   cx,1
520
     int   0x40
521
     add   ecx,3 shl 16
522
     sub   ebx,1 shl 16
523
     mov   bx,12
524
     int   0x40
525
     add   ebx,1 shl 16
526
     mov   bx,10
527
     add   ecx,3 shl 16
528
     int   0x40
529
.continue_1:
530
     popa
531
     ror   ecx,16
532
     cmp   [scroll_pointer_1],1
533
     jne   @f
534
     add   ecx,[left_scroll_compens]
535
     jmp   .draw_center_continue_2
536
@@:
537
     add   ecx,[right_scroll_compens]
538
.draw_center_continue_2:
539
     rol   ecx,16
540
     int   0x40
541
     pop   ecx
542
     ret
543
;---------------------------------------------------------------------