Subversion Repositories Kolibri OS

Rev

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

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;Basic macros for use editbox                             ;
  3. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4.  
  5. macro use_editbox_draw
  6. {
  7. edit_box:
  8. .draw:
  9.         pushad
  10.         mov     edi,[esp+36]
  11.         and     dword ed_text_color,17FFFFFFh
  12.         mov     ecx,ed_text_color
  13.         mov     ebx,ecx
  14.         shr     ecx,28
  15.         shl     ebx,4
  16.         shr     ebx,28
  17.         inc     ebx
  18.         mov     eax,6
  19.         jecxz   @f
  20.         mov     al, 8
  21. @@:
  22.         mul     bl
  23.         mov     ed_char_width,eax
  24.         mov     al, 9
  25.         jecxz   @f
  26.         mov     al, 16
  27. @@:
  28.         mul     bl
  29.         add     eax,4
  30.         mov     ed_height,eax
  31.         call    .draw_border
  32. .draw_bg_cursor_text:
  33.         call    .check_offset
  34.         call    .draw_bg
  35.         call    .draw_shift
  36. .draw_cursor_text:
  37.         call    .draw_text
  38.         test    word ed_flags,ed_focus
  39.         jz      .editbox_exit
  40.         call    .draw_cursor
  41. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  42. ;Ž¡é¨© ¢ë室 ¨§ editbox ¤«ï ¢á¥å ä㭪権 ¨ ¯®áâ ®¡à ¡®â稪®¢;;
  43. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  44. .editbox_exit:
  45.         popad
  46.         ret 4
  47. }
  48.  
  49. macro use_editbox_key
  50. {
  51. ;==========================================================
  52. ;=== ®¡à ¡®âª  ª« ¢¨ âãàë =================================
  53. ;==========================================================
  54. edit_box_key:
  55.         pushad
  56.         mov     edi,[esp+36]
  57.         test    word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
  58.         jz      edit_box.editbox_exit
  59.         test    word ed_flags,ed_mouse_on or ed_disabled
  60.         jnz     edit_box.editbox_exit
  61. ;--------------------------------------
  62. ; this code for Win-keys, works with
  63. ; kernel SVN r.3356 or later
  64.         push    eax
  65.         push    ebx
  66.         mcall   66,3
  67.         test    ax,0x200        ; LWin
  68.         jnz     .win_key_pressed
  69.         test    ax,0x400        ; RWin
  70.         jz      @f
  71. .win_key_pressed:
  72.         pop     ebx
  73.         pop     eax
  74.         jmp     edit_box.editbox_exit
  75.  
  76. @@:     pop     ebx
  77.         pop     eax
  78. ;--------------------------------------
  79. ;à®¢¥àª  ­ ¦ â shift ?
  80.         call    edit_box_key.check_shift_ctrl_alt
  81. ;----------------------------------------------------------
  82. ;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
  83. ;----------------------------------------------------------
  84.         cmp     ah,8
  85.         jz      edit_box_key.backspace
  86.         cmp     ah,0xb6
  87.         jz      edit_box_key.delete
  88.         cmp     ah,176
  89.         jz      edit_box_key.left
  90.         cmp     ah,179
  91.         jz      edit_box_key.right
  92.         cmp     ah,180
  93.         jz      edit_box_key.home
  94.         cmp     ah,181
  95.         jz      edit_box_key.end
  96.         cmp     ah,185  ;insert
  97.         jz      edit_box_key.insert
  98. ; ª®¬¡¨­ æ¨¨ Ctrl + ª« ¢¨è 
  99.         test    word ed_flags,ed_ctrl_on
  100.         jz      @f
  101. ; ¯à®¢¥àª  ᪠­ª®¤ 
  102.         ror     eax,8
  103.         cmp     ah,46 ; Ctrl + C
  104.         je      edit_box_key.ctrl_c
  105.         cmp     ah,47 ; Ctrl + V
  106.         je      edit_box_key.ctrl_v
  107.         rol     eax,8
  108. @@:
  109. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  110. ;‡ £«ã誠 ­  ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢­¨§ â.¥. ¯à¨ ®¡­ à㦥­¨¨ íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪 
  111. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  112. use_key_no_process   up,down,esc,enter,tab,numl,capsl,scrolll
  113. ;--- ­ ¦ â  ¤àã£ ï ª« ¢¨è  ---
  114. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  115. ;à®¢¥àª  ãáâ ­®¢«¥­ «¨ ä« £ ¯à¨ ª®â®à®¬ ­ã¦­® ¢ë¢®¤¨âì ⮫쪮 æ¨äàë ¢ ­ã¦­®¬ ¡®ªá¥, ¥á«¨ â ª®© ­¥®¡å®¤¨¬®á⨠­¥â, ­ã¦­® § ª®¬¥­â¨à®¢ âì ¬ ªà®á
  116. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  117. use_key_figures_only
  118. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  119. ;¯à®¢¥àª  ­  shift, ¡ë« «¨ ­ ¦ â
  120. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  121. are_key_shift_press
  122. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  123. ; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥ + ¤ «ì­¥©è ï ®¡à ¡®âª 
  124. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  125. are_key_cur_end
  126. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  127. ;Ž¡à ¡®âª  ª« ¢¨è insert,delete.backspace,home,end,left,right
  128. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  129. use_work_key
  130. }
  131.  
  132. macro use_editbox_mouse
  133. {
  134. ;==========================================================
  135. ;=== ®¡à ¡®âª  ¬ëè¨ =======================================
  136. ;==========================================================
  137. ;save for stdcall ebx,esi,edi,ebp
  138. edit_box_mouse:
  139.         pushad
  140.         mov     edi,[esp+36]
  141.         test    word ed_flags,ed_disabled
  142.         jnz     edit_box.editbox_exit
  143. ;debug
  144. ;----------------------------------------------------------
  145. ;--- ¯®«ãç ¥¬ á®áâ®ï­¨¥ ª­®¯®ª ¬ëè¨ -----------------------
  146. ;----------------------------------------------------------
  147.         mcall   37,2
  148. ;----------------------------------------------------------
  149. ;--- ¯à®¢¥à塞 á®áâ®ï­¨¥ ----------------------------------
  150. ;----------------------------------------------------------
  151.         test    eax,1
  152.         jnz     edit_box_mouse.mouse_left_button
  153.         and     word ed_flags,ed_mouse_on_off
  154.         mov     ebx,ed_mouse_variable
  155.         push    0
  156.         pop     dword [ebx]
  157.         jmp     edit_box.editbox_exit
  158.  
  159. .mouse_left_button:
  160. ;----------------------------------------------------------
  161. ;--- ¡«®ª¨à®¢ª  ®â 䮪ãá¨à®¢ª¨ ¢ ¤àã£¨å ¡®ªá å ¯à¨ ¯®¯ ¤ ­¨¨ ­  ­¨å ªãàá®à 
  162. ;----------------------------------------------------------
  163.         mov     eax,ed_mouse_variable
  164.         push    dword [eax]
  165.         pop     eax
  166.         test    eax,eax
  167.         jz      @f
  168.         cmp     eax,edi
  169.         je      @f
  170.         jmp     edit_box_mouse._blur
  171. ;----------------------------------------------------------
  172. ;--- ¯®«ãç ¥¬ ª®®à¤¨­ âë ¬ëè¨ ®â­®á¨â¥«ì­® 0 â.¥ ¢á¥© ®¡« á⨠íªà ­ 
  173. ;----------------------------------------------------------
  174. @@:     mcall   37,1
  175. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  176. ;”ã­ªæ¨ï ®¡à ¡®âª¨  ¬ë誨 ¯®«ã祭¨¥ ª®®à¤¨­ â ¨ ¯à®¢¥àª  ¨å + ¢ë¤¥«¥­¨ï
  177. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  178. use_work_mouse
  179. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  180. ;Ž¡é¨¥ ä㭪樨 ®¡à ¡®âª¨
  181. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  182. use_general_func
  183. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  184. ;”㭪樨 ¤«ï à ¡®âë á key
  185. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  186. use_key_func
  187. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  188. ;”㭪樨 ¤«ï à ¡®âë á mouse
  189. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  190. use_mouse_func
  191. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  192. ;Bit mask from editbox
  193. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  194. }
  195.  
  196. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  197. ;­¨¦¥ à á¯®«®¦¥­ë ä㭪樨 ª®â®à묨 ॠ«¨§ã¥âáï ¢¥áì  «£®à¨â¬
  198. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  199. ;Œ ªà®á ¤«ï ¢ë¢®¤  ®á­®¢­ëå ä㭪権 ª®â®àë¥ ¨á¯®«ì§ãîâáï ¡®ªá®¬
  200. macro use_general_func
  201. {
  202. ;debug_func
  203. ;----------------------------------------------------------
  204. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ¢ë¤¥«¥­­®© ç á⨠----------------
  205. ;----------------------------------------------------------
  206. edit_box.draw_shift:
  207.         test    word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  208.         jz      @f
  209.         mov     ebp,shift_color
  210.         mov     ebx,ed_shift_pos
  211.         call    edit_box_key.sh_cl_
  212. @@:     ret
  213. ;----------------------------------------------------------
  214. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ⥪áâ  --------------------------
  215. ;----------------------------------------------------------
  216. edit_box.draw_text:
  217.         call    edit_box.get_n
  218.         mov     esi,ed_size
  219.         sub     esi,ed_offset
  220.         cmp     eax,esi
  221.         jae     @f
  222.         mov     esi,eax
  223. @@:
  224.         test    esi,esi
  225.         jz      @f
  226.         mov     eax,4
  227.         mov     ebx,ed_left
  228.         add     ebx,2
  229.         shl     ebx,16
  230.         add     ebx,ed_top
  231.         add     ebx,3
  232.         mov     ecx,ed_text_color
  233.         test    dword ed_flags,ed_pass
  234.         jnz     .password
  235.         mov     edx,ed_text
  236.         add     edx,ed_offset
  237.         mcall
  238. @@:
  239.         ret
  240.  
  241. .password:
  242.         mov     ebp,esi
  243.         mov     esi,1
  244.         mov     edx,txt_pass
  245. @@:
  246.         mcall
  247.         rol     ebx,16
  248.         add     ebx,ed_char_width
  249.         rol     ebx,16
  250.         dec     ebp
  251.         jnz     @b
  252.         ret
  253.  
  254. txt_pass db '*'
  255. ;----------------------------------------------------------
  256. ;--- ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ ä®­  ----------------------------
  257. ;----------------------------------------------------------
  258. edit_box.draw_bg:
  259.         mov     ebx,ed_left
  260.         inc     ebx
  261.         shl     ebx,16
  262.         add     ebx,ed_width
  263.         dec     ebx
  264.         mov     edx,ed_color
  265.         test    word ed_flags, ed_disabled
  266.         jz      edit_box.draw_bg_eax
  267.         mov     edx, 0xCACACA   ; TODO: add disabled_color field to editbox struct
  268. edit_box.draw_bg_eax:
  269.         mov     ecx,ed_top
  270.         inc     ecx
  271.         shl     ecx,16
  272.         add     ecx,ed_height
  273.         mcall   13
  274.         ret
  275.  
  276. ;----------------------------------------------------------
  277. ;--- ¯à®æ¥¤ãà  ¯®«ã祭¨ï ª®«¨ç¥á⢠ ᨬ¢®«®¢ ¢ ⥪ã饩 è¨à¨­¥ ª®¬¯®­¥­â 
  278. ;----------------------------------------------------------
  279. edit_box.get_n:
  280.         mov     eax,ed_width
  281.         sub     eax,4
  282.         xor     edx,edx
  283.         div     word ed_char_width
  284.         ret
  285.  
  286. ;----------------------------------------------------------
  287. ;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï ªãàá®à  --------------------------
  288. ;----------------------------------------------------------
  289. ;¢å®¤­ë¥ ebp- 梥â
  290. edit_box.clear_cursor:
  291.         mov     edx,ebp
  292.         mov     ebx,cl_curs_x
  293.         mov     ecx,cl_curs_y
  294.         jmp     edit_box.draw_curs
  295.  
  296. edit_box.draw_cursor:
  297.         mov     eax,ed_pos
  298.         sub     eax,ed_offset
  299.         mul     dword ed_char_width
  300.         mov     ebx,eax
  301.         add     ebx,ed_left
  302.         inc     ebx
  303.         mov     edx,ebx
  304.         shl     ebx,16
  305.         add     ebx,edx
  306.         mov     ecx,ed_top
  307.         add     ecx,2
  308.         mov     edx,ecx
  309.         shl     ecx,16
  310.         add     ecx,edx
  311.         add     ecx,ed_height
  312.         sub     ecx,3
  313.         mov     cl_curs_x,ebx
  314.         mov     cl_curs_y,ecx
  315.         mov     edx,ed_text_color
  316. edit_box.draw_curs:
  317.         mcall   38
  318.         ret
  319.  
  320. ;----------------------------------------------------------
  321. ;--- ¯à®æ¥¤ãà  à¨á®¢ ­¨ï à ¬ª¨ ----------------------------
  322. ;----------------------------------------------------------
  323. edit_box.draw_border:
  324.         test    word ed_flags,ed_focus
  325.         mov     edx,ed_focus_border_color
  326.         jne     @f
  327.         mov     edx,ed_blur_border_color
  328. @@:
  329.         mov     ebx,ed_left
  330.         mov     ecx,ebx
  331.         shl     ebx,16
  332.         add     ebx,ecx
  333.         add     ebx,ed_width
  334.         mov     ecx,ed_top
  335.         mov     esi,ecx
  336.         shl     ecx,16
  337.         add     ecx,esi
  338.         mcall   38  ; top
  339.         mov     esi,ecx
  340.         inc     ecx
  341.         add     ecx,ed_height
  342.         mov     ebp,ecx
  343.         shl     ecx,16
  344.         mov     cx,bp
  345.         mcall   ; bottom
  346.         mov     cx,si
  347.         mov     ebp,ebx
  348.         sub     ebx,ed_width
  349.         mcall   ; left
  350.         mov     ebx,ebp
  351.         shl     ebx,16
  352.         mov     bx,bp
  353.         mcall   ; right
  354.         ret
  355.  
  356. ;----------------------------------------------------------
  357. ;--- ¯à®¢¥àª , § è¥« «¨ ªãàá®à §  £à ­¨æë ¨, ¥á«¨ ­ ¤®, ---
  358. ;--- ¨§¬¥­ï¥¬ ᬥ饭¨¥ ------------------------------------
  359. ;--- ¥á«¨ ᬥ饭¨¥ ¡ë«®, ãáâ ­®¢ª  ä« £  ed_offset_cl, ¨­ ç¥,
  360. ; ¥á«¨ ­¨ç¥£® ­¥ ¨§¬¥­¨«®áì, â® ¢ëáâ ¢«¥­¨¥ ed_offset_fl
  361. ; ¢ ®¡é¥© ¡¨â®¢®© ¬ âà¨æ¥ á®áâ®ï­¨ï ª®¬¯®­¥­â®¢ word ed_flags
  362. ;----------------------------------------------------------
  363. edit_box.check_offset:
  364.         pushad
  365.         mov     ecx,ed_pos
  366.         mov     ebx,ed_offset
  367.         cmp     ebx,ecx
  368.         ja      edit_box.sub_8
  369.         push    ebx
  370.         call    edit_box.get_n
  371.         pop     ebx
  372.         mov     edx,ebx
  373.         add     edx,eax
  374.         inc     edx     ;­¥®¡å®¤¨¬® ¤«ï ­®à¬ «ì­®£® ¯®«®¦¥­¨ï ªãàá®à  ¢ ªà ©­¥© «¥¢®© ¯®§¨æ¨¨
  375.         cmp     edx,ecx
  376.         ja      @f
  377.         mov     edx,ed_size
  378.         cmp     edx,ecx
  379.         je      edit_box.add_end
  380.         sub     edx,ecx
  381.         cmp     edx,8
  382.         jbe     edit_box.add_8
  383.         add     ebx,8
  384.         jmp     edit_box.chk_d
  385.  
  386. @@:     or      word ed_flags,ed_offset_fl
  387.         popad
  388.         ret
  389.  
  390. edit_box.sub_8:
  391.         test    ecx,ecx
  392.         jz      @f
  393.         sub     ebx,8   ;ebx=ed_offset
  394.         ja      edit_box.chk_d
  395. @@:
  396.         xor     ebx,ebx
  397.         jmp     edit_box.chk_d
  398.  
  399. edit_box.add_end:
  400.         sub     edx,eax
  401.         mov     ebx,edx
  402.         jmp     edit_box.chk_d
  403.  
  404. edit_box.add_8:
  405.         add     ebx,edx
  406. edit_box.chk_d:
  407.         mov     ed_offset,ebx
  408.         call    edit_box.draw_bg
  409.         and     word ed_flags,ed_offset_cl
  410.         popad
  411.         ret
  412.  
  413. proc edit_box_set_text, edit:dword, text:dword
  414.         pushad
  415.         mov     edi,[edit]
  416.         mov     ecx,ed_max
  417.         inc     ecx
  418.         mov     edi,[text]
  419.         xor     al,al
  420.         cld
  421.         repne scasb
  422.         mov     ecx,edi
  423.         mov     edi,[edit]
  424.         mov     esi,[text]
  425.         sub     ecx,esi
  426.         dec     ecx
  427.         mov     ed_size,ecx
  428.         mov     ed_pos,ecx
  429.         and     word ed_flags,ed_shift_cl
  430.         mov     edi,ed_text
  431.         repne movsb
  432.         mov     byte[edi],0
  433.         popad
  434.         ret
  435. endp
  436. }
  437.  
  438. macro use_key_func
  439. {
  440. ;Ž¡à ¡®âª  Shift ¤«ï á­ïâ¨ï ¢ë¤¥«¥­¨ï ­¥¨§¢¥áâ­®© ®¡« áâ¨
  441. edit_box_key.shift:
  442.         call    edit_box.draw_bg
  443.         test    word ed_flags,ed_shift
  444.         je      edit_box_key.f_exit
  445.         mov     ebp,shift_color
  446.         or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  447.         mov     ebx,ed_shift_pos
  448.         call    edit_box_key.sh_cl_
  449.         jmp     edit_box.draw_cursor_text
  450.  
  451. edit_box_key.f_exit:
  452.         call    edit_box.check_offset
  453.         and     word ed_flags,ed_shift_cl
  454.         call    edit_box_key.enable_null
  455.         jmp     edit_box.draw_cursor_text
  456.  
  457. edit_box_key.sh_cl_:
  458. ;®¡à ¡®âª  ®ç¨á⪨, ¯à¨ «¥¢®¬ - ¯à ¢®¬ ¤¢¨¦¥­¨¨ ¢ë¤¥«¥­¨ï
  459. ;¤«ï ®¡à ¡®âª¨ á­ïâ¨ï ¢ë¤¥«¥­¨ï
  460. ;¢å®¤­ë¥ ¯ à ¬¥âàë ebp=color ebx=ed_shift_pos
  461.         mov     eax,ed_pos
  462.         cmp     eax,ebx
  463.         jae     edit_box_key.sh_n
  464.         push    eax  ;¬¥­ì襥 ¢ eax
  465.         push    ebx  ;¡®«ì襥
  466.         jmp     edit_box_key.sh_n1
  467.  
  468. edit_box_key.sh_n:
  469.         push    ebx
  470.         push    eax
  471. edit_box_key.sh_n1:
  472.         call    edit_box.check_offset
  473.         call    edit_box.get_n
  474.         mov     edx,eax ;size of ed_box
  475.         mov     ecx,ed_offset
  476.         add     eax,ecx ;eax = w_off= ed_offset+width
  477.         mov     edx,eax ;save
  478.         pop     ebx     ;¡®«ì襥
  479.         pop     eax     ;¬¥­ì襥
  480.         cmp     eax,ecx         ;áà ¢­¥­¨¥ ¬¥­ì襣® á offset.
  481.         jae     edit_box_key.f_f            ;¥á«¨ ¡®«ìè¥
  482.         xor     eax,eax
  483.         cmp     edx,ebx         ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
  484.         jnb     @f
  485.         mov     ebx,edx
  486. @@:
  487.         sub     ebx,ecx
  488.         jmp     edit_box_key.nxt_f
  489.  
  490. edit_box_key.f_f:
  491.         sub     eax,ecx
  492.         cmp     edx,ebx         ;cà ¢­¨¬ à §¬¥à w_off á ¡®«ì訬
  493.         jle     @f
  494.         sub     ebx,ecx
  495.         sub     ebx,eax
  496.         jmp     edit_box_key.nxt_f
  497.  
  498. @@:     mov     ebx,edx
  499.         sub     ebx,ecx
  500.         sub     ebx,eax
  501. edit_box_key.nxt_f:
  502.         mul     dword ed_char_width
  503.         xchg    eax,ebx
  504.         mul     dword ed_char_width
  505.         add     ebx,ed_left
  506.         inc     ebx
  507.         shl     ebx,16
  508.         inc     eax
  509.         mov     bx, ax
  510.         mov     edx,ebp ;shift_color
  511.         call    edit_box.draw_bg_eax
  512.         jmp     edit_box_key.enable_null
  513.  
  514. ;“áâ ­®¢ª - á­ï⨥ ¢ë¤¥«¥­¨ï ¢ ®¤¨­ ᨬ¢®«
  515. edit_box_key.drw_sim:
  516.         mov     eax,ed_pos
  517.         call    edit_box_key.draw_rectangle
  518.         jmp     edit_box_key.enable_null
  519.  
  520. ;”ã­ªæ¨ï ãáâ ­®¢ª¨ ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨¨ ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
  521. edit_box_key.draw_wigwag:
  522.         mov     ebp,shift_color
  523.         call    edit_box.clear_cursor
  524.         or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £  ¢ë¤¥«¥­­®© ®¡« áâ¨
  525.         mov     ebp,shift_color
  526.         mov     eax,ed_pos
  527.         test    word ed_flags,ed_left_fl
  528.         jnz     edit_box_key.draw_rectangle
  529.         dec     eax
  530.         jmp     edit_box_key.draw_rectangle
  531.  
  532. ;”ã­ªæ¨ï 㤠«¥­¨ï ¢ë¤¥«¥­¨ï ¯à¨ ¤¢¨¦¥­¨¨ ¢«¥¢® ¨ ¢¯à ¢® ¨ ­ ¦ â¨¨ shift
  533. edit_box_key.draw_wigwag_cl:
  534.         mov     ebp,ed_color
  535.         call    edit_box.clear_cursor
  536.         mov     ebp,ed_color
  537.         mov     eax,ed_pos
  538.         test    word ed_flags,ed_left_fl
  539.         jnz     edit_box_key.draw_rectangle
  540.         dec     eax
  541.         jmp     edit_box_key.draw_rectangle
  542.  
  543. ;¢å®¤­®© ¯ à ¬¥âà ebx - ed_pos
  544. edit_box_key.sh_first_sh:
  545.         test    word ed_flags,ed_shift
  546.         je      @f
  547.         mov     ed_shift_pos_old,ebx
  548.         test    word ed_flags,ed_shift_on
  549.         jne     @f
  550.         mov     ed_shift_pos,ebx
  551.         or      word ed_flags,ed_shift_on
  552. @@:     ret
  553. ;Ž¡à ¡®âª  ªà ©­¨å ¯®«®¦¥­¨© ¢ editbox ¯à¨ ­ ¦ â®¬ shift
  554. ;¯à®¨§¢®¤¨â á­ï⨥ ¢ë¤¥«¥­¨ï, ¥á«¨ ­¥â shift
  555. ;¨­ ç¥ ¢®®¡é¥ ¢ë室¨â
  556. edit_box_key.sh_st_of:
  557.         test    word ed_flags,ed_shift
  558.         jne     @f
  559.         test    word ed_flags,ed_shift_bac
  560.         je      @f
  561.         call    edit_box.draw_bg
  562.         mov     ebp,ed_color
  563.         mov     ebx,ed_shift_pos
  564.         call    edit_box_key.sh_cl_  ;®ç¨á⪠ ¢ë¤¥«¥­®£® äà £¬¥­â 
  565.         and     word ed_flags,ed_shift_cl ; ®ç¨á⪠ ®â ⮣®, çâ® ã¡à «¨ ¢ë¤¥«¥­¨¥
  566.         jmp     edit_box.draw_cursor_text
  567.  
  568. @@:     and     word ed_flags,ed_shift_off
  569.         popad
  570.         ret     4
  571. ;¯à®¢¥àª  á®áâ®ï­¨ï shift, ¡ë« «¨ ®­ ­ ¦ â à ­ìè¥?
  572. edit_box_key.sh_enable:
  573.         test    word ed_flags,ed_shift
  574.         jne     edit_box_key.sh_ext_en ;­ à¨á®¢ âì § ªà è¥­­ë© ¯àאַ㣮«ì­¨ª
  575.         test    word ed_flags,ed_shift_bac
  576.         je      @f
  577.         call    edit_box.check_offset
  578.         mov     ebp,ed_color
  579.         mov     ebx,ed_shift_pos
  580.         call    edit_box_key.sh_cl_  ;®ç¨á⪠ ¢ë¤¥«¥­­®£® äà £¬¥­â 
  581.         call    edit_box_key.draw_wigwag_cl
  582.         and     word ed_flags,ed_shift_cl ; 1¢ à ­¥ ­ã¦­®
  583.         ret
  584.  
  585. @@:     mov     ebp,ed_color
  586.         call    edit_box.clear_cursor
  587.         jmp     edit_box.check_offset
  588.  
  589. edit_box_key.sh_ext_en:
  590.         call    edit_box.check_offset
  591.         test    word ed_flags,ed_offset_fl
  592.         je      @f
  593. ;¨á®¢ ­¨¥ § ªà è¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ¨å ®ç¨á⪠
  594.         mov     eax,ed_shift_pos
  595.         mov     ebx,ed_pos
  596.         mov     ecx,ed_shift_pos_old
  597. ;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­­ëå ®¡« á⥩
  598.         cmp     eax,ecx
  599.         je      edit_box_key.1_shem
  600.         jb      edit_box_key.smaller
  601.         cmp     ecx,ebx
  602.         ja      edit_box_key.1_shem
  603.         call    edit_box_key.draw_wigwag_cl ;clear
  604.         jmp     edit_box_key.sh_e_end
  605.  
  606. edit_box_key.smaller:
  607.         cmp     ecx,ebx
  608.         jb      edit_box_key.1_shem
  609.         call    edit_box_key.draw_wigwag_cl ;clear
  610.         jmp     edit_box_key.sh_e_end
  611.  
  612. edit_box_key.1_shem:
  613.         call    edit_box_key.draw_wigwag
  614. edit_box_key.sh_e_end:
  615.         and     word ed_flags,ed_shift_off
  616.         ret
  617.  
  618. @@:     mov     ebp,shift_color
  619.         mov     ebx,ed_shift_pos
  620.         call    edit_box_key.sh_cl_
  621.         jmp     edit_box_key.sh_e_end
  622. ;äã­ªæ¨ï ¤«ï ®¡à ¡®âª¨ shift ¯à¨ ­ ¦ â¨¨ home and end
  623. edit_box_key.sh_home_end:
  624.         mov     ebp,ed_color
  625.         call    edit_box.clear_cursor
  626.         test    word ed_flags,ed_shift_bac
  627.         je      @f
  628.         mov     ebp,ed_color
  629.         mov     ebx,ed_shift_pos_old
  630.         call    edit_box_key.sh_cl_
  631. @@:
  632.         test    word ed_flags,ed_shift
  633.         je      edit_box_key.sh_exit_ ;¢ë©â¨
  634.         mov     ebp,shift_color
  635.         mov     ebx,ed_shift_pos
  636.         call    edit_box_key.sh_cl_
  637.         or      word ed_flags,ed_shift_bac ;ãáâ ­®¢ª  ä« £ , ¢ë¤¥«¥­­®© ®¡« áâ¨
  638.         jmp     edit_box_key.sh_e_end
  639.  
  640. edit_box_key.sh_exit_:
  641.         call    edit_box.draw_bg
  642.         jmp     edit_box.check_offset
  643.  
  644. ;äã­ªæ¨ï ¢­¥á¥­¨ï 0 ¯®  ¤à¥áã ed_size+1
  645. edit_box_key.enable_null:
  646.         pusha
  647.         mov     eax,ed_size
  648.         mov     ebx,ed_text
  649.         test    eax,eax
  650.         add     eax,ebx
  651.         jne     @f
  652.         inc     eax
  653. @@:     xor     ebx,ebx
  654.         mov     [eax],bl
  655.         popad
  656.         ret
  657.  
  658. ;- 㤠«¥­¨¥ ᨬ¢®« 
  659. ;‚室­ë¥ ¤ ­­ë¥ edx=ed_size;ecx=ed_pos
  660. edit_box_key.del_char:
  661.         mov     esi,ed_text
  662.         test    word ed_flags,ed_shift_on
  663.         je      @f
  664.         mov     eax,ed_shift_pos
  665.         mov     ebx,esi
  666.         cmp     eax,ecx
  667.         jae     edit_box_key.dh_n
  668.         mov     ed_pos,eax      ;çâ®¡ë ­¥ ¡ë«® ã¡¥£ ­¨ï ªãàá®à 
  669.         mov     ebp,ecx
  670.         sub     ebp,eax
  671.         add     ebx,eax  ;eax ¬¥­ìè¥
  672.         sub     edx,ecx
  673.         add     esi,ecx
  674.         mov     ed_shift_pos,ebp
  675.         jmp     edit_box_key.del_ch_sh
  676.  
  677. edit_box_key.dh_n:
  678.         mov     ebp,eax
  679.         sub     ebp,ecx
  680.         add     ebx,ecx
  681.         sub     edx,eax
  682.         add     esi,eax
  683.         mov     ed_shift_pos,ebp
  684.         jmp     edit_box_key.del_ch_sh
  685.  
  686. @@:     add     esi,ecx ;㪠§ â¥«ì + ᬥ饭¨¥ ª ॠ«ì­®¬ã ¡ãä¥àã
  687.         mov     ebx,esi
  688.         inc     esi
  689.         cld
  690.         sub     edx,ecx
  691. edit_box_key.del_ch_sh:
  692.         push    edi
  693.         mov     edi,ebx
  694. @@:
  695.         lodsb
  696.         stosb
  697.         dec     edx
  698.         jns     @b
  699.         pop     edi
  700.         ret
  701. ;¢ëç¨á«¨âì § ªà è¨¢ ¥¬ãî ®¡« áâì
  702. ;ᮣ« è¥­¨¥ ¢ ebp - ¯¥à¥¤ ¥âáï ed_size
  703. edit_box_key.clear_bg:
  704.         call    edit_box.get_n  ;¯®«ãç¨âì à §¬¥à ¢ ᨬ¢®« å è¨à¨­ë ª®¬¯®­¥­â 
  705.         push    eax
  706.         mov     ebx,ed_offset
  707.         add     eax,ebx ;eax = w_off= ed_offset+width
  708.         mov     ebx,ebp ;ed_size
  709.         cmp     eax,ebx
  710.         jb      @f
  711.         mov     eax,ed_pos
  712.         sub     ebx,eax
  713.         mov     ecx,ed_offset
  714.         sub     eax,ecx
  715.         jmp     edit_box_key.nxt
  716.  
  717. @@:     mov     ebx,ed_pos
  718.         push    ebx
  719.         sub     eax,ebx
  720.         mov     ebx,eax ;It is not optimal
  721.         pop     eax     ;ed_pos
  722.         mov     ecx,ed_offset
  723.         sub     eax,ecx
  724. edit_box_key.nxt:
  725.         mov     ebp,eax  ;¯à®¢¥àª  ­  ¢ë室 § ªà è¨¢ ¥¬®© ®¡« á⨠§  ¯à¥¤¥«ë ¤«¨­ë
  726.         add     ebp,ebx
  727.         pop     edx
  728.         cmp     ebp,edx
  729.         je      @f
  730.         inc     ebx
  731. @@:
  732.         mul     dword ed_char_width
  733.         xchg    eax,ebx
  734.         mul     dword ed_char_width
  735.         add     ebx,ed_left
  736.         inc     ebx
  737.         shl     ebx,16
  738.         inc     eax
  739.         mov     bx, ax
  740.         mov     edx,ed_color
  741.         jmp     edit_box.draw_bg_eax
  742.  
  743. ;;;;;;;;;;;;;;;;;;;
  744. ;;; Ž¡à ¡®âª  ¯à¨¬¨â¨¢®¢
  745. ;;;;;;;;;;;;;;;;;;;;
  746. ; à¨á®¢ âì ¯àאַ㣮«ì­¨ª, 梥⠯¥à¥¤ ¥âáï ¢ ebp
  747. ;¢å®¤­ë¥ ¯ à ¬¥âàë:
  748. ;eax=dword ed_pos
  749. ;ebp=-梥â ed_color or shift_color
  750. edit_box_key.draw_rectangle:
  751.         sub     eax,ed_offset
  752.         mul     dword ed_char_width
  753.         add     eax,ed_left
  754.         inc     eax
  755.         shl     eax,16
  756.         add     eax,ed_char_width
  757.         mov     ebx,eax
  758.         mov     edx,ebp
  759.         jmp     edit_box.draw_bg_eax
  760.  
  761. ;;;;;;;;;;;;;;;;;;
  762. ;;à®¢¥àª  ­ ¦ â «¨ shift
  763. ;;;;;;;;;;;;;;;;;;
  764. edit_box_key.check_shift_ctrl_alt:
  765.         pusha
  766.         mcall   66,3
  767.         test    al,11b
  768.         je      @f
  769.         or      word ed_flags,ed_shift   ;ãáâ ­®¢¨¬ ä« £ Shift
  770. @@:
  771.         and     word ed_flags,ed_ctrl_off ; ®ç¨á⨬ ä« £ Ctrl
  772.         test    al,1100b
  773.         je      @f
  774.         or      word ed_flags,ed_ctrl_on   ;ãáâ ­®¢¨¬ ä« £ Ctrl
  775. @@:
  776.         and     word ed_flags,ed_alt_off ; ®ç¨á⨬ ä« £ Alt
  777.         test    al,110000b
  778.         je      @f
  779.         or      word ed_flags,ed_alt_on   ;ãáâ ­®¢¨¬ ä« £ Alt
  780. @@:
  781.         popad
  782.         ret
  783. }
  784.  
  785. macro use_key_no_process  up,down,esc,enter,tab,numl,capsl,scrolll
  786. {
  787. if up eq
  788. else
  789.         cmp     ah,177
  790.         jz      edit_box.editbox_exit
  791. end if
  792. if down eq
  793. else
  794.         cmp     ah,178
  795.         jz      edit_box.editbox_exit
  796. end if
  797. if esc eq
  798. else
  799.         cmp     ah,27   ;ESC - ª« ¢¨è  ))
  800.         jz      edit_box.editbox_exit
  801. end if
  802. if enter eq
  803. else
  804.         cmp     ah,13   ;ENTER - ª« ¢¨è  ))
  805.         jz      edit_box.editbox_exit
  806. end if
  807. if tab eq
  808. else
  809.         cmp     ah,9   ;TAB - ª« ¢¨è  ))
  810.         jz      edit_box.editbox_exit
  811. end if
  812. if numl eq
  813. else
  814.         cmp     ah,4   ;Num Lock - ª« ¢¨è  ))
  815.         jz      edit_box.editbox_exit
  816. end if
  817. if capsl eq
  818. else
  819.         cmp     ah,2   ;Caps Lock - ª« ¢¨è  ))
  820.         jz      edit_box.editbox_exit
  821. end if
  822. if scrolll eq
  823. else
  824.         cmp     ah,1   ;Scroll Lock - ª« ¢¨è  ))
  825.         jz      edit_box.editbox_exit
  826. end if
  827. }
  828.  
  829. macro use_key_figures_only
  830. {
  831.         test    word ed_flags,ed_figure_only  ; ⮫쪮 æ¨äàë?
  832.         jz      @f
  833.         cmp     ah,'0'
  834.         jb      edit_box.editbox_exit
  835.         cmp     ah,'9'
  836.         ja      edit_box.editbox_exit
  837. @@:
  838. }
  839.  
  840. macro are_key_shift_press
  841. {
  842.         test    word ed_flags,ed_shift_on
  843.         je      @f
  844. ; edx = ed_size, ecx = ed_pos
  845.         push    eax
  846.         mov     edx,ed_size
  847.         mov     ecx, ed_pos
  848.         pusha
  849. ; clear input area
  850.         mov     ebp,ed_color
  851.         mov     ebx,ed_shift_pos
  852.         call    edit_box_key.sh_cl_
  853.         mov     ebp,ed_size
  854.         call    edit_box_key.clear_bg
  855.         popa
  856.         call    edit_box_key.del_char
  857.         mov     ebx,ed_size
  858.         sub     ebx,ed_shift_pos
  859.         mov     ed_size,ebx
  860.         pop     eax
  861. @@:
  862. }
  863.  
  864. macro are_key_cur_end
  865. {
  866.         mov     ecx,ed_size
  867.         mov     edx, ed_max
  868.         test    word ed_flags,ed_insert
  869.         jne     @f
  870.         cmp     ecx,edx
  871.         jae     edit_box.editbox_exit
  872. @@:     mov     ebx, ed_pos
  873.         cmp     ebx,edx
  874.         jnl     edit_box.editbox_exit
  875.         mov     ecx,ed_size
  876.         push    edi eax
  877.         mov     ebp,edi
  878.         mov     esi,ed_text
  879.         add     esi,ecx
  880.         mov     edi,esi
  881.         cmp     ecx,ebx
  882.         je      edit_box_key.In_k
  883.         test    dword bp_flags,ed_insert
  884.         jne     edit_box_key.ins_v
  885.         pusha
  886.         mov     edi,ebp
  887.         mov     ebp,ed_size
  888.         call    edit_box_key.clear_bg
  889.         popa
  890.         sub     ecx,ebx
  891.         inc     edi
  892.         std
  893.         inc     ecx
  894. @@:
  895.         lodsb
  896.         stosb
  897.         loop    @b
  898. edit_box_key.In_k:
  899.         cld
  900.         pop     eax
  901.         mov     al,ah
  902.         stosb
  903.         pop     edi
  904.         inc     dword ed_size
  905.         inc     dword ed_pos
  906.         call    edit_box_key.draw_all2
  907.         jmp     edit_box_key.shift
  908. }
  909.  
  910. macro use_work_key
  911. {
  912. edit_box_key.insert:
  913.         test    word ed_flags,ed_insert
  914.         je      @f
  915.         and     word ed_flags,ed_insert_cl
  916.         jmp     edit_box.editbox_exit
  917.  
  918. @@:     or      word ed_flags,ed_insert
  919.         jmp     edit_box.editbox_exit
  920.  
  921. edit_box_key.ins_v:
  922.         dec     dword bp_size
  923.         sub     esi,ecx
  924.         add     esi,ebx
  925.         mov     edi,esi
  926.         pusha
  927.         mov     edi,ebp
  928.         mov     ebp,ed_pos
  929.         call    edit_box_key.clear_bg
  930.         popa
  931.         jmp     edit_box_key.In_k
  932.  
  933. edit_box_key.delete:
  934.         mov     edx,ed_size
  935.         mov     ecx,ed_pos
  936.         cmp     edx,ecx
  937.         jg      edit_box_key.bac_del
  938.         test    word ed_flags,ed_shift_on
  939.         jne     edit_box_key.del_bac
  940.         popad
  941.         ret     4
  942.  
  943. edit_box_key.bac_del:
  944.         call    edit_box_key.del_char
  945.         jmp     edit_box_key.draw_all
  946.  
  947. edit_box_key.backspace:
  948.         test    word ed_flags,ed_shift_on
  949.         jne     edit_box_key.delete
  950.         mov     ecx,ed_pos
  951.         test    ecx,ecx
  952.         jnz     edit_box_key.del_bac
  953.         popad
  954.         ret     4
  955.  
  956. edit_box_key.del_bac:
  957.         mov     edx,ed_size
  958.         cmp     edx,ecx ;if ed_pos=ed_size
  959.         je      @f
  960.         dec     ecx
  961.         call    edit_box_key.del_char
  962. @@:     test    word ed_flags,ed_shift_on
  963.         jne     edit_box_key.bac_del
  964.         dec     dword ed_pos
  965. edit_box_key.draw_all:
  966.         push    edit_box_key.shift
  967.         test    word ed_flags,ed_shift_on
  968.         je      @f
  969.         mov     eax,ed_shift_pos
  970.         mov     ebx,ed_size
  971.         sub     ebx,eax
  972.         mov     ed_size,ebx
  973.         mov     ebp,ed_color
  974.         call    edit_box.clear_cursor
  975.         call    edit_box.check_offset
  976.         jmp     edit_box.draw_bg
  977.  
  978. @@:     dec     dword ed_size
  979. edit_box_key.draw_all2:
  980.         and     word ed_flags,ed_shift_cl
  981.         mov     ebp,ed_color
  982.         call    edit_box.clear_cursor
  983.         call    edit_box.check_offset
  984.         mov     ebp,ed_size
  985.         jmp     edit_box_key.clear_bg
  986.  
  987. ;--- ­ ¦ â  ª« ¢¨è  left ---
  988. edit_box_key.left:
  989.         mov     ebx,ed_pos
  990.         test    ebx,ebx
  991.         jz      edit_box_key.sh_st_of
  992.         or      word ed_flags,ed_left_fl
  993.         call    edit_box_key.sh_first_sh
  994.         dec     dword ed_pos
  995.         call    edit_box.draw_bg
  996.         call    edit_box.draw_shift
  997.         call    edit_box_key.sh_enable
  998.         jmp     edit_box.draw_cursor_text
  999.  
  1000. ;--- ­ ¦ â  ª« ¢¨è  right ---
  1001. edit_box_key.right:
  1002.         mov     ebx,ed_pos
  1003.         cmp     ebx,ed_size
  1004.         je      edit_box_key.sh_st_of
  1005.         and     word ed_flags,ed_right_fl
  1006.         call    edit_box_key.sh_first_sh
  1007.         inc     dword ed_pos
  1008.         call    edit_box.draw_bg
  1009.         call    edit_box.draw_shift
  1010.         call    edit_box_key.sh_enable
  1011.         jmp     edit_box.draw_cursor_text
  1012.  
  1013. edit_box_key.home:
  1014.         mov     ebx,ed_pos
  1015.         test    ebx,ebx
  1016.         jz      edit_box_key.sh_st_of
  1017.         call    edit_box_key.sh_first_sh
  1018.         xor     eax,eax
  1019.         mov     ed_pos,eax
  1020.         call    edit_box.draw_bg
  1021.         call    edit_box.draw_shift
  1022.         call    edit_box_key.sh_home_end
  1023.         jmp     edit_box.draw_cursor_text
  1024.  
  1025. ;--- ­ ¦ â  ª« ¢¨è  end ---
  1026. edit_box_key.end:
  1027.         mov     ebx,ed_pos
  1028.         cmp     ebx,ed_size
  1029.         je      edit_box_key.sh_st_of
  1030.         call    edit_box_key.sh_first_sh
  1031.         mov     eax,ed_size
  1032.         mov     ed_pos,eax
  1033.         call    edit_box.draw_bg
  1034.         call    edit_box.draw_shift
  1035.         call    edit_box_key.sh_home_end
  1036.         jmp     edit_box.draw_cursor_text
  1037.  
  1038. edit_box_key.ctrl_c:
  1039. ; add memory area
  1040.         mov     ecx,ed_size
  1041.         add     ecx,3*4
  1042.         mcall   68,12
  1043. ; building the clipboard slot header
  1044.         xor     ecx,ecx
  1045.         mov     [eax+4],ecx ; type 'text'
  1046.         inc     ecx
  1047.         mov     [eax+8],ecx ; cp866 text encoding
  1048.         mov     ecx,ed_size
  1049.         add     ecx,3*4
  1050.         mov     [eax],ecx
  1051.         sub     ecx,3*4
  1052. ; copy data
  1053.         mov     esi,ed_text
  1054.         push    edi
  1055.         mov     edi,eax
  1056.         add     edi,3*4
  1057.         cld
  1058.         rep     movsb
  1059.         pop     edi
  1060. ; put slot to the kernel clipboard
  1061.         mov     edx,eax
  1062.         mov     ecx,[edx]
  1063.         push    eax
  1064.         mcall   54,2
  1065.         pop     ecx
  1066. ; remove unnecessary memory area
  1067.         mcall   68,13
  1068. .exit:
  1069.         jmp     edit_box.editbox_exit
  1070.  
  1071. edit_box_key.ctrl_v:
  1072.         mcall   54,0
  1073. ; no slots of clipboard ?
  1074.         test    eax,eax
  1075.         jz      .exit
  1076. ; main list area not found ?
  1077.         inc     eax
  1078.         test    eax,eax
  1079.         jz      .exit
  1080.         sub     eax,2
  1081.         mov     ecx,eax
  1082.         mcall   54,1
  1083. ; main list area not found ?
  1084.         inc     eax
  1085.         test    eax,eax
  1086.         jz      .exit
  1087. ; error ?
  1088.         sub     eax,2
  1089.         test    eax,eax
  1090.         jz      .exit
  1091.         inc     eax
  1092. ; check contents of container
  1093.         mov     ebx,[eax+4]
  1094. ; check for text
  1095.         test    ebx,ebx
  1096.         jnz     .no_valid_text
  1097.         mov     ebx,[eax+8]
  1098. ; check for cp866
  1099.         cmp     bl,1
  1100.         jnz     .no_valid_text
  1101.         mov     ecx,[eax]
  1102.         sub     ecx,3*4
  1103.         cmp     ecx,ed_max
  1104.         jb      @f
  1105.         mov     ecx,ed_max
  1106. @@:
  1107.         mov     esi,eax
  1108.         add     esi,3*4
  1109.         mov     ed_size,ecx
  1110.         mov     ed_pos,ecx
  1111.         push    eax edi
  1112.         mov     edi,ed_text
  1113.         cld
  1114. @@:
  1115.         lodsb
  1116.         cmp     al,0x0d ; EOS (end of string)
  1117.         je      .replace
  1118.         cmp     al,0x0a ; EOS (end of string)
  1119.         jne     .continue
  1120. .replace:
  1121.         mov     al,0x20 ; space
  1122. .continue:
  1123.         stosb
  1124.         dec     ecx
  1125.         jnz     @b
  1126.         pop     edi eax
  1127. .no_valid_text:
  1128. ; remove unnecessary memory area
  1129.         mov     ecx,eax
  1130.         mcall   68,13
  1131. .exit:
  1132.         jmp     edit_box.draw_bg_cursor_text
  1133. }
  1134.  
  1135. macro use_mouse_func
  1136. {
  1137. edit_box_mouse.mouse_wigwag:
  1138.         push    eax
  1139.         call    edit_box.draw_bg
  1140.         call    edit_box.draw_shift
  1141.         pop     eax
  1142.         or      word ed_flags,ed_shift_bac+ed_shift_on+ed_shift
  1143. ;Ž¡à ¡®âª  ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ª®£¤  ¯à®¨á室¨â ¢ë室 §  ¯à¥¤¥«ë editbox
  1144.         test    eax,eax
  1145.         js      edit_box_mouse.mleft
  1146.         shr     eax,16
  1147.         sub     eax,ed_left
  1148.         jc      edit_box_mouse.mleft
  1149.         cmp     ed_width,eax
  1150.         jc      edit_box_mouse.mright
  1151.         xor     edx,edx
  1152.         div     word ed_char_width
  1153. ;Ž¡à ¡®âª  ¯®«®¦¥­¨ï ¢ë¤¥«¥­­®£® ⥪áâ , ¢ ¯à¥¤¥« å ®¡« á⨠editbox
  1154. ;®«ã稫¨ ª®®à¤¨­ âë ¢ eax ¬ë誨, â.¥. ªã¤  ®­  ¯¥à¥¬¥á⨫ áì
  1155. ;¨á®¢ ­¨¥ § ªà è¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ¨å ®ç¨á⪠
  1156.         add     eax,ed_offset
  1157.         cmp     eax,ed_size
  1158.         ja      edit_box_mouse.mwigvag
  1159. edit_box_mouse.mdraw:
  1160.         mov     ed_pos,eax
  1161. ;¨á®¢ ­¨¥ § ªà è¥­­ëå ¯àאַ㣮«ì­¨ª®¢ ¨ ¨å ®ç¨á⪠
  1162.         mov     ecx,ed_shift_pos
  1163.         mov     ebx,ed_shift_pos_old
  1164.         mov     ed_shift_pos_old,eax
  1165. ;¯à®¢¥àª  ¨ à¨á®¢ ­¨¥ § ªà è¥­­ëå ®¡« á⥩
  1166.         cmp     ecx,ebx
  1167.         je      edit_box_mouse.m1_shem  ;¤¢¨¦¥­¨ï ­¥ ¡ë«® à ­¥¥
  1168.         jb      edit_box_mouse.msmaller ;¡ë«® ¤¢¨¦¥­¨¥ ->
  1169.         cmp     ebx,eax
  1170.         ja      edit_box_mouse.m1_shem  ;¡ë«® ¤¢¨¦¥­¨¥ <-
  1171.         je      edit_box_mouse.mwigvag
  1172.         mov     ebp,ed_color
  1173.         call    edit_box_key.sh_cl_     ;®ç¨áâ¨âì ®¡« áâì c ed_pos ed_shift_pos_old
  1174.         jmp     edit_box_mouse.mwigvag
  1175.  
  1176. edit_box_mouse.msmaller:
  1177.         cmp     ebx,eax
  1178.         jb      edit_box_mouse.m1_shem
  1179.         mov     ebp,ed_color
  1180.         call    edit_box_key.sh_cl_
  1181.         jmp     edit_box_mouse.mwigvag
  1182.  
  1183. edit_box_mouse.m1_shem:
  1184.         mov     ebp,shift_color
  1185.         mov     ebx,ecx
  1186.         call    edit_box_key.sh_cl_
  1187. edit_box_mouse.mwigvag:
  1188.         and     word ed_flags,ed_shift_mcl
  1189.         jmp     edit_box.draw_cursor_text
  1190.  
  1191. edit_box_mouse.mleft:
  1192.         mov     eax,ed_pos
  1193.         cmp     eax,0
  1194.         jbe     edit_box_mouse.mwigvag
  1195.         dec     eax
  1196.         call    edit_box.check_offset
  1197.         push    eax
  1198.         mov     ebx,ed_shift_pos
  1199.         mov     ebp,shift_color
  1200.         call    edit_box_key.sh_cl_
  1201.         pop     eax
  1202.         jmp     edit_box_mouse.mdraw
  1203.  
  1204. edit_box_mouse.mright:
  1205.         mov     eax,ed_pos
  1206.         mov     ebx,ed_size
  1207.         cmp     eax,ebx
  1208.         jae     edit_box_mouse.mwigvag
  1209.         inc     eax
  1210.         call    edit_box.check_offset
  1211.         mov     ebx,ed_shift_pos
  1212.         mov     ebp,shift_color
  1213.         push    eax
  1214.         call    edit_box_key.sh_cl_
  1215.         pop     eax
  1216.         jmp     edit_box_mouse.mdraw
  1217. }
  1218.  
  1219. macro use_work_mouse
  1220. ; ¥ 㤥ন¢ ¥¬ «¨ ¬ë ª« ¢¨èã ¬ë誨, ¯¥à¥¬¥é ï ªãàá®à?
  1221. {
  1222.         test    word ed_flags,ed_mouse_on
  1223.         jne     edit_box_mouse.mouse_wigwag
  1224. ; ¯à®¢¥à塞, ¯®¯ ¤ ¥â «¨ ªãàá®à ¢ edit box
  1225.         mov     ebx,ed_top
  1226.         cmp     ax,bx
  1227.         jl      edit_box_mouse._blur
  1228.         add     ebx,ed_height
  1229.         cmp     ax,bx
  1230.         jg      edit_box_mouse._blur
  1231.         shr     eax,16
  1232.         mov     ebx,ed_left
  1233.         cmp     ax,bx
  1234.         jl      edit_box_mouse._blur
  1235.         add     ebx,ed_width
  1236.         cmp     ax,bx
  1237.         jg      edit_box_mouse._blur
  1238. ; ¨§¬¥­ï¥¬ ¯®§¨æ¨î ªãàá®à 
  1239.         push    eax
  1240.         mov     ebp,ed_color
  1241.         call    edit_box.clear_cursor
  1242.         pop     eax
  1243. edit_box_mouse._mvpos:
  1244.         xor     edx,edx
  1245.         sub     eax,ed_left
  1246.         div     word ed_char_width
  1247.         add     eax,ed_offset
  1248.         cmp     eax,ed_size
  1249.         jna     edit_box_mouse._mshift
  1250.         mov     eax,ed_size
  1251. edit_box_mouse._mshift:
  1252. ; ᥪæ¨ï ®¡à ¡®âª¨ shift ¨ ¢ë¤¥«¥­¨ï ¯® shift
  1253.         test    word ed_flags,ed_shift_bac
  1254.         je      @f
  1255.         mov     ebp,ed_color
  1256.         mov     ebx,ed_shift_pos
  1257.         push    eax
  1258.         call    edit_box_key.sh_cl_
  1259.         and     word ed_flags,ed_shift_bac_cl
  1260.         pop     eax
  1261. @@:
  1262.         test    word ed_flags,ed_mouse_on
  1263.         jne     @f
  1264.         mov     ed_shift_pos,eax
  1265.         or      word  ed_flags,ed_mouse_on
  1266.         mov     ed_pos,eax
  1267.         mov     ebx,ed_mouse_variable
  1268.         push    edi
  1269.         pop     dword [ebx]
  1270.         bts     word ed_flags,1
  1271.         call    edit_box.draw_bg
  1272.         jmp     edit_box_mouse.m_sh
  1273.  
  1274. @@:     cmp     eax,ed_shift_pos
  1275.         je      edit_box.editbox_exit
  1276.         mov     ed_pos,eax
  1277.         call    edit_box.draw_bg
  1278.         mov     ebp,shift_color
  1279.         mov     ebx,ed_shift_pos
  1280.         call    edit_box_key.sh_cl_
  1281.         or      word ed_flags,ed_mous_adn_b
  1282. edit_box_mouse.m_sh:
  1283.         call    edit_box.draw_text
  1284.         call    edit_box.draw_cursor
  1285. ; ¯à®æ¥¤ãà  ãáâ ­®¢ª¨ 䮪ãá 
  1286.         jmp     edit_box_mouse.drc
  1287.  
  1288. edit_box_mouse._blur:
  1289.         test    word ed_flags,ed_always_focus
  1290.         jne     edit_box.editbox_exit
  1291.         btr     word ed_flags,1 ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
  1292.         jnc     edit_box.editbox_exit
  1293.         mov     ebp,ed_color
  1294.         call    edit_box.clear_cursor
  1295. edit_box_mouse.drc:
  1296.         call    edit_box.draw_border
  1297.         jmp     edit_box.editbox_exit
  1298. }
  1299.  
  1300. macro debug
  1301. {
  1302.         ;-----------  ®â« ¤ª 
  1303.         pushad
  1304.         mov eax,dword [ed_buffer.2]
  1305.         mov edi,ed_buffer.3
  1306.         call .str
  1307.         ;à¨á®¢ ­¨¥ ä®­ 
  1308.         mov eax,13
  1309.         mov ebx,178*65536+70
  1310.         mov ecx,28*65536+10
  1311.         xor edx,edx
  1312.         int 0x40
  1313.         ;¢ë¢®¤ §­ ç¥­¨ï ­  íªà ­
  1314.         mov eax,4
  1315.         mov ebx,180*65536+30
  1316.         mov ecx,0x10DDBBCC
  1317.         mov edx,ed_buffer.3
  1318.         mov esi,8
  1319.         int 0x40
  1320.         popad
  1321.         ;----------- ®â« ¤ª 
  1322. }
  1323. macro   debug_func
  1324. {
  1325. .str:
  1326.         mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï, ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx, ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
  1327.          ;¯¥à¥¢®¤ ç¨á«  ¢ ASCII áâபã, ¢å®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­¨ï, edi  ¤à¥á ªã¤  ¡ã¤¥¬ § ¯¨á뢠âì áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
  1328.         cmp eax,ecx  ;áà ¢­¨âì, ¥á«¨ ¢ eax ¬¥­ìè¥, 祬 ¢ ecx, â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
  1329.         jb @f
  1330.         xor edx,edx  ;®ç¨áâ¨âì edx
  1331.         div ecx      ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
  1332.         push edx     ;¯®«®¦¨âì ¢ á⥪
  1333.         ;dec edi             ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
  1334.         call .str ;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â , ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
  1335.         pop eax
  1336.         @@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al, 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­¨ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
  1337.         ;sbb al,$69  ;- ç¥áâ­®, ¤ ­­ ï ¨­áâàãªæ¨ï ¬¥­ï § áâ ¢«ï¥â § ¤ã¬ âìáï â.¥. ï ­¥ §­ î ª ª íâ® à ¡®â ¥â
  1338.         ;das        ;¯®á«¥ ¤ ­­®© ª®¬ ­¤ë ª ª ¡ë ¯à®¨á室¨â 㬥­ì襭¨¥ al ­  66h  (¢ ª­¨£¥ ­ ¯¨á ­® ¤à㣮¥)
  1339.         or al,0x30  ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥, 祬 ¤¢¥ ¢ëè¥
  1340.         stosb       ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祩ªã ¯ ¬ï⨠es:edi
  1341.  
  1342.         ret         ;¢¥à­ãâìáï ®ç¥­ì ¨­â¥à¥á­ë© 室, â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âáï ª®«-¢® ¢ë§®¢®¢, â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
  1343. }
  1344.  
  1345. ed_struc_size=84
  1346.