Subversion Repositories Kolibri OS

Rev

Rev 825 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 825 Rev 828
Line 1... Line 1...
1
;   Picture browser by lisovin@26.ru
1
;   Picture browser by lisovin@26.ru
2
;   Modified by Ivan Poddubny - v.0.3
2
;   Modified by Ivan Poddubny - v.0.3
3
;   Modified by Diamond - v.0.4
3
;   Modified by Diamond - v.0.4
-
 
4
;   Modified by Mario79:
4
;   Modified by Mario79 - v.0.5  18.07.08 Dinamic Allocation Memory
5
;      v.0.5  18.07.08 Dinamic Allocation Memory
-
 
6
;      v.0.6  20.07.08
-
 
7
;             1) Use Editbox (Author )
-
 
8
;             2) Draw window without fill working area (C = 1)
-
 
9
;             3) Open file with parameter in patch:
-
 
10
;                Size of parameter - 4 bytes. Parameter starts with the character "\",
-
 
11
;                the unused characters are filled by a blank (ASCII 20h).
-
 
12
;                '\T  /hd0/1/1.jpg' - set background, mode: tile
-
 
13
;                '\S  /hd0/1/1.jpg' - set background, mode: stretch
5
;   Compile with FASM for Menuet
14
;   Compile with FASM for Menuet
Line 6... Line 15...
6
 
15
 
7
;******************************************************************************
16
;******************************************************************************
8
    use32
17
    use32
Line 16... Line 25...
16
    dd	   temp_area , 0x0	   ; I_Param , I_Icon
25
    dd	   temp_area , 0x0	   ; I_Param , I_Icon
Line 17... Line 26...
17
 
26
 
18
include    'lang.inc'
27
include    'lang.inc'
19
include    '..\..\..\macros.inc'
28
include    '..\..\..\macros.inc'
-
 
29
;include    'macros.inc'
-
 
30
include    'EDITBOX.INC'
20
;include    'macros.inc'
31
use_edit_box procinfo
Line 21... Line 32...
21
;******************************************************************************
32
;******************************************************************************
22
 
33
 
23
START:				; start of execution
34
START:				; start of execution
24
	mcall	68, 11
35
	mcall	68, 11
25
; check for parameters
36
; check for parameters
-
 
37
   cmp	 dword [temp_area],'BOOT'
26
   cmp	 dword [temp_area],'BOOT'
38
   jne	 .no_boot
27
   jne	 .no_boot
39
.background:
-
 
40
   call  load_image
28
   call  load_image
41
   call  convert
-
 
42
 
29
   call  convert
43
   call  background
30
   call  background
44
.exit:
31
   or	 eax,-1
45
   or	 eax,-1
Line 32... Line 46...
32
   mcall
46
   mcall
33
 .no_boot:
47
 .no_boot:
-
 
48
 
-
 
49
   cmp	 byte [temp_area],0
34
 
50
   jz	 .no_param
35
   cmp	 byte [temp_area],0
51
 
36
   jz	 .no_param
52
 
37
   mov	 edi,string	 ; clear string
53
   mov	 edi,string	 ; clear string
Line -... Line 54...
-
 
54
   mov	 ecx,256/4	 ;   length of a string
38
   mov	 ecx,256/4	 ;   length of a string
55
   xor	 eax,eax	 ;   symbol <0>
-
 
56
   rep	 stosd
-
 
57
 
-
 
58
 
-
 
59
   mov	 edi,temp_area	 ; look for <0> in temp_area
-
 
60
 
-
 
61
   cmp	 [edi],byte "\"
-
 
62
   jne	 .continue
-
 
63
   cmp	 [edi+1],byte "T"
-
 
64
   jne	 @f
-
 
65
   mov	 [bgrmode],dword 1
-
 
66
   jmp	 .continue_1
-
 
67
@@:
-
 
68
   cmp	 [edi+1],byte "S"
-
 
69
   jne	 START.exit
39
   xor	 eax,eax	 ;   symbol <0>
70
   mov	 [bgrmode],dword 2
40
   rep	 stosd
71
.continue_1:
41
 
72
   add	 edi,4
42
   mov	 edi,temp_area	 ; look for <0> in temp_area
73
.continue:
Line 43... Line 74...
43
   mov	 esi,edi
74
   mov	 esi,edi
44
   mov	 ecx,257	 ;   strlen
75
   mov	 ecx,257	 ;   strlen
45
   repne scasb
-
 
-
 
76
   repne scasb
-
 
77
	lea	ecx, [edi-temp_area]
46
	lea	ecx, [edi-temp_area]
78
 
47
 
79
   mov	 edi,string
Line 48... Line 80...
48
   mov	 edi,string
80
   rep	 movsb		 ; copy string from temp_area to "string" (filename)
Line 192... Line 224...
192
    mcall
224
    mcall
193
    ret
225
    ret
Line 194... Line 226...
194
 
226
 
-
 
227
 
195
 
228
load_image:
196
load_image:
229
 
197
	  mov	[fileinfo+0],dword 5
230
	  mov	[fileinfo+0],dword 5
Line 198... Line 231...
198
	  mov	[fileinfo+12],dword 0
231
	  mov	[fileinfo+12],dword 0
Line 245... Line 278...
245
    mov  eax,[eax+18]
278
    mov  eax,[eax+18]
246
	test	ebx, ebx
279
	test	ebx, ebx
247
	jns	@f
280
	jns	@f
248
	neg	ebx
281
	neg	ebx
249
@@:
282
@@:
250
    add  eax,20
283
    add  eax,9	;20
251
    cmp  eax,210
284
    cmp  eax,210
252
    jae  @f
285
    jae  @f
253
    mov  eax,210
286
    mov  eax,210
254
@@:
287
@@:
255
    add  ebx,58
288
    add  ebx,54     ;58
256
    cmp  ebx,56
289
    cmp  ebx,56
257
    jae  @f
290
    jae  @f
258
    mov  ebx,56
291
    mov  ebx,56
259
@@:
292
@@:
260
    mov  [wnd_width],eax
293
    mov  [wnd_width],eax
Line 276... Line 309...
276
	mov	cx, [eax+22]
309
	mov	cx, [eax+22]
277
	test	cx, cx
310
	test	cx, cx
278
	jns	@f
311
	jns	@f
279
	neg	cx
312
	neg	cx
280
@@:
313
@@:
281
    mov  edx,10*65536+50
314
    mov  edx,5*65536+50
282
    mcall 7,[soi]
315
    mcall 7,[soi]
283
  nodrawimage:
316
  nodrawimage:
284
    ret
317
    ret
Line 285... Line 318...
285
 
318
 
Line 486... Line 519...
486
	shr	eax, 16
519
	shr	eax, 16
487
	stosb
520
	stosb
488
	pop	eax
521
	pop	eax
489
	ret
522
	ret
Line -... Line 523...
-
 
523
 
-
 
524
;---------------------------------------------------------------------
-
 
525
get_window_param:
-
 
526
    mcall 9, procinfo, -1
-
 
527
    mov   eax,[ebx+46]
-
 
528
    mov   [window_high],eax
-
 
529
    mov   eax,[ebx+42]
-
 
530
    mov   [window_width],eax
-
 
531
;    mov   eax,[ebx+70]
-
 
532
;    mov   [window_status],eax
-
 
533
    mcall 48,4
-
 
534
    mov   [skin_high],eax
-
 
535
    ret
-
 
536
;---------------------------------------------------------------------
490
 
537
 
491
;   *********************************************
538
;   *********************************************
492
;   *******  WINDOW DEFINITIONS AND DRAW ********
539
;   *******  WINDOW DEFINITIONS AND DRAW ********
Line 506... Line 553...
506
;    mov  ecx,400                   ; [y start] *65536 + [y size]
553
;    mov  ecx,400                   ; [y start] *65536 + [y size]
507
    mov  ebx,0*65536
554
    mov  ebx,0*65536
508
    mov  ecx,0*65536
555
    mov  ecx,0*65536
509
    add  ebx,[wnd_width]
556
    add  ebx,[wnd_width]
510
    add  ecx,[wnd_height]
557
    add  ecx,[wnd_height]
511
    mov  edx,0x03ffffff 	   ; color of work area RRGGBB,8->color gl
558
    mov  edx,0x43ffffff 	   ; color of work area RRGGBB,8->color gl
512
    mcall
559
    mcall
Line -... Line 560...
-
 
560
 
-
 
561
    call get_window_param
-
 
562
 
-
 
563
    mov   ebx,5
-
 
564
    shl   ebx,16
-
 
565
    add   ebx,[window_width]
-
 
566
    sub   ebx,9
-
 
567
    push  ebx
-
 
568
    mov   ecx,[skin_high]
-
 
569
    shl   ecx,16
-
 
570
    add   ecx,50
-
 
571
    sub   ecx,[skin_high]
-
 
572
    mcall 13, , ,0xffffff
-
 
573
    mov  eax,[image_file]
-
 
574
    mov  ecx,[eax+22]
-
 
575
    mov  ebx,[eax+18]
-
 
576
    push ecx
-
 
577
    add  ebx,5
-
 
578
    mov  ax,bx
-
 
579
    shl  ebx,16
-
 
580
    add  ebx,[window_width]
-
 
581
    sub  ebx,4
-
 
582
    sub  bx,ax
-
 
583
    cmp  bx,0
-
 
584
    jb	 @f
-
 
585
    add  ecx,50 shl 16
-
 
586
    mcall 13, , ,0xffffff
-
 
587
@@:
-
 
588
    pop  ecx
-
 
589
    pop  ebx
-
 
590
    add  ecx,50
-
 
591
    mov  ax,cx
-
 
592
    shl  ecx,16
-
 
593
    add  ecx,[window_high]
-
 
594
    sub  cx,ax
-
 
595
    sub  ecx,4
-
 
596
    cmp  bx,0
-
 
597
    jb	 @f
-
 
598
    mcall 13, , ,0xffffff
513
 
599
@@:
514
    mov  eax,8
600
    mov  eax,8
515
    mov  ebx,10*65536+46
601
    mov  ebx,10*65536+46
516
    mov  ecx,25*65536+20
602
    mov  ecx,25*65536+20
517
    mov  edx,2
603
    mov  edx,2
Line 555... Line 641...
555
    ru,   ' ”€‰‹  Ž’Š   ˆ”Ž   ”Ž  ',\
641
    ru,   ' ”€‰‹  Ž’Š   ˆ”Ž   ”Ž  ',\
556
    de,   'DATEI OEFNEN  INFO   HGRD'
642
    de,   'DATEI OEFNEN  INFO   HGRD'
Line 557... Line 643...
557
 
643
 
Line -... Line 644...
-
 
644
thread1:			; start of thread1
-
 
645
 
-
 
646
	  mcall 40, 0x27
-
 
647
 
-
 
648
    mov  esi,string
-
 
649
@@:
-
 
650
    cld
-
 
651
    lodsb
-
 
652
    test al,al
-
 
653
    jne  @r
-
 
654
    sub  esi,string
-
 
655
    mov  eax,esi
-
 
656
    dec  eax
-
 
657
    mov edi, edit1
-
 
658
    mov ed_size, eax
558
thread1:			; start of thread1
659
    mov ed_pos, eax
Line 559... Line 660...
559
 
660
red1:
Line 560... Line 661...
560
     call draw_window1
661
    call draw_window1
561
 
662
 
Line 562... Line 663...
562
still1:
663
still1:
563
 
664
 
564
    mov  eax,10 		; wait here for event
665
    mov  eax,10 		; wait here for event
565
    mcall
666
    mcall
566
 
667
 
567
    cmp  eax,1			; redraw request ?
668
    cmp  eax,1			; redraw request ?
568
    je	 thread1
-
 
-
 
669
    je	 red1
569
    cmp  eax,2			; key in buffer ?
670
    cmp  eax,2			; key in buffer ?
Line 570... Line 671...
570
    je	 key1
671
    je	 key1
571
    cmp  eax,3			; button in buffer ?
672
    cmp  eax,3			; button in buffer ?
572
    je	 button1
-
 
573
 
-
 
574
    jmp  still1
-
 
575
 
-
 
576
  key1: 			; key
-
 
577
    mcall
-
 
578
    cmp  ah,179
-
 
579
    jne  noright
-
 
580
    mov  eax,[pos]
-
 
581
    cmp  eax,41
-
 
582
    ja	 still1
-
 
583
    inc  eax
-
 
584
    mov  [pos],eax
-
 
585
    call drawstring
-
 
586
    jmp  still1
-
 
587
  noright:
-
 
588
    cmp  ah,176
-
 
589
    jne  noleft
-
 
590
    mov  eax,[pos]
-
 
591
    test eax,eax
-
 
592
    je	 still1
-
 
593
    dec  eax
-
 
594
    mov  [pos],eax
-
 
595
    call drawstring
-
 
596
    jmp  still1
-
 
597
  noleft:
-
 
598
    cmp  ah,182        ;del
-
 
599
    jne  nodelet
-
 
600
    call shiftback
-
 
601
    call drawstring
-
 
602
    jmp  still1
-
 
603
  nodelet:
-
 
604
    cmp  ah,8	       ;zaboy
-
 
605
    jne  noback
-
 
606
    mov  eax,[pos]
-
 
607
    test eax,eax
-
 
608
    je	 still1
-
 
609
    dec  eax
673
    je	 button1
610
    mov  [pos],eax
-
 
611
    call shiftback
-
 
612
    call drawstring
-
 
613
    jmp  still1
-
 
614
  noback:
-
 
615
    cmp  ah,13
-
 
616
    jne  noenter
-
 
617
  enter1:
-
 
618
    mov  al,byte ' '
-
 
619
    mov  edi,string
674
	  mouse_edit_box name_editboxes
620
    mov  ecx,43
-
 
621
    cld
675
    jmp  still1
622
    repne scasb
676
 
623
    dec  edi
-
 
624
    mov  byte [edi],0
-
 
625
    jmp  close1
-
 
626
  noenter:
-
 
627
    cmp  ah,27
-
 
628
    jne  noesc
-
 
629
    jmp  enter1
-
 
630
  noesc:
-
 
631
    cmp  dword [pos],42
-
 
632
    jae  still1
-
 
633
 
-
 
634
    mov  edi,string
-
 
635
    add  edi,42
-
 
636
    mov  esi,edi
-
 
637
    dec  esi
-
 
638
    mov  ecx,42
-
 
639
    sub  ecx,[pos]
-
 
640
    std
677
  key1: 			; key
641
    rep  movsb
-
 
642
 
-
 
643
    shr  eax,8
-
 
644
    mov  esi,string
678
    mcall 2
Line 645... Line 679...
645
    add  esi,[pos]
679
    cmp ah,13
646
    mov  byte [esi],al
680
    je	close1
647
    inc  dword [pos]
681
    cmp ah,27
Line 648... Line 682...
648
    call drawstring
682
    je	close1
649
 
683
    key_edit_box name_editboxes
650
    jmp  still1
-
 
651
 
684
    jmp  still1
652
  button1:			; button
685
 
653
    mov  eax,17 		; get id
686
  button1:			; button
654
    mcall
687
    mov  eax,17 		; get id
655
 
688
    mcall
656
    cmp  ah,1			; button id=1 ?
-
 
657
    jne  noclose1
-
 
658
    jmp  enter1
-
 
659
  close1:
-
 
660
    bts  dword [status],2
-
 
661
    btr  dword [status],0
-
 
662
    mov  eax,-1 		; close this program
-
 
663
    mcall
-
 
664
  noclose1:
-
 
665
    cmp  ah,2
-
 
666
    jne  nosetcur
-
 
667
    mov  eax,37
-
 
668
    mov  ebx,1
-
 
669
    mcall
-
 
670
    shr  eax,16
-
 
671
    sub  eax,21
-
 
Line 672... Line -...
672
    xor  edx,edx
-
 
673
    mov  ebx,6
-
 
674
    div  ebx
-
 
675
    mov  [pos],eax
-
 
676
    call drawstring
689
 
677
    jmp  still1
-
 
678
  nosetcur:
-
 
679
    jmp  still1
-
 
680
 
-
 
681
 
-
 
682
  shiftback:
-
 
Line 683... Line 690...
683
    mov  edi,string
690
    cmp  ah,1			; button id=1 ?
684
    add  edi,[pos]
691
    jne  still1
685
    mov  esi,edi
692
  close1:
Line 715... Line 722...
715
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
722
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
716
    mov  edx,labelt1		   ; pointer to text beginning
723
    mov  edx,labelt1		   ; pointer to text beginning
717
    mov  esi,labelt1.size	   ; text length
724
    mov  esi,labelt1.size	   ; text length
718
    mcall
725
    mcall
Line 719... Line 726...
719
 
726
 
-
 
727
;    call drawstring
Line 720... Line 728...
720
    call drawstring
728
	draw_edit_box name_editboxes
721
 
729
 
722
    mov  eax,12 		   ; function 12:tell os about windowdraw
730
    mov  eax,12 		   ; function 12:tell os about windowdraw
Line 1111... Line 1119...
1111
image_file dd 0
1119
image_file dd 0
1112
;image_file_size dd 0
1120
;image_file_size dd 0
Line 1113... Line 1121...
1113
 
1121
 
Line 1114... Line 1122...
1114
pos: dd 6
1122
pos: dd 6
1115
 
1123
 
1116
;fileinfo:
1124
window_high dd 0
-
 
1125
window_width dd 0
1117
;     dd 0
1126
skin_high dd 0
1118
;     dd 0
1127
;---------------------------------------------------------------------
-
 
1128
; for EDITBOX
1119
;     dd 0
1129
name_editboxes:
Line -... Line 1130...
-
 
1130
edit1 edit_box 200,10,30,0xffffff,0xbbddff,0,0,0,255,string,ed_focus+ed_always_focus,0
-
 
1131
name_editboxes_end:
1120
;     dd 0x290000-I_END
1132
 
1121
;     dd I_END
1133
mouse_flag: dd 0x0
1122
 
1134
;---------------------------------------------------------------------
1123
fileinfo:
1135
fileinfo:
1124
     dd 5
1136
     dd 5
Line 1130... Line 1142...
1130
	db	'/sys/bgr.bmp',0
1142
	db	'/sys/bgr.bmp',0
Line 1131... Line 1143...
1131
 
1143
 
1132
IM_END:
1144
IM_END:
Line 1133... Line -...
1133
	rb	string+257-$
-
 
1134
 
1145
	rb	string+257-$
-
 
1146
 
-
 
1147
temp_area:
1135
process_info:
1148
procinfo:
1136
temp_area:
1149
process_info:
1137
rb 1024*4
1150
rb 1024*4
1138
rb 1024*2
1151
rb 1024*2
1139
;rb 0x10000
1152
;rb 0x10000