add .VOX association, new GetIni() function which searches files in /kolibrios/settings/ first and then in /sys/settings/

git-svn-id: svn://kolibrios.org@7197 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2018-03-20 17:03:14 +00:00
parent d6c5005f96
commit 308832d4dd
7 changed files with 36 additions and 11 deletions

View File

@ -177,3 +177,5 @@ min=/kolibrios/emul/pokemini
zip=$Unz zip=$Unz
7z=$Unz 7z=$Unz
vox=/kolibrios/3D/voxel_editor/VOXEL_EDITOR

View File

@ -44,7 +44,7 @@ void CheckKosMounted()
if (dir_exists("/kolibrios")) if (dir_exists("/kolibrios"))
{ {
if (file_exists(APP_PLUS_INI_PATH)) if (file_exists(APP_PLUS_INI_PATH))
io.run("syspanel", APP_PLUS_INI_PATH); RunProgram("syspanel", APP_PLUS_INI_PATH);
else else
notify(APP_PLUS_INI_NOT_EXISTS); notify(APP_PLUS_INI_NOT_EXISTS);
ExitProcess(); ExitProcess();
@ -101,7 +101,6 @@ void draw_window()
PutPaletteImage(#scr,144,171,Form.cwidth-180,y.n,8,#scr_pal); PutPaletteImage(#scr,144,171,Form.cwidth-180,y.n,8,#scr_pal);
DrawRectangle(Form.cwidth-180-1,y.n-1, 144+1,171+1, system.color.work_graph); DrawRectangle(Form.cwidth-180-1,y.n-1, 144+1,171+1, system.color.work_graph);
DrawStandartCaptButton(x, Form.cheight-66, BTN_MANUAL_SEARCH, MANUALLY_BUTTON_TEXT); DrawStandartCaptButton(x, Form.cheight-66, BTN_MANUAL_SEARCH, MANUALLY_BUTTON_TEXT);
} }

View File

@ -109,9 +109,14 @@ bool show_dev_name=true,
libimg_image icons16_default; libimg_image icons16_default;
libimg_image icons16_selected; libimg_image icons16_selected;
//libimg_image icons32_default;
//libimg_image icons32_selected;
#define STATUS_BAR_H 16; #define STATUS_BAR_H 16;
int status_bar_h = 0; int status_bar_h = 0;
int icon_size = 16;
edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000,248,#new_element_name,#mouse_dd,100000000000010b,6,0}; edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000,248,#new_element_name,#mouse_dd,100000000000010b,6,0};
PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
byte cmd_free=0; byte cmd_free=0;
@ -144,7 +149,7 @@ void main()
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 = abspath("Eolite.ini"); eolite_ini_path = GetIni("Eolite.ini");
LoadIniSettings(); LoadIniSettings();
SystemDiscs.Get(); SystemDiscs.Get();
@ -155,6 +160,11 @@ void main()
Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffFFFfff, 0xFF94AECE); Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffFFFfff, 0xFF94AECE);
Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffCACBD6, 0xFF7692B5); Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffCACBD6, 0xFF7692B5);
//Libimg_LoadImage(#icons32_default, "/sys/icons32.png");
//Libimg_LoadImage(#icons32_selected, "/sys/icons32.png");
//Libimg_ReplaceColor(icons32_selected.image, icons32_selected.w, icons32_selected.h, 0xffFFFfff, 0xFF94AECE);
//Libimg_ReplaceColor(icons32_selected.image, icons32_selected.w, icons32_selected.h, 0xffCACBD6, 0xFF7692B5);
//-p just show file/folder properties dialog //-p just show file/folder properties dialog
if (param) && (param[0]=='-') && (param[1]=='p') if (param) && (param[0]=='-') && (param[1]=='p')
{ {
@ -696,15 +706,15 @@ void Line_ReDraw(dword bgcol, filenum){
file_offet, file_offet,
file_name_off, file_name_off,
y=filenum*files.item_h+files.y, y=filenum*files.item_h+files.y,
icon_y = files.item_h/2-7+y; icon_y = files.item_h-icon_size/2+1+y;
BDVK file; BDVK file;
char temp_path[sizeof(file_path)]; char temp_path[sizeof(file_path)];
char label_file_name[4096]; char label_file_name[4096];
if (filenum==-1) return; if (filenum==-1) return;
DrawBar(files.x,y,4,files.item_h,bgcol); DrawBar(files.x,y,4,files.item_h,bgcol);
DrawBar(files.x+20,y,files.w-20,files.item_h,bgcol); DrawBar(files.x+20,y,files.w-20,files.item_h,bgcol);
DrawBar(files.x+4,y,16,icon_y-y,bgcol); DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol);
if (files.item_h>16) DrawBar(files.x+4,icon_y+15,16,y+files.item_h-icon_y-15,bgcol); if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size-1,icon_size,y+files.item_h-icon_y-icon_size+1,bgcol);
file_offet = file_mas[filenum+files.first]*304 + buf+32; file_offet = file_mas[filenum+files.first]*304 + buf+32;
attr = ESDWORD[file_offet]; attr = ESDWORD[file_offet];
@ -769,7 +779,7 @@ void Line_ReDraw(dword bgcol, filenum){
} }
strcpy(#label_file_name+strlen(#label_file_name)-2, "..."); strcpy(#label_file_name+strlen(#label_file_name)-2, "...");
} }
kfont.WriteIntoWindow(files.x + 23, files.item_h - kfont.height / 2 + y, bgcol, text_col, kfont.size.pt, #label_file_name); kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, bgcol, text_col, kfont.size.pt, #label_file_name);
} }
DrawBar(files.x+files.w-141,y,1,files.item_h,col_list_line); //gray line 1 DrawBar(files.x+files.w-141,y,1,files.item_h,col_list_line); //gray line 1
DrawBar(files.x+files.w-68,y,1,files.item_h,col_list_line); //gray line 2 DrawBar(files.x+files.w-68,y,1,files.item_h,col_list_line); //gray line 2

View File

@ -20,12 +20,12 @@ void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
} }
if (fairing_color==col_selec) if (fairing_color==col_selec)
{ {
img_draw stdcall(icons16_selected.image, xx, yy, 16, 16, 0, icon_n*16); img_draw stdcall(icons16_selected.image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
IconFairing(icon_n, xx, yy, fairing_color); IconFairing(icon_n, xx, yy, fairing_color);
} }
else else
{ {
img_draw stdcall(icons16_default.image, xx, yy, 16, 16, 0, icon_n*16); img_draw stdcall(icons16_default.image, xx, yy, icon_size, icon_size, 0, icon_n*icon_size);
} }
} }

View File

@ -285,6 +285,18 @@ enum
return #absolute_path; return #absolute_path;
} }
:dword GetIni(dword 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);
}
return #absolute_path;
}
:byte ConvertSize_size_prefix[8]; :byte ConvertSize_size_prefix[8];
:dword ConvertSize(dword bytes) :dword ConvertSize(dword bytes)
{ {

View File

@ -11,13 +11,15 @@ struct struct_pixie_colors {
color_list_border; color_list_border;
} theme; } theme;
_ini ini = { "/sys/media/pixie/pixie.ini", "Config" }; _ini ini;
#define WIN_W_SMALL 126 #define WIN_W_SMALL 126
#define WIN_H_SMALL 31 #define WIN_H_SMALL 31
void LoadIniConfig() void LoadIniConfig()
{ {
ini.path = GetIni("pixie.ini");
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);
win_y_normal = ini.GetInt("win_y_normal", 90); win_y_normal = ini.GetInt("win_y_normal", 90);