Subversion Repositories Kolibri OS

Rev

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

Rev 474 Rev 485
Line 6... Line 6...
6
memsize dd      mem
6
memsize dd      mem
7
        dd      stacktop
7
        dd      stacktop
8
        dd      0, app_path
8
        dd      0, app_path
Line 9... Line 9...
9
 
9
 
-
 
10
include 'lang.inc'
10
include 'lang.inc'
11
include '..\..\..\macros.inc'
11
include 'font.inc'
12
include 'font.inc'
12
include 'sort.inc'
13
include 'sort.inc'
13
include 'kglobals.inc'
14
include 'kglobals.inc'
14
include 'dialogs.inc'
15
include 'dialogs.inc'
Line 58... Line 59...
58
        mov     byte [edi-256+'ð'], 'ñ'
59
        mov     byte [edi-256+'ð'], 'ñ'
59
        push    68
60
        push    68
60
        pop     eax
61
        pop     eax
61
        push    11
62
        push    11
62
        pop     ebx
63
        pop     ebx
63
        int     0x40
64
        mcall
64
        call    init_console
65
        call    init_console
65
        call    draw_window
66
        call    draw_window
66
        push    66
67
        push    66
67
        pop     eax
68
        pop     eax
68
        push    1
69
        push    1
69
        pop     ebx
70
        pop     ebx
70
        mov     ecx, ebx
71
        mov     ecx, ebx
71
        int     40h     ; set keyboard mode to scancodes
72
        mcall     ; set keyboard mode to scancodes
72
        mov     eax, 200
73
        mov     eax, 200
73
        mov     [panel1_nfa], eax
74
        mov     [panel1_nfa], eax
74
        mov     [panel2_nfa], eax
75
        mov     [panel2_nfa], eax
75
        mov     ecx, 200*4 + 32 + 200*304
76
        mov     ecx, 200*4 + 32 + 200*304
76
        call    pgalloc
77
        call    pgalloc
Line 247... Line 248...
247
        call    read_folder
248
        call    read_folder
248
        call    draw_panel
249
        call    draw_panel
249
event:
250
event:
250
        push    10
251
        push    10
251
        pop     eax
252
        pop     eax
252
        int     40h
253
        mcall
253
        dec     eax
254
        dec     eax
254
        jz      redraw
255
        jz      redraw
255
        dec     eax
256
        dec     eax
256
        jz      key
257
        jz      key
257
; button - we have only one button, close
258
; button - we have only one button, close
258
exit:
259
exit:
259
        or      eax, -1
260
        or      eax, -1
260
        int     40h
261
        mcall
261
redraw:
262
redraw:
262
; query kbd state from OS
263
; query kbd state from OS
263
        mov     al, 66
264
        mov     al, 66
264
        push    3
265
        push    3
265
        pop     ebx
266
        pop     ebx
266
        int     0x40
267
        mcall
267
        and     eax, 0x3F
268
        and     eax, 0x3F
268
        cmp     al, [ctrlstate]
269
        cmp     al, [ctrlstate]
269
        mov     [ctrlstate], al
270
        mov     [ctrlstate], al
270
        jz      @f
271
        jz      @f
271
        call    draw_keybar
272
        call    draw_keybar
272
@@:
273
@@:
273
        mov     al, 9
274
        mov     al, 9
274
        mov     ebx, procinfo
275
        mov     ebx, procinfo
275
        or      ecx, -1
276
        or      ecx, -1
276
        int     40h
277
        mcall
277
; test if rolled up
278
; test if rolled up
278
; height of rolled up window is [skinh]+3
279
; height of rolled up window is [skinh]+3
279
        mov     eax, [ebx+46]
280
        mov     eax, [ebx+46]
280
        sub     eax, [skinh]
281
        sub     eax, [skinh]
281
        cmp     eax, 5
282
        cmp     eax, 5
282
        ja      @f
283
        ja      @f
283
        mov     al, 12
284
        mov     al, 12
284
        push    1
285
        push    1
285
        pop     ebx
286
        pop     ebx
286
        int     0x40
287
        mcall
287
        xor     eax, eax
288
        xor     eax, eax
288
; ebx, ecx, edi are ignored by function 0 after first redraw
289
; ebx, ecx, edi are ignored by function 0 after first redraw
289
        mov     edx, 0x53000000
290
        mov     edx, 0x53000000
290
        int     0x40
291
        mcall
291
        mov     al, 12
292
        mov     al, 12
292
        inc     ebx
293
        inc     ebx
293
        int     0x40
294
        mcall
294
        jmp     event
295
        jmp     event
295
@@:
296
@@:
296
        xor     ecx, ecx
297
        xor     ecx, ecx
297
        mov     eax, [ebx+42]
298
        mov     eax, [ebx+42]
298
        mov     [wnd_width], eax
299
        mov     [wnd_width], eax
Line 362... Line 363...
362
        add     edx, 5*2-1
363
        add     edx, 5*2-1
363
        mov     esi, [cur_height]
364
        mov     esi, [cur_height]
364
        imul    esi, font_height
365
        imul    esi, font_height
365
        add     esi, [skinh]
366
        add     esi, [skinh]
366
        add     esi, 5-1
367
        add     esi, 5-1
367
        int     40h
368
        mcall
368
.resize_draw:
369
.resize_draw:
369
        mov     ecx, [MemForImage]
370
        mov     ecx, [MemForImage]
370
        call    pgfree
371
        call    pgfree
371
        and     [MemForImage], 0
372
        and     [MemForImage], 0
372
        call    init_console
373
        call    init_console
Line 392... Line 393...
392
@@:
393
@@:
393
        push    48
394
        push    48
394
        pop     eax
395
        pop     eax
395
        push    5
396
        push    5
396
        pop     ebx
397
        pop     ebx
397
        int     0x40
398
        mcall
398
        push    eax
399
        push    eax
399
        sub     eax, [esp+2]
400
        sub     eax, [esp+2]
400
        inc     eax
401
        inc     eax
401
        movzx   eax, ax
402
        movzx   eax, ax
402
        sub     eax, 10
403
        sub     eax, 10
Line 425... Line 426...
425
        imul    esi, font_height
426
        imul    esi, font_height
426
        add     esi, [skinh]
427
        add     esi, [skinh]
427
        add     esi, 4
428
        add     esi, 4
428
        push    67
429
        push    67
429
        pop     eax
430
        pop     eax
430
        int     0x40
431
        mcall
431
        jmp     redraw.resize_draw
432
        jmp     redraw.resize_draw
432
key:
433
key:
433
        mov     al, 2
434
        mov     al, 2
434
        int     40h
435
        mcall
435
        test    al, al
436
        test    al, al
436
        jnz     event
437
        jnz     event
437
        xchg    al, ah
438
        xchg    al, ah
438
        cmp     al, 0xE0
439
        cmp     al, 0xE0
439
        jnz     @f
440
        jnz     @f
Line 1023... Line 1024...
1023
        cmp     esi, 256
1024
        cmp     esi, 256
1024
        ja      .bigcmdline
1025
        ja      .bigcmdline
1025
.cmdlinelenok:
1026
.cmdlinelenok:
1026
        push    70
1027
        push    70
1027
        pop     eax
1028
        pop     eax
1028
        int     40h
1029
        mcall
1029
        xor     esi, esi
1030
        xor     esi, esi
1030
        xchg    esi, [restore_semicolon]
1031
        xchg    esi, [restore_semicolon]
1031
        test    esi, esi
1032
        test    esi, esi
1032
        jz      @f
1033
        jz      @f
1033
        mov     byte [esi], ';'
1034
        mov     byte [esi], ';'
Line 1055... Line 1056...
1055
        jz      @f
1056
        jz      @f
1056
        push    5
1057
        push    5
1057
        pop     eax
1058
        pop     eax
1058
        push    20
1059
        push    20
1059
        pop     ebx
1060
        pop     ebx
1060
        int     0x40
1061
        mcall
1061
        jmp     .ctrl_r
1062
        jmp     .ctrl_r
1062
@@:
1063
@@:
1063
        ret
1064
        ret
1064
.bigfilename3:
1065
.bigfilename3:
1065
        pop     esi
1066
        pop     esi
Line 1233... Line 1234...
1233
        xor     ecx, ecx
1234
        xor     ecx, ecx
1234
.drive_loop_e:
1235
.drive_loop_e:
1235
        mov     byte [tmpname+1], 0
1236
        mov     byte [tmpname+1], 0
1236
        push    70
1237
        push    70
1237
        pop     eax
1238
        pop     eax
1238
        int     40h
1239
        mcall
1239
        mov     ebx, dirinfo
1240
        mov     ebx, dirinfo
1240
        test    eax, eax
1241
        test    eax, eax
1241
        jnz     .drive_loop_e_done
1242
        jnz     .drive_loop_e_done
1242
        mov     esi, driveinfo+32+40
1243
        mov     esi, driveinfo+32+40
1243
        mov     edi, tmpname+1
1244
        mov     edi, tmpname+1
Line 1249... Line 1250...
1249
        push    [ebx+dirinfo.first-dirinfo]
1250
        push    [ebx+dirinfo.first-dirinfo]
1250
        and     [ebx+dirinfo.first-dirinfo], 0
1251
        and     [ebx+dirinfo.first-dirinfo], 0
1251
.drive_loop_i:
1252
.drive_loop_i:
1252
        push    70
1253
        push    70
1253
        pop     eax
1254
        pop     eax
1254
        int     40h
1255
        mcall
1255
        mov     ebx, dirinfo
1256
        mov     ebx, dirinfo
1256
        test    eax, eax
1257
        test    eax, eax
1257
        jnz     .drive_loop_i_done
1258
        jnz     .drive_loop_i_done
1258
        add     ecx, 32+8
1259
        add     ecx, 32+8
1259
        push    ecx
1260
        push    ecx
Line 1539... Line 1540...
1539
        mov     ebx, attrinfo
1540
        mov     ebx, attrinfo
1540
        mov     [attrinfo.attr], 0
1541
        mov     [attrinfo.attr], 0
1541
        mov     [ebx + attrinfo.name - attrinfo], esi
1542
        mov     [ebx + attrinfo.name - attrinfo], esi
1542
        push    70
1543
        push    70
1543
        pop     eax
1544
        pop     eax
1544
        int     0x40
1545
        mcall
1545
        mov     cl, byte [attrinfo.attr]
1546
        mov     cl, byte [attrinfo.attr]
1546
@@:
1547
@@:
1547
        test    cl, 0x10
1548
        test    cl, 0x10
1548
        jz      .copyfile
1549
        jz      .copyfile
1549
;  ¬ ¯®¤áã­ã«¨ ª â «®£ ­ §­ ç¥­¨ï, ¤®¯¨á뢠¥¬ ¨¬ï ä ©« 
1550
;  ¬ ¯®¤áã­ã«¨ ª â «®£ ­ §­ ç¥­¨ï, ¤®¯¨á뢠¥¬ ¨¬ï ä ©« 
Line 1608... Line 1609...
1608
        mov     [ebx+readinfo.name-readinfo], esi
1609
        mov     [ebx+readinfo.name-readinfo], esi
1609
.copyloop:
1610
.copyloop:
1610
        mov     ebx, readinfo
1611
        mov     ebx, readinfo
1611
        push    70
1612
        push    70
1612
        pop     eax
1613
        pop     eax
1613
        int     0x40
1614
        mcall
1614
        test    eax, eax
1615
        test    eax, eax
1615
        jz      .copyreadok
1616
        jz      .copyreadok
1616
        cmp     eax, 6
1617
        cmp     eax, 6
1617
        jz      .copyreadok
1618
        jz      .copyreadok
1618
        push    esi
1619
        push    esi
Line 1640... Line 1641...
1640
        mov     [writeinfo.size], ebx
1641
        mov     [writeinfo.size], ebx
1641
.copywrite:
1642
.copywrite:
1642
        mov     ebx, writeinfo
1643
        mov     ebx, writeinfo
1643
        push    70
1644
        push    70
1644
        pop     eax
1645
        pop     eax
1645
        int     0x40
1646
        mcall
1646
        test    eax, eax
1647
        test    eax, eax
1647
        jz      .copywriteok
1648
        jz      .copywriteok
1648
        push    edi
1649
        push    edi
1649
        push    dword aCannotWriteFile
1650
        push    dword aCannotWriteFile
1650
        call    get_error_msg
1651
        call    get_error_msg
Line 1697... Line 1698...
1697
        mov     ebx, delinfo
1698
        mov     ebx, delinfo
1698
        push    dword [ebx+21]
1699
        push    dword [ebx+21]
1699
        mov     dword [ebx+21], edi
1700
        mov     dword [ebx+21], edi
1700
        push    70
1701
        push    70
1701
        pop     eax
1702
        pop     eax
1702
        int     0x40
1703
        mcall
1703
; ignore errors
1704
; ignore errors
1704
        pop     dword [delinfo+21]
1705
        pop     dword [delinfo+21]
1705
        jmp     .copydone
1706
        jmp     .copydone
Line 1706... Line 1707...
1706
 
1707
 
Line 2138... Line 2139...
2138
.mkdir_absolute_path:
2139
.mkdir_absolute_path:
2139
.mkdir_retry:
2140
.mkdir_retry:
2140
        push    70
2141
        push    70
2141
        pop     eax
2142
        pop     eax
2142
        mov     ebx, mkdirinfo
2143
        mov     ebx, mkdirinfo
2143
        int     0x40
2144
        mcall
2144
        test    eax, eax
2145
        test    eax, eax
2145
        jz      @f
2146
        jz      @f
2146
        push    dword CopyDestEditBuf+12
2147
        push    dword CopyDestEditBuf+12
2147
        push    dword aCannotMakeFolder
2148
        push    dword aCannotMakeFolder
2148
        call    get_error_msg
2149
        call    get_error_msg
Line 2433... Line 2434...
2433
draw_window:
2434
draw_window:
2434
        push    12
2435
        push    12
2435
        pop     eax
2436
        pop     eax
2436
        push    1
2437
        push    1
2437
        pop     ebx
2438
        pop     ebx
2438
        int     40h
2439
        mcall
2439
        mov     al, 48
2440
        mov     al, 48
2440
        mov     bl, 4
2441
        mov     bl, 4
2441
        int     40h
2442
        mcall
2442
        mov     [skinh], eax
2443
        mov     [skinh], eax
2443
        mov     ebx, [cur_width]
2444
        mov     ebx, [cur_width]
2444
        imul    ebx, font_width
2445
        imul    ebx, font_width
2445
        add     ebx, 100*65536 + 5*2-1
2446
        add     ebx, 100*65536 + 5*2-1
2446
        mov     ecx, [cur_height]
2447
        mov     ecx, [cur_height]
2447
        imul    ecx, font_height
2448
        imul    ecx, font_height
2448
        lea     ecx, [eax+ecx+5-1+100*65536]
2449
        lea     ecx, [eax+ecx+5-1+100*65536]
2449
        xor     eax, eax
2450
        xor     eax, eax
2450
        mov     edx, 0x53000000
2451
        mov     edx, 0x53000000
2451
        mov     edi, header
2452
        mov     edi, title
2452
        int     40h
2453
        mcall
2453
        mov     al, 13
2454
        mov     al, 13
2454
        xor     edx, edx
2455
        xor     edx, edx
2455
        cmp     [fill_width], 0
2456
        cmp     [fill_width], 0
2456
        jz      @f
2457
        jz      @f
2457
        mov     ebx, [wnd_width]
2458
        mov     ebx, [wnd_width]
Line 2461... Line 2462...
2461
        mov     bx, word [fill_width]
2462
        mov     bx, word [fill_width]
2462
        mov     ecx, [skinh-2]
2463
        mov     ecx, [skinh-2]
2463
        mov     cx, word [wnd_height]
2464
        mov     cx, word [wnd_height]
2464
        sub     cx, word [skinh]
2465
        sub     cx, word [skinh]
2465
        sub     cx, 5-1
2466
        sub     cx, 5-1
2466
        int     0x40
2467
        mcall
2467
@@:
2468
@@:
2468
        cmp     [fill_height], 0
2469
        cmp     [fill_height], 0
2469
        jz      @f
2470
        jz      @f
2470
        xor     edx, edx
2471
        xor     edx, edx
2471
        mov     ebx, 50000h
2472
        mov     ebx, 50000h
Line 2474... Line 2475...
2474
        mov     ecx, [wnd_height]
2475
        mov     ecx, [wnd_height]
2475
        sub     ecx, [fill_height]
2476
        sub     ecx, [fill_height]
2476
        sub     ecx, 5-1
2477
        sub     ecx, 5-1
2477
        shl     ecx, 16
2478
        shl     ecx, 16
2478
        mov     cx, word [fill_height]
2479
        mov     cx, word [fill_height]
2479
        int     0x40
2480
        mcall
2480
@@:
2481
@@:
2481
;        xor     ecx, ecx
2482
;        xor     ecx, ecx
2482
;        call    draw_image
2483
;        call    draw_image
2483
        mov     al, 65
2484
        mov     al, 65
2484
        mov     ebx, [MemForImage]
2485
        mov     ebx, [MemForImage]
Line 2491... Line 2492...
2491
        mov     edx, [skinh]
2492
        mov     edx, [skinh]
2492
        add     edx, 5*10000h
2493
        add     edx, 5*10000h
2493
        mov     esi, 8
2494
        mov     esi, 8
2494
        mov     edi, console_colors
2495
        mov     edi, console_colors
2495
        xor     ebp, ebp
2496
        xor     ebp, ebp
2496
        int     0x40
2497
        mcall
2497
@@:
2498
@@:
2498
        mov     al, 12
2499
        mov     al, 12
2499
        push    2
2500
        push    2
2500
        pop     ebx
2501
        pop     ebx
2501
        int     40h
2502
        mcall
2502
        ret
2503
        ret
Line 2503... Line 2504...
2503
 
2504
 
2504
draw_image.nomem:
2505
draw_image.nomem:
2505
        mov     al, 13
2506
        mov     al, 13
Line 2508... Line 2509...
2508
        imul    ebx, font_width
2509
        imul    ebx, font_width
2509
        add     ebx, 5*65536
2510
        add     ebx, 5*65536
2510
        mov     ecx, [skinh-2]
2511
        mov     ecx, [skinh-2]
2511
        mov     cx, word [cur_height]
2512
        mov     cx, word [cur_height]
2512
        imul    cx, font_height
2513
        imul    cx, font_height
2513
        int     40h
2514
        mcall
2514
        mov     al, 4
2515
        mov     al, 4
2515
        mov     ebx, 32*65536+32
2516
        mov     ebx, 32*65536+32
2516
        mov     ecx, 0xFFFFFF
2517
        mov     ecx, 0xFFFFFF
2517
        mov     edx, nomem_draw
2518
        mov     edx, nomem_draw
2518
        push    nomem_draw.size
2519
        push    nomem_draw.size
2519
        pop     esi
2520
        pop     esi
2520
        int     40h
2521
        mcall
2521
        ret
2522
        ret
Line 2522... Line 2523...
2522
 
2523
 
2523
draw_image:
2524
draw_image:
2524
        mov     [bMemForImageValidData], byte 1
2525
        mov     [bMemForImageValidData], byte 1
Line 2712... Line 2713...
2712
        push    65
2713
        push    65
2713
        pop     eax
2714
        pop     eax
2714
        mov     edi, console_colors
2715
        mov     edi, console_colors
2715
        push    8
2716
        push    8
2716
        pop     esi
2717
        pop     esi
2717
        int     40h
2718
        mcall
2718
.nodraw:
2719
.nodraw:
2719
        ret
2720
        ret
Line 2720... Line 2721...
2720
 
2721
 
2721
get_console_ptr:
2722
get_console_ptr:
Line 3934... Line 3935...
3934
        mov     dword [ebp + panel1_selected_size+4 - panel1_data], eax
3935
        mov     dword [ebp + panel1_selected_size+4 - panel1_data], eax
3935
.retry:
3936
.retry:
3936
        push    70
3937
        push    70
3937
        pop     eax
3938
        pop     eax
3938
        mov     ebx, dirinfo
3939
        mov     ebx, dirinfo
3939
        int     40h
3940
        mcall
3940
        test    eax, eax
3941
        test    eax, eax
3941
        jz      .ok
3942
        jz      .ok
3942
        cmp     eax, 6
3943
        cmp     eax, 6
3943
        jz      .ok
3944
        jz      .ok
3944
; Failed to read folder, notify user
3945
; Failed to read folder, notify user
Line 5163... Line 5164...
5163
        stc
5164
        stc
5164
.found:
5165
.found:
5165
        pop     esi
5166
        pop     esi
5166
        ret
5167
        ret
Line 5167... Line 5168...
5167
 
5168
 
Line 5168... Line 5169...
5168
header  db      'Kolibri Far 0.32',0
5169
title  db      'Kolibri Far 0.32',0
5169
 
5170
 
Line 5170... Line 5171...
5170
nomem_draw      db      'No memory for redraw.',0
5171
nomem_draw      db      'No memory for redraw.',0