Subversion Repositories Kolibri OS

Rev

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

Rev 483 Rev 507
Line 591... Line 591...
591
macro use_key_no_process  up,down,esc
591
macro use_key_no_process  up,down,esc
592
{
592
{
593
if up eq 
593
if up eq 
594
else
594
else
595
        cmp     ah,177
595
        cmp     ah,177
596
        jz      .no_figure
596
        jz      .editbox_exit
597
end if
597
end if
598
if down eq 
598
if down eq 
599
else
599
else
600
        cmp     ah,178
600
        cmp     ah,178
601
        jz      .no_figure
601
        jz      .editbox_exit
602
end if
602
end if
603
if esc eq 
603
if esc eq 
604
else
604
else
605
        cmp     ah,27   ;ESC - ª« ¢¨è  ))
605
        cmp     ah,27   ;ESC - ª« ¢¨è  ))
606
        jz      .no_figure
606
        jz      .editbox_exit
607
end if
607
end if
608
}
608
}
Line 609... Line 609...
609
 
609
 
610
macro use_key_figures_only
610
macro use_key_figures_only
611
{
611
{
612
        test    word ed_flags,ed_figure_only  ; ⮫쪮 æ¨äàë ?
612
        test    word ed_flags,ed_figure_only  ; ⮫쪮 æ¨äàë ?
613
        jz      @f
613
        jz      @f
614
        cmp     ah,'0'
614
        cmp     ah,'0'
615
        jb      .no_figure
615
        jb      .editbox_exit
616
        cmp     ah,'9'
616
        cmp     ah,'9'
-
 
617
        ja      .editbox_exit
617
        ja      .no_figure
618
@@:
-
 
619
}
-
 
620
macro are_key_shift_press
-
 
621
{
-
 
622
        test    word ed_flags,ed_shift_on
-
 
623
        je      @f
-
 
624
        ;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
-
 
625
        push    eax
-
 
626
        mov     edx,ed_size
-
 
627
        mov     ecx,ed_pos
-
 
628
        pusha
-
 
629
;;;;;;;;;;;;;;;;;;;;;
-
 
630
        mov     ebp,ed_color
-
 
631
        mov     ebx,dword       ed_shift_pos
-
 
632
        call    .sh_cl_
-
 
633
;;;;;;;;;;;;;;;;;;;;;
-
 
634
        popa 
-
 
635
        call    .del_char
-
 
636
;;;;
-
 
637
        mov     eax,dword ed_shift_pos
-
 
638
        mov     ebx,ed_size
-
 
639
        sub     ebx,eax
-
 
640
        mov     ed_size,ebx
-
 
641
        pop     eax
-
 
642
@@:
-
 
643
}
-
 
644
macro are_key_cur_end
-
 
645
{
-
 
646
        mov     ecx,ed_size
-
 
647
        mov     edx, ed_max
-
 
648
        test    word ed_flags,ed_insert
-
 
649
        jne     @f
-
 
650
        cmp     ecx,edx
-
 
651
        jae     .editbox_exit
-
 
652
@@:     mov     ebx, ed_pos
-
 
653
        cmp     ebx,edx
-
 
654
        jl      @f ; ¥á«¨ ¬¥­ìè¥ ¨«¨ à ¢­®
-
 
655
        jmp     .editbox_exit
-
 
656
 
-
 
657
@@:     ; ᤢ¨£ ¥¬ ᨬ¢®«ë ¯®á«¥ ªãàá®à  ¢¯à ¢®
-
 
658
        mov     ecx,ed_size
-
 
659
        push    edi eax
-
 
660
        mov     ebp,edi
-
 
661
        mov     esi,ed_text     ; “ª § â¥«ì ­  ¡ãä¥à
-
 
662
                                ;ã¤¥¬ à ¡®â âì á® áâப®©
-
 
663
        add     esi,ecx         ;add ed_size ¤®¡ ¢¨¬ max size
-
 
664
        mov     edi,esi
-
 
665
 
-
 
666
        cmp     ecx,ebx         ;…᫨ ã ­ á ¯®§¨æ¨ï ªãàá®à  = ⥪ã饬ã à §¬¥àã ­ ¯¥ç â ­­ëå ᨬ¢®«®¢ â.¥. ªãàá®à á⮨⠢ ª®­æ¥
-
 
667
        je      .In_k
-
 
668
 
-
 
669
        test    word [ebp+40],ed_insert ;IF insert is enable  â.ª. edi ¨§¬¥­¥­  ¤à¥á㥬 ç¥à¥§ ebp
-
 
670
        jne     .ins_v
-
 
671
;clear
-
 
672
pusha
-
 
673
        mov     edi,ebp
-
 
674
        mov     ebp,ed_size
-
 
675
        call    .clear_bg
-
 
676
popa
-
 
677
        sub     ecx,ebx         ; ©¤¥¬ ª®«-¢® ᨬ¢®«®¢ ¤«ï ¯¥à¥¤¢¨¦¥­¨ï.
-
 
678
        inc     edi             ;‘¬¥á⨬ ­ è¨ ᨬ¢®«ë ¢ ¯à ¢®
-
 
679
        std
-
 
680
        inc     ecx
-
 
681
   @@:  
-
 
682
        ;--------
-
 
683
        lodsb
-
 
684
        stosb
-
 
685
        ;--------
-
 
686
        loop    @b
-
 
687
.In_k:  cld
-
 
688
        pop eax
-
 
689
        mov al,ah
-
 
690
        stosb
-
 
691
        pop edi
-
 
692
; ¢áâ ¢«ï¥¬ ª®¤ ª« ¢¨è¨ â㤠, £¤¥ ªãàá®à
-
 
693
        ; 㢥«¨ç¨¢ ¥¬ §­ ç¥­¨¥ à §¬¥à  ¨ ¯®§¨æ¨¨
-
 
694
        inc      dword ed_size
-
 
695
        inc      dword ed_pos
-
 
696
        call    .draw_all2
-
 
697
        jmp     .shift
-
 
698
}
-
 
699
macro use_work_key
-
 
700
{
-
 
701
.insert: test   word ed_flags,ed_insert ;not    word ed_insert
-
 
702
         je     @f
-
 
703
         and    word ed_flags,ed_insert_cl
-
 
704
        jmp     .editbox_exit
-
 
705
@@:
-
 
706
        or      word ed_flags,ed_insert
-
 
707
        jmp     .editbox_exit
-
 
708
.ins_v:
-
 
709
        dec     dword [ebp+42];ed_size    ;processing is insert
-
 
710
        sub     esi,ecx
-
 
711
        add     esi,ebx
-
 
712
        mov     edi,esi
-
 
713
;clear
-
 
714
pusha
-
 
715
        mov     edi,ebp
-
 
716
        mov     ebp,ed_pos
-
 
717
        call    .clear_bg
-
 
718
popa
-
 
719
        jmp     .In_k
-
 
720
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
721
.delete:        
-
 
722
        mov     edx,ed_size
-
 
723
        mov     ecx,ed_pos
-
 
724
        cmp     edx,ecx
-
 
725
        jg      .bac_del
-
 
726
        test    word ed_flags,ed_shift_on
-
 
727
        jne     .del_bac
-
 
728
edit_ex
-
 
729
.bac_del:       
-
 
730
        call    .del_char
-
 
731
        jmp     .draw_all
-
 
732
;;;;;;;;;;;;;;;;;;;;;;;;;;;;        
-
 
733
;--- ­ ¦ â  ª« ¢¨è  backspace ---
-
 
734
.backspace:
-
 
735
        ; ¯à®¢¥à塞, ªãàá®à ã «¥¢®£® ªà ï ?
-
 
736
        mov     ecx,ed_pos
-
 
737
        test    ecx,ecx
-
 
738
        jnz     .del_bac
-
 
739
        test    word ed_flags,ed_shift_on
Line -... Line 740...
-
 
740
        jne     .bac_del
-
 
741
 
-
 
742
edit_ex
-
 
743
.del_bac:
-
 
744
        mov     edx,ed_size
-
 
745
        cmp     edx,ecx ;if ed_pos=ed_size
-
 
746
        je      @f
-
 
747
        dec     ecx
-
 
748
        call    .del_char
-
 
749
@@:     test    word ed_flags,ed_shift_on
-
 
750
        jne     .bac_del
-
 
751
        dec      dword ed_pos
Line -... Line 752...
-
 
752
.draw_all:
-
 
753
        push    .shift;.draw_cursor_text;eax
-
 
754
 
-
 
755
        test    word ed_flags,ed_shift_on
-
 
756
        je      @f
-
 
757
        mov     eax,dword ed_shift_pos
Line -... Line 758...
-
 
758
        mov     ebx,ed_size
-
 
759
        sub     ebx,eax
-
 
760
        mov     ed_size,ebx
-
 
761
 
-
 
762
        mov     ebp,ed_color
-
 
763
        call    .clear_cursor
Line -... Line 764...
-
 
764
        call    .check_offset
-
 
765
        call    .draw_bg
-
 
766
        ret
-
 
767
@@:     dec      dword ed_size
-
 
768
 
-
 
769
.draw_all2:
-
 
770
        and    word ed_flags,ed_shift_cl
-
 
771
        mov     ebp,ed_color
-
 
772
        call    .clear_cursor
-
 
773
        call    .check_offset
-
 
774
        mov     ebp,ed_size
-
 
775
        call    .clear_bg
-
 
776
        ret
-
 
777
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
778
;--- ­ ¦ â  ª« ¢¨è  left ---
-
 
779
.left:  mov     ebx,ed_pos
-
 
780
        test    ebx,ebx
-
 
781
        jz      .sh_st_of
-
 
782
        or      word ed_flags,ed_left_fl
-
 
783
        call    .sh_first_sh
-
 
784
        dec      dword ed_pos
-
 
785
        call    .sh_enable
-
 
786
        jmp     .draw_cursor_text
-
 
787
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
788
;--- ­ ¦ â  ª« ¢¨è  right ---
-
 
789
.right: mov     ebx,ed_pos
-
 
790
        cmp     ebx,ed_size
-
 
791
        je      .sh_st_of
-
 
792
        and     word ed_flags,ed_right_fl
-
 
793
        call    .sh_first_sh
-
 
794
        inc     dword  ed_pos
-
 
795
        call    .sh_enable
-
 
796
        jmp     .draw_cursor_text
-
 
797
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
798
.home:  
-
 
799
        mov     ebx,ed_pos
-
 
800
        test    ebx,ebx
-
 
801
        jz      .sh_st_of
-
 
802
        call    .sh_first_sh
-
 
803
        xor     eax,eax
-
 
804
        mov     ed_pos,eax
-
 
805
        call    .sh_home_end
-
 
806
        jmp     .draw_cursor_text
-
 
807
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
808
.end:   
-
 
809
        mov     ebx,ed_pos
-
 
810
        cmp     ebx,dword ed_size
-
 
811
        je      .sh_st_of
-
 
812
        call    .sh_first_sh
-
 
813
        mov     eax,ed_size
-
 
814
        mov     ed_pos,eax
-
 
815
        call    .sh_home_end
-
 
816
        jmp     .draw_cursor_text
-
 
817
}
-
 
818
 
-
 
819
macro use_mouse_func scr_w
-
 
820
{
-
 
821
;----------------------------------------------------------
-
 
822
;--- Ž¡à ¡®âª  .mouse_wigwag
-
 
823
;----------------------------------------------------------
-
 
824
.mouse_wigwag:
-
 
825
        shr     eax,16
-
 
826
        or      word ed_flags,ed_shift_bac+ed_shift_on+ed_shift
-
 
827
;;;;;;;;;;;;;;;;;;
-
 
828
;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ª®£¤  ¯à®¨á室¨â ¢ë室 §  ¯à¥¤¥«ë editbox
-
 
829
;;;;;;;;;;;;;;;;;;
-
 
830
        mov     ebx,[procinfo.box.left]
-
 
831
        add     ebx,ed_left
-
 
832
if scr_w eq 
-
 
833
else
-
 
834
        add     ebx,dword scr_w
-
 
835
end if
-
 
836
        cmp     eax,ebx
Line -... Line 837...
-
 
837
        jb      .mleft
-
 
838
 
-
 
839
        add     ebx,ed_width
-
 
840
        cmp     eax,ebx
-
 
841
        ja      .mright 
-
 
842
 
-
 
843
        sub     ebx,ed_width
-
 
844
 
-
 
845
        xor     edx,edx
-
 
846
        sub     eax,ebx ; ¢ëç⨬ ¨§ ª®®à¤¨­ â ¬ë誨 ¯® ®á¨ å ª®®à¤¨­ âë ¤® editbox ¯® ®á¨ å
-
 
847
        mov     ebx,6
-
 
848
        div     ebx
-
 
849
;;;;;;;;;;;;;;;;;;
-
 
850
;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ¢ ¯à¥¤¥« å ®¡« á⨠editbox
-
 
851
;;;;;;;;;;;;;;;;;;
-
 
852
;®«ã稫¨ ª®®à¤¨­ âë ¢ eax ¬ë誨, â.¥. ªã¤  ®­  ¯¥à¥¬¥á⨫ áì
-
 
853
;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
-
 
854
        add     eax,ed_offset   ;¤®¡ ¢¨¬ ᬥ饭¨¥
-
 
855
        cmp     eax,dword ed_size       ;¥á«¨ ¢ë諨 §  ¯à¥¤¥«ë, â® ­¨ç¥£® ­¥ ¤¥« âì
-
 
856
        ja      .mwigvag
-
 
857
.mdraw: 
-
 
858
        mov     dword   ed_pos,eax ;á®åà ­¨¬ ­®¢®¥ §­ ç¥­¨¥
-
 
859
;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
-
 
860
        mov     ecx,dword       ed_shift_pos
-
 
861
        mov     ebx,dword       ed_shift_pos_old
-
 
862
        mov     dword   ed_shift_pos_old,eax    ;¢­¥á¥¬ ­®¢®¥ §­ ç¥­¨¥ áâ à®© ¯®§¨æ¨¨ ªãàá®à 
-
 
863
;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­ëå ®¡« á⥩
-
 
864
        cmp     ecx,ebx         ;¢ëïá­ï¥¬ ªã¤  ¡ë«® ¤¢¨¦¥­¨¥ ­  ®¤¨­ è £ ­ § ¤
-
 
865
        je      .m1_shem        ;¤¢¨¦¥­¨ï ­¥ ¡ë«® à ­¥¥ 
-
 
866
        jb      .msmaller       ;¤¢¨¦¥­¨¥ ¡ë«® ->
-
 
867
        cmp     ebx,eax         ;¤¢¨¦¥­¨¥ ¡ë«® ¤® í⮣® <- ¨ âãâ ¬ë ¯à®¢¥à塞 ᥩç á ªã¤  ¤¢¨¦¥­¨¥ ¯à®¨á室¨â
-
 
868
        ja      .m1_shem        ;¥á«¨ ¡ë«® ¤¢¨¦¥­¨¥ <- â® ­ã¦­® § ªà á¨âì ®¡« áâì
-
 
869
        je      .mwigvag        ;¥á«¨ ¨§¬¥­¥­¨ï ­¥ ¡ë«®, â® ­¨ç¥£® ­¥ ¤¥« âì
-
 
870
        mov     ebp,ed_color    ;âã⠭㦭® ®ç¨áâ¨âì ®¡« áâì c ed_pos ed_shift_pos_old
-
 
871
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
-
 
872
        call    .sh_cl_
-
 
873
        jmp     .mwigvag
-
 
874
.msmaller:
-
 
875
        cmp     ebx,eax
-
 
876
        jb      .m1_shem
-
 
877
        mov     ebp,ed_color
-
 
878
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
-
 
879
        call    .sh_cl_
-
 
880
        jmp     .mwigvag
-
 
881
;alike  =
-
 
882
.m1_shem: 
-
 
883
        mov     ebp,shift_color
-
 
884
;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
-
 
885
        mov     ebx,ecx
-
 
886
        call    .sh_cl_
-
 
887
        jmp     .mwigvag
-
 
888
.mwigvag:
-
 
889
        and     word ed_flags,ed_shift_mcl
-
 
890
        jmp     .draw_cursor_text
-
 
891
;       popa
-
 
892
;       ret
-
 
893
.mleft:
-
 
894
        mov     eax,ed_pos
-
 
895
        cmp     eax,0                                        
-
 
896
        jbe      .mwigvag
-
 
897
        dec     eax
-
 
898
        call    .check_offset
-
 
899
        push    eax
-
 
900
        mov     ebx,ed_shift_pos
-
 
901
        mov     ebp,shift_color
-
 
902
        call    .sh_cl_
-
 
903
        pop     eax
-
 
904
        jmp     .mdraw
-
 
905
.mright:
-
 
906
        mov     eax,ed_pos
-
 
907
        mov     ebx,ed_size
-
 
908
        cmp     eax,ebx
-
 
909
        jae     .mwigvag
-
 
910
        inc     eax
-
 
911
        call    .check_offset
-
 
912
        mov     ebx,ed_shift_pos
-
 
913
        mov     ebp,shift_color
-
 
914
        push    eax
-
 
915
        call    .sh_cl_
-
 
916
        pop     eax
-
 
917
        jmp     .mdraw  
-
 
918
}
-
 
919
 
-
 
920
macro use_work_mause scr_h,scr_w
-
 
921
;----------------------------------------------------------
-
 
922
;--- € ­¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à, ¢® ¢á¥ à §­ë¥ áâ®à®­ë?
-
 
923
;----------------------------------------------------------
-
 
924
{
-
 
925
        test    word ed_flags,ed_mouse_on
-
 
926
        jne     .mouse_wigwag
-
 
927
;----------------------------------------------------------
-
 
928
;--- ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box -------------
-
 
929
;----------------------------------------------------------
-
 
930
        mov     ebx,[procinfo.box.top]
-
 
931
        add     ebx,ed_top
-
 
932
if scr_h eq 
-
 
933
else
-
 
934
        add     ebx,scr_h
-
 
935
end if
-
 
936
        cmp     ax,bx
-
 
937
        jl      ._blur;.mouse_end_no_focus
-
 
938
 
-
 
939
        add     ebx,ed_height
-
 
940
        cmp     ax,bx
-
 
941
        jg      ._blur;.mouse_end_no_focus
-
 
942
 
-
 
943
        shr     eax,16
-
 
944
 
-
 
945
        mov     ebx,[procinfo.box.left]
-
 
946
        add     ebx,ed_left
-
 
947
if scr_w eq 
-
 
948
else
-
 
949
        add     ebx,scr_w
-
 
950
end if
-
 
951
        cmp     ax,bx
-
 
952
        jl      ._blur;.mouse_end_no_focus
-
 
953
 
-
 
954
        add     ebx,ed_width
-
 
955
        cmp     ax,bx
-
 
956
        jg      ._blur;.mouse_end_no_focus
-
 
957
;--- ¨§¬¥­ï¥¬ ¯®§¨æ¨î ªãàá®à  ---
-
 
958
        push    eax
-
 
959
        mov     ebp,ed_color
-
 
960
        call    .clear_cursor
-
 
961
        pop     eax
-
 
962
._mvpos:
-
 
963
        mov     ebx,dword [procinfo.box.left]
-
 
964
        xor     edx,edx
-
 
965
        sub     eax,ed_left
-
 
966
        sub     eax,ebx
-
 
967
if scr_w eq 
-
 
968
else
-
 
969
        add     ebx,scr_w
-
 
970
        sub     eax,2
-
 
971
end if
-
 
972
        mov     ebx,6
-
 
973
        div     bx
-
 
974
        add     eax,ed_offset
-
 
975
        cmp     eax,ed_size
-
 
976
        jna     ._mshift
-
 
977
        mov     eax,ed_size
-
 
978
._mshift:
-
 
979
;;;;;;;
-
 
980
;;‘¥ªæ¨ï ®¡à ¡®âª¨ shift ¨ ¢ë¤¥«¥­¨ï ¯® shift
-
 
981
;;;;;;;
-
 
982
        test    word ed_flags,ed_shift_bac
-
 
983
        je      @f
-
 
984
        mov     ebp,dword       ed_color
-
 
985
        mov     ebx,dword ed_shift_pos
-
 
986
        push    eax
-
 
987
        call    .sh_cl_
-
 
988
        and     word ed_flags,ed_shift_bac_cl
-
 
989
        pop     eax
-
 
990
@@:     
-
 
991
        test    word ed_flags,ed_mouse_on
-
 
992
        jne     @f
-
 
993
        
-
 
994
        mov     dword ed_shift_pos,eax
-
 
995
        or      word  ed_flags,ed_mouse_on
-
 
996
        mov     dword ed_pos,eax
-
 
997
        mov     dword [mouse_flag],edi          ;ãáâ ­®¢¨¬ ¨¤¥­â¨ä¨ª â®à
-
 
998
        bts     word ed_flags,1                 ;ãáâ ­®¢ª  䮪ãá 
-
 
999
        jmp     .m_sh
-
 
1000
@@:             
-
 
1001
        cmp     eax,dword ed_shift_pos  ;¥á«¨ ¯®§¨æ¨¨ ­¥ ¨§¬¥­¨«¨áì
-
 
1002
        je      .editbox_exit
-
 
1003
        mov     ed_pos,eax
-
 
1004
        mov     ebp,dword shift_color
-
 
1005
        mov     ebx,dword ed_shift_pos
-
 
1006
        call    .sh_cl_
-
 
1007
        or      word ed_flags,ed_mous_adn_b     ;ãáâ ­®¢¨¬ ¡¨â çâ® ¬ë ¢ë¤¥«¨«¨ +shift_on +
-
 
1008
.m_sh:  call    .draw_text
-
 
1009
        call    .draw_cursor
-
 
1010
;----------------------------------------------------------
-
 
1011
;--- ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá  ---------------------------
-
 
1012
;----------------------------------------------------------
-
 
1013
        jmp     .drc
-
 
1014
._blur:
-
 
1015
        test    word ed_flags,ed_always_focus
-
 
1016
        jne     .editbox_exit
-
 
1017
        btr     word ed_flags,1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
-
 
1018
        jnc     .editbox_exit
Line 618... Line 1019...
618
}
1019
 
619
 
1020
        mov     ebp,ed_color
620
 
1021
        call    .clear_cursor