Subversion Repositories Kolibri OS

Rev

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

Rev 7628 Rev 7656
Line 2... Line 2...
2
 
2
 
3
use32
3
use32
Line 4... Line 4...
4
org 0x0
4
org 0x0
5
 
5
 
Line 6... Line 6...
6
db 'MENUET01'
6
db 'MENUET01'
Line 7... Line -...
7
dd 0x01, START, I_END, F_END, stacktop, @PARAMS, sys_path
-
 
8
 
-
 
9
;-----------------------------------------------------------------------------
7
dd 0x01, START, I_END, E_END, stacktop, __params, sys_path
10
 
8
 
11
include '../../../config.inc'
-
 
12
include '../../../proc32.inc'
-
 
Line 13... Line 9...
13
include '../../../macros.inc'
9
;-----------------------------------------------------------------------------
14
include '../../../dll.inc'
-
 
Line -... Line 10...
-
 
10
 
-
 
11
__DEBUG__        = 0
-
 
12
__DEBUG_LEVEL__  = 1
15
include '../../../KOSfuncs.inc'
13
 
16
;include '../../../debug.inc'
14
LG_TRACE equ 1
-
 
15
 
-
 
16
include 'config.inc'
-
 
17
include 'proc32.inc'
-
 
18
include 'macros.inc'
-
 
19
include 'KOSfuncs.inc'
-
 
20
include 'dll.inc'
-
 
21
include 'debug-fdo.inc'
-
 
22
include 'libimg.inc'
-
 
23
 
-
 
24
 
-
 
25
KEY_MOVE_PIXELS   = 50
-
 
26
SCROLL_WIDTH_SIZE = 15
17
 
27
AR_OFFSET         = 10
Line 18... Line 28...
18
include '../../../develop/libraries/libs-dev/libio/libio.inc'
28
 
-
 
29
MIN_WINDOW_WIDTH  = 50 + 25*numimages
-
 
30
MIN_WINDOW_HEIGHT = 100
19
include '../../../develop/libraries/libs-dev/libimg/libimg.inc'
31
TOOLBAR_HEIGHT    = 31
-
 
32
CANVAS_PADDING    = 5
-
 
33
;-----------------------------------------------------------------------------
Line 20... Line 34...
20
 
34
 
21
;include '../../../develop/libraries/box_lib/asm/trunk/opendial.mac'
35
START:
22
;use_OpenDialog
36
        mcall   SF_SYSTEM, SSF_MOUSE_SETTINGS, SSSF_SET_SPEED, 5
Line 23... Line 37...
23
;-----------------------------------------------------------------------------
37
        mcall   SF_SYSTEM, SSF_MOUSE_SETTINGS, SSSF_SET_SPEEDUP, 5
Line 24... Line 38...
24
 
38
        mcall   SF_SYS_MISC, SSF_HEAP_INIT
25
START:
39
        mcall   SF_KEYBOARD, SSF_SET_INPUT_MODE, 1  ; set kbd mode to scancodes
26
    mcall   SF_SYS_MISC, SSF_HEAP_INIT
40
        mcall   SF_SET_EVENTS_MASK, EVM_REDRAW or EVM_KEY or EVM_BUTTON or EVM_MOUSE or EVM_MOUSE_FILTER
27
 
41
 
28
    stdcall dll.Load, @IMPORT
42
        stdcall dll.Load, @IMPORT
29
    or  eax, eax
43
        or      eax, eax
Line 30... Line 44...
30
    jnz exit
44
        jnz     exit
31
 
45
 
32
    invoke  sort.START, 1
46
        invoke  sort.START, 1
33
 
47
 
34
    mov ecx, 1  ; for 15.4: 1 = tile
48
        mov     ecx, 1  ; for 15.4: 1 = tile
35
    cmp word [@PARAMS], '\T'
49
        cmp     word[__params], '\T'
36
    jz  set_bgr
50
        jz      set_bgr
37
    inc ecx ; for 15.4: 2 = stretch
51
        inc     ecx     ; for 15.4: 2 = stretch
Line 57... Line 71...
57
    mov [prev_key], eax
71
        mov     [prev_key], eax
58
    invoke  ini_get_shortcut, inifilename, aShortcuts, aSlide, -1, slide_mod
72
        invoke  ini_get_shortcut, inifilename, aShortcuts, aSlide, -1, slide_mod
59
    mov [slide_key], eax
73
        mov     [slide_key], eax
60
    invoke  ini_get_shortcut, inifilename, aShortcuts, aTglbar, -1, tglbar_mod
74
        invoke  ini_get_shortcut, inifilename, aShortcuts, aTglbar, -1, tglbar_mod
61
    mov [tglbar_key], eax
75
        mov     [tglbar_key], eax
62
    mcall   SF_KEYBOARD, SSF_SET_INPUT_MODE, 1    ; set kbd mode to scancodes
-
 
Line 63... Line 76...
63
 
76
 
64
    cmp byte [@PARAMS], 0
77
        cmp     byte[__params], 0
Line 65... Line 78...
65
    jnz params_given
78
        jnz     params_given
Line 66... Line 79...
66
 
79
 
67
    mov [OpenDialog_data.draw_window],draw_window_fake
80
        mov     [OpenDialog_data.draw_window], draw_window_fake
68
    
81
 
Line 69... Line 82...
69
; OpenDialog Open
82
; OpenDialog Open
70
    push    dword OpenDialog_data
83
        push    dword OpenDialog_data
Line 71... Line 84...
71
    call    [OpenDialog_Start]
84
        call    [OpenDialog_Start]
Line 72... Line 85...
72
 
85
 
73
    cmp [OpenDialog_data.status],1
86
        cmp     [OpenDialog_data.status], 1
74
    jne exit
87
        jnz     exit
75
 
88
 
76
    mov [OpenDialog_data.draw_window],draw_window
89
        mov     [OpenDialog_data.draw_window], draw_window
77
 
90
 
Line 78... Line 91...
78
    mov esi, path
91
        mov     esi, path
79
    mov edi, @PARAMS
92
        mov     edi, __params
80
    mov ecx, 4096/4
-
 
81
    rep movsd
93
        mov     ecx, 4096/4
82
    mov byte [edi-1], 0
94
        rep     movsd
83
    jmp params_given
-
 
84
 
95
        mov     byte[edi-1], 0
85
set_bgr:
96
        jmp     params_given
Line 86... Line 97...
86
    mcall   SF_BACKGROUND_SET, SSF_MODE_BG
97
 
87
    mov eax, @PARAMS + 4
-
 
88
    call    load_image
98
set_bgr:
89
    jc  exit
99
        mcall   SF_BACKGROUND_SET, SSF_MODE_BG
90
 
100
        stdcall load_image, __params + 4
-
 
101
        jc      exit
Line 91... Line 102...
91
    call    set_as_bgr
102
        call    set_as_bgr
92
    jmp exit
103
        jmp     exit
93
 
104
 
94
params_given:
-
 
Line 95... Line 105...
95
 
105
params_given:
Line 96... Line 106...
96
    mov esi, @PARAMS
106
        mov     esi, __params
97
    push    esi
107
        push    esi
Line 98... Line 108...
98
    call    find_last_name_component
108
        call    find_last_name_component
99
 
109
        call    load_directory
100
    pop eax
110
 
101
    call    load_image
111
        pop     eax
102
    jc  exit
-
 
103
    call    generate_header
112
        stdcall load_image, eax
104
 
113
        jc      exit
105
;-----------------------------------------------------------------------------
114
 
106
 
115
;-----------------------------------------------------------------------------
107
red:
116
 
108
    call    draw_window
117
redraw_all:
109
 
118
        call    draw_window
-
 
119
 
110
still:
120
still:
-
 
121
        mov     eax, [orig_image]
-
 
122
        test    [eax + Image.Flags], Image.IsAnimated
111
    mov eax, [image]
123
        movi    eax, SF_WAIT_EVENT
112
    test    byte [eax + Image.Flags], Image.IsAnimated
124
        jz      .wait_event
113
    push    SF_WAIT_EVENT
125
        mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
114
    pop eax
126
        mov     edx, [cur_frame]
115
    jz  @f
127
        mov     ebx, [cur_frame_time]
-
 
128
        add     ebx, [edx + Image.Delay]
-
 
129
        sub     ebx, eax
116
    mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
130
        cmp     ebx, [edx + Image.Delay]
117
    mov edx, [cur_frame]
131
        jna     @f
-
 
132
        call    red_update_frame
118
    mov ebx, [cur_frame_time]
133
        jmp     still
-
 
134
    @@:
-
 
135
        test    ebx, ebx
-
 
136
        jnz     @f
-
 
137
        call    red_update_frame
119
    add ebx, [edx + Image.Delay]
138
        jmp     still
120
    sub ebx, eax
139
    @@:
121
    cmp ebx, [edx + Image.Delay]
140
        movi    eax, SF_WAIT_EVENT_TIMEOUT
-
 
141
  .wait_event:
-
 
142
        mcall   
-
 
143
        dec     eax
-
 
144
        jns     @f
-
 
145
        call    red_update_frame
-
 
146
        jmp     still
-
 
147
    @@:
-
 
148
        jz      redraw_all
-
 
149
        dec     eax
-
 
150
        jz      key
-
 
151
        dec     eax
-
 
152
        jz      button
-
 
153
 
-
 
154
mouse:
-
 
155
        mov     [pict_moved], 0
-
 
156
 
-
 
157
        
-
 
158
        invoke  scrollbar_vert_mouse, scroll_bar_data_vertical
-
 
159
        invoke  scrollbar_hort_mouse, scroll_bar_data_horizontal
-
 
160
        xor     ecx, ecx
-
 
161
        mov     eax, [scroll_bar_data_vertical.position]
-
 
162
        cmp     [pict.top], eax
-
 
163
        mov     [pict.top], eax
-
 
164
        setnz   cl
-
 
165
        mov     eax, [scroll_bar_data_horizontal.position]
-
 
166
        cmp     [pict.left], eax
-
 
167
        mov     [pict.left], eax
-
 
168
        setnz   ch
-
 
169
        test    ecx, ecx
-
 
170
        jz      @f
-
 
171
        call    draw_view
-
 
172
        call    draw_onimage_decorations
-
 
173
    @@:
-
 
174
 
-
 
175
        ; check for scroll
-
 
176
        mcall   SF_MOUSE_GET, SSF_SCROLL_DATA
-
 
177
        test    eax, eax
-
 
178
        jz      .no_scroll
-
 
179
        movsx   ecx, ax
-
 
180
        shl     ecx, 4
-
 
181
        sar     eax, 16
-
 
182
        shl     eax, 4
-
 
183
        stdcall move_pictport, eax, ecx
-
 
184
        mov     [pict_moved], eax
-
 
185
        jmp     .mouse_done
-
 
186
  .no_scroll:
-
 
187
 
-
 
188
        ; get cursor coordinates in window
-
 
189
        mcall   SF_MOUSE_GET, SSF_WINDOW_POSITION
-
 
190
        movsx   ebx, ax
-
 
191
        cmp     ebx, 0
-
 
192
        jge     @f
-
 
193
        add     eax, 0x10000
-
 
194
    @@:
-
 
195
        mov     ecx, [mouse_pos]
-
 
196
        cmp     eax, ecx
-
 
197
        jz      .no_mouse_move
-
 
198
        mov     [mouse_pos], eax
-
 
199
 
-
 
200
        cmp     [pict_drag], 1
-
 
201
        jnz     .no_mouse_move
-
 
202
        sar     eax, 16
-
 
203
        movsx   edx, cx
-
 
204
        sar     ecx, 16
-
 
205
        sub     eax, ecx
-
 
206
        sub     ebx, edx
-
 
207
        neg     eax
-
 
208
        neg     ebx
-
 
209
        stdcall move_pictport, eax, ebx
-
 
210
        mov     [pict_moved], eax
-
 
211
        jmp     .no_mouse_move
-
 
212
  .no_mouse_move:
-
 
213
 
-
 
214
        ; check buttons
-
 
215
        mcall   SF_MOUSE_GET, SSF_BUTTON
-
 
216
        mov     ecx, eax
-
 
217
        xor     ecx, [mouse_buttons]
-
 
218
        mov     [mouse_buttons], eax
-
 
219
        test    ecx, 0x01
-
 
220
        jz      .left_button_handled
-
 
221
        test    eax, 0x01
-
 
222
        jnz     .left_button_down
-
 
223
  .left_button_up:
-
 
224
        mov     [pict_drag], 0
-
 
225
        jmp     .left_button_handled
-
 
226
  .left_button_down:
-
 
227
        mov     ecx, [mouse_pos]
-
 
228
        movzx   edx, cx
-
 
229
        sar     ecx, 16
-
 
230
        mov     ebx, [canvas_abs_top]
-
 
231
        add     ebx, [view.top]
-
 
232
        cmp     ebx, edx
-
 
233
        jg      .left_click_pict_done
-
 
234
        add     ebx, [view.height]
-
 
235
        cmp     ebx, edx
-
 
236
        jl      .left_click_pict_done
-
 
237
        mov     ebx, [canvas_abs_left]
-
 
238
        add     ebx, [view.left]
-
 
239
        cmp     ebx, ecx
-
 
240
        jg      .left_click_pict_done
-
 
241
        add     ebx, [view.width]
-
 
242
        cmp     ebx, ecx
-
 
243
        jl      .left_click_pict_done
-
 
244
        mov     [pict_drag], 1
-
 
245
        jmp     .left_button_handled
Line 122... Line 246...
122
    ja  red_update_frame
246
  .left_click_pict_done:
123
    test    ebx, ebx
247
 
124
    jz  red_update_frame
248
  .left_button_handled:
125
    push    SF_WAIT_EVENT_TIMEOUT
249
  .mouse_done:
Line 151... Line 275...
151
    call    check_shortcut
275
        call    check_shortcut
152
    jz  .slide
276
        jz      .slide
153
    add edx, tglbar_mod - slide_mod
277
        add     edx, tglbar_mod - slide_mod
154
    call    check_shortcut
278
        call    check_shortcut
155
    jz  .tglbar
279
        jz      .tglbar
-
 
280
 
-
 
281
        mov     edx, scale_none_mod
-
 
282
        call    check_shortcut
-
 
283
        jz      .set_scale_none
-
 
284
        add     edx, scale_fit_min_mod - scale_none_mod
-
 
285
        call    check_shortcut
-
 
286
        jz      .set_scale_fit_min
-
 
287
        add     edx, move_pictport_left_1_mod - scale_fit_min_mod
-
 
288
        call    check_shortcut
-
 
289
        jz      .move_pictport_left
-
 
290
        add     edx, move_pictport_left_2_mod - move_pictport_left_1_mod
-
 
291
        call    check_shortcut
-
 
292
        jz      .move_pictport_left
-
 
293
        add     edx, move_pictport_right_1_mod - move_pictport_left_2_mod
-
 
294
        call    check_shortcut
-
 
295
        jz      .move_pictport_right
-
 
296
        add     edx, move_pictport_right_2_mod - move_pictport_right_1_mod
-
 
297
        call    check_shortcut
-
 
298
        jz      .move_pictport_right
-
 
299
        add     edx, move_pictport_up_1_mod - move_pictport_right_2_mod
-
 
300
        call    check_shortcut
-
 
301
        jz      .move_pictport_up
-
 
302
        add     edx, move_pictport_up_2_mod - move_pictport_up_1_mod
-
 
303
        call    check_shortcut
-
 
304
        jz      .move_pictport_up
-
 
305
        add     edx, move_pictport_down_1_mod - move_pictport_up_2_mod
-
 
306
        call    check_shortcut
-
 
307
        jz      .move_pictport_down
-
 
308
        add     edx, move_pictport_down_2_mod - move_pictport_down_1_mod
-
 
309
        call    check_shortcut
-
 
310
        jz      .move_pictport_down
-
 
311
 
156
    cmp cl, 1 ; Esc
312
        cmp     cl, 1 ; Esc
157
    jz  .esc
313
        jz      .esc
158
    jmp keyloop
314
        jmp     keyloop
159
.esc:
315
  .esc:
160
    test byte [bSlideShow], 1
316
        test    [bSlideShow], 1
161
    jnz .slide
317
        jz      keyloop
162
    jmp keyloop
318
        jmp     .slide
163
.tglbar:
319
  .tglbar:
164
    mov byte [bTglbar], 1
320
        bt      [window_style], 25
165
    test byte[bSlideShow], 1
321
        jnc     @f
166
    jnz @f
322
        mov     [bToggleToolbar], 1
167
    xor [toolbar_height], 31
323
        xor     [bShowToolbar], 1
168
@@:
324
    @@:
169
    jmp keyloop
325
        jmp     keyloop
170
.slide:
326
  .slide:
171
    call slide_show
327
        call    slide_show
172
    jmp keyloop
328
        jmp     keyloop
-
 
329
  .set_scale_none:
-
 
330
        stdcall set_scale_mode, LIBIMG_SCALE_NONE
-
 
331
        mov     eax, [scale_mode]
-
 
332
        call    recalc_canvas
-
 
333
;        call    draw_view
-
 
334
        jmp     keyloop
-
 
335
  .set_scale_fit_min:
-
 
336
        stdcall set_scale_mode, LIBIMG_SCALE_FIT_MIN
-
 
337
        mov     eax, [scale_mode]
-
 
338
        call    recalc_work
-
 
339
;        call    draw_view
-
 
340
        jmp     keyloop
-
 
341
  .move_pictport_left:
-
 
342
        stdcall move_pictport, -KEY_MOVE_PIXELS, 0
-
 
343
        stdcall update_scrollbars, eax
-
 
344
        call    draw_view
-
 
345
        call    draw_onimage_decorations
-
 
346
        jmp     keyloop
-
 
347
  .move_pictport_right:
-
 
348
        stdcall move_pictport, KEY_MOVE_PIXELS, 0
-
 
349
        stdcall update_scrollbars, eax
-
 
350
        call    draw_view
-
 
351
        call    draw_onimage_decorations
-
 
352
        jmp     keyloop
-
 
353
  .move_pictport_up:
-
 
354
        stdcall move_pictport, 0, -KEY_MOVE_PIXELS
-
 
355
        stdcall update_scrollbars, eax
-
 
356
        call    draw_view
-
 
357
        call    draw_onimage_decorations
-
 
358
        jmp     keyloop
-
 
359
  .move_pictport_down:
-
 
360
        stdcall move_pictport, 0, KEY_MOVE_PIXELS
-
 
361
        stdcall update_scrollbars, eax
-
 
362
        call    draw_view
-
 
363
        call    draw_onimage_decorations
-
 
364
        jmp     keyloop
173
.prev:
365
  .prev:
174
    dec esi
366
        dec     esi
175
    jmp keyloop
367
        jmp     keyloop
176
.next:
368
  .next:
177
    inc esi
369
        inc     esi
178
    jmp keyloop
370
        jmp     keyloop
179
keyloopdone:
371
keyloopdone:
180
    test esi, esi
372
        test    esi, esi
181
    jnz next_or_prev_handler
373
        jnz     next_or_prev_handler
182
    test byte [bSlideShow], 2
374
        test    [bToggleSlideShow], 1
183
    jnz red
375
        jnz     redraw_all
184
    test byte [bTglbar], 1
376
        test    [bToggleToolbar], 1
-
 
377
        stdcall recalc_client
-
 
378
        jnz     redraw_all
-
 
379
        test    [bScaleModeChanged], 1
-
 
380
        mov     [bScaleModeChanged], 0
-
 
381
        jnz     redraw_all
-
 
382
        test    [bNewImage], 1
-
 
383
        mov     [bNewImage], 0
185
    jnz red
384
        jnz     redraw_all
186
    jmp still
385
        jmp     still
187
next_or_prev_handler:
386
next_or_prev_handler:
188
    call    next_or_prev_image
387
        call    next_or_prev_image
189
    jmp red
388
        jmp     redraw_all
Line 190... Line 389...
190
 
389
 
191
red_update_frame:
390
red_update_frame:
192
    mov eax, [cur_frame]
391
        mov     eax, [cur_frame]
193
    mov eax, [eax + Image.Next]
392
        mov     eax, [eax + Image.Next]
194
    test    eax, eax
393
        test    eax, eax
195
    jnz @f
394
        jnz     @f
196
    mov eax, [image]
395
        mov     eax, [cur_image]
197
  @@:
396
    @@:
198
    mov [cur_frame], eax
397
        mov     [cur_frame], eax
199
    mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
398
        mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
200
    mov [cur_frame_time], eax
-
 
201
    mcall   SF_THREAD_INFO, procinfo, -1
399
        mov     [cur_frame_time], eax
202
    call    draw_cur_frame
400
        call    draw_view
Line 203... Line 401...
203
    jmp still
401
        ret
204
 
402
 
205
button:
403
button:
Line 206... Line 404...
206
    mcall   SF_GET_BUTTON
404
        mcall   SF_GET_BUTTON
207
    shr eax, 8
405
        shr     eax, 8
208
 
406
 
Line -... Line 407...
-
 
407
        ; flip horizontally
-
 
408
        cmp     eax, 'flh'
-
 
409
        jnz     .not_flh
209
    ; flip horizontally
410
 
-
 
411
        mov     eax, [cur_image]
-
 
412
        cmp     eax, [orig_image]
210
    cmp eax, 'flh'
413
        jz      @f
Line 211... Line 414...
211
    jne @f
414
        invoke  img.flip, [cur_image], FLIP_HORIZONTAL
-
 
415
    @@:
212
 
416
        invoke  img.flip, [orig_image], FLIP_HORIZONTAL
213
    invoke  img.flip, [image], FLIP_HORIZONTAL
417
        jmp     redraw_all
Line -... Line 418...
-
 
418
 
-
 
419
        ; flip vertically
-
 
420
  .not_flh:
214
    jmp redraw_image
421
        cmp     eax, 'flv'
-
 
422
        jnz     .not_flv
-
 
423
 
215
 
424
        mov     eax, [cur_image]
Line 216... Line 425...
216
    ; flip vertically
425
        cmp     eax, [orig_image]
-
 
426
        jz      @f
217
    @@: cmp eax, 'flv'
427
        invoke  img.flip, [cur_image], FLIP_VERTICAL
218
    jne @f
428
    @@:
Line -... Line 429...
-
 
429
        invoke  img.flip, [orig_image], FLIP_VERTICAL
-
 
430
        jmp     redraw_all
-
 
431
 
219
 
432
        ; flip both horizontally and vertically
-
 
433
  .not_flv:
-
 
434
        cmp     eax, 'flb'
220
    invoke  img.flip, [image], FLIP_VERTICAL
435
        jnz     .not_flb
Line 221... Line 436...
221
    jmp redraw_image
436
 
-
 
437
        mov     eax, [cur_image]
222
 
438
        cmp     eax, [orig_image]
223
    ; flip both horizontally and vertically
439
        jz      @f
Line 224... Line 440...
224
    @@: cmp eax, 'flb'
440
        invoke  img.flip, [cur_image], FLIP_BOTH
225
    jne @f
441
    @@:
226
 
442
        invoke  img.flip, [orig_image], FLIP_BOTH
227
    invoke  img.flip, [image], FLIP_BOTH
443
        jmp     redraw_all
-
 
444
 
228
    jmp redraw_image
445
        ; rotate left
229
 
446
  .not_flb:
-
 
447
        cmp     eax, 'rtl'
-
 
448
        jnz     .not_rtl
230
    ; rotate left
449
 
Line 231... Line 450...
231
    @@: cmp eax, 'rtl'
450
        push    ROTATE_90_CCW
-
 
451
  .rotate_common:
232
    jne @f
452
        mov     eax, [cur_image]
233
 
453
        cmp     eax, [orig_image]
Line 234... Line 454...
234
    push    ROTATE_90_CCW
454
        jz      @f
235
.rotate_common:
455
        invoke  img.destroy, [cur_image]
Line 236... Line 456...
236
    invoke  img.rotate, [image]
456
        mov     [cur_image], 0
-
 
457
    @@:
237
    mov eax, [image]
458
        invoke  img.rotate, [orig_image]
238
    test    eax, eax    ; clear ZF flag
459
        jmp     redraw_all
Line 239... Line 460...
239
    call    update_image_sizes
460
 
240
    jmp redraw_image
461
        ; rotate right
241
 
462
  .not_rtl:
Line 242... Line 463...
242
    ; rotate right
463
        cmp     eax, 'rtr'
243
    @@: cmp eax, 'rtr'
464
        jnz     .not_rtr
Line 244... Line 465...
244
    jne @f
465
 
245
 
466
        push    ROTATE_90_CW
246
    push    ROTATE_90_CW
467
        jmp     .rotate_common
247
    jmp .rotate_common
468
 
248
 
469
        ; open new file
249
    ; open new file
470
  .not_rtr:
Line 250... Line 471...
250
    @@: cmp eax, 'opn'
471
        cmp     eax, 'opn'
251
    jne @f
472
        jnz     @f
252
    
473
 
Line 253... Line 474...
253
; OpenDialog Open
474
; OpenDialog Open
254
    push    dword OpenDialog_data
475
        push    dword OpenDialog_data
255
    call    [OpenDialog_Start]
476
        call    [OpenDialog_Start]
256
    
477
 
257
    cmp [OpenDialog_data.status],1
-
 
258
    jne still
-
 
259
    
-
 
260
    mov esi, path
478
        cmp     [OpenDialog_data.status], 1
261
    mov edi, @PARAMS
479
        jnz     still
Line 262... Line 480...
262
    push    edi
480
 
263
    mov ecx, 4096/4
481
        mov     esi, path
264
    rep movsd
-
 
265
    mov byte [edi-1], 0
482
        mov     edi, __params
Line 266... Line 483...
266
    
483
        push    edi
267
    pop esi
484
        mov     ecx, 4096/4
268
    push    esi
485
        rep     movsd
269
    call    find_last_name_component
486
        mov     byte[edi-1], 0
Line 270... Line 487...
270
 
487
 
271
    pop eax 
488
        pop     esi
272
    push    [image]
489
        push    esi
Line 273... Line 490...
273
    call    load_image
490
        call    find_last_name_component
274
    jc  .restore_old
491
 
275
    call    generate_header
492
        pop     eax 
Line 276... Line 493...
276
    
493
        push    [cur_image]
277
    invoke  img.destroy
494
        stdcall load_image, eax
Line 278... Line 495...
278
    call    free_directory
495
        jc      .restore_old
279
    jmp red
-
 
280
    
496
        call    free_directory
281
    .restore_old:
497
        jmp     redraw_all
282
    pop [image]
498
 
283
    call    init_frame
499
  .restore_old:
284
    jmp still
500
        pop     eax
285
 
501
        jmp     still
Line 286... Line 502...
286
    ; set background
502
 
287
    @@:
503
        ; set background
Line 288... Line 504...
288
    cmp eax, 'bgr'
504
    @@:
289
    jne @f
505
        cmp     eax, 'bgr'
Line 290... Line -...
290
 
-
 
Line 291... Line 506...
291
	mcall   SF_BACKGROUND_SET, SSF_MODE_BG, 2 ;stretch by default
506
        jnz     @f
292
    call    set_as_bgr
-
 
293
    jmp still
507
 
294
 
508
        mcall   SF_BACKGROUND_SET, SSF_MODE_BG, 2 ; stretch by default
295
    @@:
-
 
296
    cmp eax, 'sld'
-
 
297
    jne @f
-
 
298
 
-
 
299
    call    slide_show
-
 
300
    jmp red
-
 
301
 
509
        call    set_as_bgr
302
    @@:
-
 
303
 
-
 
304
    or  esi, -1
-
 
305
    cmp eax, 'bck'
-
 
306
    jz  next_or_prev_handler
-
 
307
    neg esi
-
 
308
    cmp eax, 'fwd'
-
 
309
    jz  next_or_prev_handler
-
 
310
 
-
 
311
    cmp eax, 1
510
        jmp     still
-
 
511
 
Line 312... Line 512...
312
    jne still
512
    @@:
313
 
513
        cmp     eax, 'sld'
314
  exit:
-
 
315
    mcall   SF_TERMINATE_PROCESS
514
        jnz     @f
316
 
515
 
317
  redraw_image = red
516
        call    slide_show
318
 
517
        jmp     redraw_all
319
load_image:
518
 
320
    and [img_data], 0
519
    @@:
321
    push    eax
520
        or      esi, -1
322
    invoke  file.open, eax, O_READ
-
 
323
    or  eax, eax
521
        cmp     eax, 'bck'
324
    jz  .error_pop
522
        jz      next_or_prev_handler
Line 325... Line 523...
325
    mov [fh], eax
523
        neg     esi
326
    invoke  file.size
524
        cmp     eax, 'fwd'
327
    mov [img_data_len], ebx
-
 
328
    stdcall mem.Alloc, ebx
-
 
329
    test    eax, eax
-
 
330
    jz  .error_close
-
 
331
    mov [img_data], eax
-
 
332
    invoke  file.read, [fh], eax, [img_data_len]
-
 
333
    cmp eax, -1
525
        jz      next_or_prev_handler
334
    jz  .error_close
526
 
335
    cmp eax, [img_data_len]
-
 
336
    jnz .error_close
527
        cmp     eax, 1
337
    invoke  file.close, [fh]
528
        jnz     still
338
    inc eax
-
 
339
    jz  .error
-
 
340
 
-
 
341
    invoke  img.decode, [img_data], [img_data_len], 0
-
 
342
    or  eax, eax
-
 
343
    jz  .error
-
 
344
    cmp [image], 0
-
 
345
    pushf
-
 
346
    mov [image], eax
-
 
347
    call    img_resize_to_screen
-
 
348
    call    init_frame
-
 
349
    popf
-
 
350
    call    update_image_sizes
-
 
351
    call    free_img_data
-
 
352
    clc
-
 
353
    ret
-
 
354
 
-
 
355
.error_free:
-
 
356
    invoke  img.destroy, [image]
-
 
357
    jmp .error
-
 
358
 
-
 
359
.error_pop:
-
 
360
    pop eax
-
 
361
    jmp .error
-
 
362
.error_close:
-
 
363
    invoke  file.close, [fh]
-
 
364
.error:
-
 
365
    call    free_img_data
529
 
366
    stc
-
 
367
    ret
-
 
368
 
-
 
369
align 4
-
 
370
proc img_resize_to_screen uses eax ebx ecx edx
-
 
371
	mov ebx, [image]
-
 
372
	cmp	[ebx+Image.Type],Image.bpp24
-
 
373
	jne .end_f
-
 
374
	test [ebx+Image.Flags],Image.IsAnimated
-
 
375
	jnz .end_f
-
 
376
	mov eax, [ebx+Image.Data]	
-
 
377
	mov [buf_0],eax
-
 
378
	mov eax, [ebx+Image.Width]
-
 
379
	mov [buf_0.w],eax
-
 
380
	mov eax, [ebx+Image.Height]
-
 
381
	mov [buf_0.h],eax
-
 
382
 
-
 
383
	mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
-
 
384
	mov edx, [image_padding]
-
 
385
	shl edx, 1
-
 
386
	add edx, eax
-
 
387
	mcall SF_GET_SCREEN_SIZE
-
 
388
	mov ecx, eax
-
 
389
	shr ecx, 17
-
 
390
 
-
 
391
	mov ebx, [image]
-
 
392
	movzx eax,ax
-
 
393
	sub eax, edx
-
 
394
	sub eax, [toolbar_height]
-
 
395
	sub eax, 5-1 ;5 px = border
-
 
396
	cmp eax, 1
530
exit:
397
	jle .end0
531
        mcall   -1
Line 398... Line -...
398
	cmp eax, [ebx+Image.Height]
-
 
399
	jl .end1
-
 
400
	.end0:
-
 
401
		xor eax,eax
-
 
402
		jmp .end2
-
 
403
	.end1:
-
 
404
		mov [ebx+Image.Height],eax
-
 
405
	.end2:
-
 
Line -... Line 532...
-
 
532
 
406
	sub ecx, [image_padding]
533
 
407
	shl ecx, 1
534
proc load_image _filename
408
	sub ecx, 10-1 ;10 px = 2 borders
535
        push    ebx esi edi
409
	cmp ecx, 1
536
        invoke  img.from_file, [_filename]
410
	jle .end3
537
        test    eax, eax
411
	cmp ecx, [ebx+Image.Width]
538
        jz      .error
-
 
539
        mov     ebx, eax
412
	jl .end4
540
 
413
	.end3:
541
        test    [eax + Image.Flags], Image.IsAnimated
414
		xor ecx,ecx
542
        jnz     @f
415
		jmp .end5
543
        cmp     [eax + Image.Next], 0
416
	.end4:
544
        jz      @f
417
		mov [ebx+Image.Width],ecx
545
        stdcall merge_icons_to_single_img, eax
-
 
546
        test    eax, eax
418
	.end5:
547
        jz      .error_destroy
419
	cmp eax,ecx
548
    @@:
420
	jne @f
549
        stdcall init_frame, eax
421
		test eax,eax
550
        clc
422
		jz .end_f
551
        jmp     .exit
423
	@@:
552
 
424
	stdcall [buf2d_resize], buf_0, ecx, eax, 2
553
  .error_destroy:
425
.end_f:
554
        invoke  img.destroy, ebx
426
	ret
-
 
427
endp
-
 
428
 
555
        xor     eax, eax
429
align 4
556
  .error:
430
free_img_data:
557
        stc
431
    mov eax, [img_data]
558
  .exit:
-
 
559
        pop     edi esi ebx
432
    test    eax, eax
560
        ret
433
    jz  @f
561
endp
434
    stdcall mem.Free, eax
562
 
435
@@:
563
 
436
    ret
564
; in:  eax -- pointer to image
437
 
565
; out: fill pict structure
438
update_image_sizes:
566
proc calculate_picture_size
-
 
567
        mov     edx, [eax + Image.Width]
439
    pushf
568
        test    [eax + Image.Flags], Image.IsAnimated
440
    mov edx, [eax + Image.Width]
569
        jnz     .not_in_row
441
    test    [eax + Image.Flags], Image.IsAnimated
570
        push    eax
442
    jnz .not_in_row
-
 
443
    push eax
-
 
444
@@: cmp [eax + Image.Next], 0
-
 
445
    jz  @f
-
 
446
    mov eax, [eax + Image.Next]
-
 
447
    add edx, [eax + Image.Width]
-
 
448
    inc edx
-
 
449
    jmp @b
-
 
450
@@: pop eax
-
 
451
.not_in_row:
-
 
452
    mov [draw_width], edx
-
 
453
    add edx, 19
-
 
454
    cmp edx, 50 + 25*numimages
-
 
455
    jae @f
-
 
456
    mov edx, 50 + 25*numimages
571
    @@:
-
 
572
        cmp     [eax + Image.Next], 0
-
 
573
        jz      @f
Line -... Line 574...
-
 
574
        mov     eax, [eax + Image.Next]
457
@@:
575
        add     edx, [eax + Image.Width]
458
;    dec edx
576
        inc     edx
459
    mov [wnd_width], edx
577
        jmp     @b
460
    mov esi, [eax + Image.Height]
578
    @@:
461
    test    [eax + Image.Flags], Image.IsAnimated
579
        pop     eax
462
    jnz .max_equals_first
-
 
463
    push eax
580
  .not_in_row:
464
@@: cmp [eax + Image.Next], 0
581
        mov     [pict.width], edx
465
    jz  @f
582
        add     edx, 19
Line 466... Line 583...
466
    mov eax, [eax + Image.Next]
583
        cmp     edx, 50 + 25*numimages
Line 502... Line 619...
502
    pop ecx
619
        pop     ecx
503
    mcall   SF_BACKGROUND_SET, SSF_UNMAP_BG
620
        mcall   SF_BACKGROUND_SET, SSF_UNMAP_BG
Line 504... Line 621...
504
 
621
 
505
@@:
622
    @@:
506
    mcall   SF_BACKGROUND_SET, SSF_REDRAW_BG
-
 
507
 
623
        mcall   SF_BACKGROUND_SET, SSF_REDRAW_BG
508
	;save to file eskin.ini
624
        ; save to file eskin.ini
509
	xor al,al
625
        xor     al, al
510
	mov ecx,1024
626
        mov     ecx, 1024
511
	mov edi,sys_path+2
627
        mov     edi, sys_path+2
512
	repne scasb
628
        repne scasb
513
	sub edi,sys_path+3
629
        sub     edi, sys_path+3
514
	invoke  ini_set_str, inifileeskin, amain, aprogram, sys_path+2, edi
630
        invoke  ini_set_str, inifileeskin, amain, aprogram, sys_path+2, edi
515
	;add param '\S__'
631
        ; add param '\S__'
516
    cmp word[@PARAMS],'\T'
632
        cmp     word[__params], '\T'
517
    je @f
633
        jz      @f
518
	cmp word[@PARAMS],'\S'
634
        cmp     word[__params], '\S'
519
	je @f
635
        je      @f
520
	mov esi, @PARAMS+4096-8
636
        mov     esi, __params+4096-8
521
    mov edi, @PARAMS+4096-4
637
        mov     edi, __params+4096-4
522
    mov ecx, 4096/4-1
638
        mov     ecx, 4096/4-1
523
	std
639
        std
524
    rep movsd
640
        rep movsd
525
	cld
641
        cld
526
	mov dword[@PARAMS],'\S__'
642
        mov     dword[__params], '\S__'
527
	@@:
-
 
528
	;
643
    @@:
529
	xor al,al
644
        xor     al, al
530
	mov ecx,4096
645
        mov     ecx, 4096
531
	mov edi,@PARAMS
646
        mov     edi, __params
532
	repne scasb
647
        repne scasb
533
	sub edi,@PARAMS+1
648
        sub     edi, __params+1
534
	invoke  ini_set_str, inifileeskin, amain, aparam, @PARAMS, edi
649
        invoke  ini_set_str, inifileeskin, amain, aparam, __params, edi
-
 
650
        ret
Line 535... Line 651...
535
    ret
651
endp
-
 
652
 
536
 
653
proc slide_show
-
 
654
        push    ebx esi edi
537
slide_show:
655
        mov     [bToggleSlideShow], 1
-
 
656
        btc     [window_style], 25
-
 
657
        xor     [bSlideShow], 1
-
 
658
        jnz     .to_fullscreen
538
    or  byte [bSlideShow], 2
659
        ; back from fullscreen
-
 
660
        movzx   eax, [bShowToolbarSave]
-
 
661
        mov     [bShowToolbar], al
-
 
662
        mov     [canvas_padding], CANVAS_PADDING
539
    xor byte [bSlideShow], 1
663
        mov     [bg_color], 0x00ffffff
-
 
664
        mcall   SF_CHANGE_WINDOW, [window_save.left], [window_save.top], [window_save.width], [window_save.height]
-
 
665
        jmp     .done
540
    btc dword [wnd_style], 25
666
  .to_fullscreen:
541
    jc  @f
667
        stdcall copy_box, window, window_save
-
 
668
        movzx   eax, [bShowToolbar]
542
    mov eax, [toolbar_height_old]
669
        mov     [bShowToolbarSave], al
-
 
670
        mov     [bShowToolbar], 0
543
    mov [toolbar_height], eax
671
        mov     [canvas_padding], 0
544
    mov [image_padding], 5
-
 
545
    jmp .toolbar_height_done
672
;        mov     eax, [procinfo.box.width]
546
@@:
673
;        mov     [window.width], eax
-
 
674
;        mov     eax, [procinfo.box.height]
547
    mov eax, [toolbar_height]
675
;        mov     [window.height], eax
-
 
676
;        mov     eax, [procinfo.box.left]
548
    mov [toolbar_height_old], eax
677
;        mov     [window.left], eax
-
 
678
;        mov     eax, [procinfo.box.top]
-
 
679
;        mov     [window.top], eax
-
 
680
        mov     [bg_color], 0x00000000
549
    mov [toolbar_height], 0
681
        mcall   SF_GET_SCREEN_SIZE
-
 
682
        mov     edx, eax
-
 
683
        shr     edx, 16
-
 
684
        movzx   eax, ax
-
 
685
        mov     esi, eax
-
 
686
        mcall   SF_CHANGE_WINDOW, 0, 0, ,
-
 
687
        stdcall set_scale_mode, LIBIMG_SCALE_FIT_MIN
-
 
688
 
550
    mov [image_padding], 0
689
  .done:
-
 
690
        pop     edi esi ebx
-
 
691
        ret
Line 551... Line 692...
551
.toolbar_height_done:
692
endp
552
    ret
693
 
553
 
694
 
-
 
695
; seek to ESI image files
-
 
696
; esi>0 means next file, esi<0 - prev file
-
 
697
proc next_or_prev_image
-
 
698
locals
-
 
699
        files_cnt       dd ?
554
; seek to ESI image files
700
        file_idx        dd ?
555
; esi>0 means next file, esi<0 - prev file
701
endl
556
next_or_prev_image:
702
        push    ebx esi edi
557
    push    esi
703
        push    esi
558
    call    load_directory
704
        call    load_directory
-
 
705
        pop     esi
-
 
706
        mov     eax, [directory_ptr]
559
    pop esi
707
        mov     eax, [eax+4]
560
    mov ebx, [directory_ptr]
708
        mov     [files_cnt], eax
561
    test    ebx, ebx
709
        cmp     [directory_ptr], 0
562
    jz  .ret
710
        jz      .ret
563
    cmp dword[ebx+4], 0
711
        cmp     [files_cnt], 0 ; number of files
564
    jz  .ret
712
        jz      .ret
565
    mov eax, [cur_file_idx]
713
        mov     eax, [cur_file_idx]
566
    cmp eax, -1
714
        cmp     eax, -1
567
    jnz @f
715
        jnz     @f
568
    test    esi, esi
716
        test    esi, esi
569
    jns @f
-
 
570
    mov eax, [ebx+4]
717
        jns     @f
571
@@:
718
        mov     eax, [files_cnt]
572
    push    [image]
719
    @@:
573
    add eax, esi
720
        add     eax, esi
574
@@:
721
    @@:
575
    test    eax, eax
722
        test    eax, eax
576
    jns @f
723
        jns     @f
577
    add eax, [ebx+4]
724
        add     eax, [files_cnt]
578
    jmp @b
725
        jmp     @b
579
@@:
726
    @@:
580
    cmp eax, [ebx+4]
727
        cmp     eax, [files_cnt]
581
    jb  @f
728
        jb      @f
582
    sub eax, [ebx+4]
729
        sub     eax, [files_cnt]
583
    jmp @b
730
        jmp     @b
584
@@:
731
    @@:
585
    push    eax
732
        mov     [file_idx], eax
586
.scanloop:
733
  .scanloop:
587
    push    eax ebx esi
734
        push    eax esi
588
    imul    esi, eax, 304
735
        imul    esi, eax, 304
589
    add esi, [directory_ptr]
736
        add     esi, [directory_ptr]
Line 597... Line 744...
597
@@:
744
    @@:
598
    lodsb
745
        lodsb
599
    stosb
746
        stosb
600
    test    al, al
747
        test    al, al
601
    jnz @b
748
        jnz     @b
602
    mov eax, curdir
-
 
603
    call    load_image
-
 
604
    pushf
-
 
605
    mov esi, curdir
749
        mov     esi, curdir
606
    push    esi
750
        push    esi
607
    mov edi, @PARAMS
751
        mov     edi, __params
608
    mov ecx, 4096/4
752
        mov     ecx, 4096/4
609
    rep movsd
753
        rep movsd
610
    mov byte [edi-1], 0
754
        mov     byte[edi-1], 0
611
    pop esi
755
        pop     esi
-
 
756
        stdcall load_image, curdir
-
 
757
        pushfd
612
@@:
758
    @@:
613
    lodsb
759
        lodsb
614
    test    al, al
760
        test    al, al
615
    jnz @b
761
        jnz     @b
616
@@:
762
    @@:
617
    dec esi
763
        dec     esi
618
    cmp byte [esi], '/'
764
        cmp     byte[esi], '/'
619
    jnz @b
765
        jnz     @b
620
    mov byte [esi], 0
766
        mov     byte[esi], 0
621
    popf
767
        popfd
622
    pop esi ebx eax
768
        pop     esi eax
623
    jnc .loadedok
769
        jnc     .loadedok
624
    test    esi, esi
770
        test    esi, esi
625
    js  .try_prev
771
        js      .try_prev
626
.try_next:
772
  .try_next:
627
    inc eax
773
        inc     eax
628
    cmp eax, [ebx+4]
774
        cmp     eax, [files_cnt]
629
    jb  @f
775
        jb      @f
630
    xor eax, eax
776
        xor     eax, eax
631
@@:
777
    @@:
632
.try_common:
778
  .try_common:
633
    cmp eax, [esp]
779
        cmp     eax, [file_idx]
634
    jz  .notfound
780
        jz      .notfound
635
    jmp .scanloop
781
        jmp     .scanloop
636
.try_prev:
782
  .try_prev:
637
    dec eax
783
        dec     eax
638
    jns @f
784
        jns     @f
639
    mov eax, [ebx+4]
785
        mov     eax, [files_cnt]
640
    dec eax
786
        dec     eax
641
@@:
787
    @@:
642
    jmp .try_common
788
        jmp     .try_common
643
.loadedok:
789
  .loadedok:
644
    mov [cur_file_idx], eax
790
        mov     [cur_file_idx], eax
645
    pop eax
-
 
646
    invoke  img.destroy
-
 
647
    call    generate_header
-
 
648
.ret:
791
  .ret:
-
 
792
        pop     edi esi ebx
649
    ret
793
        ret
650
.notfound:
794
  .notfound:
651
    pop eax
-
 
652
    pop [image]
-
 
653
    call    init_frame
795
        pop     edi esi ebx
654
    ret
796
        ret
-
 
797
endp
-
 
798
 
Line 655... Line 799...
655
 
799
 
656
load_directory:
800
load_directory:
657
    cmp [directory_ptr], 0
801
        cmp     [directory_ptr], 0
658
    jnz .ret
802
        jnz     .ret
659
    mov esi, @PARAMS
803
        mov     esi, __params
660
    mov edi, curdir
804
        mov     edi, curdir
661
    mov ecx, [last_name_component]
805
        mov     ecx, [last_name_component]
662
    sub ecx, esi
806
        sub     ecx, esi
663
    dec ecx
807
        dec     ecx
664
    js  @f
808
        js      @f
665
    rep movsb
809
        rep     movsb
666
@@:
810
    @@:
667
    mov byte [edi], 0
811
        mov     byte[edi], 0
668
    mcall   SF_SYS_MISC, SSF_MEM_ALLOC, 0x1000
812
        mcall   68, 12, 0x1000
669
    test    eax, eax
813
        test    eax, eax
670
    jz  .ret
814
        jz      .ret
671
    mov ebx, readdir_fileinfo
815
        mov     ebx, readdir_fileinfo
672
    mov dword [ebx+12], (0x1000 - 32) / 304
816
        mov     dword[ebx+12], (0x1000 - 32) / 304      ; blocks to read
673
    mov dword [ebx+16], eax
817
        mov     dword[ebx+16], eax      ; where to store
674
    mcall   SF_FILE
818
        mcall   70
675
    cmp eax, 6
819
        cmp     eax, 6  ; read ok, but there are more files
676
    jz  .dirok
820
        jz      .dirok
677
    test    eax, eax
821
        test    eax, eax
678
    jnz free_directory
822
        jnz     free_directory
679
    mov edx, [directory_ptr]
823
        mov     edx, [directory_ptr]
680
    mov ecx, [edx+8]
824
        mov     ecx, [edx+8]            ; total number of files
681
    mov [readblocks], ecx
825
        mov     [readblocks], ecx
682
    imul    ecx, 304
826
        imul    ecx, 304        ; try to read entire dir, FIXME
683
    add ecx, 32
827
        add     ecx, 32         ; plus header
684
    mcall   SF_SYS_MISC, SSF_MEM_REALLOC
828
        mcall   68, 20          ; realloc
685
    test    eax, eax
829
        test    eax, eax
686
    jz  free_directory
830
        jz      free_directory
687
    mov [directory_ptr], eax
831
        mov     [directory_ptr], eax
688
    mcall   SF_FILE, readdir_fileinfo
832
        mcall   70, readdir_fileinfo
689
.dirok:
833
  .dirok:
690
    cmp ebx, 0
834
        cmp     ebx, 0
691
    jle free_directory
835
        jle     free_directory
-
 
836
        mov     eax, [directory_ptr]
-
 
837
        mov     edi, [eax + 8]  ; total number of files
692
    mov eax, [directory_ptr]
838
        mov     [files_num], edi
693
    add eax, 32
839
        add     eax, 32         ; skip header
694
    mov edi, eax
840
        mov     edi, eax
695
    push    0
841
        push    0
696
.dirskip:
842
  .dirskip:
697
    push    eax
843
        push    eax
698
    test    byte [eax], 18h
844
        test    byte[eax], 0x18 ; volume label or folder
699
    jnz .nocopy
845
        jnz     .nocopy
700
    lea esi, [eax+40]
846
        lea     esi, [eax+40]   ; name
701
    mov ecx, esi
847
        mov     ecx, esi
702
@@:
848
    @@:
703
    lodsb
849
        lodsb
704
    test    al, al
850
        test    al, al
Line 710... Line 856...
710
    cmp byte [esi], '.'
856
        cmp     byte[esi], '.'
711
    jnz @b
857
        jnz     @b
712
    inc esi
858
        inc     esi
713
    mov ecx, [esi]
859
        mov     ecx, [esi]
714
    cmp byte[esi+3], 0
860
        cmp     byte[esi+3], 0
715
    jne .not_3
861
        jnz     .not_3
716
    or  ecx, 0x202020
862
        or      ecx, 0x202020
717
    cmp ecx, 'jpg'
863
        cmp     ecx, 'jpg'
718
    jz  .copy
864
        jz      .copy
719
    cmp ecx, 'bmp'
865
        cmp     ecx, 'bmp'
720
    jz  .copy
866
        jz      .copy
Line 738... Line 884...
738
    jz  .copy
884
        jz      .copy
739
    cmp ecx, 'pgm'
885
        cmp     ecx, 'pgm'
740
    jz  .copy
886
        jz      .copy
741
    cmp ecx, 'pnm'
887
        cmp     ecx, 'pnm'
742
    jz  .copy
888
        jz      .copy
-
 
889
        cmp     ecx, 'ppm'
-
 
890
        jz      .copy
743
    cmp ecx, 'tif'
891
        cmp     ecx, 'tif'
744
    jz  .copy
892
        jz      .copy
-
 
893
        cmp     ecx, 'xbm'
-
 
894
        jz      .copy
745
  .not_3:
895
  .not_3:
746
    cmp byte[esi+4], 0
896
        cmp     byte[esi+4], 0
747
    jne .nocopy
897
        jnz     .nocopy
748
    or  ecx, 0x20202020
898
        or      ecx, 0x20202020
749
    cmp ecx, 'tiff'
899
        cmp     ecx, 'tiff'
750
    jz  @f
900
        jz      @f
751
    cmp ecx, 'wbmp'
901
        cmp     ecx, 'wbmp'
752
    jz  @f
902
        jz      @f
-
 
903
        cmp     ecx, 'webp'
-
 
904
        jz      @f
753
    cmp ecx, 'jpeg'
905
        cmp     ecx, 'jpeg'
754
    jnz .nocopy
906
        jnz     .nocopy
755
@@:
907
    @@:
756
    cmp byte [esi+4], 0
908
        cmp     byte[esi+4], 0
757
    jnz .nocopy
909
        jnz     .nocopy
Line 776... Line 928...
776
    add eax, 32
928
        add     eax, 32
777
    push    eax
929
        push    eax
778
    call    [SortDir]
930
        call    [SortDir]
779
    xor eax, eax
931
        xor     eax, eax
780
    mov edi, [directory_ptr]
932
        mov     edi, [directory_ptr]
781
    add edi, 32 + 40
933
        add     edi, 32 + 40    ; name
782
.scan:
934
  .scan:
783
    mov esi, [last_name_component]
935
        mov     esi, [last_name_component]
784
    push    edi
936
        push    edi
785
    invoke  strcmpi
937
        invoke  strcmpi
786
    pop edi
938
        pop     edi
Line 794... Line 946...
794
    mov [cur_file_idx], eax
946
        mov     [cur_file_idx], eax
795
.ret:
947
  .ret:
796
    ret
948
        ret
Line 797... Line 949...
797
 
949
 
798
free_directory:
950
free_directory:
799
    mcall   SF_SYS_MISC, SSF_MEM_FREE, [directory_ptr]
951
        mcall   68, 13, [directory_ptr]
800
    and [directory_ptr], 0
952
        and     [directory_ptr], 0
Line -... Line 953...
-
 
953
        ret
801
    ret
954
 
802
 
955
 
803
; in: esi->full name (e.g. /path/to/file.png)
956
; in: esi->full name (e.g. /path/to/file.png)
804
; out: [last_name_component]->last component (e.g. file.png)
957
; out: [last_name_component]->last component (e.g. file.png)
805
find_last_name_component:
958
proc find_last_name_component
806
    mov ecx, esi
959
        mov     ecx, esi
807
@@:
960
    @@:
808
    lodsb
961
        lodsb
Line 816... Line 969...
816
    jnz @b
969
        jnz     @b
817
@@:
970
    @@:
818
    inc esi
971
        inc     esi
819
    mov [last_name_component], esi
972
        mov     [last_name_component], esi
820
    ret
973
        ret
-
 
974
endp
Line -... Line 975...
-
 
975
 
821
 
976
 
822
init_frame:
977
proc init_frame _img
-
 
978
        push    ebx edx
-
 
979
        mov     eax, [orig_image]
-
 
980
        cmp     eax, [_img]
-
 
981
        jz      .exit
-
 
982
        test    eax, eax
-
 
983
        jz      .freed
-
 
984
        cmp     eax, [cur_image]
-
 
985
        jz      @f
-
 
986
        invoke  img.destroy, [orig_image]
-
 
987
    @@:
-
 
988
        invoke  img.destroy, [cur_image]
-
 
989
  .freed:
-
 
990
 
823
    push    eax
991
        mov     [bNewImage], 1
-
 
992
        mov     eax, [_img]
-
 
993
        mov     [orig_image], eax
824
    mov eax, [image]
994
        mov     [cur_image], eax
825
    mov [cur_frame], eax
995
        mov     [cur_frame], eax
826
    test    byte [eax + Image.Flags], Image.IsAnimated
996
        test    byte[eax + Image.Flags], Image.IsAnimated
827
    jz  @f
997
        jz      @f
828
    push    ebx
998
        push    ebx
829
    mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
999
        mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
830
    pop ebx
1000
        pop     ebx
831
    mov [cur_frame_time], eax
1001
        mov     [cur_frame_time], eax
-
 
1002
    @@:
-
 
1003
        mov     [pict.top], 0
-
 
1004
        mov     [pict.left], 0
832
@@:
1005
  .exit:
833
    pop eax
1006
        pop     edx ebx
-
 
1007
        ret
Line 834... Line -...
834
    ret
-
 
835
 
-
 
836
draw_window:
-
 
837
    btr  word [bSlideShow], 1  ; mode changed
-
 
838
    jc .mode_changed
-
 
839
    test byte [bTglbar], 1
-
 
840
    jz .mode_not_changed
-
 
841
.mode_changed:
-
 
842
    test [wnd_style], 1 SHL 25
-
 
843
    jz .mode_slide
-
 
844
    mov [bg_color], 0x00ffffff
-
 
845
    mov eax, [image]
-
 
846
    cmp eax, eax
-
 
847
    call update_image_sizes
-
 
848
    mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
-
 
849
    mov esi, [wnd_height]
-
 
850
    add esi, eax
-
 
851
    test byte [bTglbar], 1
-
 
852
    jz @f
-
 
853
    mcall SF_CHANGE_WINDOW, -1, -1, [wnd_width], 
-
 
854
    jmp .mode_not_changed
-
 
855
@@:
-
 
856
    mcall SF_CHANGE_WINDOW, [wnd_x], [wnd_y], [wnd_width], 
-
 
857
    jmp .mode_not_changed
-
 
858
.mode_slide:
-
 
859
    mov [bg_color], 0x00000000
-
 
860
    mov eax, [procinfo.box.left]
-
 
861
    mov [wnd_x], eax
-
 
862
    mov eax, [procinfo.box.top]
-
 
863
    mov [wnd_y], eax
-
 
864
    mcall SF_GET_SCREEN_SIZE
-
 
865
    mov edx, eax
-
 
866
    shr edx, 16
-
 
867
    movzx eax, ax
-
 
868
    mov esi, eax
-
 
Line 869... Line 1008...
869
    mcall SF_CHANGE_WINDOW, 0, 0, ,
1008
endp
870
    jmp .posok.slide_show
1009
 
871
 
1010
 
872
.mode_not_changed:
-
 
873
    cmp [bFirstDraw], 0
-
 
874
    jz  .posok
1011
proc draw_window
875
    or  ecx, -1
1012
        test    [bFirstWinDraw], 1
876
    mcall   SF_THREAD_INFO, procinfo
1013
        jnz     .min_size_ok
877
 
-
 
878
    test byte [procinfo.wnd_state], 0x04
1014
 
879
    jnz .posok
1015
        mcall   SF_THREAD_INFO, procinfo, -1
880
 
1016
        xor     eax, eax
881
    mov edx, ecx
1017
        mov     edx, -1
882
    mov esi, ecx
1018
        mov     esi, -1
-
 
1019
        cmp     [procinfo.box.width], MIN_WINDOW_WIDTH
883
    cmp dword [procinfo.box.width], 50 + 25 * numimages
1020
        ja      @f
884
    jae @f
1021
        mov     edx, MIN_WINDOW_WIDTH
885
    mov edx, 50 + 25 * numimages
1022
        inc     eax
-
 
1023
    @@:
886
@@:
1024
        cmp     [procinfo.box.height], MIN_WINDOW_HEIGHT
887
    cmp dword [procinfo.box.height], 70
1025
        ja      @f
888
    jae @f
1026
        mov     esi, MIN_WINDOW_HEIGHT
889
    mov esi, 70
-
 
890
@@:
-
 
891
    mov eax, edx
1027
        inc     eax
892
    and eax, esi
-
 
893
    cmp eax, -1
1028
    @@:
894
    jz  @f
1029
        test    eax, eax
Line 895... Line 1030...
895
    mov ebx, ecx
1030
        jz      @f
896
    mcall   SF_CHANGE_WINDOW
1031
        mcall   SF_CHANGE_WINDOW, -1, -1, , 
897
@@:
1032
    @@:
-
 
1033
 
-
 
1034
  .min_size_ok:
898
 
1035
        test    [bNewImage], 1
899
.posok:
-
 
900
    test [wnd_style], 1 SHL 25
-
 
901
    jz .posok.slide_show
-
 
902
    mcall   SF_REDRAW, SSF_BEGIN_DRAW
-
 
903
    mcall   SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
-
 
904
    mov ebp, eax    ; save skin height
-
 
905
    add eax, [wnd_height]
1036
        jz      @f
906
    mov ebx, [wnd_x]
1037
        call    generate_window_header
907
    shl ebx, 16
-
 
908
    add ebx, [wnd_width]
-
 
909
    mov ecx, [wnd_y]
-
 
910
    shl ecx, 16
-
 
911
    add ecx, eax
1038
    @@:
912
    mcall   SF_CREATE_WINDOW, , , [wnd_style], 0, real_header
-
 
913
    jmp .posok.common
1039
        mcall   SF_REDRAW, SSF_BEGIN_DRAW
914
.posok.slide_show:
1040
        mov     ecx, [window.top]
915
    mcall   SF_REDRAW, SSF_BEGIN_DRAW
1041
        shl     ecx, 16
916
    mcall SF_GET_SCREEN_SIZE
-
 
917
    mov ebx, eax
1042
        mov     cx, word[window.height]
918
    shr ebx, 16
1043
        mov     ebx, [window.left]
919
    movzx eax, ax
1044
        shl     ebx, 16
920
    mov ecx, eax
1045
        mov     bx, word[window.width]
-
 
1046
        mcall   0, , , [window_style], 0, window_header
-
 
1047
 
-
 
1048
        mcall   SF_THREAD_INFO, procinfo, -1
-
 
1049
        test    [procinfo.wnd_state], 0x04
-
 
1050
        jnz     .nodraw
-
 
1051
 
921
    mcall   SF_CREATE_WINDOW, , , [wnd_style], 0, real_header
1052
        stdcall copy_box, window, window_prev
922
.posok.common:
1053
        stdcall copy_box, procinfo.box, window
923
    mcall   SF_THREAD_INFO, procinfo, -1
1054
        test    [bFirstWinDraw], 1
-
 
1055
        jnz     .recalc
-
 
1056
        test    [bToggleSlideShow], 1
-
 
1057
        jnz     .recalc
-
 
1058
        mov     eax, [window.width]
-
 
1059
        cmp     eax, [window_prev.width]
-
 
1060
        jnz     .recalc
-
 
1061
        mov     eax, [window.height]
-
 
1062
        cmp     eax, [window_prev.height]
-
 
1063
        jnz     .recalc
-
 
1064
        test    [bNewImage], 1
-
 
1065
        jnz     .recalc
924
    mov eax, [procinfo.client_box.width]
1066
        test    [bToggleToolbar], 1
-
 
1067
        jnz     .recalc
925
    sub eax, [image_padding]
1068
        jmp     .recalc_done
-
 
1069
 
-
 
1070
  .recalc:
-
 
1071
        stdcall recalc_window
-
 
1072
  .recalc_done:
-
 
1073
 
-
 
1074
        stdcall draw_client
-
 
1075
  .nodraw:
-
 
1076
        mcall   SF_REDRAW, SSF_END_DRAW
-
 
1077
        mov     [bFirstWinDraw], 0
926
    sub eax, [image_padding]
1078
        mov     [bNewImage], 0
-
 
1079
        mov     [bToggleToolbar], 0
-
 
1080
        mov     [bToggleSlideShow], 0
-
 
1081
 
-
 
1082
        ret
-
 
1083
endp
-
 
1084
 
-
 
1085
 
-
 
1086
proc draw_view
-
 
1087
        push    ebx esi edi
-
 
1088
        cmp     [scale_mode], LIBIMG_SCALE_FIT_MIN
-
 
1089
        jnz     .scale_none
-
 
1090
        mov     ecx, [cur_frame]
-
 
1091
        mov     eax, [ecx + Image.Width]
-
 
1092
        cmp     eax, [view.width]
-
 
1093
        jnz     .scale
-
 
1094
        mov     eax, [ecx + Image.Height]
-
 
1095
        cmp     eax, [view.height]
-
 
1096
        jnz     .scale
927
    sub eax, [draw_width]
1097
        jmp     .draw
-
 
1098
  .scale:
-
 
1099
        mov     eax, [orig_image]
928
    sar eax, 1
1100
        cmp     eax, [cur_image]
929
    test eax, eax
-
 
930
    jns @f
-
 
931
    mov eax, 0
1101
        jz      @f
932
@@:
-
 
933
    add eax, [image_padding]
-
 
934
    mov [draw_x], eax
-
 
935
    mov eax, [procinfo.client_box.height]
-
 
936
    sub eax, [toolbar_height]
-
 
937
    sub eax, [image_padding]
1102
        invoke  img.destroy, [cur_image]
-
 
1103
        mov     eax, [orig_image]
-
 
1104
    @@:
-
 
1105
        invoke  img.scale, eax, 0, 0, [eax + Image.Width], [eax + Image.Height], 0, LIBIMG_SCALE_STRETCH, LIBIMG_INTER_DEFAULT, [view.width], [view.height]
938
    sub eax, [image_padding]
1106
        test    eax, eax
-
 
1107
;FIXME
939
    sub eax, [draw_height]
1108
        mov     [cur_image], eax
940
    sar eax, 1
1109
        mov     [cur_frame], eax        ; FIXME index
-
 
1110
        jmp     .draw
-
 
1111
 
-
 
1112
  .scale_none:
941
    test eax, eax
1113
 
942
    jns @f
1114
  .draw:
-
 
1115
        push    [pict.top]
-
 
1116
        push    [pict.left]
-
 
1117
        push    [view.height]
-
 
1118
        push    [view.width]
-
 
1119
        push    [view_abs_top]  ; ypos
-
 
1120
        push    [view_abs_left] ; xpos
-
 
1121
        invoke  img.draw, [cur_frame]
-
 
1122
  .done:
-
 
1123
        pop     edi esi ebx
943
    mov eax, 0
1124
        ret
944
@@:
1125
endp
-
 
1126
 
945
    add eax, [toolbar_height]
1127
 
946
    add eax, [image_padding]
1128
proc draw_toolbar
-
 
1129
        push    ebx esi edi
-
 
1130
 
947
    mov [draw_y], eax
1131
        cmp     [toolbar.height], 0
948
    mov [bFirstDraw], 1
1132
        jz      .quit
949
    cmp dword [procinfo.client_box.height], 0
1133
        mov     ebx, [toolbar_abs_left]
950
    jle .nodraw
1134
        shl     ebx, 16
951
    mov ebx, [procinfo.client_box.width]
1135
        add     ebx, [toolbar.width]
952
    inc ebx
1136
        inc     ebx
953
    mov ecx, [draw_y]
1137
        mov     ecx, [toolbar_abs_top]
954
    mcall   SF_DRAW_RECT, , , [bg_color]
1138
        shl     ecx, 16
955
    mov ecx, [procinfo.client_box.height]
1139
        add     ecx, [toolbar.height]
956
    inc ecx
1140
        mcall   13, , , [bg_color]
957
    mov esi, [cur_frame]
-
 
958
    mov esi, [esi + Image.Height]
1141
        mov     ebx, [toolbar_abs_left]
959
    add esi, [draw_y]
1142
        shl     ebx, 16
960
    sub ecx, esi
1143
        add     ebx, [toolbar_abs_left]
961
    jbe @f
-
 
962
    push    esi
-
 
963
    shl esi, 16
1144
        add     ebx, [toolbar.width]
964
    add ecx, esi
-
 
965
    pop esi
1145
        mov     ecx, [toolbar_abs_top]
966
    mcall
1146
        shl     ecx, 16
967
    xor ecx, ecx
-
 
968
@@:
1147
        add     ecx, [toolbar_abs_top]
-
 
1148
        add     ecx, (30 SHL 16) + 30
-
 
1149
        mcall   38, , , 0x007F7F7F
-
 
1150
        mov     ebx, [toolbar_abs_left]
969
    add ecx, esi
1151
        shl     ebx, 16
970
    mov ebx, [draw_y]
1152
        add     ebx, [toolbar_abs_left]
-
 
1153
        add     ebx, ((5 + 25 * 1) SHL 16) + (5 + 25 * 1)
971
    sub ecx, ebx
1154
        mov     ecx, [toolbar_abs_top]
972
    shl ebx, 16
-
 
973
    add ecx, ebx
-
 
974
    mov ebx, [draw_x]
-
 
975
    mcall
1155
        shl     ecx, 16
976
    mov esi, [cur_frame]
-
 
977
    mov esi, [esi + Image.Width]
-
 
978
    add esi, ebx
-
 
979
    mov ebx, [procinfo.client_box.width]
-
 
980
    inc ebx
-
 
981
    sub ebx, esi
1156
        add     ecx, [toolbar_abs_top]
982
    jbe @f
-
 
983
    shl esi, 16
-
 
984
    add ebx, esi
1157
        add     ecx, [toolbar.height]
985
    mcall
1158
        mcall
986
@@:
1159
        add     ebx, ((5 + 25 * 2) SHL 16) + (5 + 25 * 2)
987
 
1160
        mcall
988
    test [wnd_style], 1 SHL 25
1161
        add     ebx, ((5 + 25 * 2) SHL 16) + (5 + 25 * 2)
989
    jz .slide_show_mode
-
 
990
    mov byte [bTglbar], 0
1162
        mcall
991
    cmp byte [toolbar_height], 0
-
 
992
    je .decorations_done
-
 
993
    mov ebx, [procinfo.client_box.width]
1163
        mov     ebx, [toolbar_abs_left]
994
    push    ebx
1164
        add     ebx, [toolbar.width]
995
    mcall   SF_DRAW_LINE, , <30, 30>, 0x007F7F7F
-
 
996
    mcall   , <5 + 25 * 1, 5 + 25 * 1>, <0, 30>
1165
        sub     ebx, 25 * 5 + 10 
997
    mcall   , <10 + 25 * 3, 10 + 25 * 3>
-
 
998
    mcall   , <15 + 25 * 5, 15 + 25 * 5>
-
 
999
    pop ebx
1166
        shl     ebx, 16
Line -... Line 1167...
-
 
1167
        add     ebx, [toolbar_abs_left]
-
 
1168
        add     ebx, [toolbar.width]
-
 
1169
        sub     ebx, 25 * 5 + 10 
-
 
1170
        mcall
-
 
1171
 
-
 
1172
        mov     ebx, [toolbar_abs_left]
1000
    sub ebx, 25 * 5 + 10 
1173
        shl     ebx, 16
-
 
1174
        add     ebx, ((4 + 25 * 0) SHL 16) + 21
1001
    push    ebx
1175
        mov     ecx, [toolbar_abs_top]
-
 
1176
        shl     ecx, 16
1002
    imul    ebx, 10001h
1177
        add     ecx, (4 SHL 16) + 21
-
 
1178
        mcall   SF_DEFINE_BUTTON, , , 'opn'+40000000h
1003
    mcall
1179
        add     ebx, (5 + 25 * 1) SHL 16
-
 
1180
        mcall    , , , 'bck'+40000000h
1004
 
1181
        add     ebx, (0 + 25 * 1) SHL 16
-
 
1182
        mcall    , , , 'fwd'+40000000h
-
 
1183
        add     ebx, (5 + 25 * 1) SHL 16
1005
    mcall   SF_DEFINE_BUTTON, <4 + 25 * 0, 21>, <4, 21>, 'opn'+40000000h
1184
        mcall    , , , 'bgr'+40000000h
1006
    mcall   , <9 + 25 * 1, 21>, , 'bck'+40000000h
1185
        add     ebx, (0 + 25 * 1) SHL 16
1007
    mcall   , <9 + 25 * 2, 21>, , 'fwd'+40000000h
1186
        mcall    , , , 'sld'+40000000h
1008
    mcall   , <14 + 25 * 3, 21>, , 'bgr'+40000000h
1187
        mov     ebx, [toolbar_abs_left]
1009
    mcall   , <14 + 25 * 4, 21>, , 'sld'+40000000h
1188
        add     ebx, [toolbar.width]
1010
    pop ebx
1189
        sub     ebx, 25 * 5 + 10 
1011
    add ebx, 5
1190
        add     ebx, 5
1012
    shl ebx, 16
1191
        shl     ebx, 16
1013
    mov bl, 21
1192
        mov     bl, 21
1014
    mcall   , , , 'flh'+40000000h
1193
        mcall   , , , 'flh'+40000000h
1015
    add ebx, 25 * 65536
1194
        add     ebx, 25 SHL 16
1016
    mcall   , , , 'flv'+40000000h
1195
        mcall   , , , 'flv'+40000000h
1017
    add ebx, 30 * 65536
1196
        add     ebx, 30 SHL 16
Line 1018... Line 1197...
1018
    mcall   , , , 'rtr'+40000000h
1197
        mcall   , , , 'rtr'+40000000h
Line -... Line 1198...
-
 
1198
        add     ebx, 25 SHL 16
-
 
1199
        mcall   , , , 'rtl'+40000000h
-
 
1200
        add     ebx, 25 SHL 16
-
 
1201
        mcall   , , , 'flb'+40000000h
1019
    add ebx, 25 * 65536
1202
 
-
 
1203
        mov     ebp, (numimages-1)*20
1020
    mcall   , , , 'rtl'+40000000h
1204
 
-
 
1205
        mov     edx, [toolbar_abs_left]
1021
    add ebx, 25 * 65536
1206
        shl     edx, 16
-
 
1207
        add     edx, [toolbar_abs_top]
1022
    mcall   , , , 'flb'+40000000h
1208
        add     edx, ((5 + 25 * 0) SHL 16) + 5
-
 
1209
        mcall   65, buttons + openbtn    * 20, <20, 20>, , 8, palette
1023
 
1210
        add     edx, ((5 + 25 * 1) SHL 16) + 0
-
 
1211
        mcall     , buttons + backbtn    * 20
1024
    mov ebp, (numimages-1)*20
1212
        add     edx, ((0 + 25 * 1) SHL 16) + 0
1025
 
1213
        mcall     , buttons + forwardbtn * 20
1026
    mcall   SF_PUT_IMAGE_EXT, buttons+openbtn*20, <20, 20>, <5 + 25 * 0, 5>, 8, palette
1214
        add     edx, ((5 + 25 * 1) SHL 16) + 0
-
 
1215
        mcall     , buttons + bgrbtn     * 20
1027
    mcall   , buttons+backbtn*20,    , <10 + 25 * 1, 5>
1216
        add     edx, ((0 + 25 * 1) SHL 16) + 0
1028
    mcall   , buttons+forwardbtn*20, , <10 + 25 * 2, 5>
1217
        mcall     , buttons + slidebtn   * 20
1029
    mcall   , buttons+bgrbtn*20,     , <15 + 25 * 3, 5>
1218
        mov     edx, [client_abs_left]
1030
    mcall   , buttons+slidebtn*20,   , <15 + 25 * 4, 5>
1219
        add     edx, [client.width]
1031
    mov edx, [procinfo.client_box.width]
1220
        sub     edx, 25 * 5 + 4
1032
    sub edx, 25 * 5 + 4
1221
        shl     edx, 16
1033
    shl edx, 16
1222
        add     edx, [client_abs_top]
1034
    mov dl, 5
1223
        add     edx, 5
1035
    mcall   , buttons+fliphorzbtn*20
1224
        mcall   , buttons+fliphorzbtn*20
1036
    add edx, 25 * 65536
1225
        add     edx, 25 * 65536
1037
    mcall   , buttons+flipvertbtn*20
-
 
Line -... Line 1226...
-
 
1226
        mcall   , buttons+flipvertbtn*20
-
 
1227
        add     edx, 30 * 65536
1038
    add edx, 30 * 65536
1228
        mcall   , buttons+rotcwbtn*20
-
 
1229
        add     edx, 25 * 65536
Line 1039... Line -...
1039
    mcall   , buttons+rotcwbtn*20
-
 
1040
    add edx, 25 * 65536
-
 
Line 1041... Line 1230...
1041
    mcall   , buttons+rotccwbtn*20
1230
        mcall   , buttons+rotccwbtn*20
1042
    add edx, 25 * 65536
1231
        add     edx, 25 * 65536
Line -... Line 1232...
-
 
1232
        mcall   , buttons+rot180btn*20
-
 
1233
 
-
 
1234
  .quit:
-
 
1235
        pop     edi esi ebx
-
 
1236
        ret
-
 
1237
endp
-
 
1238
 
-
 
1239
 
-
 
1240
proc draw_canvas
-
 
1241
        push    ebx esi edi
-
 
1242
 
-
 
1243
        mov     ebx, [canvas_abs_left]
-
 
1244
        shl     ebx, 16
-
 
1245
        add     ebx, [canvas.width]
-
 
1246
        mov     ecx, [canvas_abs_top]
-
 
1247
        shl     ecx, 16
-
 
1248
        add     ecx, [view.top]
-
 
1249
;mov edx, 0xff0000
-
 
1250
        mcall   13, , , [bg_color]
-
 
1251
        mcall   13
-
 
1252
        mov     ecx, [view_abs_top]
-
 
1253
        add     ecx, [view.height]
-
 
1254
        shl     ecx, 16
-
 
1255
        add     ecx, [canvas.height]
-
 
1256
        sub     ecx, [view.top]
-
 
1257
        sub     ecx, [view.height]
-
 
1258
;mov edx, 0x00ff00
-
 
1259
        mcall   13, , , [bg_color]
-
 
1260
        mcall   13
-
 
1261
        mov     ebx, [canvas_abs_left]
-
 
1262
        shl     ebx, 16
-
 
1263
        add     ebx, [view.left]
-
 
1264
        mov     ecx, [canvas_abs_top]
-
 
1265
        shl     ecx, 16
-
 
1266
        add     ecx, [canvas.height]
-
 
1267
;mov edx, 0x0000ff
-
 
1268
;bg_color
-
 
1269
        mcall
-
 
1270
        mov     ebx, [view_abs_left]
-
 
1271
        add     ebx, [view.width]
-
 
1272
        shl     ebx, 16
-
 
1273
        mov     eax, [canvas.width]
1043
    mcall   , buttons+rot180btn*20
1274
        sub     eax, [view.left]
-
 
1275
        sub     ebx, [view.width]
Line -... Line 1276...
-
 
1276
        add     ebx, eax
1044
    jmp .decorations_done
1277
;mov edx, 0xffff00
1045
 
1278
;bg_color
1046
.slide_show_mode:
-
 
1047
 
-
 
1048
.decorations_done:
-
 
1049
    call    draw_cur_frame
-
 
1050
 
1279
        mcall   13
1051
.nodraw:
1280
    @@:
1052
    mcall   SF_REDRAW, SSF_END_DRAW
-
 
1053
 
1281
 
1054
    ret
-
 
1055
 
1282
        call    draw_view
1056
draw_cur_frame:
-
 
1057
    push    0   ; ypos
1283
 
1058
    push    0   ; xpos
-
 
1059
    mov eax, [procinfo.client_box.height]
1284
        pop     edi esi ebx
1060
    sub eax, [toolbar_height]
-
 
1061
    sub eax, [image_padding]
-
 
1062
    inc eax
1285
        ret
1063
    push    eax ; max height
1286
endp
1064
    mov eax, [procinfo.client_box.width]
-
 
1065
    sub eax, [image_padding]
-
 
1066
    inc eax
1287
 
-
 
1288
 
-
 
1289
proc draw_client
-
 
1290
        push    ebx esi edi
1067
    push    eax ; max width
1291
 
-
 
1292
        test    [bShowToolbar], 1
-
 
1293
        jz      .toolbar_done
1068
    push [draw_y]
1294
        call    draw_toolbar
-
 
1295
  .toolbar_done:
1069
    push [draw_x]
1296
        call    draw_work
1070
    push    [cur_frame]
1297
 
-
 
1298
        pop     edi esi ebx
-
 
1299
        ret
-
 
1300
endp
-
 
1301
 
-
 
1302
 
-
 
1303
proc draw_work
-
 
1304
        push    ebx esi edi
1071
    call    [img.draw]
1305
 
-
 
1306
        mov     ebx, [work_abs_left]
1072
    mov eax, [image]
1307
        shl     ebx, 16
-
 
1308
        add     ebx, [work.width]
-
 
1309
        inc     ebx
1073
    test    [eax + Image.Flags], Image.IsAnimated
1310
        mov     ecx, [work_abs_top]
-
 
1311
        shl     ecx, 16
1074
    jnz .done
1312
        add     ecx, [canvas.top]
1075
    cmp [eax + Image.Next], 0
1313
;        mcall   13, , , 0xff0000
-
 
1314
        mcall   13, , , [bg_color]
-
 
1315
        mov     eax, [canvas.height]
-
 
1316
        ror     ecx, 16
1076
    jnz .additional_frames
1317
        add     ecx, eax
-
 
1318
        add     ecx, [canvas_padding]
-
 
1319
        ror     ecx, 16
-
 
1320
;        mcall   13, , , 0x00ff00
1077
.done:
1321
        mcall   13, , , [bg_color]
1078
    ret
1322
;        mcall   13
-
 
1323
 
-
 
1324
        mov     ebx, [work_abs_left]
-
 
1325
        shl     ebx, 16
-
 
1326
        add     ebx, [canvas.left]
-
 
1327
        mov     ecx, [work_abs_top]
1079
.additional_frames:
1328
        add     ecx, [canvas_padding]
-
 
1329
        shl     ecx, 16
-
 
1330
        add     ecx, [canvas.height]
-
 
1331
;        mcall   13, , , 0x0000ff
-
 
1332
        mcall   13, , , [bg_color]
-
 
1333
;        mcall
-
 
1334
        mov     eax, [canvas.width]
-
 
1335
        ror     ebx, 16
1080
    mov ebx, [procinfo.client_box.width]
1336
        add     ebx, eax
-
 
1337
        add     ebx, [canvas_padding]
1081
    sub ebx, [image_padding]
1338
        ror     ebx, 16
-
 
1339
;        mcall   13, , , 0xffff00
-
 
1340
        mcall   13, , , [bg_color]
-
 
1341
;        mcall   13
1082
    inc ebx
1342
 
-
 
1343
        call    draw_canvas
1083
    jbe .done
1344
        call    draw_onimage_decorations
1084
    mov esi, [draw_x]
1345
 
1085
.afloop:
1346
        mov     eax, 13
1086
    sub ebx, [eax + Image.Width]
1347
        cmp     [need_scrollbar_v], 1
-
 
1348
        jnz     @f
-
 
1349
        cmp     [need_scrollbar_h], 1
1087
    jbe .done
1350
        jnz     @f
-
 
1351
        mov     ebx, [work_abs_left]
-
 
1352
        add     ebx, [work.width]
1088
    dec ebx
1353
        sub     ebx, SCROLL_WIDTH_SIZE
-
 
1354
        shl     ebx, 16
-
 
1355
        add     ebx, SCROLL_WIDTH_SIZE
-
 
1356
        inc     ebx
-
 
1357
        mov     ecx, [work_abs_top]
1089
    jz  .done
1358
        add     ecx, [work.height]
1090
    add esi, [eax + Image.Width]
1359
        sub     ecx, SCROLL_WIDTH_SIZE
-
 
1360
        shl     ecx, 16
-
 
1361
        add     ecx, SCROLL_WIDTH_SIZE
1091
    mov eax, [eax + Image.Next]
1362
        inc     ecx
1092
    push    eax
1363
        mov     edx, [bg_color]
-
 
1364
;        mov     edx, 0x00ffff
1093
    inc esi
1365
        mcall
-
 
1366
    @@:
1094
    push    0   ; ypos
1367
 
-
 
1368
        cmp     [need_scrollbar_v], 0
-
 
1369
        jz      .v_scrollbar_done
-
 
1370
        mov     eax, [client.left]
1095
    push    0   ; xpos
1371
        add     eax, [client.width]
-
 
1372
        sub     eax, SCROLL_WIDTH_SIZE
1096
    mov ecx, [procinfo.client_box.height]
1373
        mov     [scroll_bar_data_vertical.start_x], ax
-
 
1374
        mov     eax, [toolbar.height]
-
 
1375
        add     eax, [client.top]
-
 
1376
        mov     [scroll_bar_data_vertical.start_y], ax
-
 
1377
        mov     eax, [canvas.height]
-
 
1378
        add     eax, [canvas_padding]
-
 
1379
        add     eax, [canvas_padding]
-
 
1380
        mov     [scroll_bar_data_vertical.size_y], ax
-
 
1381
        mov     [scroll_bar_data_vertical.all_redraw], 1
-
 
1382
        invoke  scrollbar_vert_draw, scroll_bar_data_vertical
-
 
1383
  .v_scrollbar_done:
-
 
1384
 
-
 
1385
        cmp     [need_scrollbar_h], 0
-
 
1386
        jz      .h_scrollbar_done
1097
    sub ecx, [toolbar_height]
1387
        mov     eax, [client.left]
-
 
1388
        mov     [scroll_bar_data_horizontal.start_x], ax
-
 
1389
        mov     eax, [client.top]
1098
    sub ecx, [image_padding]
1390
        add     eax, [client.height]
-
 
1391
        sub     eax, SCROLL_WIDTH_SIZE
Line -... Line 1392...
-
 
1392
        mov     [scroll_bar_data_horizontal.start_y], ax
-
 
1393
        mov     eax, [canvas.width]
-
 
1394
        add     eax, [canvas_padding]
-
 
1395
        add     eax, [canvas_padding]
-
 
1396
        mov     [scroll_bar_data_horizontal.size_x], ax
-
 
1397
        mov     [scroll_bar_data_horizontal.all_redraw], 1
-
 
1398
        invoke  scrollbar_hort_draw, scroll_bar_data_horizontal
-
 
1399
  .h_scrollbar_done:
-
 
1400
 
-
 
1401
        pop     edi esi ebx
-
 
1402
        ret
-
 
1403
endp
-
 
1404
 
-
 
1405
 
-
 
1406
proc draw_onimage_decorations
-
 
1407
        bt      [window_style], 25
-
 
1408
        jc      @f
-
 
1409
        ; draw fullscreen decorations on image
-
 
1410
        call    draw_filename
-
 
1411
        call    draw_fullscreen_controls
-
 
1412
    @@:
-
 
1413
        ret
-
 
1414
endp
-
 
1415
 
-
 
1416
 
-
 
1417
proc draw_filename
-
 
1418
        push    esi
-
 
1419
        mcall   4, <100, 65>, 0x40ffffff, window_header, [window_header_len], 0x008800
-
 
1420
        pop     esi
-
 
1421
        ret
-
 
1422
endp
-
 
1423
 
-
 
1424
 
-
 
1425
proc draw_fullscreen_controls
-
 
1426
        push    esi
-
 
1427
        mov     ebx, [canvas.width]
-
 
1428
        shr     ebx, 1
-
 
1429
        add     ebx, [canvas.left]
-
 
1430
        sub     ebx, 22
-
 
1431
        shl     ebx, 16
-
 
1432
        add     ebx, 20
-
 
1433
        mov     ecx, [canvas.height]
-
 
1434
        shr     ecx, 3
-
 
1435
        neg     ecx
-
 
1436
        add     ecx, [canvas.height]
-
 
1437
        add     ecx, [canvas.top]
-
 
1438
        shl     ecx, 16
-
 
1439
        add     ecx, 20
-
 
1440
        mcall   8, , , 'bck'+40000000h
-
 
1441
        add     ebx, 25 SHL 16
-
 
1442
        mcall   8, , , 'fwd'+40000000h
-
 
1443
        mov     edx, [canvas.width]
-
 
1444
        shr     edx, 1
-
 
1445
        add     edx, [canvas.left]
-
 
1446
        sub     edx, 22
1099
    inc ecx
1447
        shl     edx, 16
1100
;    inc ebx
1448
        add     edx, [canvas.height]
1101
    push    ecx ; max height
1449
        shr     dx, 3
1102
    push    ebx ; max width
1450
        neg     dx
1103
    push    [draw_y]  ; y
1451
        add     dx, word[canvas.height]
1104
    push    esi ; x
1452
        add     edx, [canvas.top]
1105
    push    eax ; image
1453
        mcall   65, buttons + backbtn * 20, <20, 20>, , 8, palette
1106
    call    [img.draw]
1454
        add     edx, 25 SHL 16
1107
    pop eax
1455
        mcall   65, buttons + forwardbtn * 20,      , , 8, 
1108
    cmp [eax + Image.Next], 0
1456
        pop     esi
1109
    jnz .afloop
1457
        ret
1110
    ret
1458
endp
1111
 
1459
 
1112
 
1460
 
1113
check_shortcut:
1461
proc check_shortcut
1114
; in:   cl = scancode (from sysfn 2),
1462
; in:   cl = scancode (from sysfn 2),
1115
;   eax = state of modifiers (from sysfn 66.3),
1463
;   eax = state of modifiers (from sysfn 66.3),
1116
;   edx -> shortcut descriptor
1464
;   edx -> shortcut descriptor
1117
; out:  ZF set <=> fail
1465
; out:  ZF set <=> fail
1118
    cmp cl, [edx+4]
1466
        cmp     cl, [edx+4]
1119
    jnz .not
1467
        jnz     .not
1120
    push    eax
1468
        push    eax
1121
    mov esi, [edx]
1469
        mov     esi, [edx]
1122
    and esi, 0xF
1470
        and     esi, 0xf
1123
    and al, 3
1471
        and     al, 3
1124
    call    dword [check_modifier_table+esi*4]
1472
        call    dword[check_modifier_table+esi*4]
1125
    test    al, al
1473
        test    al, al
1126
    pop eax
1474
        pop     eax
1127
    jnz .not
1475
        jnz     .not
1128
    push    eax
1476
        push    eax
1129
    mov esi, [edx]
1477
        mov     esi, [edx]
1130
    shr esi, 4
1478
        shr     esi, 4
1131
    and esi, 0xF
1479
        and     esi, 0xf
1132
    shr al, 2
1480
        shr     al, 2
1133
    and al, 3
1481
        and     al, 3
1134
    call    dword [check_modifier_table+esi*4]
1482
        call    dword[check_modifier_table+esi*4]
1135
    test    al, al
1483
        test    al, al
-
 
1484
        pop     eax
-
 
1485
        jnz     .not
Line 1136... Line 1486...
1136
    pop eax
1486
        push    eax
1137
    jnz .not
1487
        mov     esi, [edx]
1138
    push    eax
1488
        shr     esi, 8
1139
    mov esi, [edx]
1489
        and     esi, 0xf
Line 1165... Line 1515...
1165
check_modifier_4:
1515
check_modifier_4:
1166
    cmp al, 2
1516
        cmp     al, 2
1167
    setnz   al
1517
        setnz   al
1168
    ret
1518
        ret
Line 1169... Line 1519...
1169
 
1519
 
1170
; fills real_header with window title
1520
; >edi = destination string
1171
; window title is generated as ' - Kolibri Image Viewer'
1521
; >eax = number
1172
generate_header:
1522
proc bin2dec
-
 
1523
        push    ebx ecx edx esi
1173
    push    eax
1524
 
1174
    mov esi, [last_name_component]
1525
        mov     ebx, 10
1175
    mov edi, real_header
1526
        xor     ecx, ecx
-
 
1527
    @@:
-
 
1528
        xor     edx, edx
-
 
1529
        div     ebx
-
 
1530
        push    edx
-
 
1531
        inc     ecx
-
 
1532
        test    eax, eax
-
 
1533
        jnz     @b
-
 
1534
 
-
 
1535
    @@:
-
 
1536
        pop     eax
-
 
1537
        add     eax, '0'
-
 
1538
        stosb
-
 
1539
        inc     [window_header_len]
-
 
1540
        dec     ecx
-
 
1541
        jnz     @b
-
 
1542
 
-
 
1543
        pop     esi edx ecx ebx
-
 
1544
        ret
-
 
1545
endp
-
 
1546
 
-
 
1547
 
-
 
1548
proc is_root_dir _path
-
 
1549
        push    ecx esi
-
 
1550
 
-
 
1551
        mov     esi, [_path]
-
 
1552
        xor     ecx, ecx
-
 
1553
    @@:
-
 
1554
        lodsb
-
 
1555
        test    al, al
-
 
1556
        jz      .done
-
 
1557
        cmp     al, '/'
-
 
1558
        jnz     @b
-
 
1559
        inc     ecx
-
 
1560
        jmp     @b
-
 
1561
  .done:
-
 
1562
        xor     eax, eax
-
 
1563
        cmp     ecx, 3
-
 
1564
        jz      @f
-
 
1565
        mov     eax, -2
-
 
1566
    @@:
-
 
1567
        pop     esi ecx
-
 
1568
        ret
-
 
1569
endp
-
 
1570
 
-
 
1571
; fills window_header with window title
-
 
1572
; window title is generated as '[k/n]  - Kolibri Image Viewer'
-
 
1573
; n = total files in dir
-
 
1574
; k = current file index
-
 
1575
proc generate_window_header
-
 
1576
        push    eax ebx esi edi
-
 
1577
        mov     esi, [last_name_component]
-
 
1578
        mov     edi, window_header
-
 
1579
        mov     [window_header_len], 4    ; [,/,], 
-
 
1580
 
-
 
1581
        mov     byte[edi], '['
-
 
1582
        inc     edi
-
 
1583
        mov     eax, [cur_file_idx]
-
 
1584
        inc     eax
-
 
1585
        call    bin2dec
-
 
1586
        mov     byte[edi], '/'
-
 
1587
        inc     edi
-
 
1588
        stdcall is_root_dir, path
-
 
1589
        add     eax, [files_num]
-
 
1590
        call    bin2dec
-
 
1591
        mov     word[edi], '] '
-
 
1592
        add     edi, 2
-
 
1593
 
-
 
1594
        ; add filename
1176
@@:
1595
  .next_symbol:
1177
    lodsb
1596
        lodsb
1178
    test    al, al
1597
        test    al, al
1179
    jz  @f
1598
        jz      @f
-
 
1599
        stosb
1180
    stosb
1600
        inc     [window_header_len]
1181
    cmp edi, real_header+256
1601
        cmp     edi, window_header+256
1182
    jb  @b
1602
        jb      .next_symbol
1183
.overflow:
1603
  .overflow:
1184
    mov dword [edi-4], '...'
1604
        mov     dword[edi-4], '...'
1185
.ret:
1605
  .ret:
1186
    pop eax
1606
        pop     edi esi ebx eax
1187
    ret
1607
        ret
1188
@@:
1608
    @@:
1189
    mov esi, s_header
1609
        mov     esi, s_header
1190
@@:
1610
    @@:
1191
    lodsb
1611
        lodsb
1192
    stosb
1612
        stosb
1193
    test    al, al
1613
        test    al, al
1194
    jz  .ret
1614
        jz      .ret
1195
    cmp edi, real_header+256
1615
        cmp     edi, window_header+256
1196
    jb  @b
1616
        jb      @b
-
 
1617
        jmp     .overflow
-
 
1618
endp
-
 
1619
 
-
 
1620
 
-
 
1621
proc scale_none_calc
-
 
1622
        push    ebx
-
 
1623
 
-
 
1624
        mov     [scale_mode], LIBIMG_SCALE_NONE
-
 
1625
 
-
 
1626
        mov     eax, [orig_image]
-
 
1627
        mov     [cur_image], eax
-
 
1628
        mov     [cur_frame], eax
-
 
1629
        mov     ebx, eax
-
 
1630
 
-
 
1631
        mov     [need_scrollbar_v], 0
-
 
1632
        mov     [need_scrollbar_h], 0
-
 
1633
 
-
 
1634
        mov     eax, [ebx + Image.Width]
-
 
1635
        cmp     eax, [canvas.width]
-
 
1636
        jbe     @f
-
 
1637
        sub     [canvas.height], SCROLL_WIDTH_SIZE+1
-
 
1638
        mov     [need_scrollbar_h], 1
-
 
1639
    @@:
-
 
1640
        mov     eax, [ebx + Image.Height]
-
 
1641
        cmp     eax, [canvas.height]
-
 
1642
        jbe     @f
-
 
1643
        sub     [canvas.width], SCROLL_WIDTH_SIZE+1
-
 
1644
        mov     [need_scrollbar_v], 1
-
 
1645
    @@:
-
 
1646
        cmp     [need_scrollbar_h], 1
-
 
1647
        jz      @f
-
 
1648
        mov     eax, [ebx + Image.Width]
-
 
1649
        cmp     eax, [canvas.width]
-
 
1650
        jbe     @f
-
 
1651
        sub     [canvas.height], SCROLL_WIDTH_SIZE+1
-
 
1652
        mov     [need_scrollbar_h], 1
-
 
1653
    @@:
-
 
1654
 
-
 
1655
 
-
 
1656
        mov     eax, [ebx + Image.Width]
-
 
1657
        cmp     eax, [canvas.width]
-
 
1658
        jbe     @f
-
 
1659
        mov     eax, [canvas.width]
-
 
1660
    @@:
-
 
1661
        mov     [view.width], eax
-
 
1662
        mov     [pict.width], eax
-
 
1663
 
-
 
1664
        mov     eax, [ebx + Image.Height]
-
 
1665
        cmp     eax, [canvas.height]
-
 
1666
        jbe     @f
-
 
1667
        mov     eax, [canvas.height]
-
 
1668
    @@:
-
 
1669
        mov     [view.height], eax
-
 
1670
        mov     [pict.height], eax
-
 
1671
 
-
 
1672
        mov     eax, [canvas.width]
-
 
1673
        sub     eax, [view.width]
-
 
1674
        sar     eax, 1
-
 
1675
        mov     [view.left], eax
-
 
1676
        mov     eax, [canvas.height]
-
 
1677
        sub     eax, [view.height]
-
 
1678
        sar     eax, 1
-
 
1679
        mov     [view.top], eax
-
 
1680
 
-
 
1681
        mov     eax, [ebx + Image.Width]
-
 
1682
        sub     eax, [pict.width]
-
 
1683
        sar     eax, 1
-
 
1684
        mov     [pict.left], eax
-
 
1685
        mov     eax, [ebx + Image.Height]
-
 
1686
        sub     eax, [pict.height]
-
 
1687
        sar     eax, 1
-
 
1688
        mov     [pict.top], eax
-
 
1689
 
-
 
1690
 
-
 
1691
        mov     eax, [ebx + Image.Height]
-
 
1692
        mov     [scroll_bar_data_vertical.max_area], eax
-
 
1693
        mov     eax, [pict.height]
-
 
1694
        mov     [scroll_bar_data_vertical.cur_area], eax
-
 
1695
        mov     eax, [pict.top]
-
 
1696
        mov     [scroll_bar_data_vertical.position], eax
-
 
1697
 
-
 
1698
        mov     eax, [ebx + Image.Width]
-
 
1699
        mov     [scroll_bar_data_horizontal.max_area], eax
-
 
1700
        mov     eax, [pict.width]
-
 
1701
        mov     [scroll_bar_data_horizontal.cur_area], eax
-
 
1702
        mov     eax, [pict.left]
-
 
1703
        mov     [scroll_bar_data_horizontal.position], eax
-
 
1704
 
-
 
1705
        pop     ebx
-
 
1706
        ret
-
 
1707
endp
-
 
1708
 
-
 
1709
 
-
 
1710
proc scale_fit_min_calc
-
 
1711
        push    ebx
-
 
1712
 
-
 
1713
        mov     [need_scrollbar_v], 0
-
 
1714
        mov     [need_scrollbar_h], 0
-
 
1715
        mov     [scroll_bar_data_vertical.position], 0
-
 
1716
        mov     [scroll_bar_data_horizontal.position], 0
-
 
1717
 
-
 
1718
        mov     eax, [orig_image]
-
 
1719
        cmp     [eax + Image.Type], Image.bpp24
-
 
1720
        jz      @f
-
 
1721
        cmp     [eax + Image.Type], Image.bpp32
-
 
1722
        jz      @f
-
 
1723
        cmp     [eax + Image.Type], Image.bpp8g
-
 
1724
        jz      @f
-
 
1725
        invoke  img.convert, eax, 0, Image.bpp24, 0, 0
-
 
1726
        test    eax, eax
-
 
1727
;       jz      .error
-
 
1728
        push    eax
-
 
1729
        invoke  img.destroy, [orig_image]
-
 
1730
        pop     eax
-
 
1731
        mov     [orig_image], eax
-
 
1732
        mov     [cur_image], eax
-
 
1733
        mov     [cur_frame], eax
-
 
1734
    @@:
-
 
1735
 
-
 
1736
        mov     eax, [orig_image]
-
 
1737
        mov     ecx, [eax + Image.Height]
-
 
1738
        mov     eax, [eax + Image.Width]
-
 
1739
        cmp     eax, [canvas.width]
-
 
1740
        ja      .get_size
-
 
1741
        cmp     ecx, [canvas.height]
-
 
1742
        ja      .get_size
-
 
1743
        jmp     .got_size
-
 
1744
  .get_size:
-
 
1745
        invoke  img.get_scaled_size, eax, ecx, LIBIMG_SCALE_FIT_MIN, [canvas.width], [canvas.height]
-
 
1746
  .got_size:
-
 
1747
 
-
 
1748
        mov     [pict.top], 0
-
 
1749
        mov     [pict.left], 0
-
 
1750
 
-
 
1751
        cmp     eax, [canvas.width]
-
 
1752
        jbe     @f
-
 
1753
        mov     eax, [canvas.width]
-
 
1754
    @@:
-
 
1755
        mov     [view.width], eax
-
 
1756
        mov     [pict.width], eax
-
 
1757
        neg     eax
-
 
1758
        add     eax, [canvas.width]
-
 
1759
        shr     eax, 1
-
 
1760
        mov     [view.left], eax
-
 
1761
 
-
 
1762
        mov     eax, ecx
-
 
1763
        cmp     eax, [canvas.height]
-
 
1764
        jbe     @f
-
 
1765
        mov     eax, [canvas.height]
-
 
1766
    @@:
-
 
1767
        mov     [view.height], eax
-
 
1768
        mov     [pict.height], eax
-
 
1769
        neg     eax
-
 
1770
        add     eax, [canvas.height]
-
 
1771
        shr     eax, 1
-
 
1772
        mov     [view.top], eax
-
 
1773
 
-
 
1774
 
-
 
1775
        pop     ebx
-
 
1776
        ret
-
 
1777
endp
-
 
1778
 
-
 
1779
 
-
 
1780
proc set_scale_mode _mode
-
 
1781
        push    eax ecx
-
 
1782
        xor     ecx, ecx
-
 
1783
        mov     eax, [_mode]
-
 
1784
 
-
 
1785
        cmp     [scale_mode], eax
-
 
1786
        jz      @f
-
 
1787
        mov     [bScaleModeChanged], 1
-
 
1788
        mov     [scale_mode], eax
-
 
1789
    @@:
-
 
1790
        pop     ecx eax
-
 
1791
        ret
-
 
1792
endp
-
 
1793
 
-
 
1794
proc move_pictport _dx, _dy
-
 
1795
locals
-
 
1796
        new_left dd ?
-
 
1797
        new_top  dd ?
-
 
1798
endl
-
 
1799
        push    ebx ecx
-
 
1800
 
-
 
1801
        mov     ebx, [cur_image]
-
 
1802
  .x:
-
 
1803
        mov     eax, [pict.left]
-
 
1804
        add     eax, [_dx]
-
 
1805
        cmp     eax, 0
-
 
1806
        jge     @f
-
 
1807
        mov     [new_left], 0
-
 
1808
        jmp     .xdone
-
 
1809
    @@:
-
 
1810
        mov     ecx, eax
-
 
1811
        add     eax, [pict.width]
-
 
1812
        cmp     eax, [ebx + Image.Width]
-
 
1813
        ja      @f
-
 
1814
        mov     [new_left], ecx
-
 
1815
        jmp     .xdone
-
 
1816
    @@:
-
 
1817
        mov     eax, [ebx + Image.Width]
-
 
1818
        sub     eax, [pict.width]
-
 
1819
        mov     [new_left], eax
-
 
1820
        jmp     .xdone
-
 
1821
  .xdone:
-
 
1822
 
-
 
1823
  .y:
-
 
1824
        mov     eax, [pict.top]
-
 
1825
        add     eax, [_dy]
-
 
1826
        cmp     eax, 0
-
 
1827
        jge     @f
-
 
1828
        mov     [new_top], 0
-
 
1829
        jmp     .ydone
-
 
1830
    @@:
-
 
1831
        mov     ecx, eax
-
 
1832
        add     eax, [pict.height]
-
 
1833
        cmp     eax, [ebx + Image.Height]
-
 
1834
        ja      @f
-
 
1835
        mov     [new_top], ecx
-
 
1836
        jmp     .ydone
-
 
1837
    @@:
-
 
1838
        mov     eax, [ebx + Image.Height]
-
 
1839
        sub     eax, [pict.height]
-
 
1840
        mov     [new_top], eax
-
 
1841
        jmp     .ydone
-
 
1842
  .ydone:
-
 
1843
 
-
 
1844
        xor     eax, eax
-
 
1845
        mov     ecx, [new_left]
-
 
1846
        mov     edx, [new_top]
-
 
1847
 
-
 
1848
        cmp     ecx, [pict.left]
-
 
1849
        setnz   al
-
 
1850
        shl     eax, 8
-
 
1851
 
-
 
1852
        cmp     edx, [pict.top]
-
 
1853
        setnz   al
-
 
1854
 
-
 
1855
        mov     [pict.left], ecx
-
 
1856
        mov     [pict.top], edx
-
 
1857
 
-
 
1858
        pop     ecx ebx
-
 
1859
        ret
-
 
1860
endp
-
 
1861
 
-
 
1862
 
-
 
1863
proc update_scrollbars _xxhv
-
 
1864
        mov     eax, [_xxhv]
-
 
1865
 
-
 
1866
        test    ah, ah
-
 
1867
        jz      .no_h_scroll
-
 
1868
        push    eax
-
 
1869
        mov     [scroll_bar_data_horizontal.all_redraw], 0
-
 
1870
        mov     eax, [pict.left]
-
 
1871
        mov     [scroll_bar_data_horizontal.position], eax
-
 
1872
        invoke  scrollbar_hort_draw, scroll_bar_data_horizontal
-
 
1873
        pop     eax
-
 
1874
  .no_h_scroll:
-
 
1875
        test    al, al
-
 
1876
        jz      .no_v_scroll
-
 
1877
        push    eax
-
 
1878
        mov     [scroll_bar_data_vertical.all_redraw], 0
-
 
1879
        mov     eax, [pict.top]
-
 
1880
        mov     [scroll_bar_data_vertical.position], eax
-
 
1881
        invoke  scrollbar_vert_draw, scroll_bar_data_vertical
-
 
1882
        pop     eax
-
 
1883
  .no_v_scroll:
-
 
1884
 
-
 
1885
        ret
-
 
1886
endp
-
 
1887
 
-
 
1888
 
-
 
1889
proc merge_icons_to_single_img _img
-
 
1890
        push    ebx esi edi
-
 
1891
 
-
 
1892
        mov     edx, [_img]
-
 
1893
        mov     eax, [edx + Image.Width]
-
 
1894
        mov     ecx, [edx + Image.Height]
-
 
1895
  .next:
-
 
1896
        cmp     [edx + Image.Next], 0
-
 
1897
        jz      .got_sizes
-
 
1898
        inc     eax
-
 
1899
        mov     edx, [edx + Image.Next]
-
 
1900
        add     eax, [edx + Image.Width]
-
 
1901
        cmp     ecx, [edx + Image.Height]
-
 
1902
        jae     @f
-
 
1903
        mov     ecx, [edx + Image.Height]
-
 
1904
    @@:
-
 
1905
        jmp     .next
-
 
1906
 
-
 
1907
  .got_sizes:
-
 
1908
        invoke  img.create, eax, ecx, Image.bpp32
-
 
1909
        test    eax, eax
-
 
1910
        jz      .error
-
 
1911
        mov     ebx, eax
-
 
1912
 
-
 
1913
        mov     eax, [bg_color]
-
 
1914
        mov     edi, [ebx + Image.Data]
-
 
1915
        mov     ecx, [ebx + Image.Width]
-
 
1916
        imul    ecx, [ebx + Image.Height]
-
 
1917
        rep     stosd
-
 
1918
 
-
 
1919
        mov     eax, [_img]
-
 
1920
        cmp     [eax + Image.Type], Image.bpp32
-
 
1921
        jz      @f
-
 
1922
        invoke  img.convert, eax, 0, Image.bpp32, 0, 0
-
 
1923
        test    eax, eax
-
 
1924
        jz      .error
-
 
1925
        push    eax
-
 
1926
        invoke  img.destroy, [_img]
-
 
1927
        pop     eax
-
 
1928
    @@:
-
 
1929
        mov     esi, eax
-
 
1930
        xor     edi, edi
-
 
1931
  .next_img:
-
 
1932
        stdcall put_img_on_img, ebx, esi, edi, 0
-
 
1933
        add     edi, [esi + Image.Width]
-
 
1934
        inc     edi
-
 
1935
        cmp     [esi + Image.Next], 0
-
 
1936
        jz      @f
-
 
1937
        mov     esi, [esi + Image.Next]
-
 
1938
        jmp     .next_img
-
 
1939
    @@:
-
 
1940
        invoke  img.destroy, esi
-
 
1941
        mov     eax, ebx
-
 
1942
        jmp     .quit
-
 
1943
 
-
 
1944
  .error:
-
 
1945
        xor     eax, eax
-
 
1946
  .quit:
-
 
1947
        pop     edi esi ebx
-
 
1948
        ret
-
 
1949
endp
-
 
1950
 
-
 
1951
 
-
 
1952
proc put_img_on_img _bottom, _top, _x, _y
-
 
1953
locals
-
 
1954
        img_height dd ?
-
 
1955
endl
-
 
1956
        push    ebx esi edi
-
 
1957
 
-
 
1958
        mov     ebx, [_bottom]
-
 
1959
        mov     edx, [_top]
-
 
1960
        mov     eax, [edx + Image.Height]
-
 
1961
        mov     [img_height], eax
-
 
1962
        mov     esi, [edx + Image.Data]
-
 
1963
        mov     edi, [ebx + Image.Data]
-
 
1964
        mov     eax, [_y]
-
 
1965
        imul    eax, [ebx + Image.Width]
-
 
1966
        add     eax, [_x]
-
 
1967
        shl     eax, 2
-
 
1968
        add     edi, eax
-
 
1969
  .next_line:
-
 
1970
        mov     ecx, [edx + Image.Width]
-
 
1971
        rep     movsd
-
 
1972
        mov     eax, [ebx + Image.Width]
-
 
1973
        sub     eax, [edx + Image.Width]
-
 
1974
        shl     eax, 2
-
 
1975
        add     edi, eax
-
 
1976
        dec     [img_height]
-
 
1977
        jnz     .next_line
-
 
1978
 
-
 
1979
        pop     edi esi ebx
-
 
1980
        ret
-
 
1981
endp
-
 
1982
 
-
 
1983
 
-
 
1984
proc copy_box _src, _dst
-
 
1985
        pushad
-
 
1986
 
-
 
1987
        mov     esi, [_src]
-
 
1988
        mov     edi, [_dst]
-
 
1989
        mov     ecx, 4
-
 
1990
        rep movsd
-
 
1991
 
-
 
1992
        popad
-
 
1993
        ret
-
 
1994
endp
-
 
1995
 
-
 
1996
 
-
 
1997
proc cmp_box _a, _b
-
 
1998
        pushad
-
 
1999
 
-
 
2000
        mov     esi, [_a]
-
 
2001
        mov     edi, [_b]
-
 
2002
        mov     ecx, 4
-
 
2003
        rep cmpsd
-
 
2004
 
-
 
2005
        popad
-
 
2006
        ret
-
 
2007
endp
-
 
2008
 
-
 
2009
 
-
 
2010
proc recalc_client
-
 
2011
        stdcall copy_box, toolbar, toolbar_prev
-
 
2012
        mov     [toolbar.left], 0
-
 
2013
        mov     [toolbar.top], 0
-
 
2014
        mov     eax, [client.width]
-
 
2015
        mov     [toolbar.width], eax
-
 
2016
        mov     [toolbar.height], 0
-
 
2017
        cmp     [bShowToolbar], 1
-
 
2018
        jnz     @f
-
 
2019
        mov     [toolbar.height], TOOLBAR_HEIGHT
-
 
2020
    @@:
-
 
2021
 
-
 
2022
        mov     eax, [toolbar.top]
-
 
2023
        add     eax, [client_abs_top]
-
 
2024
        mov     [toolbar_abs_top], eax
-
 
2025
        mov     eax, [toolbar.left]
-
 
2026
        add     eax, [client_abs_left]
-
 
2027
        mov     [toolbar_abs_left], eax
-
 
2028
 
-
 
2029
        test    [bFirstWinDraw], 1
-
 
2030
        jnz     .recalc_toolbar
-
 
2031
        stdcall cmp_box, toolbar, toolbar_prev
-
 
2032
        jnz     .recalc_toolbar
-
 
2033
        test    [bNewImage], 1
-
 
2034
        jnz     .recalc_toolbar
-
 
2035
        jmp     .recalc_toolbar_done
-
 
2036
  .recalc_toolbar:
-
 
2037
        stdcall recalc_toolbar
-
 
2038
  .recalc_toolbar_done:
-
 
2039
 
-
 
2040
        stdcall copy_box, work, work_prev
-
 
2041
        xor     ecx, ecx
-
 
2042
        test     [bShowToolbar], 1
-
 
2043
        jz      @f
-
 
2044
        mov     ecx, [toolbar.height]
-
 
2045
    @@:
-
 
2046
        mov     eax, ecx
-
 
2047
        mov     [work.top], eax
-
 
2048
        mov     eax, [client.height]
-
 
2049
        sub     eax, ecx
-
 
2050
        mov     [work.height], eax
-
 
2051
        mov     [work.left], 0
-
 
2052
        mov     eax, [client.width]
-
 
2053
        mov     [work.width], eax
-
 
2054
 
-
 
2055
        mov     eax, [work.top]
-
 
2056
        add     eax, [client_abs_top]
-
 
2057
        mov     [work_abs_top], eax
-
 
2058
        mov     eax, [work.left]
-
 
2059
        add     eax, [client_abs_left]
-
 
2060
        mov     [work_abs_left], eax
-
 
2061
 
-
 
2062
        test    [bFirstWinDraw], 1
-
 
2063
        jnz     .recalc_work
-
 
2064
        test    [bNewImage], 1
-
 
2065
        jnz     .recalc_work
-
 
2066
        stdcall cmp_box, work, work_prev
-
 
2067
        jnz     .recalc_work
-
 
2068
        jmp     .recalc_work_done
-
 
2069
  .recalc_work:
-
 
2070
        stdcall recalc_work
-
 
2071
  .recalc_work_done:
-
 
2072
 
-
 
2073
        ret
-
 
2074
endp
-
 
2075
 
-
 
2076
 
-
 
2077
proc recalc_toolbar
-
 
2078
 
-
 
2079
        ret
-
 
2080
endp
-
 
2081
 
-
 
2082
 
-
 
2083
proc recalc_window
-
 
2084
        stdcall copy_box, client, client_prev
-
 
2085
        test    [bSlideShow], 1
-
 
2086
        jz      .no_slide_show
-
 
2087
  .slide_show:
-
 
2088
        mov     [client.left], 0
-
 
2089
        mov     [client.top], 0
-
 
2090
        mov     eax, [procinfo.box.width]
-
 
2091
        mov     [client.width], eax
-
 
2092
        mov     eax, [procinfo.box.height]
-
 
2093
        mov     [client.height], eax
-
 
2094
        jmp     .calc_abs
-
 
2095
  .no_slide_show:
-
 
2096
        mcall   SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
-
 
2097
        mov     [client.top], eax
-
 
2098
        neg     eax
-
 
2099
        add     eax, [procinfo.box.height]
-
 
2100
        sub     eax, 5
-
 
2101
        mov     [client.height], eax
-
 
2102
        mov     [client.left], 5
-
 
2103
        mov     eax, [procinfo.box.width]
-
 
2104
        sub     eax, 10
-
 
2105
        mov     [client.width], eax
-
 
2106
 
-
 
2107
  .calc_abs:
-
 
2108
        mov     eax, [client.top]
-
 
2109
        mov     [client_abs_top], eax
-
 
2110
        mov     eax, [client.left]
-
 
2111
        mov     [client_abs_left], eax
-
 
2112
 
-
 
2113
        stdcall cmp_box, client, client_prev
-
 
2114
        jnz     .recalc_client
-
 
2115
        test    [bNewImage], 1
-
 
2116
        jnz     .recalc_client
-
 
2117
        test    [bToggleToolbar], 1
-
 
2118
        jnz     .recalc_client
-
 
2119
        jmp     .recalc_client_done
-
 
2120
  .recalc_client:
-
 
2121
        stdcall recalc_client
-
 
2122
  .recalc_client_done:
-
 
2123
 
-
 
2124
        ret
-
 
2125
endp
-
 
2126
 
-
 
2127
 
-
 
2128
proc recalc_work
-
 
2129
        stdcall copy_box, canvas, canvas_prev
-
 
2130
        mov     eax, [work.left]
-
 
2131
        add     eax, [canvas_padding]
-
 
2132
        mov     [canvas.left], eax
-
 
2133
        mov     eax, [work.width]
-
 
2134
        sub     eax, [canvas_padding]
-
 
2135
        sub     eax, [canvas_padding]
-
 
2136
        inc     eax
-
 
2137
        mov     [canvas.width], eax
-
 
2138
        mov     eax, [canvas_padding]
-
 
2139
        mov     [canvas.top], eax
-
 
2140
        mov     eax, [work.height]
-
 
2141
        sub     eax, [canvas_padding]
-
 
2142
        sub     eax, [canvas_padding]
-
 
2143
        inc     eax
-
 
2144
        mov     [canvas.height], eax
-
 
2145
 
-
 
2146
        mov     eax, [canvas.top]
-
 
2147
        add     eax, [work_abs_top]
-
 
2148
        mov     [canvas_abs_top], eax
-
 
2149
        mov     eax, [canvas.left]
-
 
2150
        add     eax, [work_abs_left]
-
 
2151
        mov     [canvas_abs_left], eax
-
 
2152
 
-
 
2153
        test    [bFirstWinDraw], 1
-
 
2154
        jnz     .recalc_canvas
-
 
2155
        test    [bNewImage], 1
-
 
2156
        jnz     .recalc_canvas
-
 
2157
        stdcall cmp_box, canvas, canvas_prev
-
 
2158
        jnz     .recalc_canvas
-
 
2159
        jmp     .recalc_canvas_done
-
 
2160
  .recalc_canvas:
-
 
2161
        stdcall recalc_canvas
-
 
2162
  .recalc_canvas_done:
-
 
2163
        ret
-
 
2164
endp
-
 
2165
 
-
 
2166
 
-
 
2167
proc recalc_canvas
-
 
2168
        stdcall copy_box, view, view_prev
-
 
2169
        mov     eax, [scale_mode]
-
 
2170
        call    [scale_mode_calc + eax*4]
-
 
2171
 
-
 
2172
        mov     eax, [view.top]
-
 
2173
        add     eax, [canvas_abs_top]
-
 
2174
        mov     [view_abs_top], eax
-
 
2175
        mov     eax, [view.left]
-
 
2176
        add     eax, [canvas_abs_left]
-
 
2177
        mov     [view_abs_left], eax
-
 
2178
 
-
 
2179
        ret
-
 
2180
endp
1197
    jmp .overflow
2181
 
-
 
2182
;-----------------------------------------------------------------------------
Line 1198... Line 2183...
1198
;-----------------------------------------------------------------------------
2183
DATA
1199
 
2184
 
-
 
2185
s_header        db ' - Kolibri Image Viewer',0
-
 
2186
window_style    dd 0x53FFFFFF
-
 
2187
window          BOX 101, 144, 529, 324  ; left top width height
1200
s_header db ' - Kolibri Image Viewer', 0
2188
window_prev     BOX 0, 0, 0, 0
-
 
2189
window_save     BOX 0, 0, 0, 0  ; restore after slide show
-
 
2190
client          BOX 0, 0, 0, 0
-
 
2191
client_prev     BOX 0, 0, 0, 0
-
 
2192
client_abs_top  dd ?
-
 
2193
client_abs_left dd ?
-
 
2194
toolbar         BOX 0, 0, 0, 0
-
 
2195
toolbar_prev    BOX 0, 0, 0, 0
1201
wnd_style        dd 0x73FFFFFF
2196
toolbar_abs_top dd ?
-
 
2197
toolbar_abs_left dd ?
1202
wnd_x            dd 100
2198
work            BOX 0, 0, 0, 0
1203
wnd_y            dd 100
2199
work_prev       BOX 0, 0, 0, 0
-
 
2200
work_abs_top    dd ?
-
 
2201
work_abs_left   dd ?
-
 
2202
canvas          BOX 0, 0, 0, 0
-
 
2203
canvas_prev     BOX 0, 0, 0, 0
-
 
2204
canvas_abs_top  dd ?
-
 
2205
canvas_abs_left dd ?
-
 
2206
view            BOX -1, -1, 0, 0
-
 
2207
view_prev       BOX -1, -1, 0, 0
-
 
2208
view_abs_top    dd ?
-
 
2209
view_abs_left   dd ?
1204
image_padding    dd 5
2210
pict            BOX 0, 0, 0, 0
-
 
2211
canvas_padding  dd 5
-
 
2212
bg_color        dd 0x00ffffff
-
 
2213
scale_mode      dd LIBIMG_SCALE_FIT_MIN
-
 
2214
pict_drag       dd 0
-
 
2215
scroll_v_drag   dd 0
-
 
2216
scroll_h_drag   dd 0
-
 
2217
 
-
 
2218
mouse_buttons    dd 0
-
 
2219
mouse_pos        dd 0
-
 
2220
need_scrollbar_v dd 0
-
 
2221
need_scrollbar_h dd 0
Line 1205... Line 2222...
1205
toolbar_height   dd 31
2222
 
-
 
2223
pict_moved      dd 0
-
 
2224
 
-
 
2225
;-----------------------------------------------------------------------------
-
 
2226
align   4
-
 
2227
scroll_bar_data_vertical:
-
 
2228
.x:
-
 
2229
.size_x         dw SCROLL_WIDTH_SIZE
-
 
2230
.start_x        dw 1
-
 
2231
.y:
-
 
2232
.size_y         dw 100
-
 
2233
.start_y        dw 0
-
 
2234
.btn_high       dd SCROLL_WIDTH_SIZE
-
 
2235
.type           dd 0    ;+12
-
 
2236
.max_area       dd 100  ;+16
-
 
2237
.cur_area       dd 10   ;+20
-
 
2238
.position       dd 0    ;+24
-
 
2239
.bckg_col       dd 0xAAAAAA     ;+28
-
 
2240
.frnt_col       dd 0xCCCCCC     ;+32
-
 
2241
.line_col       dd 0    ;+36
-
 
2242
.redraw         dd 0    ;+40
-
 
2243
.delta          dw 0    ;+44
-
 
2244
.delta2         dw 0    ;+46
-
 
2245
.run_x:
-
 
2246
.r_size_x       dw 0    ;+48
-
 
2247
.r_start_x      dw 0    ;+50
-
 
2248
.run_y:
-
 
2249
.r_size_y       dw 0    ;+52
-
 
2250
.r_start_y      dw 0    ;+54
-
 
2251
.m_pos          dd 0    ;+56
-
 
2252
.m_pos_2        dd 0    ;+60
-
 
2253
.m_keys         dd 0    ;+64
-
 
2254
.run_size       dd 0    ;+68
-
 
2255
.position2      dd 0    ;+72
-
 
2256
.work_size      dd 0    ;+76
-
 
2257
.all_redraw     dd 0    ;+80
-
 
2258
.ar_offset      dd KEY_MOVE_PIXELS   ;+84
-
 
2259
;-----------------------------------------------------------------------------
-
 
2260
align   4
-
 
2261
scroll_bar_data_horizontal:
-
 
2262
.x:
-
 
2263
.size_x         dw 0    ;+0
-
 
2264
.start_x        dw 0    ;+2
-
 
2265
.y:
-
 
2266
.size_y         dw SCROLL_WIDTH_SIZE    ;+4
-
 
2267
.start_y        dw 0    ;+6
-
 
2268
.btn_high       dd SCROLL_WIDTH_SIZE    ;+8
-
 
2269
.type           dd 0    ;+12
-
 
2270
.max_area       dd 50   ;+16
-
 
2271
.cur_area       dd 50   ;+20
-
 
2272
.position       dd 0    ;+24
-
 
2273
.bckg_col       dd 0xAAAAAA     ;+28
-
 
2274
.frnt_col       dd 0xCCCCCC     ;+32
-
 
2275
.line_col       dd 0    ;+36
-
 
2276
.redraw         dd 0    ;+40
-
 
2277
.delta          dw 0    ;+44
-
 
2278
.delta2         dw 0    ;+46
-
 
2279
.run_x:
-
 
2280
.r_size_x       dw 0    ;+48
-
 
2281
.r_start_x      dw 0    ;+50
-
 
2282
.run_y:
-
 
2283
.r_size_y       dw 0    ;+52
-
 
2284
.r_start_y      dw 0    ;+54
-
 
2285
.m_pos          dd 0    ;+56
-
 
2286
.m_pos_2        dd 0    ;+60
-
 
2287
.m_keys         dd 0    ;+64
-
 
2288
.run_size       dd 0    ;+68
-
 
2289
.position2      dd 0    ;+72
1206
bg_color         dd 0x00ffffff
2290
.work_size      dd 0    ;+76
1207
 
-
 
1208
;-----------------------------------------------------------------------------
2291
.all_redraw     dd 0    ;+80
1209
;-----------------------------------------------------------------------------
2292
.ar_offset      dd KEY_MOVE_PIXELS      ;+84
Line 1210... Line 2293...
1210
 
2293
;-----------------------------------------------------------------------------
1211
align 4
-
 
1212
@IMPORT:
2294
align 4
1213
 
2295
@IMPORT:
1214
library             \
2296
 
1215
    libio  , 'libio.obj'  , \
2297
library                           \
1216
    libgfx , 'libgfx.obj' , \
2298
        libgfx  , 'libgfx.obj'  , \
1217
    libimg , 'libimg.obj' , \
2299
        libimg  , 'libimg.obj'  , \
1218
    libini , 'libini.obj' , \
-
 
Line 1219... Line -...
1219
    sort   , 'sort.obj'   , \
-
 
1220
    proc_lib ,'proc_lib.obj',\
-
 
1221
	libbuf2d, 'buf2d.obj'
-
 
1222
 
-
 
1223
 
-
 
1224
import  libio             , \
-
 
Line 1225... Line 2300...
1225
    libio.init , 'lib_init'   , \
2300
        libini  , 'libini.obj'  , \
1226
    file.size  , 'file_size'  , \
2301
        sort    , 'sort.obj'    , \
1227
    file.open  , 'file_open'  , \
2302
        proc_lib, 'proc_lib.obj', \
1228
    file.read  , 'file_read'  , \
2303
        box_lib , 'box_lib.obj'
1229
    file.close , 'file_close'
2304
 
1230
 
2305
 
Line 1231... Line 2306...
1231
import  libgfx              , \
2306
import libgfx                         , \
1232
    libgfx.init   , 'lib_init'  , \
2307
        libgfx.init  , 'lib_init'     , \
1233
    gfx.open      , 'gfx_open'  , \
2308
        gfx.open     , 'gfx_open'     , \
1234
    gfx.close     , 'gfx_close' , \
2309
        gfx.close    , 'gfx_close'    , \
1235
    gfx.pen.color , 'gfx_pen_color' , \
2310
        gfx.pen.color, 'gfx_pen_color', \
1236
    gfx.line      , 'gfx_line'
2311
        gfx.line     , 'gfx_line'
1237
 
2312
 
1238
import  libimg             , \
2313
import libimg                                     , \
-
 
2314
        libimg.init        , 'lib_init'           , \
-
 
2315
        img.from_file      , 'img_from_file'      , \
-
 
2316
        img.to_rgb2        , 'img_to_rgb2'        , \
1239
    libimg.init , 'lib_init'   , \
2317
        img.create         , 'img_create'         , \
Line 1240... Line 2318...
1240
    img.is_img  , 'img_is_img' , \
2318
        img.flip           , 'img_flip'           , \
1241
    img.to_rgb2 , 'img_to_rgb2', \
2319
        img.rotate         , 'img_rotate'         , \
1242
    img.decode  , 'img_decode' , \
2320
        img.destroy        , 'img_destroy'        , \
Line -... Line 2321...
-
 
2321
        img.scale          , 'img_scale'          , \
1243
    img.flip    , 'img_flip'   , \
2322
        img.get_scaled_size, 'img_get_scaled_size', \
-
 
2323
        img.convert        , 'img_convert'        , \
-
 
2324
        img.draw           , 'img_draw'
Line 1244... Line 2325...
1244
    img.rotate  , 'img_rotate' , \
2325
 
1245
    img.destroy , 'img_destroy', \
2326
import libini                               , \
1246
    img.draw    , 'img_draw'
2327
        ini_get_shortcut, 'ini_get_shortcut', \
Line 1247... Line 2328...
1247
 
2328
        ini_set_str,      'ini_set_str'
1248
import  libini, \
2329
 
-
 
2330
import sort                  ,\
-
 
2331
        sort.START, 'START'  ,\
1249
    ini_get_shortcut, 'ini_get_shortcut',\
2332
        SortDir   , 'SortDir',\
Line 1250... Line -...
1250
	ini_set_str, 'ini_set_str'
-
 
1251
 
-
 
1252
import  sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi'
-
 
1253
 
-
 
1254
import  proc_lib, \
-
 
1255
    OpenDialog_Init, 'OpenDialog_init', \
-
 
1256
    OpenDialog_Start,'OpenDialog_start'
-
 
1257
 
2333
        strcmpi   , 'strcmpi'
1258
import  libbuf2d, \
2334
 
-
 
2335
import proc_lib                             ,\
-
 
2336
        OpenDialog_Init , 'OpenDialog_init' ,\
-
 
2337
        OpenDialog_Start, 'OpenDialog_start'
1259
	buf2d_init, 'lib_init', \
2338
 
-
 
2339
import box_lib                                   ,\
-
 
2340
        scrollbar_vert_draw , 'scrollbar_v_draw' ,\
1260
	buf2d_resize, 'buf2d_resize'
2341
        scrollbar_vert_mouse, 'scrollbar_v_mouse',\
Line 1261... Line 2342...
1261
 
2342
        scrollbar_hort_draw , 'scrollbar_h_draw' ,\
1262
align 4
2343
        scrollbar_hort_mouse, 'scrollbar_h_mouse'
1263
buf_0: dd 0
2344
 
Line 1327... Line 2408...
1327
OpenDialog_data:
2408
OpenDialog_data:
1328
.type           dd 0
2409
.type                   dd 0
1329
.procinfo       dd procinfo ;+4
2410
.procinfo               dd procinfo                             ; +4
1330
.com_area_name      dd communication_area_name ;+8
2411
.com_area_name          dd communication_area_name              ; +8
1331
.com_area       dd 0 ;+12
2412
.com_area               dd 0                                    ; +12
1332
.opendir_pach       dd temp_dir_pach ;+16
2413
.opendir_path           dd temp_dir_path                        ; +16
1333
.dir_default_pach   dd communication_area_default_pach ;+20
2414
.dir_default_path       dd communication_area_default_path      ; +20
1334
.start_path     dd open_dialog_path ;+24
2415
.start_path             dd open_dialog_path                     ; +24
1335
.draw_window        dd draw_window ;+28
2416
.draw_window            dd draw_window                          ; +28
1336
.status         dd 0 ;+32
2417
.status                 dd 0                                    ; +32
1337
.openfile_pach      dd path  ;openfile_pach ;+36
2418
.openfile_path          dd path                                 ; openfile_path ; +36
1338
.filename_area      dd 0    ;+40
2419
.filename_area          dd 0                                    ; +40
1339
.filter_area        dd Filter
2420
.filter_area            dd Filter
1340
.x:
2421
.x:
1341
.x_size                 dw 420 ;+48 ; Window X size
2422
.x_size                 dw 420                                  ; +48 ; Window X size
1342
.x_start                dw 10 ;+50 ; Window X position
2423
.x_start                dw 10                                   ; +50 ; Window X position
Line 1351... Line 2432...
1351
if __nightbuild eq yes
2432
if __nightbuild eq yes
1352
    db '/sys/MANAGERS/opendial',0
2433
    db '/sys/MANAGERS/opendial',0
1353
else
2434
else
1354
    db '/sys/File Managers/opendial',0
2435
    db '/sys/File Managers/opendial',0
1355
end if
2436
end if
1356
communication_area_default_pach:
2437
communication_area_default_path:
1357
    db '/rd/1',0
2438
    db '/rd/1',0
Line 1358... Line 2439...
1358
 
2439
 
1359
Filter:
2440
Filter:
1360
dd Filter.end - Filter
2441
dd Filter.end - Filter
Line 1371... Line 2452...
1371
db 'PCX',0
2452
db 'PCX',0
1372
db 'XCF',0
2453
db 'XCF',0
1373
db 'PBM',0
2454
db 'PBM',0
1374
db 'PGM',0
2455
db 'PGM',0
1375
db 'PNM',0
2456
db 'PNM',0
-
 
2457
db 'PPM',0
1376
db 'TIF',0
2458
db 'TIF',0
1377
db 'TIFF',0
2459
db 'TIFF',0
1378
db 'WBMP',0
2460
db 'WBMP',0
-
 
2461
db 'WEBP',0
-
 
2462
db 'XBM',0
1379
.end:
2463
.end:
1380
db 0
2464
db 0
Line 1381... Line 2465...
1381
 
2465
 
1382
draw_window_fake:
2466
draw_window_fake:
1383
    ret
2467
    ret
-
 
2468
;------------------------------------------------------------------------------
-
 
2469
scale_mode_calc dd scale_none_calc, 0, 0, 0, scale_fit_min_calc
-
 
2470
 
-
 
2471
scale_none_mod    dd 0
-
 
2472
scale_none_key    dd 13 ; '='
-
 
2473
scale_fit_min_mod dd 0
-
 
2474
scale_fit_min_key dd 17 ; 'w'
-
 
2475
 
-
 
2476
move_pictport_left_1_mod dd 0
-
 
2477
move_pictport_left_1_key dd 35 ; 'h'
-
 
2478
move_pictport_left_2_mod dd 0
-
 
2479
move_pictport_left_2_key dd 75 ; arrow left
-
 
2480
 
-
 
2481
move_pictport_right_1_mod dd 0
-
 
2482
move_pictport_right_1_key dd 38 ; 'l'
-
 
2483
move_pictport_right_2_mod dd 0
-
 
2484
move_pictport_right_2_key dd 77 ; arrow right
-
 
2485
 
-
 
2486
move_pictport_up_1_mod dd 0
-
 
2487
move_pictport_up_1_key dd 37 ; 'k'
-
 
2488
move_pictport_up_2_mod dd 0
-
 
2489
move_pictport_up_2_key dd 72 ; arrow up
-
 
2490
 
-
 
2491
move_pictport_down_1_mod dd 0
-
 
2492
move_pictport_down_1_key dd 36 ; 'j'
-
 
2493
move_pictport_down_2_mod dd 0
-
 
2494
move_pictport_down_2_key dd 80 ; arrow down
-
 
2495
 
-
 
2496
;shift_left_down_mod
-
 
2497
 
-
 
2498
;include_debug_strings
1384
;------------------------------------------------------------------------------
2499
 
1385
readdir_fileinfo:
2500
readdir_fileinfo:
1386
    dd  1
2501
    dd  1
1387
    dd  0
2502
    dd  0
1388
    dd  0
2503
    dd  0
1389
readblocks dd   0
2504
readblocks dd   0
-
 
2505
directory_ptr   dd  0
1390
directory_ptr   dd  0
2506
curdir          db 1024 dup (?)
1391
;------------------------------------------------------------------------------
-
 
1392
I_END:
-
 
Line -... Line 2507...
-
 
2507
;------------------------------------------------------------------------------
1393
curdir      rb  1024
2508
 
1394
 
-
 
1395
align 4
2509
I_END:
1396
img_data     dd ?
2510
align 4
1397
img_data_len dd ?
2511
img_data_len    rd 1
1398
fh       dd ?
-
 
1399
image        dd ?
-
 
1400
wnd_width   dd  100
2512
fh              rd 1
1401
wnd_height  dd  100
2513
orig_image      rd 1
1402
draw_x      dd  ?
-
 
1403
draw_y      dd  ?
-
 
1404
draw_width  dd  ?
-
 
1405
draw_height dd  ?
2514
cur_image       rd 1
1406
last_name_component dd  ?
2515
files_num       rd 1
1407
cur_file_idx    dd  ?
2516
cur_file_idx    rd 1
1408
cur_frame_time  dd  ?
2517
cur_frame_time  rd 1
1409
cur_frame   dd  ?
2518
cur_frame       rd 1
1410
 
2519
 
1411
next_mod    dd  ?
2520
next_mod          rd 1
1412
next_key    dd  ?
2521
next_key          rd 1
1413
prev_mod    dd  ?
2522
prev_mod          rd 1
1414
prev_key    dd  ?
2523
prev_key          rd 1
1415
slide_mod   dd  ?
2524
slide_mod         rd 1
1416
slide_key   dd  ?
2525
slide_key         rd 1
-
 
2526
tglbar_mod        rd 1
Line -... Line 2527...
-
 
2527
tglbar_key        rd 1
1417
tglbar_mod  dd  ?
2528
 
Line 1418... Line 2529...
1418
tglbar_key  dd  ?
2529
 
1419
 
2530
last_name_component rd 1
1420
toolbar_height_old   rd 1
2531
toolbar.height_old  rd 1
1421
 
2532
 
-
 
2533
procinfo        process_information
1422
procinfo    process_information
2534
align 16
1423
align 16
2535
path            rb 4096
1424
path:       rb  4096  ;1024+16
2536
window_header   rb 256
1425
real_header rb  256
2537
window_header_len rd 1
1426
@PARAMS rb 4096  ;512
2538
__params        rb 4096
1427
;---------------------------------------------------------------------
2539
;---------------------------------------------------------------------
1428
sys_path rb 1024
2540
sys_path rb 1024
1429
temp_dir_pach:
2541
temp_dir_path:
1430
        rb 4096
2542
        rb 4096
1431
;---------------------------------------------------------------------
2543
;---------------------------------------------------------------------