Subversion Repositories Kolibri OS

Rev

Rev 6687 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. window_h=85
  2. window_w=430
  3. ;--- ¤à㣨¥ ¬ ªà®áë ---
  4. include '../../../KOSfuncs.inc'
  5. include '../../../load_lib.mac'
  6. include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
  7. include 'txtbut.inc'
  8. include '../../../macros.inc'
  9. include 'run.mac'
  10. include 'lang.inc'
  11. use32
  12.     org 0
  13.     db 'MENUET01'
  14.     dd 1
  15.     dd start
  16.     dd i_end
  17.     dd mem
  18.     dd mem
  19.     dd par
  20.     dd cur_dir_path
  21.  
  22.  
  23. ;        meos_app_start
  24. ;        use_edit_box
  25.         @use_library
  26.         use_txt_button
  27. ;        code
  28. ;load system lib
  29. align 4
  30. start:
  31. sys_load_library  library_name, library_path, system_path, myimport
  32.         cmp     eax,-1
  33.         jz      close
  34.  
  35.         cmp     [par],byte 0
  36.         jne     read_par
  37.         mcall   SF_SET_EVENTS_MASK, EVM_MOUSE+EVM_BUTTON+EVM_KEY+EVM_REDRAW+EVM_MOUSE_FILTER
  38. red:
  39.         mcall   SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,40
  40.         edit_boxes_set_sys_color input_fn,input_fn_end,sc
  41.         set_sys_colors_txt_button run_but,sc
  42.         push    dword [sc.work_graph]
  43.         pop     [input_fn.focus_border_color]
  44.         call    draw_window
  45. still:                          ;®á­®¢­®© ®¡à ¡®â稪
  46.         mcall   SF_WAIT_EVENT
  47.         dec  eax
  48.         jz   red
  49.         dec  eax
  50.         jz   key
  51.         dec  eax
  52.         jz   button
  53. ;        mouse_edit_box input_fn
  54.         push    dword input_fn
  55.         call    [edit_box_mouse]
  56.  
  57.         jmp still    ;¥á«¨ ­¨ç¥£® ¨§ ¯¥à¥ç¨á«¥­­®£® â® á­®¢  ¢ 横«
  58. key:
  59.         mcall   SF_GET_KEY
  60.         cmp     ah,13
  61.         je      run
  62. ;        key_edit_box input_fn
  63.         push    dword input_fn
  64.         call    [edit_box_key]
  65.  
  66.         jmp     still
  67. button:
  68.         mcall   SF_GET_BUTTON
  69.         dec     ah
  70.         jz      close
  71.         dec     ah
  72.         jz      run
  73.         jmp     still
  74.  
  75. read_par:
  76.         mov     esi,par
  77.         mov     edi,fn
  78.         mov     ecx,256
  79.         rep     movsb
  80. run:
  81.         xor     eax,eax
  82.         mov     edi,file_info.name
  83.         mov     ecx,512
  84.         rep     stosb
  85.         mov     edi,run_par
  86.         mov     ecx,256
  87.         rep     stosb
  88.  
  89.         mov     esi,fn
  90.         mov     edi,file_info.name
  91.         cmp     [esi],byte '"'
  92.         je      copy_fn_with_spaces
  93. copy_fn:
  94.         cmp     [esi],byte ' '
  95.         je      .stop
  96.         cmp     [esi],byte 0
  97.         je      .stop
  98.         mov     al,[esi]
  99.         mov     [edi],al
  100.         inc     esi
  101.         inc     edi
  102.         jmp     copy_fn
  103. .stop:
  104.  
  105.         jmp     copy_par
  106.  
  107. copy_fn_with_spaces:
  108.         inc     esi
  109. @@:
  110.         cmp     [esi],byte '"'
  111.         je      .stop
  112.         cmp     [esi],byte 0
  113.         je      .stop
  114.         mov     al,[esi]
  115.         mov     [edi],al
  116.         inc     esi
  117.         inc     edi
  118.         jmp     @b
  119. .stop:
  120.  
  121. copy_par:
  122. @@:
  123.         inc     esi
  124.         cmp     [esi],byte ' '
  125.         je      @b
  126.         mov     edi,run_par
  127. @@:
  128.         cmp     [esi],byte 0
  129.         je      .stop
  130.         mov     al,[esi]
  131.         mov     [edi],al
  132.         inc     esi
  133.         inc     edi
  134.         jmp     @b
  135. .stop:
  136.         mcall   SF_FILE,file_info
  137.  
  138.         cmp     eax,0
  139.         jl      error
  140.         mov     [status],run_ok
  141.         call    draw_status
  142.         jmp     still
  143. close:
  144.         mcall SF_TERMINATE_PROCESS
  145.  
  146. error:
  147.         neg     eax
  148.         cmp_err 3,bad_file_sys
  149.         cmp_err 5,file_not_find
  150.         cmp_err 9,bad_fat_table
  151.         cmp_err 10,acces_denyied
  152.         cmp_err 11,device_error
  153.         cmp_err 30,out_of_memory
  154.         cmp_err 31,file_not_executable
  155.         cmp_err 32,many_processes
  156.  
  157.         call    draw_status
  158.         jmp     still
  159.  
  160. draw_window:
  161.         mcall   SF_STYLE_SETTINGS,SSF_GET_SCREEN_AREA
  162.         mov     si,bx
  163.  
  164.         mcall   SF_REDRAW, SSF_BEGIN_DRAW
  165.         mcall   SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
  166.         mov     dx,ax
  167.         mcall   SF_GET_SCREEN_SIZE
  168.         xor     ecx,ecx
  169.         sub     cx,window_h+40
  170.         sub     cx,dx
  171.         add     cx,si
  172.         shl     ecx,16
  173.         mov     cx,dx
  174.         add     cx,window_h
  175.         shr     eax,16
  176.         mov     bx,ax
  177.         sub     bx,window_w
  178.         shl     ebx,15
  179.         mov     bx,window_w
  180.         mov     edx,[sc.work]
  181.         or      edx,0x33000000
  182.         xor     esi,esi
  183.         mov     edi,grab_text
  184.         mcall   SF_CREATE_WINDOW
  185.  
  186.         mcall   SF_THREAD_INFO,procinfo,-1
  187.  
  188.         mov     eax,[procinfo.box.width]
  189.         sub     eax,20
  190.         mov     [input_fn.width],eax
  191.         mov     [run_but.width],ax
  192.  
  193.         ; ; draw line
  194.         ; xor   bx,bx
  195.         ; shl   ebx,16
  196.         ; mov   bx,ax
  197.         ; add   bx,10
  198.         ; mov   cx,58
  199.         ; push  cx
  200.         ; shl   ecx,16
  201.         ; pop   cx
  202.         ; mov   edx,[sc.work_graph]
  203.         ; mcall SF_DRAW_LINE
  204.  
  205.         ; draw_edit_box input_fn
  206.         push    dword input_fn
  207.         call    [edit_box_draw]
  208.  
  209.         draw_txt_button run_but
  210.  
  211.         call    draw_status_text
  212.  
  213.         mcall   SF_REDRAW, SSF_END_DRAW
  214. ret
  215.  
  216. draw_status:
  217.         mov     ebx,[procinfo.box.width]
  218.         sub     bx,10
  219.         mov     ecx,(60)*65536+15
  220.         mov     edx,[sc.work]
  221.         mcall   SF_DRAW_RECT
  222. draw_status_text:
  223.         mov     edx,[status]
  224.         xor     esi,esi
  225. @@:
  226.         cmp     [edx+esi],byte 0
  227.         je      @f
  228.         inc     esi
  229.         jmp     @b
  230. @@:
  231.         mov     ecx,[sc.work_text]
  232.         or  ecx,0x90000000
  233.         mcall   SF_DRAW_TEXT,5*65536+(60)
  234. ret
  235.  
  236. run_but txt_button 0,5,20,33,2,0,0x90000000,run_but_text,
  237. input_fn edit_box 0,5,5,0xffffff,0x6a9480,0,0xaaaaaa,0x90000000,511,fn,mouse_dd,ed_focus+ed_always_focus
  238. ;mouse_flag: dd 0x0
  239. input_fn_end:
  240. if lang eq ru
  241.         hello db '‚¢¥¤¨â¥ ¯®«­ë© ¯ãâì ª ä ©«ã ¨ ­ ¦¬¨â¥ Enter',0
  242.         bad_file_sys db '¥¨§¢¥áâ­ ï ä ©«®¢ ï á¨á⥬ ',0 ; 3
  243.         file_not_find db '” ©« ­¥ ­ ©¤¥­',0              ; 5
  244.         bad_fat_table db '’ ¡«¨æ  FAT à §àã襭 ',0       ; 9
  245.         acces_denyied db '„®áâ㯠§ ¯à¥é¥­',0             ; 10
  246.         device_error db 'Žè¨¡ª  ãáâனá⢠',0            ; 11
  247.         out_of_memory db '¥¤®áâ â®ç­® ¯ ¬ïâ¨',0         ; 30
  248.         file_not_executable db '” ©« ­¥ ï¥âáï ¨á¯®«­ï¥¬ë¬',0 ; 31
  249.         many_processes db '‘«¨èª®¬ ¬­®£® ¯à®æ¥áᮢ',0    ; 32
  250.         run_ok db 'à®£à ¬¬  ãᯥ譮 § ¯ã饭 ',0
  251.         grab_text db '‡ ¯ã᪠¯à®£à ¬¬ë',0
  252.         run_but_text db '‡€“‘’ˆ’œ',0
  253. else if lang eq it
  254.         hello db 'Inserisci percorso completo al file e premi <Enter>',0
  255.         bad_file_sys db 'Filesysrem sconosciuto',0             ; 3
  256.         file_not_find db 'File non trovato',0                  ; 5
  257.         bad_fat_table db 'Tabella FAT corrotta',0              ; 9
  258.         acces_denyied db 'Accesso negato',0                    ; 10
  259.         device_error db 'Device error',0                       ; 11
  260.         out_of_memory db 'Out of memory',0                     ; 30
  261.         file_not_executable db 'File non eseguibile',0      ; 31
  262.         many_processes db 'Troppo processi',0          ; 32
  263.         run_ok db 'Il programma eseguito correttamente',0
  264.         grab_text db 'RUN',0
  265.         run_but_text db 'Esegui',0
  266. else
  267.         hello db 'Enter full path to file and press <Enter>',0
  268.         bad_file_sys db 'Unknown file system',0                ; 3
  269.         file_not_find db 'File not found',0                    ; 5
  270.         bad_fat_table db 'FAT table corrupted',0               ; 9
  271.         acces_denyied db 'Access denied',0                     ; 10
  272.         device_error db 'Device error',0                       ; 11
  273.         out_of_memory db 'Out of memory',0                     ; 30
  274.         file_not_executable db 'File is not executable',0      ; 31
  275.         many_processes db 'Too many processes',0               ; 32
  276.         run_ok db 'The program was started successfully',0
  277.         grab_text db 'RUN',0
  278.         run_but_text db 'RUN',0
  279. end if
  280. status dd hello
  281.  
  282. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  283. ;DATA ¤ ­­ë¥
  284. ;‚ᥣ¤  ᮡ«î¤ âì ¯®á«¥¤®¢ â¥«ì­®áâì ¢ ¨¬¥­¨.
  285. system_path      db '/sys/lib/'
  286. library_name     db 'box_lib.obj',0
  287. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  288.  
  289.  
  290. myimport:
  291.  
  292. edit_box_draw   dd      aEdit_box_draw
  293. edit_box_key    dd      aEdit_box_key
  294. edit_box_mouse  dd      aEdit_box_mouse
  295. version_ed      dd      aVersion_ed
  296.  
  297.                 dd      0,0
  298.  
  299. aEdit_box_draw  db 'edit_box_draw',0
  300. aEdit_box_key   db 'edit_box_key',0
  301. aEdit_box_mouse db 'edit_box_mouse',0
  302. aVersion_ed     db 'version_ed',0
  303.  
  304.  
  305.  
  306.  
  307. file_info:
  308. .mode dd SSF_START_APP
  309. .flags dd 0
  310. .par dd run_par
  311. dd 0,0
  312. .name rb 512
  313.  
  314. flags rw 1
  315.  
  316. sc system_colors
  317.  
  318. procinfo process_information
  319.  
  320. run_par rb 256
  321. par rb 256
  322. fn rb 512
  323. mouse_dd        rd 1
  324. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  325. cur_dir_path    rb 4096
  326. library_path    rb 4096
  327. i_end:
  328. rb 1024
  329. mem:
  330. ;meos_app_end
  331. ;udata
  332.