use libini wrappers, use human readable event masks

git-svn-id: svn://kolibrios.org@7051 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2017-10-05 09:37:50 +00:00
parent 1d7bf9da84
commit f09eef1c27
15 changed files with 178 additions and 157 deletions

View File

@ -52,7 +52,7 @@ void main()
edit1.size=edit1.pos=strlen(#edit_text); edit1.size=edit1.pos=strlen(#edit_text);
Translate(); Translate();
} }
SetEventMask(0x27); SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
loop() loop()
{ {
switch(WaitEvent()) switch(WaitEvent())

View File

@ -169,13 +169,13 @@ void main()
Open_Dir(#path,ONLY_OPEN); Open_Dir(#path,ONLY_OPEN);
strcpy(#inactive_path, #path); strcpy(#inactive_path, #path);
llist_copy(#files_inactive, #files); llist_copy(#files_inactive, #files);
SetEventMask(1100111b); SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
loop(){ loop(){
switch(WaitEvent()) switch(WaitEvent())
{ {
case evMouse: case evMouse:
if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break; if (del_active) || (Form.status_window>2) break;
if (new_element_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) if (new_element_active)
{ {
edit_box_mouse stdcall(#new_file_ed); edit_box_mouse stdcall(#new_file_ed);
break; break;

View File

@ -25,7 +25,8 @@ void about_dialog()
break; break;
case evKey: case evKey:
IF (GetKey()==27) GetKeys();
IF (key_scancode == SCAN_CODE_ESC)
{ {
active_about=0; active_about=0;
cmd_free = 2; cmd_free = 2;
@ -34,7 +35,7 @@ void about_dialog()
break; break;
case evReDraw: case evReDraw:
DefineAndDrawWindow(Form.left+Form.width/2,Form.top+Form.height/2-114,310,300+GetSkinHeight(),0x34,system.color.work,NULL,0); DefineAndDrawWindow(Form.left+Form.width/2,Form.top+Form.height/2-114,310,300+skin_height,0x34,system.color.work,NULL,0);
GetProcessInfo(#about_form, SelfInfo); GetProcessInfo(#about_form, SelfInfo);
if (about_form.status_window>2) break; if (about_form.status_window>2) break;
logo_pal[0] = system.color.work; logo_pal[0] = system.color.work;

View File

@ -66,7 +66,7 @@ void FileMenu()
} }
rbmenu.w = rbmenu.w + 3 * rbmenu.font_w + 50; rbmenu.w = rbmenu.w + 3 * rbmenu.font_w + 50;
rbmenu.h = rbmenu.count * rbmenu.item_h; rbmenu.h = rbmenu.count * rbmenu.item_h;
SetEventMask(100111b); SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
goto _MENU_DRAW; goto _MENU_DRAW;
loop() switch(WaitEvent()) loop() switch(WaitEvent())
@ -86,8 +86,10 @@ void FileMenu()
break; break;
case evReDraw: _MENU_DRAW: case evReDraw: _MENU_DRAW:
if (menu_call_mouse) DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+GetSkinHeight(),rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF); if (menu_call_mouse)
else DefineAndDrawWindow(Form.left+files.x+15, files.item_h*files.cur_y+files.y+Form.top+30,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF); DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+skin_height,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF);
else
DefineAndDrawWindow(Form.left+files.x+15, files.item_h*files.cur_y+files.y+Form.top+30,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF);
GetProcessInfo(#MenuForm, SelfInfo); GetProcessInfo(#MenuForm, SelfInfo);
DrawRectangle(0,0,rbmenu.w+1,rbmenu.h+2,col_graph); DrawRectangle(0,0,rbmenu.w+1,rbmenu.h+2,col_graph);
DrawBar(1,1,rbmenu.w,1,0xFFFfff); DrawBar(1,1,rbmenu.w,1,0xFFFfff);

View File

@ -161,7 +161,7 @@ inline fastcall void GetProcessInfo(EBX, ECX)
$mov eax,9; $mov eax,9;
$int 0x40 $int 0x40
DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight DSDWORD[EBX+75] = DSDWORD[EBX+46] - skin_height - 4; //set cheight
} }
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y

View File

@ -35,4 +35,43 @@ char aini_set_int[] = "ini_set_int";
char aini_get_color[] = "ini_get_color"; char aini_get_color[] = "ini_get_color";
//char aini_set_color[] = "ini_set_color"; //char aini_set_color[] = "ini_set_color";
//===================================================//
// //
// FUCTIONS //
// //
//===================================================//
struct _ini
{
dword path;
dword section;
void SetPath();
void SetSection();
int GetInt();
void SetInt();
void GetString();
void SetString();
};
int _ini::GetInt(dword key, default_value)
{
ini_get_int stdcall (path, section, key, default_value);
return EAX;
}
void _ini::SetInt(dword key, value)
{
ini_set_int stdcall (path, section, key, value);
}
void _ini::GetString(dword key, dst, len, default_value)
{
ini_get_str stdcall (path, section, key, dst, len, default_value);
}
void _ini::SetString(dword key, value, len)
{
ini_set_str stdcall (key, value, len);
}
#endif #endif

View File

@ -14,6 +14,7 @@
#include "..\lib\obj\libini.h" #include "..\lib\obj\libini.h"
#include "..\lib\patterns\restart_process.h" #include "..\lib\patterns\restart_process.h"
// Translatiions
#ifdef LANG_RUS #ifdef LANG_RUS
?define WINDOW_TITLE "<EFBFBD>஢¥àª  ¨ ­ áâனª  ¯ à ¬¥â஢ ¬ëè¨" ?define WINDOW_TITLE "<EFBFBD>஢¥àª  ¨ ­ áâனª  ¯ à ¬¥â஢ ¬ëè¨"
?define CHECK_MOUSE_1 "<EFBFBD> ¦¬¨â¥ ­  í⮩ ®¡« áâ¨" ?define CHECK_MOUSE_1 "<EFBFBD> ¦¬¨â¥ ­  í⮩ ®¡« áâ¨"
@ -41,9 +42,7 @@ char pos_x = 22;
unsigned char panels_img_data[] = FROM "mouse_image.raw"; unsigned char panels_img_data[] = FROM "mouse_image.raw";
raw_image panels_img = { 59, 101, #panels_img_data }; raw_image panels_img = { 59, 101, #panels_img_data };
char system_ini_path[] = "/sys/settings/system.ini"; _ini ini = { "/sys/settings/system.ini", "mouse" };
char mouse_category[] = "mouse";
struct _mouse_cfg { struct _mouse_cfg {
char pointer_speed, char pointer_speed,
@ -57,13 +56,14 @@ struct _mouse_cfg {
void main() { void main() {
char id, old_button_clicked; char id, old_button_clicked;
load_dll(libini, #lib_init,1); load_dll(libini, #lib_init,1);
load_dll(boxlib, #box_lib_init,0); load_dll(boxlib, #box_lib_init,0);
LoadCfg(); LoadCfg();
SetEventMask(0x27); SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
loop() switch(WaitEvent()) loop() switch(WaitEvent())
{ {
case evMouse: case evMouse:
@ -80,68 +80,44 @@ void main() {
case evButton: case evButton:
id=GetButtonID(); id=GetButtonID();
if (id==1) switch (id) {
{ case 1:
ExitApp(); ExitApp();
} break;
if (id==99) case 99:
{ mouse_cfg.button_clicked=0;
mouse_cfg.button_clicked=0; DrawMouseImage();
DrawMouseImage(); break;
break; case 100:
} if (mouse_cfg.emulation==true) KillProcessByName("mousemul", SINGLE);
if (id==100) else RunProgram("/sys/mousemul", 0);
{ mouse_cfg.emulation ^= 1;
if (mouse_cfg.emulation==true) KillProcessByName("mousemul", SINGLE); break;
else RunProgram("/sys/mousemul", 0); case 101:
mouse_cfg.emulation ^= 1; if (mouse_cfg.madmouse==true) KillProcessByName("madmouse", SINGLE);
} else RunProgram("/sys/madmouse", 0);
if (id==101) mouse_cfg.madmouse ^= 1;
{ break;
if (mouse_cfg.madmouse==true) KillProcessByName("madmouse", SINGLE); case 120: mouse_cfg.pointer_speed++; break;
else RunProgram("/sys/madmouse", 0); case 121: if (mouse_cfg.pointer_speed>0) mouse_cfg.pointer_speed--; break;
mouse_cfg.madmouse ^= 1; case 122: mouse_cfg.acceleration++; break;
} case 123: if (mouse_cfg.acceleration>0) mouse_cfg.acceleration--; break;
if (id==120) case 124: mouse_cfg.double_click_delay+=8; break;
{ case 125: if (mouse_cfg.double_click_delay>0) mouse_cfg.double_click_delay-=8; break;
mouse_cfg.pointer_speed++;
SetMouseSpeed(mouse_cfg.pointer_speed);
}
if (id==121) && (mouse_cfg.pointer_speed>0)
{
mouse_cfg.pointer_speed--;
SetMouseSpeed(mouse_cfg.pointer_speed);
}
if (id==122)
{
mouse_cfg.acceleration++;
SetMouseAcceleration(mouse_cfg.acceleration);
}
if (id==123) && (mouse_cfg.acceleration>0)
{
mouse_cfg.acceleration--;
SetMouseAcceleration(mouse_cfg.acceleration);
}
if (id==124)
{
mouse_cfg.double_click_delay+=8;
SetMouseDoubleClickDelay(mouse_cfg.double_click_delay);
}
if (id==125) && (mouse_cfg.double_click_delay>0)
{
mouse_cfg.double_click_delay-=8;
SetMouseDoubleClickDelay(mouse_cfg.double_click_delay);
} }
DrawControls(); DrawControls();
ApplyCfg();
break; break;
case evKey: case evKey:
if (GetKey()==27) ExitApp(); GetKeys();
if (key_scancode == SCAN_CODE_ESC) ExitApp();
break; break;
case evReDraw: case evReDraw:
system.color.get(); system.color.get();
DefineAndDrawWindow(430, 150, 424, 310+GetSkinHeight(),0x34,system.color.work,WINDOW_TITLE,0); DefineAndDrawWindow(430, 150, 424, 310+skin_height,0x34,system.color.work,WINDOW_TITLE,0);
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) break; if (Form.status_window>2) break;
SetFrameColors(); SetFrameColors();
@ -177,20 +153,24 @@ void SetFrameColors() {
} }
void LoadCfg() { void LoadCfg() {
ini_get_int stdcall (#system_ini_path, #mouse_category, "acceleration", GetMouseAcceleration()); mouse_cfg.acceleration = EAX; mouse_cfg.acceleration = ini.GetInt("acceleration", GetMouseAcceleration());
ini_get_int stdcall (#system_ini_path, #mouse_category, "speed", GetMouseSpeed()); mouse_cfg.pointer_speed = EAX; mouse_cfg.pointer_speed = ini.GetInt("speed", GetMouseSpeed());
ini_get_int stdcall (#system_ini_path, #mouse_category, "double_click_delay", GetMouseDoubleClickDelay()); mouse_cfg.double_click_delay = EAX; mouse_cfg.double_click_delay = ini.GetInt("double_click_delay", GetMouseDoubleClickDelay());
mouse_cfg.madmouse = CheckProcessExists("MADMOUSE"); mouse_cfg.madmouse = CheckProcessExists("MADMOUSE");
mouse_cfg.emulation = CheckProcessExists("MOUSEMUL"); mouse_cfg.emulation = CheckProcessExists("MOUSEMUL");
} }
void ExitApp() { void ExitApp() {
ini_set_int stdcall (#system_ini_path, #mouse_category, "acceleration", mouse_cfg.acceleration); ini.SetInt("acceleration", mouse_cfg.acceleration);
ini_set_int stdcall (#system_ini_path, #mouse_category, "speed", mouse_cfg.pointer_speed); ini.SetInt("speed", mouse_cfg.pointer_speed);
ini_set_int stdcall (#system_ini_path, #mouse_category, "double_click_delay", mouse_cfg.double_click_delay); ini.SetInt("double_click_delay", mouse_cfg.double_click_delay);
ExitProcess(); ExitProcess();
} }
void ApplyCfg() {
SetMouseSpeed(mouse_cfg.pointer_speed);
SetMouseAcceleration(mouse_cfg.acceleration);
SetMouseDoubleClickDelay(mouse_cfg.double_click_delay);
}
stop: stop:

View File

@ -59,9 +59,10 @@ frame taskbar_frame = { 0, NULL, 10, NULL, 16, NULL, 0xFFFfff, 1, TASK_FRAME_T,
frame docky_frame = { 0, NULL, 10, NULL, NULL, NULL, 0xFFFfff, 1, DOCK_FRAME_T, 0, 1, 12, 0x000111, 0xCCCccc }; frame docky_frame = { 0, NULL, 10, NULL, NULL, NULL, 0xFFFfff, 1, DOCK_FRAME_T, 0, 1, 12, 0x000111, 0xCCCccc };
char taskbar_ini_path[] = "/sys/settings/taskbar.ini"; char taskbar_ini_path[] = "/sys/settings/taskbar.ini";
char taskbar_c_flags[] = "Flags"; _ini taskbar_flags_ini = { #taskbar_ini_path, "Flags" };
char taskbar_c_variables[] = "Variables"; _ini taskbar_vars_ini = { #taskbar_ini_path, "Variables" };
char docky_ini_path[] = "/sys/settings/docky.ini";
_ini docky_ini = { "/sys/settings/docky.ini", "@" };
unsigned char panels_img_data[] = FROM "panels_image.raw"; unsigned char panels_img_data[] = FROM "panels_image.raw";
raw_image panels_img = { 37, 27, #panels_img_data }; raw_image panels_img = { 37, 27, #panels_img_data };
@ -143,7 +144,7 @@ void main()
case evReDraw: case evReDraw:
system.color.get(); system.color.get();
DefineAndDrawWindow(130, 150, 465, 398+GetSkinHeight(),0x34,system.color.work,WINDOW_TITLE,0); DefineAndDrawWindow(130, 150, 465, 398 + skin_height, 0x34, system.color.work, WINDOW_TITLE, 0);
GetProcessInfo(#Form, SelfInfo); GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) break; if (Form.status_window>2) break;
taskbar_frame.size_x = docky_frame.size_x = - taskbar_frame.start_x * 2 + Form.cwidth; taskbar_frame.size_x = docky_frame.size_x = - taskbar_frame.start_x * 2 + Form.cwidth;
@ -198,49 +199,48 @@ void DrawWindowContent(byte panel_type)
void LoadCfg() void LoadCfg()
{ {
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", 1); tbAttachment = EAX; tbAttachment = taskbar_flags_ini.GetInt("Attachment", 1);
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenUp", 1); tbSoftenUp = EAX; tbSoftenUp = taskbar_flags_ini.GetInt("SoftenUp", 1);
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenDown", 1); tbSoftenDown = EAX; tbSoftenDown = taskbar_flags_ini.GetInt("SoftenDown", 1);
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinLeftButton", 1); tbMinLeftButton = EAX; tbMinLeftButton = taskbar_flags_ini.GetInt("MinLeftButton", 1);
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinRightButton", 1); tbMinRightButton = EAX; tbMinRightButton = taskbar_flags_ini.GetInt("MinRightButton", 1);
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Clock", 1); tbClock = EAX; tbClock = taskbar_flags_ini.GetInt("Clock", 1);
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "CpuUsage", 1); tbCpuUsage = EAX; tbCpuUsage = taskbar_flags_ini.GetInt("CpuUsage", 1);
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ChangeLang", 1); tbChangeLang = EAX; tbChangeLang = taskbar_flags_ini.GetInt("ChangeLang", 1);
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MenuButton", 1); tbMenuButton = EAX; tbMenuButton = taskbar_flags_ini.GetInt("MenuButton", 1);
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "PanelHeight", 18); tbPanelHeight = EAX; tbPanelHeight = taskbar_vars_ini.GetInt("PanelHeight", 18);
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "SoftenHeight", 4); tbSoftenHeight = EAX; tbSoftenHeight = taskbar_vars_ini.GetInt("SoftenHeight", 4);
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonTopOffset", 3); tbButtonOffset = EAX; tbButtonOffset = taskbar_vars_ini.GetInt("ButtonTopOffset", 3);
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonBotOffset", 3); tbButtonOffset = EAX; tbButtonOffset = taskbar_vars_ini.GetInt("ButtonBotOffset", 3);
ini_get_int stdcall (#docky_ini_path, "@", "location", 0); dkLocation = EAX; dkLocation = docky_ini.GetInt("location", 0);
ini_get_int stdcall (#docky_ini_path, "@", "fsize", 0); dkFsize = EAX; dkFsize = docky_ini.GetInt("fsize", 0);
ini_get_int stdcall (#docky_ini_path, "@", "ashow", 0); dkAshow = EAX; dkAshow = docky_ini.GetInt("ashow", 0);
} }
void SaveCfg(byte panel_type) void SaveCfg(byte panel_type)
{ {
if (panel_type==TASKBAR) { if (panel_type==TASKBAR) {
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", tbAttachment); taskbar_flags_ini.SetInt("Attachment", tbAttachment);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenUp", tbSoftenUp); taskbar_flags_ini.SetInt("SoftenUp", tbSoftenUp);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenDown", tbSoftenDown); taskbar_flags_ini.SetInt("SoftenDown", tbSoftenDown);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinLeftButton", tbMinLeftButton); taskbar_flags_ini.SetInt("MinLeftButton", tbMinLeftButton);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinRightButton", tbMinRightButton); taskbar_flags_ini.SetInt("MinRightButton", tbMinRightButton);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "RunApplButton", tbRunApplButton); taskbar_flags_ini.SetInt("RunApplButton", tbRunApplButton);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ClnDeskButton", tbClnDeskButton); taskbar_flags_ini.SetInt("ClnDeskButton", tbClnDeskButton);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Clock", tbClock); taskbar_flags_ini.SetInt("Clock", tbClock);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "CpuUsage", tbCpuUsage); taskbar_flags_ini.SetInt("CpuUsage", tbCpuUsage);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ChangeLang", tbChangeLang); taskbar_flags_ini.SetInt("ChangeLang", tbChangeLang);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MenuButton", tbMenuButton); taskbar_flags_ini.SetInt("MenuButton", tbMenuButton);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "PanelHeight", tbPanelHeight); taskbar_vars_ini.SetInt("PanelHeight", tbPanelHeight);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "SoftenHeight", tbSoftenHeight); taskbar_vars_ini.SetInt("SoftenHeight", tbSoftenHeight);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonTopOffset", tbButtonOffset); taskbar_vars_ini.SetInt("ButtonTopOffset", tbButtonOffset);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonBottOffset", tbButtonOffset); taskbar_vars_ini.SetInt("ButtonBottOffset", tbButtonOffset);
} }
if (panel_type==DOCKY) { if (panel_type==DOCKY) {
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", tbAttachment); docky_ini.SetInt("location", dkLocation);
ini_set_int stdcall (#docky_ini_path, "@", "location", dkLocation); docky_ini.SetInt("fsize", dkFsize);
ini_set_int stdcall (#docky_ini_path, "@", "fsize", dkFsize); docky_ini.SetInt("ashow", dkAshow);
ini_set_int stdcall (#docky_ini_path, "@", "ashow", dkAshow);
} }
} }

View File

@ -3,7 +3,6 @@
@C-- pixie.c @C-- pixie.c
@del pixie @del pixie
@kpack pixie.com
@rename pixie.com pixie @rename pixie.com pixie
@del warning.txt @del warning.txt
@del lang.h-- @del lang.h--

View File

@ -7,7 +7,7 @@
#include "..\lib\obj\proc_lib.h" #include "..\lib\obj\proc_lib.h"
#include "..\lib\patterns\simple_open_dialog.h" #include "..\lib\patterns\simple_open_dialog.h"
char default_dir[] = "/rd/1"; char default_dir[] = "/rd/1";
od_filter filter2 = { "MP3", 0 }; od_filter filter2 = { 8, "MP3\0\0" };
#include "..\lib\file_system.h" #include "..\lib\file_system.h"
#include "..\lib\list_box.h" #include "..\lib\list_box.h"
@ -30,8 +30,6 @@ scroll_bar scroll1 = { 5,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,
proc_info Form; proc_info Form;
llist list; llist list;
char pixie_ini_path[4096];
enum { enum {
BUTTON_WINDOW_CLOSE = 1, BUTTON_WINDOW_CLOSE = 1,
BUTTON_WINDOW_MINIMIZE, BUTTON_WINDOW_MINIMIZE,
@ -112,8 +110,6 @@ void main()
load_dll(Proc_lib, #OpenDialog_init,0); load_dll(Proc_lib, #OpenDialog_init,0);
OpenDialog_init stdcall (#o_dialog); OpenDialog_init stdcall (#o_dialog);
id = abspath("pixie.ini");
strcpy(#pixie_ini_path, id);
LoadIniConfig(); LoadIniConfig();
CheckDefaultForTheFirstStart(); CheckDefaultForTheFirstStart();
OpenFolder(#param); OpenFolder(#param);

View File

@ -4,17 +4,21 @@ enum {
THEME_LIGHT THEME_LIGHT
}; };
char config_section[] = "Config"; char pathini[4096];
_ini ini = { "/sys/media/pixie/pixie.ini", "Config" };
void LoadIniConfig() void LoadIniConfig()
{ {
ini_get_int stdcall (#pixie_ini_path, #config_section, "current_theme", THEME_DARK); current_theme = EAX; dword temp = abspath("pixie.ini");
ini_get_int stdcall (#pixie_ini_path, #config_section, "window_mode", WINDOW_MODE_NORMAL); window_mode = EAX; strcpy(#pathini, temp);
ini_get_int stdcall (#pixie_ini_path, #config_section, "win_x_normal", 100); win_x_normal = EAX; ini.path = #pathini;
ini_get_int stdcall (#pixie_ini_path, #config_section, "win_y_normal", 90); win_y_normal = EAX; current_theme = ini.GetInt("current_theme", THEME_DARK);
ini_get_int stdcall (#pixie_ini_path, #config_section, "win_x_small", -1); win_x_small = EAX; window_mode = ini.GetInt("window_mode", WINDOW_MODE_NORMAL);
ini_get_int stdcall (#pixie_ini_path, #config_section, "win_y_small", -1); win_y_small = EAX; win_x_normal = ini.GetInt("win_x_normal", 100);
ini_get_str stdcall (#pixie_ini_path, #config_section, "last_folder", #work_folder, sizeof(work_folder), 0); win_y_normal = ini.GetInt("win_y_normal", 90);
win_x_small = ini.GetInt("win_x_small", -1);
win_y_small = ini.GetInt("win_y_small", -1);
ini.GetString("last_folder", #work_folder, sizeof(work_folder), 0);
if (current_theme == THEME_DARK) SetColorThemeDark(); else SetColorThemeLight(); if (current_theme == THEME_DARK) SetColorThemeDark(); else SetColorThemeLight();
if (win_x_small==-1) win_x_small = 2000; if (win_x_small==-1) win_x_small = 2000;
@ -33,13 +37,13 @@ void SaveIniConfig()
win_x_small = Form.left; win_x_small = Form.left;
win_y_small = Form.top; win_y_small = Form.top;
} }
ini_set_int stdcall (#pixie_ini_path, #config_section, "current_theme", current_theme); ini.SetInt("current_theme", current_theme);
ini_set_int stdcall (#pixie_ini_path, #config_section, "window_mode", window_mode); ini.SetInt("window_mode", window_mode);
ini_set_int stdcall (#pixie_ini_path, #config_section, "win_x_normal", win_x_normal); ini.SetInt("win_x_normal", win_x_normal);
ini_set_int stdcall (#pixie_ini_path, #config_section, "win_y_normal", win_y_normal); ini.SetInt("win_y_normal", win_y_normal);
ini_set_int stdcall (#pixie_ini_path, #config_section, "win_x_small", win_x_small); ini.SetInt("win_x_small", win_x_small);
ini_set_int stdcall (#pixie_ini_path, #config_section, "win_y_small", win_y_small); ini.SetInt("win_y_small", win_y_small);
ini_set_str stdcall (#pixie_ini_path, #config_section, "last_folder", #work_folder, strlen(#work_folder)); ini.SetString("last_folder", #work_folder, strlen(#work_folder));
} }
struct struct_pixie_colors { struct struct_pixie_colors {

View File

@ -32,7 +32,7 @@
//simple open dialog data //simple open dialog data
char default_dir[] = "/rd/1"; char default_dir[] = "/rd/1";
od_filter filter2 = { "MP3", 0 }; od_filter filter2 = { 8, "MP3\0\0" };
#define ABOUT_MESSAGE "'Pixies Player v2.0 #define ABOUT_MESSAGE "'Pixies Player v2.0
A tiny MP3 folder player. A tiny MP3 folder player.

View File

@ -49,6 +49,8 @@ int driver_handle;
dword disk_sizes[10]; dword disk_sizes[10];
_ini ini = { "/sys/settings/tmpdisk.ini", "DiskSizes" };
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
///////////////////////// Code //////////////////// ///////////////////////// Code ////////////////////
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
@ -85,8 +87,7 @@ void GetDiskSizesFromIni()
for (i=0; i<=9; i++) for (i=0; i<=9; i++)
{ {
key[0]=i+'0'; key[0]=i+'0';
ini_get_int stdcall ("/sys/settings/tmpdisk.ini", "DiskSizes", #key, 0); disk_sizes[i] = ini.GetInt(#key, 0);
disk_sizes[i] = EAX;
} }
} }
@ -97,7 +98,7 @@ void SaveDiskSizesToIni()
for (i=0; i<=9; i++) for (i=0; i<=9; i++)
{ {
key[0]=i+'0'; key[0]=i+'0';
ini_set_int stdcall ("/sys/settings/tmpdisk.ini", "DiskSizes", #key, disk_sizes[i]); ini.SetInt(#key, disk_sizes[i]);
} }
} }

View File

@ -1,24 +1,21 @@
char ini_path[4096]; _ini ini = { "/sys/settings/txtread.ini", "Config" };
char config_section[] = "Config";
int encoding;
void LoadIniSettings() void LoadIniSettings()
{ {
strcpy(#ini_path, "/sys/settings/txtread.ini"); kfont.size.pt = ini.GetInt("FontSize", 14);
ini_get_int stdcall (#ini_path, #config_section, "FontSize", 14); kfont.size.pt = EAX; encoding = ini.GetInt("Encoding", CH_CP866);
ini_get_int stdcall (#ini_path, #config_section, "Encoding", CH_CP866); encoding = EAX; Form.left = ini.GetInt("WinX", 150);
ini_get_int stdcall (#ini_path, #config_section, "WinX", 150); Form.left = EAX; Form.top = ini.GetInt("WinY", 50);
ini_get_int stdcall (#ini_path, #config_section, "WinY", 50); Form.top = EAX; Form.width = ini.GetInt("WinW", 640);
ini_get_int stdcall (#ini_path, #config_section, "WinW", 640); Form.width = EAX; Form.height = ini.GetInt("WinH", 560);
ini_get_int stdcall (#ini_path, #config_section, "WinH", 560); Form.height = EAX;
} }
void SaveIniSettings() void SaveIniSettings()
{ {
ini_set_int stdcall (#ini_path, #config_section, "FontSize", kfont.size.pt); ini.SetInt("FontSize", kfont.size.pt);
ini_set_int stdcall (#ini_path, #config_section, "Encoding", encoding); ini.SetInt("Encoding", encoding);
ini_set_int stdcall (#ini_path, #config_section, "WinX", Form.left); ini.SetInt("WinX", Form.left);
ini_set_int stdcall (#ini_path, #config_section, "WinY", Form.top); ini.SetInt("WinY", Form.top);
ini_set_int stdcall (#ini_path, #config_section, "WinW", Form.width); ini.SetInt("WinW", Form.width);
ini_set_int stdcall (#ini_path, #config_section, "WinH", Form.height); ini.SetInt("WinH", Form.height);
} }

View File

@ -52,6 +52,8 @@ enum {
SHOW_INFO, SHOW_INFO,
}; };
int encoding;
#include "ini.h" #include "ini.h"
#include "gui.h" #include "gui.h"
#include "prepare_page.h" #include "prepare_page.h"