Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
31 halyavin 1
;   Picture browser by lisovin@26.ru
2
;   Modified by Ivan Poddubny - v.0.3
190 diamond 3
;   Modified by Diamond - v.0.4
828 mario79 4
;   Modified by Mario79:
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
31 halyavin 14
;   Compile with FASM for Menuet
15
 
16
;******************************************************************************
17
    use32
18
    org    0x0
825 mario79 19
    db	   'MENUET01'		   ; 8 byte id
20
    dd	   0x01 		   ; header version
21
    dd	   START		   ; start of code
22
    dd	   IM_END		   ; size of image
23
    dd	   I_END ;0x300000                 ; memory for app
24
    dd	   I_END ;0x300000                 ; esp
25
    dd	   temp_area , 0x0	   ; I_Param , I_Icon
132 diamond 26
 
31 halyavin 27
include    'lang.inc'
485 heavyiron 28
include    '..\..\..\macros.inc'
825 mario79 29
;include    'macros.inc'
828 mario79 30
include    'EDITBOX.INC'
31
use_edit_box procinfo
31 halyavin 32
;******************************************************************************
33
 
825 mario79 34
START:				; start of execution
35
	mcall	68, 11
31 halyavin 36
; check for parameters
825 mario79 37
   cmp	 dword [temp_area],'BOOT'
38
   jne	 .no_boot
828 mario79 39
.background:
31 halyavin 40
   call  load_image
41
   call  convert
828 mario79 42
 
31 halyavin 43
   call  background
828 mario79 44
.exit:
825 mario79 45
   or	 eax,-1
485 heavyiron 46
   mcall
31 halyavin 47
 .no_boot:
48
 
825 mario79 49
   cmp	 byte [temp_area],0
50
   jz	 .no_param
828 mario79 51
 
52
 
825 mario79 53
   mov	 edi,string	 ; clear string
54
   mov	 ecx,256/4	 ;   length of a string
55
   xor	 eax,eax	 ;   symbol <0>
56
   rep	 stosd
31 halyavin 57
 
828 mario79 58
 
825 mario79 59
   mov	 edi,temp_area	 ; look for <0> in temp_area
828 mario79 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
70
   mov	 [bgrmode],dword 2
71
.continue_1:
72
   add	 edi,4
73
.continue:
825 mario79 74
   mov	 esi,edi
75
   mov	 ecx,257	 ;   strlen
31 halyavin 76
   repne scasb
825 mario79 77
	lea	ecx, [edi-temp_area]
31 halyavin 78
 
825 mario79 79
   mov	 edi,string
80
   rep	 movsb		 ; copy string from temp_area to "string" (filename)
828 mario79 81
   cmp	 [temp_area],byte "\"
82
   je	 START.background
132 diamond 83
   call  load_image
84
   call  convert
85
 
31 halyavin 86
 .no_param:
87
 
88
 
825 mario79 89
   or  ecx,-1		; get information about me
31 halyavin 90
   call getappinfo
91
 
825 mario79 92
   mov	edx,[process_info+30] ; теперь в edx наш идентификатор
93
   mov	ecx,eax
31 halyavin 94
 
95
  @@:
96
   call getappinfo
825 mario79 97
   cmp	edx,[process_info+30]
98
   je	@f  ; если наш PID совпал с PID рассматриваемого процесса, мы нашли себя
99
   dec	ecx ; иначе смотрим следующий процесс
100
   jne	@b  ; возвращаемся, если не все процессы рассмотрены
31 halyavin 101
  @@:
102
 
103
; теперь в ecx номер процесса
104
    mov  [process],ecx
105
 
135 diamond 106
draw_still:
31 halyavin 107
    call draw_window
108
 
109
still:
110
 
825 mario79 111
    mov  eax,10 		; wait here for event
485 heavyiron 112
    mcall
31 halyavin 113
 
825 mario79 114
	dec	eax
115
	jz	red
116
	dec	eax
117
	jnz	button
31 halyavin 118
 
825 mario79 119
  key:				; key
135 diamond 120
    mov  al,2
485 heavyiron 121
    mcall
135 diamond 122
    mov  al,ah
123
    cmp  al,6
825 mario79 124
    je	 kfile
135 diamond 125
    cmp  al,15
825 mario79 126
    je	 kopen
135 diamond 127
    cmp  al,9
825 mario79 128
    je	 kinfo
135 diamond 129
    cmp  al,2
825 mario79 130
    je	 kbgrd
31 halyavin 131
    jmp  still
132
 
135 diamond 133
  red:
825 mario79 134
	test	byte [status], 4
135
	jz	draw_still
136
	mov	al, 18
137
	mov	ebx, 3
138
	mov	ecx, [process]
139
	mcall
140
	and	byte [status], not 4
141
	jmp	still
135 diamond 142
 
825 mario79 143
  button:			; button
144
    mov  eax,17 		; get id
485 heavyiron 145
    mcall
31 halyavin 146
 
825 mario79 147
    cmp  ah,1			; button id=1 ?
31 halyavin 148
    jne  noclose
149
 
825 mario79 150
    mov  eax,-1 		; close this program
485 heavyiron 151
    mcall
31 halyavin 152
  noclose:
153
    cmp  ah,2
154
    jne  nofile
155
  kfile:
825 mario79 156
	test	byte [status], 1
157
	jnz	still
158
	or	byte [status], 1
31 halyavin 159
    mov  eax,51
160
    mov  ebx,1
161
    mov  ecx,thread1
825 mario79 162
    mov  edx,thread   ;0x29fff0
485 heavyiron 163
    mcall
31 halyavin 164
    jmp  still
165
  nofile:
166
    cmp  ah,3
167
    jne  noopen
168
 
169
 kopen:
170
    mov ecx,-1
171
    call getappinfo
825 mario79 172
    mov eax,[image_file]
173
    mov ebx,dword [eax+42]
174
    mov ecx,dword [eax+46]
31 halyavin 175
    add ebx,10*65536-15
176
    add ecx,50*65536-55
177
    mov edx,0xffffff
178
    mov eax,13
485 heavyiron 179
    mcall
31 halyavin 180
 
181
    call load_image
182
 
183
  open1:
825 mario79 184
    mov eax,[image_file]
185
    cmp [eax],word 'BM'
31 halyavin 186
    jne  still
187
    call convert
188
    call drawimage
189
    jmp  still
190
  noopen:
191
 
192
    cmp  ah,4
193
    jne  noinfo
194
  kinfo:
825 mario79 195
	test	byte [status], 2
196
	jnz	still
197
	or	byte [status], 2
31 halyavin 198
    mov  eax,51
199
    mov  ebx,1
200
    mov  ecx,thread2
825 mario79 201
    mov  edx,thread-512  ;0x2afff0
485 heavyiron 202
    mcall
31 halyavin 203
    jmp  still
204
  noinfo:
205
 
206
; УСТАНОВИТЬ ФОН
207
    cmp  ah,5
208
    jne  still
209
  kbgrd:
825 mario79 210
	test	byte [status], 8
211
	jnz	still
212
	or	byte [status], 8
31 halyavin 213
    mov  eax,51
214
    mov  ebx,1
215
    mov  ecx,thread3
825 mario79 216
    mov  edx,thread-512*2  ;0x2bfff0
485 heavyiron 217
    mcall
31 halyavin 218
    jmp  still
219
    ;call background
220
 
221
 getappinfo:
222
    mov  eax,9
132 diamond 223
    mov  ebx,process_info
485 heavyiron 224
    mcall
31 halyavin 225
    ret
226
 
227
 
228
load_image:
828 mario79 229
 
825 mario79 230
	  mov	[fileinfo+0],dword 5
231
	  mov	[fileinfo+12],dword 0
232
	  mov	[fileinfo+16],dword process_info
233
 
234
    cmp  [image_file],0
235
    je	  @f
236
    mov   ecx,[image_file]
237
     mcall 68, 13,
238
 
190 diamond 239
@@:
825 mario79 240
	  mcall 70, fileinfo
241
 
242
	  mov	[fileinfo+0],dword 0
243
	  mov	[fileinfo+12],dword 512
244
	  mov	[fileinfo+16],dword process_info+40
245
 
246
	  mcall 70, fileinfo
247
 
248
	  mov	ecx,[process_info+32]
249
	  mov	[fileinfo+12],ecx
250
 
251
    mov  eax,[process_info+40+28]
252
 
253
	cmp	eax, 24
254
	jz	.convert24
255
	cmp	eax, 8
256
	jz	.convert8
257
	cmp	eax, 4
258
	jz	.convert4
259
     shl  ecx,2
260
.convert4:
261
     shl  ecx,1
262
.convert8:
263
     lea  ecx,[ecx*3]
264
.convert24:
265
     shl  ecx,1
266
@@:
267
 
268
	  mcall 68, 12
269
 
270
 
271
	  mov	[fileinfo+16],eax
272
	  mov	[image_file],eax
273
 
274
	  mcall 70, fileinfo
275
 
276
    mov  eax,[image_file]
277
    mov  ebx,[eax+22]
278
    mov  eax,[eax+18]
279
	test	ebx, ebx
280
	jns	@f
281
	neg	ebx
282
@@:
828 mario79 283
    add  eax,9	;20
132 diamond 284
    cmp  eax,210
285
    jae  @f
286
    mov  eax,210
287
@@:
828 mario79 288
    add  ebx,54     ;58
132 diamond 289
    cmp  ebx,56
290
    jae  @f
291
    mov  ebx,56
292
@@:
293
    mov  [wnd_width],eax
294
    mov  [wnd_height],ebx
295
    test [bWasDraw],1
825 mario79 296
    jz	 @f
132 diamond 297
    mov  esi,ebx
298
    mov  edx,eax
825 mario79 299
    mcall 67,-1,-1
132 diamond 300
@@:
301
    ret
31 halyavin 302
 
303
 
304
  drawimage:
825 mario79 305
    mov  eax,[image_file]
306
    cmp  [eax],word 'BM'
31 halyavin 307
    jne  nodrawimage
825 mario79 308
	mov	ecx, dword [eax+18-2]
309
	mov	cx, [eax+22]
310
	test	cx, cx
311
	jns	@f
312
	neg	cx
190 diamond 313
@@:
828 mario79 314
    mov  edx,5*65536+50
825 mario79 315
    mcall 7,[soi]
31 halyavin 316
  nodrawimage:
317
    ret
318
 
319
; УСТАНОВИТЬ ФОН
320
  background:
825 mario79 321
    mov  eax,[image_file]
322
    cmp  [eax],word 'BM'
31 halyavin 323
    jne  @f
825 mario79 324
    mov  ecx,[eax+18] ; ширина
325
    mov  edx,[eax+22] ; высота
326
    mcall 15,1
31 halyavin 327
 
328
    mov  esi, ecx
329
    imul esi, edx
825 mario79 330
	lea	esi, [esi+esi*2]
31 halyavin 331
    mov  ebx,5
332
    mov  ecx,[soi]
333
    xor  edx,edx
334
;;;    mov  esi, ;640*480*3
485 heavyiron 335
    mcall
31 halyavin 336
 
825 mario79 337
    dec  ebx	;tile/stretch
31 halyavin 338
    mov  ecx,dword [bgrmode]
485 heavyiron 339
    mcall
31 halyavin 340
 
341
    dec  ebx
485 heavyiron 342
    mcall
31 halyavin 343
   @@:
344
    ret
345
 
190 diamond 346
convert:
825 mario79 347
	mov	ecx, [image_file]  ;I_END
348
	add	ecx, [ecx+2]
349
	mov	[soi], ecx
350
	mov	eax,[image_file]
351
	mov	ebp, [eax+18]
352
	lea	ebp, [ebp*3]	; ebp = size of output scanline
353
	mov	eax, [eax+22]
354
	dec	eax
355
	mul	ebp
356
	add	eax, ecx
357
	mov	edi, eax	; edi points to last scanline
358
	mov	esi, [image_file]  ;I_END
359
	add	esi, [esi+10]
360
;        mov     ebx, I_END+54
361
	mov	ebx,[image_file]
362
	mov	edx, [ebx+22]
363
	add	ebx,54
364
	lea	eax, [ebp*2]
365
	mov	[delta], eax
366
	test	edx, edx
367
	jz	.ret
368
	jns	@f
369
	neg	edx
370
	and	[delta], 0
371
	mov	edi, ecx
190 diamond 372
@@:
825 mario79 373
;        movzx   eax, word [I_END+28]
374
	mov	eax,[image_file]
375
	movzx	eax,word [eax+28]
376
	cmp	eax, 24
377
	jz	convert24
378
	cmp	eax, 8
379
	jz	convert8
380
	cmp	eax, 4
381
	jz	convert4
382
	dec	eax
383
	jz	convert1
190 diamond 384
.ret:
825 mario79 385
	ret
190 diamond 386
convert24:
825 mario79 387
	mov	ecx, ebp
388
	rep	movsb
389
	sub	edi, [delta]
390
	mov	eax, ebp
391
	neg	eax
392
	and	eax, 3
393
	add	esi, eax
394
	dec	edx
395
	jnz	convert24
396
	ret
190 diamond 397
convert8:
825 mario79 398
	push	edi
399
	add	[esp], ebp
190 diamond 400
.loopi:
825 mario79 401
	xor	eax, eax
402
	lodsb
403
;        cmp     dword [I_END+30], 1
404
	push	eax
405
	mov	eax,[image_file]
406
	cmp	dword [eax+30],1
407
	pop	eax
408
	jnz	.nocompressed
190 diamond 409
.compressed:
825 mario79 410
	mov	ecx, eax
411
	jecxz	.special
412
	lodsb
413
	mov	eax, [ebx+eax*4]
190 diamond 414
@@:
825 mario79 415
	call	putpixel
416
	loop	@b
417
	jmp	.loopi
190 diamond 418
.nocompressed:
825 mario79 419
	mov	eax, [ebx+eax*4]
420
	call	putpixel
190 diamond 421
.loopicont:
825 mario79 422
	cmp	edi, [esp]
423
	jnz	.loopi
190 diamond 424
.next:
825 mario79 425
	pop	edi
426
	sub	edi, [delta]
427
	mov	eax, ebp
428
	and	eax, 3
429
	add	esi, eax
430
	dec	edx
431
	jnz	convert8
432
	ret
190 diamond 433
.special:
825 mario79 434
	lodsb
435
	test	al, al
436
	jz	.next
437
	cmp	al, 2
438
	jbe	.end
439
	mov	ecx, eax
440
	push	ecx
190 diamond 441
@@:
825 mario79 442
	xor	eax, eax
443
	lodsb
444
	mov	eax, [ebx+eax*4]
445
	call	putpixel
446
	loop	@b
447
	pop	ecx
448
	and	ecx, 1
449
	add	esi, ecx
450
	jmp	.loopi
190 diamond 451
.end:
825 mario79 452
	pop	edi
453
	ret
190 diamond 454
convert4:
825 mario79 455
	push	edi
456
	add	[esp], ebp
190 diamond 457
.loopi:
825 mario79 458
	xor	eax, eax
459
	lodsb
460
	shr	eax, 4
461
	mov	eax, [ebx+eax*4]
462
	call	putpixel
463
	cmp	edi, [esp]
464
	jz	.loopidone
465
	mov	al, [esi-1]
466
	and	eax, 0xF
467
	mov	eax, [ebx+eax*4]
468
	stosd
469
	dec	edi
470
	cmp	edi, [esp]
471
	jnz	.loopi
190 diamond 472
.loopidone:
825 mario79 473
	pop	edi
474
	sub	edi, [delta]
475
	call	align_input
476
	dec	edx
477
	jnz	convert4
478
	ret
190 diamond 479
convert1:
825 mario79 480
	push	edi
481
	add	[esp], ebp
190 diamond 482
.loopi:
825 mario79 483
	lodsb
484
	mov	ecx, 8
190 diamond 485
.loopii:
825 mario79 486
	add	al, al
487
	push	eax
488
	setc	al
489
	movzx	eax, al
490
	mov	eax, [ebx+eax*4]
491
	call	putpixel
492
	pop	eax
493
	cmp	edi, [esp]
494
	loopnz	.loopii
495
	jnz	.loopi
496
	pop	edi
497
	sub	edi, [delta]
498
	call	align_input
499
	dec	edx
500
	jnz	convert1
501
	ret
31 halyavin 502
 
190 diamond 503
align_input:
825 mario79 504
	push	esi
505
	push	eax
506
	mov	eax,[image_file]
507
	sub	esi,eax    ;I_END
508
	sub	esi,[eax+10]
509
	pop	eax
510
	neg	esi
511
	and	esi, 3
512
	add	[esp], esi
513
	pop	esi
514
	ret
31 halyavin 515
 
190 diamond 516
putpixel:
825 mario79 517
	push	eax
518
	stosw
519
	shr	eax, 16
520
	stosb
521
	pop	eax
522
	ret
31 halyavin 523
 
828 mario79 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
;---------------------------------------------------------------------
537
 
31 halyavin 538
;   *********************************************
539
;   *******  WINDOW DEFINITIONS AND DRAW ********
540
;   *********************************************
541
 
542
 
543
draw_window:
825 mario79 544
    or	 [bWasDraw],1
31 halyavin 545
 
825 mario79 546
    mov  eax,12 		   ; function 12:tell os about windowdraw
547
    mov  ebx,1			   ; 1, start of draw
485 heavyiron 548
    mcall
31 halyavin 549
 
825 mario79 550
				   ; DRAW WINDOW
551
    xor  eax,eax		   ; function 0 : define and draw window
132 diamond 552
;    mov  ebx,350                   ; [x start] *65536 + [x size]
553
;    mov  ecx,400                   ; [y start] *65536 + [y size]
825 mario79 554
    mov  ebx,0*65536
555
    mov  ecx,0*65536
132 diamond 556
    add  ebx,[wnd_width]
557
    add  ecx,[wnd_height]
828 mario79 558
    mov  edx,0x43ffffff 	   ; color of work area RRGGBB,8->color gl
485 heavyiron 559
    mcall
31 halyavin 560
 
828 mario79 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
599
@@:
31 halyavin 600
    mov  eax,8
601
    mov  ebx,10*65536+46
602
    mov  ecx,25*65536+20
603
    mov  edx,2
604
    mov  esi,0x780078
605
  newbutton:
485 heavyiron 606
    mcall
31 halyavin 607
    add  ebx,48*65536
608
    inc  edx
609
    cmp  edx,6
825 mario79 610
    jb	 newbutton
31 halyavin 611
 
825 mario79 612
				   ; WINDOW LABEL
613
    mov  eax,4			   ; function 4 : write text to window
614
    mov  ebx,8*65536+8		   ; [x start] *65536 + [y start]
615
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
616
    mov  edx,labelt		   ; pointer to text beginning
617
    mov  esi,12 		   ; text length
485 heavyiron 618
    mcall
31 halyavin 619
 
620
    mov  ebx,14*65536+32
621
    mov  edx,buttext
622
    mov  esi,26
485 heavyiron 623
    mcall
31 halyavin 624
 
625
    call drawimage
626
 
825 mario79 627
    mov  eax,12 		   ; function 12:tell os about windowdraw
628
    mov  ebx,2			   ; 2, end of draw
485 heavyiron 629
    mcall
31 halyavin 630
 
631
    ret
632
 
633
 
634
; DATA AREA
635
 
636
labelt:
825 mario79 637
	 db 'MeView v.0.4'
31 halyavin 638
 
639
lsz buttext,\
640
    en,   ' FILE   OPEN   INFO   BGRD',\
135 diamond 641
    ru,   ' ФАЙЛ  ОТКР   ИНФО   ФОН  ',\
642
    de,   'DATEI OEFNEN  INFO   HGRD'
31 halyavin 643
 
825 mario79 644
thread1:			; start of thread1
31 halyavin 645
 
828 mario79 646
	  mcall 40, 0x27
31 halyavin 647
 
828 mario79 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
659
    mov ed_pos, eax
660
red1:
661
    call draw_window1
662
 
31 halyavin 663
still1:
664
 
825 mario79 665
    mov  eax,10 		; wait here for event
485 heavyiron 666
    mcall
31 halyavin 667
 
825 mario79 668
    cmp  eax,1			; redraw request ?
828 mario79 669
    je	 red1
825 mario79 670
    cmp  eax,2			; key in buffer ?
671
    je	 key1
672
    cmp  eax,3			; button in buffer ?
673
    je	 button1
828 mario79 674
	  mouse_edit_box name_editboxes
31 halyavin 675
    jmp  still1
676
 
825 mario79 677
  key1: 			; key
828 mario79 678
    mcall 2
679
    cmp ah,13
680
    je	close1
681
    cmp ah,27
682
    je	close1
683
    key_edit_box name_editboxes
31 halyavin 684
    jmp  still1
685
 
825 mario79 686
  button1:			; button
687
    mov  eax,17 		; get id
485 heavyiron 688
    mcall
31 halyavin 689
 
825 mario79 690
    cmp  ah,1			; button id=1 ?
828 mario79 691
    jne  still1
31 halyavin 692
  close1:
693
    bts  dword [status],2
694
    btr  dword [status],0
825 mario79 695
    mov  eax,-1 		; close this program
485 heavyiron 696
    mcall
828 mario79 697
 
31 halyavin 698
    jmp  still1
699
 
700
;   *********************************************
701
;   *******  WINDOW DEFINITIONS AND DRAW ********
702
;   *********************************************
703
 
704
 
705
draw_window1:
706
 
707
 
825 mario79 708
    mov  eax,12 		   ; function 12:tell os about windowdraw
709
    mov  ebx,1			   ; 1, start of draw
485 heavyiron 710
    mcall
31 halyavin 711
 
825 mario79 712
				   ; DRAW WINDOW
713
    xor  eax,eax		   ; function 0 : define and draw window
714
    mov  ebx,100*65536+300	   ; [x start] *65536 + [x size]
715
    mov  ecx,100*65536+80	   ; [y start] *65536 + [y size]
716
    mov  edx,0x03780078 	   ; color of work area RRGGBB,8->color gl
485 heavyiron 717
    mcall
31 halyavin 718
 
825 mario79 719
				   ; WINDOW LABEL
720
    mov  eax,4			   ; function 4 : write text to window
721
    mov  ebx,8*65536+8		   ; [x start] *65536 + [y start]
722
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
723
    mov  edx,labelt1		   ; pointer to text beginning
724
    mov  esi,labelt1.size	   ; text length
485 heavyiron 725
    mcall
31 halyavin 726
 
828 mario79 727
;    call drawstring
728
	draw_edit_box name_editboxes
31 halyavin 729
 
825 mario79 730
    mov  eax,12 		   ; function 12:tell os about windowdraw
731
    mov  ebx,2			   ; 2, end of draw
485 heavyiron 732
    mcall
31 halyavin 733
 
734
    ret
735
 
736
 drawstring:
737
    pusha
825 mario79 738
    mov  eax,8		   ;invisible button
31 halyavin 739
    mov  ebx,21*65536+258
740
    mov  ecx,40*65536+15
132 diamond 741
    mov  edx,0x60000002
485 heavyiron 742
    mcall
31 halyavin 743
 
825 mario79 744
    mov  eax,13 	    ;bar
31 halyavin 745
    mov  edx,0xe0e0e0
485 heavyiron 746
    mcall
825 mario79 747
    push eax		    ;cursor
31 halyavin 748
    mov  eax,6*65536
749
    mul  dword [pos]
750
    add  eax,21*65536+6
751
    mov  ebx,eax
752
    pop  eax
753
    mov  edx,0x6a73d0
485 heavyiron 754
    mcall
825 mario79 755
    mov  eax,4		    ;path
31 halyavin 756
    mov  ebx,21*65536+44
757
    xor  ecx,ecx
758
    mov  edx,string
759
    mov  esi,43
485 heavyiron 760
    mcall
31 halyavin 761
 
762
 
763
    popa
764
    ret
765
 
766
; DATA AREA
767
 
768
lsz labelt1,\
825 mario79 769
   en,	'File',\
770
   ru,	'Файл',\
771
   de,	'Datei'
31 halyavin 772
 
825 mario79 773
thread2:			  ; start of info thread
31 halyavin 774
 
775
     call draw_window2
776
 
777
still2:
778
 
825 mario79 779
    mov  eax,10 		; wait here for event
485 heavyiron 780
    mcall
31 halyavin 781
 
825 mario79 782
    cmp  eax,1			; redraw request ?
783
    je	 thread2
784
    cmp  eax,2			; key in buffer ?
785
    je	 close2
786
    cmp  eax,3			; button in buffer ?
787
    je	 button2
31 halyavin 788
 
789
    jmp  still2
790
 
825 mario79 791
  button2:			 ; button
792
    mov  eax,17 		; get id
485 heavyiron 793
    mcall
31 halyavin 794
 
825 mario79 795
    cmp  ah,1			; button id=1 ?
31 halyavin 796
    jne  noclose2
797
  close2:
798
    btr dword [status],1
799
    bts dword [status],2
825 mario79 800
    mov  eax,-1 		; close this program
485 heavyiron 801
    mcall
31 halyavin 802
  noclose2:
803
 
804
    jmp  still2
805
 
806
 
807
 
808
 
809
;   *********************************************
810
;   *******  WINDOW DEFINITIONS AND DRAW ********
811
;   *********************************************
812
 
813
 
814
draw_window2:
815
 
816
 
825 mario79 817
    mov  eax,12 		   ; function 12:tell os about windowdraw
818
    mov  ebx,1			   ; 1, start of draw
485 heavyiron 819
    mcall
31 halyavin 820
 
825 mario79 821
				   ; DRAW WINDOW
822
    xor  eax,eax		   ; function 0 : define and draw window
823
    mov  ebx,100*65536+330	   ; [x start] *65536 + [x size]
824
    mov  ecx,100*65536+90	   ; [y start] *65536 + [y size]
825
    mov  edx,0x03780078 	   ; color of work area RRGGBB,8->color gl
485 heavyiron 826
    mcall
31 halyavin 827
 
825 mario79 828
				   ; WINDOW LABEL
829
    mov  eax,4			   ; function 4 : write text to window
830
    mov  ebx,8*65536+8		   ; [x start] *65536 + [y start]
831
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
832
    mov  edx,labelt2		   ; pointer to text beginning
833
    mov  esi,labelt2.size	   ; text length
485 heavyiron 834
    mcall
31 halyavin 835
 
836
    mov  ebx,10*65536+30
837
    mov  edx,string
838
    mov  esi,43
485 heavyiron 839
    mcall
31 halyavin 840
    mov  edx,fitext
841
    mov  esi,14
842
    add  ebx,70*65536+10
843
 followstring:
485 heavyiron 844
    mcall
31 halyavin 845
    add  ebx,10
846
    add  edx,esi
847
    cmp  ebx,80*65536+70
848
    jbe  followstring
849
    mov  eax,47
850
    mov  edx,200*65536+40
851
    mov  esi,ecx
825 mario79 852
    mov  ecx,[image_file]
853
    push ecx
854
    mov  ecx, [ecx+2]
31 halyavin 855
    call digitcorrect
485 heavyiron 856
    mcall
31 halyavin 857
    add  edx,10
825 mario79 858
    pop  ecx
859
    push ecx
860
    mov  ecx, [ecx+18]
31 halyavin 861
    call digitcorrect
485 heavyiron 862
    mcall
31 halyavin 863
    add  edx,10
825 mario79 864
    pop  ecx
865
    push ecx
866
    mov  ecx, [ecx+22]
31 halyavin 867
    call digitcorrect
485 heavyiron 868
    mcall
31 halyavin 869
    add  edx,10
825 mario79 870
    pop  ecx
871
    movzx ecx,word [ecx+28]
31 halyavin 872
    call digitcorrect
485 heavyiron 873
    mcall
31 halyavin 874
 
825 mario79 875
    mov  eax,12 		   ; function 12:tell os about windowdraw
876
    mov  ebx,2			   ; 2, end of draw
485 heavyiron 877
    mcall
31 halyavin 878
 
879
    ret
880
 
881
 digitcorrect:
882
    xor  ebx,ebx
883
    mov  bh,6
884
    cmp  ecx,99999
825 mario79 885
    ja	 c_end
31 halyavin 886
    dec  bh
887
    cmp  ecx,9999
825 mario79 888
    ja	 c_end
31 halyavin 889
    dec  bh
890
    cmp  ecx,999
825 mario79 891
    ja	 c_end
31 halyavin 892
    dec  bh
893
    cmp  ecx,99
825 mario79 894
    ja	 c_end
31 halyavin 895
    dec  bh
896
    cmp  ecx,9
825 mario79 897
    ja	 c_end
31 halyavin 898
    dec  bh
899
 c_end:
900
    bswap ebx
901
    ret
902
 
903
 
904
; DATA AREA
905
 
906
lsz labelt2,\
907
    en,   'File info',\
135 diamond 908
    ru,   'Информация о файле',\
909
    de,   'Dateiinfo'
31 halyavin 910
 
911
lsz fitext,\
912
     en, 'FILE SIZE     ',\
913
     en, 'X SIZE        ',\
914
     en, 'Y SIZE        ',\
915
     en, 'BITS PER PIXEL',\
825 mario79 916
			  \
31 halyavin 917
     ru, 'Размер файла  ',\
918
     ru, 'Ширина        ',\
919
     ru, 'Высота        ',\
135 diamond 920
     ru, 'Бит на пиксел ',\
825 mario79 921
			  \
135 diamond 922
     de, 'FATEIGROESSE  ',\
923
     de, 'X GROESSE     ',\
924
     de, 'Y GROESSE     ',\
925
     de, 'BITS PER PIXEL'
31 halyavin 926
 
825 mario79 927
thread3:			  ; start of bgrd thread
31 halyavin 928
 
929
     call draw_window3
930
 
931
still3:
932
 
825 mario79 933
    mov  eax,10 		; wait here for event
485 heavyiron 934
    mcall
31 halyavin 935
 
825 mario79 936
    cmp  eax,1			; redraw request ?
937
    je	 thread3
938
    cmp  eax,2			; key in buffer ?
939
    je	 key3
940
    cmp  eax,3			; button in buffer ?
941
    je	 button3
31 halyavin 942
 
943
    jmp  still3
944
 
945
  key3:
485 heavyiron 946
    mcall
31 halyavin 947
    cmp  ah,27
825 mario79 948
    je	 close3
31 halyavin 949
    cmp  ah,13
825 mario79 950
    je	 kok
31 halyavin 951
    cmp  ah,178 ;up
952
    jne  nofup
953
    cmp  dword [bgrmode],1
825 mario79 954
    je	 fdn
31 halyavin 955
  fup:
956
    dec dword [bgrmode]
957
    jmp  flagcont
958
  nofup:
959
    cmp  ah,177 ;down
960
    jne  still3
961
    cmp dword [bgrmode],2
825 mario79 962
    je	 fup
31 halyavin 963
  fdn:
964
    inc dword [bgrmode]
965
    jmp  flagcont
966
 
967
 
825 mario79 968
  button3:			 ; button
969
    mov  eax,17 		; get id
485 heavyiron 970
    mcall
31 halyavin 971
 
825 mario79 972
    cmp  ah,1			; button id=1 ?
31 halyavin 973
    jne  noclose3
974
  close3:
975
    btr dword [status],3
976
    bts dword [status],2
825 mario79 977
    mov  eax,-1 		; close this program
485 heavyiron 978
    mcall
31 halyavin 979
  noclose3:
980
    cmp  ah,4
981
    jne  nook
982
   kok:
983
    call background
984
    jmp  close3
985
  nook:
986
    cmp  ah,2
825 mario79 987
    jb	 still3
31 halyavin 988
    cmp  ah,3
825 mario79 989
    ja	 still3
31 halyavin 990
    dec  ah
991
    mov byte [bgrmode],ah
992
   flagcont:
993
    call drawflags
994
    jmp  still3
995
 
996
 
997
 
998
 
999
;   *********************************************
1000
;   *******  WINDOW DEFINITIONS AND DRAW ********
1001
;   *********************************************
1002
 
1003
 
1004
draw_window3:
1005
 
1006
 
825 mario79 1007
    mov  eax,12 		   ; function 12:tell os about windowdraw
1008
    mov  ebx,1			   ; 1, start of draw
485 heavyiron 1009
    mcall
31 halyavin 1010
 
825 mario79 1011
				   ; DRAW WINDOW
1012
    xor  eax,eax		   ; function 0 : define and draw window
1013
    mov  ebx,100*65536+200	   ; [x start] *65536 + [x size]
1014
    mov  ecx,100*65536+100	   ; [y start] *65536 + [y size]
1015
    mov  edx,0x03780078 	   ; color of work area RRGGBB,8->color gl
485 heavyiron 1016
    mcall
31 halyavin 1017
 
1018
    mov  eax,8
1019
    mov  ebx,70*65536+40
1020
    mov  ecx,70*65536+20
1021
    mov  edx,4
1022
    mov  esi,0xac0000
485 heavyiron 1023
    mcall
31 halyavin 1024
 
825 mario79 1025
				   ; WINDOW LABEL
1026
    mov  eax,4			   ; function 4 : write text to window
1027
    mov  ebx,8*65536+8		   ; [x start] *65536 + [y start]
1028
    mov  ecx,0x10ddeeff 	   ; font 1 & color ( 0xF0RRGGBB )
1029
    mov  edx,labelt3		   ; pointer to text beginning
1030
    mov  esi,labelt3.size	   ; text length
485 heavyiron 1031
    mcall
31 halyavin 1032
    add  ebx,38*65536+20
1033
    mov  ecx,0xddeeff
1034
    mov  edx, bgrdtext
1035
    mov  esi, bgrdtext.size
485 heavyiron 1036
    mcall
31 halyavin 1037
    add  ebx,40*65536+15
1038
    mov  edx, tiled
1039
    mov  esi, tiled.size
485 heavyiron 1040
    mcall
31 halyavin 1041
    add  ebx,15
1042
    mov  edx, stretch
1043
    mov  esi, stretch.size ;7
485 heavyiron 1044
    mcall
31 halyavin 1045
    add  ebx,18
1046
    mov  edx, ok_btn
1047
    mov  esi, ok_btn.size ;2
485 heavyiron 1048
    mcall
31 halyavin 1049
 
1050
    call drawflags
1051
 
825 mario79 1052
    mov  eax,12 		   ; function 12:tell os about windowdraw
1053
    mov  ebx,2			   ; 2, end of draw
485 heavyiron 1054
    mcall
31 halyavin 1055
 
1056
    ret
1057
 
1058
 drawflags:
1059
    mov  eax,8
1060
    mov  ebx,70*65536+10
1061
    mov  ecx,40*65536+10
1062
    mov  edx,2
1063
    mov  esi,0xe0e0e0
485 heavyiron 1064
    mcall
31 halyavin 1065
    add  ecx,15*65536
1066
    inc  edx
485 heavyiron 1067
    mcall
31 halyavin 1068
    mov  eax,4
1069
    mov  ebx,73*65536+42
1070
    xor  ecx,ecx
1071
    mov  edx,vflag
1072
    mov  esi,1
1073
    cmp  dword [bgrmode],1
825 mario79 1074
    je	 nodownflag
31 halyavin 1075
    add  ebx,15
1076
 nodownflag:
485 heavyiron 1077
    mcall
31 halyavin 1078
    ret
1079
 
1080
 
1081
; DATA AREA
825 mario79 1082
status	 dd 0  ;bit0=1 if file thread is created
1083
soi	 dd 0
1084
delta	dd	0
190 diamond 1085
process  dd 0
1086
 
1087
bWasDraw db 0
31 halyavin 1088
vflag: db 'x'
1089
bgrmode: dd 1
1090
 
132 diamond 1091
wnd_width dd 210
1092
wnd_height dd 53
1093
 
31 halyavin 1094
lsz labelt3,\
1095
    en,   'Background set',\
135 diamond 1096
    ru,   "Установка фона",\
1097
    de,   'Hintergrund gesetzt'
31 halyavin 1098
 
1099
lsz bgrdtext,\
1100
    en, 'SET AS BACKGROUND:',\
135 diamond 1101
    ru, 'Тип обоев:',\
1102
    de, 'ALS HINTERGRUND'
31 halyavin 1103
 
1104
lsz tiled,\
1105
    en, 'TILED',\
135 diamond 1106
    ru, 'замостить',\
1107
    de, 'GEKACHELT'
31 halyavin 1108
 
1109
lsz stretch,\
1110
    en, 'STRETCH',\
135 diamond 1111
    ru, 'растянуть',\
1112
    de, 'GESTRECKT'
31 halyavin 1113
 
1114
lsz ok_btn,\
1115
    en, 'Ok',\
135 diamond 1116
    ru, 'Ok',\
1117
    de, 'Ok'
31 halyavin 1118
 
825 mario79 1119
image_file dd 0
1120
;image_file_size dd 0
1121
 
135 diamond 1122
pos: dd 6
825 mario79 1123
 
828 mario79 1124
window_high dd 0
1125
window_width dd 0
1126
skin_high dd 0
1127
;---------------------------------------------------------------------
1128
; for EDITBOX
1129
name_editboxes:
1130
edit1 edit_box 200,10,30,0xffffff,0xbbddff,0,0,0,255,string,ed_focus+ed_always_focus,0
1131
name_editboxes_end:
825 mario79 1132
 
828 mario79 1133
mouse_flag: dd 0x0
1134
;---------------------------------------------------------------------
135 diamond 1135
fileinfo:
825 mario79 1136
     dd 5
135 diamond 1137
     dd 0
1138
     dd 0
825 mario79 1139
     dd 0		;x290000-I_END
1140
     dd process_info	;I_END
135 diamond 1141
string:
825 mario79 1142
	db	'/sys/bgr.bmp',0
31 halyavin 1143
 
135 diamond 1144
IM_END:
825 mario79 1145
	rb	string+257-$
31 halyavin 1146
 
828 mario79 1147
temp_area:
1148
procinfo:
132 diamond 1149
process_info:
825 mario79 1150
rb 1024*4
1151
rb 1024*2
1152
;rb 0x10000
1153
thread:
1154
rb 512
31 halyavin 1155
I_END: