Subversion Repositories Kolibri OS

Rev

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

  1. #ifndef AUTOBUILD
  2. #include "lang.h--"
  3. #endif
  4.  
  5. #define MEMSIZE 4096*20
  6. #include "..\lib\strings.h"
  7. #include "..\lib\mem.h"
  8. #include "..\lib\io.h"
  9. #include "..\lib\gui.h"
  10. #include "..\lib\obj\proc_lib.h"
  11. #include "..\lib\patterns\simple_open_dialog.h"
  12. #include "..\lib\added_sysdir.c"
  13.  
  14. char default_dir[] = "/rd/1";
  15. od_filter filter2 = {"",0};
  16.  
  17. proc_info Form;
  18.  
  19. dword scr = FROM "scr.raw_8bit";
  20. dword scr_pal[] = {0xFFFFFF,0xBBDDFF,0x4166B5,0xE0E4E6,0xAFBEDD,0xC4D4E8,0x52ACDD,0x000000,
  21. 0xE9DAB2,0xC99811,0xFDF9D4,0xF8B93C,0xFDEEBE,0xFBEBA6,0xDFAF4F,0xF3D57C};
  22.  
  23.  
  24.  
  25. void CheckKosMounted()
  26. {
  27.         if (isdir("/kolibrios/"))
  28.         {
  29.                 io.run("syspanel", "/kolibrios/settings/app_plus.ini");
  30.                 ExitProcess();
  31.         }
  32. }
  33.  
  34. void RunAutosearch()
  35. {
  36.         dword searchap_run_id;
  37.         searchap_run_id = io.run("/sys/searchap",0);
  38.         while (GetProcessSlot(searchap_run_id)) pause(10);
  39. }
  40.  
  41. void main()
  42. {
  43.         word id;
  44.  
  45.         CheckKosMounted();
  46.         RunAutosearch();
  47.         CheckKosMounted();
  48.  
  49.         o_dialog.type = 2;
  50.         load_dll(Proc_lib, #OpenDialog_init,0);
  51.         OpenDialog_init stdcall (#o_dialog);
  52.  
  53.         loop() switch(WaitEvent())
  54.         {      
  55.                 case evButton:
  56.                         id=GetButtonID();              
  57.                         if (id==1) ExitProcess();
  58.                         if (id==10)
  59.                         {
  60.                                 OpenDialog_start stdcall (#o_dialog);
  61.                                 if (o_dialog.status) SetAdditionalSystemDirectory("kolibrios", #openfile_path);
  62.                                 pause(3);
  63.                                 CheckKosMounted();
  64.                         }
  65.                         break;
  66.                  
  67.                 case evReDraw:
  68.                         draw_window();
  69.         }
  70. }
  71.  
  72. #define WINDOW_TITLE_TEXT "Error"
  73. #define CONTENT_HEADER_TEXT "/KOLIBRIOS/ NOT MOUNTED"
  74. #define DESCRIPTION_TEXT "Try to find it manually. It should look
  75. like image on the right.
  76. Note: this action can be done only once
  77. per 1 session of the OS running. If you
  78. will choose the wrong folder then you
  79. need to reboot system to try again."
  80. #define MANUALLY_BUTTON_TEXT "Choose /kolibrios/ folder..."
  81.  
  82.  
  83. void draw_window()
  84. {
  85.         incn y;
  86.         dword x=30;
  87.         y.n=0;
  88.         system.color.get();
  89.         DefineAndDrawWindow(screen.width-570/2, 100, 570, 280+skin_height, 0x34, system.color.work, WINDOW_TITLE_TEXT);
  90.         GetProcessInfo(#Form, SelfInfo);
  91.         WriteTextB(x+2,y.inc(20)+2,0x81,MixColors(system.color.work, 0xB92234,220),CONTENT_HEADER_TEXT);
  92.         WriteTextB(x,y.n,0x81,0xB92234,CONTENT_HEADER_TEXT);
  93.        
  94.         WriteTextLines(x,y.inc(50),0x90,system.color.work_text,DESCRIPTION_TEXT,20);
  95.        
  96.         PutPaletteImage(#scr,144,171,Form.cwidth-180,y.n,8,#scr_pal);
  97.         DrawRectangle(Form.cwidth-180-1,y.n-1, 144+1,171+1, system.color.work_graph);
  98.        
  99.         DrawCaptButton(x,Form.cheight-66,300,30,10,system.color.work_button,system.color.work_button_text,MANUALLY_BUTTON_TEXT);
  100. }
  101.  
  102.  
  103. stop:
  104.