Subversion Repositories Kolibri OS

Rev

Rev 1951 | Rev 1958 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1951 mario79 1
;---------------------------------------------------------------------
2
invert_left_to_right:
3
	mov ebx,3
4
	jmp  rotate_counter_clockwise.1
5
;---------------------------------------------------------------------
6
invert_up_to_down:
7
	mov ebx,4
8
	jmp  rotate_counter_clockwise.1
9
;---------------------------------------------------------------------
10
rotate_clockwise:
11
	mov ebx,1
12
	jmp  rotate_counter_clockwise.1
13
;---------------------------------------------------------------------
14
rotate_counter_clockwise:
15
	mov ebx,2
16
.1:
17
	mov  eax,[soi]
18
	test eax,eax
19
	jz   still
20
 
21
	mov  eax,[RAW1_pointer]
22
	test eax,eax
23
	jz   @f
24
	cmp  [Total_Repeat_N],1
25
	ja   still
26
@@:
27
 
28
	push  ebx
29
	call  proc_position_correct
30
	mov  eax,[vertical_position_coorect]
31
	mov  ebx,[horizontal_position_coorect]
32
	mov  [horizontal_position_coorect],eax
33
	mov  [vertical_position_coorect],ebx
34
	pop  ebx
1957 mario79 35
;	mov eax,image_file
36
; ebx - direction
37
; 1 - clockwise, 2 - counter clockwise
38
; 3 - Left&Right, 4 - Up&Down
39
	push	ebx
40
	push	dword image_file
1951 mario79 41
;	call [plugin_rotate]
42
	call [rotate_Start]
43
    mov  ebx,[raw_pointer]
44
    mov  eax,[ebx+4]
45
    mov  [img_width],eax
46
    mov  eax,[ebx+8]
47
    mov  [img_high],eax
48
	call convert.img_resolution_ok
49
	jmp  kopen.1
50
;---------------------------------------------------------------------
51
calculate_arrows_offset:
52
	mov  eax,[arrows_offset]
53
	imul eax,[scaling_mode]
54
	mov  ebx,100
55
	xor  edx,edx
56
	div  ebx
57
	mov  [scroll_bar_data_vertical.ar_offset],eax
58
	mov  [scroll_bar_data_horizontal.ar_offset],eax
59
	ret
60
;---------------------------------------------------------------------
61
no_scaling:
62
	mov  eax,scaling_mode
63
	cmp  [eax],dword 100
64
	je   still
65
.1:
66
	mov  [eax],dword 100
67
	mov  [zoom_factors],dword zoom_factors.100
68
	mov  eax,[eax]
69
	jmp   zoom_plus.2
70
 
71
;	call calculate_arrows_offset
72
;	call draw_zoom_factors
73
;	jmp  red
74
;---------------------------------------------------------------------
75
scaling:
76
	mov  eax,[soi]
77
	test eax,eax
78
	jz   still
79
	mov  eax,scaling_mode
80
	xor  ebx,ebx
81
	cmp  [eax],ebx  ;dword 0
82
	je   still
83
	mov  [eax],ebx  ;dword 0
84
	mov  [zoom_factors],dword zoom_factors.1
85
	call .1
86
	call draw_zoom_factors
87
	jmp  still
88
;---------------------------
89
.compens_x:
90
	call .get_x_y
91
	xor  ecx,ecx
92
	mov  cx,[wa_high_1]
93
	imul eax,ecx
94
	xor  edx,edx
95
	div  ebx
96
	ret
97
;---------------------------
98
.compens_y:
99
	call .get_x_y
100
	xchg eax,ebx
101
	xor  ecx,ecx
102
	mov  cx,[wa_width_1]
103
	imul eax,ecx
104
	xor  edx,edx
105
	div  ebx
106
	ret
107
;---------------------------
108
.get_x_y:
109
    mov  ebx,[raw_pointer]
110
    mov  eax,[ebx+4]
111
	mov  ebx,[ebx+8]
112
	ret
113
;---------------------------
114
.fill_for_L_R:
115
	cmp   [no_fill],1
116
	je   @f
117
;	xor  eax,eax
118
;	mov  [no_fill],al
119
;	ret
120
;@@:
121
	pusha
122
	mov   ebx,[image_start_coordinates]
123
	mov   ecx,ebx
124
	shl   ecx,16
125
	mov   bx,ax
126
	mov   cx,[wa_high_1]
127
	mcall 13,,,[fill_color] ;0xffffff
128
	mov   ax,bx
129
	ror   ebx,16
130
	add   bx,ax
131
	add   bx,[wa_width_2]
132
	mov   ax,[wa_width_1]
133
;	add   ax,5
134
	sub   ax,bx
135
	rol   ebx,16
136
	mov   bx,ax
137
	mcall 13,,,[fill_color]  ;0xffffff
138
	popa
139
@@:
140
	ret
141
;---------------------------
142
.fill_for_U_D:
143
	cmp   [no_fill],1
144
	je   @f
145
;	xor  eax,eax
146
;	mov  [no_fill],al
147
;	ret
148
;@@:
149
	pusha
150
	mov   ebx,[image_start_coordinates]
151
	mov   ecx,ebx
152
	shl   ecx,16
153
	mov   cx,ax
154
	mov   bx,[wa_width_1]
155
	mcall 13,,,[fill_color]  ;0xffffff
156
	mov   ax,cx
157
	ror   ecx,16
158
	add   cx,ax
159
	add   cx,[wa_high_2]
160
	mov   ax,[wa_high_1]
161
	add   ax,28  ;50
162
	sub   ax,cx
163
	rol   ecx,16
164
	mov   cx,ax
165
	mcall 13,,,[fill_color]  ;0xffffff
166
	popa
167
@@:
168
	ret
169
;---------------------------
170
.1:
171
	call .get_x_y
172
	cmp  eax,ebx
173
	jb  .y
174
;---------------------------
175
.x:
176
	call .compens_y
177
	cmp  ax,[wa_high_1]
178
	jbe @f
179
	call .compens_x
180
	mov  [wa_width_2],ax
181
	jmp  .4
182
@@:
183
	mov  [wa_high_2],ax
184
	jmp  .4
185
;---------------------------
186
.y:
187
	call .compens_x
188
	cmp  ax,[wa_width_1]
189
	jbe  @f
190
	call .compens_y
191
	mov  [wa_high_2],ax
192
	jmp  .4
193
@@:
194
	mov  [wa_width_2],ax
195
;---------------------------
196
.4:
197
	mov bx,[wa_width_2]
198
	shl ebx,16
199
	mov bx,[wa_high_2]
200
 
201
	xor  ecx,ecx
202
.5:
203
 
204
;	mov  eax,ebx
205
;	and  eax,0xffff
206
;	mov  [test1],eax
207
 
208
;	mov  eax,ebx
209
;	shr  eax,16
210
;	mov  [test2],eax
211
 
212
;	mov  eax,ecx
213
;	and  eax,0xffff
214
;	mov  [test3],eax
215
 
216
;	mov  eax,ecx
217
;	shr  eax,16
218
;	mov  [test4],eax
219
 
220
	mov eax,image_file
221
	mov  edx,[scaling_mode]
222
	movzx  esi,byte [filtering_flag]
223
	mov  edi,[background_color]
224
 
225
;	pusha
226
;	mcall 26,9
227
;	mov  [test1],eax
228
;	popa
229
 
230
;	call [plugin_scaling]
231
 
232
	call [Scaling_Start]
233
 
234
;	pusha
235
;	mcall 26,9
236
;	mov  ebx,[test1]
237
;	sub  eax,ebx
238
;	cmp  [test2],0
239
;	je  @f
240
;	add  eax,[test2]
241
;	shr  eax,1
242
;	cmp  eax,[test3]
243
;	jbe  @f
244
;	mov  [test3],eax
245
;@@:
246
;	mov  [test2],eax
247
;	popa
248
 
249
	mov  ecx,ebx
250
 
251
	mov  edx,[image_start_coordinates]
252
 
253
    mov  eax,edx
254
    shl  eax,16
255
    mov  ax,cx
256
    mov  [scroll_bar_data_vertical.y],eax
257
 
258
    mov  eax,edx
259
    mov  ebx,ecx
260
    shr  ebx,16
261
    mov  ax,bx
262
    mov  [scroll_bar_data_horizontal.x],eax
263
 
264
;	call correct_cur_area
265
 
266
;	movzx eax,[wa_width_1]
267
;	mov  [test1],eax
268
;	movzx eax,[wa_width_2]
269
;	mov  [test2],eax
270
 
271
;	movzx eax,[wa_high_1]
272
;	mov  [test3],eax
273
;	movzx eax,[wa_high_2]
274
;	mov  [test4],eax
275
 
276
	xor  eax,eax
277
	mov  ax,[wa_width_1]
278
	sub  ax,[wa_width_2]
279
	shr  ax,1
280
	test ax,ax
281
	jz  @f
282
	shl  eax,16
283
	add  edx,eax
284
	shr  eax,16
285
	call .fill_for_L_R
286
@@:
287
	mov  ax,[wa_high_1]
288
	sub  ax,[wa_high_2]
289
	shr  ax,1
290
	test ax,ax
291
	jz  @f
292
	add  edx,eax
293
	call .fill_for_U_D
294
@@:
295
	mov   esi,[img_resolution]
296
    cmp   [img_resolution_2],15
297
    jne  @f
298
	mov  esi,15
299
@@:
300
	mov  eax,[raw_pointer]
301
	mov  edi,[eax+20]
302
	add  edi,eax
303
;	mov  edi,[img_palette]
304
	xor  ebp,ebp
305
 
306
	mov  ebx,[raw_pointer_2]
307
 
308
	mov  eax,ecx
309
	test ax,ax
310
	jz   .no_draw  ;@f
311
	shr  eax,16
312
	test eax,eax
313
	jz   .no_draw ;@f
314
 
315
	cmp  [filtering_flag],0
316
	je   @f
317
	cmp  esi,8
318
	jne  @f
319
	mov  esi,24
320
@@:
321
	mcall 65
322
.no_draw:
323
;	mov  eax,ecx
324
;	shr  eax,16
325
;	mov  [test1],eax
326
;
327
;	mov  eax,ecx
328
;	and  eax,0xffff
329
;	mov  [test2],eax
330
;
331
;	mov  eax,edx
332
;	shr  eax,16
333
;	mov  [test3],eax
334
;
335
;	mov  eax,edx
336
;	and  eax,0xffff
337
;	mov  [test4],eax
338
 
339
	push ebx
340
	call draw_file_name_to_work_area
341
	pop  ebx
342
	mov  ecx,ebx  ;[raw_pointer_2]
343
	mcall 68,13
344
 
345
 
346
	xor  eax,eax
347
	mov  ax,[wa_width_2]
348
;	imul eax,100
349
; ЕАХ = ЕАХ * 100
350
    shl eax,2      ; умножение на 4
351
    lea eax,[eax+eax*4] ; умножение на 5
352
    lea eax,[eax+eax*4] ; умножение на 5
353
	mov  ebx,[img_width]
354
	test ebx,ebx
355
	jnz  @f
356
	inc  ebx
357
@@:
358
	xor  edx,edx
359
	div  ebx
360
	shl  edx,1
361
	cmp  ebx,edx
362
	jb   @f
363
	inc  eax
364
@@:
365
	mov  [zoom_auto_factor],eax
366
 
367
	ret
368
;---------------------------------------------------------------------
369
calculation_next_value_plus:
370
	mov  ebx,[zoom_auto_factor]
371
	mov  ecx,zoom_factors.min
372
	sub  ecx,4
373
@@:
374
	add  ecx,4
375
	cmp  ecx,dword zoom_factors.max
376
	jae  .max
377
	mov  eax,[ecx]
378
	cmp  eax,ebx
379
	jb   @r
380
@@:
381
	mov  eax,zoom_factors
382
	mov  [eax],ecx
383
;	jmp  zoom_plus.1
384
	ret
385
.max:
386
	mov  ecx,dword zoom_factors.max
387
	jmp  @r
388
;---------------------------------------------------------------------
389
calculation_next_value_minus:
390
	mov  ebx,[zoom_auto_factor]
391
	mov  ecx,zoom_factors.max
392
	add  ecx,4
393
@@:
394
	sub  ecx,4
395
	cmp  ecx,dword zoom_factors.min
396
	jbe  .min
397
	mov  eax,[ecx]
398
	cmp  eax,ebx
399
	ja   @r
400
@@:
401
	mov  eax,zoom_factors
402
	mov  [eax],ecx
403
;	jmp  zoom_plus.1
404
	ret
405
.min:
406
	mov  ecx,dword zoom_factors.min
407
	jmp  @r
408
;---------------------------------------------------------------------
409
proc_position_correct:
410
	mov  [position_coorect],1
411
	mov  eax,[scroll_bar_data_vertical.max_area]
412
	xor  ebx,ebx
413
	mov  bx,[wa_high_1]
414
	shr  ebx,1
415
	shl  eax,8
416
	add  ebx,[scroll_bar_data_vertical.position]
417
	test ebx,ebx
418
	jnz  @f
419
	inc  ebx
420
@@:
421
	xor  edx,edx
422
	div  ebx
423
	mov  [vertical_position_coorect],eax
424
 
425
	mov  eax,[scroll_bar_data_horizontal.max_area]
426
	xor  ebx,ebx
427
	mov  bx,[wa_width_1]
428
	shr ebx,1
429
	shl  eax,8
430
	add  ebx,[scroll_bar_data_horizontal.position]
431
	test ebx,ebx
432
	jnz  @f
433
	inc  ebx
434
@@:
435
	xor  edx,edx
436
	div  ebx
437
	mov  [horizontal_position_coorect],eax
438
	ret
439
;---------------------------------------------------------------------
440
zoom_plus:
441
;	cmp  [scaling_mode],dword 0
442
	mov  eax,[scaling_mode]
443
	test eax,eax
444
;	jz   no_scaling.1
445
;	jz   calculation_next_value_plus
446
	jnz  @f
447
	call  calculation_next_value_plus
448
	jmp  .1
449
@@:
450
;	jne  @f
451
;	mov  [scaling_mode],dword 100
452
;	mov  [zoom_factors],dword zoom_factors.100
453
;	call  draw_zoom_factors
454
;	jmp  red
455
;@@:
456
	mov  eax,zoom_factors
457
	cmp  [eax],dword zoom_factors.max
458
	jae  still
459
	add  [eax],dword 4
460
.1:
461
	mov  eax,[eax]
462
	mov  eax,[eax]
463
.2:
464
	mov  [scaling_mode],eax
465
 
466
	mov  [correct_scrollbar_100_flag],1
467
	call calculate_arrows_offset
468
 
469
	call  proc_position_correct
470
 
471
    call  drawimage
472
 
473
	call  set_draw_scrollbar_all
474
    call  draw_scrollbars
475
	call  set_nodraw_scrollbar_all
476
 
477
	call  draw_zoom_factors
478
	jmp  still
479
 
480
zoom_all:
481
;******************************
482
	mov  eax,wa_width_1
483
	mov  eax,[eax]
484
	push eax
485
	mov  eax,wa_high_1
486
	mov  eax,[eax]
487
	push eax
488
;******************************
489
	cmp  [position_coorect],0
490
	je   .correct_end
491
	mov  [position_coorect],0
492
	mov  eax,[scroll_bar_data_vertical.max_area]
493
;	xor  ebx,ebx
494
;	mov  bx,[wa_high_1]
495
;	shr  ebx,1
496
;	add  eax,ebx  ;[scroll_bar_data_vertical.cur_area]
497
	shl  eax,8
498
	mov  ebx,[vertical_position_coorect]
499
	test ebx,ebx
500
	jnz  @f
501
	inc  ebx
502
@@:
503
	xor  edx,edx
504
	div  ebx
505
;	shr  eax,8
506
	xor  ebx,ebx
507
	mov  bx,[wa_high_1]
508
	shr  ebx,1
509
	cmp  eax,ebx
510
	jae  @f
511
	xor  eax,eax
512
	jmp  .position_vertical_correct
513
@@:
514
	sub  eax,ebx
515
.position_vertical_correct:
516
	mov  [scroll_bar_data_vertical.position],eax
517
 
518
	mov  eax,[scroll_bar_data_horizontal.max_area]
519
;	xor  ebx,ebx
520
;	mov  bx,[wa_width_1]
521
;	shr  ebx,1
522
;	add  eax,ebx  ;[scroll_bar_data_horizontal.cur_area]
523
	shl  eax,8
524
	mov  ebx,[horizontal_position_coorect]
525
	test ebx,ebx
526
	jnz  @f
527
	inc  ebx
528
@@:
529
	xor  edx,edx
530
	div  ebx
531
;	shr  eax,8
532
	xor  ebx,ebx
533
	mov  bx,[wa_width_1]
534
	shr  ebx,1
535
	cmp  eax,ebx
536
	jae  @f
537
	xor  eax,eax
538
	jmp  .position_horizontal_correct
539
@@:
540
	sub  eax,ebx
541
.position_horizontal_correct:
542
	mov  [scroll_bar_data_horizontal.position],eax
543
 
544
.correct_end:
545
 
546
;****************************************************************************
547
; Vertical SCROLLBAR
548
; At a case of resizing of the window
549
; Check the position of a runner has crossed a limit
550
;****************************************************************************
551
    mov  eax,[scroll_bar_data_vertical.max_area]
552
	xor  ebx,ebx
553
	mov  bx,[wa_high_1]
554
	cmp  eax,ebx
555
	ja   @f
556
	xor  eax,eax
557
	jmp  .p_5
558
@@:
559
    sub  eax,ebx  ;[scroll_bar_data_vertical.cur_area]
560
    cmp  eax,[scroll_bar_data_vertical.position]
561
    jae  @f
562
.p_5:
563
    mov  [scroll_bar_data_vertical.position],eax
564
@@:
565
;****************************************************************************
566
; Horizontal SCROLLBAR
567
; At a case of resizing of the window
568
; Check the position of a runner has crossed a limit
569
;****************************************************************************
570
    mov  eax,[scroll_bar_data_horizontal.max_area]
571
	xor  ebx,ebx
572
	mov  bx,[wa_width_1]
573
	cmp  eax,ebx
574
	ja   @f
575
	xor  eax,eax
576
	jmp  .p_6
577
@@:
578
    sub  eax,ebx  ;[scroll_bar_data_horizontal.cur_area]
579
    cmp  eax,[scroll_bar_data_horizontal.position]
580
    jae  @f
581
.p_6:
582
    mov  [scroll_bar_data_horizontal.position],eax
583
@@:
584
;****************************************************************************
585
 
586
	mov   eax,[scroll_bar_data_horizontal.max_area]
587
	mov   ebx,[scroll_bar_data_vertical.max_area]
588
 
589
 
590
	sub   eax,[scroll_bar_data_horizontal.position]   ;100
591
	sub   ebx,[scroll_bar_data_vertical.position]    ;100
592
 
593
	xor   ecx,ecx
594
	mov   cx,word [wa_width_1]
595
	cmp   eax,ecx
596
	jbe   @f
597
	xor   eax,eax
598
	mov   ax,[wa_width_1]
599
@@:
600
	mov   [wa_width_2],ax
601
	mov   ecx,eax
602
	shl   ecx,16
603
	xchg  eax,ebx
604
 
605
	xor   edx,edx
606
	mov   dx,word [wa_high_1]
607
	cmp   eax,edx
608
	jbe   @f
609
	xor   eax,eax
610
	mov   ax,[wa_high_1]
611
@@:
612
	mov   [wa_high_2],ax
613
	mov   cx,ax
614
 
615
	call  correct_cur_area
616
 
617
	mov   ebx,ecx
618
 
619
	push eax
620
	mov  eax,[scroll_bar_data_vertical.max_area]
621
	cmp  eax,[scroll_bar_data_vertical.cur_area]
622
	jbe  .horizontal  ;@f
623
	mov  ax,[wa_width_1]
624
	sub  ax,[scroll_bar_data_vertical.size_x]
625
	mov  [wa_width_1],ax
626
	cmp  ax,[wa_width_2]
627
	jae  .horizontal
628
	mov  [wa_width_2],ax
629
.horizontal:
630
	mov  eax,[scroll_bar_data_horizontal.max_area]
631
	cmp  eax,[scroll_bar_data_horizontal.cur_area]
632
	jbe  .finish   ;@f
633
	mov  ax,[wa_high_1]
634
	sub  ax,[scroll_bar_data_horizontal.size_y]
635
	mov  [wa_high_1],ax
636
	cmp  ax,[wa_high_2]
637
	jae  .finish
638
	mov  [wa_high_2],ax
639
.finish:   ;@@:
640
	pop  eax
641
 
642
	mov  cx,[wa_width_2]
643
	shl ecx,16
644
	mov  cx,[wa_high_2]
645
 
646
	call  correct_cur_area
647
 
648
	mov   ebx,ecx
649
 
650
	mov  eax,[scroll_bar_data_horizontal.position]
651
 
652
;	imul eax,100
653
; ЕАХ = ЕАХ * 100
654
    shl eax,2      ; умножение на 4
655
    lea eax,[eax+eax*4] ; умножение на 5
656
    lea eax,[eax+eax*4] ; умножение на 5
657
	push ebx
658
	mov  ebx,[scaling_mode]
659
	xor  edx,edx
660
	div  ebx
661
 
662
;	shl  edx,1
663
;	cmp  edx,ebx
664
;	jb  @f
665
;	inc  eax
666
;@@:
667
 
668
	pop  ebx
669
 
670
	mov  ecx,eax
671
	shl  ecx,16
672
 
673
	mov  eax,[scroll_bar_data_vertical.position]
674
 
675
;	imul eax,100
676
; ЕАХ = ЕАХ * 100
677
    shl eax,2      ; умножение на 4
678
    lea eax,[eax+eax*4] ; умножение на 5
679
    lea eax,[eax+eax*4] ; умножение на 5
680
	push ebx
681
	mov  ebx,[scaling_mode]
682
	xor  edx,edx
683
	div  ebx
684
 
685
;	shl  edx,1
686
;	cmp  edx,ebx
687
;	jb  @f
688
;	inc  eax
689
;@@:
690
 
691
	pop  ebx
692
 
693
	mov  cx,ax
694
 
695
	call   scaling.5
696
;******************************
697
	pop  eax
698
	mov  ebx,wa_high_1
699
	mov  [ebx],eax
700
 
701
	pop  eax
702
	mov  ebx,wa_width_1
703
	mov  [ebx],eax
704
;******************************
705
 
706
	ret
707
;---------------------------------------------------------------------
708
zoom_minus:
709
;	cmp  [scaling_mode],dword 0
710
	mov  eax,[scaling_mode]
711
	test eax,eax
712
;	jz   no_scaling.1
713
;	jz   calculation_next_value_minus
714
	jnz  @f
715
	call  calculation_next_value_minus
716
	jmp  zoom_plus.1
717
@@:
718
;	je   no_scaling.1
719
;	jne  @f
720
;	mov  [scaling_mode],dword 100
721
;	mov  [zoom_factors],dword zoom_factors.100
722
;	call  draw_zoom_factors
723
;	jmp  red
724
;@@:
725
	mov  eax,zoom_factors
726
	cmp  [eax],dword zoom_factors.min
727
	jbe  still
728
	sub  [eax],dword 4
729
	jmp   zoom_plus.1
730
;---------------------------------------------------------------------