Subversion Repositories Kolibri OS

Rev

Rev 7784 | Rev 7862 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7784 Rev 7860
Line 24... Line 24...
24
 
24
 
25
KEY_MOVE_PIXELS   = 50
25
KEY_MOVE_PIXELS   = 50
26
SCROLL_WIDTH_SIZE = 15
26
SCROLL_WIDTH_SIZE = 15
Line 27... Line 27...
27
AR_OFFSET         = 10
27
AR_OFFSET         = 10
28
 
28
 
29
MIN_WINDOW_WIDTH  = 50 + 25*numimages
29
MIN_WINDOW_WIDTH  = 50+25*numimages
30
MIN_WINDOW_HEIGHT = 100
30
MIN_WINDOW_HEIGHT = 100
31
TOOLBAR_HEIGHT    = 31
31
TOOLBAR_HEIGHT    = 31
Line 57... Line 57...
57
        mov     esi, __params
57
        mov     esi, __params
58
        mov     edi, path
58
        mov     edi, path
59
        mov     ecx, 4096/4
59
        mov     ecx, 4096/4
60
        rep     movsd
60
        rep     movsd
61
        mov     byte[edi-1], 0
61
        mov     byte[edi-1], 0
62
    @@:
62
@@:
63
; OpenDialog initialisation
63
; OpenDialog initialisation
64
        push    dword OpenDialog_data
64
        push    dword OpenDialog_data
65
        call    [OpenDialog_Init]
65
        call    [OpenDialog_Init]
Line 66... Line 66...
66
 
66
 
Line 95... Line 95...
95
        mov     byte[edi-1], 0
95
        mov     byte[edi-1], 0
96
        jmp     params_given
96
        jmp     params_given
Line 97... Line 97...
97
 
97
 
98
set_bgr:
98
set_bgr:
99
        mcall   SF_BACKGROUND_SET, SSF_MODE_BG
99
        mcall   SF_BACKGROUND_SET, SSF_MODE_BG
100
        stdcall load_image, __params + 4
100
        stdcall load_image, __params+4
101
        jc      exit
101
        jc      exit
102
        call    set_as_bgr
102
        call    set_as_bgr
Line 103... Line 103...
103
        jmp     exit
103
        jmp     exit
Line 117... Line 117...
117
redraw_all:
117
redraw_all:
118
        call    draw_window
118
        call    draw_window
Line 119... Line 119...
119
 
119
 
120
still:
120
still:
121
        mov     eax, [orig_image]
121
        mov     eax, [orig_image]
122
        test    [eax + Image.Flags], Image.IsAnimated
122
        test    [eax+Image.Flags], Image.IsAnimated
123
        movi    eax, SF_WAIT_EVENT
123
        movi    eax, SF_WAIT_EVENT
124
        jz      .wait_event
124
        jz      .wait_event
125
        mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
125
        mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
126
        mov     edx, [cur_frame]
126
        mov     edx, [cur_frame]
127
        mov     ebx, [cur_frame_time]
127
        mov     ebx, [cur_frame_time]
128
        add     ebx, [edx + Image.Delay]
128
        add     ebx, [edx+Image.Delay]
129
        sub     ebx, eax
129
        sub     ebx, eax
130
        cmp     ebx, [edx + Image.Delay]
130
        cmp     ebx, [edx+Image.Delay]
131
        jna     @f
131
        jna     @f
132
        call    red_update_frame
132
        call    red_update_frame
133
        jmp     still
133
        jmp     still
134
    @@:
134
@@:
135
        test    ebx, ebx
135
        test    ebx, ebx
136
        jnz     @f
136
        jnz     @f
137
        call    red_update_frame
137
        call    red_update_frame
138
        jmp     still
138
        jmp     still
139
    @@:
139
@@:
140
        movi    eax, SF_WAIT_EVENT_TIMEOUT
140
        movi    eax, SF_WAIT_EVENT_TIMEOUT
141
  .wait_event:
141
.wait_event:
142
        mcall   
142
        mcall   
143
        dec     eax
143
        dec     eax
144
        jns     @f
144
        jns     @f
145
        call    red_update_frame
145
        call    red_update_frame
146
        jmp     still
146
        jmp     still
147
    @@:
147
@@:
148
        jz      redraw_all
148
        jz      redraw_all
149
        dec     eax
149
        dec     eax
150
        jz      key
150
        jz      key
151
        dec     eax
151
        dec     eax
Line 152... Line 152...
152
        jz      button
152
        jz      button
-
 
153
 
-
 
154
mouse:
-
 
155
        mov     eax, [need_scrollbar_v]
-
 
156
        add     eax, [need_scrollbar_h]
153
 
157
        test    eax, eax
Line 154... Line 158...
154
mouse:
158
        jz      .done
155
        mov     [pict_moved], 0
159
        mov     [pict_moved], 0
156
 
160
 
Line 167... Line 171...
167
        setnz   ch
171
        setnz   ch
168
        test    ecx, ecx
172
        test    ecx, ecx
169
        jz      @f
173
        jz      @f
170
        call    draw_view
174
        call    draw_view
171
        call    draw_onimage_decorations
175
        call    draw_onimage_decorations
172
    @@:
176
@@:
Line 173... Line 177...
173
 
177
 
174
        ; check for scroll
178
        ; check for scroll
175
        mcall   SF_MOUSE_GET, SSF_SCROLL_DATA
179
        mcall   SF_MOUSE_GET, SSF_SCROLL_DATA
176
        test    eax, eax
180
        test    eax, eax
Line 180... Line 184...
180
        sar     eax, 16
184
        sar     eax, 16
181
        shl     eax, 4
185
        shl     eax, 4
182
        stdcall move_pictport, eax, ecx
186
        stdcall move_pictport, eax, ecx
183
        mov     [pict_moved], eax
187
        mov     [pict_moved], eax
184
        jmp     .mouse_done
188
        jmp     .mouse_done
185
  .no_scroll:
189
.no_scroll:
Line 186... Line 190...
186
 
190
 
187
        ; get cursor coordinates in window
191
        ; get cursor coordinates in window
188
        mcall   SF_MOUSE_GET, SSF_WINDOW_POSITION
192
        mcall   SF_MOUSE_GET, SSF_WINDOW_POSITION
189
        movsx   ebx, ax
193
        movsx   ebx, ax
190
        cmp     ebx, 0
194
        cmp     ebx, 0
191
        jge     @f
195
        jge     @f
192
        add     eax, 0x10000
196
        add     eax, 0x10000
193
    @@:
197
@@:
194
        mov     ecx, [mouse_pos]
198
        mov     ecx, [mouse_pos]
195
        cmp     eax, ecx
199
        cmp     eax, ecx
196
        jz      .no_mouse_move
200
        jz      .no_mouse_move
Line 206... Line 210...
206
        neg     eax
210
        neg     eax
207
        neg     ebx
211
        neg     ebx
208
        stdcall move_pictport, eax, ebx
212
        stdcall move_pictport, eax, ebx
209
        mov     [pict_moved], eax
213
        mov     [pict_moved], eax
210
        jmp     .no_mouse_move
214
        jmp     .no_mouse_move
211
  .no_mouse_move:
215
.no_mouse_move:
Line 212... Line 216...
212
 
216
 
213
        ; check buttons
217
        ; check buttons
214
        mcall   SF_MOUSE_GET, SSF_BUTTON
218
        mcall   SF_MOUSE_GET, SSF_BUTTON
215
        mov     ecx, eax
219
        mov     ecx, eax
216
        xor     ecx, [mouse_buttons]
220
        xor     ecx, [mouse_buttons]
217
        mov     [mouse_buttons], eax
221
        mov     [mouse_buttons], eax
218
        test    ecx, 0x01
222
        test    ecx, 0x01
219
        jz      .left_button_handled
223
        jz      .left_button_handled
220
        test    eax, 0x01
224
        test    eax, 0x01
221
        jnz     .left_button_down
225
        jnz     .left_button_down
222
  .left_button_up:
226
.left_button_up:
223
        mov     [pict_drag], 0
227
        mov     [pict_drag], 0
224
        jmp     .left_button_handled
228
        jmp     .left_button_handled
225
  .left_button_down:
229
.left_button_down:
226
        mov     ecx, [mouse_pos]
230
        mov     ecx, [mouse_pos]
227
        movzx   edx, cx
231
        movzx   edx, cx
228
        sar     ecx, 16
232
        sar     ecx, 16
229
        mov     ebx, [canvas_abs_top]
233
        mov     ebx, [canvas_abs_top]
Line 240... Line 244...
240
        add     ebx, [view.width]
244
        add     ebx, [view.width]
241
        cmp     ebx, ecx
245
        cmp     ebx, ecx
242
        jl      .left_click_pict_done
246
        jl      .left_click_pict_done
243
        mov     [pict_drag], 1
247
        mov     [pict_drag], 1
244
        jmp     .left_button_handled
248
        jmp     .left_button_handled
245
  .left_click_pict_done:
249
.left_click_pict_done:
Line 246... Line 250...
246
 
250
 
247
  .left_button_handled:
251
.left_button_handled:
248
  .mouse_done:
252
.mouse_done:
249
        mov     eax, [pict_moved]
253
        mov     eax, [pict_moved]
250
        test    eax, eax
254
        test    eax, eax
251
        jz      .done
255
        jz      .done
252
        stdcall update_scrollbars, eax
256
        stdcall update_scrollbars, eax
253
        call    draw_view
257
        call    draw_view
254
        call    draw_onimage_decorations
258
        call    draw_onimage_decorations
255
  .done:
259
.done:
Line 256... Line 260...
256
        jmp     still
260
        jmp     still
257
 
261
 
258
key:
262
key:
Line 265... Line 269...
265
        mov     ecx, eax
269
        mov     ecx, eax
266
        mcall   SF_KEYBOARD, SSF_GET_CONTROL_KEYS
270
        mcall   SF_KEYBOARD, SSF_GET_CONTROL_KEYS
267
        mov     edx, next_mod
271
        mov     edx, next_mod
268
        call    check_shortcut
272
        call    check_shortcut
269
        jz      .next
273
        jz      .next
270
        add     edx, prev_mod - next_mod
274
        add     edx, prev_mod-next_mod
271
        call    check_shortcut
275
        call    check_shortcut
272
        jz      .prev
276
        jz      .prev
273
        add     edx, slide_mod - prev_mod
277
        add     edx, slide_mod-prev_mod
274
        call    check_shortcut
278
        call    check_shortcut
275
        jz      .slide
279
        jz      .slide
276
        add     edx, tglbar_mod - slide_mod
280
        add     edx, tglbar_mod-slide_mod
277
        call    check_shortcut
281
        call    check_shortcut
278
        jz      .tglbar
282
        jz      .tglbar
Line 279... Line 283...
279
 
283
 
280
        mov     edx, scale_none_mod
284
        mov     edx, scale_none_mod
281
        call    check_shortcut
285
        call    check_shortcut
282
        jz      .set_scale_none
286
        jz      .set_scale_none
283
        add     edx, scale_fit_min_mod - scale_none_mod
287
        add     edx, scale_fit_min_mod-scale_none_mod
284
        call    check_shortcut
288
        call    check_shortcut
285
        jz      .set_scale_fit_min
289
        jz      .set_scale_fit_min
286
        add     edx, move_pictport_left_1_mod - scale_fit_min_mod
290
        add     edx, move_pictport_left_1_mod-scale_fit_min_mod
287
        call    check_shortcut
291
        call    check_shortcut
288
        jz      .move_pictport_left
292
        jz      .move_pictport_left
289
        add     edx, move_pictport_left_2_mod - move_pictport_left_1_mod
293
        add     edx, move_pictport_left_2_mod-move_pictport_left_1_mod
290
        call    check_shortcut
294
        call    check_shortcut
291
        jz      .move_pictport_left
295
        jz      .move_pictport_left
292
        add     edx, move_pictport_right_1_mod - move_pictport_left_2_mod
296
        add     edx, move_pictport_right_1_mod-move_pictport_left_2_mod
293
        call    check_shortcut
297
        call    check_shortcut
294
        jz      .move_pictport_right
298
        jz      .move_pictport_right
295
        add     edx, move_pictport_right_2_mod - move_pictport_right_1_mod
299
        add     edx, move_pictport_right_2_mod-move_pictport_right_1_mod
296
        call    check_shortcut
300
        call    check_shortcut
297
        jz      .move_pictport_right
301
        jz      .move_pictport_right
298
        add     edx, move_pictport_up_1_mod - move_pictport_right_2_mod
302
        add     edx, move_pictport_up_1_mod-move_pictport_right_2_mod
299
        call    check_shortcut
303
        call    check_shortcut
300
        jz      .move_pictport_up
304
        jz      .move_pictport_up
301
        add     edx, move_pictport_up_2_mod - move_pictport_up_1_mod
305
        add     edx, move_pictport_up_2_mod-move_pictport_up_1_mod
302
        call    check_shortcut
306
        call    check_shortcut
303
        jz      .move_pictport_up
307
        jz      .move_pictport_up
304
        add     edx, move_pictport_down_1_mod - move_pictport_up_2_mod
308
        add     edx, move_pictport_down_1_mod-move_pictport_up_2_mod
305
        call    check_shortcut
309
        call    check_shortcut
306
        jz      .move_pictport_down
310
        jz      .move_pictport_down
307
        add     edx, move_pictport_down_2_mod - move_pictport_down_1_mod
311
        add     edx, move_pictport_down_2_mod-move_pictport_down_1_mod
308
        call    check_shortcut
312
        call    check_shortcut
Line 309... Line 313...
309
        jz      .move_pictport_down
313
        jz      .move_pictport_down
310
 
314
 
311
        cmp     cl, 1 ; Esc
315
        cmp     cl, 1 ; Esc
312
        jz      .esc
316
        jz      .esc
313
        jmp     keyloop
317
        jmp     keyloop
314
  .esc:
318
.esc:
315
        test    [bSlideShow], 1
319
        test    [bSlideShow], 1
316
        jz      keyloop
320
        jz      keyloop
317
        jmp     .slide
321
        jmp     .slide
318
  .tglbar:
322
.tglbar:
319
        bt      [window_style], 25
323
        bt      [window_style], 25
320
        jnc     @f
324
        jnc     @f
321
        mov     [bToggleToolbar], 1
325
        mov     [bToggleToolbar], 1
322
        xor     [bShowToolbar], 1
326
        xor     [bShowToolbar], 1
323
    @@:
327
@@:
324
        jmp     keyloop
328
        jmp     keyloop
325
  .slide:
329
.slide:
326
        call    slide_show
330
        call    slide_show
327
        jmp     keyloop
331
        jmp     keyloop
328
  .set_scale_none:
332
.set_scale_none:
329
        mov     eax, LIBIMG_SCALE_NONE
333
        mov     eax, LIBIMG_SCALE_NONE
330
        call    set_scale_mode
334
        call    set_scale_mode
331
        jz      @f
335
        jz      @f
332
        call    recalc_canvas
336
        call    recalc_canvas
333
    @@:
337
@@:
334
        jmp     keyloop
338
        jmp     keyloop
335
  .set_scale_fit_min:
339
.set_scale_fit_min:
336
        mov     eax, LIBIMG_SCALE_FIT_MIN
340
        mov     eax, LIBIMG_SCALE_FIT_MIN
337
        call    set_scale_mode
341
        call    set_scale_mode
338
        jz      @f
342
        jz      @f
339
        call    recalc_work
343
        call    recalc_work
340
    @@:
344
@@:
341
        jmp     keyloop
345
        jmp     keyloop
342
  .move_pictport_left:
346
.move_pictport_left:
343
        stdcall move_pictport, -KEY_MOVE_PIXELS, 0
347
        stdcall move_pictport, -KEY_MOVE_PIXELS, 0
344
        stdcall update_scrollbars, eax
348
        stdcall update_scrollbars, eax
345
        call    draw_view
349
        call    draw_view
346
        call    draw_onimage_decorations
350
        call    draw_onimage_decorations
347
        jmp     keyloop
351
        jmp     keyloop
348
  .move_pictport_right:
352
.move_pictport_right:
349
        stdcall move_pictport, KEY_MOVE_PIXELS, 0
353
        stdcall move_pictport, KEY_MOVE_PIXELS, 0
350
        stdcall update_scrollbars, eax
354
        stdcall update_scrollbars, eax
351
        call    draw_view
355
        call    draw_view
352
        call    draw_onimage_decorations
356
        call    draw_onimage_decorations
353
        jmp     keyloop
357
        jmp     keyloop
354
  .move_pictport_up:
358
.move_pictport_up:
355
        stdcall move_pictport, 0, -KEY_MOVE_PIXELS
359
        stdcall move_pictport, 0, -KEY_MOVE_PIXELS
356
        stdcall update_scrollbars, eax
360
        stdcall update_scrollbars, eax
357
        call    draw_view
361
        call    draw_view
358
        call    draw_onimage_decorations
362
        call    draw_onimage_decorations
359
        jmp     keyloop
363
        jmp     keyloop
360
  .move_pictport_down:
364
.move_pictport_down:
361
        stdcall move_pictport, 0, KEY_MOVE_PIXELS
365
        stdcall move_pictport, 0, KEY_MOVE_PIXELS
362
        stdcall update_scrollbars, eax
366
        stdcall update_scrollbars, eax
363
        call    draw_view
367
        call    draw_view
364
        call    draw_onimage_decorations
368
        call    draw_onimage_decorations
365
        jmp     keyloop
369
        jmp     keyloop
366
  .prev:
370
.prev:
367
        dec     esi
371
        dec     esi
368
        jmp     keyloop
372
        jmp     keyloop
369
  .next:
373
.next:
370
        inc     esi
374
        inc     esi
371
        jmp     keyloop
375
        jmp     keyloop
372
keyloopdone:
376
keyloopdone:
Line 388... Line 392...
388
        call    next_or_prev_image
392
        call    next_or_prev_image
389
        jmp     redraw_all
393
        jmp     redraw_all
Line 390... Line 394...
390
 
394
 
391
red_update_frame:
395
red_update_frame:
392
        mov     eax, [cur_frame]
396
        mov     eax, [cur_frame]
393
        mov     eax, [eax + Image.Next]
397
        mov     eax, [eax+Image.Next]
394
        test    eax, eax
398
        test    eax, eax
395
        jnz     @f
399
        jnz     @f
396
        mov     eax, [cur_image]
400
        mov     eax, [cur_image]
397
    @@:
401
@@:
398
        mov     [cur_frame], eax
402
        mov     [cur_frame], eax
399
        mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
403
        mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
400
        mov     [cur_frame_time], eax
404
        mov     [cur_frame_time], eax
401
        call    draw_view
405
        call    draw_view
Line 411... Line 415...
411
 
415
 
412
        mov     eax, [cur_image]
416
        mov     eax, [cur_image]
413
        cmp     eax, [orig_image]
417
        cmp     eax, [orig_image]
414
        jz      @f
418
        jz      @f
415
        invoke  img.flip, [cur_image], FLIP_HORIZONTAL
419
        invoke  img.flip, [cur_image], FLIP_HORIZONTAL
416
    @@:
420
@@:
417
        invoke  img.flip, [orig_image], FLIP_HORIZONTAL
421
        invoke  img.flip, [orig_image], FLIP_HORIZONTAL
Line 418... Line 422...
418
        jmp     redraw_all
422
        jmp     redraw_all
419
 
423
 
420
        ; flip vertically
424
        ; flip vertically
421
  .not_flh:
425
.not_flh:
Line 422... Line 426...
422
        cmp     eax, 'flv'
426
        cmp     eax, 'flv'
423
        jnz     .not_flv
427
        jnz     .not_flv
424
 
428
 
425
        mov     eax, [cur_image]
429
        mov     eax, [cur_image]
426
        cmp     eax, [orig_image]
430
        cmp     eax, [orig_image]
427
        jz      @f
431
        jz      @f
428
        invoke  img.flip, [cur_image], FLIP_VERTICAL
432
        invoke  img.flip, [cur_image], FLIP_VERTICAL
Line 429... Line 433...
429
    @@:
433
@@:
430
        invoke  img.flip, [orig_image], FLIP_VERTICAL
434
        invoke  img.flip, [orig_image], FLIP_VERTICAL
431
        jmp     redraw_all
435
        jmp     redraw_all
432
 
436
 
Line 433... Line 437...
433
        ; flip both horizontally and vertically
437
        ; flip both horizontally and vertically
434
  .not_flv:
438
.not_flv:
435
        cmp     eax, 'flb'
439
        cmp     eax, 'flb'
436
        jnz     .not_flb
440
        jnz     .not_flb
437
 
441
 
438
        mov     eax, [cur_image]
442
        mov     eax, [cur_image]
439
        cmp     eax, [orig_image]
443
        cmp     eax, [orig_image]
Line 440... Line 444...
440
        jz      @f
444
        jz      @f
441
        invoke  img.flip, [cur_image], FLIP_BOTH
445
        invoke  img.flip, [cur_image], FLIP_BOTH
442
    @@:
446
@@:
443
        invoke  img.flip, [orig_image], FLIP_BOTH
447
        invoke  img.flip, [orig_image], FLIP_BOTH
Line 444... Line 448...
444
        jmp     redraw_all
448
        jmp     redraw_all
445
 
449
 
446
        ; rotate left
450
        ; rotate left
447
  .not_flb:
451
.not_flb:
448
        cmp     eax, 'rtl'
452
        cmp     eax, 'rtl'
449
        jnz     .not_rtl
453
        jnz     .not_rtl
450
 
454
 
451
        push    ROTATE_90_CCW
455
        push    ROTATE_90_CCW
452
  .rotate_common:
456
.rotate_common:
453
        mov     eax, [cur_image]
457
        mov     eax, [cur_image]
Line 454... Line 458...
454
        cmp     eax, [orig_image]
458
        cmp     eax, [orig_image]
455
        jz      @f
459
        jz      @f
456
        invoke  img.destroy, [cur_image]
460
        invoke  img.destroy, [cur_image]
457
        mov     [cur_image], 0
461
        mov     [cur_image], 0
Line 458... Line 462...
458
    @@:
462
@@:
459
        invoke  img.rotate, [orig_image]
463
        invoke  img.rotate, [orig_image]
Line 460... Line 464...
460
        jmp     redraw_all
464
        jmp     redraw_all
461
 
465
 
462
        ; rotate right
466
        ; rotate right
463
  .not_rtl:
467
.not_rtl:
Line 464... Line 468...
464
        cmp     eax, 'rtr'
468
        cmp     eax, 'rtr'
465
        jnz     .not_rtr
469
        jnz     .not_rtr
Line 495... Line 499...
495
        stdcall load_image, eax
499
        stdcall load_image, eax
496
        jc      .restore_old
500
        jc      .restore_old
497
        call    free_directory
501
        call    free_directory
498
        jmp     redraw_all
502
        jmp     redraw_all
Line 499... Line 503...
499
 
503
 
500
  .restore_old:
504
.restore_old:
501
        pop     eax
505
        pop     eax
Line 502... Line 506...
502
        jmp     still
506
        jmp     still
503
 
507
 
504
        ; set background
508
        ; set background
505
    @@:
509
@@:
Line 506... Line 510...
506
        cmp     eax, 'bgr'
510
        cmp     eax, 'bgr'
507
        jnz     @f
511
        jnz     @f
508
 
512
 
Line 509... Line 513...
509
        mcall   SF_BACKGROUND_SET, SSF_MODE_BG, 2 ; stretch by default
513
        mcall   SF_BACKGROUND_SET, SSF_MODE_BG, 2 ; stretch by default
510
        call    set_as_bgr
514
        call    set_as_bgr
511
        jmp     still
515
        jmp     still
Line 512... Line 516...
512
 
516
 
513
    @@:
517
@@:
Line 514... Line 518...
514
        cmp     eax, 'sld'
518
        cmp     eax, 'sld'
-
 
519
        jnz     @f
-
 
520
 
-
 
521
        call    slide_show
-
 
522
        jmp     redraw_all
-
 
523
 
-
 
524
@@:
-
 
525
        cmp     eax, 'scl'
-
 
526
        jnz     .not_scl
-
 
527
        mov     eax, LIBIMG_SCALE_NONE
-
 
528
        cmp     [scale_mode], LIBIMG_SCALE_NONE
-
 
529
        jnz     @f
-
 
530
        mov     eax, LIBIMG_SCALE_FIT_MIN
-
 
531
@@:
515
        jnz     @f
532
        call    set_scale_mode
516
 
533
        jz      @f
517
        call    slide_show
534
        call    recalc_work
518
        jmp     redraw_all
535
@@:
519
 
536
        jmp     redraw_all
Line 537... Line 554...
537
        invoke  img.from_file, [_filename]
554
        invoke  img.from_file, [_filename]
538
        test    eax, eax
555
        test    eax, eax
539
        jz      .error
556
        jz      .error
540
        mov     ebx, eax
557
        mov     ebx, eax
Line 541... Line 558...
541
 
558
 
542
        test    [eax + Image.Flags], Image.IsAnimated
559
        test    [eax+Image.Flags], Image.IsAnimated
543
        jnz     @f
560
        jnz     @f
544
        cmp     [eax + Image.Next], 0
561
        cmp     [eax+Image.Next], 0
545
        jz      @f
562
        jz      @f
546
        stdcall merge_icons_to_single_img, eax
563
        stdcall merge_icons_to_single_img, eax
547
        test    eax, eax
564
        test    eax, eax
548
        jz      .error_destroy
565
        jz      .error_destroy
549
    @@:
566
@@:
550
        stdcall init_frame, eax
567
        stdcall init_frame, eax
551
        clc
568
        clc
Line 552... Line 569...
552
        jmp     .exit
569
        jmp     .exit
553
 
570
 
554
  .error_destroy:
571
.error_destroy:
555
        invoke  img.destroy, ebx
572
        invoke  img.destroy, ebx
556
        xor     eax, eax
573
        xor     eax, eax
557
  .error:
574
.error:
558
        stc
575
        stc
559
  .exit:
576
.exit:
560
        pop     edi esi ebx
577
        pop     edi esi ebx
Line 561... Line 578...
561
        ret
578
        ret
562
endp
579
endp
563
 
580
 
564
 
581
 
565
; in:  eax -- pointer to image
582
; in:  eax -- pointer to image
566
; out: fill pict structure
583
; out: fill pict structure
567
proc calculate_picture_size
584
proc calculate_picture_size
568
        mov     edx, [eax + Image.Width]
585
        mov     edx, [eax+Image.Width]
569
        test    [eax + Image.Flags], Image.IsAnimated
586
        test    [eax+Image.Flags], Image.IsAnimated
570
        jnz     .not_in_row
587
        jnz     .not_in_row
571
        push    eax
588
        push    eax
572
    @@:
589
@@:
573
        cmp     [eax + Image.Next], 0
590
        cmp     [eax+Image.Next], 0
574
        jz      @f
591
        jz      @f
575
        mov     eax, [eax + Image.Next]
592
        mov     eax, [eax+Image.Next]
576
        add     edx, [eax + Image.Width]
593
        add     edx, [eax+Image.Width]
577
        inc     edx
594
        inc     edx
578
        jmp     @b
595
        jmp     @b
579
    @@:
596
@@:
580
        pop     eax
597
        pop     eax
581
  .not_in_row:
598
.not_in_row:
582
        mov     [pict.width], edx
599
        mov     [pict.width], edx
583
        add     edx, 19
600
        add     edx, 19
584
        cmp     edx, 50 + 25*numimages
601
        cmp     edx, 50+25*numimages
585
        jae     @f
602
        jae     @f
586
        mov     edx, 50 + 25*numimages
603
        mov     edx, 50+25*numimages
587
    @@:
604
@@:
588
        mov     esi, [eax + Image.Height]
605
        mov     esi, [eax+Image.Height]
589
        test    [eax + Image.Flags], Image.IsAnimated
606
        test    [eax+Image.Flags], Image.IsAnimated
590
        jnz     .max_equals_first
607
        jnz     .max_equals_first
591
        push    eax
608
        push    eax
592
    @@:
609
@@:
593
        cmp     [eax + Image.Next], 0
610
        cmp     [eax+Image.Next], 0
594
        jz      @f
611
        jz      @f
595
        mov     eax, [eax + Image.Next]
612
        mov     eax, [eax+Image.Next]
596
        cmp     esi, [eax + Image.Height]
613
        cmp     esi, [eax+Image.Height]
597
        jae     @b
614
        jae     @b
598
        mov     esi, [eax + Image.Height]
615
        mov     esi, [eax+Image.Height]
599
        jmp     @b
616
        jmp     @b
600
    @@:
617
@@:
601
        pop     eax
618
        pop     eax
Line 602... Line 619...
602
  .max_equals_first:
619
.max_equals_first:
603
        mov     [pict.height], esi
620
        mov     [pict.height], esi
604
        ret
621
        ret
605
endp
622
endp
606
 
623
 
607
 
624
 
608
; in:  [orig_image]
625
; in:  [orig_image]
609
proc set_as_bgr
626
proc set_as_bgr
610
        mov     esi, [orig_image]
627
        mov     esi, [orig_image]
Line 611... Line 628...
611
        mov     ecx, [esi + Image.Width]
628
        mov     ecx, [esi+Image.Width]
612
        mov     edx, [esi + Image.Height]
629
        mov     edx, [esi+Image.Height]
613
        mcall   SF_BACKGROUND_SET, SSF_SIZE_BG
630
        mcall   SF_BACKGROUND_SET, SSF_SIZE_BG
614
        mcall   SF_BACKGROUND_SET, SSF_MAP_BG
631
        mcall   SF_BACKGROUND_SET, SSF_MAP_BG
Line 615... Line 632...
615
        test    eax, eax
632
        test    eax, eax
616
        jz      @f
633
        jz      @f
617
 
634
 
618
        push    eax
635
        push    eax
619
        invoke  img.to_rgb2, esi, eax
636
        invoke  img.to_rgb2, esi, eax
620
        pop     ecx
637
        pop     ecx
Line 639... Line 656...
639
        mov     ecx, 4096/4-1
656
        mov     ecx, 4096/4-1
640
        std
657
        std
641
        rep movsd
658
        rep movsd
642
        cld
659
        cld
643
        mov     dword[__params], '\S__'
660
        mov     dword[__params], '\S__'
644
    @@:
661
@@:
645
        xor     al, al
662
        xor     al, al
646
        mov     ecx, 4096
663
        mov     ecx, 4096
647
        mov     edi, __params
664
        mov     edi, __params
648
        repne scasb
665
        repne scasb
649
        sub     edi, __params+1
666
        sub     edi, __params+1
Line 662... Line 679...
662
        mov     [bShowToolbar], al
679
        mov     [bShowToolbar], al
663
        mov     [canvas_padding], CANVAS_PADDING
680
        mov     [canvas_padding], CANVAS_PADDING
664
        mov     [bg_color], 0x00ffffff
681
        mov     [bg_color], 0x00ffffff
665
        mcall   SF_CHANGE_WINDOW, [window_save.left], [window_save.top], [window_save.width], [window_save.height]
682
        mcall   SF_CHANGE_WINDOW, [window_save.left], [window_save.top], [window_save.width], [window_save.height]
666
        jmp     .done
683
        jmp     .done
667
  .to_fullscreen:
684
.to_fullscreen:
668
        stdcall copy_box, window, window_save
685
        stdcall copy_box, window, window_save
669
        movzx   eax, [bShowToolbar]
686
        movzx   eax, [bShowToolbar]
670
        mov     [bShowToolbarSave], al
687
        mov     [bShowToolbarSave], al
671
        mov     [bShowToolbar], 0
688
        mov     [bShowToolbar], 0
672
        mov     [canvas_padding], 0
689
        mov     [canvas_padding], 0
Line 678... Line 695...
678
        mov     esi, eax
695
        mov     esi, eax
679
        mcall   SF_CHANGE_WINDOW, 0, 0, ,
696
        mcall   SF_CHANGE_WINDOW, 0, 0, ,
680
        mov     eax, LIBIMG_SCALE_FIT_MIN
697
        mov     eax, LIBIMG_SCALE_FIT_MIN
681
        call    set_scale_mode
698
        call    set_scale_mode
Line 682... Line 699...
682
 
699
 
683
  .done:
700
.done:
684
        pop     edi esi ebx
701
        pop     edi esi ebx
685
        ret
702
        ret
Line 686... Line 703...
686
endp
703
endp
687
 
704
 
688
 
705
 
689
; seek to ESI image files
706
; seek to ESI image files
690
; esi>0 means next file, esi<0 - prev file
707
; esi>0 means next file, esi<0-prev file
691
proc next_or_prev_image
708
proc next_or_prev_image
692
locals
709
locals
Line 708... Line 725...
708
        cmp     eax, -1
725
        cmp     eax, -1
709
        jnz     @f
726
        jnz     @f
710
        test    esi, esi
727
        test    esi, esi
711
        jns     @f
728
        jns     @f
712
        mov     eax, [files_cnt]
729
        mov     eax, [files_cnt]
713
    @@:
730
@@:
714
        add     eax, esi
731
        add     eax, esi
715
    @@:
732
@@:
716
        test    eax, eax
733
        test    eax, eax
717
        jns     @f
734
        jns     @f
718
        add     eax, [files_cnt]
735
        add     eax, [files_cnt]
719
        jmp     @b
736
        jmp     @b
720
    @@:
737
@@:
721
        cmp     eax, [files_cnt]
738
        cmp     eax, [files_cnt]
722
        jb      @f
739
        jb      @f
723
        sub     eax, [files_cnt]
740
        sub     eax, [files_cnt]
724
        jmp     @b
741
        jmp     @b
725
    @@:
742
@@:
726
        mov     [file_idx], eax
743
        mov     [file_idx], eax
727
  .scanloop:
744
.scanloop:
728
        push    eax esi
745
        push    eax esi
729
        imul    esi, eax, 304
746
        imul    esi, eax, 304
730
        add     esi, [directory_ptr]
747
        add     esi, [directory_ptr]
731
        add     esi, 32 + 40
748
        add     esi, 32+40
732
        mov     edi, curdir
749
        mov     edi, curdir
733
    @@:
750
@@:
734
        inc     edi
751
        inc     edi
735
        cmp     byte[edi-1], 0
752
        cmp     byte[edi-1], 0
736
        jnz     @b
753
        jnz     @b
737
        mov     byte[edi-1], '/'
754
        mov     byte[edi-1], '/'
738
    @@:
755
@@:
739
        lodsb
756
        lodsb
740
        stosb
757
        stosb
741
        test    al, al
758
        test    al, al
742
        jnz     @b
759
        jnz     @b
743
        mov     esi, curdir
760
        mov     esi, curdir
Line 747... Line 764...
747
        rep movsd
764
        rep movsd
748
        mov     byte[edi-1], 0
765
        mov     byte[edi-1], 0
749
        pop     esi
766
        pop     esi
750
        stdcall load_image, curdir
767
        stdcall load_image, curdir
751
        pushfd
768
        pushfd
752
    @@:
769
@@:
753
        lodsb
770
        lodsb
754
        test    al, al
771
        test    al, al
755
        jnz     @b
772
        jnz     @b
756
    @@:
773
@@:
757
        dec     esi
774
        dec     esi
758
        cmp     byte[esi], '/'
775
        cmp     byte[esi], '/'
759
        jnz     @b
776
        jnz     @b
760
        mov     byte[esi], 0
777
        mov     byte[esi], 0
761
        popfd
778
        popfd
762
        pop     esi eax
779
        pop     esi eax
763
        jnc     .loadedok
780
        jnc     .loadedok
764
        test    esi, esi
781
        test    esi, esi
765
        js      .try_prev
782
        js      .try_prev
766
  .try_next:
783
.try_next:
767
        inc     eax
784
        inc     eax
768
        cmp     eax, [files_cnt]
785
        cmp     eax, [files_cnt]
769
        jb      @f
786
        jb      @f
770
        xor     eax, eax
787
        xor     eax, eax
771
    @@:
788
@@:
772
  .try_common:
789
.try_common:
773
        cmp     eax, [file_idx]
790
        cmp     eax, [file_idx]
774
        jz      .notfound
791
        jz      .notfound
775
        jmp     .scanloop
792
        jmp     .scanloop
776
  .try_prev:
793
.try_prev:
777
        dec     eax
794
        dec     eax
778
        jns     @f
795
        jns     @f
779
        mov     eax, [files_cnt]
796
        mov     eax, [files_cnt]
780
        dec     eax
797
        dec     eax
781
    @@:
798
@@:
782
        jmp     .try_common
799
        jmp     .try_common
783
  .loadedok:
800
.loadedok:
784
        mov     [cur_file_idx], eax
801
        mov     [cur_file_idx], eax
785
  .ret:
802
.ret:
786
        pop     edi esi ebx
803
        pop     edi esi ebx
787
        ret
804
        ret
788
  .notfound:
805
.notfound:
789
        pop     edi esi ebx
806
        pop     edi esi ebx
790
        ret
807
        ret
791
endp
808
endp
Line 799... Line 816...
799
        mov     ecx, [last_name_component]
816
        mov     ecx, [last_name_component]
800
        sub     ecx, esi
817
        sub     ecx, esi
801
        dec     ecx
818
        dec     ecx
802
        js      @f
819
        js      @f
803
        rep     movsb
820
        rep     movsb
804
    @@:
821
@@:
805
        mov     byte[edi], 0
822
        mov     byte[edi], 0
806
        mcall   68, 12, 0x1000
823
        mcall   68, 12, 0x1000
807
        test    eax, eax
824
        test    eax, eax
808
        jz      .ret
825
        jz      .ret
809
        mov     ebx, readdir_fileinfo
826
        mov     ebx, readdir_fileinfo
810
        mov     dword[ebx+12], (0x1000 - 32) / 304      ; blocks to read
827
        mov     dword[ebx+12], (0x1000-32) / 304      ; blocks to read
811
        mov     dword[ebx+16], eax      ; where to store
828
        mov     dword[ebx+16], eax      ; where to store
812
        mcall   70
829
        mcall   70
813
        cmp     eax, 6  ; read ok, but there are more files
830
        cmp     eax, 6  ; read ok, but there are more files
814
        jz      .dirok
831
        jz      .dirok
815
        test    eax, eax
832
        test    eax, eax
Line 822... Line 839...
822
        mcall   68, 20          ; realloc
839
        mcall   68, 20          ; realloc
823
        test    eax, eax
840
        test    eax, eax
824
        jz      free_directory
841
        jz      free_directory
825
        mov     [directory_ptr], eax
842
        mov     [directory_ptr], eax
826
        mcall   70, readdir_fileinfo
843
        mcall   70, readdir_fileinfo
827
  .dirok:
844
.dirok:
828
        cmp     ebx, 0
845
        cmp     ebx, 0
829
        jle     free_directory
846
        jle     free_directory
830
        mov     eax, [directory_ptr]
847
        mov     eax, [directory_ptr]
831
        mov     edi, [eax + 8]  ; total number of files
848
        mov     edi, [eax+8]  ; total number of files
832
        mov     [files_num], edi
849
        mov     [files_num], edi
833
        add     eax, 32         ; skip header
850
        add     eax, 32         ; skip header
834
        mov     edi, eax
851
        mov     edi, eax
835
        push    0
852
        push    0
836
  .dirskip:
853
.dirskip:
837
        push    eax
854
        push    eax
838
        test    byte[eax], 0x18 ; volume label or folder
855
        test    byte[eax], 0x18 ; volume label or folder
839
        jnz     .nocopy
856
        jnz     .nocopy
840
        lea     esi, [eax+40]   ; name
857
        lea     esi, [eax+40]   ; name
841
        mov     ecx, esi
858
        mov     ecx, esi
842
    @@:
859
@@:
843
        lodsb
860
        lodsb
844
        test    al, al
861
        test    al, al
845
        jnz     @b
862
        jnz     @b
846
    @@:
863
@@:
847
        dec     esi
864
        dec     esi
848
        cmp     esi, ecx
865
        cmp     esi, ecx
849
        jb      .noext
866
        jb      .noext
850
        cmp     byte[esi], '.'
867
        cmp     byte[esi], '.'
851
        jnz     @b
868
        jnz     @b
Line 884... Line 901...
884
        jz      .copy
901
        jz      .copy
885
        cmp     ecx, 'tif'
902
        cmp     ecx, 'tif'
886
        jz      .copy
903
        jz      .copy
887
        cmp     ecx, 'xbm'
904
        cmp     ecx, 'xbm'
888
        jz      .copy
905
        jz      .copy
889
  .not_3:
906
.not_3:
890
        cmp     byte[esi+4], 0
907
        cmp     byte[esi+4], 0
891
        jnz     .nocopy
908
        jnz     .nocopy
892
        or      ecx, 0x20202020
909
        or      ecx, 0x20202020
893
        cmp     ecx, 'tiff'
910
        cmp     ecx, 'tiff'
894
        jz      @f
911
        jz      @f
Line 896... Line 913...
896
        jz      @f
913
        jz      @f
897
        cmp     ecx, 'webp'
914
        cmp     ecx, 'webp'
898
        jz      @f
915
        jz      @f
899
        cmp     ecx, 'jpeg'
916
        cmp     ecx, 'jpeg'
900
        jnz     .nocopy
917
        jnz     .nocopy
901
    @@:
918
@@:
902
        cmp     byte[esi+4], 0
919
        cmp     byte[esi+4], 0
903
        jnz     .nocopy
920
        jnz     .nocopy
904
  .copy:
921
.copy:
905
        mov     esi, [esp]
922
        mov     esi, [esp]
906
        mov     ecx, 304 / 4
923
        mov     ecx, 304 / 4
907
        rep     movsd
924
        rep     movsd
908
        inc     dword[esp+4]
925
        inc     dword[esp+4]
909
  .nocopy:
926
.nocopy:
910
  .noext:
927
.noext:
911
        pop     eax
928
        pop     eax
912
        add     eax, 304
929
        add     eax, 304
913
        dec     ebx
930
        dec     ebx
914
        jnz     .dirskip
931
        jnz     .dirskip
915
        mov     eax, [directory_ptr]
932
        mov     eax, [directory_ptr]
Line 922... Line 939...
922
        add     eax, 32
939
        add     eax, 32
923
        push    eax
940
        push    eax
924
        call    [SortDir]
941
        call    [SortDir]
925
        xor     eax, eax
942
        xor     eax, eax
926
        mov     edi, [directory_ptr]
943
        mov     edi, [directory_ptr]
927
        add     edi, 32 + 40    ; name
944
        add     edi, 32+40    ; name
928
  .scan:
945
.scan:
929
        mov     esi, [last_name_component]
946
        mov     esi, [last_name_component]
930
        push    edi
947
        push    edi
931
        invoke  strcmpi
948
        invoke  strcmpi
932
        pop     edi
949
        pop     edi
933
        jz      .found
950
        jz      .found
934
        inc     eax
951
        inc     eax
935
        add     edi, 304
952
        add     edi, 304
936
        dec     ebx
953
        dec     ebx
937
        jnz     .scan
954
        jnz     .scan
938
        or      eax, -1
955
        or      eax, -1
939
  .found:
956
.found:
940
        mov     [cur_file_idx], eax
957
        mov     [cur_file_idx], eax
941
  .ret:
958
.ret:
942
        ret
959
        ret
Line 943... Line 960...
943
 
960
 
944
free_directory:
961
free_directory:
945
        mcall   68, 13, [directory_ptr]
962
        mcall   68, 13, [directory_ptr]
Line 949... Line 966...
949
 
966
 
950
; in: esi->full name (e.g. /path/to/file.png)
967
; in: esi->full name (e.g. /path/to/file.png)
951
; out: [last_name_component]->last component (e.g. file.png)
968
; out: [last_name_component]->last component (e.g. file.png)
952
proc find_last_name_component
969
proc find_last_name_component
953
        mov     ecx, esi
970
        mov     ecx, esi
954
    @@:
971
@@:
955
        lodsb
972
        lodsb
956
        test    al, al
973
        test    al, al
957
        jnz     @b
974
        jnz     @b
958
    @@:
975
@@:
959
        dec     esi
976
        dec     esi
960
        cmp     esi, ecx
977
        cmp     esi, ecx
961
        jb      @f
978
        jb      @f
962
        cmp     byte[esi], '/'
979
        cmp     byte[esi], '/'
963
        jnz     @b
980
        jnz     @b
964
    @@:
981
@@:
965
        inc     esi
982
        inc     esi
966
        mov     [last_name_component], esi
983
        mov     [last_name_component], esi
967
        ret
984
        ret
Line 968... Line 985...
968
endp
985
endp
969
 
-
 
970
 
986
 
971
proc init_frame _img
987
 
972
        push    ebx edx
988
proc init_frame uses ebx edx, _img
973
        mov     eax, [orig_image]
989
        mov     eax, [orig_image]
974
        cmp     eax, [_img]
990
        cmp     eax, [_img]
975
        jz      .exit
991
        jz      .exit
976
        test    eax, eax
992
        test    eax, eax
977
        jz      .freed
993
        jz      .freed
978
        cmp     eax, [cur_image]
994
        cmp     eax, [cur_image]
979
        jz      @f
995
        jz      @f
980
        invoke  img.destroy, [orig_image]
996
        invoke  img.destroy, [orig_image]
Line 981... Line 997...
981
    @@:
997
@@:
982
        invoke  img.destroy, [cur_image]
998
        invoke  img.destroy, [cur_image]
983
  .freed:
999
.freed:
984
 
1000
 
985
        mov     [bNewImage], 1
1001
        mov     [bNewImage], 1
986
        mov     eax, [_img]
1002
        mov     eax, [_img]
987
        mov     [orig_image], eax
1003
        mov     [orig_image], eax
988
        mov     [cur_image], eax
1004
        mov     [cur_image], eax
989
        mov     [cur_frame], eax
1005
        mov     [cur_frame], eax
990
        test    byte[eax + Image.Flags], Image.IsAnimated
1006
        test    byte[eax+Image.Flags], Image.IsAnimated
991
        jz      @f
1007
        jz      @f
992
        push    ebx
1008
        push    ebx
993
        mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
1009
        mcall   SF_SYSTEM_GET, SSF_TIME_COUNT
994
        pop     ebx
1010
        pop     ebx
995
        mov     [cur_frame_time], eax
1011
        mov     [cur_frame_time], eax
996
    @@:
-
 
997
        mov     [pict.top], 0
1012
@@:
998
        mov     [pict.left], 0
1013
        mov     [pict.top], 0
Line 999... Line 1014...
999
  .exit:
1014
        mov     [pict.left], 0
Line 1012... Line 1027...
1012
        mov     esi, -1
1027
        mov     esi, -1
1013
        cmp     [procinfo.box.width], MIN_WINDOW_WIDTH
1028
        cmp     [procinfo.box.width], MIN_WINDOW_WIDTH
1014
        ja      @f
1029
        ja      @f
1015
        mov     edx, MIN_WINDOW_WIDTH
1030
        mov     edx, MIN_WINDOW_WIDTH
1016
        inc     eax
1031
        inc     eax
1017
    @@:
1032
@@:
1018
        cmp     [procinfo.box.height], MIN_WINDOW_HEIGHT
1033
        cmp     [procinfo.box.height], MIN_WINDOW_HEIGHT
1019
        ja      @f
1034
        ja      @f
1020
        mov     esi, MIN_WINDOW_HEIGHT
1035
        mov     esi, MIN_WINDOW_HEIGHT
1021
        inc     eax
1036
        inc     eax
1022
    @@:
1037
@@:
1023
        test    eax, eax
1038
        test    eax, eax
1024
        jz      @f
1039
        jz      @f
1025
        mcall   SF_CHANGE_WINDOW, -1, -1, , 
1040
        mcall   SF_CHANGE_WINDOW, -1, -1, , 
1026
    @@:
1041
@@:
Line 1027... Line 1042...
1027
 
1042
 
1028
  .min_size_ok:
1043
.min_size_ok:
1029
        test    [bNewImage], 1
1044
        test    [bNewImage], 1
1030
        jz      @f
1045
        jz      @f
1031
        call    generate_window_header
1046
        call    generate_window_header
1032
    @@:
1047
@@:
1033
        mcall   SF_REDRAW, SSF_BEGIN_DRAW
1048
        mcall   SF_REDRAW, SSF_BEGIN_DRAW
1034
        mov     ecx, [window.top]
1049
        mov     ecx, [window.top]
1035
        shl     ecx, 16
1050
        shl     ecx, 16
1036
        mov     cx, word[window.height]
1051
        mov     cx, word[window.height]
Line 1059... Line 1074...
1059
        jnz     .recalc
1074
        jnz     .recalc
1060
        test    [bToggleToolbar], 1
1075
        test    [bToggleToolbar], 1
1061
        jnz     .recalc
1076
        jnz     .recalc
1062
        jmp     .recalc_done
1077
        jmp     .recalc_done
Line 1063... Line 1078...
1063
 
1078
 
1064
  .recalc:
1079
.recalc:
1065
        stdcall recalc_window
1080
        stdcall recalc_window
Line 1066... Line 1081...
1066
  .recalc_done:
1081
.recalc_done:
1067
 
1082
 
1068
        stdcall draw_client
1083
        stdcall draw_client
1069
  .nodraw:
1084
.nodraw:
1070
        mcall   SF_REDRAW, SSF_END_DRAW
1085
        mcall   SF_REDRAW, SSF_END_DRAW
1071
        mov     [bFirstWinDraw], 0
1086
        mov     [bFirstWinDraw], 0
1072
        mov     [bNewImage], 0
1087
        mov     [bNewImage], 0
Line 1073... Line 1088...
1073
        mov     [bToggleToolbar], 0
1088
        mov     [bToggleToolbar], 0
1074
        mov     [bToggleSlideShow], 0
1089
        mov     [bToggleSlideShow], 0
Line 1075... Line -...
1075
 
-
 
1076
        ret
1090
 
1077
endp
1091
        ret
1078
 
1092
endp
1079
 
1093
 
1080
proc draw_view
1094
 
1081
        push    ebx esi edi
1095
proc draw_view uses ebx esi edi
1082
        cmp     [scale_mode], LIBIMG_SCALE_FIT_MIN
1096
        cmp     [scale_mode], LIBIMG_SCALE_FIT_MIN
1083
        jnz     .scale_none
1097
        jnz     .scale_none
1084
        mov     ecx, [cur_frame]
1098
        mov     ecx, [cur_frame]
1085
        mov     eax, [ecx + Image.Width]
1099
        mov     eax, [ecx+Image.Width]
1086
        cmp     eax, [view.width]
1100
        cmp     eax, [view.width]
1087
        jnz     .scale
1101
        jnz     .scale
1088
        mov     eax, [ecx + Image.Height]
1102
        mov     eax, [ecx+Image.Height]
1089
        cmp     eax, [view.height]
1103
        cmp     eax, [view.height]
1090
        jnz     .scale
1104
        jnz     .scale
1091
        jmp     .draw
1105
        jmp     .draw
1092
  .scale:
1106
.scale:
1093
        mov     eax, [orig_image]
1107
        mov     eax, [orig_image]
1094
        cmp     eax, [cur_image]
1108
        cmp     eax, [cur_image]
1095
        jz      @f
1109
        jz      @f
1096
        invoke  img.destroy, [cur_image]
1110
        invoke  img.destroy, [cur_image]
1097
        mov     eax, [orig_image]
1111
        mov     eax, [orig_image]
1098
    @@:
1112
@@:
1099
        invoke  img.scale, eax, 0, 0, [eax + Image.Width], [eax + Image.Height], 0, LIBIMG_SCALE_STRETCH, LIBIMG_INTER_DEFAULT, [view.width], [view.height]
1113
        invoke  img.scale, eax, 0, 0, [eax+Image.Width], [eax+Image.Height], 0, LIBIMG_SCALE_STRETCH, LIBIMG_INTER_DEFAULT, [view.width], [view.height]
Line 1100... Line 1114...
1100
        test    eax, eax
1114
        test    eax, eax
Line 1101... Line 1115...
1101
;FIXME
1115
;FIXME
1102
        mov     [cur_image], eax
1116
        mov     [cur_image], eax
1103
        mov     [cur_frame], eax        ; FIXME index
1117
        mov     [cur_frame], eax        ; FIXME index
1104
        jmp     .draw
1118
        jmp     .draw
1105
 
1119
 
1106
  .scale_none:
1120
.scale_none:
1107
 
1121
 
1108
  .draw:
1122
.draw:
1109
        push    [pict.top]
1123
        push    [pict.top]
1110
        push    [pict.left]
-
 
1111
        push    [view.height]
1124
        push    [pict.left]
1112
        push    [view.width]
1125
        push    [view.height]
Line -... Line 1126...
-
 
1126
        push    [view.width]
-
 
1127
        push    [view_abs_top]  ; ypos
-
 
1128
        push    [view_abs_left] ; xpos
-
 
1129
        invoke  img.draw, [cur_frame]
-
 
1130
.done:
-
 
1131
        ret
-
 
1132
endp
-
 
1133
 
-
 
1134
proc draw_scale_button
-
 
1135
        pushad
-
 
1136
        mcall   65, buttons+scalebtn*20, <20,20>, [scale_button_xy], 8, palette
-
 
1137
        mov     ebx, [scale_button_xy]
-
 
1138
        add     ebx, 0x00050006
-
 
1139
        ; print letter(s) corresponding to the current scaling mode
-
 
1140
        mov     edi, 2
-
 
1141
        mov     [scale_button_letter], 'x1'
-
 
1142
        cmp     [scale_mode], LIBIMG_SCALE_NONE
-
 
1143
        jz      @f
-
 
1144
        add     ebx, 0x00020001
Line 1113... Line -...
1113
        push    [view_abs_top]  ; ypos
-
 
1114
        push    [view_abs_left] ; xpos
1145
        mov     edi, 1
1115
        invoke  img.draw, [cur_frame]
-
 
1116
  .done:
1146
        mov     [scale_button_letter], 'W'
1117
        pop     edi esi ebx
1147
;        cmp     [scale_mode], LIBIMG_SCALE_FIT_MIN
1118
        ret
1148
@@:
1119
endp
1149
        mcall   4, , 0x800100ff, scale_button_letter
1120
 
1150
        popad
Line 1137... Line 1167...
1137
        add     ebx, [toolbar_abs_left]
1167
        add     ebx, [toolbar_abs_left]
1138
        add     ebx, [toolbar.width]
1168
        add     ebx, [toolbar.width]
1139
        mov     ecx, [toolbar_abs_top]
1169
        mov     ecx, [toolbar_abs_top]
1140
        shl     ecx, 16
1170
        shl     ecx, 16
1141
        add     ecx, [toolbar_abs_top]
1171
        add     ecx, [toolbar_abs_top]
1142
        add     ecx, (30 SHL 16) + 30
1172
        add     ecx, (30 SHL 16)+30
1143
        mcall   38, , , 0x007F7F7F
1173
        mcall   38, , , 0x007F7F7F
1144
        mov     ebx, [toolbar_abs_left]
1174
        mov     ebx, [toolbar_abs_left]
1145
        shl     ebx, 16
1175
        shl     ebx, 16
1146
        add     ebx, [toolbar_abs_left]
1176
        add     ebx, [toolbar_abs_left]
1147
        add     ebx, ((5 + 25 * 1) SHL 16) + (5 + 25 * 1)
1177
        add     ebx, ((5+25*1) SHL 16)+(5+25*1)
1148
        mov     ecx, [toolbar_abs_top]
1178
        mov     ecx, [toolbar_abs_top]
1149
        shl     ecx, 16
1179
        shl     ecx, 16
1150
        add     ecx, [toolbar_abs_top]
1180
        add     ecx, [toolbar_abs_top]
1151
        add     ecx, [toolbar.height]
1181
        add     ecx, [toolbar.height]
1152
        mcall
1182
        mcall
1153
        add     ebx, ((5 + 25 * 2) SHL 16) + (5 + 25 * 2)
1183
        add     ebx, ((5+25*2) SHL 16)+(5+25*2)
1154
        mcall
1184
        mcall
1155
        add     ebx, ((5 + 25 * 2) SHL 16) + (5 + 25 * 2)
1185
        add     ebx, ((5+25*2) SHL 16)+(5+25*2)
-
 
1186
        mcall
-
 
1187
        add     ebx, ((5+25*1) SHL 16)+(5+25*1)
1156
        mcall
1188
        mcall
1157
        mov     ebx, [toolbar_abs_left]
1189
        mov     ebx, [toolbar_abs_left]
1158
        add     ebx, [toolbar.width]
1190
        add     ebx, [toolbar.width]
1159
        sub     ebx, 25 * 5 + 10 
1191
        sub     ebx, 25*5+10 
1160
        shl     ebx, 16
1192
        shl     ebx, 16
1161
        add     ebx, [toolbar_abs_left]
1193
        add     ebx, [toolbar_abs_left]
1162
        add     ebx, [toolbar.width]
1194
        add     ebx, [toolbar.width]
1163
        sub     ebx, 25 * 5 + 10 
1195
        sub     ebx, 25*5+10 
1164
        mcall
1196
        mcall
Line 1165... Line 1197...
1165
 
1197
 
1166
        mov     ebx, [toolbar_abs_left]
1198
        mov     ebx, [toolbar_abs_left]
1167
        shl     ebx, 16
1199
        shl     ebx, 16
1168
        add     ebx, ((4 + 25 * 0) SHL 16) + 21
1200
        add     ebx, ((4+25*0) SHL 16)+21
1169
        mov     ecx, [toolbar_abs_top]
1201
        mov     ecx, [toolbar_abs_top]
1170
        shl     ecx, 16
1202
        shl     ecx, 16
1171
        add     ecx, (4 SHL 16) + 21
1203
        add     ecx, (4 SHL 16)+21
1172
        mcall   SF_DEFINE_BUTTON, , , 'opn'+40000000h
1204
        mcall   SF_DEFINE_BUTTON, , , 'opn'+40000000h
1173
        add     ebx, (5 + 25 * 1) SHL 16
1205
        add     ebx, (5+25*1) SHL 16
1174
        mcall    , , , 'bck'+40000000h
1206
        mcall    , , , 'bck'+40000000h
1175
        add     ebx, (0 + 25 * 1) SHL 16
1207
        add     ebx, (0+25*1) SHL 16
1176
        mcall    , , , 'fwd'+40000000h
1208
        mcall    , , , 'fwd'+40000000h
1177
        add     ebx, (5 + 25 * 1) SHL 16
1209
        add     ebx, (5+25*1) SHL 16
1178
        mcall    , , , 'bgr'+40000000h
1210
        mcall    , , , 'bgr'+40000000h
1179
        add     ebx, (0 + 25 * 1) SHL 16
1211
        add     ebx, (0+25*1) SHL 16
-
 
1212
        mcall    , , , 'sld'+40000000h
-
 
1213
        add     ebx, (5+25*1) SHL 16
1180
        mcall    , , , 'sld'+40000000h
1214
        mcall    , , , 'scl'+40000000h
1181
        mov     ebx, [toolbar_abs_left]
1215
        mov     ebx, [toolbar_abs_left]
1182
        add     ebx, [toolbar.width]
1216
        add     ebx, [toolbar.width]
1183
        sub     ebx, 25 * 5 + 10 
1217
        sub     ebx, 25*5+10 
1184
        add     ebx, 5
1218
        add     ebx, 5
1185
        shl     ebx, 16
1219
        shl     ebx, 16
1186
        mov     bl, 21
1220
        mov     bl, 21
1187
        mcall   , , , 'flh'+40000000h
1221
        mcall   , , , 'flh'+40000000h
Line 1197... Line 1231...
1197
        mov     ebp, (numimages-1)*20
1231
        mov     ebp, (numimages-1)*20
Line 1198... Line 1232...
1198
 
1232
 
1199
        mov     edx, [toolbar_abs_left]
1233
        mov     edx, [toolbar_abs_left]
1200
        shl     edx, 16
1234
        shl     edx, 16
1201
        add     edx, [toolbar_abs_top]
1235
        add     edx, [toolbar_abs_top]
1202
        add     edx, ((5 + 25 * 0) SHL 16) + 5
1236
        add     edx, ((5+25*0) SHL 16)+5
1203
        mcall   65, buttons + openbtn    * 20, <20, 20>, , 8, palette
1237
        mcall   65, buttons+openbtn   *20, <20, 20>, , 8, palette
1204
        add     edx, ((5 + 25 * 1) SHL 16) + 0
1238
        add     edx, ((5+25*1) SHL 16)+0
1205
        mcall     , buttons + backbtn    * 20
1239
        mcall     , buttons+backbtn   *20
1206
        add     edx, ((0 + 25 * 1) SHL 16) + 0
1240
        add     edx, ((0+25*1) SHL 16)+0
1207
        mcall     , buttons + forwardbtn * 20
1241
        mcall     , buttons+forwardbtn*20
1208
        add     edx, ((5 + 25 * 1) SHL 16) + 0
1242
        add     edx, ((5+25*1) SHL 16)+0
1209
        mcall     , buttons + bgrbtn     * 20
1243
        mcall     , buttons+bgrbtn    *20
1210
        add     edx, ((0 + 25 * 1) SHL 16) + 0
1244
        add     edx, ((0+25*1) SHL 16)+0
-
 
1245
        mcall     , buttons+slidebtn  *20
-
 
1246
        add     edx, ((5+25*1) SHL 16)+0
-
 
1247
;        mcall     , buttons+scalebtn  *20
-
 
1248
        mov     [scale_button_xy], edx
1211
        mcall     , buttons + slidebtn   * 20
1249
        call    draw_scale_button
1212
        mov     edx, [client_abs_left]
1250
        mov     edx, [client_abs_left]
1213
        add     edx, [client.width]
1251
        add     edx, [client.width]
1214
        sub     edx, 25 * 5 + 4
1252
        sub     edx, 25*5+4
1215
        shl     edx, 16
1253
        shl     edx, 16
1216
        add     edx, [client_abs_top]
1254
        add     edx, [client_abs_top]
1217
        add     edx, 5
1255
        add     edx, 5
1218
        mcall   , buttons+fliphorzbtn*20
1256
        mcall   , buttons+fliphorzbtn*20
1219
        add     edx, 25 * 65536
1257
        add     edx, 25*65536
1220
        mcall   , buttons+flipvertbtn*20
1258
        mcall   , buttons+flipvertbtn*20
1221
        add     edx, 30 * 65536
1259
        add     edx, 30*65536
1222
        mcall   , buttons+rotcwbtn*20
1260
        mcall   , buttons+rotcwbtn*20
1223
        add     edx, 25 * 65536
1261
        add     edx, 25*65536
1224
        mcall   , buttons+rotccwbtn*20
1262
        mcall   , buttons+rotccwbtn*20
1225
        add     edx, 25 * 65536
1263
        add     edx, 25*65536
Line 1226... Line 1264...
1226
        mcall   , buttons+rot180btn*20
1264
        mcall   , buttons+rot180btn*20
1227
 
-
 
1228
  .quit:
1265
 
1229
        pop     edi esi ebx
1266
.quit:
Line 1230... Line 1267...
1230
        ret
1267
        ret
Line 1269... Line 1306...
1269
        sub     ebx, [view.width]
1306
        sub     ebx, [view.width]
1270
        add     ebx, eax
1307
        add     ebx, eax
1271
;mov edx, 0xffff00
1308
;mov edx, 0xffff00
1272
;bg_color
1309
;bg_color
1273
        mcall   13
1310
        mcall   13
1274
    @@:
1311
@@:
Line 1275... Line 1312...
1275
 
1312
 
Line 1276... Line 1313...
1276
        call    draw_view
1313
        call    draw_view
1277
 
1314
 
Line 1284... Line 1321...
1284
        push    ebx esi edi
1321
        push    ebx esi edi
Line 1285... Line 1322...
1285
 
1322
 
1286
        test    [bShowToolbar], 1
1323
        test    [bShowToolbar], 1
1287
        jz      .toolbar_done
1324
        jz      .toolbar_done
1288
        call    draw_toolbar
1325
        call    draw_toolbar
1289
  .toolbar_done:
1326
.toolbar_done:
Line 1290... Line 1327...
1290
        call    draw_work
1327
        call    draw_work
1291
 
1328
 
1292
        pop     edi esi ebx
1329
        pop     edi esi ebx
Line 1355... Line 1392...
1355
        add     ecx, SCROLL_WIDTH_SIZE
1392
        add     ecx, SCROLL_WIDTH_SIZE
1356
        inc     ecx
1393
        inc     ecx
1357
        mov     edx, [bg_color]
1394
        mov     edx, [bg_color]
1358
;        mov     edx, 0x00ffff
1395
;        mov     edx, 0x00ffff
1359
        mcall
1396
        mcall
1360
    @@:
1397
@@:
Line 1361... Line 1398...
1361
 
1398
 
1362
        cmp     [need_scrollbar_v], 0
1399
        cmp     [need_scrollbar_v], 0
1363
        jz      .v_scrollbar_done
1400
        jz      .v_scrollbar_done
1364
        mov     eax, [client.left]
1401
        mov     eax, [client.left]
Line 1372... Line 1409...
1372
        add     eax, [canvas_padding]
1409
        add     eax, [canvas_padding]
1373
        add     eax, [canvas_padding]
1410
        add     eax, [canvas_padding]
1374
        mov     [scroll_bar_data_vertical.size_y], ax
1411
        mov     [scroll_bar_data_vertical.size_y], ax
1375
        mov     [scroll_bar_data_vertical.all_redraw], 1
1412
        mov     [scroll_bar_data_vertical.all_redraw], 1
1376
        invoke  scrollbar_vert_draw, scroll_bar_data_vertical
1413
        invoke  scrollbar_vert_draw, scroll_bar_data_vertical
1377
  .v_scrollbar_done:
1414
.v_scrollbar_done:
Line 1378... Line 1415...
1378
 
1415
 
1379
        cmp     [need_scrollbar_h], 0
1416
        cmp     [need_scrollbar_h], 0
1380
        jz      .h_scrollbar_done
1417
        jz      .h_scrollbar_done
1381
        mov     eax, [client.left]
1418
        mov     eax, [client.left]
Line 1388... Line 1425...
1388
        add     eax, [canvas_padding]
1425
        add     eax, [canvas_padding]
1389
        add     eax, [canvas_padding]
1426
        add     eax, [canvas_padding]
1390
        mov     [scroll_bar_data_horizontal.size_x], ax
1427
        mov     [scroll_bar_data_horizontal.size_x], ax
1391
        mov     [scroll_bar_data_horizontal.all_redraw], 1
1428
        mov     [scroll_bar_data_horizontal.all_redraw], 1
1392
        invoke  scrollbar_hort_draw, scroll_bar_data_horizontal
1429
        invoke  scrollbar_hort_draw, scroll_bar_data_horizontal
1393
  .h_scrollbar_done:
1430
.h_scrollbar_done:
Line 1394... Line 1431...
1394
 
1431
 
1395
        pop     edi esi ebx
1432
        pop     edi esi ebx
1396
        ret
1433
        ret
Line 1401... Line 1438...
1401
        bt      [window_style], 25
1438
        bt      [window_style], 25
1402
        jc      @f
1439
        jc      @f
1403
        ; draw fullscreen decorations on image
1440
        ; draw fullscreen decorations on image
1404
        call    draw_filename
1441
        call    draw_filename
1405
        call    draw_fullscreen_controls
1442
        call    draw_fullscreen_controls
1406
    @@:
1443
@@:
1407
        ret
1444
        ret
1408
endp
1445
endp
Line 1409... Line 1446...
1409
 
1446
 
Line 1442... Line 1479...
1442
        add     edx, [canvas.height]
1479
        add     edx, [canvas.height]
1443
        shr     dx, 3
1480
        shr     dx, 3
1444
        neg     dx
1481
        neg     dx
1445
        add     dx, word[canvas.height]
1482
        add     dx, word[canvas.height]
1446
        add     edx, [canvas.top]
1483
        add     edx, [canvas.top]
1447
        mcall   65, buttons + backbtn * 20, <20, 20>, , 8, palette
1484
        mcall   65, buttons+backbtn*20, <20, 20>, , 8, palette
1448
        add     edx, 25 SHL 16
1485
        add     edx, 25 SHL 16
1449
        mcall   65, buttons + forwardbtn * 20,      , , 8, 
1486
        mcall   65, buttons+forwardbtn*20,      , , 8, 
1450
        pop     esi
1487
        pop     esi
1451
        ret
1488
        ret
1452
endp
1489
endp
Line 1485... Line 1522...
1485
        and     al, 3
1522
        and     al, 3
1486
        call    dword[check_modifier_table+esi*4]
1523
        call    dword[check_modifier_table+esi*4]
1487
        test    al, al
1524
        test    al, al
1488
        pop     eax
1525
        pop     eax
1489
;       jnz     .not
1526
;       jnz     .not
1490
  .not:
1527
.not:
1491
        ret
1528
        ret
1492
endp
1529
endp
Line 1493... Line 1530...
1493
 
1530
 
Line 1516... Line 1553...
1516
proc bin2dec
1553
proc bin2dec
1517
        push    ebx ecx edx esi
1554
        push    ebx ecx edx esi
Line 1518... Line 1555...
1518
 
1555
 
1519
        mov     ebx, 10
1556
        mov     ebx, 10
1520
        xor     ecx, ecx
1557
        xor     ecx, ecx
1521
    @@:
1558
@@:
1522
        xor     edx, edx
1559
        xor     edx, edx
1523
        div     ebx
1560
        div     ebx
1524
        push    edx
1561
        push    edx
1525
        inc     ecx
1562
        inc     ecx
1526
        test    eax, eax
1563
        test    eax, eax
Line 1527... Line 1564...
1527
        jnz     @b
1564
        jnz     @b
1528
 
1565
 
1529
    @@:
1566
@@:
1530
        pop     eax
1567
        pop     eax
1531
        add     eax, '0'
1568
        add     eax, '0'
1532
        stosb
1569
        stosb
Line 1537... Line 1574...
1537
        pop     esi edx ecx ebx
1574
        pop     esi edx ecx ebx
1538
        ret
1575
        ret
1539
endp
1576
endp
Line 1540... Line -...
1540
 
-
 
1541
 
-
 
1542
proc is_root_dir _path
-
 
1543
        push    ecx esi
-
 
1544
 
-
 
1545
        mov     esi, [_path]
-
 
1546
        xor     ecx, ecx
-
 
1547
    @@:
-
 
1548
        lodsb
-
 
1549
        test    al, al
-
 
1550
        jz      .done
-
 
1551
        cmp     al, '/'
-
 
1552
        jnz     @b
-
 
1553
        inc     ecx
-
 
1554
        jmp     @b
-
 
1555
  .done:
-
 
1556
        xor     eax, eax
-
 
1557
        cmp     ecx, 3
-
 
1558
        jz      @f
-
 
1559
        mov     eax, -2
-
 
1560
    @@:
-
 
1561
        pop     esi ecx
-
 
1562
        ret
-
 
1563
endp
1577
 
1564
 
1578
 
1565
; fills window_header with window title
1579
; fills window_header with window title
1566
; window title is generated as '[k/n]  - Kolibri Image Viewer'
1580
; window title is generated as '[k/n]  - Kolibri Image Viewer'
1567
; n = total files in dir
1581
; n = total files in dir
Line 1577... Line 1591...
1577
        mov     eax, [cur_file_idx]
1591
        mov     eax, [cur_file_idx]
1578
        inc     eax
1592
        inc     eax
1579
        call    bin2dec
1593
        call    bin2dec
1580
        mov     byte[edi], '/'
1594
        mov     byte[edi], '/'
1581
        inc     edi
1595
        inc     edi
1582
        stdcall is_root_dir, path
1596
        mov     eax, [directory_ptr]
1583
        add     eax, [files_num]
1597
        mov     eax, [eax+4]
1584
        call    bin2dec
1598
        call    bin2dec
1585
        mov     word[edi], '] '
1599
        mov     word[edi], '] '
1586
        add     edi, 2
1600
        add     edi, 2
Line 1587... Line 1601...
1587
 
1601
 
1588
        ; add filename
1602
        ; add filename
1589
  .next_symbol:
1603
.next_symbol:
1590
        lodsb
1604
        lodsb
1591
        test    al, al
1605
        test    al, al
1592
        jz      @f
1606
        jz      @f
1593
        stosb
1607
        stosb
1594
        inc     [window_header_len]
1608
        inc     [window_header_len]
1595
        cmp     edi, window_header+256
1609
        cmp     edi, window_header+256
1596
        jb      .next_symbol
1610
        jb      .next_symbol
1597
  .overflow:
1611
.overflow:
1598
        mov     dword[edi-4], '...'
1612
        mov     dword[edi-4], '...'
1599
  .ret:
1613
.ret:
1600
        pop     edi esi ebx eax
1614
        pop     edi esi ebx eax
1601
        ret
1615
        ret
1602
    @@:
1616
@@:
1603
        mov     esi, s_header
1617
        mov     esi, s_header
1604
    @@:
1618
@@:
1605
        lodsb
1619
        lodsb
1606
        stosb
1620
        stosb
1607
        test    al, al
1621
        test    al, al
1608
        jz      .ret
1622
        jz      .ret
Line 1623... Line 1637...
1623
        mov     ebx, eax
1637
        mov     ebx, eax
Line 1624... Line 1638...
1624
 
1638
 
1625
        mov     [need_scrollbar_v], 0
1639
        mov     [need_scrollbar_v], 0
Line 1626... Line 1640...
1626
        mov     [need_scrollbar_h], 0
1640
        mov     [need_scrollbar_h], 0
1627
 
1641
 
1628
        mov     eax, [ebx + Image.Width]
1642
        mov     eax, [ebx+Image.Width]
1629
        cmp     eax, [canvas.width]
1643
        cmp     eax, [canvas.width]
1630
        jbe     @f
1644
        jbe     @f
1631
        sub     [canvas.height], SCROLL_WIDTH_SIZE+1
1645
        sub     [canvas.height], SCROLL_WIDTH_SIZE+1
1632
        mov     [need_scrollbar_h], 1
1646
        mov     [need_scrollbar_h], 1
1633
    @@:
1647
@@:
1634
        mov     eax, [ebx + Image.Height]
1648
        mov     eax, [ebx+Image.Height]
1635
        cmp     eax, [canvas.height]
1649
        cmp     eax, [canvas.height]
1636
        jbe     @f
1650
        jbe     @f
1637
        sub     [canvas.width], SCROLL_WIDTH_SIZE+1
1651
        sub     [canvas.width], SCROLL_WIDTH_SIZE+1
1638
        mov     [need_scrollbar_v], 1
1652
        mov     [need_scrollbar_v], 1
1639
    @@:
1653
@@:
1640
        cmp     [need_scrollbar_h], 1
1654
        cmp     [need_scrollbar_h], 1
1641
        jz      @f
1655
        jz      @f
1642
        mov     eax, [ebx + Image.Width]
1656
        mov     eax, [ebx+Image.Width]
1643
        cmp     eax, [canvas.width]
1657
        cmp     eax, [canvas.width]
1644
        jbe     @f
1658
        jbe     @f
1645
        sub     [canvas.height], SCROLL_WIDTH_SIZE+1
1659
        sub     [canvas.height], SCROLL_WIDTH_SIZE+1
Line 1646... Line 1660...
1646
        mov     [need_scrollbar_h], 1
1660
        mov     [need_scrollbar_h], 1
1647
    @@:
1661
@@:
1648
 
1662
 
1649
 
1663
 
1650
        mov     eax, [ebx + Image.Width]
1664
        mov     eax, [ebx+Image.Width]
1651
        cmp     eax, [canvas.width]
1665
        cmp     eax, [canvas.width]
1652
        jbe     @f
1666
        jbe     @f
Line 1653... Line 1667...
1653
        mov     eax, [canvas.width]
1667
        mov     eax, [canvas.width]
1654
    @@:
1668
@@:
1655
        mov     [view.width], eax
1669
        mov     [view.width], eax
1656
        mov     [pict.width], eax
1670
        mov     [pict.width], eax
1657
 
1671
 
1658
        mov     eax, [ebx + Image.Height]
1672
        mov     eax, [ebx+Image.Height]
1659
        cmp     eax, [canvas.height]
1673
        cmp     eax, [canvas.height]
Line 1660... Line 1674...
1660
        jbe     @f
1674
        jbe     @f
1661
        mov     eax, [canvas.height]
1675
        mov     eax, [canvas.height]
Line 1670... Line 1684...
1670
        mov     eax, [canvas.height]
1684
        mov     eax, [canvas.height]
1671
        sub     eax, [view.height]
1685
        sub     eax, [view.height]
1672
        sar     eax, 1
1686
        sar     eax, 1
1673
        mov     [view.top], eax
1687
        mov     [view.top], eax
Line 1674... Line 1688...
1674
 
1688
 
1675
        mov     eax, [ebx + Image.Width]
1689
        mov     eax, [ebx+Image.Width]
1676
        sub     eax, [pict.width]
1690
        sub     eax, [pict.width]
1677
        sar     eax, 1
1691
        sar     eax, 1
1678
        mov     [pict.left], eax
1692
        mov     [pict.left], eax
1679
        mov     eax, [ebx + Image.Height]
1693
        mov     eax, [ebx+Image.Height]
1680
        sub     eax, [pict.height]
1694
        sub     eax, [pict.height]
1681
        sar     eax, 1
1695
        sar     eax, 1
Line 1682... Line 1696...
1682
        mov     [pict.top], eax
1696
        mov     [pict.top], eax
1683
 
1697
 
1684
 
1698
 
1685
        mov     eax, [ebx + Image.Height]
1699
        mov     eax, [ebx+Image.Height]
1686
        mov     [scroll_bar_data_vertical.max_area], eax
1700
        mov     [scroll_bar_data_vertical.max_area], eax
1687
        mov     eax, [pict.height]
1701
        mov     eax, [pict.height]
Line 1688... Line 1702...
1688
        mov     [scroll_bar_data_vertical.cur_area], eax
1702
        mov     [scroll_bar_data_vertical.cur_area], eax
1689
        mov     eax, [pict.top]
1703
        mov     eax, [pict.top]
1690
        mov     [scroll_bar_data_vertical.position], eax
1704
        mov     [scroll_bar_data_vertical.position], eax
1691
 
1705
 
1692
        mov     eax, [ebx + Image.Width]
1706
        mov     eax, [ebx+Image.Width]
1693
        mov     [scroll_bar_data_horizontal.max_area], eax
1707
        mov     [scroll_bar_data_horizontal.max_area], eax
Line 1708... Line 1722...
1708
        mov     [need_scrollbar_h], 0
1722
        mov     [need_scrollbar_h], 0
1709
        mov     [scroll_bar_data_vertical.position], 0
1723
        mov     [scroll_bar_data_vertical.position], 0
1710
        mov     [scroll_bar_data_horizontal.position], 0
1724
        mov     [scroll_bar_data_horizontal.position], 0
Line 1711... Line 1725...
1711
 
1725
 
1712
        mov     eax, [orig_image]
1726
        mov     eax, [orig_image]
1713
        cmp     [eax + Image.Type], Image.bpp24
1727
        cmp     [eax+Image.Type], Image.bpp24
1714
        jz      @f
1728
        jz      @f
1715
        cmp     [eax + Image.Type], Image.bpp32
1729
        cmp     [eax+Image.Type], Image.bpp32
1716
        jz      @f
1730
        jz      @f
1717
        cmp     [eax + Image.Type], Image.bpp8g
1731
        cmp     [eax+Image.Type], Image.bpp8g
1718
        jz      @f
1732
        jz      @f
1719
        invoke  img.convert, eax, 0, Image.bpp24, 0, 0
1733
        invoke  img.convert, eax, 0, Image.bpp24, 0, 0
1720
        test    eax, eax
1734
        test    eax, eax
1721
;       jz      .error
1735
;       jz      .error
1722
        push    eax
1736
        push    eax
1723
        invoke  img.destroy, [orig_image]
1737
        invoke  img.destroy, [orig_image]
1724
        pop     eax
1738
        pop     eax
1725
        mov     [orig_image], eax
1739
        mov     [orig_image], eax
1726
        mov     [cur_image], eax
1740
        mov     [cur_image], eax
1727
        mov     [cur_frame], eax
1741
        mov     [cur_frame], eax
Line 1728... Line 1742...
1728
    @@:
1742
@@:
1729
 
1743
 
1730
        mov     eax, [orig_image]
1744
        mov     eax, [orig_image]
1731
        mov     ecx, [eax + Image.Height]
1745
        mov     ecx, [eax+Image.Height]
1732
        mov     eax, [eax + Image.Width]
1746
        mov     eax, [eax+Image.Width]
1733
        cmp     eax, [canvas.width]
1747
        cmp     eax, [canvas.width]
1734
        ja      .get_size
1748
        ja      .get_size
1735
        cmp     ecx, [canvas.height]
1749
        cmp     ecx, [canvas.height]
1736
        ja      .get_size
1750
        ja      .get_size
1737
        jmp     .got_size
1751
        jmp     .got_size
1738
  .get_size:
1752
.get_size:
Line 1739... Line 1753...
1739
        invoke  img.get_scaled_size, eax, ecx, LIBIMG_SCALE_FIT_MIN, [canvas.width], [canvas.height]
1753
        invoke  img.get_scaled_size, eax, ecx, LIBIMG_SCALE_FIT_MIN, [canvas.width], [canvas.height]
1740
  .got_size:
1754
.got_size:
Line 1741... Line 1755...
1741
 
1755
 
1742
        mov     [pict.top], 0
1756
        mov     [pict.top], 0
1743
        mov     [pict.left], 0
1757
        mov     [pict.left], 0
1744
 
1758
 
1745
        cmp     eax, [canvas.width]
1759
        cmp     eax, [canvas.width]
1746
        jbe     @f
1760
        jbe     @f
1747
        mov     eax, [canvas.width]
1761
        mov     eax, [canvas.width]
1748
    @@:
1762
@@:
1749
        mov     [view.width], eax
1763
        mov     [view.width], eax
Line 1755... Line 1769...
1755
 
1769
 
1756
        mov     eax, ecx
1770
        mov     eax, ecx
1757
        cmp     eax, [canvas.height]
1771
        cmp     eax, [canvas.height]
1758
        jbe     @f
1772
        jbe     @f
1759
        mov     eax, [canvas.height]
1773
        mov     eax, [canvas.height]
1760
    @@:
1774
@@:
1761
        mov     [view.height], eax
1775
        mov     [view.height], eax
1762
        mov     [pict.height], eax
1776
        mov     [pict.height], eax
1763
        neg     eax
1777
        neg     eax
1764
        add     eax, [canvas.height]
1778
        add     eax, [canvas.height]
Line 1786... Line 1800...
1786
        new_top  dd ?
1800
        new_top  dd ?
1787
endl
1801
endl
1788
        push    ebx ecx
1802
        push    ebx ecx
Line 1789... Line 1803...
1789
 
1803
 
1790
        mov     ebx, [cur_image]
1804
        mov     ebx, [cur_image]
1791
  .x:
1805
.x:
1792
        mov     eax, [pict.left]
1806
        mov     eax, [pict.left]
1793
        add     eax, [_dx]
1807
        add     eax, [_dx]
1794
        cmp     eax, 0
1808
        cmp     eax, 0
1795
        jge     @f
1809
        jge     @f
1796
        mov     [new_left], 0
1810
        mov     [new_left], 0
1797
        jmp     .xdone
1811
        jmp     .xdone
1798
    @@:
1812
@@:
1799
        mov     ecx, eax
1813
        mov     ecx, eax
1800
        add     eax, [pict.width]
1814
        add     eax, [pict.width]
1801
        cmp     eax, [ebx + Image.Width]
1815
        cmp     eax, [ebx+Image.Width]
1802
        ja      @f
1816
        ja      @f
1803
        mov     [new_left], ecx
1817
        mov     [new_left], ecx
1804
        jmp     .xdone
1818
        jmp     .xdone
1805
    @@:
1819
@@:
1806
        mov     eax, [ebx + Image.Width]
1820
        mov     eax, [ebx+Image.Width]
1807
        sub     eax, [pict.width]
1821
        sub     eax, [pict.width]
1808
        mov     [new_left], eax
1822
        mov     [new_left], eax
1809
        jmp     .xdone
1823
        jmp     .xdone
Line 1810... Line 1824...
1810
  .xdone:
1824
.xdone:
1811
 
1825
 
1812
  .y:
1826
.y:
1813
        mov     eax, [pict.top]
1827
        mov     eax, [pict.top]
1814
        add     eax, [_dy]
1828
        add     eax, [_dy]
1815
        cmp     eax, 0
1829
        cmp     eax, 0
1816
        jge     @f
1830
        jge     @f
1817
        mov     [new_top], 0
1831
        mov     [new_top], 0
1818
        jmp     .ydone
1832
        jmp     .ydone
1819
    @@:
1833
@@:
1820
        mov     ecx, eax
1834
        mov     ecx, eax
1821
        add     eax, [pict.height]
1835
        add     eax, [pict.height]
1822
        cmp     eax, [ebx + Image.Height]
1836
        cmp     eax, [ebx+Image.Height]
1823
        ja      @f
1837
        ja      @f
1824
        mov     [new_top], ecx
1838
        mov     [new_top], ecx
1825
        jmp     .ydone
1839
        jmp     .ydone
1826
    @@:
1840
@@:
1827
        mov     eax, [ebx + Image.Height]
1841
        mov     eax, [ebx+Image.Height]
1828
        sub     eax, [pict.height]
1842
        sub     eax, [pict.height]
1829
        mov     [new_top], eax
1843
        mov     [new_top], eax
Line 1830... Line 1844...
1830
        jmp     .ydone
1844
        jmp     .ydone
1831
  .ydone:
1845
.ydone:
1832
 
1846
 
Line 1858... Line 1872...
1858
        mov     [scroll_bar_data_horizontal.all_redraw], 0
1872
        mov     [scroll_bar_data_horizontal.all_redraw], 0
1859
        mov     eax, [pict.left]
1873
        mov     eax, [pict.left]
1860
        mov     [scroll_bar_data_horizontal.position], eax
1874
        mov     [scroll_bar_data_horizontal.position], eax
1861
        invoke  scrollbar_hort_draw, scroll_bar_data_horizontal
1875
        invoke  scrollbar_hort_draw, scroll_bar_data_horizontal
1862
        pop     eax
1876
        pop     eax
1863
  .no_h_scroll:
1877
.no_h_scroll:
1864
        test    al, al
1878
        test    al, al
1865
        jz      .no_v_scroll
1879
        jz      .no_v_scroll
1866
        push    eax
1880
        push    eax
1867
        mov     [scroll_bar_data_vertical.all_redraw], 0
1881
        mov     [scroll_bar_data_vertical.all_redraw], 0
1868
        mov     eax, [pict.top]
1882
        mov     eax, [pict.top]
1869
        mov     [scroll_bar_data_vertical.position], eax
1883
        mov     [scroll_bar_data_vertical.position], eax
1870
        invoke  scrollbar_vert_draw, scroll_bar_data_vertical
1884
        invoke  scrollbar_vert_draw, scroll_bar_data_vertical
1871
        pop     eax
1885
        pop     eax
1872
  .no_v_scroll:
1886
.no_v_scroll:
Line 1873... Line 1887...
1873
 
1887
 
1874
        ret
1888
        ret
Line 1875... Line 1889...
1875
endp
1889
endp
1876
 
1890
 
Line 1877... Line 1891...
1877
 
1891
 
1878
proc merge_icons_to_single_img _img
1892
proc merge_icons_to_single_img _img
1879
        push    ebx esi edi
1893
        push    ebx esi edi
1880
 
1894
 
1881
        mov     edx, [_img]
1895
        mov     edx, [_img]
1882
        mov     eax, [edx + Image.Width]
1896
        mov     eax, [edx+Image.Width]
1883
        mov     ecx, [edx + Image.Height]
1897
        mov     ecx, [edx+Image.Height]
1884
  .next:
1898
.next:
1885
        cmp     [edx + Image.Next], 0
1899
        cmp     [edx+Image.Next], 0
1886
        jz      .got_sizes
1900
        jz      .got_sizes
1887
        inc     eax
1901
        inc     eax
1888
        mov     edx, [edx + Image.Next]
1902
        mov     edx, [edx+Image.Next]
1889
        add     eax, [edx + Image.Width]
1903
        add     eax, [edx+Image.Width]
1890
        cmp     ecx, [edx + Image.Height]
1904
        cmp     ecx, [edx+Image.Height]
Line 1891... Line 1905...
1891
        jae     @f
1905
        jae     @f
1892
        mov     ecx, [edx + Image.Height]
1906
        mov     ecx, [edx+Image.Height]
1893
    @@:
1907
@@:
1894
        jmp     .next
1908
        jmp     .next
1895
 
1909
 
Line 1896... Line 1910...
1896
  .got_sizes:
1910
.got_sizes:
1897
        invoke  img.create, eax, ecx, Image.bpp32
1911
        invoke  img.create, eax, ecx, Image.bpp32
1898
        test    eax, eax
1912
        test    eax, eax
1899
        jz      .error
1913
        jz      .error
1900
        mov     ebx, eax
1914
        mov     ebx, eax
Line 1901... Line 1915...
1901
 
1915
 
1902
        mov     eax, [bg_color]
1916
        mov     eax, [bg_color]
1903
        mov     edi, [ebx + Image.Data]
1917
        mov     edi, [ebx+Image.Data]
1904
        mov     ecx, [ebx + Image.Width]
1918
        mov     ecx, [ebx+Image.Width]
1905
        imul    ecx, [ebx + Image.Height]
1919
        imul    ecx, [ebx+Image.Height]
1906
        rep     stosd
1920
        rep     stosd
1907
 
1921
 
1908
        mov     eax, [_img]
1922
        mov     eax, [_img]
1909
        cmp     [eax + Image.Type], Image.bpp32
1923
        cmp     [eax+Image.Type], Image.bpp32
1910
        jz      @f
1924
        jz      @f
1911
        invoke  img.convert, eax, 0, Image.bpp32, 0, 0
1925
        invoke  img.convert, eax, 0, Image.bpp32, 0, 0
1912
        test    eax, eax
1926
        test    eax, eax
1913
        jz      .error
1927
        jz      .error
1914
        push    eax
1928
        push    eax
1915
        invoke  img.destroy, [_img]
1929
        invoke  img.destroy, [_img]
1916
        pop     eax
1930
        pop     eax
1917
    @@:
1931
@@:
1918
        mov     esi, eax
1932
        mov     esi, eax
1919
        xor     edi, edi
1933
        xor     edi, edi
1920
  .next_img:
1934
.next_img:
1921
        stdcall put_img_on_img, ebx, esi, edi, 0
1935
        stdcall put_img_on_img, ebx, esi, edi, 0
1922
        add     edi, [esi + Image.Width]
1936
        add     edi, [esi+Image.Width]
1923
        inc     edi
1937
        inc     edi
1924
        cmp     [esi + Image.Next], 0
1938
        cmp     [esi+Image.Next], 0
Line 1925... Line 1939...
1925
        jz      @f
1939
        jz      @f
1926
        mov     esi, [esi + Image.Next]
1940
        mov     esi, [esi+Image.Next]
1927
        jmp     .next_img
1941
        jmp     .next_img
1928
    @@:
1942
@@:
1929
        invoke  img.destroy, esi
1943
        invoke  img.destroy, esi
1930
        mov     eax, ebx
1944
        mov     eax, ebx
Line 1944... Line 1958...
1944
endl
1958
endl
1945
        push    ebx esi edi
1959
        push    ebx esi edi
Line 1946... Line 1960...
1946
 
1960
 
1947
        mov     ebx, [_bottom]
1961
        mov     ebx, [_bottom]
1948
        mov     edx, [_top]
1962
        mov     edx, [_top]
1949
        mov     eax, [edx + Image.Height]
1963
        mov     eax, [edx+Image.Height]
1950
        mov     [img_height], eax
1964
        mov     [img_height], eax
1951
        mov     esi, [edx + Image.Data]
1965
        mov     esi, [edx+Image.Data]
1952
        mov     edi, [ebx + Image.Data]
1966
        mov     edi, [ebx+Image.Data]
1953
        mov     eax, [_y]
1967
        mov     eax, [_y]
1954
        imul    eax, [ebx + Image.Width]
1968
        imul    eax, [ebx+Image.Width]
1955
        add     eax, [_x]
1969
        add     eax, [_x]
1956
        shl     eax, 2
1970
        shl     eax, 2
1957
        add     edi, eax
1971
        add     edi, eax
1958
  .next_line:
1972
.next_line:
1959
        mov     ecx, [edx + Image.Width]
1973
        mov     ecx, [edx+Image.Width]
1960
        rep     movsd
1974
        rep     movsd
1961
        mov     eax, [ebx + Image.Width]
1975
        mov     eax, [ebx+Image.Width]
1962
        sub     eax, [edx + Image.Width]
1976
        sub     eax, [edx+Image.Width]
1963
        shl     eax, 2
1977
        shl     eax, 2
1964
        add     edi, eax
1978
        add     edi, eax
1965
        dec     [img_height]
1979
        dec     [img_height]
Line 2004... Line 2018...
2004
        mov     [toolbar.width], eax
2018
        mov     [toolbar.width], eax
2005
        mov     [toolbar.height], 0
2019
        mov     [toolbar.height], 0
2006
        cmp     [bShowToolbar], 1
2020
        cmp     [bShowToolbar], 1
2007
        jnz     @f
2021
        jnz     @f
2008
        mov     [toolbar.height], TOOLBAR_HEIGHT
2022
        mov     [toolbar.height], TOOLBAR_HEIGHT
2009
    @@:
2023
@@:
Line 2010... Line 2024...
2010
 
2024
 
2011
        mov     eax, [toolbar.top]
2025
        mov     eax, [toolbar.top]
2012
        add     eax, [client_abs_top]
2026
        add     eax, [client_abs_top]
2013
        mov     [toolbar_abs_top], eax
2027
        mov     [toolbar_abs_top], eax
Line 2020... Line 2034...
2020
        stdcall cmp_box, toolbar, toolbar_prev
2034
        stdcall cmp_box, toolbar, toolbar_prev
2021
        jnz     .recalc_toolbar
2035
        jnz     .recalc_toolbar
2022
        test    [bNewImage], 1
2036
        test    [bNewImage], 1
2023
        jnz     .recalc_toolbar
2037
        jnz     .recalc_toolbar
2024
        jmp     .recalc_toolbar_done
2038
        jmp     .recalc_toolbar_done
2025
  .recalc_toolbar:
2039
.recalc_toolbar:
2026
        stdcall recalc_toolbar
2040
        stdcall recalc_toolbar
2027
  .recalc_toolbar_done:
2041
.recalc_toolbar_done:
Line 2028... Line 2042...
2028
 
2042
 
2029
        stdcall copy_box, work, work_prev
2043
        stdcall copy_box, work, work_prev
2030
        xor     ecx, ecx
2044
        xor     ecx, ecx
2031
        test     [bShowToolbar], 1
2045
        test     [bShowToolbar], 1
2032
        jz      @f
2046
        jz      @f
2033
        mov     ecx, [toolbar.height]
2047
        mov     ecx, [toolbar.height]
2034
    @@:
2048
@@:
2035
        mov     eax, ecx
2049
        mov     eax, ecx
2036
        mov     [work.top], eax
2050
        mov     [work.top], eax
2037
        mov     eax, [client.height]
2051
        mov     eax, [client.height]
2038
        sub     eax, ecx
2052
        sub     eax, ecx
Line 2053... Line 2067...
2053
        test    [bNewImage], 1
2067
        test    [bNewImage], 1
2054
        jnz     .recalc_work
2068
        jnz     .recalc_work
2055
        stdcall cmp_box, work, work_prev
2069
        stdcall cmp_box, work, work_prev
2056
        jnz     .recalc_work
2070
        jnz     .recalc_work
2057
        jmp     .recalc_work_done
2071
        jmp     .recalc_work_done
2058
  .recalc_work:
2072
.recalc_work:
2059
        stdcall recalc_work
2073
        stdcall recalc_work
2060
  .recalc_work_done:
2074
.recalc_work_done:
Line 2061... Line 2075...
2061
 
2075
 
2062
        ret
2076
        ret
Line 2071... Line 2085...
2071
 
2085
 
2072
proc recalc_window
2086
proc recalc_window
2073
        stdcall copy_box, client, client_prev
2087
        stdcall copy_box, client, client_prev
2074
        test    [bSlideShow], 1
2088
        test    [bSlideShow], 1
2075
        jz      .no_slide_show
2089
        jz      .no_slide_show
2076
  .slide_show:
2090
.slide_show:
2077
        mov     [client.left], 0
2091
        mov     [client.left], 0
2078
        mov     [client.top], 0
2092
        mov     [client.top], 0
2079
        mov     eax, [procinfo.box.width]
2093
        mov     eax, [procinfo.box.width]
2080
        mov     [client.width], eax
2094
        mov     [client.width], eax
2081
        mov     eax, [procinfo.box.height]
2095
        mov     eax, [procinfo.box.height]
2082
        mov     [client.height], eax
2096
        mov     [client.height], eax
2083
        jmp     .calc_abs
2097
        jmp     .calc_abs
2084
  .no_slide_show:
2098
.no_slide_show:
2085
        mcall   SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
2099
        mcall   SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
2086
        mov     [client.top], eax
2100
        mov     [client.top], eax
2087
        neg     eax
2101
        neg     eax
2088
        add     eax, [procinfo.box.height]
2102
        add     eax, [procinfo.box.height]
Line 2091... Line 2105...
2091
        mov     [client.left], 5
2105
        mov     [client.left], 5
2092
        mov     eax, [procinfo.box.width]
2106
        mov     eax, [procinfo.box.width]
2093
        sub     eax, 10
2107
        sub     eax, 10
2094
        mov     [client.width], eax
2108
        mov     [client.width], eax
Line 2095... Line 2109...
2095
 
2109
 
2096
  .calc_abs:
2110
.calc_abs:
2097
        mov     eax, [client.top]
2111
        mov     eax, [client.top]
2098
        mov     [client_abs_top], eax
2112
        mov     [client_abs_top], eax
2099
        mov     eax, [client.left]
2113
        mov     eax, [client.left]
Line 2104... Line 2118...
2104
        test    [bNewImage], 1
2118
        test    [bNewImage], 1
2105
        jnz     .recalc_client
2119
        jnz     .recalc_client
2106
        test    [bToggleToolbar], 1
2120
        test    [bToggleToolbar], 1
2107
        jnz     .recalc_client
2121
        jnz     .recalc_client
2108
        jmp     .recalc_client_done
2122
        jmp     .recalc_client_done
2109
  .recalc_client:
2123
.recalc_client:
2110
        stdcall recalc_client
2124
        stdcall recalc_client
2111
  .recalc_client_done:
2125
.recalc_client_done:
Line 2112... Line 2126...
2112
 
2126
 
2113
        ret
2127
        ret
Line 2143... Line 2157...
2143
        jnz     .recalc_canvas
2157
        jnz     .recalc_canvas
2144
        test    [bNewImage], 1
2158
        test    [bNewImage], 1
2145
        jnz     .recalc_canvas
2159
        jnz     .recalc_canvas
2146
        stdcall cmp_box, canvas, canvas_prev
2160
        stdcall cmp_box, canvas, canvas_prev
2147
        jnz     .recalc_canvas
2161
        jnz     .recalc_canvas
-
 
2162
        cmp     [bScaleModeChanged], 0
-
 
2163
        jnz     .recalc_canvas
2148
        jmp     .recalc_canvas_done
2164
        jmp     .recalc_canvas_done
2149
  .recalc_canvas:
2165
.recalc_canvas:
2150
        stdcall recalc_canvas
2166
        stdcall recalc_canvas
2151
  .recalc_canvas_done:
2167
.recalc_canvas_done:
2152
        ret
2168
        ret
2153
endp
2169
endp
Line 2154... Line 2170...
2154
 
2170
 
2155
 
2171
 
2156
proc recalc_canvas
2172
proc recalc_canvas
2157
        stdcall copy_box, view, view_prev
2173
        stdcall copy_box, view, view_prev
Line 2158... Line 2174...
2158
        mov     eax, [scale_mode]
2174
        mov     eax, [scale_mode]
2159
        call    [scale_mode_calc + eax*4]
2175
        call    [scale_mode_calc+eax*4]
2160
 
2176
 
2161
        mov     eax, [view.top]
2177
        mov     eax, [view.top]
Line 2171... Line 2187...
2171
;-----------------------------------------------------------------------------
2187
;-----------------------------------------------------------------------------
2172
DATA
2188
DATA
Line 2173... Line 2189...
2173
 
2189
 
2174
s_header        db ' - Kolibri Image Viewer',0
2190
s_header        db ' - Kolibri Image Viewer',0
2175
window_style    dd 0x53FFFFFF
2191
window_style    dd 0x53FFFFFF
2176
window          BOX 101, 144, 750, 600  ; left top width height
2192
window          BOX 101, 144, 529, 324  ; left top width height
2177
window_prev     BOX 0, 0, 0, 0
2193
window_prev     BOX 0, 0, 0, 0
2178
window_save     BOX 0, 0, 0, 0  ; restore after slide show
2194
window_save     BOX 0, 0, 0, 0  ; restore after slide show
2179
client          BOX 0, 0, 0, 0
2195
client          BOX 0, 0, 0, 0
2180
client_prev     BOX 0, 0, 0, 0
2196
client_prev     BOX 0, 0, 0, 0
Line 2343... Line 2359...
2343
 
2359
 
2344
virtual at 0
2360
virtual at 0
2345
file 'kivicons.bmp':0xA,4
2361
file 'kivicons.bmp':0xA,4
2346
load offbits dword from 0
2362
load offbits dword from 0
2347
end virtual
2363
end virtual
2348
numimages = 10
2364
numimages = 11
2349
openbtn = 0
2365
openbtn = 0
2350
backbtn = 1
2366
backbtn = 1
2351
forwardbtn = 2
2367
forwardbtn = 2
2352
bgrbtn = 3
2368
bgrbtn = 3
2353
fliphorzbtn = 4
2369
fliphorzbtn = 4
2354
flipvertbtn = 5
2370
flipvertbtn = 5
2355
rotcwbtn = 6
2371
rotcwbtn = 6
2356
rotccwbtn = 7
2372
rotccwbtn = 7
2357
rot180btn = 8
2373
rot180btn = 8
-
 
2374
slidebtn = 9
Line 2358... Line 2375...
2358
slidebtn = 9
2375
scalebtn = 10
2359
 
2376
 
2360
palette:
2377
palette:
2361
    file 'kivicons.bmp':0x36,offbits-0x36
2378
    file 'kivicons.bmp':0x36,offbits-0x36
2362
buttons:
2379
buttons:
2363
    file 'kivicons.bmp':offbits
2380
    file 'kivicons.bmp':offbits
2364
repeat 10
2381
repeat 11
2365
y = % - 1
2382
y = %-1
2366
z = 20 - %
2383
z = 20-%
2367
repeat numimages*5
2384
repeat numimages*5
2368
load a dword from $ - numimages*20*20 + numimages*20*y + (%-1)*4
2385
load a dword from $ - numimages*20*20 + numimages*20*y + (%-1)*4
2369
load b dword from $ - numimages*20*20 + numimages*20*z + (%-1)*4
2386
load b dword from $ - numimages*20*20 + numimages*20*z + (%-1)*4
Line 2425... Line 2442...
2425
end if
2442
end if
2426
communication_area_default_path:
2443
communication_area_default_path:
2427
    db '/rd/1',0
2444
    db '/rd/1',0
Line 2428... Line 2445...
2428
 
2445
 
2429
Filter:
2446
Filter:
2430
dd Filter.end - Filter
2447
dd Filter.end-Filter
2431
.1:
2448
.1:
2432
db 'BMP',0
2449
db 'BMP',0
2433
db 'GIF',0
2450
db 'GIF',0
2434
db 'JPG',0
2451
db 'JPG',0
Line 2489... Line 2506...
2489
readdir_fileinfo:
2506
readdir_fileinfo:
2490
    dd  1
2507
    dd  1
2491
    dd  0
2508
    dd  0
2492
    dd  0
2509
    dd  0
2493
readblocks dd   0
2510
readblocks dd   0
2494
directory_ptr   dd  0
2511
directory_ptr   dd 0
2495
curdir          db 1024 dup (?)
2512
curdir          rb 1024
2496
;------------------------------------------------------------------------------
2513
;------------------------------------------------------------------------------
Line 2497... Line 2514...
2497
 
2514
 
2498
I_END:
2515
I_END:
2499
align 4
2516
align 4
Line 2518... Line 2535...
2518
 
2535
 
2519
last_name_component rd 1
2536
last_name_component rd 1
Line 2520... Line 2537...
2520
toolbar.height_old  rd 1
2537
toolbar.height_old  rd 1
-
 
2538
 
-
 
2539
procinfo        process_information
2521
 
2540
scale_button_xy dd ?
2522
procinfo        process_information
2541
scale_button_letter dd ?        ; i.e. 'x1',0
2523
align 16
2542
align 16
2524
path            rb 4096
2543
path            rb 4096
2525
window_header   rb 256
2544
window_header   rb 256