Subversion Repositories Kolibri OS

Rev

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