2009-01-28 15:55:32 +01:00
|
|
|
use32
|
|
|
|
org 0x0
|
|
|
|
|
|
|
|
db 'MENUET01'
|
2010-05-28 12:27:10 +02:00
|
|
|
dd 0x01, START, I_END, F_END, stacktop, @PARAMS, 0x0
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
2012-12-15 21:01:37 +01:00
|
|
|
include '../../../config.inc'
|
2009-05-24 18:48:56 +02:00
|
|
|
include '../../../proc32.inc'
|
|
|
|
include '../../../macros.inc'
|
2012-12-15 21:01:37 +01:00
|
|
|
include '../../../dll.inc'
|
|
|
|
;include '../../../debug.inc'
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
include '../../../develop/libraries/libs-dev/libio/libio.inc'
|
|
|
|
include '../../../develop/libraries/libs-dev/libimg/libimg.inc'
|
|
|
|
|
2010-07-03 16:27:35 +02:00
|
|
|
;include '../../../develop/libraries/box_lib/asm/trunk/opendial.mac'
|
|
|
|
;use_OpenDialog
|
2009-01-28 15:55:32 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
START:
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall 68, 11
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
stdcall dll.Load, @IMPORT
|
|
|
|
or eax, eax
|
|
|
|
jnz exit
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
invoke sort.START, 1
|
2009-01-31 04:32:49 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
mov ecx, 1 ; for 15.4: 1 = tile
|
|
|
|
cmp word [@PARAMS], '\T'
|
|
|
|
jz set_bgr
|
|
|
|
inc ecx ; for 15.4: 2 = stretch
|
|
|
|
cmp word [@PARAMS], '\S'
|
|
|
|
jz set_bgr
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-25 21:17:38 +02:00
|
|
|
cmp byte [@PARAMS], 0
|
|
|
|
jz @f
|
|
|
|
mov esi, @PARAMS
|
|
|
|
mov edi, path
|
|
|
|
mov ecx, 4096/4
|
|
|
|
rep movsd
|
|
|
|
mov byte [edi-1], 0
|
|
|
|
@@:
|
|
|
|
; OpenDialog initialisation
|
|
|
|
push dword OpenDialog_data
|
|
|
|
call [OpenDialog_Init]
|
|
|
|
|
2010-02-28 20:40:01 +01:00
|
|
|
; initialize keyboard handling
|
2010-08-17 00:04:18 +02:00
|
|
|
invoke ini_get_shortcut, inifilename, aShortcuts, aNext, -1, next_mod
|
|
|
|
mov [next_key], eax
|
|
|
|
invoke ini_get_shortcut, inifilename, aShortcuts, aPrev, -1, prev_mod
|
|
|
|
mov [prev_key], eax
|
2012-12-15 21:01:37 +01:00
|
|
|
invoke ini_get_shortcut, inifilename, aShortcuts, aSlide, -1, slide_mod
|
|
|
|
mov [slide_key], eax
|
|
|
|
invoke ini_get_shortcut, inifilename, aShortcuts, aTglbar, -1, tglbar_mod
|
|
|
|
mov [tglbar_key], eax
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall 66, 1, 1 ; set kbd mode to scancodes
|
2010-02-28 20:40:01 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp byte [@PARAMS], 0
|
|
|
|
jnz params_given
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
mov [OpenDialog_data.draw_window],draw_window_fake
|
|
|
|
|
2010-07-03 16:27:35 +02:00
|
|
|
; OpenDialog Open
|
2010-08-17 00:04:18 +02:00
|
|
|
push dword OpenDialog_data
|
|
|
|
call [OpenDialog_Start]
|
2010-05-28 12:27:10 +02:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp [OpenDialog_data.status],1
|
|
|
|
jne exit
|
2010-05-28 12:27:10 +02:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
mov [OpenDialog_data.draw_window],draw_window
|
2010-05-28 12:27:10 +02:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
mov esi, path
|
|
|
|
mov edi, @PARAMS
|
|
|
|
mov ecx, 4096/4
|
|
|
|
rep movsd
|
|
|
|
mov byte [edi-1], 0
|
|
|
|
jmp params_given
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
set_bgr:
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall 15, 4
|
|
|
|
mov eax, @PARAMS + 4
|
|
|
|
call load_image
|
|
|
|
jc exit
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
call set_as_bgr
|
|
|
|
jmp exit
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
params_given:
|
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
mov esi, @PARAMS
|
|
|
|
push esi
|
|
|
|
call find_last_name_component
|
2010-02-28 20:40:01 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
pop eax
|
|
|
|
call load_image
|
|
|
|
jc exit
|
|
|
|
call generate_header
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
red:
|
2010-08-17 00:04:18 +02:00
|
|
|
call draw_window
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
still:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov eax, [image]
|
|
|
|
test byte [eax + Image.Flags], Image.IsAnimated
|
|
|
|
push 10
|
|
|
|
pop eax
|
|
|
|
jz @f
|
|
|
|
mcall 26, 9
|
|
|
|
mov edx, [cur_frame]
|
|
|
|
mov ebx, [cur_frame_time]
|
|
|
|
add ebx, [edx + Image.Delay]
|
|
|
|
sub ebx, eax
|
|
|
|
cmp ebx, [edx + Image.Delay]
|
|
|
|
ja red_update_frame
|
|
|
|
test ebx, ebx
|
|
|
|
jz red_update_frame
|
|
|
|
push 23
|
|
|
|
pop eax
|
2009-05-24 18:48:56 +02:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall
|
|
|
|
dec eax
|
|
|
|
js red_update_frame
|
|
|
|
jz red
|
|
|
|
dec eax
|
|
|
|
jnz button
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2009-05-24 18:48:56 +02:00
|
|
|
key:
|
2010-08-17 00:04:18 +02:00
|
|
|
xor esi, esi
|
2010-02-28 20:40:01 +01:00
|
|
|
keyloop:
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall 2
|
|
|
|
test al, al
|
|
|
|
jnz keyloopdone
|
|
|
|
shr eax, 8
|
|
|
|
mov ecx, eax
|
|
|
|
mcall 66, 3
|
|
|
|
mov edx, next_mod
|
|
|
|
call check_shortcut
|
|
|
|
jz .next
|
|
|
|
add edx, prev_mod - next_mod
|
|
|
|
call check_shortcut
|
2012-12-15 21:01:37 +01:00
|
|
|
jz .prev
|
|
|
|
add edx, slide_mod - prev_mod
|
|
|
|
call check_shortcut
|
|
|
|
jz .slide
|
|
|
|
add edx, tglbar_mod - slide_mod
|
|
|
|
call check_shortcut
|
|
|
|
jz .tglbar
|
|
|
|
cmp cl, 1 ; Esc
|
|
|
|
jz .esc
|
|
|
|
jmp keyloop
|
|
|
|
.esc:
|
|
|
|
test byte [bSlideShow], 1
|
|
|
|
jnz .slide
|
|
|
|
jmp keyloop
|
|
|
|
.tglbar:
|
|
|
|
mov byte [bTglbar], 1
|
|
|
|
test byte[bSlideShow], 1
|
|
|
|
jnz @f
|
|
|
|
xor [toolbar_height], 31
|
|
|
|
@@:
|
|
|
|
jmp keyloop
|
|
|
|
.slide:
|
|
|
|
call slide_show
|
|
|
|
jmp keyloop
|
2010-02-28 20:40:01 +01:00
|
|
|
.prev:
|
2010-08-17 00:04:18 +02:00
|
|
|
dec esi
|
|
|
|
jmp keyloop
|
2010-02-28 20:40:01 +01:00
|
|
|
.next:
|
2010-08-17 00:04:18 +02:00
|
|
|
inc esi
|
|
|
|
jmp keyloop
|
2010-02-28 20:40:01 +01:00
|
|
|
keyloopdone:
|
2012-12-15 21:01:37 +01:00
|
|
|
test esi, esi
|
|
|
|
jnz next_or_prev_handler
|
|
|
|
test byte [bSlideShow], 2
|
|
|
|
jnz red
|
|
|
|
test byte [bTglbar], 1
|
|
|
|
jnz red
|
|
|
|
jmp still
|
2010-02-28 20:40:01 +01:00
|
|
|
next_or_prev_handler:
|
2010-08-17 00:04:18 +02:00
|
|
|
call next_or_prev_image
|
|
|
|
jmp red
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2009-05-24 18:48:56 +02:00
|
|
|
red_update_frame:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov eax, [cur_frame]
|
|
|
|
mov eax, [eax + Image.Next]
|
|
|
|
test eax, eax
|
|
|
|
jnz @f
|
|
|
|
mov eax, [image]
|
2009-05-24 18:48:56 +02:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov [cur_frame], eax
|
|
|
|
mcall 26, 9
|
|
|
|
mov [cur_frame_time], eax
|
|
|
|
mcall 9, procinfo, -1
|
|
|
|
call draw_cur_frame
|
|
|
|
jmp still
|
2009-05-24 18:48:56 +02:00
|
|
|
|
|
|
|
button:
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall 17
|
|
|
|
shr eax, 8
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
; flip horizontally
|
|
|
|
cmp eax, 'flh'
|
|
|
|
jne @f
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
invoke img.flip, [image], FLIP_HORIZONTAL
|
|
|
|
jmp redraw_image
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
; flip vertically
|
|
|
|
@@: cmp eax, 'flv'
|
|
|
|
jne @f
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
invoke img.flip, [image], FLIP_VERTICAL
|
|
|
|
jmp redraw_image
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
; flip both horizontally and vertically
|
|
|
|
@@: cmp eax, 'flb'
|
|
|
|
jne @f
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
invoke img.flip, [image], FLIP_BOTH
|
|
|
|
jmp redraw_image
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
; rotate left
|
|
|
|
@@: cmp eax, 'rtl'
|
|
|
|
jne @f
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
push ROTATE_90_CCW
|
2009-01-28 15:55:32 +01:00
|
|
|
.rotate_common:
|
2010-08-17 00:04:18 +02:00
|
|
|
invoke img.rotate, [image]
|
|
|
|
mov eax, [image]
|
|
|
|
test eax, eax ; clear ZF flag
|
|
|
|
call update_image_sizes
|
|
|
|
jmp redraw_image
|
|
|
|
|
|
|
|
; rotate right
|
|
|
|
@@: cmp eax, 'rtr'
|
|
|
|
jne @f
|
|
|
|
|
|
|
|
push ROTATE_90_CW
|
|
|
|
jmp .rotate_common
|
|
|
|
|
|
|
|
; open new file
|
|
|
|
@@: cmp eax, 'opn'
|
|
|
|
jne @f
|
|
|
|
|
2010-07-03 16:27:35 +02:00
|
|
|
; OpenDialog Open
|
2010-08-17 00:04:18 +02:00
|
|
|
push dword OpenDialog_data
|
|
|
|
call [OpenDialog_Start]
|
|
|
|
|
|
|
|
cmp [OpenDialog_data.status],1
|
|
|
|
jne still
|
|
|
|
|
|
|
|
mov esi, path
|
|
|
|
mov edi, @PARAMS
|
|
|
|
push edi
|
|
|
|
mov ecx, 4096/4
|
|
|
|
rep movsd
|
|
|
|
mov byte [edi-1], 0
|
|
|
|
|
|
|
|
pop esi
|
|
|
|
push esi
|
|
|
|
call find_last_name_component
|
|
|
|
|
|
|
|
pop eax
|
|
|
|
push [image]
|
|
|
|
call load_image
|
|
|
|
jc .restore_old
|
|
|
|
call generate_header
|
|
|
|
|
|
|
|
invoke img.destroy
|
|
|
|
call free_directory
|
|
|
|
jmp red
|
|
|
|
|
2009-01-28 15:55:32 +01:00
|
|
|
.restore_old:
|
2010-08-17 00:04:18 +02:00
|
|
|
pop [image]
|
|
|
|
call init_frame
|
|
|
|
jmp still
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
; set background
|
2009-01-31 04:32:49 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp eax, 'bgr'
|
|
|
|
jne @f
|
2009-01-31 04:32:49 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
call set_as_bgr
|
|
|
|
jmp still
|
2009-01-31 04:32:49 +01:00
|
|
|
|
2012-12-15 21:01:37 +01:00
|
|
|
@@:
|
|
|
|
cmp eax, 'sld'
|
|
|
|
jne @f
|
|
|
|
|
|
|
|
call slide_show
|
|
|
|
jmp red
|
|
|
|
|
2009-01-31 04:32:49 +01:00
|
|
|
@@:
|
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
or esi, -1
|
|
|
|
cmp eax, 'bck'
|
|
|
|
jz next_or_prev_handler
|
|
|
|
neg esi
|
|
|
|
cmp eax, 'fwd'
|
|
|
|
jz next_or_prev_handler
|
2009-01-31 04:32:49 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp eax, 1
|
|
|
|
jne still
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
exit:
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall -1
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
redraw_image = red
|
|
|
|
|
|
|
|
load_image:
|
2010-08-17 00:04:18 +02:00
|
|
|
and [img_data], 0
|
|
|
|
push eax
|
|
|
|
invoke file.open, eax, O_READ
|
|
|
|
or eax, eax
|
|
|
|
jz .error_pop
|
|
|
|
mov [fh], eax
|
|
|
|
invoke file.size
|
|
|
|
mov [img_data_len], ebx
|
|
|
|
stdcall mem.Alloc, ebx
|
|
|
|
test eax, eax
|
|
|
|
jz .error_close
|
|
|
|
mov [img_data], eax
|
|
|
|
invoke file.read, [fh], eax, [img_data_len]
|
|
|
|
cmp eax, -1
|
|
|
|
jz .error_close
|
|
|
|
cmp eax, [img_data_len]
|
|
|
|
jnz .error_close
|
|
|
|
invoke file.close, [fh]
|
|
|
|
inc eax
|
|
|
|
jz .error
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
invoke img.decode, [img_data], [img_data_len], 0
|
|
|
|
or eax, eax
|
|
|
|
jz .error
|
|
|
|
cmp [image], 0
|
|
|
|
pushf
|
|
|
|
mov [image], eax
|
|
|
|
call init_frame
|
|
|
|
popf
|
|
|
|
call update_image_sizes
|
|
|
|
call free_img_data
|
|
|
|
clc
|
|
|
|
ret
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
.error_free:
|
2010-08-17 00:04:18 +02:00
|
|
|
invoke img.destroy, [image]
|
|
|
|
jmp .error
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
.error_pop:
|
2010-08-17 00:04:18 +02:00
|
|
|
pop eax
|
|
|
|
jmp .error
|
2009-01-28 15:55:32 +01:00
|
|
|
.error_close:
|
2010-08-17 00:04:18 +02:00
|
|
|
invoke file.close, [fh]
|
2009-01-28 15:55:32 +01:00
|
|
|
.error:
|
2010-08-17 00:04:18 +02:00
|
|
|
call free_img_data
|
|
|
|
stc
|
|
|
|
ret
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
free_img_data:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov eax, [img_data]
|
|
|
|
test eax, eax
|
|
|
|
jz @f
|
|
|
|
stdcall mem.Free, eax
|
2009-01-28 15:55:32 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
ret
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
update_image_sizes:
|
2010-08-17 00:04:18 +02:00
|
|
|
pushf
|
|
|
|
mov edx, [eax + Image.Width]
|
2011-07-30 21:35:59 +02:00
|
|
|
test [eax + Image.Flags], Image.IsAnimated
|
|
|
|
jnz .not_in_row
|
|
|
|
push eax
|
|
|
|
@@: cmp [eax + Image.Next], 0
|
|
|
|
jz @f
|
|
|
|
mov eax, [eax + Image.Next]
|
|
|
|
add edx, [eax + Image.Width]
|
|
|
|
inc edx
|
|
|
|
jmp @b
|
|
|
|
@@: pop eax
|
|
|
|
.not_in_row:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov [draw_width], edx
|
|
|
|
add edx, 19
|
2012-12-15 21:01:37 +01:00
|
|
|
cmp edx, 50 + 25*numimages
|
2010-08-17 00:04:18 +02:00
|
|
|
jae @f
|
2012-12-15 21:01:37 +01:00
|
|
|
mov edx, 50 + 25*numimages
|
2009-01-28 15:55:32 +01:00
|
|
|
@@:
|
2012-12-15 21:01:37 +01:00
|
|
|
; dec edx
|
2010-08-17 00:04:18 +02:00
|
|
|
mov [wnd_width], edx
|
|
|
|
mov esi, [eax + Image.Height]
|
2011-07-30 21:35:59 +02:00
|
|
|
test [eax + Image.Flags], Image.IsAnimated
|
|
|
|
jnz .max_equals_first
|
|
|
|
push eax
|
|
|
|
@@: cmp [eax + Image.Next], 0
|
|
|
|
jz @f
|
|
|
|
mov eax, [eax + Image.Next]
|
|
|
|
cmp esi, [eax + Image.Height]
|
|
|
|
jae @b
|
|
|
|
mov esi, [eax + Image.Height]
|
|
|
|
jmp @b
|
|
|
|
@@: pop eax
|
|
|
|
.max_equals_first:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov [draw_height], esi
|
2012-12-15 21:01:37 +01:00
|
|
|
add esi, [toolbar_height]
|
|
|
|
add esi, [image_padding]
|
|
|
|
add esi, [image_padding]
|
|
|
|
add esi, 5 ; window bottom frame height
|
|
|
|
dec esi
|
2010-08-17 00:04:18 +02:00
|
|
|
mov [wnd_height], esi
|
|
|
|
popf
|
|
|
|
jz .no_resize
|
2012-12-15 21:01:37 +01:00
|
|
|
test [wnd_style], 1 SHL 25
|
|
|
|
jz .no_resize
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall 48, 4
|
|
|
|
add esi, eax
|
|
|
|
mcall 67,-1,-1
|
2009-01-28 15:55:32 +01:00
|
|
|
.no_resize:
|
2010-08-17 00:04:18 +02:00
|
|
|
ret
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2009-01-31 04:32:49 +01:00
|
|
|
set_as_bgr:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov esi, [image]
|
|
|
|
mov ecx, [esi + Image.Width]
|
|
|
|
mov edx, [esi + Image.Height]
|
|
|
|
mcall 15, 1
|
2009-01-31 04:32:49 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall 15, 6
|
|
|
|
test eax, eax
|
|
|
|
jz @f
|
2009-01-31 04:32:49 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
push eax
|
|
|
|
invoke img.to_rgb2, esi, eax
|
|
|
|
pop ecx
|
|
|
|
mcall 15, 7
|
2009-01-31 04:32:49 +01:00
|
|
|
|
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall 15, 3
|
|
|
|
ret
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2012-12-15 21:01:37 +01:00
|
|
|
slide_show:
|
|
|
|
or byte [bSlideShow], 2
|
|
|
|
xor byte [bSlideShow], 1
|
|
|
|
btc dword [wnd_style], 25
|
|
|
|
jc @f
|
|
|
|
mov eax, [toolbar_height_old]
|
|
|
|
mov [toolbar_height], eax
|
|
|
|
mov [image_padding], 5
|
|
|
|
jmp .toolbar_height_done
|
|
|
|
@@:
|
|
|
|
mov eax, [toolbar_height]
|
|
|
|
mov [toolbar_height_old], eax
|
|
|
|
mov [toolbar_height], 0
|
|
|
|
mov [image_padding], 0
|
|
|
|
.toolbar_height_done:
|
|
|
|
ret
|
|
|
|
|
2010-02-28 20:40:01 +01:00
|
|
|
; seek to ESI image files
|
|
|
|
; esi>0 means next file, esi<0 - prev file
|
|
|
|
next_or_prev_image:
|
2010-08-17 00:04:18 +02:00
|
|
|
push esi
|
|
|
|
call load_directory
|
|
|
|
pop esi
|
|
|
|
mov ebx, [directory_ptr]
|
|
|
|
test ebx, ebx
|
|
|
|
jz .ret
|
|
|
|
cmp dword[ebx+4], 0
|
|
|
|
jz .ret
|
|
|
|
mov eax, [cur_file_idx]
|
|
|
|
cmp eax, -1
|
|
|
|
jnz @f
|
|
|
|
test esi, esi
|
|
|
|
jns @f
|
|
|
|
mov eax, [ebx+4]
|
2009-01-31 04:32:49 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
push [image]
|
|
|
|
add eax, esi
|
2010-02-28 20:40:01 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
test eax, eax
|
|
|
|
jns @f
|
|
|
|
add eax, [ebx+4]
|
|
|
|
jmp @b
|
2009-01-31 04:32:49 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp eax, [ebx+4]
|
|
|
|
jb @f
|
|
|
|
sub eax, [ebx+4]
|
|
|
|
jmp @b
|
2010-02-28 20:40:01 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
push eax
|
2010-02-28 20:40:01 +01:00
|
|
|
.scanloop:
|
2010-08-17 00:04:18 +02:00
|
|
|
push eax ebx esi
|
|
|
|
imul esi, eax, 304
|
|
|
|
add esi, [directory_ptr]
|
|
|
|
add esi, 32 + 40
|
|
|
|
mov edi, curdir
|
2009-01-31 04:32:49 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
inc edi
|
|
|
|
cmp byte [edi-1], 0
|
|
|
|
jnz @b
|
|
|
|
mov byte [edi-1], '/'
|
2009-01-31 04:32:49 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
lodsb
|
|
|
|
stosb
|
|
|
|
test al, al
|
|
|
|
jnz @b
|
|
|
|
mov eax, curdir
|
|
|
|
call load_image
|
|
|
|
pushf
|
|
|
|
mov esi, curdir
|
|
|
|
push esi
|
|
|
|
mov edi, @PARAMS
|
|
|
|
mov ecx, 4096/4
|
|
|
|
rep movsd
|
|
|
|
mov byte [edi-1], 0
|
|
|
|
pop esi
|
2009-02-21 15:34:46 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
lodsb
|
|
|
|
test al, al
|
|
|
|
jnz @b
|
2009-02-21 15:34:46 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
dec esi
|
|
|
|
cmp byte [esi], '/'
|
|
|
|
jnz @b
|
|
|
|
mov byte [esi], 0
|
|
|
|
popf
|
|
|
|
pop esi ebx eax
|
|
|
|
jnc .loadedok
|
|
|
|
test esi, esi
|
|
|
|
js .try_prev
|
2010-02-28 20:40:01 +01:00
|
|
|
.try_next:
|
2010-08-17 00:04:18 +02:00
|
|
|
inc eax
|
|
|
|
cmp eax, [ebx+4]
|
|
|
|
jb @f
|
|
|
|
xor eax, eax
|
2009-01-31 04:32:49 +01:00
|
|
|
@@:
|
2010-02-28 20:40:01 +01:00
|
|
|
.try_common:
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp eax, [esp]
|
|
|
|
jz .notfound
|
|
|
|
jmp .scanloop
|
2010-02-28 20:40:01 +01:00
|
|
|
.try_prev:
|
2010-08-17 00:04:18 +02:00
|
|
|
dec eax
|
|
|
|
jns @f
|
|
|
|
mov eax, [ebx+4]
|
|
|
|
dec eax
|
2009-01-31 04:32:49 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
jmp .try_common
|
2010-02-28 20:40:01 +01:00
|
|
|
.loadedok:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov [cur_file_idx], eax
|
|
|
|
pop eax
|
|
|
|
invoke img.destroy
|
|
|
|
call generate_header
|
2009-01-31 04:32:49 +01:00
|
|
|
.ret:
|
2010-08-17 00:04:18 +02:00
|
|
|
ret
|
2009-01-31 04:32:49 +01:00
|
|
|
.notfound:
|
2010-08-17 00:04:18 +02:00
|
|
|
pop eax
|
|
|
|
pop [image]
|
|
|
|
call init_frame
|
|
|
|
ret
|
2009-01-31 04:32:49 +01:00
|
|
|
|
|
|
|
load_directory:
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp [directory_ptr], 0
|
|
|
|
jnz .ret
|
|
|
|
mov esi, @PARAMS
|
|
|
|
mov edi, curdir
|
|
|
|
mov ecx, [last_name_component]
|
|
|
|
sub ecx, esi
|
|
|
|
dec ecx
|
|
|
|
js @f
|
|
|
|
rep movsb
|
2010-02-28 20:40:01 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov byte [edi], 0
|
|
|
|
mcall 68, 12, 0x1000
|
|
|
|
test eax, eax
|
|
|
|
jz .ret
|
|
|
|
mov ebx, readdir_fileinfo
|
|
|
|
mov dword [ebx+12], (0x1000 - 32) / 304
|
|
|
|
mov dword [ebx+16], eax
|
|
|
|
mcall 70
|
|
|
|
cmp eax, 6
|
|
|
|
jz .dirok
|
|
|
|
test eax, eax
|
|
|
|
jnz free_directory
|
|
|
|
mov edx, [directory_ptr]
|
|
|
|
mov ecx, [edx+8]
|
|
|
|
mov [readblocks], ecx
|
|
|
|
imul ecx, 304
|
|
|
|
add ecx, 32
|
|
|
|
mcall 68, 20
|
|
|
|
test eax, eax
|
|
|
|
jz free_directory
|
|
|
|
mov [directory_ptr], eax
|
|
|
|
mcall 70, readdir_fileinfo
|
2009-01-31 04:32:49 +01:00
|
|
|
.dirok:
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp ebx, 0
|
|
|
|
jle free_directory
|
|
|
|
mov eax, [directory_ptr]
|
|
|
|
add eax, 32
|
|
|
|
mov edi, eax
|
|
|
|
push 0
|
2009-01-31 04:32:49 +01:00
|
|
|
.dirskip:
|
2010-08-17 00:04:18 +02:00
|
|
|
push eax
|
|
|
|
test byte [eax], 18h
|
|
|
|
jnz .nocopy
|
|
|
|
lea esi, [eax+40]
|
|
|
|
mov ecx, esi
|
2009-01-31 04:32:49 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
lodsb
|
|
|
|
test al, al
|
|
|
|
jnz @b
|
2009-01-31 04:32:49 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
dec esi
|
|
|
|
cmp esi, ecx
|
|
|
|
jb .noext
|
|
|
|
cmp byte [esi], '.'
|
|
|
|
jnz @b
|
|
|
|
inc esi
|
|
|
|
mov ecx, [esi]
|
|
|
|
or ecx, 0x202020
|
|
|
|
cmp ecx, 'jpg'
|
|
|
|
jz .copy
|
|
|
|
cmp ecx, 'bmp'
|
|
|
|
jz .copy
|
|
|
|
cmp ecx, 'gif'
|
|
|
|
jz .copy
|
|
|
|
cmp ecx, 'png'
|
|
|
|
jz .copy
|
|
|
|
cmp ecx, 'jpe'
|
|
|
|
jz .copy
|
|
|
|
cmp ecx, 'ico'
|
|
|
|
jz .copy
|
|
|
|
cmp ecx, 'cur'
|
|
|
|
jz .copy
|
2012-12-15 21:01:37 +01:00
|
|
|
cmp ecx, 'tga'
|
|
|
|
jz .copy
|
2010-08-22 21:59:19 +02:00
|
|
|
cmp ecx, 'pcx'
|
|
|
|
jz .copy
|
2011-05-02 19:44:44 +02:00
|
|
|
cmp ecx, 'xcf'
|
|
|
|
jz .copy
|
2012-02-23 23:16:03 +01:00
|
|
|
cmp ecx, 'pbm'
|
|
|
|
jz .copy
|
|
|
|
cmp ecx, 'pgm'
|
|
|
|
jz .copy
|
|
|
|
cmp ecx, 'pnm'
|
|
|
|
jz .copy
|
|
|
|
cmp ecx, 'tif'
|
|
|
|
jz .copy
|
|
|
|
cmp ecx, 'tiff'
|
|
|
|
jz @f
|
2012-02-23 23:52:59 +01:00
|
|
|
cmp ecx, 'wbmp'
|
|
|
|
jz @f
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp ecx, 'jpeg'
|
|
|
|
jz @f
|
|
|
|
cmp ecx, 'jpeG'
|
|
|
|
jnz .nocopy
|
2009-01-31 04:32:49 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp byte [esi+4], 0
|
|
|
|
jnz .nocopy
|
2009-01-31 04:32:49 +01:00
|
|
|
.copy:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov esi, [esp]
|
|
|
|
mov ecx, 304 / 4
|
|
|
|
rep movsd
|
|
|
|
inc dword [esp+4]
|
2009-01-31 04:32:49 +01:00
|
|
|
.nocopy:
|
|
|
|
.noext:
|
2010-08-17 00:04:18 +02:00
|
|
|
pop eax
|
|
|
|
add eax, 304
|
|
|
|
dec ebx
|
|
|
|
jnz .dirskip
|
|
|
|
mov eax, [directory_ptr]
|
|
|
|
pop ebx
|
|
|
|
mov [eax+4], ebx
|
|
|
|
test ebx, ebx
|
|
|
|
jz free_directory
|
|
|
|
push 0 ; sort mode
|
|
|
|
push ebx
|
|
|
|
add eax, 32
|
|
|
|
push eax
|
|
|
|
call [SortDir]
|
|
|
|
xor eax, eax
|
|
|
|
mov edi, [directory_ptr]
|
|
|
|
add edi, 32 + 40
|
2009-01-31 04:32:49 +01:00
|
|
|
.scan:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov esi, [last_name_component]
|
|
|
|
push edi
|
|
|
|
invoke strcmpi
|
|
|
|
pop edi
|
|
|
|
jz .found
|
|
|
|
inc eax
|
|
|
|
add edi, 304
|
|
|
|
dec ebx
|
|
|
|
jnz .scan
|
|
|
|
or eax, -1
|
2009-01-31 04:32:49 +01:00
|
|
|
.found:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov [cur_file_idx], eax
|
2009-01-31 04:32:49 +01:00
|
|
|
.ret:
|
2010-08-17 00:04:18 +02:00
|
|
|
ret
|
2009-01-31 04:32:49 +01:00
|
|
|
|
|
|
|
free_directory:
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall 68, 13, [directory_ptr]
|
|
|
|
and [directory_ptr], 0
|
|
|
|
ret
|
2009-01-31 04:32:49 +01:00
|
|
|
|
2010-02-28 20:40:01 +01:00
|
|
|
; in: esi->full name (e.g. /path/to/file.png)
|
|
|
|
; out: [last_name_component]->last component (e.g. file.png)
|
|
|
|
find_last_name_component:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov ecx, esi
|
2010-02-28 20:40:01 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
lodsb
|
|
|
|
test al, al
|
|
|
|
jnz @b
|
2010-02-28 20:40:01 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
dec esi
|
|
|
|
cmp esi, ecx
|
|
|
|
jb @f
|
|
|
|
cmp byte [esi], '/'
|
|
|
|
jnz @b
|
2010-02-28 20:40:01 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
inc esi
|
|
|
|
mov [last_name_component], esi
|
|
|
|
ret
|
2010-02-28 20:40:01 +01:00
|
|
|
|
2009-05-24 18:48:56 +02:00
|
|
|
init_frame:
|
2010-08-17 00:04:18 +02:00
|
|
|
push eax
|
|
|
|
mov eax, [image]
|
|
|
|
mov [cur_frame], eax
|
|
|
|
test byte [eax + Image.Flags], Image.IsAnimated
|
|
|
|
jz @f
|
|
|
|
push ebx
|
|
|
|
mcall 26, 9
|
|
|
|
pop ebx
|
|
|
|
mov [cur_frame_time], eax
|
2009-05-24 18:48:56 +02:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
pop eax
|
|
|
|
ret
|
2009-05-24 18:48:56 +02:00
|
|
|
|
2009-01-31 04:32:49 +01:00
|
|
|
draw_window:
|
2012-12-15 21:01:37 +01:00
|
|
|
btr word [bSlideShow], 1 ; mode changed
|
|
|
|
jc .mode_changed
|
|
|
|
test byte [bTglbar], 1
|
|
|
|
jz .mode_not_changed
|
|
|
|
.mode_changed:
|
|
|
|
test [wnd_style], 1 SHL 25
|
|
|
|
jz .mode_slide
|
|
|
|
mov [bg_color], 0x00ffffff
|
|
|
|
mov eax, [image]
|
|
|
|
cmp eax, eax
|
|
|
|
call update_image_sizes
|
|
|
|
mcall 48, 4
|
|
|
|
mov esi, [wnd_height]
|
|
|
|
add esi, eax
|
|
|
|
test byte [bTglbar], 1
|
|
|
|
jz @f
|
|
|
|
mcall 67, -1, -1, [wnd_width],
|
|
|
|
jmp .mode_not_changed
|
|
|
|
@@:
|
|
|
|
mcall 67, [wnd_x], [wnd_y], [wnd_width],
|
|
|
|
jmp .mode_not_changed
|
|
|
|
.mode_slide:
|
|
|
|
mov [bg_color], 0x00000000
|
|
|
|
mov eax, [procinfo.box.left]
|
|
|
|
mov [wnd_x], eax
|
|
|
|
mov eax, [procinfo.box.top]
|
|
|
|
mov [wnd_y], eax
|
|
|
|
mcall 14
|
|
|
|
mov edx, eax
|
|
|
|
shr edx, 16
|
|
|
|
movzx eax, ax
|
|
|
|
mov esi, eax
|
|
|
|
mcall 67, 0, 0, ,
|
|
|
|
jmp .posok.slide_show
|
|
|
|
|
|
|
|
.mode_not_changed:
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp [bFirstDraw], 0
|
|
|
|
jz .posok
|
|
|
|
or ecx, -1
|
|
|
|
mcall 9, procinfo
|
|
|
|
|
2012-12-15 21:01:37 +01:00
|
|
|
test byte [procinfo.wnd_state], 0x04
|
|
|
|
jnz .posok
|
2010-08-17 00:04:18 +02:00
|
|
|
|
|
|
|
mov edx, ecx
|
|
|
|
mov esi, ecx
|
2012-12-15 21:01:37 +01:00
|
|
|
cmp dword [procinfo.box.width], 50 + 25 * numimages
|
2010-08-17 00:04:18 +02:00
|
|
|
jae @f
|
2012-12-15 21:01:37 +01:00
|
|
|
mov edx, 50 + 25 * numimages
|
2009-02-21 15:34:46 +01:00
|
|
|
@@:
|
2012-12-15 21:01:37 +01:00
|
|
|
cmp dword [procinfo.box.height], 70
|
2010-08-17 00:04:18 +02:00
|
|
|
jae @f
|
|
|
|
mov esi, 70
|
2009-02-21 15:34:46 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov eax, edx
|
|
|
|
and eax, esi
|
|
|
|
cmp eax, -1
|
|
|
|
jz @f
|
|
|
|
mov ebx, ecx
|
|
|
|
mcall 67
|
2009-02-21 15:34:46 +01:00
|
|
|
@@:
|
|
|
|
|
|
|
|
.posok:
|
2012-12-15 21:01:37 +01:00
|
|
|
test [wnd_style], 1 SHL 25
|
|
|
|
jz .posok.slide_show
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall 12, 1
|
|
|
|
mcall 48, 4
|
|
|
|
mov ebp, eax ; save skin height
|
|
|
|
add eax, [wnd_height]
|
2012-12-15 21:01:37 +01:00
|
|
|
mov ebx, [wnd_x]
|
|
|
|
shl ebx, 16
|
2010-08-17 00:04:18 +02:00
|
|
|
add ebx, [wnd_width]
|
2012-12-15 21:01:37 +01:00
|
|
|
mov ecx, [wnd_y]
|
|
|
|
shl ecx, 16
|
|
|
|
add ecx, eax
|
|
|
|
mcall 0, , , [wnd_style], 0, real_header
|
|
|
|
jmp .posok.common
|
|
|
|
.posok.slide_show:
|
|
|
|
mcall 12, 1
|
|
|
|
mcall 14
|
|
|
|
mov ebx, eax
|
|
|
|
shr ebx, 16
|
|
|
|
movzx eax, ax
|
|
|
|
mov ecx, eax
|
|
|
|
mcall 0, , , [wnd_style], 0, real_header
|
|
|
|
.posok.common:
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall 9, procinfo, -1
|
2012-12-15 21:01:37 +01:00
|
|
|
mov eax, [procinfo.client_box.width]
|
|
|
|
sub eax, [image_padding]
|
|
|
|
sub eax, [image_padding]
|
|
|
|
sub eax, [draw_width]
|
|
|
|
sar eax, 1
|
|
|
|
test eax, eax
|
|
|
|
jns @f
|
|
|
|
mov eax, 0
|
|
|
|
@@:
|
|
|
|
add eax, [image_padding]
|
|
|
|
mov [draw_x], eax
|
|
|
|
mov eax, [procinfo.client_box.height]
|
|
|
|
sub eax, [toolbar_height]
|
|
|
|
sub eax, [image_padding]
|
|
|
|
sub eax, [image_padding]
|
|
|
|
sub eax, [draw_height]
|
|
|
|
sar eax, 1
|
|
|
|
test eax, eax
|
|
|
|
jns @f
|
|
|
|
mov eax, 0
|
|
|
|
@@:
|
|
|
|
add eax, [toolbar_height]
|
|
|
|
add eax, [image_padding]
|
|
|
|
mov [draw_y], eax
|
2010-08-17 00:04:18 +02:00
|
|
|
mov [bFirstDraw], 1
|
2012-12-15 21:01:37 +01:00
|
|
|
cmp dword [procinfo.client_box.height], 0
|
2010-08-17 00:04:18 +02:00
|
|
|
jle .nodraw
|
2012-12-15 21:01:37 +01:00
|
|
|
mov ebx, [procinfo.client_box.width]
|
2010-08-17 00:04:18 +02:00
|
|
|
inc ebx
|
2012-12-15 21:01:37 +01:00
|
|
|
mov ecx, [draw_y]
|
|
|
|
mcall 13, , , [bg_color]
|
|
|
|
mov ecx, [procinfo.client_box.height]
|
2010-08-17 00:04:18 +02:00
|
|
|
inc ecx
|
2012-12-15 21:01:37 +01:00
|
|
|
mov esi, [cur_frame]
|
|
|
|
mov esi, [esi + Image.Height]
|
|
|
|
add esi, [draw_y]
|
2010-08-17 00:04:18 +02:00
|
|
|
sub ecx, esi
|
|
|
|
jbe @f
|
|
|
|
push esi
|
|
|
|
shl esi, 16
|
|
|
|
add ecx, esi
|
|
|
|
pop esi
|
|
|
|
mcall
|
|
|
|
xor ecx, ecx
|
2009-02-21 15:34:46 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
add ecx, esi
|
2012-12-15 21:01:37 +01:00
|
|
|
mov ebx, [draw_y]
|
|
|
|
sub ecx, ebx
|
|
|
|
shl ebx, 16
|
|
|
|
add ecx, ebx
|
|
|
|
mov ebx, [draw_x]
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall
|
2012-12-15 21:01:37 +01:00
|
|
|
mov esi, [cur_frame]
|
|
|
|
mov esi, [esi + Image.Width]
|
2010-08-17 00:04:18 +02:00
|
|
|
add esi, ebx
|
2012-12-15 21:01:37 +01:00
|
|
|
mov ebx, [procinfo.client_box.width]
|
2010-08-17 00:04:18 +02:00
|
|
|
inc ebx
|
|
|
|
sub ebx, esi
|
|
|
|
jbe @f
|
|
|
|
shl esi, 16
|
|
|
|
add ebx, esi
|
|
|
|
mcall
|
2009-02-21 15:34:46 +01:00
|
|
|
@@:
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2012-12-15 21:01:37 +01:00
|
|
|
test [wnd_style], 1 SHL 25
|
|
|
|
jz .slide_show_mode
|
|
|
|
mov byte [bTglbar], 0
|
|
|
|
cmp byte [toolbar_height], 0
|
|
|
|
je .decorations_done
|
|
|
|
mov ebx, [procinfo.client_box.width]
|
2010-08-17 00:04:18 +02:00
|
|
|
push ebx
|
|
|
|
mcall 38, , <30, 30>, 0x007F7F7F
|
|
|
|
mcall , <5 + 25 * 1, 5 + 25 * 1>, <0, 30>
|
|
|
|
mcall , <10 + 25 * 3, 10 + 25 * 3>
|
2012-12-15 21:01:37 +01:00
|
|
|
mcall , <15 + 25 * 5, 15 + 25 * 5>
|
2010-08-17 00:04:18 +02:00
|
|
|
pop ebx
|
2012-12-15 21:01:37 +01:00
|
|
|
sub ebx, 25 * 5 + 10
|
2010-08-17 00:04:18 +02:00
|
|
|
push ebx
|
|
|
|
imul ebx, 10001h
|
|
|
|
mcall
|
|
|
|
|
|
|
|
mcall 8, <5 + 25 * 0, 20>, <5, 20>, 'opn'+40000000h
|
|
|
|
mcall , <10 + 25 * 1, 20>, , 'bck'+40000000h
|
|
|
|
mcall , <10 + 25 * 2, 20>, , 'fwd'+40000000h
|
|
|
|
mcall , <15 + 25 * 3, 20>, , 'bgr'+40000000h
|
2012-12-15 21:01:37 +01:00
|
|
|
mcall , <15 + 25 * 4, 20>, , 'sld'+40000000h
|
2010-08-17 00:04:18 +02:00
|
|
|
pop ebx
|
|
|
|
add ebx, 5
|
|
|
|
shl ebx, 16
|
|
|
|
mov bl, 20
|
|
|
|
mcall , , , 'flh'+40000000h
|
|
|
|
add ebx, 25 * 65536
|
|
|
|
mcall , , , 'flv'+40000000h
|
|
|
|
add ebx, 30 * 65536
|
|
|
|
mcall , , , 'rtr'+40000000h
|
|
|
|
add ebx, 25 * 65536
|
|
|
|
mcall , , , 'rtl'+40000000h
|
|
|
|
add ebx, 25 * 65536
|
|
|
|
mcall , , , 'flb'+40000000h
|
|
|
|
|
|
|
|
mov ebp, (numimages-1)*20
|
|
|
|
|
|
|
|
mcall 65, buttons+openbtn*20, <20, 20>, <5 + 25 * 0, 5>, 8, palette
|
2012-12-15 21:01:37 +01:00
|
|
|
mcall , buttons+backbtn*20, , <10 + 25 * 1, 5>
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall , buttons+forwardbtn*20, , <10 + 25 * 2, 5>
|
2012-12-15 21:01:37 +01:00
|
|
|
mcall , buttons+bgrbtn*20, , <15 + 25 * 3, 5>
|
|
|
|
mcall , buttons+slidebtn*20, , <15 + 25 * 4, 5>
|
|
|
|
mov edx, [procinfo.client_box.width]
|
2010-08-17 00:04:18 +02:00
|
|
|
sub edx, 25 * 5 + 4
|
|
|
|
shl edx, 16
|
|
|
|
mov dl, 5
|
|
|
|
mcall , buttons+fliphorzbtn*20
|
|
|
|
add edx, 25 * 65536
|
|
|
|
mcall , buttons+flipvertbtn*20
|
|
|
|
add edx, 30 * 65536
|
|
|
|
mcall , buttons+rotcwbtn*20
|
|
|
|
add edx, 25 * 65536
|
|
|
|
mcall , buttons+rotccwbtn*20
|
|
|
|
add edx, 25 * 65536
|
|
|
|
mcall , buttons+rot180btn*20
|
2012-12-15 21:01:37 +01:00
|
|
|
jmp .decorations_done
|
|
|
|
|
|
|
|
.slide_show_mode:
|
2010-08-17 00:04:18 +02:00
|
|
|
|
2012-12-15 21:01:37 +01:00
|
|
|
.decorations_done:
|
2010-08-17 00:04:18 +02:00
|
|
|
call draw_cur_frame
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2009-05-27 19:22:57 +02:00
|
|
|
.nodraw:
|
2010-08-17 00:04:18 +02:00
|
|
|
mcall 12, 2
|
2009-02-21 15:34:46 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
ret
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2009-05-24 18:48:56 +02:00
|
|
|
draw_cur_frame:
|
2010-08-17 00:04:18 +02:00
|
|
|
push 0 ; ypos
|
|
|
|
push 0 ; xpos
|
2012-12-15 21:01:37 +01:00
|
|
|
mov eax, [procinfo.client_box.height]
|
|
|
|
sub eax, [toolbar_height]
|
|
|
|
sub eax, [image_padding]
|
|
|
|
inc eax
|
2010-08-17 00:04:18 +02:00
|
|
|
push eax ; max height
|
2012-12-15 21:01:37 +01:00
|
|
|
mov eax, [procinfo.client_box.width]
|
|
|
|
sub eax, [image_padding]
|
|
|
|
inc eax
|
2010-08-17 00:04:18 +02:00
|
|
|
push eax ; max width
|
2012-12-15 21:01:37 +01:00
|
|
|
push [draw_y]
|
|
|
|
push [draw_x]
|
2010-08-17 00:04:18 +02:00
|
|
|
push [cur_frame]
|
|
|
|
call [img.draw]
|
|
|
|
mov eax, [image]
|
|
|
|
test [eax + Image.Flags], Image.IsAnimated
|
|
|
|
jnz .done
|
|
|
|
cmp [eax + Image.Next], 0
|
|
|
|
jnz .additional_frames
|
2009-06-03 23:12:49 +02:00
|
|
|
.done:
|
2010-08-17 00:04:18 +02:00
|
|
|
ret
|
2009-06-03 23:12:49 +02:00
|
|
|
.additional_frames:
|
2012-12-15 21:01:37 +01:00
|
|
|
mov ebx, [procinfo.client_box.width]
|
|
|
|
sub ebx, [image_padding]
|
|
|
|
inc ebx
|
2010-08-17 00:04:18 +02:00
|
|
|
jbe .done
|
2012-12-15 21:01:37 +01:00
|
|
|
mov esi, [draw_x]
|
2009-06-03 23:12:49 +02:00
|
|
|
.afloop:
|
2010-08-17 00:04:18 +02:00
|
|
|
sub ebx, [eax + Image.Width]
|
|
|
|
jbe .done
|
|
|
|
dec ebx
|
|
|
|
jz .done
|
|
|
|
add esi, [eax + Image.Width]
|
|
|
|
mov eax, [eax + Image.Next]
|
|
|
|
push eax
|
|
|
|
inc esi
|
|
|
|
push 0 ; ypos
|
|
|
|
push 0 ; xpos
|
2012-12-15 21:01:37 +01:00
|
|
|
mov ecx, [procinfo.client_box.height]
|
|
|
|
sub ecx, [toolbar_height]
|
|
|
|
sub ecx, [image_padding]
|
|
|
|
inc ecx
|
|
|
|
; inc ebx
|
2010-08-17 00:04:18 +02:00
|
|
|
push ecx ; max height
|
|
|
|
push ebx ; max width
|
2012-12-15 21:01:37 +01:00
|
|
|
push [draw_y] ; y
|
2010-08-17 00:04:18 +02:00
|
|
|
push esi ; x
|
|
|
|
push eax ; image
|
|
|
|
call [img.draw]
|
|
|
|
pop eax
|
|
|
|
cmp [eax + Image.Next], 0
|
|
|
|
jnz .afloop
|
|
|
|
ret
|
2009-05-24 18:48:56 +02:00
|
|
|
|
2009-01-28 15:55:32 +01:00
|
|
|
|
2010-02-28 20:40:01 +01:00
|
|
|
check_shortcut:
|
2010-08-17 00:04:18 +02:00
|
|
|
; in: cl = scancode (from sysfn 2),
|
|
|
|
; eax = state of modifiers (from sysfn 66.3),
|
|
|
|
; edx -> shortcut descriptor
|
|
|
|
; out: ZF set <=> fail
|
|
|
|
cmp cl, [edx+4]
|
|
|
|
jnz .not
|
|
|
|
push eax
|
|
|
|
mov esi, [edx]
|
|
|
|
and esi, 0xF
|
|
|
|
and al, 3
|
|
|
|
call dword [check_modifier_table+esi*4]
|
|
|
|
test al, al
|
|
|
|
pop eax
|
|
|
|
jnz .not
|
|
|
|
push eax
|
|
|
|
mov esi, [edx]
|
|
|
|
shr esi, 4
|
|
|
|
and esi, 0xF
|
|
|
|
shr al, 2
|
|
|
|
and al, 3
|
|
|
|
call dword [check_modifier_table+esi*4]
|
|
|
|
test al, al
|
|
|
|
pop eax
|
|
|
|
jnz .not
|
|
|
|
push eax
|
|
|
|
mov esi, [edx]
|
|
|
|
shr esi, 8
|
|
|
|
and esi, 0xF
|
|
|
|
shr al, 4
|
|
|
|
and al, 3
|
|
|
|
call dword [check_modifier_table+esi*4]
|
|
|
|
test al, al
|
|
|
|
pop eax
|
|
|
|
; jnz .not
|
2010-02-28 20:40:01 +01:00
|
|
|
.not:
|
2010-08-17 00:04:18 +02:00
|
|
|
ret
|
2010-02-28 20:40:01 +01:00
|
|
|
|
|
|
|
check_modifier_0:
|
2010-08-17 00:04:18 +02:00
|
|
|
setnz al
|
|
|
|
ret
|
2010-02-28 20:40:01 +01:00
|
|
|
check_modifier_1:
|
2010-08-17 00:04:18 +02:00
|
|
|
setp al
|
|
|
|
ret
|
2010-02-28 20:40:01 +01:00
|
|
|
check_modifier_2:
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp al, 3
|
|
|
|
setnz al
|
|
|
|
ret
|
2010-02-28 20:40:01 +01:00
|
|
|
check_modifier_3:
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp al, 1
|
|
|
|
setnz al
|
|
|
|
ret
|
2010-02-28 20:40:01 +01:00
|
|
|
check_modifier_4:
|
2010-08-17 00:04:18 +02:00
|
|
|
cmp al, 2
|
|
|
|
setnz al
|
|
|
|
ret
|
2010-02-28 20:40:01 +01:00
|
|
|
|
|
|
|
; fills real_header with window title
|
|
|
|
; window title is generated as '<filename> - Kolibri Image Viewer'
|
|
|
|
generate_header:
|
2010-08-17 00:04:18 +02:00
|
|
|
push eax
|
|
|
|
mov esi, [last_name_component]
|
|
|
|
mov edi, real_header
|
2010-02-28 20:40:01 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
lodsb
|
|
|
|
test al, al
|
|
|
|
jz @f
|
|
|
|
stosb
|
|
|
|
cmp edi, real_header+256
|
|
|
|
jb @b
|
2010-02-28 20:40:01 +01:00
|
|
|
.overflow:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov dword [edi-4], '...'
|
2010-02-28 20:40:01 +01:00
|
|
|
.ret:
|
2010-08-17 00:04:18 +02:00
|
|
|
pop eax
|
|
|
|
ret
|
2010-02-28 20:40:01 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
mov esi, s_header
|
2010-02-28 20:40:01 +01:00
|
|
|
@@:
|
2010-08-17 00:04:18 +02:00
|
|
|
lodsb
|
|
|
|
stosb
|
|
|
|
test al, al
|
|
|
|
jz .ret
|
|
|
|
cmp edi, real_header+256
|
|
|
|
jb @b
|
|
|
|
jmp .overflow
|
2009-01-28 15:55:32 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
2010-02-28 20:40:01 +01:00
|
|
|
s_header db ' - Kolibri Image Viewer', 0
|
2012-12-15 21:01:37 +01:00
|
|
|
wnd_style dd 0x73FFFFFF
|
|
|
|
wnd_x dd 100
|
|
|
|
wnd_y dd 100
|
|
|
|
image_padding dd 5
|
|
|
|
toolbar_height dd 31
|
|
|
|
bg_color dd 0x00ffffff
|
2009-01-28 15:55:32 +01:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
align 4
|
|
|
|
@IMPORT:
|
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
library \
|
|
|
|
libio , 'libio.obj' , \
|
|
|
|
libgfx , 'libgfx.obj' , \
|
|
|
|
libimg , 'libimg.obj' , \
|
|
|
|
libini , 'libini.obj' , \
|
|
|
|
sort , 'sort.obj' , \
|
|
|
|
proc_lib ,'proc_lib.obj'
|
|
|
|
|
|
|
|
|
|
|
|
import libio , \
|
|
|
|
libio.init , 'lib_init' , \
|
|
|
|
file.size , 'file_size' , \
|
|
|
|
file.open , 'file_open' , \
|
|
|
|
file.read , 'file_read' , \
|
|
|
|
file.close , 'file_close'
|
|
|
|
|
|
|
|
import libgfx , \
|
|
|
|
libgfx.init , 'lib_init' , \
|
|
|
|
gfx.open , 'gfx_open' , \
|
|
|
|
gfx.close , 'gfx_close' , \
|
|
|
|
gfx.pen.color , 'gfx_pen_color' , \
|
|
|
|
gfx.line , 'gfx_line'
|
|
|
|
|
|
|
|
import libimg , \
|
|
|
|
libimg.init , 'lib_init' , \
|
|
|
|
img.is_img , 'img_is_img' , \
|
|
|
|
img.to_rgb2 , 'img_to_rgb2', \
|
|
|
|
img.decode , 'img_decode' , \
|
|
|
|
img.flip , 'img_flip' , \
|
|
|
|
img.rotate , 'img_rotate' , \
|
|
|
|
img.destroy , 'img_destroy', \
|
|
|
|
img.draw , 'img_draw'
|
|
|
|
|
|
|
|
import libini, \
|
|
|
|
ini_get_shortcut, 'ini_get_shortcut'
|
2010-02-28 20:40:01 +01:00
|
|
|
|
2009-08-26 13:31:41 +02:00
|
|
|
import sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
|
2009-01-31 04:32:49 +01:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
import proc_lib, \
|
|
|
|
OpenDialog_Init, 'OpenDialog_init', \
|
|
|
|
OpenDialog_Start,'OpenDialog_start'
|
2010-07-03 16:27:35 +02:00
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
bFirstDraw db 0
|
2012-12-15 21:01:37 +01:00
|
|
|
bSlideShow db 0
|
|
|
|
bTglbar db 0
|
2009-01-28 15:55:32 +01:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
2009-01-31 04:32:49 +01:00
|
|
|
virtual at 0
|
|
|
|
file 'kivicons.bmp':0xA,4
|
|
|
|
load offbits dword from 0
|
|
|
|
end virtual
|
2012-12-15 21:01:37 +01:00
|
|
|
numimages = 10
|
2009-01-31 04:32:49 +01:00
|
|
|
openbtn = 0
|
|
|
|
backbtn = 1
|
|
|
|
forwardbtn = 2
|
|
|
|
bgrbtn = 3
|
|
|
|
fliphorzbtn = 4
|
|
|
|
flipvertbtn = 5
|
|
|
|
rotcwbtn = 6
|
|
|
|
rotccwbtn = 7
|
|
|
|
rot180btn = 8
|
2012-12-15 21:01:37 +01:00
|
|
|
slidebtn = 9
|
2009-01-31 04:32:49 +01:00
|
|
|
|
2009-01-28 15:55:32 +01:00
|
|
|
palette:
|
2010-08-17 00:04:18 +02:00
|
|
|
file 'kivicons.bmp':0x36,offbits-0x36
|
2009-01-31 04:32:49 +01:00
|
|
|
buttons:
|
2010-08-17 00:04:18 +02:00
|
|
|
file 'kivicons.bmp':offbits
|
2009-01-28 15:55:32 +01:00
|
|
|
repeat 10
|
|
|
|
y = % - 1
|
|
|
|
z = 20 - %
|
2009-01-31 04:32:49 +01:00
|
|
|
repeat numimages*5
|
|
|
|
load a dword from $ - numimages*20*20 + numimages*20*y + (%-1)*4
|
|
|
|
load b dword from $ - numimages*20*20 + numimages*20*z + (%-1)*4
|
|
|
|
store dword a at $ - numimages*20*20 + numimages*20*z + (%-1)*4
|
|
|
|
store dword b at $ - numimages*20*20 + numimages*20*y + (%-1)*4
|
2009-01-28 15:55:32 +01:00
|
|
|
end repeat
|
|
|
|
end repeat
|
|
|
|
|
2010-08-17 00:04:18 +02:00
|
|
|
inifilename db '/sys/media/kiv.ini',0
|
|
|
|
aShortcuts db 'Shortcuts',0
|
|
|
|
aNext db 'Next',0
|
|
|
|
aPrev db 'Prev',0
|
2012-12-15 21:01:37 +01:00
|
|
|
aSlide db 'SlideShow',0
|
|
|
|
aTglbar db 'ToggleBar',0
|
2010-02-28 20:40:01 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
check_modifier_table:
|
2010-08-17 00:04:18 +02:00
|
|
|
dd check_modifier_0
|
|
|
|
dd check_modifier_1
|
|
|
|
dd check_modifier_2
|
|
|
|
dd check_modifier_3
|
|
|
|
dd check_modifier_4
|
2010-02-28 20:40:01 +01:00
|
|
|
|
2010-05-28 12:27:10 +02:00
|
|
|
;---------------------------------------------------------------------
|
|
|
|
align 4
|
|
|
|
OpenDialog_data:
|
2010-08-17 00:04:18 +02:00
|
|
|
.type dd 0
|
|
|
|
.procinfo dd procinfo ;+4
|
|
|
|
.com_area_name dd communication_area_name ;+8
|
|
|
|
.com_area dd 0 ;+12
|
|
|
|
.opendir_pach dd temp_dir_pach ;+16
|
|
|
|
.dir_default_pach dd communication_area_default_pach ;+20
|
|
|
|
.start_path dd open_dialog_path ;+24
|
|
|
|
.draw_window dd draw_window ;+28
|
|
|
|
.status dd 0 ;+32
|
|
|
|
.openfile_pach dd path ;openfile_pach ;+36
|
|
|
|
.filename_area dd 0 ;+40
|
|
|
|
.filter_area dd Filter
|
2010-08-24 11:08:40 +02:00
|
|
|
.x:
|
|
|
|
.x_size dw 420 ;+48 ; Window X size
|
|
|
|
.x_start dw 10 ;+50 ; Window X position
|
|
|
|
.y:
|
|
|
|
.y_size dw 320 ;+52 ; Window y size
|
|
|
|
.y_start dw 10 ;+54 ; Window Y position
|
2010-05-28 12:27:10 +02:00
|
|
|
|
|
|
|
communication_area_name:
|
2010-08-17 00:04:18 +02:00
|
|
|
db 'FFFFFFFF_open_dialog',0
|
2010-11-15 13:37:00 +01:00
|
|
|
|
2010-05-28 12:27:10 +02:00
|
|
|
open_dialog_path:
|
2010-11-15 13:37:00 +01:00
|
|
|
if __nightbuild eq yes
|
|
|
|
db '/sys/MANAGERS/opendial',0
|
|
|
|
else
|
2010-08-17 00:04:18 +02:00
|
|
|
db '/sys/File Managers/opendial',0
|
2010-11-15 13:37:00 +01:00
|
|
|
end if
|
2010-05-28 12:27:10 +02:00
|
|
|
communication_area_default_pach:
|
2010-08-17 00:04:18 +02:00
|
|
|
db '/rd/1',0
|
2010-05-28 12:27:10 +02:00
|
|
|
|
|
|
|
Filter:
|
|
|
|
dd Filter.end - Filter
|
|
|
|
.1:
|
|
|
|
db 'BMP',0
|
|
|
|
db 'GIF',0
|
|
|
|
db 'JPG',0
|
|
|
|
db 'JPEG',0
|
|
|
|
db 'JPE',0
|
|
|
|
db 'PNG',0
|
|
|
|
db 'ICO',0
|
|
|
|
db 'CUR',0
|
2012-12-15 21:01:37 +01:00
|
|
|
db 'TGA',0
|
2010-08-17 00:04:18 +02:00
|
|
|
db 'PCX',0
|
2011-05-02 19:44:44 +02:00
|
|
|
db 'XCF',0
|
2012-02-23 23:16:03 +01:00
|
|
|
db 'PBM',0
|
|
|
|
db 'PGM',0
|
|
|
|
db 'PNM',0
|
|
|
|
db 'TIF',0
|
|
|
|
db 'TIFF',0
|
2012-02-23 23:52:59 +01:00
|
|
|
db 'WBMP',0
|
2010-05-28 12:27:10 +02:00
|
|
|
.end:
|
|
|
|
db 0
|
|
|
|
|
|
|
|
draw_window_fake:
|
2010-08-17 00:04:18 +02:00
|
|
|
ret
|
2010-05-28 12:27:10 +02:00
|
|
|
;------------------------------------------------------------------------------
|
2009-01-31 04:32:49 +01:00
|
|
|
readdir_fileinfo:
|
2010-08-17 00:04:18 +02:00
|
|
|
dd 1
|
|
|
|
dd 0
|
|
|
|
dd 0
|
|
|
|
readblocks dd 0
|
|
|
|
directory_ptr dd 0
|
2010-05-28 12:27:10 +02:00
|
|
|
;------------------------------------------------------------------------------
|
2009-01-28 15:55:32 +01:00
|
|
|
I_END:
|
2010-08-17 00:04:18 +02:00
|
|
|
curdir rb 1024
|
2009-01-31 04:32:49 +01:00
|
|
|
|
|
|
|
align 4
|
2009-01-28 15:55:32 +01:00
|
|
|
img_data dd ?
|
|
|
|
img_data_len dd ?
|
2010-08-17 00:04:18 +02:00
|
|
|
fh dd ?
|
|
|
|
image dd ?
|
2012-12-15 21:01:37 +01:00
|
|
|
wnd_width dd 100
|
|
|
|
wnd_height dd 100
|
|
|
|
draw_x dd ?
|
|
|
|
draw_y dd ?
|
2010-08-17 00:04:18 +02:00
|
|
|
draw_width dd ?
|
|
|
|
draw_height dd ?
|
|
|
|
last_name_component dd ?
|
|
|
|
cur_file_idx dd ?
|
|
|
|
cur_frame_time dd ?
|
|
|
|
cur_frame dd ?
|
|
|
|
|
|
|
|
next_mod dd ?
|
|
|
|
next_key dd ?
|
|
|
|
prev_mod dd ?
|
|
|
|
prev_key dd ?
|
2012-12-15 21:01:37 +01:00
|
|
|
slide_mod dd ?
|
|
|
|
slide_key dd ?
|
|
|
|
tglbar_mod dd ?
|
|
|
|
tglbar_key dd ?
|
|
|
|
|
|
|
|
toolbar_height_old rd 1
|
2010-08-17 00:04:18 +02:00
|
|
|
|
2012-12-15 21:01:37 +01:00
|
|
|
procinfo process_information
|
2010-08-17 00:04:18 +02:00
|
|
|
path: rb 4096 ;1024+16
|
|
|
|
real_header rb 256
|
2010-05-28 12:27:10 +02:00
|
|
|
@PARAMS rb 4096 ;512
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
temp_dir_pach:
|
|
|
|
rb 4096
|
|
|
|
;---------------------------------------------------------------------
|
2010-08-17 00:04:18 +02:00
|
|
|
rb 4096
|
2010-05-28 12:27:10 +02:00
|
|
|
stacktop:
|
|
|
|
;---------------------------------------------------------------------
|
2011-05-02 19:44:44 +02:00
|
|
|
F_END:
|