Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. ; END
  3. ; KolibriOS Team 2005-2016
  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. include '../../../gui_patterns.inc'
  26. include "../../../string.inc"
  27.  
  28. WIN_W equ 440
  29. WIN_H equ 200
  30. BOT_PANEL_H equ 70
  31.  
  32. CANCEL_BUTTON_ID equ 1+BT_HIDE
  33. HOME_BUTTON_ID equ 2
  34. REBOOT_BUTTON_ID equ 3
  35. POWEROFF_BUTTON_ID equ 4
  36.  
  37. @use_library
  38.  
  39.        
  40. align 4
  41. START:
  42.  
  43.  
  44. load_libraries l_libs_start,end_l_libs
  45.         inc     eax
  46.         test    eax,eax
  47.         jz      close
  48.  
  49. push    dword check1
  50. call    [init_checkbox2]
  51.  
  52. stdcall dll.Init,[init_lib]
  53.  
  54. invoke  ini_get_int,ini_file,asettings,aautosave,0
  55.         mov   [autosave],eax
  56.         dec   eax
  57.         jnz   @f
  58.         bts   dword [check1.flags],1
  59. @@:
  60.         mcall   40,0x80000027
  61. redraw:
  62.     call draw_window
  63. still:
  64.     mov  al,10
  65.     mcall                                    ;wait here for event
  66.     dec  eax
  67.     jz   redraw
  68.     dec  eax
  69.     jz   key
  70.     dec  eax
  71.     jz   button
  72.  
  73.     push dword check1
  74.     call [check_box_mouse2]
  75.     bt   dword [check1.flags],1
  76.     jnc  @f
  77.     mov  [autosave],1
  78.     jmp  still
  79. @@:
  80.     mov  [autosave],0
  81.     jmp  still
  82.  
  83. key:
  84.     mov  al,2
  85.     mcall                                    ;eax=2 - get key code
  86.     mov  al,ah
  87.      cmp  al,13
  88.      je   restart
  89.      cmp  al,19
  90.      je   checkbox
  91.      cmp  al,180
  92.      je   restart_kernel
  93.      cmp  al,181
  94.      je   power_off
  95.      cmp  al,27
  96.      jne   still
  97.  
  98. close:
  99.     mcall -1
  100.  
  101. button:
  102.     mcall 17                                 ;eax=17 - get pressed button id
  103.     xchg al,ah
  104.     dec  eax
  105.     jz   close
  106.     dec  eax
  107.     jz   restart_kernel
  108.     dec  eax
  109.     jz   restart
  110.     dec  eax
  111.     jnz  checkbox
  112.  
  113. power_off:
  114.     push 2
  115.     jmp  mcall_and_close
  116.  
  117. restart:
  118.     push 3
  119.     jmp  mcall_and_close
  120.  
  121. restart_kernel:
  122.     push 4
  123.  
  124. mcall_and_close:
  125. if fade=1
  126.  ; === FADE IN ===
  127.     mov eax, color1
  128.   @@:
  129.     mov ebx, [eax + 32]
  130.     mov [eax], ebx
  131.     add eax, 4
  132.     cmp eax, color21
  133.     jne @b
  134.  
  135.     call    draw_window
  136. end if
  137.  
  138.     invoke  ini_set_int,ini_file,asettings,aautosave,[autosave]
  139.     cmp  [autosave],1
  140.     jne   no_save
  141.  
  142. if fade=0
  143.     mov   al,4
  144.     mcall   ,<50,120> ,0x800000cc,label7        ;eax=4 - write text
  145. end if
  146.  
  147.     mcall 70,rdsave
  148.     test  eax,eax
  149.     js    no_save
  150.     mov   ecx,eax
  151.     mcall 18,21
  152.     mov   ecx,eax
  153. @@:
  154.     push ecx
  155.     mcall 23,100
  156.     dec   eax
  157.     jnz   no_red
  158.     call draw_window
  159. no_red:
  160.     pop   ecx
  161.     mcall 9,proc_info
  162.     cmp   [proc_info+50],9
  163.     je    no_save
  164.     jmp   @b
  165. no_save:
  166.     pop  ecx
  167.     mcall 18,9
  168.     mcall -1
  169. ret
  170.  
  171. checkbox:
  172.     btc   dword [check1.flags],1
  173.     jc    .1
  174.     mov   [autosave],1
  175.     jmp   .draw
  176. .1:
  177.     mov   [autosave],0
  178. .draw:
  179.     push  dword check1
  180.     call  [check_box_draw2]
  181.     jmp    still
  182.  
  183. draw_window:
  184.     mcall 12,1
  185.        
  186.     mov   al,14
  187.     mcall                                    ;eax=14 - get screen max x & max y
  188.     movzx ecx,ax
  189.     shr   eax,17
  190.     shl   eax,16
  191.     lea   ebx,[eax-(WIN_W/2) shl 16+WIN_W-1]
  192.     shr   ecx,1
  193.     shl   ecx,16
  194.     lea   ecx,[ecx-(WIN_H/2) shl 16+WIN_H-1]
  195.  
  196.     xor   eax,eax
  197.         mov edx, 0x41000000
  198.         mcall ;define and draw window
  199.        
  200.         DrawWideRectangle 0, 0, WIN_W, WIN_H, 2, 0xA3A7AA
  201.         DrawBar 2, 2, WIN_W-4, WIN_H-BOT_PANEL_H-2, 0x202020
  202.         DrawBar 2, WIN_H-BOT_PANEL_H-2, WIN_W-4, BOT_PANEL_H, 0x4B4B4B
  203.         WriteText 30, 27, 10010001b, 0xFFFfff, TEXT_TITLE
  204.         WriteText 55, 70, 10010000b, 0xFFFfff, TEXT_RDSAVE1
  205.         WriteText 55, 86, 10010000b, 0xFFFfff, TEXT_RDSAVE2
  206.        
  207.         DefineButton  WIN_W-33, 2, 32, 20, CANCEL_BUTTON_ID, 0
  208.         WriteText  WIN_W-23, 5, 10000001b, 0xFFFfff, TEXT_CANCEL
  209.  
  210.     push  dword check1
  211.     call  [check_box_draw2]
  212.  
  213. macro EndButton  x, bgcol, id, but_text, hotkey_text
  214. {
  215.         buty equ WIN_H-60
  216.         butw equ 116
  217.         buth equ 43
  218.         DrawWideRectangle x-3, buty-3, butw+6, buth+6, 3, 0x202020
  219.         DefineButton x, buty, butw-1, buth-1, id, bgcol
  220.         ; WriteTextBold -strlen(but_text)*8 + butw / 2 + x, buty+8,  10010000b, 0xFFFfff, but_text
  221.         ; WriteText     -strlen(but_text)*6 + butw / 2 + x, buty+26, 10000000b, 0xFFFfff, hotkey_text
  222.         stdcall string.length, but_text
  223.         mov  ebx,eax
  224.         imul ebx,4
  225.         neg  ebx
  226.         add  ebx,butw / 2 + x
  227.         shl  ebx,16
  228.         add  ebx,buty+8
  229.         mcall 4, , 10010000b shl 24 + 0xFFFfff, but_text
  230.         add ebx,1 shl 16
  231.         mcall
  232.         stdcall string.length, hotkey_text
  233.         mov  ebx,eax
  234.         imul ebx,3
  235.         neg  ebx
  236.         add  ebx,butw / 2 + x
  237.         shl  ebx,16
  238.         add  ebx,buty+26
  239.         mcall 4, , 10000000b shl 24 + 0xFFFfff, hotkey_text
  240. }
  241.  
  242.         EndButton  20, 0x4E91C5, HOME_BUTTON_ID,     TEXT_KERNEL, TEXT_HOME
  243.         EndButton 160, 0x55C891, REBOOT_BUTTON_ID,   TEXT_REBOOT, TEXT_ENTER
  244.         EndButton 300, 0xC75C54, POWEROFF_BUTTON_ID, TEXT_OFF,    TEXT_END
  245.  
  246.     mov   al,12
  247.     mcall   ,2
  248.     ret
  249. ;---------------------------------------------------------------------
  250. ;data
  251. include 'data.inc'
  252. ;---------------------------------------------------------------------
  253. IM_END:
  254. ;---------------------------------------------------------------------
  255. align 4
  256.  
  257. proc_info  rb 1024
  258.  
  259. autosave rd 1
  260. ;---------------------------------------------------------------------
  261. cur_dir_path:
  262.         rb 4096
  263. ;---------------------------------------------------------------------
  264. library_path:
  265.         rb 4096
  266. ;---------------------------------------------------------------------
  267. align 32
  268.         rb 4096
  269. stacktop:
  270. I_END:  ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë