Subversion Repositories Kolibri OS

Rev

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

  1. #define MEMSIZE 1024*60
  2.  
  3. #include "../lib/gui.h"
  4. #include "../lib/copyf.h"
  5.  
  6. #include "../lib/obj/libini.h"
  7.  
  8. #include "../lib/patterns/restart_process.h"
  9.  
  10. char logo[] = "
  11. ████   ████ ██████████ ████   ████ ███████████
  12. ████   ██   ███         ███ ███   ██  ███  ██
  13. █████  ██   ███          █████    ██  ███  ██
  14. ██ ███ ██   ███████       ███         ███    
  15. ██  █████   ███          █████        ███    
  16. ██   ████   ███         ███ ███       ███    
  17. ████   ███  ██████████ ████   ████    █████  
  18. ";
  19.  
  20. #ifdef LANG_RUS
  21. #define T_INTRO "Попробуйте новое визуальное оформление Колибри, которое раньше было доступно только в KolibriNext.";
  22. #define T_INSTALL "Установить"
  23. #define T_COMPLETE "Установка завершена"
  24. #define T_EXIT "Выход"
  25. #else
  26. #define T_INTRO "Try a new visual design of KolibriOS, which previously was available only in KolibriNext.";
  27. #define T_INSTALL "Install"
  28. #define T_COMPLETE "Install complete"
  29. #define T_EXIT "Exit"
  30. #endif
  31.  
  32. #define B_INSTALL 10
  33. #define B_EXIT 11
  34.  
  35. bool install_complete = false;
  36.  
  37. void main()
  38. {
  39.         word btn;
  40.         saved_state = FILE_REPLACE;
  41.         load_dll(libini, #lib_init,1);
  42.         loop() switch(WaitEvent())
  43.         {
  44.                 case evButton:
  45.                         btn = GetButtonID();              
  46.                         if (btn == 1) || (B_EXIT == btn) ExitProcess();
  47.                         if (B_INSTALL == btn) EventInstall();
  48.                         break;
  49.          
  50.                 case evKey:
  51.                         GetKeys();
  52.                         if (key_scancode == SCAN_CODE_ESC) ExitProcess();
  53.                         if (key_scancode == SCAN_CODE_ENTER) {
  54.                                 if (install_complete) ExitProcess();
  55.                                 else EventInstall();
  56.                         }
  57.                         break;
  58.                  
  59.                 case evReDraw:
  60.                         draw_window();
  61.                         break;
  62.         }
  63. }
  64.  
  65. #define WINW 400
  66. #define WINH 300
  67. void draw_window()
  68. {
  69.         sc.get();
  70.         DefineAndDrawWindow(screen.w-WINW/2,screen.h-WINH/2,
  71.                 WINW+9,WINH+skin_h,0x34,sc.work,"KolibriN10",0);
  72.         DrawLogo();
  73.         if (install_complete) DrawInstallComplete(); else DrawIntro();
  74. }
  75.  
  76. void DrawIntro()
  77. {
  78.         DrawTextViewArea(30, 140, WINW-60, WINH-80,
  79.                 T_INTRO, -1, sc.work_text);
  80.         DrawCaptButton(WINW-110/2, WINH-70, 110, 28, B_INSTALL,
  81.                 0x0092D8, 0xFFFfff, T_INSTALL);
  82. }
  83.  
  84. void DrawInstallComplete()
  85. {
  86.         draw_icon_32(WINW-32/2, 140, sc.work, 49);
  87.         WriteTextCenter(0,185, WINW, sc.work_text, T_COMPLETE);
  88.         DrawCaptButton(WINW-110/2, WINH-70, 110, 28, B_EXIT,
  89.                 0x0092D8, 0xFFFfff, T_EXIT);
  90. }
  91.  
  92. void DrawLogo()
  93. {
  94.         #define LX -46*6+WINW/2
  95.         #define LY 25
  96.         WriteTextLines(LX-2, LY, 0x80, 0xF497C0, #logo, 9);
  97.         WriteTextLines(LX+3, LY, 0x80, 0x7ED1E3, #logo, 9);
  98.  
  99.         pause(1);
  100.  
  101.         WriteTextLines(LX+1, LY, 0x80, 0xEC008C, #logo, 9);
  102.         WriteTextLines(LX,   LY, 0x80, 0xEC008C, #logo, 9);
  103. }
  104.  
  105. void EventInstall()
  106. {
  107.         ini_set_int stdcall ("/sys/settings/taskbar.ini", "Flags", "Attachment", 0);
  108.         writing_error_channel = WRITE_ERROR_NOTIFY;
  109.         copy_state = FILE_REPLACE;
  110.         //if (copyf("/kolibrios/KolibriNext/settings", "/sys/settings")) return;
  111.         CopyFile("/kolibrios/KolibriNext/settings/app_plus.ini", "/sys/settings/app_plus.ini");
  112.         CopyFile("/kolibrios/KolibriNext/settings/docky.ini", "/sys/settings/docky.ini");
  113.         CopyFile("/kolibrios/KolibriNext/settings/icon.ini", "/sys/settings/icon.ini");
  114.  
  115.         RestartProcessByName("/sys/@icon", MULTIPLE);
  116.         RestartProcessByName("/sys/@taskbar", SINGLE);
  117.         RestartProcessByName("/sys/@docky", SINGLE);
  118.  
  119.         RunProgram("/sys/media/kiv", "\\S__/kolibrios/res/Wallpapers/Free yourself.jpg");
  120.  
  121.         install_complete = true;
  122.  
  123.         pause(150);
  124.         ActivateWindow_Self();
  125. }
  126.  
  127. void Operation_Draw_Progress(dword filename) { }