Subversion Repositories Kolibri OS

Rev

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

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