From 308832d4dda095d439a480182aff67b8258c25e3 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Tue, 20 Mar 2018 17:03:14 +0000 Subject: [PATCH] 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 --- data/common/settings/assoc.ini | 4 +++- .../{File Managers => settings}/eolite.ini | 0 programs/cmm/app_plus/app_plus.c | 3 +-- programs/cmm/eolite/Eolite.c | 20 ++++++++++++++----- programs/cmm/eolite/include/icons.h | 4 ++-- programs/cmm/lib/file_system.h | 12 +++++++++++ programs/cmm/pixie2/settings.h | 4 +++- 7 files changed, 36 insertions(+), 11 deletions(-) rename data/common/{File Managers => settings}/eolite.ini (100%) diff --git a/data/common/settings/assoc.ini b/data/common/settings/assoc.ini index 71a1aa1df4..2b9b97ff91 100644 --- a/data/common/settings/assoc.ini +++ b/data/common/settings/assoc.ini @@ -176,4 +176,6 @@ gbc=/kolibrios/emul/gameboy min=/kolibrios/emul/pokemini zip=$Unz -7z=$Unz \ No newline at end of file +7z=$Unz + +vox=/kolibrios/3D/voxel_editor/VOXEL_EDITOR diff --git a/data/common/File Managers/eolite.ini b/data/common/settings/eolite.ini similarity index 100% rename from data/common/File Managers/eolite.ini rename to data/common/settings/eolite.ini diff --git a/programs/cmm/app_plus/app_plus.c b/programs/cmm/app_plus/app_plus.c index 40ff4fc0ea..24e8d78b3a 100644 --- a/programs/cmm/app_plus/app_plus.c +++ b/programs/cmm/app_plus/app_plus.c @@ -44,7 +44,7 @@ void CheckKosMounted() if (dir_exists("/kolibrios")) { if (file_exists(APP_PLUS_INI_PATH)) - io.run("syspanel", APP_PLUS_INI_PATH); + RunProgram("syspanel", APP_PLUS_INI_PATH); else notify(APP_PLUS_INI_NOT_EXISTS); ExitProcess(); @@ -101,7 +101,6 @@ void draw_window() 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); - DrawStandartCaptButton(x, Form.cheight-66, BTN_MANUAL_SEARCH, MANUALLY_BUTTON_TEXT); } diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 6cd1ec0532..e3911c885e 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -109,9 +109,14 @@ bool show_dev_name=true, libimg_image icons16_default; libimg_image icons16_selected; +//libimg_image icons32_default; +//libimg_image icons32_selected; + #define STATUS_BAR_H 16; 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}; PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; byte cmd_free=0; @@ -144,7 +149,7 @@ void main() load_dll(libio, #libio_init,1); load_dll(libimg, #libimg_init,1); - eolite_ini_path = abspath("Eolite.ini"); + eolite_ini_path = GetIni("Eolite.ini"); LoadIniSettings(); 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, 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 if (param) && (param[0]=='-') && (param[1]=='p') { @@ -696,15 +706,15 @@ void Line_ReDraw(dword bgcol, filenum){ file_offet, file_name_off, 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; char temp_path[sizeof(file_path)]; char label_file_name[4096]; if (filenum==-1) return; DrawBar(files.x,y,4,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); - if (files.item_h>16) DrawBar(files.x+4,icon_y+15,16,y+files.item_h-icon_y-15,bgcol); + DrawBar(files.x+4,y,icon_size,icon_y-y,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; attr = ESDWORD[file_offet]; @@ -769,7 +779,7 @@ void Line_ReDraw(dword bgcol, filenum){ } 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-68,y,1,files.item_h,col_list_line); //gray line 2 diff --git a/programs/cmm/eolite/include/icons.h b/programs/cmm/eolite/include/icons.h index bc7af982c8..319c7b4114 100644 --- a/programs/cmm/eolite/include/icons.h +++ b/programs/cmm/eolite/include/icons.h @@ -20,12 +20,12 @@ void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color) } 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); } 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); } } diff --git a/programs/cmm/lib/file_system.h b/programs/cmm/lib/file_system.h index 20ab9d334d..fe33515917 100644 --- a/programs/cmm/lib/file_system.h +++ b/programs/cmm/lib/file_system.h @@ -285,6 +285,18 @@ enum 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]; :dword ConvertSize(dword bytes) { diff --git a/programs/cmm/pixie2/settings.h b/programs/cmm/pixie2/settings.h index 79850c3685..d00d628b28 100644 --- a/programs/cmm/pixie2/settings.h +++ b/programs/cmm/pixie2/settings.h @@ -11,13 +11,15 @@ struct struct_pixie_colors { color_list_border; } theme; -_ini ini = { "/sys/media/pixie/pixie.ini", "Config" }; +_ini ini; #define WIN_W_SMALL 126 #define WIN_H_SMALL 31 void LoadIniConfig() { + ini.path = GetIni("pixie.ini"); + ini.section = "Config"; 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);