From 2ece3b26d7d5bb8a10bc7462a66636052def28aa Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 21 Mar 2018 23:26:31 +0000 Subject: [PATCH] Pixie2 Pre-Final: bugfixes Eolite: simplier ini-related code git-svn-id: svn://kolibrios.org@7202 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/eolite/Eolite.c | 7 ++- programs/cmm/eolite/include/about.h | 2 - programs/cmm/eolite/include/settings.h | 56 +++++++++++----------- programs/cmm/eolite/include/translations.h | 4 +- programs/cmm/lib/file_system.h | 19 ++++---- programs/cmm/pixie2/pixie.c | 9 +--- programs/cmm/pixie2/settings.h | 2 +- 7 files changed, 46 insertions(+), 53 deletions(-) diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index e3911c885e..2caaade08c 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -1,4 +1,4 @@ -//Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2016 +//Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2018 //GNU GPL licence. #ifndef AUTOBUILD @@ -83,7 +83,8 @@ byte char active_path[4096], inactive_path[4096]; -dword eolite_ini_path; +dword eolite_ini_path[4096]; +_ini ini; char scroll_used=false; @@ -148,8 +149,6 @@ void main() load_dll(libini, #lib_init,1); load_dll(libio, #libio_init,1); load_dll(libimg, #libimg_init,1); - - eolite_ini_path = GetIni("Eolite.ini"); LoadIniSettings(); SystemDiscs.Get(); diff --git a/programs/cmm/eolite/include/about.h b/programs/cmm/eolite/include/about.h index 0d1953fc60..44957ab13b 100644 --- a/programs/cmm/eolite/include/about.h +++ b/programs/cmm/eolite/include/about.h @@ -1,5 +1,3 @@ -//Leency 2008-2016 - #define BROWSER_PATH "/sys/network/webview" #define BROWSER_LINK "http://kolibri-n.org/inf/eolite/eolite_p1" diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h index 579676b2a4..6fdb35289a 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -29,7 +29,6 @@ ?define START_PATH "Start path:" #endif -char config_section[] = "Config"; int WinX, WinY, WinW, WinH; dword set_mouse_dd; @@ -61,13 +60,13 @@ void settings_dialog() strcpy(#path_start,#path); path_start_ed.size = strlen(#path_start); path_start_ed.pos = strlen(#path_start); - ini_set_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path,strlen(#path)); + ini.SetString("DefaultPath", #path, strlen(#path)); edit_box_draw stdcall (#path_start_ed); break; } else if (id==7) { - ini_set_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path_start,strlen(#path_start)); + ini.SetString("DefaultPath", #path_start,strlen(#path_start)); break; } else if (id==20) show_dev_name ^= 1; @@ -130,20 +129,23 @@ void DrawSettingsCheckBoxes() void LoadIniSettings() { + ini.path = GetIni(#eolite_ini_path, "EOLITE.INI"); + ini.section = "Config"; + files.SetFont(6, 9, 10000000b); - ini_get_int stdcall (eolite_ini_path, #config_section, "ShowDeviceName", 1); show_dev_name = EAX; - ini_get_int stdcall (eolite_ini_path, #config_section, "ShowStatusBar", 1); show_status_bar = EAX; - ini_get_int stdcall (eolite_ini_path, #config_section, "RealFileNamesCase", 1); real_files_names_case = EAX; - ini_get_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", 0); info_after_copy = EAX; - ini_get_int stdcall (eolite_ini_path, #config_section, "FontSize", 13); kfont.size.pt = EAX; - ini_get_int stdcall (eolite_ini_path, #config_section, "TwoPanels", 0); two_panels = EAX; - ini_get_int stdcall (eolite_ini_path, #config_section, "LineHeight", 19); files.item_h = EAX; - ini_get_int stdcall (eolite_ini_path, #config_section, "WinX", 200); WinX = EAX; - ini_get_int stdcall (eolite_ini_path, #config_section, "WinY", 50); WinY = EAX; - ini_get_int stdcall (eolite_ini_path, #config_section, "WinW", 550); WinW = EAX; - ini_get_int stdcall (eolite_ini_path, #config_section, "WinH", 506); WinH = EAX; - ini_get_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path,4096,"/rd/1"); - ini_get_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path_start,4096,"/rd/1"); + real_files_names_case = ini.GetInt("RealFileNamesCase", 1); + show_dev_name = ini.GetInt("ShowDeviceName", 1); + show_status_bar = ini.GetInt("ShowStatusBar", 1); + info_after_copy = ini.GetInt("InfoAfterCopy", 0); + kfont.size.pt = ini.GetInt("FontSize", 13); + two_panels = ini.GetInt("TwoPanels", 0); + files.item_h = ini.GetInt("LineHeight", 19); + WinX = ini.GetInt("WinX", 200); + WinY = ini.GetInt("WinY", 50); + WinW = ini.GetInt("WinW", 550); + WinH = ini.GetInt("WinH", 506); + ini.GetString("DefaultPath", #path, 4096, "/rd/1"); + ini.GetString("DefaultPath", #path_start, 4096, "/rd/1"); path_start_ed.size = strlen(#path_start); path_start_ed.pos = strlen(#path_start); @@ -156,17 +158,17 @@ void LoadIniSettings() void SaveIniSettings() { - ini_set_int stdcall (eolite_ini_path, #config_section, "ShowDeviceName", show_dev_name); - ini_set_int stdcall (eolite_ini_path, #config_section, "ShowStatusBar", show_status_bar); - ini_set_int stdcall (eolite_ini_path, #config_section, "RealFileNamesCase", real_files_names_case); - ini_set_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", info_after_copy); - ini_set_int stdcall (eolite_ini_path, #config_section, "FontSize", kfont.size.pt); - ini_set_int stdcall (eolite_ini_path, #config_section, "TwoPanels", two_panels); - ini_set_int stdcall (eolite_ini_path, #config_section, "LineHeight", files.item_h); - ini_set_int stdcall (eolite_ini_path, #config_section, "WinX", Form.left); - ini_set_int stdcall (eolite_ini_path, #config_section, "WinY", Form.top); - ini_set_int stdcall (eolite_ini_path, #config_section, "WinW", Form.width); - ini_set_int stdcall (eolite_ini_path, #config_section, "WinH", Form.height); + ini.SetInt("ShowDeviceName", show_dev_name); + ini.SetInt("ShowStatusBar", show_status_bar); + ini.SetInt("RealFileNamesCase", real_files_names_case); + ini.SetInt("InfoAfterCopy", info_after_copy); + ini.SetInt("FontSize", kfont.size.pt); + ini.SetInt("TwoPanels", two_panels); + ini.SetInt("LineHeight", files.item_h); + ini.SetInt("WinX", Form.left); + ini.SetInt("WinY", Form.top); + ini.SetInt("WinW", Form.width); + ini.SetInt("WinH", Form.height); } diff --git a/programs/cmm/eolite/include/translations.h b/programs/cmm/eolite/include/translations.h index dc55c797c1..bac43ecc4f 100644 --- a/programs/cmm/eolite/include/translations.h +++ b/programs/cmm/eolite/include/translations.h @@ -1,5 +1,5 @@ -#define TITLE "Eolite File Manager v3.82" -#define ABOUT_TITLE "EOLITE 3.82" +#define TITLE "Eolite File Manager v3.83" +#define ABOUT_TITLE "EOLITE 3.83" #ifdef LANG_RUS ?define T_FILE "” ©«" diff --git a/programs/cmm/lib/file_system.h b/programs/cmm/lib/file_system.h index fe33515917..a557f57b21 100644 --- a/programs/cmm/lib/file_system.h +++ b/programs/cmm/lib/file_system.h @@ -197,13 +197,13 @@ $int 0x40 } -:char dir_exists(dword fpath) +:bool dir_exists(dword fpath) { BDVK fpath_atr; if (GetFileInfo(fpath, #fpath_atr) != 0) return false; return fpath_atr.isfolder; } -:char file_exists(dword fpath) +:bool file_exists(dword fpath) { BDVK ReadFile_atr; if (! GetFileInfo(fpath, #ReadFile_atr)) return true; @@ -285,16 +285,15 @@ enum return #absolute_path; } -:dword GetIni(dword ini_name) //search it on /kolibrios/ then on /sys/ +:dword GetIni(dword ini_path, ini_name) //search it on /kolibrios/ then on /sys/ { - char absolute_path[4096]; - strcpy(#absolute_path, "/kolibrios/settings/"); - strcat(#absolute_path, ini_name); - if (!file_exists(#absolute_path)) { - strcpy(#absolute_path, "/sys/settings/"); - strcat(#absolute_path, ini_name); + strcpy(ini_path, "/kolibrios/settings/"); + strcat(ini_path, ini_name); + if (!file_exists(ini_path)) { + strcpy(ini_path, "/sys/settings/"); + strcat(ini_path, ini_name); } - return #absolute_path; + return ini_path; } :byte ConvertSize_size_prefix[8]; diff --git a/programs/cmm/pixie2/pixie.c b/programs/cmm/pixie2/pixie.c index c50b5d38de..7b39057ac2 100644 --- a/programs/cmm/pixie2/pixie.c +++ b/programs/cmm/pixie2/pixie.c @@ -31,7 +31,7 @@ char default_dir[] = "/rd/1"; od_filter filter2 = { 15, "MP3\0WAV\0XM\0\0" }; -#define ABOUT_MESSAGE "Pixie Player v2.8 +#define ABOUT_MESSAGE "Pixie Player v2.81 A tiny music folder player. Supports MP3, WAV, XM audio file formats. @@ -118,9 +118,6 @@ void LoadLibraries() void main() { - int tempstr; - tempstr = abspath("pixie.ini"); - strcpy(#pixie_ini_path, tempstr); list.SetFont(8, 16, 13); LoadLibraries(); LoadIniConfig(); @@ -215,7 +212,6 @@ void DrawPlayList() { strcpy(#temp_filename, files_mas[i + list.first] * 304 + buf + 72); temp_filename[strrchr(#temp_filename, '.')-1] = '\0'; - //if (strlen(#temp_filename)>47) strcpy(#temp_filename+44, "..."); yyy = i*list.item_h+list.y; @@ -510,13 +506,12 @@ void EventDeleteItem() if (list.cur_y == current_playing_file_n) EventStopPlaying(); for (i=list.cur_y; i