Subversion Repositories Kolibri OS

Rev

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

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