Subversion Repositories Kolibri OS

Rev

Rev 439 | Blame | Last modification | View Log | Download | RSS feed

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