Subversion Repositories Kolibri OS

Rev

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