Subversion Repositories Kolibri OS

Rev

Rev 463 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ; SEE YOU File FAQ.txt and HISTORY. Good Like!
  2. ;;;;;;;;;;;;;;;;;;
  3. include 'editbox.mac'    ;¬ ªà®á ª®â®àë© ¤®«¦¥­ ®¡«¥£ç¨âì ¦¨§­ì :) ᯥ樠«ì­® ¤«ï editbox
  4. ;;;;;;;;;;;;;;;;;;
  5. macro use_edit_box structure_of_potock,scr_h,scr_w
  6. {
  7. edit_box:
  8. ed_width        equ [edi]               ;è¨à¨­  ª®¬¯®­¥­â 
  9. ed_left         equ [edi+4]             ;¯®«®¦¥­¨¥ ¯® ®á¨ å
  10. ed_top          equ [edi+8]             ;¯®«®¦¥­¨¥ ¯® ®á¨ ã
  11. ed_color        equ [edi+12]            ;梥â ä®­  ª®¬¯®­¥­â 
  12. shift_color     equ [edi+16]            ;=0x6a9480
  13. ed_focus_border_color   equ [edi+20]    ;梥â à ¬ª¨ ª®¬¯®­¥­â 
  14. ed_blur_border_color    equ [edi+24]    ;梥⠭¥  ªâ¨¢­®£® ª®¬¯®­¥­â 
  15. ed_text_color   equ [edi+28]            ;梥â ⥪áâ 
  16. ed_max          equ [edi+32]                    ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦­® ¬ ªá¨¬ «ì­® ¢¢¥áâ¨
  17. ed_text         equ [edi+36]                    ;㪠§ â¥«ì ­  ¡ãä¥à
  18. ed_flags        equ [edi+40]            ;ä« £¨
  19. ed_size equ [edi+42]                    ;ª®«-¢® ᨬ¢®«®¢
  20. ed_pos  equ [edi+46]                    ;¯®§¨æ¨ï ªãàá®à 
  21. ed_offset       equ [edi+50]            ;ᬥ饭¨¥
  22. cl_curs_x       equ [edi+54]            ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® å
  23. cl_curs_y       equ [edi+58]            ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® ã
  24. ed_shift_pos    equ [edi+62]            ;¯®«®¦¥­¨¥ ªãàá®à 
  25. ed_shift_pos_old equ [edi+66]           ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
  26. ;==========================================================
  27. ;=== ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ =================================
  28. ;==========================================================
  29. .draw:
  30. pusha
  31. ;--- à¨á㥬 à ¬ªã ---
  32.         call    .draw_border            ; ”ã­ªæ¨ï áâ ¡¨«ì­ 
  33. .draw_bg_cursor_text:
  34. ;--- ¨§¬¥­ï¥¬ ᬥ饭¨¥, ¥á«¨ ­ ¤® ---
  35.         call    .check_offset           ;¢ëç¨á«¥­¨¥ ¯®§¨æ¨¨ ªãàá®à  áâ ¡¨«ì­ 
  36. ;--- à¨á㥬 ¢­ãâ७­îî ®¡« áâì ---
  37.         call    .draw_bg                ;­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª à ¡®ç¥© ®¡« áâ¨
  38. ;---- à¨á㥬 ¢ë¤¥«¥­¨¥, ¯® shift ¥á«¨ ¥áâì
  39.         call    .draw_shift
  40. .draw_cursor_text:
  41. ;--- à¨á㥬 ªãàá®à ---
  42.         ;--- ¬®¦¥â ¥£® ­¥ ­ ¤® à¨á®¢ âì ----
  43.         test    word ed_flags,ed_focus
  44.         je     @f
  45.         call    .draw_cursor
  46. @@:
  47.         call    .draw_text
  48. edit_ex
  49.  
  50. ;debug_func
  51. ;----------------------------------------------------------
  52. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ¢ë¤¥«¥­®© ç á⨠-----------------
  53. ;----------------------------------------------------------
  54. .draw_shift:
  55.         test    word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  56.         jz      @f
  57.         mov     ebp,shift_color
  58.         mov     ebx,dword       ed_shift_pos
  59.         call    .sh_cl_
  60. @@:     ret
  61. ;----------------------------------------------------------
  62. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
  63. ;----------------------------------------------------------
  64. .draw_text:
  65. ;--- ¢ëç¨á«ï¥¬, ᪮«ìª® ¯®¬¥é ¥âáï ᨬ¢®«®¢ ---
  66. ;--- çâ®¡ë ¬ãá®à ­¥ à¨á®¢ âì ---
  67.         call    .get_n
  68.         mov     esi,ed_size
  69.         mov     ebx,ed_offset
  70.         sub     esi,ebx
  71.         cmp     eax,esi
  72.         jae     @F
  73.         mov     esi,eax         ;çâ®¡ë ­¥ ¢ë室¨âì §  ¯à¥¤¥«ë íªà ­ 
  74. ;--- à¨á㥬 ⥪áâ ---                                            
  75. @@:     mov     eax,4
  76.         mov     ebx,ed_left
  77.         mov     edx,ed_offset
  78.         add     ebx,2
  79.         shl     ebx,16
  80.         mov     bx,ed_top
  81.         add     ebx,4
  82.         mov     ecx,ed_text_color
  83.         add     edx,ed_text
  84.         int     0x40
  85. ret
  86. ;----------------------------------------------------------
  87. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ä®­  ----------------------------
  88. ;¢å®¤­ë¥ ¤ ­­ë¥
  89. ;eax
  90. ;edx - color
  91. ;----------------------------------------------------------
  92. ;¢å®¤ ⮫쪮 梥â edx
  93. .draw_bg:
  94.         mov     ebx,ed_left
  95.         add     ebx,1
  96.         shl     ebx,16
  97.         mov     bx,ed_width
  98.         sub     ebx,1
  99.         mov     edx,ed_color
  100. .draw_bg_eax:
  101.         mov     ecx,ed_top
  102.         mov     eax,13
  103.         add     ecx,1
  104.         shl     ecx,16
  105.         mov     cx,ed_height
  106.         dec     ecx
  107.         int     0x40
  108. ret
  109.  
  110. ;----------------------------------------------------------
  111. ;--- ¯à®æ¥¤ãà  ¯®«ã祭¨ï ª®«¨ç¥á⢠ ᨬ¢®«®¢ ¢ ⥪ã饩 é¨à¨­¥ ª®¬¯®­¥­â  --------------
  112. ;----------------------------------------------------------
  113. .get_n:
  114.         mov     eax,ed_width    ;¯®«ã祬 è¨à¨­ã ª®¬¯®­¥­â 
  115.         xor     edx,edx   ;१ã«ìâ â à á¯®«®£ ¥âáï ¢ ¯ à¥ edx:eax ¢ eax - ®áâ â®ª
  116.         sub     eax,4           ;¢ëç⨬ 4
  117.         mov     ebx,6           ;§ £à㧬¨ ¤¥«¨â¥«ì
  118.         div     ebx             ;à §¬¤¥«¨¬ ­  6
  119. ret
  120. ;----------------------------------------------------------
  121. ;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï ªãàá®à  --------------------------
  122. ;----------------------------------------------------------
  123. ;¢å®¤­ë¥ ebp- 梥â
  124. .clear_cursor:
  125.         mov     edx,ebp
  126.         mov     ebx,cl_curs_x
  127.         mov     ecx,cl_curs_y
  128.         jmp     .draw_curs
  129. .draw_cursor:
  130.         mov     edx,ed_text_color
  131.         mov     ebx,ed_pos
  132.         mov     ecx,ed_offset
  133.         sub     ebx,ecx
  134.  
  135.         lea     ebx,[ebx*2+ebx]
  136.         shl     ebx,1
  137.         ;imul   ebx,6
  138.         add     bx,ed_left
  139.         mov     ecx,ed_top
  140.         inc     ebx
  141.         add     ecx,2
  142.         mov     ebp,ebx
  143.         shl     ebx,16
  144.         mov     bx,bp
  145.         mov     ebp,ecx
  146.        
  147.         shl     ecx,16
  148.         mov     cx,bp
  149.         add     cx,ed_height-4
  150.        
  151.         mov     cl_curs_x,ebx
  152.         mov     cl_curs_y,ecx
  153. .draw_curs:              
  154.         mov     eax,38
  155.         int     0x40
  156. ret
  157. ;----------------------------------------------------------
  158. ;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï à ¬ª¨ ----------------------------
  159. ;----------------------------------------------------------
  160. .draw_border:
  161. ;--- 梥â à ¬ª¨ ---
  162.         test    word ed_flags,ed_focus
  163.         mov     edx,ed_focus_border_color
  164.         jne     @f
  165.         mov     edx,ed_blur_border_color
  166. @@:
  167. ;--- ᢥàåã ---
  168.         mov     eax,38
  169.         mov     ebx,ed_left
  170.         mov     ecx,ebx
  171.         shl     ebx,16
  172.         mov     bx,cx
  173.         add     bx,ed_width
  174.         mov     ecx, ed_top
  175.         mov     esi,ecx
  176.         shl     ecx,16
  177.         mov     cx,si
  178.         int     0x40
  179.  
  180. ;--- á­¨§ã ---
  181.         mov     esi,ecx
  182.         add     ecx,ed_height
  183.         mov     ebp,ecx
  184.         shl     ecx,16
  185.         mov     cx,bp
  186.         int     0x40
  187.  
  188. ;--- á«¥¢  ---
  189.         mov     cx,si
  190.         mov     ebp,ebx
  191.         sub     bx,ed_width
  192.         int     0x40
  193.  
  194. ;--- á¯à ¢  ---
  195.         mov     ebx,ebp
  196.         shl     ebx,16
  197.         mov     bx,bp
  198.         int     0x40
  199. ret
  200. ;----------------------------------------------------------
  201. ;--- ¯à®¢¥àª , § è¥« «¨ ªãàá®à §  £à ­¨æë ¨, ¥á«¨ ­ ¤®, ---
  202. ;--- ¨§¬¥­ï¥¬ ᬥ饭¨¥ ------------------------------------
  203. ;--- eax = -1, ¥á«¨ ­¥ ¨§¬¥­¨«®áì ¨«¨ eax = 0, ¥á«¨
  204. ; ¨§¬¥­¨«®áì
  205. ;----------------------------------------------------------
  206. .check_offset:
  207. pusha
  208.         mov     ecx,ed_pos
  209.         mov     ebx,ed_offset
  210.         cmp     ebx,ecx
  211.         ja      .sub_8
  212.  
  213.         push    ebx
  214.         call    .get_n                  ;¯®«ã稬 ª®«-¢® ᨬ¢®«®¢ ¢ ¯ à¥ ॣ¨áâ஢ edx:eax
  215.         pop     ebx
  216.         mov     edx,ebx
  217.         add     edx,eax         ;ed_offset+width editbox
  218.         inc     edx             ;­¥®¡å®¤¨¬® ¤«ï ­®¬ «ì­®£® ¯®«®¦¥­¨ï ªãàá®à  ¢ ªà ©­¥© «¥¢®© ¯®§¨æ¨¨
  219.         cmp     edx,ecx
  220.         ja      @f
  221.  
  222.         mov     edx,ed_size
  223.         cmp     edx,ecx
  224.         je      .add_end
  225.  
  226.         sub     edx,ecx
  227.         cmp     edx,8
  228.         jbe     .add_8
  229.         add     ebx,8
  230.         jmp     .chk_d
  231.  
  232. .sub_8: cmp     ecx,0
  233.         je      .sub_min
  234.         cmp     ebx,8
  235.         jbe     .sub_min
  236.         sub     ebx,8   ;ebx=ed_offset
  237.         jmp     .chk_d
  238. .sub_min:
  239.         xor     ebx,ebx
  240.         jmp     .chk_d
  241.  
  242. .add_end:sub    edx,eax
  243.         mov     ebx,edx
  244.         jmp     .chk_d
  245. .add_8: add     ebx,edx
  246. .chk_d: mov     ed_offset,ebx
  247.         call    .draw_bg
  248.         and     word ed_flags,ed_offset_cl
  249. edit_ex
  250. @@:
  251.         or      word ed_flags,ed_offset_fl
  252. edit_ex
  253. ;==========================================================
  254. ;=== ®¡à ¡®âª  ª« ¢¨ âãàë =================================
  255. ;==========================================================
  256. .key:
  257. pusha
  258.         test    word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
  259.         je      @b
  260. ;à®¢¥àª  ­  ­ ¦ âë shift
  261.         call    .check_shift
  262. ;----------------------------------------------------------
  263. ;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
  264. ;----------------------------------------------------------
  265.         cmp     ah,8
  266.         jz      .backspace
  267.         cmp     ah,0xb6
  268.         jz      .delete
  269.         cmp     ah,176
  270.         jz      .left
  271.         cmp     ah,179
  272.         jz      .right
  273.         cmp     ah,180
  274.         jz      .home
  275.         cmp     ah,181
  276.         jz      .end
  277.         cmp     ah,185  ;insert
  278.         jz      .insert
  279. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  280. ;‡ £«ã誠 ­  ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢­¨§
  281. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;    
  282.         cmp     ah,177
  283.         jz      .no_figure
  284.         cmp     ah,178
  285.         jz      .no_figure
  286.         cmp     ah,27   ;ESC - ª« ¢¨è  ))
  287.         jz      .no_figure
  288. ;--- ­ ¦ â  ¤àã£ ï ª« ¢¨è  ---
  289.         test    word ed_flags,ed_figure_only  ; ⮫쪮 æ¨äàë ?
  290.         jz      @f
  291.         cmp     ah,'0'
  292.         jb      .no_figure
  293.         cmp     ah,'9'
  294.         ja      .no_figure
  295. ;¯à®¢¥àª  ­  shift
  296. @@:     test    word ed_flags,ed_shift_on
  297.         je      @f
  298.         ;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
  299.         push    eax
  300.         mov     edx,ed_size
  301.         mov     ecx,ed_pos
  302.         pusha
  303. ;clear
  304.         mov     ebp,edx ;ed_size
  305.         call    .clear_bg
  306.         mov     ebp,ed_color
  307.         mov     ebx,dword       ed_shift_pos
  308.         call    .sh_cl_
  309.  
  310. .sh_nxt:popa
  311.         call    .del_char
  312. ;;;;
  313.         mov     eax,dword ed_shift_pos
  314.         mov     ebx,ed_size
  315.         sub     ebx,eax
  316.         mov     ed_size,ebx
  317.         pop     eax
  318.         ; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥
  319. @@:     mov     ecx,ed_size
  320.         mov     edx, ed_max
  321.         test    word ed_flags,ed_insert
  322.         jne     @f
  323.         cmp     ecx,edx
  324.         jae     .no_figure
  325. @@:     mov     ebx, ed_pos
  326.         cmp     ebx,edx
  327.         jl      @f ; ¥á«¨ ¬¥­ìè¥ ¨«¨ à ¢­®
  328. .no_figure:
  329. edit_ex
  330. .insert: test   word ed_flags,ed_insert ;not    word ed_insert
  331.          je     .insert_1
  332.          and    word ed_flags,ed_insert_cl
  333.         jmp     .no_figure
  334. .insert_1:
  335.         or      word ed_flags,ed_insert
  336.         jmp     .no_figure
  337. .ins_v:
  338.         dec     dword [ebp+42];ed_size    ;processing is insert
  339.         sub     esi,ecx
  340.         add     esi,ebx
  341.         mov     edi,esi
  342. ;clear
  343. pusha
  344.         mov     edi,ebp
  345.         mov     ebp,ed_pos
  346.         call    .clear_bg
  347. popa
  348.         jmp     .In_k
  349. @@:     ; ᤢ¨£ ¥¬ ᨬ¢®«ë ¯®á«¥ ªãàá®à  ¢¯à ¢®
  350.         mov     ecx,ed_size
  351.         push    edi eax
  352.         mov     ebp,edi
  353.         mov     esi,ed_text     ; “ª § â¥«ì ­  ¡ãä¥à
  354.                                 ;ã¤¥¬ à ¡®â âì á® áâப®©
  355.         add     esi,ecx         ;add ed_size ¤®¡ ¢¨¬ max size
  356.         mov     edi,esi
  357.  
  358.         cmp     ecx,ebx         ;…᫨ ã ­ á ¯®§¨æ¨ï ªãàá®à  = ⥪ã饬ã à §¬¥àã ­ ¯¥ç â ­­ëå ᨬ¢®«®¢ â.¥. ªãàá®à á⮨⠢ ª®­æ¥
  359.         je      .In_k
  360.  
  361.         test    word [ebp+40],ed_insert ;IF insert is enable  â.ª. edi ¨§¬¥­¥­  ¤à¥á㥬 ç¥à¥§ ebp
  362.         jne     .ins_v
  363. ;clear
  364. pusha
  365.         mov     edi,ebp
  366.         mov     ebp,ed_size
  367.         call    .clear_bg
  368. popa
  369.         sub     ecx,ebx         ; ©¤¥¬ ª®«-¢® ᨬ¢®«®¢ ¤«ï ¯¥à¥¤¢¨¦¥­¨ï.
  370.         inc     edi             ;‘¬¥á⨬ ­ è¨ ᨬ¢®«ë ¢ ¯à ¢®
  371.         std
  372.         inc     ecx
  373.    @@:  
  374.         ;--------
  375.         lodsb
  376.         stosb
  377.         ;--------
  378.         loop    @b
  379. .In_k:  cld
  380.         pop eax
  381.         mov al,ah
  382.         stosb
  383.         pop edi
  384. ; ¢áâ ¢«ï¥¬ ª®¤ ª« ¢¨è¨ â㤠, £¤¥ ªãàá®à
  385.         ; 㢥«¨ç¨¢ ¥¬ §­ ç¥­¨¥ à §¬¥à  ¨ ¯®§¨æ¨¨
  386.         inc      dword ed_size
  387.         inc      dword ed_pos
  388.         call    .draw_all2
  389.         jmp     .shift;.draw_cursor_text
  390. .delete:        
  391.         mov     edx,ed_size
  392.         mov     ecx,ed_pos
  393.         cmp     edx,ecx
  394.         jg      .bac_del
  395.         test    word ed_flags,ed_shift_on
  396.         jne     .del_bac
  397. edit_ex
  398. .bac_del:      
  399.         call    .del_char
  400.         jmp     .draw_all
  401.        
  402. ;--- ­ ¦ â  ª« ¢¨è  backspace ---
  403. .backspace:
  404.         ; ¯à®¢¥à塞, ªãàá®à ã «¥¢®£® ªà ï ?
  405.         mov     ecx,ed_pos
  406.         test    ecx,ecx
  407.         jnz     .del_bac
  408.         test    word ed_flags,ed_shift_on
  409.         jne     .bac_del
  410.  
  411. edit_ex
  412. .del_bac:
  413.         mov     edx,ed_size
  414.         cmp     edx,ecx ;if ed_pos=ed_size
  415.         je      @f
  416.         dec     ecx
  417.         call    .del_char
  418. @@:     test    word ed_flags,ed_shift_on
  419.         jne     .bac_del
  420.         dec      dword ed_pos
  421. .draw_all:
  422.         push    .shift;.draw_cursor_text;eax
  423.  
  424.         test    word ed_flags,ed_shift_on
  425.         je      @f
  426.         mov     eax,dword ed_shift_pos
  427.         mov     ebx,ed_size
  428.         sub     ebx,eax
  429.         mov     ed_size,ebx
  430.  
  431.         mov     ebp,ed_color
  432.         call    .clear_cursor
  433.         call    .check_offset
  434.         call    .draw_bg
  435.         ret
  436. @@:     dec      dword ed_size
  437.  
  438. .draw_all2:
  439.         and    word ed_flags,ed_shift_cl
  440.         mov     ebp,ed_color
  441.         call    .clear_cursor
  442.         call    .check_offset
  443.         mov     ebp,ed_size
  444.         call    .clear_bg
  445.         ret
  446. ;--- ­ ¦ â  ª« ¢¨è  left ---
  447. .left:  mov     ebx,ed_pos
  448.         test    ebx,ebx
  449.         jz      .sh_st_of
  450.         or      word ed_flags,ed_left_fl
  451.         call    .sh_first_sh
  452.         dec      dword ed_pos
  453.         call    .sh_enable
  454.         jmp     .draw_cursor_text
  455. ;--- ­ ¦ â  ª« ¢¨è  right ---
  456. .right: mov     ebx,ed_pos
  457.         cmp     ebx,ed_size
  458.         je      .sh_st_of
  459.         and     word ed_flags,ed_right_fl
  460.         call    .sh_first_sh
  461.         inc     dword  ed_pos
  462.         call    .sh_enable
  463.         jmp     .draw_cursor_text
  464. .home:  
  465.         mov     ebx,ed_pos
  466.         test    ebx,ebx
  467.         jz      .sh_st_of
  468.         call    .sh_first_sh
  469.         xor     eax,eax
  470.         mov     ed_pos,eax
  471.         call    .sh_home_end
  472.         jmp     .draw_cursor_text
  473. .end:  
  474.         mov     ebx,ed_pos
  475.         cmp     ebx,dword ed_size
  476.         je      .sh_st_of
  477.         call    .sh_first_sh
  478.         mov     eax,ed_size
  479.         mov     ed_pos,eax
  480.         call    .sh_home_end
  481.         jmp     .draw_cursor_text
  482. ;Ž¡à ¡®âª  Shift ¤«ï á­ïâ¨ï ¢ë¤¥«¥­¨ï ­¥¨§¢¥áâ­®© ®¡« áâ¨
  483. .shift: ;;;;;;;SHIFT
  484.         test    word ed_flags,ed_shift
  485.         je      .f_exit
  486.  
  487. @@:     mov     ebp,shift_color
  488.         or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  489.         mov     ebx,dword       ed_shift_pos
  490.         call    .sh_cl_
  491.         jmp     .draw_cursor_text
  492. ;;;;;;;;;;;;;;;;;;;;;
  493. .f_exit:call    .check_offset
  494.         and     word ed_flags,ed_shift_cl
  495.         call    .enable_null
  496.         jmp     .draw_cursor_text
  497. .sh_cl_:
  498. ;;;;;;SHIFT end
  499. ;®¡à ¡®âª  ®ç¨á⪨, ¯à¨ «¥¢®¬ - ¯à ¢®¬ ¤¢¨¦¥­¨¨ ¢ë¤¥«¥­¨ï
  500. ;¤«ï ®¡à ¡®âª¨ á­ïâ¨ï ¢ë¤¥«¥­¨ï
  501. ;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
  502.         mov     eax,dword       ed_pos
  503.         cmp     eax,ebx
  504.  
  505.         jae     .sh_n
  506.         push    eax  ;¬¥­ì襥 ¢ eax
  507.         push    ebx  ;¡®«ì襥
  508.         jmp     .sh_n1
  509.                      ;¥á«¨ ¨­ ç¥
  510. .sh_n:  push    ebx  
  511.         push    eax
  512. .sh_n1:
  513.         call    .check_offset
  514.         call    .get_n
  515.         mov     edx,eax ;size of ed_box
  516.         mov     ecx,ed_offset
  517.         add     eax,ecx ;eax = w_off= ed_offset+width
  518.         mov     edx,eax ;save
  519.         pop     ebx     ;¡®«ì襥
  520.         pop     eax     ;¬¥­ì襥
  521.  
  522.         cmp     eax,ecx         ;áà ¢­¥­¨¥ á ¬¥­ì襣® á offset.
  523.         jae     .f_f            ;¥á«¨ ¡®«ìè¥
  524.         xor     eax,eax
  525.         cmp     edx,ebx         ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
  526.         jb      @f
  527.         sub     ebx,ecx
  528.         jmp     .nxt_f
  529. @@:     mov     ebx,edx
  530.         sub     ebx,ecx
  531.         jmp     .nxt_f
  532. .f_f:  
  533.         sub     eax,ecx
  534.         cmp     edx,ebx         ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
  535.         jle     @f
  536.         sub     ebx,ecx
  537.         sub     ebx,eax
  538.         jmp     .nxt_f
  539. @@:
  540.         mov     ebx,edx
  541.         sub     ebx,ecx
  542.         sub     ebx,eax
  543. .nxt_f:
  544.         mov     edx,ebx
  545.         lea     ebx,[eax*2+eax]
  546.         shl     ebx,1
  547.         add     ebx,ed_left
  548.         inc     ebx
  549.         shl     ebx,16
  550.         lea     ecx,[edx*2+edx]
  551.         shl     ecx,1  
  552.         mov     bx,cx
  553.         inc     ebx
  554.         mov     edx,ebp;shift_color
  555.  
  556.         call    .draw_bg_eax
  557. @@:     call    .enable_null
  558.         ret
  559. ;;;;;;;;;;;;;;;;;;;;;
  560. ;“áâ ­®¢ª - á­ï⨥ ¢ë¤¥«¥­¨ï ¢ ®¤¨­ ᨬ¢®«
  561. ;;;;;;;;;;;;;;;;;;;;;
  562. .drw_sim:
  563.         mov     eax,dword       ed_pos
  564.         call    .draw_rectangle   ;­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª á § ¤ ­­ë¬ 梥⮬
  565.         jmp     @b
  566. ;;;;;;;;;;;;;;;;;;;;;
  567. ;”ãªæ¨ï ãáâ ­®¢ª¨ ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
  568. ;‹®£¨ª :
  569. ;;;;;;;;;;
  570. .draw_wigwag:
  571. ;äã­ªæ¨ï ãáâ ­®¢ª¨ ¯¥à¥¬¥­­ëå
  572.         mov     ebp,shift_color
  573.         call    .clear_cursor
  574.  
  575.         or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  576.         mov     ebp,shift_color
  577.         mov     eax,dword       ed_pos
  578.         test    word ed_flags,ed_left_fl
  579.         jz      .low
  580.         jmp     @f
  581. ;;;;;;;;;;
  582. ;”ãªæ¨ï 㤠«¥­¨ï ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨ï ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
  583. ;‹®£¨ª :
  584. ;;;;;;;;;;
  585. .draw_wigwag_cl:
  586. ;äã­ªæ¨ï ãáâ ­®¢ª¨ ¯¥à¥¬¥­­ëå
  587.         mov     ebp,ed_color
  588.         call    .clear_cursor
  589.  
  590.         mov     ebp,ed_color
  591.         mov     eax,dword       ed_pos
  592.         test    word ed_flags,ed_left_fl
  593.         jz      .low
  594. @@:     call    .draw_rectangle  ;­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª § ªà è¨¢ ¥¬®© ®¡« áâ¨
  595.         ret
  596. .low:   dec     eax
  597.         jmp     @b
  598. ;¢å®¤­®© ¯ à ¬¥âà ebx - ed_pos
  599. .sh_first_sh:
  600.         test    word ed_flags,ed_shift
  601.         je      @f
  602.         mov     dword ed_shift_pos_old,ebx
  603.         test    word ed_flags,ed_shift_on
  604.         jne     @f
  605.         mov     dword ed_shift_pos,ebx
  606.         or      word ed_flags,ed_shift_on
  607. @@:     ret
  608. ;Ž¡à ¡®âª  ªà ©­¨å ¯®«®¦¥­¨© ¢ editbox ¯à¨ ­ ¦ â®¬ shift
  609. ;¯à®¨§¢®¤¨â á­ï⨥ ¢ë¤¥«¥­¨¥, ¥á«¨ ­¥â shift
  610. ;¨­ ç¥ ¢®®¡é¥ ¢ë室¨â
  611. .sh_st_of:
  612.         test    word ed_flags,ed_shift
  613.         jne     @f
  614.         test    word ed_flags,ed_shift_bac
  615.         je      @f
  616.         mov     ebp,ed_color
  617.         mov     ebx,dword       ed_shift_pos
  618.         call    .sh_cl_  ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
  619.         and     word ed_flags,ed_shift_cl ; ®ç¨á⪠ ®â ⮣® çâ® ã¡à «¨ ¢ë¤¥«¥­¨¥
  620.         jmp     .draw_cursor_text
  621. @@:
  622.         and     word ed_flags,ed_shift_off
  623. edit_ex
  624. ;¯à®¢¥àª  á®áâ®ï­¨ï shift ¡ë« «¨ ®­ ­ ¦ â à ­ìè¥?
  625. .sh_enable:
  626.         test    word ed_flags,ed_shift
  627.         jne     .sh_ext_en ;­ à¨á®¢ âì § ªà è¥­ë© ¯àאַ㣮«ì­¨ª
  628.  
  629.         test    word ed_flags,ed_shift_bac
  630.         je      @f
  631.         call    .check_offset
  632.  
  633.         mov     ebp,ed_color
  634.         mov     ebx,dword       ed_shift_pos
  635.         call    .sh_cl_  ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
  636.         call    .draw_wigwag_cl
  637.         and     word ed_flags,ed_shift_cl ; 1¢ à ­¥ ­ã¦­®
  638.         ret
  639.  
  640. @@:     mov     ebp,ed_color
  641.         call    .clear_cursor
  642.         call    .check_offset
  643.         ret
  644. .sh_ext_en:    
  645.         call    .check_offset
  646.         test    word ed_flags,ed_offset_fl
  647.         je      @f
  648. ;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
  649.         mov     eax,dword       ed_shift_pos
  650.         mov     ebx,dword       ed_pos
  651.         mov     ecx,dword       ed_shift_pos_old
  652. ;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­ëå ®¡« á⥩
  653.         cmp     eax,ecx
  654.         je      .1_shem
  655.         jb      .smaller
  656.         cmp     ecx,ebx
  657.         ja      .1_shem
  658.         call    .draw_wigwag_cl ;clear
  659.         jmp     .sh_e_end
  660. .smaller:
  661.         cmp     ecx,ebx
  662.         jb      .1_shem
  663.         call    .draw_wigwag_cl ;clear
  664.         jmp     .sh_e_end
  665. ;alike  =
  666. .1_shem: call   .draw_wigwag
  667. .sh_e_end:      and     word ed_flags,ed_shift_off
  668.         ret
  669. @@:     mov     ebp,shift_color
  670.         mov     ebx,dword       ed_shift_pos
  671.         call    .sh_cl_
  672.         jmp     .sh_e_end
  673. ;äã­ªæ¨ï ¤«ï ®¡à ¡®âª¨ shift ¯à¨ ­ ¦ â¨¨ home and end
  674. .sh_home_end:
  675.         mov     ebp,ed_color
  676.         call    .clear_cursor
  677.         test    word ed_flags,ed_shift_bac
  678.         je      @f
  679.         mov     ebp,ed_color
  680.         mov     ebx,dword       ed_shift_pos_old
  681.         call    .sh_cl_
  682.  
  683. @@:     test    word ed_flags,ed_shift
  684.         je      .sh_exit_ ;¢ë©â¨
  685.         mov     ebp,shift_color
  686.         mov     ebx,dword       ed_shift_pos
  687.         call    .sh_cl_
  688.         or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  689.         jmp     .sh_e_end
  690. .sh_exit_:      call    .check_offset
  691.         ret
  692. ;äã­ªæ¨ï ¢­¥á¥­¨ï 0 ¯®  ¤à¥áã ed_size+1
  693. .enable_null:
  694.         pusha
  695.         mov     eax,ed_size
  696.         mov     ebx,ed_text
  697.         test    eax,eax
  698.         add     eax,ebx
  699.         jne     @f
  700.         inc     eax
  701. @@:     xor     ebx,ebx
  702.         mov     [eax],bl
  703. edit_ex
  704. ;- 㤠«¥­¨¥ ᨬ¢®« 
  705. ;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
  706. .del_char:
  707.         mov     esi,ed_text
  708.         test    word ed_flags,ed_shift_on
  709.         je      @f
  710.         mov     eax,dword ed_shift_pos
  711.         mov     ebx,esi
  712.         cmp     eax,ecx
  713.         jae     .dh_n
  714.  
  715.         mov     ed_pos,eax      ;çâ® ¡ë ­¥ ¡ë«® ã¡¥£ ­¨ï ªãàá®à 
  716.         mov     ebp,ecx
  717.         sub     ebp,eax
  718.         add     ebx,eax  ;eax ¬¥­ìè¥
  719.         sub     edx,ecx
  720.         add     esi,ecx
  721.  
  722.         mov     dword ed_shift_pos,ebp
  723.         jmp     .del_ch_sh
  724.                      ;¥á«¨ ¨­ ç¥
  725. .dh_n:  
  726.         mov     ebp,eax
  727.         sub     ebp,ecx
  728.         add     ebx,ecx
  729.         sub     edx,eax
  730.         add     esi,eax
  731.         mov     dword ed_shift_pos,ebp
  732.         jmp     .del_ch_sh
  733.  
  734. @@:     add     esi,ecx ;㪠§ â¥«ì + ᬥ饭¨¥ ª ॠ«ì­®¬ã ¡ãää¥àã
  735.         mov     ebx,esi
  736.         inc     esi
  737.         cld
  738.  
  739.         sub     edx,ecx
  740. .del_ch_sh:
  741.  
  742.         push    edi
  743.         mov     edi,ebx
  744. @@:
  745.         lodsb
  746.         stosb
  747.         dec edx
  748.         jns @b
  749.        
  750.         pop edi
  751.         ret
  752. ;¢ëç¨á«¨âì § ªà è¨¢ ¥¬ãî ®¡« áâì
  753. ;ᮣ« è¥­¨¥ ¢ ebp - ¯¥à¥¤ ¥âáï ed_size
  754. .clear_bg:
  755.         call    .get_n  ;¯®«ãç¨âì à §¬¥à ¢ ᨬ¢®« å è¨à¨­ë ª®¬¯®­¥­â 
  756.         push    eax
  757.         mov     ebx,ed_offset
  758.         add     eax,ebx ;eax = w_off= ed_offset+width
  759.         mov     ebx,ebp ;ed_size
  760.        
  761.         cmp     eax,ebx
  762.         jb      @f
  763.         mov     eax,ed_pos
  764.         sub     ebx,eax
  765.         mov     ecx,ed_offset
  766.         sub     eax,ecx
  767.         jmp     .nxt
  768. @@:     mov     ebx,ed_pos
  769.         push    ebx
  770.         sub     eax,ebx
  771.         mov     ebx,eax ;It is don't optimal
  772.        
  773.         pop     eax     ;ed_pos
  774.         mov     ecx,ed_offset
  775.         sub     eax,ecx
  776. .nxt:
  777.         mov     ebp,eax  ;¯à®¢¥àª  ­  ¢ë室 § ªà è¨¢ ¥¬®© ®¡« á⨠§  ¯à¥¤¥«ë ¤«¨­ë
  778.         add     ebp,ebx
  779.         pop     edx
  780.         cmp     ebp,edx
  781.         je      @f
  782.         inc     ebx
  783.  
  784. @@:     mov     edx,ebx
  785.         lea     ebx,[eax*2+eax]
  786.         shl     ebx,1
  787.         add     ebx,ed_left
  788.         inc     ebx
  789.         shl     ebx,16
  790.         lea     ecx,[edx*2+edx]
  791.         shl     ecx,1  
  792.         mov     bx,cx
  793.         mov     edx,ed_color
  794.         call    .draw_bg_eax
  795.         ret
  796. ;;;;;;;;;;;;;;;;;;;
  797. ;;; Ž¡à ¡®âª  ¯à¨¬¨â¨¢®¢
  798. ;;;;;;;;;;;;;;;;;;;;
  799. ; à¨á®¢ âì ¯àאַ㣮«ì­¨ª, 梥⠯¥à¥¤ ¥âáï ¢ ebp
  800. ;¢å®¤­ë¥ ¯ à ¬¥âàë:
  801. ;eax=dword ed_pos
  802. ;ebp=-梥â ed_color or shift_color
  803. .draw_rectangle:
  804.         mov     ecx,dword ed_offset
  805.         sub     eax,ecx
  806.         lea     ebx,[eax*2+eax]
  807.         shl     ebx,1
  808.         inc     ebx
  809.         add     ebx,ed_left
  810.         shl     ebx,16
  811.         mov     bx,6
  812.         mov     edx,ebp
  813.         call    .draw_bg_eax
  814.         ret
  815. ;;;;;;;;;;;;;;;;;;
  816. ;;à®¢¥àª  ­ ¦ â «¨ shift
  817. ;;;;;;;;;;;;;;;;;;
  818. .check_shift:
  819. pusha   ;á®åà ­¨¬ ¢á¥ ॣ¨áâàë
  820.         mcall   66,3,1
  821.         test    al,0x03
  822.         je      @f
  823.         or      word ed_flags,ed_shift   ;ãáâ ­®¢¨¬ ä« £
  824. @@:edit_ex
  825. ;==========================================================
  826. ;=== ®¡à ¡®âª  ¬ëè¨ =======================================
  827. ;==========================================================
  828. .mouse:
  829. pusha
  830. ;debug
  831. ;----------------------------------------------------------
  832. ;--- ¯®«ãç ¥¬ á®áâ®ï­¨¥ ª­®¯®ª ¬ëè¨ -----------------------
  833. ;----------------------------------------------------------    
  834.         mcall   37,2
  835. ;----------------------------------------------------------
  836. ;--- ¯à®¢¥à塞 á®áâ®ï­¨¥ ----------------------------------
  837. ;----------------------------------------------------------
  838.         test    eax,1              
  839.         jnz     .mouse_left_button
  840.         and     word ed_flags,ed_mouse_on_off
  841.         xor     ebx,ebx
  842.         mov     dword [mouse_flag],ebx
  843. edit_ex
  844. .mouse_left_button:
  845. ;----------------------------------------------------------
  846. ;--- ¡«®ª¨à®¢ª  ®â 䮪ãá¨à®¢ª¨ ¢ ¤àã£¨å ¡®ªá å ¯à¨ ¯®¯ ¤ ­¨¨ ­  ­¨å ªãàá®à 
  847. ;----------------------------------------------------------
  848.         mov     eax,dword [mouse_flag]
  849.         test    eax,eax
  850.         jz      @f
  851.         cmp     eax,edi
  852.         je      @f
  853.         jmp     ._blur
  854. ;----------------------------------------------------------
  855. ;--- ¯®«ãç ¥¬ ª®®à¤¨­ âë ¬ëè¨ ®â­®á¨â¥«ì­® 0 â.¥ ¢á¥© ®¡« á⨠íªà ­ 
  856. ;----------------------------------------------------------
  857. @@:     mcall   37,0
  858. ;----------------------------------------------------------
  859. ;--- € ­¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à, ¢® ¢á¥ à §­ë¥ áâ®à®­ë?
  860. ;----------------------------------------------------------
  861.         mov     ecx,structure_of_potock
  862.         test    word ed_flags,ed_mouse_on
  863.         jne     .mouse_wigwag
  864. ;----------------------------------------------------------
  865. ;--- ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box -------------
  866. ;----------------------------------------------------------
  867.         mov     ebx,dword [ecx+38]
  868.         add     ebx,ed_top
  869. if scr_h eq
  870. else
  871.         add     ebx,scr_h
  872. end if
  873.         cmp     ax,bx
  874.         jl      ._blur;.mouse_end_no_focus
  875.  
  876.         add     ebx,ed_height
  877.         cmp     ax,bx
  878.         jg      ._blur;.mouse_end_no_focus
  879.  
  880.         shr     eax,16
  881.  
  882.         mov     ebx,dword [ecx+34]
  883.         add     ebx,ed_left
  884. if scr_w eq
  885. else
  886.         add     ebx,scr_w
  887. end if
  888.         cmp     ax,bx
  889.         jl      ._blur;.mouse_end_no_focus
  890.  
  891.         add     ebx,ed_width
  892.         cmp     ax,bx
  893.         jg      ._blur;.mouse_end_no_focus
  894. ;--- ¨§¬¥­ï¥¬ ¯®§¨æ¨î ªãàá®à  ---
  895.         push    eax
  896.         mov     ebp,ed_color
  897.         call    .clear_cursor
  898.         pop     eax
  899. ._mvpos:
  900.         mov     ecx,structure_of_potock
  901.         mov     ebx,dword [ecx+34]
  902.         xor     edx,edx
  903.         sub     eax,ed_left
  904.         sub     eax,ebx
  905. if scr_w eq
  906. else
  907.         add     ebx,scr_w
  908.         sub     eax,2
  909. end if
  910.         mov     ebx,6
  911.         div     bx
  912.         add     eax,ed_offset
  913.         cmp     eax,ed_size
  914.         jna     ._mshift
  915.         mov     eax,ed_size
  916. ._mshift:
  917. ;;;;;;;
  918. ;;‘¥ªæ¨ï ®¡à ¡®âª¨ shift ¨ ¢ë¤¥«¥­¨ï ¯® shift
  919. ;;;;;;;
  920.         test    word ed_flags,ed_shift_bac
  921.         je      @f
  922.         mov     ebp,dword       ed_color
  923.         mov     ebx,dword ed_shift_pos
  924.         push    eax
  925.         call    .sh_cl_
  926.         and     word ed_flags,ed_shift_bac_cl
  927.         pop     eax
  928. @@:    
  929.         test    word ed_flags,ed_mouse_on
  930.         jne     @f
  931.        
  932.         mov     dword ed_shift_pos,eax
  933.         or      word  ed_flags,ed_mouse_on
  934.         mov     dword ed_pos,eax
  935.         mov     dword [mouse_flag],edi          ;ãáâ ­®¢¨¬ ¨¤¥­â¨ä¨ª â®à
  936.         bts     word ed_flags,1                 ;ãáâ ­®¢ª  䮪ãá 
  937.         jmp     .m_sh
  938. @@:            
  939.         cmp     eax,dword ed_shift_pos  ;¥á«¨ ¯®§¨æ¨¨ ­¥ ¨§¬¥­¨«¨áì
  940.         je      .mouse_ex
  941.         mov     ed_pos,eax
  942.         mov     ebp,dword shift_color
  943.         mov     ebx,dword ed_shift_pos
  944.         call    .sh_cl_
  945.         or      word ed_flags,ed_mous_adn_b     ;ãáâ ­®¢¨¬ ¡¨â çâ® ¬ë ¢ë¤¥«¨«¨ +shift_on +
  946. .m_sh:  call    .draw_text
  947.         call    .draw_cursor
  948. ;----------------------------------------------------------
  949. ;--- ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá  ---------------------------
  950. ;----------------------------------------------------------
  951.         jmp     .drc
  952. ._blur:
  953.         test    word ed_flags,ed_always_focus
  954.         jne     .mouse_ex
  955.         btr     word ed_flags,1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
  956.         jnc     .mouse_ex
  957.  
  958.         mov     ebp,ed_color
  959.         call    .clear_cursor
  960. .drc:   call    .draw_border
  961. .mouse_ex:
  962.  
  963. edit_ex
  964. ;----------------------------------------------------------
  965. ;--- ¯à®æ¥¤ãà  à §¬ë¢ ­¨ï 䮪ãá  --------------------------
  966. ;----------------------------------------------------------
  967. ;.blur:
  968. ;pusha
  969. ;._blur:
  970.         ;btr     ed_flags,1
  971.         ;jnc     @f
  972.         ;call    .draw_border
  973.         ;call    .clear_cursor
  974. ;@@:
  975. ;edit_ex
  976.  
  977. ;----------------------------------------------------------
  978. ;--- Ž¡à ¡®âª  .mouse_wigwag
  979. ;----------------------------------------------------------
  980. .mouse_wigwag:
  981.         shr     eax,16
  982.         or      word ed_flags,ed_shift_bac+ed_shift_on+ed_shift
  983. ;;;;;;;;;;;;;;;;;;
  984. ;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ª®£¤  ¯à®¨á室¨â ¢ë室 §  ¯à¥¤¥«ë editbox
  985. ;;;;;;;;;;;;;;;;;;
  986.         mov     ecx,structure_of_potock
  987.         mov     ebx,dword [ecx+34]
  988.         add     ebx,ed_left
  989. if scr_w eq
  990. else
  991.         add     ebx,scr_w
  992. end if
  993.         cmp     eax,ebx
  994.         jb      .mleft
  995.  
  996.         add     ebx,ed_width
  997.         cmp     eax,ebx
  998.         ja      .mright
  999.  
  1000.         sub     ebx,ed_width
  1001.  
  1002.         xor     edx,edx
  1003.         sub     eax,ebx ; ¢ëç⨬ ¨§ ª®®à¤¨­ â ¬ë誨 ¯® ®á¨ å ª®®à¤¨­ âë ¤® editbox ¯® ®á¨ å
  1004.         mov     ebx,6
  1005.         div     ebx
  1006. ;;;;;;;;;;;;;;;;;;
  1007. ;;¯à®æ¥¤ãà  ®¡à ¡®âª¨ ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ¢ ¯à¥¤¥« å ®¡« á⨠editbox
  1008. ;;;;;;;;;;;;;;;;;;
  1009. ;®«ã稫¨ ª®®à¤¨­ âë ¢ eax ¬ë誨, â.¥. ªã¤  ®­  ¯¥à¥¬¥á⨫ áì
  1010. ;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
  1011.         add     eax,ed_offset   ;¤®¡ ¢¨¬ ᬥ饭¨¥
  1012.         cmp     eax,dword ed_size       ;¥á«¨ ¢ë諨 §  ¯à¥¤¥«ë, â® ­¨ç¥£® ­¥ ¤¥« âì
  1013.         ja      .mwigvag
  1014. .mdraw:
  1015.         mov     dword   ed_pos,eax ;á®åà ­¨¬ ­®¢®¥ §­ ç¥­¨¥
  1016. ;¨á®¢ ­¨¥ § ªà è¥­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ®ç¨á⪠ ¨å
  1017.         mov     ecx,dword       ed_shift_pos
  1018.         mov     ebx,dword       ed_shift_pos_old
  1019.         mov     dword   ed_shift_pos_old,eax    ;¢­¥á¥¬ ­®¢®¥ §­ ç¥­¨¥ áâ à®© ¯®§¨æ¨¨ ªãàá®à 
  1020. ;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­ëå ®¡« á⥩
  1021.         cmp     ecx,ebx         ;¢ëïá­ï¥¬ ªã¤  ¡ë«® ¤¢¨¦¥­¨¥ ­  ®¤¨­ è £ ­ § ¤
  1022.         je      .m1_shem        ;¤¢¨¦¥­¨ï ­¥ ¡ë«® à ­¥¥
  1023.         jb      .msmaller       ;¤¢¨¦¥­¨¥ ¡ë«® ->
  1024.         cmp     ebx,eax         ;¤¢¨¦¥­¨¥ ¡ë«® ¤® í⮣® <- ¨ âãâ ¬ë ¯à®¢¥à塞 ᥩç á ªã¤  ¤¢¨¦¥­¨¥ ¯à®¨á室¨â
  1025.         ja      .m1_shem        ;¥á«¨ ¡ë«® ¤¢¨¦¥­¨¥ <- â® ­ã¦­® § ªà á¨âì ®¡« áâì
  1026.         je      .mwigvag        ;¥á«¨ ¨§¬¥­¥­¨ï ­¥ ¡ë«®, â® ­¨ç¥£® ­¥ ¤¥« âì
  1027.         mov     ebp,ed_color    ;âã⠭㦭® ®ç¨áâ¨âì ®¡« áâì c ed_pos ed_shift_pos_old
  1028. ;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
  1029.         call    .sh_cl_
  1030.         jmp     .mwigvag
  1031. .msmaller:
  1032.         cmp     ebx,eax
  1033.         jb      .m1_shem
  1034.         mov     ebp,ed_color
  1035. ;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
  1036.         call    .sh_cl_
  1037.         jmp     .mwigvag
  1038. ;alike  =
  1039. .m1_shem:
  1040.         mov     ebp,shift_color
  1041. ;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
  1042.         mov     ebx,ecx
  1043.         call    .sh_cl_
  1044.         jmp     .mwigvag
  1045. .mwigvag:
  1046.         and     word ed_flags,ed_shift_mcl
  1047.         jmp     .draw_cursor_text
  1048. ;       popa
  1049. ;       ret
  1050. .mleft:
  1051.         mov     eax,ed_pos
  1052.         cmp     eax,0
  1053.         jbe      .mwigvag
  1054.         dec     eax
  1055.         call    .check_offset
  1056.         push    eax
  1057.         mov     ebx,ed_shift_pos
  1058.         mov     ebp,shift_color
  1059.         call    .sh_cl_
  1060.         pop     eax
  1061.         jmp     .mdraw
  1062. .mright:
  1063.         mov     eax,ed_pos
  1064.         mov     ebx,ed_size
  1065.         cmp     eax,ebx
  1066.         jae     .mwigvag
  1067.         inc     eax
  1068.         call    .check_offset
  1069.         mov     ebx,ed_shift_pos
  1070.         mov     ebp,shift_color
  1071.         push    eax
  1072.         call    .sh_cl_
  1073.         pop     eax
  1074.         jmp     .mdraw  
  1075.  
  1076. }
  1077. ed_figure_only= 1000000000000000b   ;®¤­¨ ᨬ¢®«ë
  1078. ed_always_focus= 100000000000000b
  1079. ed_focus=                     10b   ;䮪ãá ¯à¨«®¦¥­¨ï
  1080. ed_shift_on=                1000b   ;¥á«¨ ­¥ ãáâ ­®¢«¥­ -§­ ç¨â ¢¯¥à¢ë¥ ­ ¦ â shift,¥á«¨ ¡ë« ãáâ ­®¢«¥­, §­ ç¨â ¬ë 㦥 çâ® - â® ¤¥« «¨ 㤥ন¢ ï shift
  1081. ed_shift_on_off=1111111111110111b
  1082. ed_shift=                    100b   ;¢ª«îç ¥âáï ¯à¨ ­ ¦ â¨¨ ­  shift â.¥. ¥á«¨ ­ ¦¨¬ î
  1083. ed_shift_off=   1111111111111011b
  1084. ed_shift_bac=              10000b   ;¡¨â ¤«ï ®ç¨á⪨ ¢ë¤¥«¥­®£® shift â.¥. ¯à¨ ãáâ ­®¢ª¥ £®¢®à¨â çâ® ¥áâì ¢ë¤¥«¥­¨¥
  1085. ed_shift_bac_cl=1111111111101111b   ;®ç¨á⪠ ¯à¨ 㤠«¥­¨¨ ¢ë¤¥«¥­¨ï
  1086. ed_shift_cl=    1111111111100011b
  1087. ed_shift_mcl=   1111111111111011b
  1088. ed_left_fl=               100000b
  1089. ed_right_fl=    1111111111011111b
  1090. ed_offset_fl=            1000000b
  1091. ed_offset_cl=   1111111110111111b
  1092. ed_insert=              10000000b
  1093. ed_insert_cl=   1111111101111111b
  1094. ed_mouse_on =          100000000b
  1095. ed_mous_adn_b=         100011000b
  1096. ed_mouse_on_off=1111111011111111b
  1097. ed_height=14 ; ¢ëá®â 
  1098. macro draw_edit_boxes start,_end,use_f9,structure_of_potock
  1099. {
  1100. if use_f9 eq
  1101. else
  1102.         mcall   9,structure_of_potock,-1
  1103. end if
  1104.         mov     edi,start
  1105.         mov     ecx,((_end-start)/ed_struc_size)
  1106. @@:
  1107.         call    edit_box.draw
  1108.         add     edi,ed_struc_size
  1109.         loop    @b
  1110. }
  1111.  
  1112. macro mouse_edit_boxes start,_end
  1113. {
  1114.         mov     edi,start
  1115.         mov     ecx,((_end-start)/ed_struc_size)
  1116. @@:
  1117.         call    edit_box.mouse
  1118.         add     edi,ed_struc_size
  1119.         loop    @b
  1120. }
  1121.  
  1122. macro key_edit_boxes start,end
  1123. {
  1124.         mov     edi,start
  1125.         mov     ecx,((end-start)/ed_struc_size)
  1126. @@:
  1127.         call    edit_box.key
  1128.         add     edi,ed_struc_size
  1129.         loop    @b
  1130. }
  1131. ed_struc_size=70
  1132. struc  edit_box width,left,top,color,shift_color,focus_border_color,\
  1133.        blur_border_color,text_color,max,text,flags,size,pos
  1134. {
  1135. .width dd width
  1136. .left dd left
  1137. .top dd top
  1138. .color dd color
  1139. .shift_color dd shift_color
  1140. .focus_border_color dd focus_border_color
  1141. .blur_border_color dd blur_border_color
  1142. .text_color dd text_color
  1143. .max dd max
  1144. .text dd text
  1145. .flags dw flags+0
  1146. .size dd size+0
  1147. .pos dd pos+0
  1148. .offset dd 0
  1149. .cl_curs_x dd 0
  1150. .cl_curs_y dd 0
  1151. .shift   dd 0
  1152. .shift_old   dd 0
  1153. }
  1154.  
  1155.  
  1156. macro edit_boxes_set_sys_color start,end,color_table
  1157. {
  1158.         mov     edi,start
  1159.         mov     ecx,((end-start)/ed_struc_size)
  1160.         mov     esi,color_table
  1161. @@:
  1162.         mov     eax,[esi+36]
  1163.         mov     ebx,[esi+20]
  1164.         mov     ed_focus_border_color,eax
  1165.         shr     bh,1
  1166.         shr     bl,1
  1167.         shr     ah,1
  1168.         shr     al,1
  1169.         add     ah,bh
  1170.         add     al,bl
  1171.         ror     eax,16
  1172.         ror     ebx,16
  1173.         shr     bl,1
  1174.         shr     al,1
  1175.         add     al,bl
  1176.         ror     eax,16
  1177.         mov     ed_blur_border_color,eax
  1178.         add     edi,ed_struc_size
  1179.         loop    @b
  1180. }
  1181.  
  1182. macro draw_edit_box ed_ptr,use_f9,structure_of_potock
  1183. {
  1184. if use_f9 eq
  1185. else
  1186.         mcall   9,structure_of_potock,-1
  1187. end if
  1188.         mov     edi,ed_ptr
  1189.         call    edit_box.draw
  1190. }
  1191.  
  1192. macro mouse_edit_box ed_ptr
  1193. {
  1194.         mov     edi,ed_ptr
  1195.         call    edit_box.mouse
  1196. }
  1197.  
  1198. macro key_edit_box ed_ptr
  1199. {
  1200.         mov     edi,ed_ptr
  1201.         call    edit_box.key
  1202. }
  1203. macro default_box ed_ptr
  1204. {
  1205. pusha
  1206. ;       xor     eax,eax
  1207. ;       mov     ed_shift_pos,eax
  1208. ;       mov     ed_shift_pos_old,eax
  1209.         and     word ed_flags,ed_shift_cl
  1210. ;       mov     ed_offset,eax
  1211. popa
  1212. }