Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
5183 hidnplayr 1
format binary as ""
2
 
1004 diamond 3
use32
4
org 0x0
5
 
6
db 'MENUET01'
1470 mario79 7
dd 0x01, START, I_END, F_END, stacktop, @PARAMS, 0x0
1004 diamond 8
 
9
;-----------------------------------------------------------------------------
10
 
3116 dunkaist 11
include '../../../config.inc'
1080 diamond 12
include '../../../proc32.inc'
13
include '../../../macros.inc'
3116 dunkaist 14
include '../../../dll.inc'
6801 IgorA 15
include '../../../KOSfuncs.inc'
3116 dunkaist 16
;include '../../../debug.inc'
1004 diamond 17
 
18
include '../../../develop/libraries/libs-dev/libio/libio.inc'
19
include '../../../develop/libraries/libs-dev/libimg/libimg.inc'
20
 
1511 mario79 21
;include '../../../develop/libraries/box_lib/asm/trunk/opendial.mac'
22
;use_OpenDialog
1004 diamond 23
;-----------------------------------------------------------------------------
24
 
25
START:
6801 IgorA 26
    mcall   SF_SYS_MISC, SSF_HEAP_INIT
1004 diamond 27
 
1570 dunkaist 28
    stdcall dll.Load, @IMPORT
29
    or  eax, eax
30
    jnz exit
1004 diamond 31
 
1570 dunkaist 32
    invoke  sort.START, 1
1016 diamond 33
 
1570 dunkaist 34
    mov ecx, 1  ; for 15.4: 1 = tile
35
    cmp word [@PARAMS], '\T'
36
    jz  set_bgr
37
    inc ecx ; for 15.4: 2 = stretch
38
    cmp word [@PARAMS], '\S'
39
    jz  set_bgr
1004 diamond 40
 
1594 mario79 41
    cmp byte [@PARAMS], 0
42
    jz @f
43
    mov esi, @PARAMS
44
    mov edi, path
45
    mov ecx, 4096/4
46
    rep movsd
47
    mov byte [edi-1], 0
48
@@:
49
; OpenDialog initialisation
50
    push    dword OpenDialog_data
51
    call    [OpenDialog_Init]
52
 
1427 diamond 53
; initialize keyboard handling
1570 dunkaist 54
    invoke  ini_get_shortcut, inifilename, aShortcuts, aNext, -1, next_mod
55
    mov [next_key], eax
56
    invoke  ini_get_shortcut, inifilename, aShortcuts, aPrev, -1, prev_mod
57
    mov [prev_key], eax
3116 dunkaist 58
    invoke  ini_get_shortcut, inifilename, aShortcuts, aSlide, -1, slide_mod
59
    mov [slide_key], eax
60
    invoke  ini_get_shortcut, inifilename, aShortcuts, aTglbar, -1, tglbar_mod
61
    mov [tglbar_key], eax
6801 IgorA 62
    mcall   SF_KEYBOARD, SSF_SET_INPUT_MODE, 1    ; set kbd mode to scancodes
1427 diamond 63
 
1570 dunkaist 64
    cmp byte [@PARAMS], 0
65
    jnz params_given
1004 diamond 66
 
1570 dunkaist 67
    mov [OpenDialog_data.draw_window],draw_window_fake
68
 
1511 mario79 69
; OpenDialog Open
1570 dunkaist 70
    push    dword OpenDialog_data
71
    call    [OpenDialog_Start]
1470 mario79 72
 
1570 dunkaist 73
    cmp [OpenDialog_data.status],1
74
    jne exit
1470 mario79 75
 
1570 dunkaist 76
    mov [OpenDialog_data.draw_window],draw_window
1470 mario79 77
 
1570 dunkaist 78
    mov esi, path
79
    mov edi, @PARAMS
80
    mov ecx, 4096/4
81
    rep movsd
82
    mov byte [edi-1], 0
83
    jmp params_given
1004 diamond 84
 
85
set_bgr:
6801 IgorA 86
    mcall   SF_BACKGROUND_SET, SSF_MODE_BG
1570 dunkaist 87
    mov eax, @PARAMS + 4
88
    call    load_image
89
    jc  exit
1004 diamond 90
 
1570 dunkaist 91
    call    set_as_bgr
92
    jmp exit
1004 diamond 93
 
94
params_given:
95
 
1570 dunkaist 96
    mov esi, @PARAMS
97
    push    esi
98
    call    find_last_name_component
1427 diamond 99
 
1570 dunkaist 100
    pop eax
101
    call    load_image
102
    jc  exit
103
    call    generate_header
1004 diamond 104
 
105
;-----------------------------------------------------------------------------
106
 
107
red:
1570 dunkaist 108
    call    draw_window
1004 diamond 109
 
110
still:
1570 dunkaist 111
    mov eax, [image]
112
    test    byte [eax + Image.Flags], Image.IsAnimated
6804 IgorA 113
    push    SF_WAIT_EVENT
1570 dunkaist 114
    pop eax
115
    jz  @f
6801 IgorA 116
    mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
1570 dunkaist 117
    mov edx, [cur_frame]
118
    mov ebx, [cur_frame_time]
119
    add ebx, [edx + Image.Delay]
120
    sub ebx, eax
121
    cmp ebx, [edx + Image.Delay]
122
    ja  red_update_frame
123
    test    ebx, ebx
124
    jz  red_update_frame
6804 IgorA 125
    push    SF_WAIT_EVENT_TIMEOUT
1570 dunkaist 126
    pop eax
1080 diamond 127
  @@:
1570 dunkaist 128
    mcall
129
    dec eax
130
    js  red_update_frame
131
    jz  red
132
    dec eax
133
    jnz button
1004 diamond 134
 
1080 diamond 135
key:
1570 dunkaist 136
    xor esi, esi
1427 diamond 137
keyloop:
6801 IgorA 138
    mcall   SF_GET_KEY
1570 dunkaist 139
    test    al, al
140
    jnz keyloopdone
141
    shr eax, 8
142
    mov ecx, eax
6801 IgorA 143
    mcall   SF_KEYBOARD, SSF_GET_CONTROL_KEYS
1570 dunkaist 144
    mov edx, next_mod
145
    call    check_shortcut
146
    jz  .next
147
    add edx, prev_mod - next_mod
148
    call    check_shortcut
3116 dunkaist 149
    jz  .prev
150
    add edx, slide_mod - prev_mod
151
    call    check_shortcut
152
    jz  .slide
153
    add edx, tglbar_mod - slide_mod
154
    call    check_shortcut
155
    jz  .tglbar
156
    cmp cl, 1 ; Esc
157
    jz  .esc
158
    jmp keyloop
159
.esc:
160
    test byte [bSlideShow], 1
161
    jnz .slide
162
    jmp keyloop
163
.tglbar:
164
    mov byte [bTglbar], 1
165
    test byte[bSlideShow], 1
166
    jnz @f
167
    xor [toolbar_height], 31
168
@@:
169
    jmp keyloop
170
.slide:
171
    call slide_show
172
    jmp keyloop
1427 diamond 173
.prev:
1570 dunkaist 174
    dec esi
175
    jmp keyloop
1427 diamond 176
.next:
1570 dunkaist 177
    inc esi
178
    jmp keyloop
1427 diamond 179
keyloopdone:
3116 dunkaist 180
    test esi, esi
181
    jnz next_or_prev_handler
182
    test byte [bSlideShow], 2
183
    jnz red
184
    test byte [bTglbar], 1
185
    jnz red
186
    jmp still
1427 diamond 187
next_or_prev_handler:
1570 dunkaist 188
    call    next_or_prev_image
189
    jmp red
1004 diamond 190
 
1080 diamond 191
red_update_frame:
1570 dunkaist 192
    mov eax, [cur_frame]
193
    mov eax, [eax + Image.Next]
194
    test    eax, eax
195
    jnz @f
196
    mov eax, [image]
1080 diamond 197
  @@:
1570 dunkaist 198
    mov [cur_frame], eax
6801 IgorA 199
    mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
1570 dunkaist 200
    mov [cur_frame_time], eax
6801 IgorA 201
    mcall   SF_THREAD_INFO, procinfo, -1
1570 dunkaist 202
    call    draw_cur_frame
203
    jmp still
1080 diamond 204
 
205
button:
6801 IgorA 206
    mcall   SF_GET_BUTTON
1570 dunkaist 207
    shr eax, 8
1004 diamond 208
 
1570 dunkaist 209
    ; flip horizontally
210
    cmp eax, 'flh'
211
    jne @f
1004 diamond 212
 
1570 dunkaist 213
    invoke  img.flip, [image], FLIP_HORIZONTAL
214
    jmp redraw_image
1004 diamond 215
 
1570 dunkaist 216
    ; flip vertically
217
    @@: cmp eax, 'flv'
218
    jne @f
1004 diamond 219
 
1570 dunkaist 220
    invoke  img.flip, [image], FLIP_VERTICAL
221
    jmp redraw_image
1004 diamond 222
 
1570 dunkaist 223
    ; flip both horizontally and vertically
224
    @@: cmp eax, 'flb'
225
    jne @f
1004 diamond 226
 
1570 dunkaist 227
    invoke  img.flip, [image], FLIP_BOTH
228
    jmp redraw_image
1004 diamond 229
 
1570 dunkaist 230
    ; rotate left
231
    @@: cmp eax, 'rtl'
232
    jne @f
1004 diamond 233
 
1570 dunkaist 234
    push    ROTATE_90_CCW
1004 diamond 235
.rotate_common:
1570 dunkaist 236
    invoke  img.rotate, [image]
237
    mov eax, [image]
238
    test    eax, eax    ; clear ZF flag
239
    call    update_image_sizes
240
    jmp redraw_image
1004 diamond 241
 
1570 dunkaist 242
    ; rotate right
243
    @@: cmp eax, 'rtr'
244
    jne @f
1004 diamond 245
 
1570 dunkaist 246
    push    ROTATE_90_CW
247
    jmp .rotate_common
1004 diamond 248
 
1570 dunkaist 249
    ; open new file
250
    @@: cmp eax, 'opn'
251
    jne @f
252
 
1511 mario79 253
; OpenDialog Open
1570 dunkaist 254
    push    dword OpenDialog_data
255
    call    [OpenDialog_Start]
256
 
257
    cmp [OpenDialog_data.status],1
258
    jne still
259
 
260
    mov esi, path
261
    mov edi, @PARAMS
262
    push    edi
263
    mov ecx, 4096/4
264
    rep movsd
265
    mov byte [edi-1], 0
266
 
267
    pop esi
268
    push    esi
269
    call    find_last_name_component
1475 diamond 270
 
1570 dunkaist 271
    pop eax
272
    push    [image]
273
    call    load_image
274
    jc  .restore_old
275
    call    generate_header
276
 
277
    invoke  img.destroy
278
    call    free_directory
279
    jmp red
280
 
1004 diamond 281
    .restore_old:
1570 dunkaist 282
    pop [image]
283
    call    init_frame
284
    jmp still
1004 diamond 285
 
1570 dunkaist 286
    ; set background
1016 diamond 287
    @@:
1570 dunkaist 288
    cmp eax, 'bgr'
289
    jne @f
1016 diamond 290
 
1570 dunkaist 291
    call    set_as_bgr
292
    jmp still
1016 diamond 293
 
294
    @@:
3116 dunkaist 295
    cmp eax, 'sld'
296
    jne @f
1016 diamond 297
 
3116 dunkaist 298
    call    slide_show
299
    jmp red
300
 
301
    @@:
302
 
1570 dunkaist 303
    or  esi, -1
304
    cmp eax, 'bck'
305
    jz  next_or_prev_handler
306
    neg esi
307
    cmp eax, 'fwd'
308
    jz  next_or_prev_handler
1016 diamond 309
 
1570 dunkaist 310
    cmp eax, 1
311
    jne still
1004 diamond 312
 
313
  exit:
6801 IgorA 314
    mcall   SF_TERMINATE_PROCESS
1004 diamond 315
 
316
  redraw_image = red
317
 
318
load_image:
1570 dunkaist 319
    and [img_data], 0
320
    push    eax
321
    invoke  file.open, eax, O_READ
322
    or  eax, eax
323
    jz  .error_pop
324
    mov [fh], eax
325
    invoke  file.size
326
    mov [img_data_len], ebx
327
    stdcall mem.Alloc, ebx
328
    test    eax, eax
329
    jz  .error_close
330
    mov [img_data], eax
331
    invoke  file.read, [fh], eax, [img_data_len]
332
    cmp eax, -1
333
    jz  .error_close
334
    cmp eax, [img_data_len]
335
    jnz .error_close
336
    invoke  file.close, [fh]
337
    inc eax
338
    jz  .error
1004 diamond 339
 
1570 dunkaist 340
    invoke  img.decode, [img_data], [img_data_len], 0
341
    or  eax, eax
342
    jz  .error
343
    cmp [image], 0
344
    pushf
345
    mov [image], eax
6804 IgorA 346
    call    img_resize_to_screen
1570 dunkaist 347
    call    init_frame
348
    popf
349
    call    update_image_sizes
350
    call    free_img_data
351
    clc
352
    ret
1004 diamond 353
 
354
.error_free:
1570 dunkaist 355
    invoke  img.destroy, [image]
356
    jmp .error
1004 diamond 357
 
358
.error_pop:
1570 dunkaist 359
    pop eax
360
    jmp .error
1004 diamond 361
.error_close:
1570 dunkaist 362
    invoke  file.close, [fh]
1004 diamond 363
.error:
1570 dunkaist 364
    call    free_img_data
365
    stc
366
    ret
1004 diamond 367
 
6804 IgorA 368
align 4
369
proc img_resize_to_screen uses eax ebx ecx edx
370
	mov ebx, [image]
371
	cmp	[ebx+Image.Type],Image.bpp24
372
	jne .end_f
373
	test [ebx+Image.Flags],Image.IsAnimated
374
	jnz .end_f
375
	mov eax, [ebx+Image.Data]
376
	mov [buf_0],eax
377
	mov eax, [ebx+Image.Width]
378
	mov [buf_0.w],eax
379
	mov eax, [ebx+Image.Height]
380
	mov [buf_0.h],eax
381
 
382
	mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
383
	mov edx, [image_padding]
384
	shl edx, 1
385
	add edx, eax
386
	mcall SF_GET_SCREEN_SIZE
387
	mov ecx, eax
388
	shr ecx, 17
389
 
390
	mov ebx, [image]
391
	movzx eax,ax
392
	sub eax, edx
393
	sub eax, [toolbar_height]
394
	sub eax, 5-1 ;5 px = border
395
	cmp eax, 1
396
	jle .end0
397
	cmp eax, [ebx+Image.Height]
398
	jl .end1
399
	.end0:
400
		xor eax,eax
401
		jmp .end2
402
	.end1:
403
		mov [ebx+Image.Height],eax
404
	.end2:
405
	sub ecx, [image_padding]
406
	shl ecx, 1
407
	sub ecx, 10-1 ;10 px = 2 borders
408
	cmp ecx, 1
409
	jle .end3
410
	cmp ecx, [ebx+Image.Width]
411
	jl .end4
412
	.end3:
413
		xor ecx,ecx
414
		jmp .end5
415
	.end4:
416
		mov [ebx+Image.Width],ecx
417
	.end5:
418
	cmp eax,ecx
419
	jne @f
420
		test eax,eax
421
		jz .end_f
422
	@@:
423
	stdcall [buf2d_resize], buf_0, ecx, eax, 2
424
.end_f:
425
	ret
426
endp
427
 
428
align 4
1004 diamond 429
free_img_data:
1570 dunkaist 430
    mov eax, [img_data]
431
    test    eax, eax
432
    jz  @f
433
    stdcall mem.Free, eax
1004 diamond 434
@@:
1570 dunkaist 435
    ret
1004 diamond 436
 
437
update_image_sizes:
1570 dunkaist 438
    pushf
439
    mov edx, [eax + Image.Width]
2036 dunkaist 440
    test    [eax + Image.Flags], Image.IsAnimated
441
    jnz .not_in_row
442
    push eax
443
@@: cmp [eax + Image.Next], 0
444
    jz  @f
445
    mov eax, [eax + Image.Next]
446
    add edx, [eax + Image.Width]
447
    inc edx
448
    jmp @b
449
@@: pop eax
450
.not_in_row:
1570 dunkaist 451
    mov [draw_width], edx
452
    add edx, 19
3116 dunkaist 453
    cmp edx, 50 + 25*numimages
1570 dunkaist 454
    jae @f
3116 dunkaist 455
    mov edx, 50 + 25*numimages
1004 diamond 456
@@:
3116 dunkaist 457
;    dec edx
1570 dunkaist 458
    mov [wnd_width], edx
459
    mov esi, [eax + Image.Height]
2036 dunkaist 460
    test    [eax + Image.Flags], Image.IsAnimated
461
    jnz .max_equals_first
462
    push eax
463
@@: cmp [eax + Image.Next], 0
464
    jz  @f
465
    mov eax, [eax + Image.Next]
466
    cmp esi, [eax + Image.Height]
467
    jae @b
468
    mov esi, [eax + Image.Height]
469
    jmp @b
470
@@: pop eax
471
.max_equals_first:
1570 dunkaist 472
    mov [draw_height], esi
3116 dunkaist 473
    add esi, [toolbar_height]
474
    add esi, [image_padding]
475
    add esi, [image_padding]
476
    add esi, 5  ; window bottom frame height
477
    dec esi
1570 dunkaist 478
    mov [wnd_height], esi
479
    popf
480
    jz  .no_resize
3116 dunkaist 481
    test [wnd_style], 1 SHL 25
482
    jz .no_resize
6801 IgorA 483
    mcall   SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
1570 dunkaist 484
    add esi, eax
6801 IgorA 485
    mcall   SF_CHANGE_WINDOW,-1,-1
1004 diamond 486
.no_resize:
1570 dunkaist 487
    ret
1004 diamond 488
 
1016 diamond 489
set_as_bgr:
1570 dunkaist 490
    mov esi, [image]
491
    mov ecx, [esi + Image.Width]
492
    mov edx, [esi + Image.Height]
6801 IgorA 493
    mcall   SF_BACKGROUND_SET, SSF_SIZE_BG
1016 diamond 494
 
6801 IgorA 495
    mcall   SF_BACKGROUND_SET, SSF_MAP_BG
1570 dunkaist 496
    test    eax, eax
497
    jz  @f
1016 diamond 498
 
1570 dunkaist 499
    push    eax
500
    invoke  img.to_rgb2, esi, eax
501
    pop ecx
6801 IgorA 502
    mcall   SF_BACKGROUND_SET, SSF_UNMAP_BG
1016 diamond 503
 
504
@@:
6801 IgorA 505
    mcall   SF_BACKGROUND_SET, SSF_REDRAW_BG
1570 dunkaist 506
    ret
1016 diamond 507
 
3116 dunkaist 508
slide_show:
509
    or  byte [bSlideShow], 2
510
    xor byte [bSlideShow], 1
511
    btc dword [wnd_style], 25
512
    jc  @f
513
    mov eax, [toolbar_height_old]
514
    mov [toolbar_height], eax
515
    mov [image_padding], 5
516
    jmp .toolbar_height_done
517
@@:
518
    mov eax, [toolbar_height]
519
    mov [toolbar_height_old], eax
520
    mov [toolbar_height], 0
521
    mov [image_padding], 0
522
.toolbar_height_done:
523
    ret
524
 
1427 diamond 525
; seek to ESI image files
526
; esi>0 means next file, esi<0 - prev file
527
next_or_prev_image:
1570 dunkaist 528
    push    esi
529
    call    load_directory
530
    pop esi
531
    mov ebx, [directory_ptr]
532
    test    ebx, ebx
533
    jz  .ret
534
    cmp dword[ebx+4], 0
535
    jz  .ret
536
    mov eax, [cur_file_idx]
537
    cmp eax, -1
538
    jnz @f
539
    test    esi, esi
540
    jns @f
541
    mov eax, [ebx+4]
1016 diamond 542
@@:
1570 dunkaist 543
    push    [image]
544
    add eax, esi
1427 diamond 545
@@:
1570 dunkaist 546
    test    eax, eax
547
    jns @f
548
    add eax, [ebx+4]
549
    jmp @b
1016 diamond 550
@@:
1570 dunkaist 551
    cmp eax, [ebx+4]
552
    jb  @f
553
    sub eax, [ebx+4]
554
    jmp @b
1427 diamond 555
@@:
1570 dunkaist 556
    push    eax
1427 diamond 557
.scanloop:
1570 dunkaist 558
    push    eax ebx esi
559
    imul    esi, eax, 304
560
    add esi, [directory_ptr]
561
    add esi, 32 + 40
562
    mov edi, curdir
1016 diamond 563
@@:
1570 dunkaist 564
    inc edi
565
    cmp byte [edi-1], 0
566
    jnz @b
567
    mov byte [edi-1], '/'
1016 diamond 568
@@:
1570 dunkaist 569
    lodsb
570
    stosb
571
    test    al, al
572
    jnz @b
573
    mov eax, curdir
574
    call    load_image
575
    pushf
576
    mov esi, curdir
577
    push    esi
578
    mov edi, @PARAMS
579
    mov ecx, 4096/4
580
    rep movsd
581
    mov byte [edi-1], 0
582
    pop esi
1040 diamond 583
@@:
1570 dunkaist 584
    lodsb
585
    test    al, al
586
    jnz @b
1040 diamond 587
@@:
1570 dunkaist 588
    dec esi
589
    cmp byte [esi], '/'
590
    jnz @b
591
    mov byte [esi], 0
592
    popf
593
    pop esi ebx eax
594
    jnc .loadedok
595
    test    esi, esi
596
    js  .try_prev
1427 diamond 597
.try_next:
1570 dunkaist 598
    inc eax
599
    cmp eax, [ebx+4]
600
    jb  @f
601
    xor eax, eax
1016 diamond 602
@@:
1427 diamond 603
.try_common:
1570 dunkaist 604
    cmp eax, [esp]
605
    jz  .notfound
606
    jmp .scanloop
1427 diamond 607
.try_prev:
1570 dunkaist 608
    dec eax
609
    jns @f
610
    mov eax, [ebx+4]
611
    dec eax
1016 diamond 612
@@:
1570 dunkaist 613
    jmp .try_common
1427 diamond 614
.loadedok:
1570 dunkaist 615
    mov [cur_file_idx], eax
616
    pop eax
617
    invoke  img.destroy
618
    call    generate_header
1016 diamond 619
.ret:
1570 dunkaist 620
    ret
1016 diamond 621
.notfound:
1570 dunkaist 622
    pop eax
623
    pop [image]
624
    call    init_frame
625
    ret
1016 diamond 626
 
627
load_directory:
1570 dunkaist 628
    cmp [directory_ptr], 0
629
    jnz .ret
630
    mov esi, @PARAMS
631
    mov edi, curdir
632
    mov ecx, [last_name_component]
633
    sub ecx, esi
634
    dec ecx
635
    js  @f
636
    rep movsb
1427 diamond 637
@@:
1570 dunkaist 638
    mov byte [edi], 0
6801 IgorA 639
    mcall   SF_SYS_MISC, SSF_MEM_ALLOC, 0x1000
1570 dunkaist 640
    test    eax, eax
641
    jz  .ret
642
    mov ebx, readdir_fileinfo
643
    mov dword [ebx+12], (0x1000 - 32) / 304
644
    mov dword [ebx+16], eax
6801 IgorA 645
    mcall   SF_FILE
1570 dunkaist 646
    cmp eax, 6
647
    jz  .dirok
648
    test    eax, eax
649
    jnz free_directory
650
    mov edx, [directory_ptr]
651
    mov ecx, [edx+8]
652
    mov [readblocks], ecx
653
    imul    ecx, 304
654
    add ecx, 32
6801 IgorA 655
    mcall   SF_SYS_MISC, SSF_MEM_REALLOC
1570 dunkaist 656
    test    eax, eax
657
    jz  free_directory
658
    mov [directory_ptr], eax
6801 IgorA 659
    mcall   SF_FILE, readdir_fileinfo
1016 diamond 660
.dirok:
1570 dunkaist 661
    cmp ebx, 0
662
    jle free_directory
663
    mov eax, [directory_ptr]
664
    add eax, 32
665
    mov edi, eax
666
    push    0
1016 diamond 667
.dirskip:
1570 dunkaist 668
    push    eax
669
    test    byte [eax], 18h
670
    jnz .nocopy
671
    lea esi, [eax+40]
672
    mov ecx, esi
1016 diamond 673
@@:
1570 dunkaist 674
    lodsb
675
    test    al, al
676
    jnz @b
1016 diamond 677
@@:
1570 dunkaist 678
    dec esi
679
    cmp esi, ecx
680
    jb  .noext
681
    cmp byte [esi], '.'
682
    jnz @b
683
    inc esi
684
    mov ecx, [esi]
5183 hidnplayr 685
    cmp byte[esi+3], 0
686
    jne .not_3
1570 dunkaist 687
    or  ecx, 0x202020
688
    cmp ecx, 'jpg'
689
    jz  .copy
690
    cmp ecx, 'bmp'
691
    jz  .copy
692
    cmp ecx, 'gif'
693
    jz  .copy
694
    cmp ecx, 'png'
695
    jz  .copy
696
    cmp ecx, 'jpe'
697
    jz  .copy
698
    cmp ecx, 'ico'
699
    jz  .copy
700
    cmp ecx, 'cur'
701
    jz  .copy
3116 dunkaist 702
    cmp ecx, 'tga'
703
    jz  .copy
1575 dunkaist 704
    cmp ecx, 'pcx'
705
    jz  .copy
1922 dunkaist 706
    cmp ecx, 'xcf'
707
    jz  .copy
2389 dunkaist 708
    cmp ecx, 'pbm'
709
    jz  .copy
710
    cmp ecx, 'pgm'
711
    jz  .copy
712
    cmp ecx, 'pnm'
713
    jz  .copy
714
    cmp ecx, 'tif'
715
    jz  .copy
5183 hidnplayr 716
  .not_3:
717
    cmp byte[esi+4], 0
718
    jne .nocopy
719
    or  ecx, 0x20202020
2389 dunkaist 720
    cmp ecx, 'tiff'
721
    jz  @f
2394 dunkaist 722
    cmp ecx, 'wbmp'
723
    jz  @f
1570 dunkaist 724
    cmp ecx, 'jpeg'
725
    jnz .nocopy
1016 diamond 726
@@:
1570 dunkaist 727
    cmp byte [esi+4], 0
728
    jnz .nocopy
1016 diamond 729
.copy:
1570 dunkaist 730
    mov esi, [esp]
731
    mov ecx, 304 / 4
732
    rep movsd
733
    inc dword [esp+4]
1016 diamond 734
.nocopy:
735
.noext:
1570 dunkaist 736
    pop eax
737
    add eax, 304
738
    dec ebx
739
    jnz .dirskip
740
    mov eax, [directory_ptr]
741
    pop ebx
742
    mov [eax+4], ebx
743
    test    ebx, ebx
744
    jz  free_directory
745
    push    0   ; sort mode
746
    push    ebx
747
    add eax, 32
748
    push    eax
749
    call    [SortDir]
750
    xor eax, eax
751
    mov edi, [directory_ptr]
752
    add edi, 32 + 40
1016 diamond 753
.scan:
1570 dunkaist 754
    mov esi, [last_name_component]
755
    push    edi
756
    invoke  strcmpi
757
    pop edi
758
    jz  .found
759
    inc eax
760
    add edi, 304
761
    dec ebx
762
    jnz .scan
763
    or  eax, -1
1016 diamond 764
.found:
1570 dunkaist 765
    mov [cur_file_idx], eax
1016 diamond 766
.ret:
1570 dunkaist 767
    ret
1016 diamond 768
 
769
free_directory:
6801 IgorA 770
    mcall   SF_SYS_MISC, SSF_MEM_FREE, [directory_ptr]
1570 dunkaist 771
    and [directory_ptr], 0
772
    ret
1016 diamond 773
 
1427 diamond 774
; in: esi->full name (e.g. /path/to/file.png)
775
; out: [last_name_component]->last component (e.g. file.png)
776
find_last_name_component:
1570 dunkaist 777
    mov ecx, esi
1427 diamond 778
@@:
1570 dunkaist 779
    lodsb
780
    test    al, al
781
    jnz @b
1427 diamond 782
@@:
1570 dunkaist 783
    dec esi
784
    cmp esi, ecx
785
    jb  @f
786
    cmp byte [esi], '/'
787
    jnz @b
1427 diamond 788
@@:
1570 dunkaist 789
    inc esi
790
    mov [last_name_component], esi
791
    ret
1427 diamond 792
 
1080 diamond 793
init_frame:
1570 dunkaist 794
    push    eax
795
    mov eax, [image]
796
    mov [cur_frame], eax
797
    test    byte [eax + Image.Flags], Image.IsAnimated
798
    jz  @f
799
    push    ebx
6801 IgorA 800
    mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
1570 dunkaist 801
    pop ebx
802
    mov [cur_frame_time], eax
1080 diamond 803
@@:
1570 dunkaist 804
    pop eax
805
    ret
1080 diamond 806
 
1004 diamond 807
draw_window:
3116 dunkaist 808
    btr  word [bSlideShow], 1  ; mode changed
809
    jc .mode_changed
810
    test byte [bTglbar], 1
811
    jz .mode_not_changed
812
.mode_changed:
813
    test [wnd_style], 1 SHL 25
814
    jz .mode_slide
815
    mov [bg_color], 0x00ffffff
816
    mov eax, [image]
817
    cmp eax, eax
818
    call update_image_sizes
6801 IgorA 819
    mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
3116 dunkaist 820
    mov esi, [wnd_height]
821
    add esi, eax
822
    test byte [bTglbar], 1
823
    jz @f
6801 IgorA 824
    mcall SF_CHANGE_WINDOW, -1, -1, [wnd_width],
3116 dunkaist 825
    jmp .mode_not_changed
826
@@:
6801 IgorA 827
    mcall SF_CHANGE_WINDOW, [wnd_x], [wnd_y], [wnd_width],
3116 dunkaist 828
    jmp .mode_not_changed
829
.mode_slide:
830
    mov [bg_color], 0x00000000
831
    mov eax, [procinfo.box.left]
832
    mov [wnd_x], eax
833
    mov eax, [procinfo.box.top]
834
    mov [wnd_y], eax
6801 IgorA 835
    mcall SF_GET_SCREEN_SIZE
3116 dunkaist 836
    mov edx, eax
837
    shr edx, 16
838
    movzx eax, ax
839
    mov esi, eax
6801 IgorA 840
    mcall SF_CHANGE_WINDOW, 0, 0, ,
3116 dunkaist 841
    jmp .posok.slide_show
842
 
843
.mode_not_changed:
1570 dunkaist 844
    cmp [bFirstDraw], 0
845
    jz  .posok
846
    or  ecx, -1
6801 IgorA 847
    mcall   SF_THREAD_INFO, procinfo
1040 diamond 848
 
3116 dunkaist 849
    test byte [procinfo.wnd_state], 0x04
850
    jnz .posok
1040 diamond 851
 
1570 dunkaist 852
    mov edx, ecx
853
    mov esi, ecx
3116 dunkaist 854
    cmp dword [procinfo.box.width], 50 + 25 * numimages
1570 dunkaist 855
    jae @f
3116 dunkaist 856
    mov edx, 50 + 25 * numimages
1040 diamond 857
@@:
3116 dunkaist 858
    cmp dword [procinfo.box.height], 70
1570 dunkaist 859
    jae @f
860
    mov esi, 70
1040 diamond 861
@@:
1570 dunkaist 862
    mov eax, edx
863
    and eax, esi
864
    cmp eax, -1
865
    jz  @f
866
    mov ebx, ecx
6801 IgorA 867
    mcall   SF_CHANGE_WINDOW
1040 diamond 868
@@:
869
 
870
.posok:
3116 dunkaist 871
    test [wnd_style], 1 SHL 25
872
    jz .posok.slide_show
6801 IgorA 873
    mcall   SF_REDRAW, SSF_BEGIN_DRAW
874
    mcall   SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
1570 dunkaist 875
    mov ebp, eax    ; save skin height
876
    add eax, [wnd_height]
3116 dunkaist 877
    mov ebx, [wnd_x]
878
    shl ebx, 16
1570 dunkaist 879
    add ebx, [wnd_width]
3116 dunkaist 880
    mov ecx, [wnd_y]
881
    shl ecx, 16
882
    add ecx, eax
6801 IgorA 883
    mcall   SF_CREATE_WINDOW, , , [wnd_style], 0, real_header
3116 dunkaist 884
    jmp .posok.common
885
.posok.slide_show:
6801 IgorA 886
    mcall   SF_REDRAW, SSF_BEGIN_DRAW
887
    mcall SF_GET_SCREEN_SIZE
3116 dunkaist 888
    mov ebx, eax
889
    shr ebx, 16
890
    movzx eax, ax
891
    mov ecx, eax
6801 IgorA 892
    mcall   SF_CREATE_WINDOW, , , [wnd_style], 0, real_header
3116 dunkaist 893
.posok.common:
6801 IgorA 894
    mcall   SF_THREAD_INFO, procinfo, -1
3116 dunkaist 895
    mov eax, [procinfo.client_box.width]
896
    sub eax, [image_padding]
897
    sub eax, [image_padding]
898
    sub eax, [draw_width]
899
    sar eax, 1
900
    test eax, eax
901
    jns @f
902
    mov eax, 0
903
@@:
904
    add eax, [image_padding]
905
    mov [draw_x], eax
906
    mov eax, [procinfo.client_box.height]
907
    sub eax, [toolbar_height]
908
    sub eax, [image_padding]
909
    sub eax, [image_padding]
910
    sub eax, [draw_height]
911
    sar eax, 1
912
    test eax, eax
913
    jns @f
914
    mov eax, 0
915
@@:
916
    add eax, [toolbar_height]
917
    add eax, [image_padding]
918
    mov [draw_y], eax
1570 dunkaist 919
    mov [bFirstDraw], 1
3116 dunkaist 920
    cmp dword [procinfo.client_box.height], 0
1570 dunkaist 921
    jle .nodraw
3116 dunkaist 922
    mov ebx, [procinfo.client_box.width]
1570 dunkaist 923
    inc ebx
3116 dunkaist 924
    mov ecx, [draw_y]
6801 IgorA 925
    mcall   SF_DRAW_RECT, , , [bg_color]
3116 dunkaist 926
    mov ecx, [procinfo.client_box.height]
1570 dunkaist 927
    inc ecx
3116 dunkaist 928
    mov esi, [cur_frame]
929
    mov esi, [esi + Image.Height]
930
    add esi, [draw_y]
1570 dunkaist 931
    sub ecx, esi
932
    jbe @f
933
    push    esi
934
    shl esi, 16
935
    add ecx, esi
936
    pop esi
937
    mcall
938
    xor ecx, ecx
1040 diamond 939
@@:
1570 dunkaist 940
    add ecx, esi
3116 dunkaist 941
    mov ebx, [draw_y]
942
    sub ecx, ebx
943
    shl ebx, 16
944
    add ecx, ebx
945
    mov ebx, [draw_x]
1570 dunkaist 946
    mcall
3116 dunkaist 947
    mov esi, [cur_frame]
948
    mov esi, [esi + Image.Width]
1570 dunkaist 949
    add esi, ebx
3116 dunkaist 950
    mov ebx, [procinfo.client_box.width]
1570 dunkaist 951
    inc ebx
952
    sub ebx, esi
953
    jbe @f
954
    shl esi, 16
955
    add ebx, esi
956
    mcall
1040 diamond 957
@@:
1004 diamond 958
 
3116 dunkaist 959
    test [wnd_style], 1 SHL 25
960
    jz .slide_show_mode
961
    mov byte [bTglbar], 0
962
    cmp byte [toolbar_height], 0
963
    je .decorations_done
964
    mov ebx, [procinfo.client_box.width]
1570 dunkaist 965
    push    ebx
6801 IgorA 966
    mcall   SF_DRAW_LINE, , <30, 30>, 0x007F7F7F
1570 dunkaist 967
    mcall   , <5 + 25 * 1, 5 + 25 * 1>, <0, 30>
968
    mcall   , <10 + 25 * 3, 10 + 25 * 3>
3116 dunkaist 969
    mcall   , <15 + 25 * 5, 15 + 25 * 5>
1570 dunkaist 970
    pop ebx
3116 dunkaist 971
    sub ebx, 25 * 5 + 10
1570 dunkaist 972
    push    ebx
973
    imul    ebx, 10001h
974
    mcall
1004 diamond 975
 
6801 IgorA 976
    mcall   SF_DEFINE_BUTTON, <5 + 25 * 0, 20>, <5, 20>, 'opn'+40000000h
1570 dunkaist 977
    mcall   , <10 + 25 * 1, 20>, , 'bck'+40000000h
978
    mcall   , <10 + 25 * 2, 20>, , 'fwd'+40000000h
979
    mcall   , <15 + 25 * 3, 20>, , 'bgr'+40000000h
3116 dunkaist 980
    mcall   , <15 + 25 * 4, 20>, , 'sld'+40000000h
1570 dunkaist 981
    pop ebx
982
    add ebx, 5
983
    shl ebx, 16
984
    mov bl, 20
985
    mcall   , , , 'flh'+40000000h
986
    add ebx, 25 * 65536
987
    mcall   , , , 'flv'+40000000h
988
    add ebx, 30 * 65536
989
    mcall   , , , 'rtr'+40000000h
990
    add ebx, 25 * 65536
991
    mcall   , , , 'rtl'+40000000h
992
    add ebx, 25 * 65536
993
    mcall   , , , 'flb'+40000000h
1004 diamond 994
 
1570 dunkaist 995
    mov ebp, (numimages-1)*20
1004 diamond 996
 
6801 IgorA 997
    mcall   SF_PUT_IMAGE_EXT, buttons+openbtn*20, <20, 20>, <5 + 25 * 0, 5>, 8, palette
3116 dunkaist 998
    mcall   , buttons+backbtn*20,    , <10 + 25 * 1, 5>
1570 dunkaist 999
    mcall   , buttons+forwardbtn*20, , <10 + 25 * 2, 5>
3116 dunkaist 1000
    mcall   , buttons+bgrbtn*20,     , <15 + 25 * 3, 5>
1001
    mcall   , buttons+slidebtn*20,   , <15 + 25 * 4, 5>
1002
    mov edx, [procinfo.client_box.width]
1570 dunkaist 1003
    sub edx, 25 * 5 + 4
1004
    shl edx, 16
1005
    mov dl, 5
1006
    mcall   , buttons+fliphorzbtn*20
1007
    add edx, 25 * 65536
1008
    mcall   , buttons+flipvertbtn*20
1009
    add edx, 30 * 65536
1010
    mcall   , buttons+rotcwbtn*20
1011
    add edx, 25 * 65536
1012
    mcall   , buttons+rotccwbtn*20
1013
    add edx, 25 * 65536
1014
    mcall   , buttons+rot180btn*20
3116 dunkaist 1015
    jmp .decorations_done
1004 diamond 1016
 
3116 dunkaist 1017
.slide_show_mode:
1018
 
1019
.decorations_done:
1570 dunkaist 1020
    call    draw_cur_frame
1004 diamond 1021
 
1087 diamond 1022
.nodraw:
6801 IgorA 1023
    mcall   SF_REDRAW, SSF_END_DRAW
1040 diamond 1024
 
1570 dunkaist 1025
    ret
1004 diamond 1026
 
1080 diamond 1027
draw_cur_frame:
1570 dunkaist 1028
    push    0   ; ypos
1029
    push    0   ; xpos
3116 dunkaist 1030
    mov eax, [procinfo.client_box.height]
1031
    sub eax, [toolbar_height]
1032
    sub eax, [image_padding]
1033
    inc eax
1570 dunkaist 1034
    push    eax ; max height
3116 dunkaist 1035
    mov eax, [procinfo.client_box.width]
1036
    sub eax, [image_padding]
1037
    inc eax
1570 dunkaist 1038
    push    eax ; max width
3116 dunkaist 1039
    push [draw_y]
1040
    push [draw_x]
1570 dunkaist 1041
    push    [cur_frame]
1042
    call    [img.draw]
1043
    mov eax, [image]
1044
    test    [eax + Image.Flags], Image.IsAnimated
1045
    jnz .done
1046
    cmp [eax + Image.Next], 0
1047
    jnz .additional_frames
1102 diamond 1048
.done:
1570 dunkaist 1049
    ret
1102 diamond 1050
.additional_frames:
3116 dunkaist 1051
    mov ebx, [procinfo.client_box.width]
1052
    sub ebx, [image_padding]
1053
    inc ebx
1570 dunkaist 1054
    jbe .done
3116 dunkaist 1055
    mov esi, [draw_x]
1102 diamond 1056
.afloop:
1570 dunkaist 1057
    sub ebx, [eax + Image.Width]
1058
    jbe .done
1059
    dec ebx
1060
    jz  .done
1061
    add esi, [eax + Image.Width]
1062
    mov eax, [eax + Image.Next]
1063
    push    eax
1064
    inc esi
1065
    push    0   ; ypos
1066
    push    0   ; xpos
3116 dunkaist 1067
    mov ecx, [procinfo.client_box.height]
1068
    sub ecx, [toolbar_height]
1069
    sub ecx, [image_padding]
1070
    inc ecx
1071
;    inc ebx
1570 dunkaist 1072
    push    ecx ; max height
1073
    push    ebx ; max width
3116 dunkaist 1074
    push    [draw_y]  ; y
1570 dunkaist 1075
    push    esi ; x
1076
    push    eax ; image
1077
    call    [img.draw]
1078
    pop eax
1079
    cmp [eax + Image.Next], 0
1080
    jnz .afloop
1081
    ret
1080 diamond 1082
 
1004 diamond 1083
 
1427 diamond 1084
check_shortcut:
1570 dunkaist 1085
; in:   cl = scancode (from sysfn 2),
1086
;   eax = state of modifiers (from sysfn 66.3),
1087
;   edx -> shortcut descriptor
1088
; out:  ZF set <=> fail
1089
    cmp cl, [edx+4]
1090
    jnz .not
1091
    push    eax
1092
    mov esi, [edx]
1093
    and esi, 0xF
1094
    and al, 3
1095
    call    dword [check_modifier_table+esi*4]
1096
    test    al, al
1097
    pop eax
1098
    jnz .not
1099
    push    eax
1100
    mov esi, [edx]
1101
    shr esi, 4
1102
    and esi, 0xF
1103
    shr al, 2
1104
    and al, 3
1105
    call    dword [check_modifier_table+esi*4]
1106
    test    al, al
1107
    pop eax
1108
    jnz .not
1109
    push    eax
1110
    mov esi, [edx]
1111
    shr esi, 8
1112
    and esi, 0xF
1113
    shr al, 4
1114
    and al, 3
1115
    call    dword [check_modifier_table+esi*4]
1116
    test    al, al
1117
    pop eax
1118
;   jnz .not
1427 diamond 1119
.not:
1570 dunkaist 1120
    ret
1427 diamond 1121
 
1122
check_modifier_0:
1570 dunkaist 1123
    setnz   al
1124
    ret
1427 diamond 1125
check_modifier_1:
1570 dunkaist 1126
    setp    al
1127
    ret
1427 diamond 1128
check_modifier_2:
1570 dunkaist 1129
    cmp al, 3
1130
    setnz   al
1131
    ret
1427 diamond 1132
check_modifier_3:
1570 dunkaist 1133
    cmp al, 1
1134
    setnz   al
1135
    ret
1427 diamond 1136
check_modifier_4:
1570 dunkaist 1137
    cmp al, 2
1138
    setnz   al
1139
    ret
1427 diamond 1140
 
1141
; fills real_header with window title
1142
; window title is generated as ' - Kolibri Image Viewer'
1143
generate_header:
1570 dunkaist 1144
    push    eax
1145
    mov esi, [last_name_component]
1146
    mov edi, real_header
1427 diamond 1147
@@:
1570 dunkaist 1148
    lodsb
1149
    test    al, al
1150
    jz  @f
1151
    stosb
1152
    cmp edi, real_header+256
1153
    jb  @b
1427 diamond 1154
.overflow:
1570 dunkaist 1155
    mov dword [edi-4], '...'
1427 diamond 1156
.ret:
1570 dunkaist 1157
    pop eax
1158
    ret
1427 diamond 1159
@@:
1570 dunkaist 1160
    mov esi, s_header
1427 diamond 1161
@@:
1570 dunkaist 1162
    lodsb
1163
    stosb
1164
    test    al, al
1165
    jz  .ret
1166
    cmp edi, real_header+256
1167
    jb  @b
1168
    jmp .overflow
1004 diamond 1169
;-----------------------------------------------------------------------------
1170
 
1427 diamond 1171
s_header db ' - Kolibri Image Viewer', 0
3116 dunkaist 1172
wnd_style        dd 0x73FFFFFF
1173
wnd_x            dd 100
1174
wnd_y            dd 100
1175
image_padding    dd 5
1176
toolbar_height   dd 31
1177
bg_color         dd 0x00ffffff
1004 diamond 1178
 
1179
;-----------------------------------------------------------------------------
1180
;-----------------------------------------------------------------------------
1181
 
1182
align 4
1183
@IMPORT:
1184
 
1570 dunkaist 1185
library             \
1186
    libio  , 'libio.obj'  , \
1187
    libgfx , 'libgfx.obj' , \
1188
    libimg , 'libimg.obj' , \
1189
    libini , 'libini.obj' , \
1190
    sort   , 'sort.obj'   , \
6804 IgorA 1191
    proc_lib ,'proc_lib.obj',\
1192
	libbuf2d, 'buf2d.obj'
1004 diamond 1193
 
1511 mario79 1194
 
1570 dunkaist 1195
import  libio             , \
1196
    libio.init , 'lib_init'   , \
1197
    file.size  , 'file_size'  , \
1198
    file.open  , 'file_open'  , \
1199
    file.read  , 'file_read'  , \
1200
    file.close , 'file_close'
1004 diamond 1201
 
1570 dunkaist 1202
import  libgfx              , \
1203
    libgfx.init   , 'lib_init'  , \
1204
    gfx.open      , 'gfx_open'  , \
1205
    gfx.close     , 'gfx_close' , \
1206
    gfx.pen.color , 'gfx_pen_color' , \
1207
    gfx.line      , 'gfx_line'
1004 diamond 1208
 
1570 dunkaist 1209
import  libimg             , \
1210
    libimg.init , 'lib_init'   , \
1211
    img.is_img  , 'img_is_img' , \
1212
    img.to_rgb2 , 'img_to_rgb2', \
1213
    img.decode  , 'img_decode' , \
1214
    img.flip    , 'img_flip'   , \
1215
    img.rotate  , 'img_rotate' , \
1216
    img.destroy , 'img_destroy', \
1217
    img.draw    , 'img_draw'
1004 diamond 1218
 
1570 dunkaist 1219
import  libini, \
1220
    ini_get_shortcut, 'ini_get_shortcut'
1427 diamond 1221
 
1144 diamond 1222
import  sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
1016 diamond 1223
 
1570 dunkaist 1224
import  proc_lib, \
1225
    OpenDialog_Init, 'OpenDialog_init', \
1226
    OpenDialog_Start,'OpenDialog_start'
1511 mario79 1227
 
6804 IgorA 1228
import  libbuf2d, \
1229
	buf2d_init, 'lib_init', \
1230
	buf2d_resize, 'buf2d_resize'
1231
 
1232
align 4
1233
buf_0: dd 0
1234
	dw 0,0
1235
.w: dd 0
1236
.h: dd 0,0
1237
	db 24 ;+20 bit in pixel
1238
 
1570 dunkaist 1239
bFirstDraw  db  0
3116 dunkaist 1240
bSlideShow  db  0
1241
bTglbar     db  0
1004 diamond 1242
;-----------------------------------------------------------------------------
1243
 
1016 diamond 1244
virtual at 0
1245
file 'kivicons.bmp':0xA,4
1246
load offbits dword from 0
1247
end virtual
3116 dunkaist 1248
numimages = 10
1016 diamond 1249
openbtn = 0
1250
backbtn = 1
1251
forwardbtn = 2
1252
bgrbtn = 3
1253
fliphorzbtn = 4
1254
flipvertbtn = 5
1255
rotcwbtn = 6
1256
rotccwbtn = 7
1257
rot180btn = 8
3116 dunkaist 1258
slidebtn = 9
1016 diamond 1259
 
1004 diamond 1260
palette:
1570 dunkaist 1261
    file 'kivicons.bmp':0x36,offbits-0x36
1016 diamond 1262
buttons:
1570 dunkaist 1263
    file 'kivicons.bmp':offbits
1004 diamond 1264
repeat 10
1265
y = % - 1
1266
z = 20 - %
1016 diamond 1267
repeat numimages*5
1268
load a dword from $ - numimages*20*20 + numimages*20*y + (%-1)*4
1269
load b dword from $ - numimages*20*20 + numimages*20*z + (%-1)*4
1270
store dword a at $ - numimages*20*20 + numimages*20*z + (%-1)*4
1271
store dword b at $ - numimages*20*20 + numimages*20*y + (%-1)*4
1004 diamond 1272
end repeat
1273
end repeat
1274
 
1570 dunkaist 1275
inifilename db  '/sys/media/kiv.ini',0
1276
aShortcuts  db  'Shortcuts',0
1277
aNext       db  'Next',0
1278
aPrev       db  'Prev',0
3116 dunkaist 1279
aSlide      db  'SlideShow',0
1280
aTglbar     db  'ToggleBar',0
1427 diamond 1281
 
1282
align 4
1283
check_modifier_table:
1570 dunkaist 1284
    dd  check_modifier_0
1285
    dd  check_modifier_1
1286
    dd  check_modifier_2
1287
    dd  check_modifier_3
1288
    dd  check_modifier_4
1427 diamond 1289
 
1470 mario79 1290
;---------------------------------------------------------------------
1291
align 4
1292
OpenDialog_data:
1570 dunkaist 1293
.type           dd 0
1294
.procinfo       dd procinfo ;+4
1295
.com_area_name      dd communication_area_name ;+8
1296
.com_area       dd 0 ;+12
1297
.opendir_pach       dd temp_dir_pach ;+16
1298
.dir_default_pach   dd communication_area_default_pach ;+20
1299
.start_path     dd open_dialog_path ;+24
1300
.draw_window        dd draw_window ;+28
1301
.status         dd 0 ;+32
1302
.openfile_pach      dd path  ;openfile_pach ;+36
1303
.filename_area      dd 0    ;+40
1304
.filter_area        dd Filter
1582 mario79 1305
.x:
5183 hidnplayr 1306
.x_size                 dw 420 ;+48 ; Window X size
1307
.x_start                dw 10 ;+50 ; Window X position
1582 mario79 1308
.y:
5183 hidnplayr 1309
.y_size                 dw 320 ;+52 ; Window y size
1310
.y_start                dw 10 ;+54 ; Window Y position
1004 diamond 1311
 
1470 mario79 1312
communication_area_name:
1570 dunkaist 1313
    db 'FFFFFFFF_open_dialog',0
1701 lrz 1314
 
1470 mario79 1315
open_dialog_path:
1701 lrz 1316
if __nightbuild eq yes
1317
    db '/sys/MANAGERS/opendial',0
1318
else
1570 dunkaist 1319
    db '/sys/File Managers/opendial',0
1701 lrz 1320
end if
1470 mario79 1321
communication_area_default_pach:
1570 dunkaist 1322
    db '/rd/1',0
1004 diamond 1323
 
1470 mario79 1324
Filter:
1325
dd Filter.end - Filter
1326
.1:
1327
db 'BMP',0
1328
db 'GIF',0
1329
db 'JPG',0
1330
db 'JPEG',0
1331
db 'JPE',0
1332
db 'PNG',0
1333
db 'ICO',0
1334
db 'CUR',0
3116 dunkaist 1335
db 'TGA',0
1570 dunkaist 1336
db 'PCX',0
1922 dunkaist 1337
db 'XCF',0
2389 dunkaist 1338
db 'PBM',0
1339
db 'PGM',0
1340
db 'PNM',0
1341
db 'TIF',0
1342
db 'TIFF',0
2394 dunkaist 1343
db 'WBMP',0
1470 mario79 1344
.end:
1345
db 0
1004 diamond 1346
 
1470 mario79 1347
draw_window_fake:
1570 dunkaist 1348
    ret
1470 mario79 1349
;------------------------------------------------------------------------------
1016 diamond 1350
readdir_fileinfo:
1570 dunkaist 1351
    dd  1
1352
    dd  0
1353
    dd  0
1354
readblocks dd   0
1355
directory_ptr   dd  0
1470 mario79 1356
;------------------------------------------------------------------------------
1004 diamond 1357
I_END:
1570 dunkaist 1358
curdir      rb  1024
1016 diamond 1359
 
1360
align 4
1004 diamond 1361
img_data     dd ?
1362
img_data_len dd ?
1570 dunkaist 1363
fh       dd ?
1364
image        dd ?
3116 dunkaist 1365
wnd_width   dd  100
1366
wnd_height  dd  100
1367
draw_x      dd  ?
1368
draw_y      dd  ?
1570 dunkaist 1369
draw_width  dd  ?
1370
draw_height dd  ?
1371
last_name_component dd  ?
1372
cur_file_idx    dd  ?
1373
cur_frame_time  dd  ?
1374
cur_frame   dd  ?
1004 diamond 1375
 
1570 dunkaist 1376
next_mod    dd  ?
1377
next_key    dd  ?
1378
prev_mod    dd  ?
1379
prev_key    dd  ?
3116 dunkaist 1380
slide_mod   dd  ?
1381
slide_key   dd  ?
1382
tglbar_mod  dd  ?
1383
tglbar_key  dd  ?
1004 diamond 1384
 
3116 dunkaist 1385
toolbar_height_old   rd 1
1386
 
1387
procinfo    process_information
1570 dunkaist 1388
path:       rb  4096  ;1024+16
1389
real_header rb  256
1470 mario79 1390
@PARAMS rb 4096  ;512
1391
;---------------------------------------------------------------------
1392
temp_dir_pach:
1393
        rb 4096
1394
;---------------------------------------------------------------------
1570 dunkaist 1395
    rb 4096
1470 mario79 1396
stacktop:
1397
;---------------------------------------------------------------------
1922 dunkaist 1398
F_END: