2015-02-17 17:46:38 +01:00
|
|
|
|
2021-06-26 19:36:34 +02:00
|
|
|
dword eolite_ini_path[4096];
|
|
|
|
_ini ini;
|
|
|
|
|
2018-04-21 14:28:00 +02:00
|
|
|
char path_start[4096];
|
2018-04-16 00:44:36 +02:00
|
|
|
edit_box path_start_ed = {290,50,57,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,4098,
|
2018-04-21 14:28:00 +02:00
|
|
|
#path_start,0, 100000000000010b,0,0};
|
2016-04-19 20:42:13 +02:00
|
|
|
|
2018-04-19 22:12:07 +02:00
|
|
|
more_less_box font_size = { NULL, 9, 22, FONT_SIZE_LABEL };
|
2018-04-19 16:16:32 +02:00
|
|
|
more_less_box line_height = { NULL, 16, 64, LIST_LINE_HEIGHT };
|
2018-04-19 22:12:07 +02:00
|
|
|
checkbox show_dev_name = { SHOW_DEVICE_CLASS };
|
|
|
|
checkbox show_status_bar = { SHOW_STATUS_BAR };
|
|
|
|
checkbox big_icons = { BIG_ICONS };
|
2018-10-01 18:41:14 +02:00
|
|
|
checkbox colored_lines = { COLORED_LINES };
|
2018-04-19 16:16:32 +02:00
|
|
|
|
|
|
|
|
2015-02-17 17:46:38 +01:00
|
|
|
void settings_dialog()
|
|
|
|
{
|
2018-04-22 15:33:01 +02:00
|
|
|
proc_info Settings;
|
2018-04-19 22:12:07 +02:00
|
|
|
int id;
|
2021-06-05 21:30:53 +02:00
|
|
|
active_settings = true;
|
2018-04-19 16:16:32 +02:00
|
|
|
font_size.value = kfont.size.pt;
|
2018-04-21 14:28:00 +02:00
|
|
|
line_height.value = files.item_h;
|
2016-04-19 20:42:13 +02:00
|
|
|
SetEventMask(0x27);
|
2015-07-16 03:44:30 +02:00
|
|
|
loop(){
|
2015-07-21 03:10:37 +02:00
|
|
|
switch(WaitEvent())
|
|
|
|
{
|
2016-04-19 20:42:13 +02:00
|
|
|
case evMouse:
|
|
|
|
edit_box_mouse stdcall (#path_start_ed);
|
|
|
|
break;
|
|
|
|
|
2015-07-21 03:10:37 +02:00
|
|
|
case evButton:
|
2015-02-17 17:46:38 +01:00
|
|
|
id=GetButtonID();
|
2018-04-19 22:12:07 +02:00
|
|
|
if (1==id) { ExitSettings(); break; }
|
2015-07-21 03:10:37 +02:00
|
|
|
else if (id==5)
|
2015-02-20 16:25:51 +01:00
|
|
|
{
|
2021-06-05 21:30:53 +02:00
|
|
|
RunProgram("/sys/@open", "/sys/settings/assoc.ini");
|
2015-02-24 18:47:47 +01:00
|
|
|
break;
|
2015-02-20 16:25:51 +01:00
|
|
|
}
|
2015-09-29 22:05:29 +02:00
|
|
|
else if (id==6)
|
|
|
|
{
|
2021-06-27 11:28:59 +02:00
|
|
|
strcpy(#path_start,path);
|
2018-04-20 11:43:15 +02:00
|
|
|
path_start_ed.size = path_start_ed.pos = strlen(#path_start);
|
2021-06-27 11:28:59 +02:00
|
|
|
ini.SetString("DefaultPath", path, strlen(path));
|
2016-04-19 20:42:13 +02:00
|
|
|
edit_box_draw stdcall (#path_start_ed);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (id==7)
|
|
|
|
{
|
2018-10-14 12:47:23 +02:00
|
|
|
SetDefaultPath(#path_start);
|
2015-09-29 22:05:29 +02:00
|
|
|
break;
|
|
|
|
}
|
2018-04-19 22:12:07 +02:00
|
|
|
show_dev_name.click(id);
|
|
|
|
show_status_bar.click(id);
|
2018-10-01 18:41:14 +02:00
|
|
|
colored_lines.click(id);
|
2018-04-19 22:12:07 +02:00
|
|
|
if (font_size.click(id)) {
|
2018-04-19 16:16:32 +02:00
|
|
|
kfont.size.pt = font_size.value;
|
|
|
|
kfont.changeSIZE();
|
|
|
|
BigFontsChange();
|
|
|
|
}
|
2018-09-17 00:30:13 +02:00
|
|
|
if (line_height.click(id)) files.item_h = files_inactive.item_h = line_height.value;
|
2018-04-19 22:12:07 +02:00
|
|
|
if (big_icons.click(id)) BigIconsSwitch();
|
2015-07-23 13:54:26 +02:00
|
|
|
EventRedrawWindow(Form.left,Form.top);
|
2018-05-02 18:32:29 +02:00
|
|
|
//RefreshWindow(Form.slot, Settings.slot);
|
2016-04-19 20:42:13 +02:00
|
|
|
break;
|
2015-07-21 03:10:37 +02:00
|
|
|
|
|
|
|
case evKey:
|
2015-08-10 12:55:14 +02:00
|
|
|
GetKeys();
|
2015-08-18 17:02:42 +02:00
|
|
|
if (key_scancode==SCAN_CODE_ESC) ExitSettings();
|
2016-04-19 20:42:13 +02:00
|
|
|
EAX= key_ascii << 8;
|
|
|
|
edit_box_key stdcall (#path_start_ed);
|
2015-02-17 17:46:38 +01:00
|
|
|
break;
|
2015-07-21 03:10:37 +02:00
|
|
|
|
|
|
|
case evReDraw:
|
2018-04-18 16:07:12 +02:00
|
|
|
DefineAndDrawWindow(Form.cwidth-300/2+Form.left, Form.cheight-292/2+Form.top, 400,
|
2021-06-28 12:55:08 +02:00
|
|
|
-efm*42+345+skin_height,0x34,sc.work,TITLE_SETT,0);
|
2018-04-22 15:33:01 +02:00
|
|
|
GetProcessInfo(#Settings, SelfInfo);
|
2015-02-24 18:47:47 +01:00
|
|
|
DrawSettingsCheckBoxes();
|
2015-07-21 03:10:37 +02:00
|
|
|
}
|
2015-02-17 17:46:38 +01:00
|
|
|
}
|
2015-02-19 08:42:42 +01:00
|
|
|
}
|
|
|
|
|
2015-08-18 17:02:42 +02:00
|
|
|
void ExitSettings()
|
|
|
|
{
|
2021-06-05 21:30:53 +02:00
|
|
|
active_settings = false;
|
2015-08-18 17:02:42 +02:00
|
|
|
settings_window = 0;
|
|
|
|
cmd_free = 4;
|
|
|
|
ExitProcess();
|
|
|
|
}
|
|
|
|
|
2015-02-24 18:47:47 +01:00
|
|
|
void DrawSettingsCheckBoxes()
|
|
|
|
{
|
2016-02-24 17:49:57 +01:00
|
|
|
incn y;
|
2021-06-17 19:06:34 +02:00
|
|
|
int but_x;
|
|
|
|
#define FRX 26
|
|
|
|
#define XXX 11
|
2016-02-24 17:49:57 +01:00
|
|
|
y.n = 0;
|
2021-06-27 11:28:59 +02:00
|
|
|
if (!efm) {
|
|
|
|
show_dev_name.draw(XXX, y.inc(14));
|
|
|
|
show_status_bar.draw(XXX, y.inc(25));
|
|
|
|
}
|
2021-06-17 19:06:34 +02:00
|
|
|
big_icons.draw(XXX, y.inc(25));
|
|
|
|
colored_lines.draw(XXX, y.inc(25));
|
|
|
|
font_size.draw(XXX, y.inc(31));
|
|
|
|
line_height.draw(XXX, y.inc(31));
|
2018-04-16 00:44:36 +02:00
|
|
|
|
2021-06-17 19:06:34 +02:00
|
|
|
DrawFrame(XXX, y.inc(37), 340, 95, START_PATH);
|
2018-04-16 00:44:36 +02:00
|
|
|
// START_PATH {
|
2021-06-17 19:06:34 +02:00
|
|
|
DrawEditBoxPos(FRX, y.inc(21), #path_start_ed);
|
|
|
|
but_x = DrawStandartCaptButton(FRX, y.inc(34), 6, SAVE_PATH_AS_DEFAULT);
|
|
|
|
DrawStandartCaptButton(FRX+but_x, y.inc(0), 7, SAVE_START_PATH_AS_DEFAULT);
|
2018-04-16 00:44:36 +02:00
|
|
|
// } START_PATH
|
|
|
|
|
2021-06-17 19:06:34 +02:00
|
|
|
DrawStandartCaptButton(XXX, y.inc(52), 5, EDIT_FILE_ASSOCIATIONS);
|
2015-02-24 18:47:47 +01:00
|
|
|
}
|
|
|
|
|
2015-02-19 08:42:42 +01:00
|
|
|
|
2015-02-21 13:24:30 +01:00
|
|
|
void LoadIniSettings()
|
2015-02-19 08:42:42 +01:00
|
|
|
{
|
2018-10-03 01:32:56 +02:00
|
|
|
ini.path = GetIni(#eolite_ini_path, "app.ini");
|
2021-06-05 21:30:53 +02:00
|
|
|
if (efm) ini.section = "EFM"; else ini.section = "Eolite";
|
2018-03-22 00:26:31 +01:00
|
|
|
|
2021-06-26 09:59:13 +02:00
|
|
|
files.SetFont(6, 9, 10000000b);
|
2018-04-19 22:12:07 +02:00
|
|
|
show_dev_name.checked = ini.GetInt("ShowDeviceName", true);
|
|
|
|
show_status_bar.checked = ini.GetInt("ShowStatusBar", true);
|
2018-09-17 00:30:13 +02:00
|
|
|
big_icons.checked = ini.GetInt("BigIcons", false); BigIconsSwitch();
|
2021-06-12 23:12:15 +02:00
|
|
|
colored_lines.checked = ini.GetInt("ColoredLines", true);
|
2018-03-22 00:26:31 +01:00
|
|
|
kfont.size.pt = ini.GetInt("FontSize", 13);
|
|
|
|
files.item_h = ini.GetInt("LineHeight", 19);
|
2021-06-05 21:30:53 +02:00
|
|
|
Form.left = ini.GetInt("WinX", 100);
|
|
|
|
Form.top = ini.GetInt("WinY", 30);
|
|
|
|
Form.width = ini.GetInt("WinW", efm*170+550);
|
2021-06-12 23:12:15 +02:00
|
|
|
Form.height = ini.GetInt("WinH", efm*100+517);
|
2021-06-29 22:31:23 +02:00
|
|
|
ini.GetString("DefaultPath", #path_start, 4096, "/sys");
|
2018-04-21 14:28:00 +02:00
|
|
|
path_start_ed.size = path_start_ed.pos = strlen(#path_start);
|
2021-06-17 11:29:39 +02:00
|
|
|
kfont.init(DEFAULT_FONT);
|
2015-12-16 17:13:34 +01:00
|
|
|
ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on");
|
2021-06-17 11:29:39 +02:00
|
|
|
if(streq(#temp,"off")) kfont.smooth = false; else kfont.smooth = true;
|
2015-02-19 08:42:42 +01:00
|
|
|
}
|
|
|
|
|
2015-08-06 18:13:03 +02:00
|
|
|
|
2015-02-21 13:24:30 +01:00
|
|
|
void SaveIniSettings()
|
|
|
|
{
|
2018-04-19 22:12:07 +02:00
|
|
|
ini.SetInt("ShowDeviceName", show_dev_name.checked);
|
|
|
|
ini.SetInt("ShowStatusBar", show_status_bar.checked);
|
2018-09-17 00:30:13 +02:00
|
|
|
ini.SetInt("BigIcons", big_icons.checked);
|
2018-10-01 18:41:14 +02:00
|
|
|
ini.SetInt("ColoredLines", colored_lines.checked);
|
|
|
|
ini.SetInt("FontSize", kfont.size.pt);
|
2018-03-22 00:26:31 +01:00
|
|
|
ini.SetInt("LineHeight", files.item_h);
|
2021-06-05 21:30:53 +02:00
|
|
|
if (Form.status_window<=2) {
|
|
|
|
ini.SetInt("WinX", Form.left);
|
|
|
|
ini.SetInt("WinY", Form.top);
|
|
|
|
ini.SetInt("WinW", Form.width);
|
|
|
|
ini.SetInt("WinH", Form.height);
|
|
|
|
}
|
2015-02-21 13:24:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-19 08:42:42 +01:00
|
|
|
|
|
|
|
void Write_Error(int error_number)
|
|
|
|
{
|
|
|
|
char error_message[500];
|
2021-12-18 16:21:21 +01:00
|
|
|
sprintf(#error_message,"\"Eolite\n%s\" -tE", get_error(error_number));
|
2015-07-29 14:14:49 +02:00
|
|
|
notify(#error_message);
|
2015-02-19 08:42:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-18 11:38:01 +02:00
|
|
|
void LoadIcons()
|
|
|
|
{
|
2021-06-07 23:45:46 +02:00
|
|
|
dword selected_shadow = MixColors(col.selec, 0, 200);
|
|
|
|
dword non_white_shadow = MixColors(col.list_bg, 0, 200);
|
|
|
|
if (big_icons.checked)
|
|
|
|
{
|
2020-05-27 18:08:11 +02:00
|
|
|
icons32_default.load("/sys/icons32.png");
|
|
|
|
icons32_selected.load("/sys/icons32.png");
|
2021-06-07 23:45:46 +02:00
|
|
|
//FUUUUUU... the next ugly code may replace the previous line
|
|
|
|
//we are copying raw data without loading and unpycking PNG
|
|
|
|
//memmov(icons32_selected.imgsrc, icons32_default.imgsrc, icons32_default.h*32*4);
|
|
|
|
//EDI = icons32_selected.image;
|
|
|
|
//ESDWORD[EDI+04] = 32;
|
|
|
|
//ESDWORD[EDI+08] = icons32_default.h;
|
|
|
|
//ESDWORD[EDI+20] = IMAGE_BPP32;
|
|
|
|
//ESDWORD[EDI+24] = icons32_selected.imgsrc;
|
2020-05-27 18:08:11 +02:00
|
|
|
icons32_default.replace_color(0x00000000, col.list_bg);
|
2021-06-07 23:45:46 +02:00
|
|
|
icons32_selected.replace_color(0x00000000, col.selec);
|
|
|
|
} else {
|
|
|
|
icons16_default.load("/sys/icons16.png");
|
|
|
|
icons16_selected.load("/sys/icons16.png");
|
|
|
|
icons16_selected.replace_2colors(0xffFFFfff, col.selec, 0xffCACBD6, selected_shadow);
|
|
|
|
if (col.list_bg!=0xFFFfff) {
|
2021-06-14 02:36:42 +02:00
|
|
|
icons16_default.replace_2colors(0xffFFFfff, col.list_bg, 0xffCACBD6, non_white_shadow);
|
2021-06-07 23:45:46 +02:00
|
|
|
}
|
2020-05-27 18:08:11 +02:00
|
|
|
}
|
2021-06-07 23:45:46 +02:00
|
|
|
|
2019-04-18 11:38:01 +02:00
|
|
|
}
|
|
|
|
|
2015-02-19 08:42:42 +01:00
|
|
|
void SetAppColors()
|
|
|
|
{
|
2018-10-14 12:47:23 +02:00
|
|
|
int i;
|
2020-04-18 01:52:24 +02:00
|
|
|
static dword bg_col;
|
|
|
|
dword old_list_bg_color = col.list_bg;
|
|
|
|
sc.get();
|
2020-04-22 22:42:35 +02:00
|
|
|
sc.work_dark = MixColors(0, sc.work, 35);
|
2020-05-16 15:32:10 +02:00
|
|
|
if (sc.work == 0) sc.work = 1;
|
2020-04-18 01:52:24 +02:00
|
|
|
if (bg_col == sc.work) return;
|
|
|
|
bg_col = sc.work;
|
2020-04-13 13:51:56 +02:00
|
|
|
if (skin_is_dark())
|
2019-04-17 14:11:31 +02:00
|
|
|
{
|
|
|
|
//use dark colors
|
2021-06-28 12:55:08 +02:00
|
|
|
col.skin_is_dark = true;
|
2020-04-18 01:52:24 +02:00
|
|
|
col.list_bg = sc.work;
|
|
|
|
col.list_gb_text = sc.work_text;
|
2019-04-17 14:11:31 +02:00
|
|
|
col.list_text_hidden = 0xA6A6B7;
|
2020-04-18 01:52:24 +02:00
|
|
|
col.list_vert_line = sc.work_graph;
|
|
|
|
col.lpanel = MixColors(sc.work_graph, sc.work, 65);
|
|
|
|
col.selec = col.selec_active = sc.button;
|
|
|
|
col.selec_text = sc.button_text;
|
|
|
|
if (col.list_bg==col.selec) col.selec = sc.work_graph; //for fucking skins
|
|
|
|
col.slider_bg_big = MixColors(0xCED0D0, sc.work, 35);
|
|
|
|
col.odd_line = MixColors(0xFFFfff, sc.work, 15);
|
2020-11-23 14:31:55 +01:00
|
|
|
for (i=0; blue_hl_pal[i]!=0; i++) waves_pal[i] = MixColors(col.lpanel, blue_hl_pal[i], 180);
|
2019-04-17 14:11:31 +02:00
|
|
|
}
|
2020-04-13 13:51:56 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
//use light colors
|
2021-06-28 12:55:08 +02:00
|
|
|
col.skin_is_dark = false;
|
2020-04-13 13:51:56 +02:00
|
|
|
col.list_bg = 0xFFFfff;
|
|
|
|
col.list_gb_text = 0x000000;
|
|
|
|
col.list_text_hidden = 0xA6A6B7;
|
|
|
|
col.list_vert_line = 0xDDD7CF;
|
|
|
|
col.lpanel = 0x00699C;
|
2021-06-07 22:03:19 +02:00
|
|
|
col.selec = col.selec_active = 0x92B1D9;
|
2020-04-13 13:51:56 +02:00
|
|
|
col.selec_text = 0x000000;
|
|
|
|
col.slider_bg_big = 0xCDCFCF;
|
2021-06-07 22:03:19 +02:00
|
|
|
col.odd_line = 0xF4F5F5;
|
2020-11-23 14:31:55 +01:00
|
|
|
for (i=0; blue_hl_pal[i]!=0; i++) waves_pal[i] = blue_hl_pal[i];
|
2020-04-13 13:51:56 +02:00
|
|
|
}
|
2019-04-17 14:11:31 +02:00
|
|
|
col.selec_inactive = MixColors(0xBBBbbb, col.list_bg, 65);
|
2020-04-18 01:52:24 +02:00
|
|
|
col.slider_bg_left = MixColors(sc.work_graph, col.slider_bg_big, 10);
|
|
|
|
for (i=0; i<20; i++) col.work_gradient[i] = MixColors(sc.work_light, sc.work, i*5);
|
2019-04-18 11:38:01 +02:00
|
|
|
if (old_list_bg_color!=col.list_bg) LoadIcons();
|
2015-02-24 18:47:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-06 18:13:03 +02:00
|
|
|
void BigFontsChange()
|
|
|
|
{
|
2016-12-21 20:50:13 +01:00
|
|
|
files.item_h = kfont.size.pt + 4;
|
2018-09-17 00:30:13 +02:00
|
|
|
if (files.item_h<icon_size+3) {
|
|
|
|
files.item_h = icon_size+3;
|
|
|
|
line_height.value = files.item_h;
|
|
|
|
line_height.redraw();
|
|
|
|
}
|
2015-09-09 16:24:42 +02:00
|
|
|
files_active.item_h = files_inactive.item_h = files.item_h;
|
2015-08-06 18:13:03 +02:00
|
|
|
}
|
2018-04-19 22:12:07 +02:00
|
|
|
|
|
|
|
void BigIconsSwitch()
|
|
|
|
{
|
2020-05-27 18:08:11 +02:00
|
|
|
if (big_icons.checked) {
|
2021-06-10 13:18:19 +02:00
|
|
|
icon_size = 32;
|
2020-05-27 18:08:11 +02:00
|
|
|
LoadIcons();
|
|
|
|
} else {
|
2021-06-10 13:18:19 +02:00
|
|
|
icon_size = icons16_default.w;
|
2020-05-27 18:08:11 +02:00
|
|
|
}
|
2018-09-17 00:30:13 +02:00
|
|
|
BigFontsChange();
|
2018-04-19 22:12:07 +02:00
|
|
|
}
|
2018-10-14 12:47:23 +02:00
|
|
|
|
|
|
|
void SetDefaultPath(dword p)
|
|
|
|
{
|
|
|
|
ini.SetString("DefaultPath", p, strlen(p));
|
|
|
|
notify("'Default path has been set' -O");
|
|
|
|
}
|