Subversion Repositories Kolibri OS

Rev

Rev 1041 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1041 Rev 1199
Line 1... Line 1...
1
;**************************************************************
1
;**************************************************************
2
; ScrollBar Macro for Kolibri OS
2
; ScrollBar Macro for Kolibri OS
3
; Copyright (c) 2009, Mario79
3
; Copyright (c) 2009, 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
Line 12... Line 12...
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 Mario79 ''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;
Line 292... Line 292...
292
{
292
{
293
scroll_bar_vertical:
293
scroll_bar_vertical:
294
.draw:
294
.draw:
295
	pusha
295
	pusha
296
	mov   edi,dword [esp+36]
296
	mov   edi,dword [esp+36]
297
;	mov   sb_all_redraw,dword 1
-
 
298
	mov   sb_delta,word 0
297
	mov   sb_delta,word 0
299
	call  .draw_1
298
	call  .draw_1
300
	mov   sb_all_redraw,dword 0
299
	mov   sb_all_redraw,dword 0
301
scroll_bar_exit
300
scroll_bar_exit
302
.draw_1:
301
.draw_1:
Line 307... Line 306...
307
	mov   edx,sb_btn_high
306
	mov   edx,sb_btn_high
308
	shl   edx,1
307
	shl   edx,1
309
	sub   eax,edx
308
	sub   eax,edx
310
	mov   sb_work_size,eax
309
	mov   sb_work_size,eax
311
;*********************************
310
;*********************************
312
	mov   eax,sb_work_size   ;sb_max_area
311
	mov   eax,sb_work_size
313
	mov   ebx,sb_max_area
312
	mov   ebx,sb_max_area
314
	cmp   ebx,sb_cur_area
313
	cmp   ebx,sb_cur_area
315
	ja	@f
314
	ja	@f
Line 316... Line 315...
316
 
315
 
Line 492... Line 491...
492
;********************************* 
491
;********************************* 
493
@@:
492
@@:
494
	pop   ecx
493
	pop   ecx
Line 495... Line 494...
495
	
494
	
496
	ror   ecx,16
495
	ror   ecx,16
497
	add   ecx,sb_btn_high  ;14 shl 16
496
	add   ecx,sb_btn_high
Line 498... Line 497...
498
	rol   ecx,16
497
	rol   ecx,16
499
	
498
	
500
	mov   edx,sb_line_col
499
	mov   edx,sb_line_col
Line 534... Line 533...
534
	mov   sb_m_pos_2,eax
533
	mov   sb_m_pos_2,eax
535
	jmp   .continue_2
534
	jmp   .continue_2
Line 536... Line 535...
536
	
535
	
537
@@:
536
@@:
538
	cmp   sb_m_keys,dword 0
537
	cmp   sb_m_keys,dword 0
539
	jne	 @f   ;.continue_2
538
	jne	 @f
540
	mov   eax,sb_m_pos
539
	mov   eax,sb_m_pos
541
	mov   sb_m_pos_2,eax
540
	mov   sb_m_pos_2,eax
542
	jmp   .correct_1	;.exit_sb	
541
	jmp   .correct_1	;.exit_sb	
543
@@:
542
@@:
Line 605... Line 604...
605
	mov   sb_delta2,word 1	
604
	mov   sb_delta2,word 1	
606
@@:
605
@@:
607
	push  eax
606
	push  eax
608
	mov   ax,sb_m_pos
607
	mov   ax,sb_m_pos
609
	cmp   ax,sb_m_pos_2
608
	cmp   ax,sb_m_pos_2
610
	je	.correct  ;.exit_sb	
609
	je	.correct	
Line 611... Line 610...
611
	
610
	
612
	shl   eax,16
611
	shl   eax,16
613
	shr   eax,16
612
	shr   eax,16
614
	mov   ebx,sb_m_pos_2
613
	mov   ebx,sb_m_pos_2
Line 673... Line 672...
673
	cmp   sb_m_keys,dword 0
672
	cmp   sb_m_keys,dword 0
674
	je   .exit_sb
673
	je   .exit_sb
Line 675... Line 674...
675
	
674
	
676
	mov   eax,sb_ar_offset
675
	mov   eax,sb_ar_offset
677
	cmp   sb_position,eax  ;dword 0
-
 
678
;	je	.exit_sb
676
	cmp   sb_position,eax  ;dword 0
Line 679... Line -...
679
	jbe   @f
-
 
680
	
677
	jbe   @f
681
;	dec   dword sb_position
678
	
682
	sub   sb_position,eax
679
	sub   sb_position,eax
683
	jmp   .all_sb
680
	jmp   .all_sb
684
@@:
681
@@:
Line 697... Line 694...
697
	cmp   ax,cx
694
	cmp   ax,cx
698
	ja	.down_sb
695
	ja	.down_sb
Line 699... Line 696...
699
	
696
	
700
@@:
697
@@:
701
	mov   ebx,sb_btn_high   ;16  ;15
-
 
702
;	inc   ebx
698
	mov   ebx,sb_btn_high   ;16  ;15
703
	add   bx,sb_start_y
699
	add   bx,sb_start_y
704
	sub   cx,bx
700
	sub   cx,bx
Line 705... Line 701...
705
	sub   ax,bx
701
	sub   ax,bx
Line 710... Line 706...
710
	cmp   sb_delta,word 1
706
	cmp   sb_delta,word 1
711
	je	.continue
707
	je	.continue
Line 712... Line 708...
712
	
708
	
713
@@:
709
@@:
714
	mov   edx,eax
-
 
715
;	sub   edx,sb_btn_high
710
	mov   edx,eax
716
	push  ebx
711
	push  ebx
717
	shr   ebx,1 
712
	shr   ebx,1 
718
	sub   edx,ebx
713
	sub   edx,ebx
719
	pop   ebx
714
	pop   ebx
Line 732... Line 727...
732
	sub   edx,sb_run_size
727
	sub   edx,sb_run_size
733
	cmp   sb_position2,edx
728
	cmp   sb_position2,edx
734
	jbe   .continue
729
	jbe   .continue
Line 735... Line 730...
735
	
730
	
736
	mov   sb_position2,edx
-
 
Line 737... Line 731...
737
;	jmp   .continue_1
731
	mov   sb_position2,edx
738
	
732
 
739
.continue:   
733
.continue:   
740
	mov   eax,sb_position2
734
	mov   eax,sb_position2
Line 748... Line 742...
748
	ja	@f
742
	ja	@f
Line 749... Line 743...
749
 
743
 
750
	xor   eax,eax
744
	xor   eax,eax
751
	inc   eax
745
	inc   eax
752
	mov   sb_position2,eax
746
	mov   sb_position2,eax
753
	jmp   .all_sb   ;.store_position
747
	jmp   .all_sb
754
@@:
748
@@:
755
	sub   eax,sb_cur_area
749
	sub   eax,sb_cur_area
756
	inc   eax
750
	inc   eax
757
	shl   eax,10
751
	shl   eax,10
Line 794... Line 788...
794
	sub   eax,sb_cur_area
788
	sub   eax,sb_cur_area
795
	push  eax
789
	push  eax
796
	sub   eax,ebx
790
	sub   eax,ebx
797
	cmp   sb_position,eax
791
	cmp   sb_position,eax
798
	pop   eax
792
	pop   eax
799
;	jae   .exit_sb
-
 
800
	jae   @f
793
	jae   @f
Line 801... Line -...
801
	
-
 
802
;	inc   dword sb_position
794
	
803
	add   sb_position,ebx
795
	add   sb_position,ebx
804
	jmp   .all_sb
796
	jmp   .all_sb
805
@@:
797
@@:
806
	mov   sb_position,eax
798
	mov   sb_position,eax
Line 824... Line 816...
824
{
816
{
825
scroll_bar_horizontal:
817
scroll_bar_horizontal:
826
.draw:
818
.draw:
827
	pusha
819
	pusha
828
	mov   edi,dword [esp+36]
820
	mov   edi,dword [esp+36]
829
;	mov   sb_all_redraw,dword 1
-
 
830
	mov   sb_delta,word 0
821
	mov   sb_delta,word 0
831
	call  .draw_1
822
	call  .draw_1
832
	mov   sb_all_redraw,dword 0
823
	mov   sb_all_redraw,dword 0
833
scroll_bar_exit
824
scroll_bar_exit
834
.draw_1:
825
.draw_1:
Line 1064... Line 1055...
1064
	mov   sb_m_pos_2,eax
1055
	mov   sb_m_pos_2,eax
1065
	jmp   .continue_2
1056
	jmp   .continue_2
Line 1066... Line 1057...
1066
	
1057
	
1067
@@:
1058
@@:
1068
	cmp   sb_m_keys,dword 0
1059
	cmp   sb_m_keys,dword 0
1069
	jne	 @f   ;.continue_2
1060
	jne	 @f
1070
	mov   eax,sb_m_pos
1061
	mov   eax,sb_m_pos
1071
	mov   sb_m_pos_2,eax
1062
	mov   sb_m_pos_2,eax
1072
	jmp   .correct_1	;.exit_sb
1063
	jmp   .correct_1	;.exit_sb
1073
@@:
1064
@@:
Line 1138... Line 1129...
1138
	mov   eax,sb_m_pos
1129
	mov   eax,sb_m_pos
1139
	mov   ebx,sb_m_pos_2
1130
	mov   ebx,sb_m_pos_2
1140
	shr   eax,16
1131
	shr   eax,16
1141
	shr   ebx,16
1132
	shr   ebx,16
1142
	cmp   eax,ebx
1133
	cmp   eax,ebx
1143
	je	.correct  ;.exit_sb	
1134
	je	.correct	
Line 1144... Line 1135...
1144
	
1135
	
1145
;	shl   eax,16
1136
;	shl   eax,16
1146
;	shr   eax,16
1137
;	shr   eax,16
1147
;	mov   ebx,sb_m_pos_2
1138
;	mov   ebx,sb_m_pos_2
Line 1206... Line 1197...
1206
	cmp   sb_m_keys,dword 0
1197
	cmp   sb_m_keys,dword 0
1207
	je   .exit_sb
1198
	je   .exit_sb
Line 1208... Line 1199...
1208
	
1199
	
1209
	mov   eax,sb_ar_offset
1200
	mov   eax,sb_ar_offset
1210
	cmp   sb_position,eax  ;dword 0
-
 
1211
;	je	.exit_sb
1201
	cmp   sb_position,eax  ;dword 0
Line 1212... Line -...
1212
	jbe   @f
-
 
1213
	
1202
	jbe   @f
1214
;	dec   dword sb_position
1203
	
1215
	sub   sb_position,eax
1204
	sub   sb_position,eax
1216
	jmp   .all_sb
1205
	jmp   .all_sb
1217
@@:
1206
@@:
Line 1230... Line 1219...
1230
	cmp   ax,cx
1219
	cmp   ax,cx
1231
	ja	.down_sb
1220
	ja	.down_sb
Line 1232... Line 1221...
1232
	
1221
	
1233
@@:
1222
@@:
1234
	mov   ebx,sb_btn_high   ;16  ;15
-
 
1235
;	inc   ebx
1223
	mov   ebx,sb_btn_high   ;16  ;15
1236
	add   bx,sb_start_x	;y
1224
	add   bx,sb_start_x	;y
1237
	sub   cx,bx
1225
	sub   cx,bx
Line 1238... Line 1226...
1238
	sub   ax,bx
1226
	sub   ax,bx
Line 1243... Line 1231...
1243
	cmp   sb_delta,word 1
1231
	cmp   sb_delta,word 1
1244
	je	.continue
1232
	je	.continue
Line 1245... Line 1233...
1245
	
1233
	
1246
@@:
1234
@@:
1247
	mov   edx,eax
-
 
-
 
1235
	mov   edx,eax
1248
;	sub   edx,sb_btn_high
1236
 
1249
	push  ebx
1237
	push  ebx
1250
	shr   ebx,1 
1238
	shr   ebx,1 
1251
	sub   edx,ebx
1239
	sub   edx,ebx
1252
	pop   ebx
1240
	pop   ebx
Line 1265... Line 1253...
1265
	sub   edx,sb_run_size
1253
	sub   edx,sb_run_size
1266
	cmp   sb_position2,edx
1254
	cmp   sb_position2,edx
1267
	jbe   .continue
1255
	jbe   .continue
Line 1268... Line 1256...
1268
	
1256
	
1269
	mov   sb_position2,edx
-
 
Line 1270... Line 1257...
1270
;	jmp   .continue_1
1257
	mov   sb_position2,edx
1271
	
1258
 
1272
.continue:   
1259
.continue:   
1273
	mov   eax,sb_position2
1260
	mov   eax,sb_position2
Line 1281... Line 1268...
1281
	ja	@f
1268
	ja	@f
Line 1282... Line 1269...
1282
 
1269
 
1283
	xor   eax,eax
1270
	xor   eax,eax
1284
	inc   eax
1271
	inc   eax
1285
	mov   sb_position2,eax
1272
	mov   sb_position2,eax
1286
	jmp   .all_sb   ;.store_position
1273
	jmp   .all_sb
1287
@@:
1274
@@:
1288
	sub   eax,sb_cur_area
1275
	sub   eax,sb_cur_area
1289
	inc   eax
1276
	inc   eax
1290
	shl   eax,10
1277
	shl   eax,10
Line 1327... Line 1314...
1327
	sub   eax,sb_cur_area
1314
	sub   eax,sb_cur_area
1328
	push  eax
1315
	push  eax
1329
	sub   eax,ebx
1316
	sub   eax,ebx
1330
	cmp   sb_position,eax
1317
	cmp   sb_position,eax
1331
	pop   eax
1318
	pop   eax
1332
;	jae   .exit_sb
-
 
1333
	jae   @f
1319
	jae   @f
Line 1334... Line -...
1334
	
-
 
1335
;	inc   dword sb_position
1320
	
1336
	add   sb_position,ebx
1321
	add   sb_position,ebx
1337
	jmp   .all_sb
1322
	jmp   .all_sb
1338
@@:
1323
@@:
1339
	mov   sb_position,eax
1324
	mov   sb_position,eax