Subversion Repositories Kolibri OS

Rev

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