Subversion Repositories Kolibri OS

Rev

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

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