Pixie2 Pre-Final: bugfixes

Eolite: simplier ini-related code

git-svn-id: svn://kolibrios.org@7202 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2018-03-21 23:26:31 +00:00
parent 1b63551705
commit 2ece3b26d7
7 changed files with 46 additions and 53 deletions

View File

@ -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. //GNU GPL licence.
#ifndef AUTOBUILD #ifndef AUTOBUILD
@ -83,7 +83,8 @@ byte
char active_path[4096], inactive_path[4096]; char active_path[4096], inactive_path[4096];
dword eolite_ini_path; dword eolite_ini_path[4096];
_ini ini;
char scroll_used=false; char scroll_used=false;
@ -148,8 +149,6 @@ void main()
load_dll(libini, #lib_init,1); load_dll(libini, #lib_init,1);
load_dll(libio, #libio_init,1); load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1); load_dll(libimg, #libimg_init,1);
eolite_ini_path = GetIni("Eolite.ini");
LoadIniSettings(); LoadIniSettings();
SystemDiscs.Get(); SystemDiscs.Get();

View File

@ -1,5 +1,3 @@
//Leency 2008-2016
#define BROWSER_PATH "/sys/network/webview" #define BROWSER_PATH "/sys/network/webview"
#define BROWSER_LINK "http://kolibri-n.org/inf/eolite/eolite_p1" #define BROWSER_LINK "http://kolibri-n.org/inf/eolite/eolite_p1"

View File

@ -29,7 +29,6 @@
?define START_PATH "Start path:" ?define START_PATH "Start path:"
#endif #endif
char config_section[] = "Config";
int WinX, WinY, WinW, WinH; int WinX, WinY, WinW, WinH;
dword set_mouse_dd; dword set_mouse_dd;
@ -61,13 +60,13 @@ void settings_dialog()
strcpy(#path_start,#path); strcpy(#path_start,#path);
path_start_ed.size = strlen(#path_start); path_start_ed.size = strlen(#path_start);
path_start_ed.pos = 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); edit_box_draw stdcall (#path_start_ed);
break; break;
} }
else if (id==7) 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; break;
} }
else if (id==20) show_dev_name ^= 1; else if (id==20) show_dev_name ^= 1;
@ -130,20 +129,23 @@ void DrawSettingsCheckBoxes()
void LoadIniSettings() void LoadIniSettings()
{ {
ini.path = GetIni(#eolite_ini_path, "EOLITE.INI");
ini.section = "Config";
files.SetFont(6, 9, 10000000b); files.SetFont(6, 9, 10000000b);
ini_get_int stdcall (eolite_ini_path, #config_section, "ShowDeviceName", 1); show_dev_name = EAX; real_files_names_case = ini.GetInt("RealFileNamesCase", 1);
ini_get_int stdcall (eolite_ini_path, #config_section, "ShowStatusBar", 1); show_status_bar = EAX; show_dev_name = ini.GetInt("ShowDeviceName", 1);
ini_get_int stdcall (eolite_ini_path, #config_section, "RealFileNamesCase", 1); real_files_names_case = EAX; show_status_bar = ini.GetInt("ShowStatusBar", 1);
ini_get_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", 0); info_after_copy = EAX; info_after_copy = ini.GetInt("InfoAfterCopy", 0);
ini_get_int stdcall (eolite_ini_path, #config_section, "FontSize", 13); kfont.size.pt = EAX; kfont.size.pt = ini.GetInt("FontSize", 13);
ini_get_int stdcall (eolite_ini_path, #config_section, "TwoPanels", 0); two_panels = EAX; two_panels = ini.GetInt("TwoPanels", 0);
ini_get_int stdcall (eolite_ini_path, #config_section, "LineHeight", 19); files.item_h = EAX; files.item_h = ini.GetInt("LineHeight", 19);
ini_get_int stdcall (eolite_ini_path, #config_section, "WinX", 200); WinX = EAX; WinX = ini.GetInt("WinX", 200);
ini_get_int stdcall (eolite_ini_path, #config_section, "WinY", 50); WinY = EAX; WinY = ini.GetInt("WinY", 50);
ini_get_int stdcall (eolite_ini_path, #config_section, "WinW", 550); WinW = EAX; WinW = ini.GetInt("WinW", 550);
ini_get_int stdcall (eolite_ini_path, #config_section, "WinH", 506); WinH = EAX; WinH = ini.GetInt("WinH", 506);
ini_get_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path,4096,"/rd/1"); ini.GetString("DefaultPath", #path, 4096, "/rd/1");
ini_get_str stdcall (eolite_ini_path, #config_section, "DefaultPath", #path_start,4096,"/rd/1"); ini.GetString("DefaultPath", #path_start, 4096, "/rd/1");
path_start_ed.size = strlen(#path_start); path_start_ed.size = strlen(#path_start);
path_start_ed.pos = strlen(#path_start); path_start_ed.pos = strlen(#path_start);
@ -156,17 +158,17 @@ void LoadIniSettings()
void SaveIniSettings() void SaveIniSettings()
{ {
ini_set_int stdcall (eolite_ini_path, #config_section, "ShowDeviceName", show_dev_name); ini.SetInt("ShowDeviceName", show_dev_name);
ini_set_int stdcall (eolite_ini_path, #config_section, "ShowStatusBar", show_status_bar); ini.SetInt("ShowStatusBar", show_status_bar);
ini_set_int stdcall (eolite_ini_path, #config_section, "RealFileNamesCase", real_files_names_case); ini.SetInt("RealFileNamesCase", real_files_names_case);
ini_set_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", info_after_copy); ini.SetInt("InfoAfterCopy", info_after_copy);
ini_set_int stdcall (eolite_ini_path, #config_section, "FontSize", kfont.size.pt); ini.SetInt("FontSize", kfont.size.pt);
ini_set_int stdcall (eolite_ini_path, #config_section, "TwoPanels", two_panels); ini.SetInt("TwoPanels", two_panels);
ini_set_int stdcall (eolite_ini_path, #config_section, "LineHeight", files.item_h); ini.SetInt("LineHeight", files.item_h);
ini_set_int stdcall (eolite_ini_path, #config_section, "WinX", Form.left); ini.SetInt("WinX", Form.left);
ini_set_int stdcall (eolite_ini_path, #config_section, "WinY", Form.top); ini.SetInt("WinY", Form.top);
ini_set_int stdcall (eolite_ini_path, #config_section, "WinW", Form.width); ini.SetInt("WinW", Form.width);
ini_set_int stdcall (eolite_ini_path, #config_section, "WinH", Form.height); ini.SetInt("WinH", Form.height);
} }

View File

@ -1,5 +1,5 @@
#define TITLE "Eolite File Manager v3.82" #define TITLE "Eolite File Manager v3.83"
#define ABOUT_TITLE "EOLITE 3.82" #define ABOUT_TITLE "EOLITE 3.83"
#ifdef LANG_RUS #ifdef LANG_RUS
?define T_FILE "” ©«" ?define T_FILE "” ©«"

View File

@ -197,13 +197,13 @@
$int 0x40 $int 0x40
} }
:char dir_exists(dword fpath) :bool dir_exists(dword fpath)
{ {
BDVK fpath_atr; BDVK fpath_atr;
if (GetFileInfo(fpath, #fpath_atr) != 0) return false; if (GetFileInfo(fpath, #fpath_atr) != 0) return false;
return fpath_atr.isfolder; return fpath_atr.isfolder;
} }
:char file_exists(dword fpath) :bool file_exists(dword fpath)
{ {
BDVK ReadFile_atr; BDVK ReadFile_atr;
if (! GetFileInfo(fpath, #ReadFile_atr)) return true; if (! GetFileInfo(fpath, #ReadFile_atr)) return true;
@ -285,16 +285,15 @@ enum
return #absolute_path; 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(ini_path, "/kolibrios/settings/");
strcpy(#absolute_path, "/kolibrios/settings/"); strcat(ini_path, ini_name);
strcat(#absolute_path, ini_name); if (!file_exists(ini_path)) {
if (!file_exists(#absolute_path)) { strcpy(ini_path, "/sys/settings/");
strcpy(#absolute_path, "/sys/settings/"); strcat(ini_path, ini_name);
strcat(#absolute_path, ini_name);
} }
return #absolute_path; return ini_path;
} }
:byte ConvertSize_size_prefix[8]; :byte ConvertSize_size_prefix[8];

View File

@ -31,7 +31,7 @@
char default_dir[] = "/rd/1"; char default_dir[] = "/rd/1";
od_filter filter2 = { 15, "MP3\0WAV\0XM\0\0" }; 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. A tiny music folder player.
Supports MP3, WAV, XM audio file formats. Supports MP3, WAV, XM audio file formats.
@ -118,9 +118,6 @@ void LoadLibraries()
void main() void main()
{ {
int tempstr;
tempstr = abspath("pixie.ini");
strcpy(#pixie_ini_path, tempstr);
list.SetFont(8, 16, 13); list.SetFont(8, 16, 13);
LoadLibraries(); LoadLibraries();
LoadIniConfig(); LoadIniConfig();
@ -215,7 +212,6 @@ void DrawPlayList()
{ {
strcpy(#temp_filename, files_mas[i + list.first] * 304 + buf + 72); strcpy(#temp_filename, files_mas[i + list.first] * 304 + buf + 72);
temp_filename[strrchr(#temp_filename, '.')-1] = '\0'; temp_filename[strrchr(#temp_filename, '.')-1] = '\0';
//if (strlen(#temp_filename)>47) strcpy(#temp_filename+44, "...");
yyy = i*list.item_h+list.y; yyy = i*list.item_h+list.y;
@ -510,13 +506,12 @@ void EventDeleteItem()
if (list.cur_y == current_playing_file_n) EventStopPlaying(); if (list.cur_y == current_playing_file_n) EventStopPlaying();
for (i=list.cur_y; i<list.count; i++) files_mas[i] = files_mas[i+1]; for (i=list.cur_y; i<list.count; i++) files_mas[i] = files_mas[i+1];
list.count--; list.count--;
if (i + list.first <= current_playing_file_n) current_playing_file_n--; if (list.cur_y <= current_playing_file_n) current_playing_file_n--;
list.CheckDoesValuesOkey(); list.CheckDoesValuesOkey();
if (list.count <= list.visible) if (list.count <= list.visible)
{ {
list.h = list.count * list.item_h; list.h = list.count * list.item_h;
list.visible = list.count; list.visible = list.count;
list.w -= 1;
if (window_mode==WINDOW_MODE_NORMAL) MoveSize(OLD, OLD, OLD, skin.h + list.h); if (window_mode==WINDOW_MODE_NORMAL) MoveSize(OLD, OLD, OLD, skin.h + list.h);
} }
else DrawPlayList(); else DrawPlayList();

View File

@ -18,7 +18,7 @@ _ini ini;
void LoadIniConfig() void LoadIniConfig()
{ {
ini.path = GetIni("pixie.ini"); ini.path = GetIni(#pixie_ini_path, "PIXIE.INI");
ini.section = "Config"; ini.section = "Config";
window_mode = ini.GetInt("window_mode", WINDOW_MODE_NORMAL); window_mode = ini.GetInt("window_mode", WINDOW_MODE_NORMAL);
win_x_normal = ini.GetInt("win_x_normal", 100); win_x_normal = ini.GetInt("win_x_normal", 100);