Subversion Repositories Kolibri OS

Rev

Rev 7128 | Rev 7404 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. macro use_key_no_process  up,down,esc,enter,tab,numl,capsl,scrolll
  2. {
  3. if up eq
  4. else
  5.         cmp     ah,177
  6.         jz      edit_box.editbox_exit
  7. end if
  8. if down eq
  9. else
  10.         cmp     ah,178
  11.         jz      edit_box.editbox_exit
  12. end if
  13. if esc eq
  14. else
  15.         cmp     ah,27   ;ESC - ª« ¢¨è  ))
  16.         jz      edit_box.editbox_exit
  17. end if
  18. if enter eq
  19. else
  20.         cmp     ah,13   ;ENTER - ª« ¢¨è  ))
  21.         jz      edit_box.editbox_exit
  22. end if
  23. if tab eq
  24. else
  25.         cmp     ah,9   ;TAB - ª« ¢¨è  ))
  26.         jz      edit_box.editbox_exit
  27. end if
  28. if numl eq
  29. else
  30.         cmp     ah,4   ;Num Lock - ª« ¢¨è  ))
  31.         jz      edit_box.editbox_exit
  32. end if
  33. if capsl eq
  34. else
  35.         cmp     ah,2   ;Caps Lock - ª« ¢¨è  ))
  36.         jz      edit_box.editbox_exit
  37. end if
  38. if scrolll eq
  39. else
  40.         cmp     ah,1   ;Scroll Lock - ª« ¢¨è  ))
  41.         jz      edit_box.editbox_exit
  42. end if
  43. }
  44.  
  45.  
  46. align 16
  47. edit_box:
  48. .draw:
  49.         pushad
  50.         mov     edi,[esp+36]
  51.         and     dword ed_text_color,17FFFFFFh
  52.         mov     ecx,ed_text_color
  53.         mov     ebx,ecx
  54.         shr     ecx,28
  55.         shl     ebx,4
  56.         shr     ebx,28
  57.         inc     ebx
  58.         mov     eax,6
  59.         jecxz   @f
  60.         mov     al, 8
  61. @@:
  62.         mul     bl
  63.         mov     ed_char_width,eax
  64.         mov     al, 9
  65.         jecxz   @f
  66.         mov     al, 16
  67. @@:
  68.         mul     bl
  69.         add     eax,4
  70.         mov     ed_height,eax
  71.         call    .draw_border
  72. .draw_bg_cursor_text:
  73.         call    .check_offset
  74.         call    .draw_bg
  75.         call    .draw_shift
  76. .draw_cursor_text:
  77.         call    .draw_text
  78.         test    word ed_flags,ed_focus
  79.         jz      .editbox_exit
  80.         call    .draw_cursor
  81. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  82. ;Ž¡é¨© ¢ë室 ¨§ editbox ¤«ï ¢á¥å ä㭪権 ¨ ¯®áâ ®¡à ¡®â稪®¢;;
  83. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  84. .editbox_exit:
  85.         popad
  86.         ret 4
  87.  
  88. ;==========================================================
  89. ;=== ®¡à ¡®âª  ª« ¢¨ âãàë =================================
  90. ;==========================================================
  91. align 16
  92. edit_box_key:
  93.         pushad
  94.         mov     edi,[esp+36]
  95.         test    word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
  96.         jz      edit_box.editbox_exit
  97.         test    word ed_flags,ed_mouse_on or ed_disabled
  98.         jnz     edit_box.editbox_exit
  99. ;--------------------------------------
  100. ; this code for Win-keys, works with
  101. ; kernel SVN r.3356 or later
  102.         push    eax
  103.         push    ebx
  104.         mcall   SF_KEYBOARD,SSF_GET_CONTROL_KEYS
  105.         test    ax,0x200        ; LWin
  106.         jnz     .win_key_pressed
  107.         test    ax,0x400        ; RWin
  108.         jz      @f
  109. .win_key_pressed:
  110.         pop     ebx
  111.         pop     eax
  112.         jmp     edit_box.editbox_exit
  113.  
  114. @@:     pop     ebx
  115.         pop     eax
  116. ;--------------------------------------
  117. ;à®¢¥àª  ­ ¦ â shift ?
  118.         call    edit_box_key.check_shift_ctrl_alt
  119. ;----------------------------------------------------------
  120. ;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
  121. ;----------------------------------------------------------
  122.         cmp     ah,8
  123.         jz      edit_box_key.backspace
  124.         cmp     ah,0xb6
  125.         jz      edit_box_key.delete
  126.         cmp     ah,176
  127.         jz      edit_box_key.left
  128.         cmp     ah,179
  129.         jz      edit_box_key.right
  130.         cmp     ah,180
  131.         jz      edit_box_key.home
  132.         cmp     ah,181
  133.         jz      edit_box_key.end
  134.         cmp     ah,185  ;insert
  135.         jz      edit_box_key.insert
  136. ; ª®¬¡¨­ æ¨¨ Ctrl + ª« ¢¨è 
  137.         test    word ed_flags,ed_ctrl_on
  138.         jz      @f
  139. ; ¯à®¢¥àª  ᪠­ª®¤ 
  140.         ror     eax,8
  141.         cmp     ah,45 ; Ctrl + X
  142.         je      edit_box_key.ctrl_x        
  143.         cmp     ah,46 ; Ctrl + C
  144.         je      edit_box_key.ctrl_c
  145.         cmp     ah,47 ; Ctrl + V
  146.         je      edit_box_key.ctrl_v
  147.         rol     eax,8
  148. @@:
  149. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  150. ;‡ £«ã誠 ­  ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢­¨§ â.¥. ¯à¨ ®¡­ à㦥­¨¨ íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪 
  151. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  152. use_key_no_process   up,down,esc,enter,tab,numl,capsl,scrolll
  153. ;--- ­ ¦ â  ¤àã£ ï ª« ¢¨è  ---
  154. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  155. ;à®¢¥àª  ãáâ ­®¢«¥­ «¨ ä« £ ¯à¨ ª®â®à®¬ ­ã¦­® ¢ë¢®¤¨âì ⮫쪮 æ¨äàë ¢ ­ã¦­®¬ ¡®ªá¥, ¥á«¨ â ª®© ­¥®¡å®¤¨¬®á⨠­¥â, ­ã¦­® § ª®¬¥­â¨à®¢ âì ¬ ªà®á
  156. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  157.         test    word ed_flags,ed_figure_only  ; ⮫쪮 æ¨äàë?
  158.         jz      @f
  159.         cmp     ah,'0'
  160.         jb      edit_box.editbox_exit
  161.         cmp     ah,'9'
  162.         ja      edit_box.editbox_exit
  163. @@:
  164.  
  165. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  166. ;¯à®¢¥àª  ­  shift, ¡ë« «¨ ­ ¦ â
  167. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  168.         test    word ed_flags,ed_shift_on
  169.         je      @f
  170. ; edx = ed_size, ecx = ed_pos
  171.         push    eax
  172.         mov     edx,ed_size
  173.         mov     ecx, ed_pos
  174.         pusha
  175. ; clear input area
  176.         mov     ebp,ed_color
  177.         movzx   ebx, word ed_shift_pos
  178.         call    edit_box_key.sh_cl_
  179.         mov     ebp,ed_size
  180.         call    edit_box_key.clear_bg
  181.         popa
  182.         call    edit_box_key.del_char
  183.         mov     ebx,ed_size
  184.         sub     bx,ed_shift_pos
  185.         mov     ed_size,ebx
  186.         pop     eax
  187. @@:
  188.  
  189. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  190. ; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥ + ¤ «ì­¥©è ï ®¡à ¡®âª 
  191. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  192.         mov     ecx,ed_size
  193.         mov     edx, ed_max
  194.         test    word ed_flags,ed_insert
  195.         jne     @f
  196.         cmp     ecx,edx
  197.         jae     edit_box.editbox_exit
  198. @@:     mov     ebx, ed_pos
  199.         cmp     ebx,edx
  200.         jnl     edit_box.editbox_exit
  201.         mov     ecx,ed_size
  202.         push    edi eax
  203.         mov     ebp,edi
  204.         mov     esi,ed_text
  205.         add     esi,ecx
  206.         mov     edi,esi
  207.         cmp     ecx,ebx
  208.         je      edit_box_key.In_k
  209.         test    dword bp_flags,ed_insert
  210.         jne     edit_box_key.ins_v
  211.         pusha
  212.         mov     edi,ebp
  213.         mov     ebp,ed_size
  214.         call    edit_box_key.clear_bg
  215.         popa
  216.         sub     ecx,ebx
  217.         inc     edi
  218.         std
  219.         inc     ecx
  220. @@:
  221.         lodsb
  222.         stosb
  223.         loop    @b
  224. edit_box_key.In_k:
  225.         cld
  226.         pop     eax
  227.         mov     al,ah
  228.         stosb
  229.         pop     edi
  230.         inc     dword ed_size
  231.         inc     dword ed_pos
  232.         call    edit_box_key.draw_all2
  233.         jmp     edit_box_key.shift
  234.  
  235. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  236. ;Ž¡à ¡®âª  ª« ¢¨è insert,delete.backspace,home,end,left,right
  237. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  238. edit_box_key.insert:
  239.         test    word ed_flags,ed_insert
  240.         je      @f
  241.         and     word ed_flags,ed_insert_cl
  242.         jmp     edit_box.editbox_exit
  243.  
  244. @@:     or      word ed_flags,ed_insert
  245.         jmp     edit_box.editbox_exit
  246.  
  247. edit_box_key.ins_v:
  248.         dec     dword bp_size
  249.         sub     esi,ecx
  250.         add     esi,ebx
  251.         mov     edi,esi
  252.         pusha
  253.         mov     edi,ebp
  254.         mov     ebp,ed_pos
  255.         call    edit_box_key.clear_bg
  256.         popa
  257.         jmp     edit_box_key.In_k
  258.  
  259. edit_box_key.delete:
  260.         mov     edx,ed_size
  261.         mov     ecx,ed_pos
  262.         cmp     edx,ecx
  263.         jg      edit_box_key.bac_del
  264.         test    word ed_flags,ed_shift_on
  265.         jne     edit_box_key.del_bac
  266.         popad
  267.         ret     4
  268.  
  269. edit_box_key.bac_del:
  270.         call    edit_box_key.del_char
  271.         jmp     edit_box_key.draw_all
  272.  
  273. edit_box_key.backspace:
  274.         test    word ed_flags,ed_shift_on
  275.         jne     edit_box_key.delete
  276.         mov     ecx,ed_pos
  277.         test    ecx,ecx
  278.         jnz     edit_box_key.del_bac
  279.         popad
  280.         ret     4
  281.  
  282. edit_box_key.del_bac:
  283.         mov     edx,ed_size
  284.         cmp     edx,ecx ;if ed_pos=ed_size
  285.         je      @f
  286.         dec     ecx
  287.         call    edit_box_key.del_char
  288. @@:     test    word ed_flags,ed_shift_on
  289.         jne     edit_box_key.bac_del
  290.         dec     dword ed_pos
  291. edit_box_key.draw_all:
  292.         push    edit_box_key.shift
  293.         test    word ed_flags,ed_shift_on
  294.         je      @f
  295.         movzx   eax, word ed_shift_pos
  296.         mov     ebx,ed_size
  297.         sub     ebx,eax
  298.         mov     ed_size,ebx
  299.         mov     ebp,ed_color
  300.         call    edit_box.clear_cursor
  301.         call    edit_box.check_offset        
  302.         and     word ed_flags,ed_shift_cl
  303.         jmp     edit_box.draw_bg
  304.  
  305. @@:     dec     dword ed_size
  306. edit_box_key.draw_all2:
  307.         and     word ed_flags,ed_shift_cl
  308.         mov     ebp,ed_color
  309.         call    edit_box.clear_cursor
  310.         call    edit_box.check_offset
  311.         mov     ebp,ed_size
  312.         jmp     edit_box_key.clear_bg
  313.  
  314. ;--- ­ ¦ â  ª« ¢¨è  left ---
  315. edit_box_key.left:
  316.         mov     ebx,ed_pos
  317.         test    ebx,ebx
  318.         jz      edit_box_key.sh_st_of
  319.         or      word ed_flags,ed_left_fl
  320.         call    edit_box_key.sh_first_sh
  321.         dec     dword ed_pos
  322.         call    edit_box.draw_bg
  323.         call    edit_box.draw_shift
  324.         call    edit_box_key.sh_enable
  325.         jmp     edit_box.draw_cursor_text
  326.  
  327. ;--- ­ ¦ â  ª« ¢¨è  right ---
  328. edit_box_key.right:
  329.         mov     ebx,ed_pos
  330.         cmp     ebx,ed_size
  331.         je      edit_box_key.sh_st_of
  332.         and     word ed_flags,ed_right_fl
  333.         call    edit_box_key.sh_first_sh
  334.         inc     dword ed_pos
  335.         call    edit_box.draw_bg
  336.         call    edit_box.draw_shift
  337.         call    edit_box_key.sh_enable
  338.         jmp     edit_box.draw_cursor_text
  339.  
  340. edit_box_key.home:
  341.         mov     ebx,ed_pos
  342.         test    ebx,ebx
  343.         jz      edit_box_key.sh_st_of
  344.         call    edit_box_key.sh_first_sh
  345.         xor     eax,eax
  346.         mov     ed_pos,eax
  347.         call    edit_box.draw_bg
  348.         call    edit_box.draw_shift
  349.         call    edit_box_key.sh_home_end
  350.         jmp     edit_box.draw_cursor_text
  351.  
  352. ;--- ­ ¦ â  ª« ¢¨è  end ---
  353. edit_box_key.end:
  354.         mov     ebx,ed_pos
  355.         cmp     ebx,ed_size
  356.         je      edit_box_key.sh_st_of
  357.         call    edit_box_key.sh_first_sh
  358.         mov     eax,ed_size
  359.         mov     ed_pos,eax
  360.         call    edit_box.draw_bg
  361.         call    edit_box.draw_shift
  362.         call    edit_box_key.sh_home_end
  363.         jmp     edit_box.draw_cursor_text
  364. ;----------------------------------------
  365. StrInsert:
  366. ; SizeOf(TmpBuf) >= StrLen(Src) + StrLen(Dst) + 1              
  367. Dst    equ [esp + 20] ; - destination buffer
  368. Src    equ [esp + 16] ; - source to insert from
  369. Pos    equ [esp + 12] ; - position for insert
  370. DstMax equ [esp + 8]  ; - maximum Dst length(exclude terminating null)
  371. TmpBuf equ [esp + 4]  ; - temporary buffer              
  372.         xor    edx, edx
  373.         mov    esi, Dst
  374.         mov    edi, TmpBuf
  375.         mov    ecx, Pos
  376.         add    edx, ecx
  377.         rep movsb
  378.         mov    edi, Src
  379.         mov    ecx, -1
  380.         xor    eax, eax
  381.         repne scasb
  382.         mov    eax, -2
  383.         sub    eax, ecx
  384.         add    edx, eax
  385.         mov    esi, Src
  386.         mov    edi, TmpBuf
  387.         add    edi, Pos
  388.         mov    ecx, eax
  389.         rep movsb
  390.         mov    ebx, edi
  391.         mov    edi, Dst
  392.         add    edi, Pos
  393.         mov    ecx, -1
  394.         xor    eax, eax
  395.         repne scasb
  396.         mov    eax, -2
  397.         sub    eax, ecx
  398.         inc    eax
  399.         add    edx, eax
  400.         mov    edi, ebx
  401.         mov    esi, Pos
  402.         add    esi, Dst
  403.         mov    ecx, eax
  404.         rep movsb
  405.         mov    esi, TmpBuf
  406.         mov    edi, Dst
  407. ; ecx = MIN(edx, DstSize)        
  408.         cmp    edx, DstMax
  409.         sbb    ecx, ecx                                  
  410.         and    edx, ecx
  411.         not    ecx
  412.         and    ecx, DstMax
  413.         add    ecx, edx                                  
  414.         mov    eax, ecx ; return total length
  415.         rep movsb
  416.         ret    20
  417. restore Dst    
  418. restore Src      
  419. restore Pos    
  420. restore DstSize
  421. restore TmpBuf
  422. ;----------------------------------------        
  423. edit_box_key.ctrl_x:
  424.         test   word ed_flags,ed_shift_on
  425.         jz     edit_box.editbox_exit        
  426.         push    dword 'X'  ; this value need below to determine which action is used
  427.         jmp     edit_box_key.ctrl_c.pushed
  428.        
  429. edit_box_key.ctrl_c:
  430.         test   word ed_flags,ed_shift_on
  431.         jz     edit_box.editbox_exit
  432.         push    dword 'C'  ; this value need below to determine which action is used
  433. .pushed:        
  434. ; add memory area
  435.         mov     ecx,ed_size
  436.         add     ecx,3*4
  437.         mcall   SF_SYS_MISC,SSF_MEM_ALLOC
  438. ; building the clipboard slot header
  439.         xor     ecx,ecx
  440.         mov     [eax+4],ecx ; type 'text'
  441.         inc     ecx
  442.         mov     [eax+8],ecx ; cp866 text encoding
  443.         mov     ecx,ed_pos      
  444.         movzx   ebx,word ed_shift_pos
  445.         sub     ecx,ebx
  446. .abs: ; make ecx = abs(ecx)
  447.                neg     ecx
  448.                jl            .abs
  449.         add     ecx,3*4
  450.         mov     [eax],ecx
  451.         sub     ecx,3*4        
  452.         mov     edx,ed_pos
  453.         movzx   ebx,word ed_shift_pos
  454.         cmp     edx,ebx
  455.         jle     @f
  456.         mov     edx,ebx
  457. @@:        
  458. ; copy data
  459.         mov     esi,ed_text
  460.         add     esi,edx
  461.         push    edi
  462.         mov     edi,eax
  463.         add     edi,3*4
  464.         cld
  465.         rep     movsb
  466.         pop     edi
  467. ; put slot to the kernel clipboard
  468.         mov     edx,eax
  469.         mov     ecx,[edx]
  470.         push    eax
  471.         mcall   SF_CLIPBOARD,SSF_WRITE_CB
  472.         pop     ecx
  473. ; remove unnecessary memory area
  474.         mcall   SF_SYS_MISC,SSF_MEM_FREE
  475. .exit:
  476.         pop     eax        ; determine current action (ctrl+X or ctrl+C)
  477.         cmp     eax, 'X'
  478.         je      edit_box_key.delete
  479.         jmp     edit_box.editbox_exit
  480.  
  481. edit_box_key.ctrl_v:
  482.         mcall   SF_CLIPBOARD,SSF_GET_SLOT_COUNT
  483. ; no slots of clipboard ?
  484.         test    eax,eax
  485.         jz      .exit
  486. ; main list area not found ?
  487.         inc     eax
  488.         test    eax,eax
  489.         jz      .exit
  490.         sub     eax,2
  491.         mov     ecx,eax
  492.         mcall   SF_CLIPBOARD,SSF_READ_CB
  493. ; main list area not found ?
  494.         inc     eax
  495.         test    eax,eax
  496.         jz      .exit
  497. ; error ?
  498.         sub     eax,2
  499.         test    eax,eax
  500.         jz      .exit
  501.         inc     eax
  502. ; check contents of container
  503.         mov     ebx,[eax+4]
  504. ; check for text
  505.         test    ebx,ebx
  506.         jnz     .no_valid_text
  507.         mov     ebx,[eax+8]
  508. ; check for cp866
  509.         cmp     bl,1
  510.         jnz     .no_valid_text
  511. ; if something selected then need to delete it        
  512.         test   word ed_flags,ed_shift_on
  513.         jz     .selected_done
  514.         push   eax; dummy parameter ; need to
  515.         push   dword .selected_done ; correctly return
  516.         pushad                      ; from edit_box_key.delete
  517.         jmp    edit_box_key.delete
  518. .selected_done:        
  519.         mov     ecx,[eax]
  520.         sub     ecx,3*4
  521. ; in ecx size of string to insert  
  522.         add     ecx,ed_size
  523.         mov     edx,ed_max
  524.         cmp     ecx,edx
  525.         jb      @f
  526.         mov     ecx,edx
  527. @@:
  528.         mov     esi,eax
  529.         add     esi,3*4
  530.         push    eax edi
  531. ;---------------------------------------;        
  532.         mov     ed_size,ecx
  533.         inc     ecx        
  534.         mcall   SF_SYS_MISC,SSF_MEM_ALLOC
  535.         push    eax ; save mem pointer
  536.                
  537.         mov     edx, ed_max
  538.        
  539.         push   dword ed_text ; Dst  
  540.         push   esi           ; Src  
  541.         push   dword ed_pos  ; Pos in Dst
  542.         push   edx           ; DstMax
  543.         push   eax           ; TmpBuf
  544.         call   StrInsert  
  545.        
  546.         pop    eax ; restore mem pointer
  547.         mcall   SF_SYS_MISC,SSF_MEM_FREE
  548. ;---------------------------------------;        
  549. ;        mov     edi,ed_text
  550. ;        cld
  551. ;@@:
  552. ;        lodsb
  553. ;        cmp     al,0x0d ; EOS (end of string)
  554. ;        je      .replace
  555. ;        cmp     al,0x0a ; EOS (end of string)
  556. ;        jne     .continue
  557. ;.replace:
  558. ;        mov     al,0x20 ; space
  559. ;.continue:
  560. ;        stosb
  561. ;        dec     ecx
  562. ;        jnz     @b
  563.         pop     edi eax
  564. .no_valid_text:
  565. ; remove unnecessary memory area
  566.         mov     ecx,eax
  567.         mcall   SF_SYS_MISC,SSF_MEM_FREE
  568. .exit:
  569.         jmp     edit_box.draw_bg_cursor_text
  570.  
  571. ;==========================================================
  572. ;=== ®¡à ¡®âª  ¬ëè¨ =======================================
  573. ;==========================================================
  574. ;save for stdcall ebx,esi,edi,ebp
  575. align 16
  576. edit_box_mouse:
  577.         pushad
  578.         mov     edi,[esp+36]
  579.         test    word ed_flags,ed_disabled
  580.         jnz     edit_box.editbox_exit
  581.  
  582. ;----------------------------------------------------------
  583. ;--- ¯®«ãç ¥¬ á®áâ®ï­¨¥ ª­®¯®ª ¬ëè¨ -----------------------
  584. ;----------------------------------------------------------
  585.         mcall   SF_MOUSE_GET,SSF_BUTTON
  586. ;----------------------------------------------------------
  587. ;--- ¯à®¢¥à塞 á®áâ®ï­¨¥ ----------------------------------
  588. ;----------------------------------------------------------
  589.         test    eax,1
  590.         jnz     edit_box_mouse.mouse_left_button
  591.         and     word ed_flags,ed_mouse_on_off
  592.         mov     ebx,ed_mouse_variable
  593.         push    0
  594.         pop     dword [ebx]
  595.         jmp     edit_box.editbox_exit
  596.  
  597. .mouse_left_button:
  598. ;----------------------------------------------------------
  599. ;--- ¡«®ª¨à®¢ª  ®â 䮪ãá¨à®¢ª¨ ¢ ¤àã£¨å ¡®ªá å ¯à¨ ¯®¯ ¤ ­¨¨ ­  ­¨å ªãàá®à 
  600. ;----------------------------------------------------------
  601.         mov     eax,ed_mouse_variable
  602.         push    dword [eax]
  603.         pop     eax
  604.         test    eax,eax
  605.         jz      @f
  606.         cmp     eax,edi
  607.         je      @f
  608.         jmp     edit_box_mouse._blur
  609. ;----------------------------------------------------------
  610. ;--- ¯®«ãç ¥¬ ª®®à¤¨­ âë ¬ëè¨ ®â­®á¨â¥«ì­® 0 â.¥ ¢á¥© ®¡« á⨠íªà ­ 
  611. ;----------------------------------------------------------
  612. @@:
  613.         mcall   SF_MOUSE_GET,SSF_WINDOW_POSITION
  614. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  615. ;”ã­ªæ¨ï ®¡à ¡®âª¨  ¬ë誨 ¯®«ã祭¨¥ ª®®à¤¨­ â ¨ ¯à®¢¥àª  ¨å + ¢ë¤¥«¥­¨ï
  616. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  617. ; ¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à?
  618.         test    word ed_flags,ed_mouse_on
  619.         jne     edit_box_mouse.mouse_wigwag
  620. ; ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box
  621.         mov     ebx,ed_top
  622.         cmp     ax,bx
  623.         jl      edit_box_mouse._blur
  624.         add     ebx,ed_height
  625.         cmp     ax,bx
  626.         jg      edit_box_mouse._blur
  627.         shr     eax,16
  628.         mov     ebx,ed_left
  629.         cmp     ax,bx
  630.         jl      edit_box_mouse._blur
  631.         add     ebx,ed_width
  632.         cmp     ax,bx
  633.         jg      edit_box_mouse._blur
  634. ; ¨§¬¥­ï¥¬ ¯®§¨æ¨î ªãàá®à 
  635.         push    eax
  636.         mov     ebp,ed_color
  637.         call    edit_box.clear_cursor
  638.         pop     eax
  639. edit_box_mouse._mvpos:
  640.         xor     edx,edx
  641.         sub     eax,ed_left
  642.         div     word ed_char_width
  643.         add     eax,ed_offset
  644.         cmp     eax,ed_size
  645.         jna     edit_box_mouse._mshift
  646.         mov     eax,ed_size
  647. edit_box_mouse._mshift:
  648. ; ᥪæ¨ï ®¡à ¡®âª¨ shift ¨ ¢ë¤¥«¥­¨ï ¯® shift
  649.         test    word ed_flags,ed_shift_bac
  650.         je      @f
  651.         mov     ebp,ed_color
  652.         movzx   ebx, word ed_shift_pos
  653.         push    eax
  654.         call    edit_box_key.sh_cl_
  655.         and     word ed_flags,ed_shift_bac_cl
  656.         pop     eax
  657. @@:
  658.         test    word ed_flags,ed_mouse_on
  659.         jne     @f
  660.         mov     ed_shift_pos,ax
  661.         or      word  ed_flags,ed_mouse_on
  662.         mov     ed_pos,eax
  663.         mov     ebx,ed_mouse_variable
  664.         push    edi
  665.         pop     dword [ebx]
  666.         bts     word ed_flags,1
  667.         call    edit_box.draw_bg
  668.         jmp     edit_box_mouse.m_sh
  669.  
  670. @@:     cmp     ax,ed_shift_pos
  671.         je      edit_box.editbox_exit
  672.         mov     ed_pos,eax
  673.         call    edit_box.draw_bg
  674.         mov     ebp,shift_color
  675.         movzx   ebx, word ed_shift_pos
  676.         call    edit_box_key.sh_cl_
  677.         or      word ed_flags,ed_mous_adn_b
  678. edit_box_mouse.m_sh:
  679.         call    edit_box.draw_text
  680.         call    edit_box.draw_cursor
  681. ; ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá 
  682.         jmp     edit_box_mouse.drc
  683.  
  684. edit_box_mouse._blur:
  685.         test    word ed_flags,ed_always_focus
  686.         jne     edit_box.editbox_exit
  687.         btr     word ed_flags,1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
  688.         jnc     edit_box.editbox_exit
  689.         mov     ebp,ed_color
  690.         call    edit_box.clear_cursor
  691. edit_box_mouse.drc:
  692.         call    edit_box.draw_border
  693.         jmp     edit_box.editbox_exit
  694.  
  695. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  696. ;Ž¡é¨¥ ä㭪樨 ®¡à ¡®âª¨
  697. ;----------------------------------------------------------
  698. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ¢ë¤¥«¥­­®© ç á⨠----------------
  699. ;----------------------------------------------------------
  700. edit_box.draw_shift:
  701.         test    word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  702.         jz      @f
  703.         mov     ebp,shift_color
  704.         movzx   ebx, word ed_shift_pos
  705.         call    edit_box_key.sh_cl_
  706. @@:     ret
  707. ;----------------------------------------------------------
  708. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
  709. ;----------------------------------------------------------
  710. edit_box.draw_text:
  711.         call    edit_box.get_n
  712.         mov     esi,ed_size
  713.         sub     esi,ed_offset
  714.         cmp     eax,esi
  715.         jae     @f
  716.         mov     esi,eax
  717. @@:
  718.         test    esi,esi
  719.         jz      @f
  720.         mov     eax,SF_DRAW_TEXT
  721.         mov     ebx,ed_left
  722.         add     ebx,2
  723.         shl     ebx,16
  724.         add     ebx,ed_top
  725.         add     ebx,3
  726.         mov     ecx,ed_text_color
  727.         test    dword ed_flags,ed_pass
  728.         jnz     .password
  729.         mov     edx,ed_text
  730.         add     edx,ed_offset
  731.         mcall
  732. @@:
  733.         ret
  734.  
  735. .password:
  736.         mov     ebp,esi
  737.         mov     esi,1
  738.         mov     edx,txt_pass
  739. @@:
  740.         mcall
  741.         rol     ebx,16
  742.         add     ebx,ed_char_width
  743.         rol     ebx,16
  744.         dec     ebp
  745.         jnz     @b
  746.         ret
  747.  
  748. txt_pass db '*'
  749. ;----------------------------------------------------------
  750. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ä®­  ----------------------------
  751. ;----------------------------------------------------------
  752. edit_box.draw_bg:
  753.         mov     ebx,ed_left
  754.         inc     ebx
  755.         shl     ebx,16
  756.         add     ebx,ed_width
  757.         dec     ebx
  758.         mov     edx,ed_color
  759.         test    word ed_flags, ed_disabled
  760.         jz      edit_box.draw_bg_eax
  761.         mov     edx, 0xCACACA   ; TODO: add disabled_color field to editbox struct
  762. edit_box.draw_bg_eax:
  763.         mov     ecx,ed_top
  764.         inc     ecx
  765.         shl     ecx,16
  766.         add     ecx,ed_height
  767.         mcall   SF_DRAW_RECT
  768.         ret
  769.  
  770. ;----------------------------------------------------------
  771. ;--- ¯à®æ¥¤ãà  ¯®«ã祭¨ï ª®«¨ç¥á⢠ ᨬ¢®«®¢ ¢ ⥪ã饩 è¨à¨­¥ ª®¬¯®­¥­â 
  772. ;----------------------------------------------------------
  773. edit_box.get_n:
  774.         mov     eax,ed_width
  775.         sub     eax,4
  776.         xor     edx,edx
  777.         div     word ed_char_width
  778.         ret
  779.  
  780. ;----------------------------------------------------------
  781. ;------------------ Draw Cursor Procedure -----------------
  782. ;----------------------------------------------------------
  783. ; in: ebp = Color
  784. edit_box.clear_cursor:
  785.         movzx   ebx, word cl_curs_x
  786.         cmp     ebx, ed_left ;¯®¯ ¤ ¥â «¨ ªãàá®à ⥪á⮢®¥ ¯®«¥?
  787.         jle     @f
  788.         mov     edx, ebp
  789.         movzx   ecx, word cl_curs_y
  790.         cmp     ecx, ed_top
  791.         jg      edit_box.draw_curs
  792. @@:
  793.         ret
  794.  
  795. edit_box.draw_cursor:
  796.         mov     edx, ed_text_color
  797.         mov     eax, ed_pos
  798.         sub     eax, ed_offset
  799.         mul     dword ed_char_width
  800.         mov     ebx, eax
  801.         add     ebx, ed_left
  802.         inc     ebx
  803.         mov     ecx, ed_top
  804.         add     ecx, 2
  805.         mov     cl_curs_x, bx
  806.         mov     cl_curs_y, cx
  807. edit_box.draw_curs:
  808.         mov     eax, ebx
  809.         shl     ebx, 16
  810.         or      ebx, eax
  811.         mov     eax, ecx
  812.         shl     ecx, 16
  813.         or      ecx, eax
  814.         add     ecx, ed_height
  815.         sub     ecx, 3
  816.         mcall   SF_DRAW_LINE
  817.         ret
  818.  
  819. ;----------------------------------------------------------
  820. ;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï à ¬ª¨ ----------------------------
  821. ;----------------------------------------------------------
  822. edit_box.draw_border:
  823.         test    word ed_flags,ed_focus
  824.         mov     edx,ed_focus_border_color
  825.         jne     @f
  826.         mov     edx,ed_blur_border_color
  827. @@:
  828.         mov     ebx,ed_left
  829.         mov     ecx,ebx
  830.         shl     ebx,16
  831.         add     ebx,ecx
  832.         add     ebx,ed_width
  833.         mov     ecx,ed_top
  834.         mov     esi,ecx
  835.         shl     ecx,16
  836.         add     ecx,esi
  837.         mcall   SF_DRAW_LINE ; top
  838.         mov     esi,ecx
  839.         inc     ecx
  840.         add     ecx,ed_height
  841.         mov     ebp,ecx
  842.         shl     ecx,16
  843.         mov     cx,bp
  844.         mcall   ; bottom
  845.         mov     cx,si
  846.         mov     ebp,ebx
  847.         sub     ebx,ed_width
  848.         mcall   ; left
  849.         mov     ebx,ebp
  850.         shl     ebx,16
  851.         mov     bx,bp
  852.         mcall   ; right
  853.         ret
  854.  
  855. ;----------------------------------------------------------
  856. ;--- ¯à®¢¥àª , § è¥« «¨ ªãàá®à §  £à ­¨æë ¨, ¥á«¨ ­ ¤®, ---
  857. ;--- ¨§¬¥­ï¥¬ ᬥ饭¨¥ ------------------------------------
  858. ;--- ¥á«¨ ᬥ饭¨¥ ¡ë«®, ãáâ ­®¢ª  ä« £  ed_offset_cl, ¨­ ç¥,
  859. ; ¥á«¨ ­¨ç¥£® ­¥ ¨§¬¥­¨«®áì, â® ¢ëáâ ¢«¥­¨¥ ed_offset_fl
  860. ; ¢ ®¡é¥© ¡¨â®¢®© ¬ âà¨æ¥ á®áâ®ï­¨ï ª®¬¯®­¥­â®¢ word ed_flags
  861. ;----------------------------------------------------------
  862. edit_box.check_offset:
  863.         pushad
  864.         mov     ecx,ed_pos
  865.         mov     ebx,ed_offset
  866.         cmp     ebx,ecx
  867.         ja      edit_box.sub_8
  868.         push    ebx
  869.         call    edit_box.get_n
  870.         pop     ebx
  871.         mov     edx,ebx
  872.         add     edx,eax
  873.         inc     edx     ;­¥®¡å®¤¨¬® ¤«ï ­®à¬ «ì­®£® ¯®«®¦¥­¨ï ªãàá®à  ¢ ªà ©­¥© «¥¢®© ¯®§¨æ¨¨
  874.         cmp     edx,ecx
  875.         ja      @f
  876.         mov     edx,ed_size
  877.         cmp     edx,ecx
  878.         je      edit_box.add_end
  879.         sub     edx,ecx
  880.         cmp     edx,8
  881.         jbe     edit_box.add_8
  882.         add     ebx,8
  883.         jmp     edit_box.chk_d
  884.  
  885. @@:     or      word ed_flags,ed_offset_fl
  886.         popad
  887.         ret
  888.  
  889. edit_box.sub_8:
  890.         test    ecx,ecx
  891.         jz      @f
  892.         sub     ebx,8   ;ebx=ed_offset
  893.         ja      edit_box.chk_d
  894. @@:
  895.         xor     ebx,ebx
  896.         jmp     edit_box.chk_d
  897.  
  898. edit_box.add_end:
  899.         sub     edx,eax
  900.         mov     ebx,edx
  901.         jmp     edit_box.chk_d
  902.  
  903. edit_box.add_8:
  904.         add     ebx,edx
  905. edit_box.chk_d:
  906.         mov     ed_offset,ebx
  907.         call    edit_box.draw_bg
  908.         and     word ed_flags,ed_offset_cl
  909.         popad
  910.         ret
  911.  
  912. align 4
  913. proc edit_box_set_text, edit:dword, text:dword
  914.         pushad
  915.         mov     edi,[edit]
  916.         mov     ecx,ed_max
  917.         inc     ecx
  918.         mov     edi,[text]
  919.         xor     al,al
  920.         cld
  921.         repne scasb
  922.         mov     ecx,edi
  923.         mov     edi,[edit]
  924.         mov     esi,[text]
  925.         sub     ecx,esi
  926.         dec     ecx
  927.         mov     ed_size,ecx
  928.         mov     ed_pos,ecx
  929.         and     word ed_flags,ed_shift_cl
  930.         mov     edi,ed_text
  931.         repne movsb
  932.         mov     byte[edi],0
  933.         popad
  934.         ret
  935. endp
  936.  
  937. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  938. ;”㭪樨 ¤«ï à ¡®âë á key
  939. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  940.  
  941. ;Ž¡à ¡®âª  Shift ¤«ï á­ïâ¨ï ¢ë¤¥«¥­¨ï ­¥¨§¢¥áâ­®© ®¡« áâ¨
  942. edit_box_key.shift:
  943.         call    edit_box.draw_bg
  944.         test    word ed_flags,ed_shift
  945.         je      edit_box_key.f_exit
  946.         mov     ebp,shift_color
  947.         or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  948.         movzx   ebx, word ed_shift_pos
  949.         call    edit_box_key.sh_cl_
  950.         jmp     edit_box.draw_cursor_text
  951.  
  952. edit_box_key.f_exit:
  953.         call    edit_box.check_offset
  954.         and     word ed_flags,ed_shift_cl
  955.         call    edit_box_key.enable_null
  956.         jmp     edit_box.draw_cursor_text
  957.  
  958. edit_box_key.sh_cl_:
  959. ;®¡à ¡®âª  ®ç¨á⪨, ¯à¨ «¥¢®¬ - ¯à ¢®¬ ¤¢¨¦¥­¨¨ ¢ë¤¥«¥­¨ï
  960. ;¤«ï ®¡à ¡®âª¨ á­ïâ¨ï ¢ë¤¥«¥­¨ï
  961. ;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
  962.         mov     eax,ed_pos
  963.         cmp     eax,ebx
  964.         jae     edit_box_key.sh_n
  965.         push    eax  ;¬¥­ì襥 ¢ eax
  966.         push    ebx  ;¡®«ì襥
  967.         jmp     edit_box_key.sh_n1
  968.  
  969. edit_box_key.sh_n:
  970.         push    ebx
  971.         push    eax
  972. edit_box_key.sh_n1:
  973.         call    edit_box.check_offset
  974.         call    edit_box.get_n
  975.         mov     edx,eax ;size of ed_box
  976.         mov     ecx,ed_offset
  977.         add     eax,ecx ;eax = w_off= ed_offset+width
  978.         mov     edx,eax ;save
  979.         pop     ebx     ;¡®«ì襥
  980.         pop     eax     ;¬¥­ì襥
  981.         cmp     eax,ecx         ;áà ¢­¥­¨¥ ¬¥­ì襣® á offset.
  982.         jae     edit_box_key.f_f            ;¥á«¨ ¡®«ìè¥
  983.         xor     eax,eax
  984.         cmp     edx,ebx         ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
  985.         jnb     @f
  986.         mov     ebx,edx
  987. @@:
  988.         sub     ebx,ecx
  989.         jmp     edit_box_key.nxt_f
  990.  
  991. edit_box_key.f_f:
  992.         sub     eax,ecx
  993.         cmp     edx,ebx         ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
  994.         jle     @f
  995.         sub     ebx,ecx
  996.         sub     ebx,eax
  997.         jmp     edit_box_key.nxt_f
  998.  
  999. @@:     mov     ebx,edx
  1000.         sub     ebx,ecx
  1001.         sub     ebx,eax
  1002. edit_box_key.nxt_f:
  1003.         mul     dword ed_char_width
  1004.         xchg    eax,ebx
  1005.         mul     dword ed_char_width
  1006.         add     ebx,ed_left
  1007.         inc     ebx
  1008.         shl     ebx,16
  1009.         inc     eax
  1010.         mov     bx, ax
  1011.         mov     edx,ebp ;shift_color
  1012.         call    edit_box.draw_bg_eax
  1013.         jmp     edit_box_key.enable_null
  1014.  
  1015. ;“áâ ­®¢ª - á­ï⨥ ¢ë¤¥«¥­¨ï ¢ ®¤¨­ ᨬ¢®«
  1016. edit_box_key.drw_sim:
  1017.         mov     eax,ed_pos
  1018.         call    edit_box_key.draw_rectangle
  1019.         jmp     edit_box_key.enable_null
  1020.  
  1021. ;”ã­ªæ¨ï ãáâ ­®¢ª¨ ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨¨ ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
  1022. edit_box_key.draw_wigwag:
  1023.         mov     ebp,shift_color
  1024.         call    edit_box.clear_cursor
  1025.         or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £  ¢ë¤¥«¥­­®© ®¡« áâ¨
  1026.         mov     ebp,shift_color
  1027.         mov     eax,ed_pos
  1028.         test    word ed_flags,ed_left_fl
  1029.         jnz     edit_box_key.draw_rectangle
  1030.         dec     eax
  1031.         jmp     edit_box_key.draw_rectangle
  1032.  
  1033. ;”ã­ªæ¨ï 㤠«¥­¨ï ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨¨ ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
  1034. edit_box_key.draw_wigwag_cl:
  1035.         mov     ebp,ed_color
  1036.         call    edit_box.clear_cursor
  1037.         mov     ebp,ed_color
  1038.         mov     eax,ed_pos
  1039.         test    word ed_flags,ed_left_fl
  1040.         jnz     edit_box_key.draw_rectangle
  1041.         dec     eax
  1042.         jmp     edit_box_key.draw_rectangle
  1043.  
  1044. ;¢å®¤­®© ¯ à ¬¥âà ebx - ed_pos
  1045. edit_box_key.sh_first_sh:
  1046.         test    word ed_flags,ed_shift
  1047.         je      @f
  1048.         mov     ed_shift_pos_old,bx
  1049.         test    word ed_flags,ed_shift_on
  1050.         jne     @f
  1051.         mov     ed_shift_pos,bx
  1052.         or      word ed_flags,ed_shift_on
  1053. @@:     ret
  1054. ;Ž¡à ¡®âª  ªà ©­¨å ¯®«®¦¥­¨© ¢ editbox ¯à¨ ­ ¦ â®¬ shift
  1055. ;¯à®¨§¢®¤¨â á­ï⨥ ¢ë¤¥«¥­¨ï, ¥á«¨ ­¥â shift
  1056. ;¨­ ç¥ ¢®®¡é¥ ¢ë室¨â
  1057. edit_box_key.sh_st_of:
  1058.         test    word ed_flags,ed_shift
  1059.         jne     @f
  1060.         test    word ed_flags,ed_shift_bac
  1061.         je      @f
  1062.         call    edit_box.draw_bg
  1063.         mov     ebp,ed_color
  1064.         movzx   ebx, word ed_shift_pos
  1065.         call    edit_box_key.sh_cl_  ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
  1066.         and     word ed_flags,ed_shift_cl ; ®ç¨á⪠ ®â ⮣®, çâ® ã¡à «¨ ¢ë¤¥«¥­¨¥
  1067.         jmp     edit_box.draw_cursor_text
  1068.  
  1069. @@:     and     word ed_flags,ed_shift_off
  1070.         popad
  1071.         ret     4
  1072. ;¯à®¢¥àª  á®áâ®ï­¨ï shift, ¡ë« «¨ ®­ ­ ¦ â à ­ìè¥?
  1073. edit_box_key.sh_enable:
  1074.         test    word ed_flags,ed_shift
  1075.         jne     edit_box_key.sh_ext_en ;­ à¨á®¢ âì § ªà è¥­­ë© ¯àאַ㣮«ì­¨ª
  1076.         test    word ed_flags,ed_shift_bac
  1077.         je      @f
  1078.         call    edit_box.check_offset
  1079.         mov     ebp,ed_color
  1080.         movzx   ebx, word ed_shift_pos
  1081.         call    edit_box_key.sh_cl_  ;®ç¨á⪠ ¢ë¤¥«¥­­®£® äà £¬¥­â 
  1082.         call    edit_box_key.draw_wigwag_cl
  1083.         and     word ed_flags,ed_shift_cl ; 1¢ à ­¥ ­ã¦­®
  1084.         ret
  1085.  
  1086. @@:     mov     ebp,ed_color
  1087.         call    edit_box.clear_cursor
  1088.         jmp     edit_box.check_offset
  1089.  
  1090. edit_box_key.sh_ext_en:
  1091.         call    edit_box.check_offset
  1092.         test    word ed_flags,ed_offset_fl
  1093.         je      @f
  1094. ;¨á®¢ ­¨¥ § ªà è¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ¨å ®ç¨á⪠
  1095.         movzx   eax, word ed_shift_pos
  1096.         mov     ebx,ed_pos
  1097.         movzx   ecx, word ed_shift_pos_old
  1098. ;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­­ëå ®¡« á⥩
  1099.         cmp     eax,ecx
  1100.         je      edit_box_key.1_shem
  1101.         jb      edit_box_key.smaller
  1102.         cmp     ecx,ebx
  1103.         ja      edit_box_key.1_shem
  1104.         call    edit_box_key.draw_wigwag_cl ;clear
  1105.         jmp     edit_box_key.sh_e_end
  1106.  
  1107. edit_box_key.smaller:
  1108.         cmp     ecx,ebx
  1109.         jb      edit_box_key.1_shem
  1110.         call    edit_box_key.draw_wigwag_cl ;clear
  1111.         jmp     edit_box_key.sh_e_end
  1112.  
  1113. edit_box_key.1_shem:
  1114.         call    edit_box_key.draw_wigwag
  1115. edit_box_key.sh_e_end:
  1116.         and     word ed_flags,ed_shift_off
  1117.         ret
  1118.  
  1119. @@:     mov     ebp,shift_color
  1120.         movzx   ebx, word ed_shift_pos
  1121.         call    edit_box_key.sh_cl_
  1122.         jmp     edit_box_key.sh_e_end
  1123. ;äã­ªæ¨ï ¤«ï ®¡à ¡®âª¨ shift ¯à¨ ­ ¦ â¨¨ home and end
  1124. edit_box_key.sh_home_end:
  1125.         mov     ebp,ed_color
  1126.         call    edit_box.clear_cursor
  1127.         test    word ed_flags,ed_shift_bac
  1128.         je      @f
  1129.         mov     ebp,ed_color
  1130.         movzx   ebx, word ed_shift_pos_old
  1131.         call    edit_box_key.sh_cl_
  1132. @@:
  1133.         test    word ed_flags,ed_shift
  1134.         je      edit_box_key.sh_exit_ ;¢ë©â¨
  1135.         mov     ebp,shift_color
  1136.         movzx   ebx, word ed_shift_pos
  1137.         call    edit_box_key.sh_cl_
  1138.         or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  1139.         jmp     edit_box_key.sh_e_end
  1140.  
  1141. edit_box_key.sh_exit_:
  1142.         call    edit_box.draw_bg
  1143.         jmp     edit_box.check_offset
  1144.  
  1145. ;äã­ªæ¨ï ¢­¥á¥­¨ï 0 ¯®  ¤à¥áã ed_size+1
  1146. edit_box_key.enable_null:
  1147.         pusha
  1148.         mov     eax,ed_size
  1149.         mov     ebx,ed_text
  1150.         test    eax,eax
  1151.         add     eax,ebx
  1152.         jne     @f
  1153.         inc     eax
  1154. @@:     xor     ebx,ebx
  1155.         mov     [eax],bl
  1156.         popad
  1157.         ret
  1158.  
  1159. ;- 㤠«¥­¨¥ ᨬ¢®« 
  1160. ;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
  1161. edit_box_key.del_char:
  1162.         mov     esi,ed_text
  1163.         test    word ed_flags,ed_shift_on
  1164.         je      @f
  1165.         movzx   eax, word ed_shift_pos
  1166.         mov     ebx,esi
  1167.         cmp     eax,ecx
  1168.         jae     edit_box_key.dh_n
  1169.         mov     ed_pos,eax      ;çâ®¡ë ­¥ ¡ë«® ã¡¥£ ­¨ï ªãàá®à 
  1170.         mov     ebp,ecx
  1171.         sub     ebp,eax
  1172.         add     ebx,eax  ;eax ¬¥­ìè¥
  1173.         sub     edx,ecx
  1174.         add     esi,ecx
  1175.         mov     ed_shift_pos,bp
  1176.         jmp     edit_box_key.del_ch_sh
  1177.  
  1178. edit_box_key.dh_n:
  1179.         mov     ebp,eax
  1180.         sub     ebp,ecx
  1181.         add     ebx,ecx
  1182.         sub     edx,eax
  1183.         add     esi,eax
  1184.         mov     ed_shift_pos,bp
  1185.         jmp     edit_box_key.del_ch_sh
  1186.  
  1187. @@:     add     esi,ecx ;㪠§ â¥«ì + ᬥ饭¨¥ ª ॠ«ì­®¬ã ¡ãä¥àã
  1188.         mov     ebx,esi
  1189.         inc     esi
  1190.         cld
  1191.         sub     edx,ecx
  1192. edit_box_key.del_ch_sh:
  1193.         push    edi
  1194.         mov     edi,ebx
  1195. @@:
  1196.         lodsb
  1197.         stosb
  1198.         dec     edx
  1199.         jns     @b
  1200.         pop     edi
  1201.         ret
  1202. ;¢ëç¨á«¨âì § ªà è¨¢ ¥¬ãî ®¡« áâì
  1203. ;ᮣ« è¥­¨¥ ¢ ebp - ¯¥à¥¤ ¥âáï ed_size
  1204. edit_box_key.clear_bg:
  1205.         call    edit_box.get_n  ;¯®«ãç¨âì à §¬¥à ¢ ᨬ¢®« å è¨à¨­ë ª®¬¯®­¥­â 
  1206.         push    eax
  1207.         mov     ebx,ed_offset
  1208.         add     eax,ebx ;eax = w_off= ed_offset+width
  1209.         mov     ebx,ebp ;ed_size
  1210.         cmp     eax,ebx
  1211.         jb      @f
  1212.         mov     eax,ed_pos
  1213.         sub     ebx,eax
  1214.         mov     ecx,ed_offset
  1215.         sub     eax,ecx
  1216.         jmp     edit_box_key.nxt
  1217.  
  1218. @@:     mov     ebx,ed_pos
  1219.         push    ebx
  1220.         sub     eax,ebx
  1221.         mov     ebx,eax ;It is not optimal
  1222.         pop     eax     ;ed_pos
  1223.         mov     ecx,ed_offset
  1224.         sub     eax,ecx
  1225. edit_box_key.nxt:
  1226.         mov     ebp,eax  ;¯à®¢¥àª  ­  ¢ë室 § ªà è¨¢ ¥¬®© ®¡« á⨠§  ¯à¥¤¥«ë ¤«¨­ë
  1227.         add     ebp,ebx
  1228.         pop     edx
  1229.         cmp     ebp,edx
  1230.         je      @f
  1231.         inc     ebx
  1232. @@:
  1233.         mul     dword ed_char_width
  1234.         xchg    eax,ebx
  1235.         mul     dword ed_char_width
  1236.         add     ebx,ed_left
  1237.         inc     ebx
  1238.         shl     ebx,16
  1239.         inc     eax
  1240.         mov     bx, ax
  1241.         mov     edx,ed_color
  1242.         jmp     edit_box.draw_bg_eax
  1243.  
  1244. ;;;;;;;;;;;;;;;;;;;
  1245. ;;; Ž¡à ¡®âª  ¯à¨¬¨â¨¢®¢
  1246. ;;;;;;;;;;;;;;;;;;;;
  1247. ; à¨á®¢ âì ¯àאַ㣮«ì­¨ª, 梥⠯¥à¥¤ ¥âáï ¢ ebp
  1248. ;¢å®¤­ë¥ ¯ à ¬¥âàë:
  1249. ;eax=dword ed_pos
  1250. ;ebp=-梥â ed_color or shift_color
  1251. edit_box_key.draw_rectangle:
  1252.         sub     eax,ed_offset
  1253.         mul     dword ed_char_width
  1254.         add     eax,ed_left
  1255.         inc     eax
  1256.         shl     eax,16
  1257.         add     eax,ed_char_width
  1258.         mov     ebx,eax
  1259.         mov     edx,ebp
  1260.         jmp     edit_box.draw_bg_eax
  1261.  
  1262. ;;;;;;;;;;;;;;;;;;
  1263. ;;à®¢¥àª  ­ ¦ â «¨ shift
  1264. ;;;;;;;;;;;;;;;;;;
  1265. edit_box_key.check_shift_ctrl_alt:
  1266.         pusha
  1267.         mcall   SF_KEYBOARD,SSF_GET_CONTROL_KEYS
  1268.         test    al,11b
  1269.         je      @f
  1270.         or      word ed_flags,ed_shift   ;ãáâ ­®¢¨¬ ä« £ Shift
  1271. @@:
  1272.         and     word ed_flags,ed_ctrl_off ; ®ç¨á⨬ ä« £ Ctrl
  1273.         test    al,1100b
  1274.         je      @f
  1275.         or      word ed_flags,ed_ctrl_on   ;ãáâ ­®¢¨¬ ä« £ Ctrl
  1276. @@:
  1277.         and     word ed_flags,ed_alt_off ; ®ç¨á⨬ ä« £ Alt
  1278.         test    al,110000b
  1279.         je      @f
  1280.         or      word ed_flags,ed_alt_on   ;ãáâ ­®¢¨¬ ä« £ Alt
  1281. @@:
  1282.         popad
  1283.         ret
  1284.  
  1285. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1286. ;”㭪樨 ¤«ï à ¡®âë á mouse
  1287. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1288. edit_box_mouse.mouse_wigwag:
  1289.         push    eax
  1290.         call    edit_box.draw_bg
  1291.         call    edit_box.draw_shift
  1292.         pop     eax
  1293.         or      word ed_flags,ed_shift_bac+ed_shift_on+ed_shift
  1294. ;Ž¡à ¡®âª  ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ª®£¤  ¯à®¨á室¨â ¢ë室 §  ¯à¥¤¥«ë editbox
  1295.         test    eax,eax
  1296.         js      edit_box_mouse.mleft
  1297.         shr     eax,16
  1298.         sub     eax,ed_left
  1299.         jc      edit_box_mouse.mleft
  1300.         cmp     ed_width,eax
  1301.         jc      edit_box_mouse.mright
  1302.         xor     edx,edx
  1303.         div     word ed_char_width
  1304. ;Ž¡à ¡®âª  ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ¢ ¯à¥¤¥« å ®¡« á⨠editbox
  1305. ;®«ã稫¨ ª®®à¤¨­ âë ¢ eax ¬ë誨, â.¥. ªã¤  ®­  ¯¥à¥¬¥á⨫ áì
  1306. ;¨á®¢ ­¨¥ § ªà è¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ¨å ®ç¨á⪠
  1307.         add     eax,ed_offset
  1308.         cmp     eax,ed_size
  1309.         ja      edit_box_mouse.mwigvag
  1310. edit_box_mouse.mdraw:
  1311.         mov     ed_pos,eax
  1312. ;¨á®¢ ­¨¥ § ªà è¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ¨å ®ç¨á⪠
  1313.         movzx   ecx, word ed_shift_pos
  1314.         movzx   ebx, word ed_shift_pos_old
  1315.         mov     ed_shift_pos_old,ax
  1316. ;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­­ëå ®¡« á⥩
  1317.         cmp     ecx,ebx
  1318.         je      edit_box_mouse.m1_shem  ;¤¢¨¦¥­¨ï ­¥ ¡ë«® à ­¥¥
  1319.         jb      edit_box_mouse.msmaller ;¡ë«® ¤¢¨¦¥­¨¥ ->
  1320.         cmp     ebx,eax
  1321.         ja      edit_box_mouse.m1_shem  ;¡ë«® ¤¢¨¦¥­¨¥ <-
  1322.         je      edit_box_mouse.mwigvag
  1323.         mov     ebp,ed_color
  1324.         call    edit_box_key.sh_cl_     ;®ç¨áâ¨âì ®¡« áâì c ed_pos ed_shift_pos_old
  1325.         jmp     edit_box_mouse.mwigvag
  1326.  
  1327. edit_box_mouse.msmaller:
  1328.         cmp     ebx,eax
  1329.         jb      edit_box_mouse.m1_shem
  1330.         mov     ebp,ed_color
  1331.         call    edit_box_key.sh_cl_
  1332.         jmp     edit_box_mouse.mwigvag
  1333.  
  1334. edit_box_mouse.m1_shem:
  1335.         mov     ebp,shift_color
  1336.         mov     ebx,ecx
  1337.         call    edit_box_key.sh_cl_
  1338. edit_box_mouse.mwigvag:
  1339.         and     word ed_flags,ed_shift_mcl
  1340.         jmp     edit_box.draw_cursor_text
  1341.  
  1342. edit_box_mouse.mleft:
  1343.         mov     eax,ed_pos
  1344.         cmp     eax,0
  1345.         jbe     edit_box_mouse.mwigvag
  1346.         dec     eax
  1347.         call    edit_box.check_offset
  1348.         push    eax
  1349.         movzx   ebx, word ed_shift_pos
  1350.         mov     ebp,shift_color
  1351.         call    edit_box_key.sh_cl_
  1352.         pop     eax
  1353.         jmp     edit_box_mouse.mdraw
  1354.  
  1355. edit_box_mouse.mright:
  1356.         mov     eax,ed_pos
  1357.         mov     ebx,ed_size
  1358.         cmp     eax,ebx
  1359.         jae     edit_box_mouse.mwigvag
  1360.         inc     eax
  1361.         call    edit_box.check_offset
  1362.         movzx   ebx, word ed_shift_pos
  1363.         mov     ebp,shift_color
  1364.         push    eax
  1365.         call    edit_box_key.sh_cl_
  1366.         pop     eax
  1367.         jmp     edit_box_mouse.mdraw
  1368.  
  1369.  
  1370. ed_struc_size=84
  1371.