Subversion Repositories Kolibri OS

Rev

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

  1. //Leency 2008-2015
  2.  
  3. #define EDITOR_PATH     "/sys/tinypad"
  4.  
  5. #ifdef LANG_RUS
  6.         ?define EDIT_FILE_ASSOCIATIONS "¥¤ ªâ¨à®¢ âì  áá®æ¨ æ¨¨ ä ©«®¢"
  7.         ?define TITLE_SETT " áâனª¨"
  8.         ?define SET_1 "‚뢮¤¨âì ­ §¢ ­¨ï ª« áá  ãáâனáâ¢"
  9.         ?define SET_2 "®ª §ë¢ âì ¨¬¥­  ä ©«®¢ ­¥ ¬¥­ïï ॣ¨áâà"
  10.         ?define SET_3 "‚ëá®â  áâப¨ ¢ ᯨ᪥"
  11.         ?define CANCEL_T "Žâ¬¥­ "
  12.         ?define APPLY_T "à¨¬¥­¨âì"
  13. #else
  14.         ?define EDIT_FILE_ASSOCIATIONS "Edit file associations"
  15.         ?define TITLE_SETT "Settings"
  16.         ?define SET_1 "Show device class name"
  17.         ?define SET_2 "Show real file names without changing case"
  18.         ?define SET_3 "List line height"
  19.         ?define CANCEL_T "Cancel"
  20.         ?define APPLY_T "Apply"
  21. #endif
  22.  
  23. int     mouse_ddd;
  24. char lineh_s[30]="18\0";
  25. edit_box LineHeight_ed = {52,10,70,0xffffff,0x94AECE,0xffc90E,0xffffff,2,4,#lineh_s,#mouse_ddd, 1000000000000000b,2,2};
  26. checkbox2 ShowDeviceName_chb = {10*65536+15, 10*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, SET_1, CH_FLAG_MIDDLE, 0};
  27. checkbox2 RealFileNamesCase_chb = {10*65536+15, 30*65536+15, 5, 0xffffff, 0x9098B0, 0x80000000, SET_2, CH_FLAG_MIDDLE, 0};
  28.  
  29. void settings_dialog()
  30. {  
  31.         byte id;
  32.         unsigned int key;
  33.         proc_info settings_form;
  34.         dword eolite_ini_path = abspath("Eolite.ini");
  35.  
  36.         if (active_about) ExitProcess();
  37.         active_about=1;
  38.  
  39.         ShowDeviceName_chb.size_of_str = strlen(SET_1) * 6;
  40.         RealFileNamesCase_chb.size_of_str = strlen(SET_2) * 6;
  41.  
  42.         SetEventMask(0x27);
  43.         loop() switch(WaitEvent())
  44.         {
  45.                 case evButton:
  46.                                 id=GetButtonID();
  47.                                 if (id==10)
  48.                                 {
  49.                                         if ( asm test ShowDeviceName_chb.flags, 2) ini_set_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", 1);
  50.                                         ELSE  ini_set_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", 0);
  51.                                         if ( asm test RealFileNamesCase_chb.flags, 2) ini_set_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", 1);
  52.                                         ELSE ini_set_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", 0);
  53.                                         if (LineHeight_ed.size) ini_set_int stdcall (eolite_ini_path, "Config", "LineHeight", atoi(#lineh_s));
  54.                                         active_about=0;
  55.                                         action_buf = 300;
  56.                                         ExitProcess();
  57.                                 }                                      
  58.                                 if (id==1) || (id==11)
  59.                                 {
  60.                                         active_about=0;
  61.                                         ExitProcess();
  62.                                 }
  63.                                 if (id==5)
  64.                                 {
  65.                                         RunProgram("tinypad", "/sys/settings/assoc.ini");
  66.                                 }
  67.                                 break;
  68.                                
  69.                 case evKey:
  70.                                 key = GetKey();
  71.                                 if (key==27)
  72.                                 {
  73.                                         active_about=0;
  74.                                         action_buf = 300;
  75.                                         ExitProcess();
  76.                                 }
  77.                                 EAX=key<<8;
  78.                                 edit_box_key stdcall(#LineHeight_ed);
  79.                                 break;
  80.                                
  81.                 case evMouse:
  82.                                 check_box_mouse stdcall (#ShowDeviceName_chb);
  83.                                 check_box_mouse stdcall (#RealFileNamesCase_chb);
  84.                                 edit_box_mouse stdcall (#LineHeight_ed);
  85.                                 break;
  86.                        
  87.                 case evReDraw:
  88.                                 DefineAndDrawWindow(Form.left + 100, 150, 300, 200+GetSkinHeight(),0x34,sc.work,TITLE_SETT);
  89.                                 GetProcessInfo(#settings_form, SelfInfo);
  90.                                
  91.                                 if (show_dev_name) ShowDeviceName_chb.flags = 110b;
  92.                                 ELSE  ShowDeviceName_chb.flags = 100b;
  93.                                
  94.                                 if (real_files_names_case) RealFileNamesCase_chb.flags = 110b;
  95.                                 ELSE RealFileNamesCase_chb.flags = 100b;
  96.                                
  97.                                 key = itoa(files.line_h);
  98.                                 strcpy(#lineh_s, key);
  99.                                
  100.                                 check_box_draw stdcall (#ShowDeviceName_chb);
  101.                                 check_box_draw stdcall (#RealFileNamesCase_chb);
  102.                                 edit_box_draw stdcall (#LineHeight_ed);
  103.                                 DrawRectangle(LineHeight_ed.left-1, LineHeight_ed.top-1, LineHeight_ed.width+2, 16, sc.work_graph);
  104.                                 WriteText(10, 57, 0x80, 0x000000, SET_3);
  105.                                 DrawFlatButton(9, 100, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
  106.                                 DrawFlatButton(128, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, APPLY_T);
  107.                                 DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, CANCEL_T);
  108.         }
  109. }
  110.  
  111.  
  112. void GetIni()
  113. {
  114.         dword eolite_ini_path = abspath("Eolite.ini");
  115.         ini_get_color stdcall (eolite_ini_path, "Config", "SelectionColor", 0x94AECE);
  116.         edit2.shift_color = EAX;
  117.         col_selec = EAX;
  118.         ini_get_int stdcall (eolite_ini_path, "Config", "LineHeight", 18);
  119.         files.line_h = EAX;
  120.         ini_get_int stdcall (eolite_ini_path, "Config", "ShowDeviceName", 1);
  121.         show_dev_name = EAX;
  122.         ini_get_int stdcall (eolite_ini_path, "Config", "RealFileNamesCase", 0);
  123.         real_files_names_case = EAX;
  124. }
  125.  
  126.  
  127. void Write_Error(int error_number)
  128. {
  129.         char error_message[500];
  130.         dword ii;
  131.         if (files.current>=0) Line_ReDraw(0xFF0000, files.current);
  132.         pause(5);
  133.         strcpy(#error_message, "\"Eolite\n");
  134.         ii = get_error(error_number);
  135.         strcat(#error_message, ii);
  136.         strcat(#error_message, "\" -tE");
  137.         notify(#error_message);
  138. }
  139.  
  140.  
  141. void SetAppColors()
  142. {
  143.         sc.work = 0xE4DFE1;
  144.         sc.work_text = 0;
  145.         sc.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
  146.         sc.work_button_text = 0x000000;
  147.         col_padding = 0xC8C9C9;
  148.         //col_selec   = 0x94AECE;
  149.         col_lpanel  = 0x00699C;
  150.         /*
  151.         sc.get();
  152.         for (i=0; i<=14; i++) col_palette[i] = sc.work;
  153.         toolbar_pal[0]= goto_about_pal[0] = sc.work = sc.work;
  154.         col_lpanel = sc.work_graph;
  155.         for (i=0; i<=99; i++) blue_hl_pal[i] = sc.work_graph;
  156.         */
  157. }