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);
Translate();
}
SetEventMask(0x27);
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
loop()
{
switch(WaitEvent())

View File

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

View File

@ -25,7 +25,8 @@ void about_dialog()
break;
case evKey:
IF (GetKey()==27)
GetKeys();
IF (key_scancode == SCAN_CODE_ESC)
{
active_about=0;
cmd_free = 2;
@ -34,7 +35,7 @@ void about_dialog()
break;
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);
if (about_form.status_window>2) break;
logo_pal[0] = system.color.work;

View File

@ -66,7 +66,7 @@ void FileMenu()
}
rbmenu.w = rbmenu.w + 3 * rbmenu.font_w + 50;
rbmenu.h = rbmenu.count * rbmenu.item_h;
SetEventMask(100111b);
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
goto _MENU_DRAW;
loop() switch(WaitEvent())
@ -86,8 +86,10 @@ void FileMenu()
break;
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);
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);
if (menu_call_mouse)
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);
DrawRectangle(0,0,rbmenu.w+1,rbmenu.h+2,col_graph);
DrawBar(1,1,rbmenu.w,1,0xFFFfff);

View File

@ -161,7 +161,7 @@ inline fastcall void GetProcessInfo(EBX, ECX)
$mov eax,9;
$int 0x40
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

View File

@ -35,4 +35,43 @@ char aini_set_int[] = "ini_set_int";
char aini_get_color[] = "ini_get_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

View File

@ -14,6 +14,7 @@
#include "..\lib\obj\libini.h"
#include "..\lib\patterns\restart_process.h"
// Translatiions
#ifdef LANG_RUS
?define WINDOW_TITLE "<EFBFBD>஢¥àª  ¨ ­ áâனª  ¯ à ¬¥â஢ ¬ëè¨"
?define CHECK_MOUSE_1 "<EFBFBD> ¦¬¨â¥ ­  í⮩ ®¡« áâ¨"
@ -41,9 +42,7 @@ char pos_x = 22;
unsigned char panels_img_data[] = FROM "mouse_image.raw";
raw_image panels_img = { 59, 101, #panels_img_data };
char system_ini_path[] = "/sys/settings/system.ini";
char mouse_category[] = "mouse";
_ini ini = { "/sys/settings/system.ini", "mouse" };
struct _mouse_cfg {
char pointer_speed,
@ -63,7 +62,8 @@ void main() {
LoadCfg();
SetEventMask(0x27);
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
loop() switch(WaitEvent())
{
case evMouse:
@ -80,68 +80,44 @@ void main() {
case evButton:
id=GetButtonID();
if (id==1)
{
switch (id) {
case 1:
ExitApp();
}
if (id==99)
{
break;
case 99:
mouse_cfg.button_clicked=0;
DrawMouseImage();
break;
}
if (id==100)
{
case 100:
if (mouse_cfg.emulation==true) KillProcessByName("mousemul", SINGLE);
else RunProgram("/sys/mousemul", 0);
mouse_cfg.emulation ^= 1;
}
if (id==101)
{
break;
case 101:
if (mouse_cfg.madmouse==true) KillProcessByName("madmouse", SINGLE);
else RunProgram("/sys/madmouse", 0);
mouse_cfg.madmouse ^= 1;
}
if (id==120)
{
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);
break;
case 120: mouse_cfg.pointer_speed++; break;
case 121: if (mouse_cfg.pointer_speed>0) mouse_cfg.pointer_speed--; break;
case 122: mouse_cfg.acceleration++; break;
case 123: if (mouse_cfg.acceleration>0) mouse_cfg.acceleration--; break;
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;
}
DrawControls();
ApplyCfg();
break;
case evKey:
if (GetKey()==27) ExitApp();
GetKeys();
if (key_scancode == SCAN_CODE_ESC) ExitApp();
break;
case evReDraw:
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);
if (Form.status_window>2) break;
SetFrameColors();
@ -177,20 +153,24 @@ void SetFrameColors() {
}
void LoadCfg() {
ini_get_int stdcall (#system_ini_path, #mouse_category, "acceleration", GetMouseAcceleration()); mouse_cfg.acceleration = EAX;
ini_get_int stdcall (#system_ini_path, #mouse_category, "speed", GetMouseSpeed()); mouse_cfg.pointer_speed = EAX;
ini_get_int stdcall (#system_ini_path, #mouse_category, "double_click_delay", GetMouseDoubleClickDelay()); mouse_cfg.double_click_delay = EAX;
mouse_cfg.acceleration = ini.GetInt("acceleration", GetMouseAcceleration());
mouse_cfg.pointer_speed = ini.GetInt("speed", GetMouseSpeed());
mouse_cfg.double_click_delay = ini.GetInt("double_click_delay", GetMouseDoubleClickDelay());
mouse_cfg.madmouse = CheckProcessExists("MADMOUSE");
mouse_cfg.emulation = CheckProcessExists("MOUSEMUL");
}
void ExitApp() {
ini_set_int stdcall (#system_ini_path, #mouse_category, "acceleration", mouse_cfg.acceleration);
ini_set_int stdcall (#system_ini_path, #mouse_category, "speed", mouse_cfg.pointer_speed);
ini_set_int stdcall (#system_ini_path, #mouse_category, "double_click_delay", mouse_cfg.double_click_delay);
ini.SetInt("acceleration", mouse_cfg.acceleration);
ini.SetInt("speed", mouse_cfg.pointer_speed);
ini.SetInt("double_click_delay", mouse_cfg.double_click_delay);
ExitProcess();
}
void ApplyCfg() {
SetMouseSpeed(mouse_cfg.pointer_speed);
SetMouseAcceleration(mouse_cfg.acceleration);
SetMouseDoubleClickDelay(mouse_cfg.double_click_delay);
}
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 };
char taskbar_ini_path[] = "/sys/settings/taskbar.ini";
char taskbar_c_flags[] = "Flags";
char taskbar_c_variables[] = "Variables";
char docky_ini_path[] = "/sys/settings/docky.ini";
_ini taskbar_flags_ini = { #taskbar_ini_path, "Flags" };
_ini taskbar_vars_ini = { #taskbar_ini_path, "Variables" };
_ini docky_ini = { "/sys/settings/docky.ini", "@" };
unsigned char panels_img_data[] = FROM "panels_image.raw";
raw_image panels_img = { 37, 27, #panels_img_data };
@ -143,7 +144,7 @@ void main()
case evReDraw:
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);
if (Form.status_window>2) break;
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()
{
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", 1); tbAttachment = EAX;
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenUp", 1); tbSoftenUp = EAX;
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenDown", 1); tbSoftenDown = EAX;
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinLeftButton", 1); tbMinLeftButton = EAX;
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinRightButton", 1); tbMinRightButton = EAX;
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Clock", 1); tbClock = EAX;
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "CpuUsage", 1); tbCpuUsage = EAX;
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ChangeLang", 1); tbChangeLang = EAX;
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MenuButton", 1); tbMenuButton = EAX;
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "PanelHeight", 18); tbPanelHeight = EAX;
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "SoftenHeight", 4); tbSoftenHeight = EAX;
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonTopOffset", 3); tbButtonOffset = EAX;
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonBotOffset", 3); tbButtonOffset = EAX;
tbAttachment = taskbar_flags_ini.GetInt("Attachment", 1);
tbSoftenUp = taskbar_flags_ini.GetInt("SoftenUp", 1);
tbSoftenDown = taskbar_flags_ini.GetInt("SoftenDown", 1);
tbMinLeftButton = taskbar_flags_ini.GetInt("MinLeftButton", 1);
tbMinRightButton = taskbar_flags_ini.GetInt("MinRightButton", 1);
tbClock = taskbar_flags_ini.GetInt("Clock", 1);
tbCpuUsage = taskbar_flags_ini.GetInt("CpuUsage", 1);
tbChangeLang = taskbar_flags_ini.GetInt("ChangeLang", 1);
tbMenuButton = taskbar_flags_ini.GetInt("MenuButton", 1);
tbPanelHeight = taskbar_vars_ini.GetInt("PanelHeight", 18);
tbSoftenHeight = taskbar_vars_ini.GetInt("SoftenHeight", 4);
tbButtonOffset = taskbar_vars_ini.GetInt("ButtonTopOffset", 3);
tbButtonOffset = taskbar_vars_ini.GetInt("ButtonBotOffset", 3);
ini_get_int stdcall (#docky_ini_path, "@", "location", 0); dkLocation = EAX;
ini_get_int stdcall (#docky_ini_path, "@", "fsize", 0); dkFsize = EAX;
ini_get_int stdcall (#docky_ini_path, "@", "ashow", 0); dkAshow = EAX;
dkLocation = docky_ini.GetInt("location", 0);
dkFsize = docky_ini.GetInt("fsize", 0);
dkAshow = docky_ini.GetInt("ashow", 0);
}
void SaveCfg(byte panel_type)
{
if (panel_type==TASKBAR) {
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", tbAttachment);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenUp", tbSoftenUp);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenDown", tbSoftenDown);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinLeftButton", tbMinLeftButton);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinRightButton", tbMinRightButton);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "RunApplButton", tbRunApplButton);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ClnDeskButton", tbClnDeskButton);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Clock", tbClock);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "CpuUsage", tbCpuUsage);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ChangeLang", tbChangeLang);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MenuButton", tbMenuButton);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "PanelHeight", tbPanelHeight);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "SoftenHeight", tbSoftenHeight);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonTopOffset", tbButtonOffset);
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonBottOffset", tbButtonOffset);
taskbar_flags_ini.SetInt("Attachment", tbAttachment);
taskbar_flags_ini.SetInt("SoftenUp", tbSoftenUp);
taskbar_flags_ini.SetInt("SoftenDown", tbSoftenDown);
taskbar_flags_ini.SetInt("MinLeftButton", tbMinLeftButton);
taskbar_flags_ini.SetInt("MinRightButton", tbMinRightButton);
taskbar_flags_ini.SetInt("RunApplButton", tbRunApplButton);
taskbar_flags_ini.SetInt("ClnDeskButton", tbClnDeskButton);
taskbar_flags_ini.SetInt("Clock", tbClock);
taskbar_flags_ini.SetInt("CpuUsage", tbCpuUsage);
taskbar_flags_ini.SetInt("ChangeLang", tbChangeLang);
taskbar_flags_ini.SetInt("MenuButton", tbMenuButton);
taskbar_vars_ini.SetInt("PanelHeight", tbPanelHeight);
taskbar_vars_ini.SetInt("SoftenHeight", tbSoftenHeight);
taskbar_vars_ini.SetInt("ButtonTopOffset", tbButtonOffset);
taskbar_vars_ini.SetInt("ButtonBottOffset", tbButtonOffset);
}
if (panel_type==DOCKY) {
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", tbAttachment);
ini_set_int stdcall (#docky_ini_path, "@", "location", dkLocation);
ini_set_int stdcall (#docky_ini_path, "@", "fsize", dkFsize);
ini_set_int stdcall (#docky_ini_path, "@", "ashow", dkAshow);
docky_ini.SetInt("location", dkLocation);
docky_ini.SetInt("fsize", dkFsize);
docky_ini.SetInt("ashow", dkAshow);
}
}

View File

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

View File

@ -7,7 +7,7 @@
#include "..\lib\obj\proc_lib.h"
#include "..\lib\patterns\simple_open_dialog.h"
char default_dir[] = "/rd/1";
od_filter filter2 = { "MP3", 0 };
od_filter filter2 = { 8, "MP3\0\0" };
#include "..\lib\file_system.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;
llist list;
char pixie_ini_path[4096];
enum {
BUTTON_WINDOW_CLOSE = 1,
BUTTON_WINDOW_MINIMIZE,
@ -112,8 +110,6 @@ void main()
load_dll(Proc_lib, #OpenDialog_init,0);
OpenDialog_init stdcall (#o_dialog);
id = abspath("pixie.ini");
strcpy(#pixie_ini_path, id);
LoadIniConfig();
CheckDefaultForTheFirstStart();
OpenFolder(#param);

View File

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

View File

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

View File

@ -49,6 +49,8 @@ int driver_handle;
dword disk_sizes[10];
_ini ini = { "/sys/settings/tmpdisk.ini", "DiskSizes" };
/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////// Code ////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
@ -85,8 +87,7 @@ void GetDiskSizesFromIni()
for (i=0; i<=9; i++)
{
key[0]=i+'0';
ini_get_int stdcall ("/sys/settings/tmpdisk.ini", "DiskSizes", #key, 0);
disk_sizes[i] = EAX;
disk_sizes[i] = ini.GetInt(#key, 0);
}
}
@ -97,7 +98,7 @@ void SaveDiskSizesToIni()
for (i=0; i<=9; i++)
{
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];
char config_section[] = "Config";
int encoding;
_ini ini = { "/sys/settings/txtread.ini", "Config" };
void LoadIniSettings()
{
strcpy(#ini_path, "/sys/settings/txtread.ini");
ini_get_int stdcall (#ini_path, #config_section, "FontSize", 14); kfont.size.pt = EAX;
ini_get_int stdcall (#ini_path, #config_section, "Encoding", CH_CP866); encoding = EAX;
ini_get_int stdcall (#ini_path, #config_section, "WinX", 150); Form.left = EAX;
ini_get_int stdcall (#ini_path, #config_section, "WinY", 50); Form.top = EAX;
ini_get_int stdcall (#ini_path, #config_section, "WinW", 640); Form.width = EAX;
ini_get_int stdcall (#ini_path, #config_section, "WinH", 560); Form.height = EAX;
kfont.size.pt = ini.GetInt("FontSize", 14);
encoding = ini.GetInt("Encoding", CH_CP866);
Form.left = ini.GetInt("WinX", 150);
Form.top = ini.GetInt("WinY", 50);
Form.width = ini.GetInt("WinW", 640);
Form.height = ini.GetInt("WinH", 560);
}
void SaveIniSettings()
{
ini_set_int stdcall (#ini_path, #config_section, "FontSize", kfont.size.pt);
ini_set_int stdcall (#ini_path, #config_section, "Encoding", encoding);
ini_set_int stdcall (#ini_path, #config_section, "WinX", Form.left);
ini_set_int stdcall (#ini_path, #config_section, "WinY", Form.top);
ini_set_int stdcall (#ini_path, #config_section, "WinW", Form.width);
ini_set_int stdcall (#ini_path, #config_section, "WinH", Form.height);
ini.SetInt("FontSize", kfont.size.pt);
ini.SetInt("Encoding", encoding);
ini.SetInt("WinX", Form.left);
ini.SetInt("WinY", Form.top);
ini.SetInt("WinW", Form.width);
ini.SetInt("WinH", Form.height);
}

View File

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