Subversion Repositories Kolibri OS

Rev

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