Subversion Repositories Kolibri OS

Rev

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

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