Subversion Repositories Kolibri OS

Rev

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

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