Subversion Repositories Kolibri OS

Rev

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

  1. ; Copyright (c) 2009, <Lrz>
  2. ; All rights reserved.
  3. ;
  4. ; Redistribution and use in source and binary forms, with or without
  5. ; modification, are permitted provided that the following conditions are met:
  6. ;       * Redistributions of source code must retain the above copyright
  7. ;       notice, this list of conditions and the following disclaimer.
  8. ;       * Redistributions in binary form must reproduce the above copyright
  9. ;       notice, this list of conditions and the following disclaimer in the
  10. ;       documentation and/or other materials provided with the distribution.
  11. ;       * Neither the name of the <organization> nor the
  12. ;       names of its contributors may be used to endorse or promote products
  13. ;       derived from this software without specific prior written permission.
  14. ;
  15. ; THIS SOFTWARE IS PROVIDED BY Alexey Teplov nickname <Lrz> ''AS IS'' AND ANY
  16. ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. ; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
  19. ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  22. ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. ;*****************************************************************************
  26.  
  27. ;§ £®«®¢®ª ¯à¨«®¦¥­¨ï
  28. use32                ; âà ­á«ïâ®à, ¨á¯®«ì§ãî騩 32 à §à來ëå ª®¬ ­¤ë
  29.     org 0x0                ; ¡ §®¢ë©  ¤à¥á ª®¤ , ¢á¥£¤  0x0
  30.     db 'MENUET01'        ; ¨¤¥­â¨ä¨ª â®à ¨á¯®«­ï¥¬®£® ä ©«  (8 ¡ ©â)
  31.     dd 0x1                ; ¢¥àá¨ï ä®à¬ â  § £®«®¢ª  ¨á¯®«­ï¥¬®£® ä ©« 
  32.     dd start                ;  ¤à¥á, ­  ª®â®àë© á¨á⥬  ¯¥à¥¤ ñâ ã¯à ¢«¥­¨¥
  33.                         ; ¯®á«¥ § £à㧪¨ ¯à¨«®¦¥­¨ï ¢ ¯ ¬ïâì
  34.     dd mem                ; à §¬¥à ¯à¨«®¦¥­¨ï
  35.     dd mem                  ; Ž¡ê¥¬ ¨á¯®«ì§ã¥¬®© ¯ ¬ïâ¨, ¤«ï á⥪  ®â¢¥¤¥¬ 0å100 ¡ ©â ¨ ¢ë஢­¨¬ ­  £à­¨æã 4 ¡ ©â 
  36.     dd mem                  ; à á¯®«®¦¨¬ ¯®§¨æ¨î á⥪  ¢ ®¡« á⨠¯ ¬ïâ¨, áࠧ㠧  ⥫®¬ ¯à®£à ¬¬ë. ‚¥à設  á⥪  ¢ ¤¨ ¯ §®­¥ ¯ ¬ïâ¨, 㪠§ ­­®¬ ¢ëè¥
  37.     dd 0x0              ; 㪠§ â¥«ì ­  áâபã á ¯ à ¬¥âà ¬¨.
  38.     dd way_of_ini
  39. include '../../../../macros.inc'
  40. include '../../box_lib/asm/trunk/editbox_ex.mac'
  41. include '../../box_lib/load_lib.mac'
  42.         @use_library    ;use load lib macros
  43. start:
  44. ;universal load library/librarys
  45. sys_load_libraries l_libs_start,end_l_libs
  46. ;if return code =-1 then exit, else nornary work
  47.         cmp     eax,-1
  48.         jz      exit
  49.         mcall   40,0x27         ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
  50.  
  51.         mov  eax,48
  52.         mov  ebx,3
  53.         mov  ecx,sc
  54.         mov  edx,sizeof.system_colors
  55.         mcall
  56.         mov  eax,dword [sc.work]
  57.         mov  dword [con_colors+4],eax
  58.  
  59. ;       mcall   66,1,0
  60.        call [initialization_font]       ; ¨­¨æ¨ «¨§ æ¨ï ᯨ᪠ èà¨ä⮢
  61.        push dword (8 shl 16 +16)        ; ¯®¨áª ­ã¦­®£® èà¨äâ  ¢ ­ ¡®à¥ èà¨ä⮢ (¯®ª  ¤®áâ㯥­ ⮫쪮 8å16)
  62.        call [get_font]
  63.         test    eax,eax                 ;­ è«¨ ?
  64.         jnz     exit
  65. ;;;;;;;;;;;;;;;;;;;;
  66.         mcall   40,0x27         ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
  67. red_win:
  68.     call draw_window            ;¯¥à¢®­ ç «ì­® ­¥®¡å®¤¨¬® ­ à¨á®¢ âì ®ª­®
  69. align 4
  70. still:                          ;®á­®¢­®© ®¡à ¡®â稪
  71.         mcall   10              ;Ž¦¨¤ âì ᮡëâ¨ï
  72.         dec  eax
  73.         jz   red_win
  74.         dec  eax
  75.         jz   key
  76.         dec  eax
  77.         jz   button
  78.  
  79.         push    dword edit1
  80.         call    [edit_box_mouse]
  81.  
  82.         jmp still    ;¥á«¨ ­¨ç¥£® ¨§ ¯¥à¥ç¨á«¥­­®£® â® á­®¢  ¢ 横«
  83. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  84. button:
  85.         mcall   17      ;¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª« ¢¨è¨
  86.         test ah,ah      ;¥á«¨ ¢ ah 0, â® ¯¥à¥©â¨ ­  ®¡à ¡®â稪 ᮡë⨩ still
  87.         jz  still
  88. exit:   mcall   -1
  89. key:
  90.         mcall   2       ;§ £à㧨¬ §­ ç¥­¨¥ 2 ¢ ॣ¨áâ®à eax ¨ ¯®«ã稬 ª®¤ ­ ¦ â®© ª« ¢¨è¨
  91.  
  92.         push    dword edit1
  93.         call    [edit_box_key]
  94.  
  95.  
  96.         mcall   13,<20,650>,<40,16>, dword[con_colors+4]
  97.  
  98.  
  99.         push    dword 20 shl 16 + 40    ; esp+12= dd x shl 16 + y x- ª®®à¤¨­ â  ¯® •, y - ª®®à¤¨­ â  ¯® Y
  100.         push    dword con_colors        ; esp+8 = dd point to color of background and font
  101.         push    dword text              ; esp+4 = dd point to ASCIIZ
  102. ; esp+0 = dd back
  103.         call    [font_draw_on_string]   ; ¢ë¢¥á⨠¯® £«¨ä ¬ áâà®çªã
  104.  
  105.  
  106.         jmp still
  107.  
  108. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  109. align 4
  110. draw_window:            ;à¨á®¢ ­¨¥ ®ª­  ¯à¨«®¦¥­¨ï
  111.         mcall   12,1
  112.         xor  eax,eax             ;®¡­ã«¨âì eax
  113.         mov  ebx,50*65536+680    ;[ª®®à¤¨­ â  ¯® ®á¨ x]*65536 + [à §¬¥à ¯® ®á¨ x]
  114.         mov  ecx,30*65536+500    ;[ª®®à¤¨­ â  ¯® ®á¨ y]*65536 + [à §¬¥à ¯® ®á¨ y]
  115.         mov  edx,[sc.work]       ; color of work area RRGGBB,8->color gl
  116.         or   edx,0x34000000
  117.         mov  edi,hed
  118.         mcall                    ;­ à¨á®¢ âì ®ª­® ¯à¨«®¦¥­¨ï
  119.        
  120.         push    dword edit1
  121.         call    [edit_box_draw]
  122. ;
  123.         push    dword 20 shl 16 + 40    ; esp+12= dd x shl 16 + y x- ª®®à¤¨­ â  ¯® •, y - ª®®à¤¨­ â  ¯® Y
  124.         push    dword con_colors        ; esp+8 = dd point to color of background and font
  125.         push    dword text; esp+4 = dd point to ASCIIZ
  126. ; esp+0 = dd back
  127.         call    [font_draw_on_string]   ; ¢ë¢¥á⨠¯® £«¨ä ¬ áâà®çªã
  128.         mov eax,12               ;”ã­ªæ¨ï 12 - ­ ç âì/§ ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
  129.         mov ebx,2                ;®¤äã­ªæ¨ï 2 - § ª®­ç¨âì ¯¥à¥à¨á®¢ªã ®ª­ .
  130.         mcall
  131.         ret
  132. ;;;;;;;;;;;;
  133. ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  134. ;DATA ¤ ­­ë¥
  135. l_libs_start:
  136. library01 l_libs library_name, way_of_ini, library_path, system_path, err_message_found_lib, head_f_l, font_import, err_message_import, head_f_i
  137.  
  138. library02 l_libs library_name1, way_of_ini, library_path, system_path1, err_message_found_lib1, head_f_l, import_box_lib, err_message_import1, head_f_i
  139.  
  140. end_l_libs:
  141.  
  142. ;
  143. system_path      db '/sys/lib/'
  144. library_name     db 'fonts_lib.obj',0
  145.  
  146. system_path1      db '/sys/lib/'
  147. library_name1     db 'box_lib.obj',0
  148.  
  149. err_message_found_lib   db 'Sorry I cannot load library fonts_lib.obj',0
  150. err_message_found_lib1  db 'Sorry I cannot load library box_lib.obj',0
  151.  
  152. head_f_i:
  153. head_f_l        db 'System error',0
  154. err_message_import      db 'Error on load import library fonts_lib.obj',0
  155. err_message_import1     db 'Error on load import library box_lib.obj',0
  156.  
  157. align 4
  158. import_box_lib:  
  159.  
  160. edit_box_draw   dd      aEdit_box_draw
  161. edit_box_key    dd      aEdit_box_key
  162. edit_box_mouse  dd      aEdit_box_mouse
  163. version_ed      dd      aVersion_ed
  164.  
  165.                 dd      0
  166.                 dd      0
  167.  
  168. aEdit_box_draw  db 'edit_box',0
  169. aEdit_box_key   db 'edit_box_key',0
  170. aEdit_box_mouse db 'edit_box_mouse',0
  171. aVersion_ed     db 'version_ed',0
  172.  
  173. font_import:
  174. initialization_font     dd      a_initialization_font
  175. get_font                dd      a_get_font
  176. free_fulder_info        dd      a_free_fulder_info
  177. free_font               dd      a_free_font
  178. font_draw_on_string     dd      a_font_draw_on_string
  179. show_all_glif           dd      a_show_all_glif
  180. Version_fn            dd      a_Version_fn
  181.                       dd      0,0
  182.  
  183. a_initialization_font   db 'initialization_font',0
  184. a_get_font              db 'get_font',0
  185. a_free_fulder_info      db 'free_fulder_info',0
  186. a_free_font             db 'free_font',0
  187. a_font_draw_on_string   db 'font_draw_on_string',0
  188. a_show_all_glif         db 'show_all_glif',0
  189. a_Version_fn          db 'version_fn',0
  190.  
  191.  
  192.  
  193. edit1 edit_box 350,175,5,0xffffff,0x6f9480,0,0xAABBCC,0,test_leght,text,ed_focus,text_end-text-1,text_end-text-1
  194.  
  195. text db   'à¨¬¥à ¨á¯®«ì§®¢ ­¨ï ¡¨¡«¨®â¥ª¨ èà¨ä⮢ fonts_lib.obj',0
  196. text_end:
  197. rb  256
  198. test_leght = ($-text)-1
  199.  
  200. hed db   "Font's demo <Lrz>",0
  201. align 4
  202. con_colors      dd      0x1E1EFF, 0x96FFCF
  203.  
  204. align 4
  205. sc     system_colors
  206. way_of_ini      rb 4096
  207. library_path    rb 4096
  208.  
  209. align 4
  210. i_end:
  211. rb 1024
  212. mem:
  213.                 ;ª®­¥æ ª®¤