Subversion Repositories Kolibri OS

Rev

Rev 600 | Rev 1069 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ; 24.07.2008 <Lrz> ®¡­®¢«¥­ Edit ¡®ªá
  2. ; 01.02.07 - ®¡­®¢«ñ­ editbox
  3. ; 31.01.07 - ¨á¯à ¢«¥­  ­¥ª®àà¥ªâ­ ï ®âà¨á®¢ª  ¯à¨ ¡®«ì讬 §­ ç¥­¨¨ ¢ëá®âë ᪨­ 
  4. ;            ¢ëà ¢­¨¢ ­¨¥ á­¨§ã ®â­®á¨â¥«ì­® à ¡®ç¥© ®¡« á⨠íªà ­ 
  5. window_y=67
  6. ;window_x=320
  7. window_x=640
  8. ;--- ¤à㣨¥ ¬ ªà®áë ---
  9. include '../../../develop/examples/editbox/trunk/editbox.inc'
  10. ;include 'editbox.inc'
  11. include 'txtbut.inc'
  12. include '../../../macros.inc'
  13. ;include 'macros.inc'
  14. include 'run.mac'
  15. include 'lang.inc'
  16.         meos_app_start
  17.         use_edit_box
  18.         use_txt_button
  19.         code
  20.         cmp     [par],byte 0
  21.         jne     read_par
  22.         mcall   40,EVM_MOUSE+EVM_BUTTON+EVM_KEY+EVM_REDRAW
  23. red:
  24.         mcall   48,3,sc,40
  25.         set_sys_colors_txt_button run_but,sc
  26.         push    dword [sc.work_graph]
  27.         pop     [input_fn.focus_border_color]
  28.         call    draw_window
  29. still:                          ;®á­®¢­®© ®¡à ¡®â稪
  30.         mcall   10              ;Ž¦¨¤ âì ᮡëâ¨ï
  31.         dec  eax
  32.         jz   red
  33.         dec  eax
  34.         jz   key
  35.         dec  eax
  36.         jz   button
  37.         mouse_edit_box input_fn
  38.         jmp still    ;¥á«¨ ­¨ç¥£® ¨§ ¯¥à¥ç¨á«¥­­®£® â® á­®¢  ¢ 横«
  39. key:
  40.         mcall   2
  41.         cmp     ah,13
  42.         je      run
  43.         key_edit_box input_fn
  44.         jmp     still
  45. button:
  46.         mcall   17
  47.         dec     ah
  48.         jz      close
  49.         dec     ah
  50.         jz      run
  51.         jmp     still
  52.  
  53. read_par:
  54.         mov     esi,par
  55.         mov     edi,fn
  56.         mov     ecx,256
  57.         rep     movsb
  58. run:
  59.         xor     eax,eax
  60.         mov     edi,file_info.name
  61.         mov     ecx,512
  62.         rep     stosb
  63.         mov     edi,run_par
  64.         mov     ecx,256
  65.         rep     stosb
  66.  
  67.         mov     esi,fn
  68.         mov     edi,file_info.name
  69.         cmp     [esi],byte '"'
  70.         je      copy_fn_with_spaces
  71. copy_fn:
  72.         cmp     [esi],byte ' '
  73.         je      .stop
  74.         cmp     [esi],byte 0
  75.         je      .stop
  76.         mov     al,[esi]
  77.         mov     [edi],al
  78.         inc     esi
  79.         inc     edi
  80.         jmp     copy_fn
  81. .stop:
  82.  
  83.         jmp     copy_par
  84.  
  85. copy_fn_with_spaces:
  86.         inc     esi
  87. @@:
  88.         cmp     [esi],byte '"'
  89.         je      .stop
  90.         cmp     [esi],byte 0
  91.         je      .stop
  92.         mov     al,[esi]
  93.         mov     [edi],al
  94.         inc     esi
  95.         inc     edi
  96.         jmp     @b
  97. .stop:
  98.  
  99. copy_par:
  100. @@:
  101.         inc     esi
  102.         cmp     [esi],byte ' '
  103.         je      @b
  104.         mov     edi,run_par
  105. @@:
  106.         cmp     [esi],byte 0
  107.         je      .stop
  108.         mov     al,[esi]
  109.         mov     [edi],al
  110.         inc     esi
  111.         inc     edi
  112.         jmp     @b
  113. .stop:
  114.         mcall   70,file_info
  115.  
  116.         cmp     eax,0
  117.         jl      error
  118.         mov     [status],run_ok
  119.         call    draw_status
  120.         jmp     still
  121. close:
  122.         mcall -1
  123.  
  124. error:
  125.         neg     eax
  126.         cmp_err 3,bad_file_sys
  127.         cmp_err 5,file_not_find
  128.         cmp_err 9,bad_fat_table
  129.         cmp_err 10,acces_denyied
  130.         cmp_err 11,device_error
  131.         cmp_err 30,out_of_memory
  132.         cmp_err 31,file_not_executable
  133.         cmp_err 32,many_processes
  134.  
  135.         call    draw_status
  136.         jmp     still
  137.  
  138. draw_window:
  139.         mcall   48,5
  140.         mov     si,bx
  141.  
  142.         mcall   12,1
  143.         mcall   48,4
  144.         mov     dx,ax
  145.         mcall   14
  146.         xor     ecx,ecx
  147.         sub     cx,window_y+2
  148.         sub     cx,dx
  149.         add     cx,si
  150.         shl     ecx,16
  151.         mov     cx,dx
  152.         add     cx,window_y
  153.         shr     eax,16
  154.         mov     bx,ax
  155.         sub     bx,window_x
  156.         shl     ebx,15
  157.         mov     bx,window_x
  158.         mov     edx,[sc.work]
  159.         or      edx,0x33000000
  160.         xor     esi,esi
  161.         mov     edi,grab_text
  162.         mcall   0
  163.  
  164.         mcall   9,procinfo,-1
  165.  
  166.         mov     eax,[procinfo.box.width]
  167.         sub     eax,20
  168.         mov     [input_fn.width],eax
  169.         mov     [run_but.width],ax
  170.  
  171.         xor     bx,bx
  172.         shl     ebx,16
  173.         mov     bx,ax
  174.         add     bx,10
  175.         mov     cx,45
  176.         push    cx
  177.         shl     ecx,16
  178.         pop     cx
  179.         mov     edx,[sc.work_graph]
  180.         mcall   38
  181.         draw_edit_box input_fn
  182.         draw_txt_button run_but
  183.  
  184.         call    draw_status_text
  185.  
  186.         mcall   12,2
  187. ret
  188.  
  189. draw_status:
  190.         mov     ebx,[procinfo.box.width]
  191.         sub     bx,10
  192.         mov     ecx,(50)*65536+12
  193.         mov     edx,[sc.work]
  194.         mcall   13
  195. draw_status_text:
  196.         mov     edx,[status]
  197.         xor     esi,esi
  198. @@:
  199.         cmp     [edx+esi],byte 0
  200.         je      @f
  201.         inc     esi
  202.         jmp     @b
  203. @@:
  204.         mov     ecx,[sc.work_text]
  205.         mcall   4,5*65536+(50)
  206. ret
  207.  
  208. run_but txt_button 0,5,15,25,2,0,0,run_but_text,
  209. input_fn edit_box 0,5,5,0xffffff,0x6a9480,0,0xaaaaaa,0,511,fn,ed_focus+ed_always_focus
  210. mouse_flag: dd 0x0
  211.  
  212. if lang eq ru
  213. hello db '‚¢¥¤¨â¥ ¯®«­ë© ¯ãâì ª ä ©«ã ¨ ­ ¦¬¨â¥ Enter',0
  214. bad_file_sys db '¥¨§¢¥áâ­ ï ä ©«®¢ ï á¨á⥬ ',0 ; 3
  215. file_not_find db '” ©« ­¥ ­ ©¤¥­',0              ; 5
  216. bad_fat_table db '’ ¡«¨æ  FAT à §àã襭 ',0       ; 9
  217. acces_denyied db '„®áâ㯠§ ¯à¥é¥­',0             ; 10
  218. device_error db 'Žè¨¡ª  ãáâனá⢠',0            ; 11
  219. out_of_memory db '¥¤®áâ â®ç­® ¯ ¬ïâ¨',0         ; 30
  220. file_not_executable db '” ©« ­¥ ï¥âáï ¨á¯®«­ï¥¬ë¬',0 ; 31
  221. many_processes db '‘«¨èª®¬ ¬­®£® ¯à®æ¥áᮢ',0    ; 32
  222. run_ok db 'à®£à ¬¬  ãᯥ譮 § ¯ã饭 ',0
  223. grab_text db '‡€“‘Š Žƒ€ŒŒ›',0
  224. run_but_text db '‡€“‘’ˆ’œ',0
  225. else
  226. hello db 'Enter full path to file and press <Enter>',0
  227. bad_file_sys db 'Unknown file system',0                ; 3
  228. file_not_find db 'File not found',0                    ; 5
  229. bad_fat_table db 'FAT table corrupted',0               ; 9
  230. acces_denyied db 'Access denied',0                     ; 10
  231. device_error db 'Device error',0                       ; 11
  232. out_of_memory db 'Out of memory',0                     ; 30
  233. file_not_executable db 'File is not executable',0      ; 31
  234. many_processes db 'Too many processes',0               ; 32
  235. run_ok db 'The program was started successfully',0
  236. grab_text db 'RUN',0
  237. run_but_text db 'RUN',0
  238. end if
  239. status dd hello
  240.  
  241. file_info:
  242. .mode dd 7
  243. .flags dd 0
  244. .par dd run_par
  245. dd 0,0
  246. .name rb 512
  247.  
  248. flags dw ?
  249.  
  250. sc system_colors
  251.  
  252. procinfo process_information
  253.  
  254. run_par rb 256
  255. par rb 256
  256. fn rb 512
  257. meos_app_end
  258. udata
  259.