Subversion Repositories Kolibri OS

Rev

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

Rev 4933 Rev 8932
Line 13... Line 13...
13
min_width = 54
13
min_width = 54
14
max_width = 255
14
max_width = 255
15
min_height = 8
15
min_height = 8
16
max_height = 255
16
max_height = 255
Line -... Line 17...
-
 
17
 
17
 
18
include '../../../KOSfuncs.inc'
18
include 'lang.inc'
19
include 'lang.inc'
19
include 'font.inc'
20
include 'font.inc'
20
include 'sort.inc'
21
include 'sort.inc'
21
include 'kglobals.inc'
22
include 'kglobals.inc'
Line 28... Line 29...
28
 
29
 
29
cursor_normal_size = (font_height*15+50)/100
30
cursor_normal_size = (font_height*15+50)/100
Line 30... Line 31...
30
cursor_big_size = font_height
31
cursor_big_size = font_height
-
 
32
 
-
 
33
start:
-
 
34
        mov     eax,SF_SET_EVENTS_MASK
31
 
35
		mov     ebx,(11b shl 30) or 100111b
32
start:
36
		int     0x40
33
        mov     edi, identical_table
37
		mov     edi, identical_table
34
        mov     ecx, 0x100
38
        mov     ecx, 0x100
35
        xor     eax, eax
39
        xor     eax, eax
Line 106... Line 110...
106
        stosd
110
        stosd
107
        xor     eax, eax
111
        xor     eax, eax
108
        stosd
112
        stosd
109
        stosd
113
        stosd
110
        stosb
114
        stosb
111
        push    68
115
        push    SF_SYS_MISC
112
        pop     eax
116
        pop     eax
113
        push    11
117
        push    SSF_HEAP_INIT
114
        pop     ebx
118
        pop     ebx
115
        int     0x40
119
        int     0x40
116
        call    init_console
120
        call    init_console
117
        call    draw_window
121
        call    draw_window
118
        push    66
122
        push    SF_KEYBOARD
119
        pop     eax
123
        pop     eax
120
        push    1
124
        push    SSF_SET_INPUT_MODE
121
        pop     ebx
125
        pop     ebx
122
        mov     ecx, ebx
126
        mov     ecx, ebx
123
        int     40h     ; set keyboard mode to scancodes
127
        int     40h     ; set keyboard mode to scancodes
124
        mov     eax, 200
128
        mov     eax, 200
125
        mov     [panel1_nfa], eax
129
        mov     [panel1_nfa], eax
Line 390... Line 394...
390
        call    get_event
394
        call    get_event
391
        dec     eax
395
        dec     eax
392
        jz      redraw
396
        jz      redraw
393
        dec     eax
397
        dec     eax
394
        jz      key
398
        jz      key
-
 
399
        sub     eax,4
-
 
400
        jz      mouse
395
; button - we have only one button, close
401
; button - we have only one button, close
396
exit:
402
exit:
397
; close all screens
403
; close all screens
398
@@:
404
@@:
399
        mov     ecx, [num_screens]
405
        mov     ecx, [num_screens]
Line 490... Line 496...
490
get_event:
496
get_event:
491
        push    ebx
497
        push    ebx
492
        mov     ebx, [idle_interval]
498
        mov     ebx, [idle_interval]
493
        cmp     ebx, -1
499
        cmp     ebx, -1
494
        jz      .infinite
500
        jz      .infinite
495
        push    23
501
        push    SF_WAIT_EVENT_TIMEOUT
496
        pop     eax
502
        pop     eax
497
        int     40h
503
        int     40h
498
        pop     ebx
504
        pop     ebx
499
        test    eax, eax
505
        test    eax, eax
500
        jnz     .ret
506
        jnz     .ret
Line 505... Line 511...
505
        jz      get_event
511
        jz      get_event
506
        call    eax
512
        call    eax
507
        jmp     get_event
513
        jmp     get_event
508
.infinite:
514
.infinite:
509
        pop     ebx
515
        pop     ebx
510
        push    10
516
        push    SF_WAIT_EVENT
511
        pop     eax
517
        pop     eax
512
        int     40h
518
        int     40h
513
.ret:
519
.ret:
514
        ret
520
        ret
Line 515... Line 521...
515
 
521
 
516
redraw:
522
redraw:
517
; query kbd state from OS
523
; query kbd state from OS
518
        mov     al, 66
524
        mov     al, SF_KEYBOARD
519
        push    3
525
        push    SSF_GET_CONTROL_KEYS
520
        pop     ebx
526
        pop     ebx
521
        int     0x40
527
        int     0x40
522
        and     eax, 0x3F
528
        and     eax, 0x3F
523
        cmp     al, [ctrlstate]
529
        cmp     al, [ctrlstate]
524
        mov     [ctrlstate], al
530
        mov     [ctrlstate], al
525
        jz      @f
531
        jz      @f
526
        call    draw_keybar
532
        call    draw_keybar
527
@@:
533
@@:
528
        mov     al, 9
534
        mov     al, SF_THREAD_INFO
529
        mov     ebx, procinfo
535
        mov     ebx, procinfo
530
        or      ecx, -1
536
        or      ecx, -1
531
        int     40h
537
        int     40h
532
; test if rolled up
538
; test if rolled up
533
; height of rolled up window is [skinh]+3
539
; height of rolled up window is [skinh]+3
534
        mov     eax, [ebx+46]
540
        mov     eax, [ebx+46]
535
        sub     eax, [skinh]
541
        sub     eax, [skinh]
536
        cmp     eax, 5
542
        cmp     eax, 5
537
        ja      @f
543
        ja      @f
538
        mov     al, 12
544
        mov     al, SF_REDRAW
539
        push    1
545
        push    SSF_BEGIN_DRAW
540
        pop     ebx
546
        pop     ebx
541
        int     0x40
547
        int     0x40
542
        xor     eax, eax
548
        xor     eax, eax
543
; ebx, ecx, edi are ignored by function 0 after first redraw
549
; ebx, ecx, edi are ignored by function 0 after first redraw
544
        mov     edx, 0x53000000
550
        mov     edx, 0x53000000
545
        int     0x40
551
        int     0x40
546
        mov     al, 12
552
        mov     al, SF_REDRAW
547
        inc     ebx
553
        inc     ebx
548
        int     0x40
554
        int     0x40
549
        jmp     event
555
        jmp     event
550
@@:
556
@@:
Line 606... Line 612...
606
        or      cl, ch
612
        or      cl, ch
607
        jz      @f
613
        jz      @f
608
        test    byte [ebx+70], 1
614
        test    byte [ebx+70], 1
609
        jnz     @f
615
        jnz     @f
610
.resize:
616
.resize:
611
        push    67
617
        push    SF_CHANGE_WINDOW
612
        pop     eax
618
        pop     eax
613
        or      ebx, -1
619
        or      ebx, -1
614
        or      ecx, -1
620
        or      ecx, -1
615
        mov     edx, [cur_width]
621
        mov     edx, [cur_width]
616
        imul    edx, font_width
622
        imul    edx, font_width
Line 644... Line 650...
644
        mov     eax, [saved_height]
650
        mov     eax, [saved_height]
645
        mov     [cur_height], eax
651
        mov     [cur_height], eax
646
        or      [saved_height], -1
652
        or      [saved_height], -1
647
        jmp     redraw.resize
653
        jmp     redraw.resize
648
@@:
654
@@:
649
        push    48
655
        push    SF_STYLE_SETTINGS
650
        pop     eax
656
        pop     eax
651
        push    5
657
        push    SSF_GET_SCREEN_AREA
652
        pop     ebx
658
        pop     ebx
653
        int     0x40
659
        int     0x40
654
        push    eax
660
        push    eax
655
        sub     eax, [esp+2]
661
        sub     eax, [esp+2]
656
        inc     eax
662
        inc     eax
Line 679... Line 685...
679
        add     edx, 5*2-1
685
        add     edx, 5*2-1
680
        mov     esi, [cur_height]
686
        mov     esi, [cur_height]
681
        imul    esi, font_height
687
        imul    esi, font_height
682
        add     esi, [skinh]
688
        add     esi, [skinh]
683
        add     esi, 4
689
        add     esi, 4
684
        push    67
690
        push    SF_CHANGE_WINDOW
685
        pop     eax
691
        pop     eax
686
        int     0x40
692
        int     0x40
687
        jmp     redraw.resize_draw
693
        jmp     redraw.resize_draw
688
key:
694
key:
689
        mov     al, 2
695
        mov     al, SF_GET_KEY
690
        int     40h
696
        int     40h
691
        test    al, al
697
        test    al, al
692
        jnz     event
698
        jnz     event
693
        xchg    al, ah
699
        xchg    al, ah
694
        cmp     al, 0xE0
700
        cmp     al, 0xE0
Line 771... Line 777...
771
        jmp     .keybar
777
        jmp     .keybar
772
.ralt_up:
778
.ralt_up:
773
        and     [ctrlstate], not 0x20
779
        and     [ctrlstate], not 0x20
774
        jmp     .keybar
780
        jmp     .keybar
Line -... Line 781...
-
 
781
 
-
 
782
align 16
-
 
783
mouse:
-
 
784
        mov     eax,SF_MOUSE_GET
-
 
785
        mov     ebx,SSF_BUTTON_EXT
-
 
786
        int     0x40
-
 
787
        bt      eax,8
-
 
788
        jnc     event
-
 
789
 
-
 
790
        mov     eax,SF_MOUSE_GET
-
 
791
        mov     ebx,SSF_WINDOW_POSITION
-
 
792
        int     0x40
-
 
793
		cmp     ax, word[skinh]
-
 
794
		jl      event
-
 
795
		shr     eax,16
-
 
796
        mov     ebx, [cur_width]
-
 
797
        imul    ebx, font_width/2
-
 
798
		add     ebx, 5 ;window border
-
 
799
		cmp     eax,ebx
-
 
800
		jg      @f
-
 
801
		cmp     [active_panel], panel1_data
-
 
802
		je      event
-
 
803
		jmp     .tab
-
 
804
@@:
-
 
805
		cmp     [active_panel], panel2_data
-
 
806
		je      event
-
 
807
.tab:
-
 
808
        xor     [active_panel], panel1_data xor panel2_data
-
 
809
        call    draw_cmdbar
-
 
810
        mov     ebp, [active_panel]
-
 
811
        xor     ebp, panel1_data xor panel2_data
-
 
812
        call    draw_panel
-
 
813
        mov     ebp, [active_panel]
-
 
814
        call    draw_panel
-
 
815
        jmp     event
-
 
816
 
775
 
817
align 16
776
process_ctrl_keys:
818
process_ctrl_keys:
777
        cmp     byte [esi], 0
819
        cmp     byte [esi], 0
778
        jz      .done
820
        jz      .done
779
        push    ecx
821
        push    ecx
Line 1810... Line 1852...
1810
        sub     esi, [ebx+8]
1852
        sub     esi, [ebx+8]
1811
        dec     esi
1853
        dec     esi
1812
        cmp     esi, 256
1854
        cmp     esi, 256
1813
        ja      .bigcmdline
1855
        ja      .bigcmdline
1814
.cmdlinelenok:
1856
.cmdlinelenok:
1815
        push    70
1857
        push    SF_FILE
1816
        pop     eax
1858
        pop     eax
1817
        int     40h
1859
        int     40h
1818
        xor     esi, esi
1860
        xor     esi, esi
1819
        xchg    esi, [restore_semicolon]
1861
        xchg    esi, [restore_semicolon]
1820
        test    esi, esi
1862
        test    esi, esi
Line 1836... Line 1878...
1836
        pop     eax
1878
        pop     eax
1837
        ret
1879
        ret
1838
@@:
1880
@@:
1839
        test    edx, edx
1881
        test    edx, edx
1840
        jz      @f
1882
        jz      @f
1841
        push    5
1883
        push    SF_SLEEP
1842
        pop     eax
1884
        pop     eax
1843
        push    20
1885
        push    20
1844
        pop     ebx
1886
        pop     ebx
1845
        int     0x40
1887
        int     0x40
1846
        jmp     .ctrl_r
1888
        jmp     .ctrl_r
Line 2071... Line 2113...
2071
        mov     byte [tmpname], '/'
2113
        mov     byte [tmpname], '/'
2072
        xor     edx, edx
2114
        xor     edx, edx
2073
        xor     ecx, ecx
2115
        xor     ecx, ecx
2074
.drive_loop_e:
2116
.drive_loop_e:
2075
        mov     byte [tmpname+1], 0
2117
        mov     byte [tmpname+1], 0
2076
        push    70
2118
        push    SF_FILE
2077
        pop     eax
2119
        pop     eax
2078
        int     40h
2120
        int     40h
2079
        mov     ebx, dirinfo
2121
        mov     ebx, dirinfo
2080
        test    eax, eax
2122
        test    eax, eax
2081
        jnz     .drive_loop_e_done
2123
        jnz     .drive_loop_e_done
Line 2087... Line 2129...
2087
        test    al, al
2129
        test    al, al
2088
        jnz     @b
2130
        jnz     @b
2089
        push    [ebx+dirinfo.first-dirinfo]
2131
        push    [ebx+dirinfo.first-dirinfo]
2090
        and     [ebx+dirinfo.first-dirinfo], 0
2132
        and     [ebx+dirinfo.first-dirinfo], 0
2091
.drive_loop_i:
2133
.drive_loop_i:
2092
        push    70
2134
        push    SF_FILE
2093
        pop     eax
2135
        pop     eax
2094
        int     40h
2136
        int     40h
2095
        mov     ebx, dirinfo
2137
        mov     ebx, dirinfo
2096
        test    eax, eax
2138
        test    eax, eax
2097
        jnz     .drive_loop_i_done
2139
        jnz     .drive_loop_i_done
Line 2503... Line 2545...
2503
        cmp     eax, 2
2545
        cmp     eax, 2
2504
        jbe     .createupdone1
2546
        jbe     .createupdone1
2505
        mov     dl, [edi]
2547
        mov     dl, [edi]
2506
        mov     byte [edi], 0
2548
        mov     byte [edi], 0
2507
        push    eax
2549
        push    eax
2508
        push    70
2550
        push    SF_FILE
2509
        pop     eax
2551
        pop     eax
2510
        mov     ebx, attrinfo
2552
        mov     ebx, attrinfo
2511
        int     0x40
2553
        int     0x40
2512
        test    eax, eax
2554
        test    eax, eax
2513
        pop     eax
2555
        pop     eax
Line 2563... Line 2605...
2563
        cmp     byte [edi], 1
2605
        cmp     byte [edi], 1
2564
        sbb     eax, -1
2606
        sbb     eax, -1
2565
        cmp     eax, 2
2607
        cmp     eax, 2
2566
        jbe     .docopy
2608
        jbe     .docopy
2567
        mov     [attrinfo.attr], 0      ; assume zero attributes if error
2609
        mov     [attrinfo.attr], 0      ; assume zero attributes if error
2568
        push    70
2610
        push    SF_FILE
2569
        pop     eax
2611
        pop     eax
2570
        mov     ebx, attrinfo
2612
        mov     ebx, attrinfo
2571
        int     0x40
2613
        int     0x40
2572
        test    [attrinfo.attr], 10h
2614
        test    [attrinfo.attr], 10h
2573
        setnz   dl
2615
        setnz   dl
Line 3649... Line 3691...
3649
        pop     eax
3691
        pop     eax
3650
        pop     eax
3692
        pop     eax
3651
        ret
3693
        ret
Line 3652... Line 3694...
3652
 
3694
 
3653
draw_window:
3695
draw_window:
3654
        push    12
3696
        push    SF_REDRAW
3655
        pop     eax
3697
        pop     eax
3656
        push    1
3698
        push    SSF_BEGIN_DRAW
3657
        pop     ebx
3699
        pop     ebx
3658
        int     40h
3700
        int     40h
3659
        mov     al, 48
3701
        mov     al, SF_STYLE_SETTINGS
3660
        mov     bl, 4
3702
        mov     bl, SSF_GET_SKIN_HEIGHT
3661
        int     40h
3703
        int     40h
3662
        mov     [skinh], eax
3704
        mov     [skinh], eax
3663
        mov     ebx, [cur_width]
3705
        mov     ebx, [cur_width]
3664
        imul    ebx, font_width
3706
        imul    ebx, font_width
Line 3668... Line 3710...
3668
        lea     ecx, [eax+ecx+5-1+100*65536]
3710
        lea     ecx, [eax+ecx+5-1+100*65536]
3669
        xor     eax, eax
3711
        xor     eax, eax
3670
        mov     edx, 0x53000000
3712
        mov     edx, 0x53000000
3671
        mov     edi, header
3713
        mov     edi, header
3672
        int     40h
3714
        int     40h
3673
        mov     al, 13
3715
        mov     al, SF_DRAW_RECT
3674
        xor     edx, edx
3716
        xor     edx, edx
3675
        cmp     [fill_width], 0
3717
        cmp     [fill_width], 0
3676
        jz      @f
3718
        jz      @f
3677
        mov     ebx, [wnd_width]
3719
        mov     ebx, [wnd_width]
3678
        sub     ebx, [fill_width]
3720
        sub     ebx, [fill_width]
Line 3698... Line 3740...
3698
        mov     cx, word [fill_height]
3740
        mov     cx, word [fill_height]
3699
        int     0x40
3741
        int     0x40
3700
@@:
3742
@@:
3701
;        xor     ecx, ecx
3743
;        xor     ecx, ecx
3702
;        call    draw_image
3744
;        call    draw_image
3703
        mov     al, 65
3745
        mov     al, SF_PUT_IMAGE_EXT
3704
        mov     ebx, [MemForImage]
3746
        mov     ebx, [MemForImage]
3705
        test    ebx, ebx
3747
        test    ebx, ebx
3706
        jz      @f
3748
        jz      @f
3707
        mov     ecx, [cur_width]
3749
        mov     ecx, [cur_width]
3708
        imul    ecx, font_width*10000h
3750
        imul    ecx, font_width*10000h
Line 3713... Line 3755...
3713
        mov     esi, 8
3755
        mov     esi, 8
3714
        mov     edi, console_colors
3756
        mov     edi, console_colors
3715
        xor     ebp, ebp
3757
        xor     ebp, ebp
3716
        int     0x40
3758
        int     0x40
3717
@@:
3759
@@:
3718
        mov     al, 12
3760
        mov     al, SF_REDRAW
3719
        push    2
3761
        push    SSF_END_DRAW
3720
        pop     ebx
3762
        pop     ebx
3721
        int     40h
3763
        int     40h
3722
        ret
3764
        ret
Line 3723... Line 3765...
3723
 
3765
 
3724
draw_image.nomem:
3766
draw_image.nomem:
3725
        mov     al, 13
3767
        mov     al, SF_DRAW_RECT
3726
        xor     edx, edx
3768
        xor     edx, edx
3727
        mov     ebx, [cur_width]
3769
        mov     ebx, [cur_width]
3728
        imul    ebx, font_width
3770
        imul    ebx, font_width
3729
        add     ebx, 5*65536
3771
        add     ebx, 5*65536
3730
        mov     ecx, [skinh-2]
3772
        mov     ecx, [skinh-2]
3731
        mov     cx, word [cur_height]
3773
        mov     cx, word [cur_height]
3732
        imul    cx, font_height
3774
        imul    cx, font_height
3733
        int     40h
3775
        int     40h
3734
        mov     al, 4
3776
        mov     al, SF_DRAW_TEXT
3735
        mov     ebx, 32*65536+32
3777
        mov     ebx, 32*65536+32
3736
        mov     ecx, 0xFFFFFF
3778
        mov     ecx, 0xFFFFFF
3737
        mov     edx, nomem_draw
3779
        mov     edx, nomem_draw
3738
        push    nomem_draw.size
3780
        push    nomem_draw.size
Line 3928... Line 3970...
3928
        imul    esi, [cur_width], font_width
3970
        imul    esi, [cur_width], font_width
3929
        mov     ebp, ecx
3971
        mov     ebp, ecx
3930
        shr     ebp, 16
3972
        shr     ebp, 16
3931
        sub     esi, ebp
3973
        sub     esi, ebp
3932
        mov     ebp, esi
3974
        mov     ebp, esi
3933
        push    65
3975
        push    SF_PUT_IMAGE_EXT
3934
        pop     eax
3976
        pop     eax
3935
        mov     edi, console_colors
3977
        mov     edi, console_colors
3936
        push    8
3978
        push    8
3937
        pop     esi
3979
        pop     esi
3938
        int     40h
3980
        int     40h
Line 4086... Line 4128...
4086
        mov     al, ' '
4128
        mov     al, ' '
4087
        mov     ah, [cmdbar_normal_color]
4129
        mov     ah, [cmdbar_normal_color]
4088
        rep     stosw
4130
        rep     stosw
4089
        ret
4131
        ret
Line -... Line 4132...
-
 
4132
 
4090
 
4133
align 16
4091
draw_border:
4134
draw_border:
4092
        push    edi
4135
        push    edi
4093
        mov     al, 0xC9
4136
        mov     al, 0xC9
4094
        stosw
4137
        stosw
Line 4215... Line 4258...
4215
        dec     edi
4258
        dec     edi
4216
.nodir:
4259
.nodir:
4217
        mov     byte [edi], 0
4260
        mov     byte [edi], 0
4218
        ret     10h
4261
        ret     10h
Line -... Line 4262...
-
 
4262
 
-
 
4263
;input:
-
 
4264
; ebp - pointer to panel1 or panel2
4219
 
4265
align 16
4220
draw_panel:
4266
draw_panel:
4221
        mov     eax, [ebp + panel1_left - panel1_data]
4267
        mov     eax, [ebp + panel1_left - panel1_data]
4222
        mov     edx, [ebp + panel1_top - panel1_data]
4268
        mov     edx, [ebp + panel1_top - panel1_data]
4223
        call    get_console_ptr
4269
        call    get_console_ptr
Line 5266... Line 5312...
5266
        pop     ebp
5312
        pop     ebp
5267
        mov     ebx, [dirinfo.dirdata]
5313
        mov     ebx, [dirinfo.dirdata]
5268
        mov     ebx, [ebx+4]
5314
        mov     ebx, [ebx+4]
5269
        jmp     .read
5315
        jmp     .read
5270
.native:
5316
.native:
5271
        push    70
5317
        push    SF_FILE
5272
        pop     eax
5318
        pop     eax
5273
        mov     ebx, dirinfo
5319
        mov     ebx, dirinfo
5274
        int     40h
5320
        int     40h
5275
.read:
5321
.read:
5276
        test    eax, eax
5322
        test    eax, eax