Subversion Repositories Kolibri OS

Rev

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

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