Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. ; END
  3. ; KolibriOS Team 2005-2015
  4.  
  5. fade equ 0
  6.  
  7. use32        ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à 
  8. org 0x0      ;  ¤à¥á æ¨ï á ­ã«ï
  9.  
  10. db 'MENUET01'    ; 8-¡ ©â­ë© ¨¤¥­â¨ä¨ª â®à MenuetOS
  11. dd 0x01          ; ¢¥àá¨ï § £®«®¢ª  (¢á¥£¤  1)
  12. dd START         ;  ¤à¥á ¯¥à¢®© ª®¬ ­¤ë
  13. dd IM_END        ; à §¬¥à ¯à®£à ¬¬ë
  14. dd I_END         ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
  15. dd stacktop      ;  ¤à¥á ¢¥à設ë á⥪ 
  16. dd 0x0           ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢
  17. dd cur_dir_path
  18.  
  19. include 'lang.inc'
  20. include '../../../macros.inc'
  21. include '../../../proc32.inc'
  22. include '../../../dll.inc'
  23. include '../../../develop/libraries/box_lib/load_lib.mac'
  24. include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
  25.  
  26. @use_library
  27.  
  28. macro DrawBar  x, y, width, height, color
  29. {
  30.         mcall 13, (x) shl 16 + (width), (y) shl 16 + (height), color
  31. }
  32.  
  33. macro DrawRectangle  x, y, w, h, color
  34. {
  35.         DrawBar x,y,w,1,color
  36.         DrawBar x,y+h,w,1
  37.         DrawBar x,y,1,h
  38.         DrawBar x+w,y,1,h+1
  39. }
  40.  
  41.        
  42. align 4
  43. START:
  44.  
  45.  
  46. load_libraries l_libs_start,end_l_libs
  47.         inc     eax
  48.         test    eax,eax
  49.         jz      close
  50.  
  51. push    dword check1
  52. call    [init_checkbox2]
  53.  
  54. stdcall dll.Init,[init_lib]
  55.  
  56. invoke  ini_get_int,ini_file,asettings,aautosave,0
  57.         mov   [autosave],eax
  58.         dec   eax
  59.         jnz   @f
  60.         bts   dword [check1.flags],1
  61. @@:
  62.         mcall   40,0x80000027
  63. redraw:
  64.     call draw_window
  65. still:
  66.     mov  al,10
  67.     mcall                                    ;wait here for event
  68.     dec  eax
  69.     jz   redraw
  70.     dec  eax
  71.     jz   key
  72.     dec  eax
  73.     jz   button
  74.  
  75.     push dword check1
  76.     call [check_box_mouse2]
  77.     bt   dword [check1.flags],1
  78.     jnc  @f
  79.     mov  [autosave],1
  80.     jmp  still
  81. @@:
  82.     mov  [autosave],0
  83.     jmp  still
  84.  
  85. key:
  86.     mov  al,2
  87.     mcall                                    ;eax=2 - get key code
  88.     mov  al,ah
  89.      cmp  al,13
  90.      je   restart
  91.      cmp  al,19
  92.      je   checkbox
  93.      cmp  al,180
  94.      je   restart_kernel
  95.      cmp  al,181
  96.      je   power_off
  97.      cmp  al,27
  98.      jne   still
  99.  
  100. close:
  101.     mcall -1
  102.  
  103. button:
  104.     mcall 17                                 ;eax=17 - get pressed button id
  105.     xchg al,ah
  106.     dec  eax
  107.     jz   close
  108.     dec  eax
  109.     jz   restart_kernel
  110.     dec  eax
  111.     jz   restart
  112.     dec  eax
  113.     jnz  checkbox
  114.  
  115. power_off:
  116.     push 2
  117.     jmp  mcall_and_close
  118.  
  119. restart:
  120.     push 3
  121.     jmp  mcall_and_close
  122.  
  123. restart_kernel:
  124.     push 4
  125.  
  126. mcall_and_close:
  127. if fade=1
  128.  ; === FADE IN ===
  129.     mov eax, color1
  130.   @@:
  131.     mov ebx, [eax + 32]
  132.     mov [eax], ebx
  133.     add eax, 4
  134.     cmp eax, color21
  135.     jne @b
  136.  
  137.     call    draw_window
  138. end if
  139.  
  140.     invoke  ini_set_int,ini_file,asettings,aautosave,[autosave]
  141.     cmp  [autosave],1
  142.     jne   no_save
  143.  
  144. if fade=0
  145.     mov   al,4
  146.     mcall   ,<50,120> ,0x800000cc,label7        ;eax=4 - write text
  147. end if
  148.  
  149.     mcall 70,rdsave
  150.     test  eax,eax
  151.     js    no_save
  152.     mov   ecx,eax
  153.     mcall 18,21
  154.     mov   ecx,eax
  155. @@:
  156.     push ecx
  157.     mcall 23,100
  158.     dec   eax
  159.     jnz   no_red
  160.     call draw_window
  161. no_red:
  162.     pop   ecx
  163.     mcall 9,proc_info
  164.     cmp   [proc_info+50],9
  165.     je    no_save
  166.     jmp   @b
  167. no_save:
  168.     pop  ecx
  169.   mcall 18,9
  170. ret
  171.  
  172. checkbox:
  173.     btc   dword [check1.flags],1
  174.     jc    .1
  175.     mov   [autosave],1
  176.     jmp   .draw
  177. .1:
  178.     mov   [autosave],0
  179. .draw:
  180.     push  dword check1
  181.     call  [check_box_draw2]
  182.     jmp    still
  183.  
  184. draw_window:
  185.     mcall 12,1
  186.  
  187.     mov   al,14
  188.     mcall                                    ;eax=14 - get screen max x & max y
  189.     movzx ecx,ax
  190.     shr   eax,17
  191.     shl   eax,16
  192.     lea   ebx,[eax-165 shl 16+332]
  193.     shr   ecx,1
  194.     shl   ecx,16
  195.     lea   ecx,[ecx-70 shl 16+132]
  196.  
  197.     xor   eax,eax
  198.         mov edx, 0x01000000
  199.         mcall ;define and draw window  
  200.  
  201.         DrawRectangle 0,0,332,132,[color1]
  202.     mov   al,13
  203.     mcall   ,<1,331>,<1,1>,[color2]
  204.         mcall   ,<1,1>,<1,131>
  205.     mcall   ,<2,330>,<2,130>, [color3]
  206.  
  207.     mov   al,8
  208.     mcall   ,<16,144> ,<16,36>,4,[color4]     ;eax=8 - draw buttons
  209.     mcall   ,<170,144>,       ,2,[color5]
  210.     mcall   ,         ,<62,36>,1,[color6]
  211.     mcall   ,<16,144> ,       ,3,[color7]
  212.  
  213.     mov   al,4
  214.     mcall   ,<28,19> ,[color8],label2        ;eax=4 - write text
  215.     mcall   ,<28,65> ,        ,label3
  216.     mcall   ,<64,40> ,[color9],label5
  217.     mcall   ,<64,86> ,       ,label6
  218.  
  219.     push  dword check1
  220.     call  [check_box_draw2]
  221.  
  222.     mov   al,12
  223.     mcall   ,2
  224.     ret
  225. ;---------------------------------------------------------------------
  226. ;data
  227. include 'data.inc'
  228. ;---------------------------------------------------------------------
  229. IM_END:
  230. ;---------------------------------------------------------------------
  231. align 4
  232.  
  233. proc_info  rb 1024
  234.  
  235. autosave rd 1
  236. ;---------------------------------------------------------------------
  237. cur_dir_path:
  238.         rb 4096
  239. ;---------------------------------------------------------------------
  240. library_path:
  241.         rb 4096
  242. ;---------------------------------------------------------------------
  243. align 32
  244.         rb 4096
  245. stacktop:
  246. I_END:  ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë