Eolite 3.82: use icons16.png for icons and "/sys/File Managers/icons.ini" for icon associations instead of build in data

git-svn-id: svn://kolibrios.org@7054 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2017-10-05 21:38:09 +00:00
parent d047f779c8
commit b80a9d4dc8
8 changed files with 111 additions and 159 deletions

View File

@ -1,6 +1,6 @@
[icons16] [icons16]
asm=4 <dir>=0
inc=4 <up>=22
txt=3 txt=3
rtf=3 rtf=3
ini=3 ini=3
@ -13,6 +13,16 @@ inf=3
xml=3 xml=3
odt=3 odt=3
fb2=3 fb2=3
asm=4
inc=4
img=5
ima=5
imz=5
bwz=5
dsk=5
vfd=5
wil=5
wlz=5
jpg=6 jpg=6
jpe=6 jpe=6
jpeg=6 jpeg=6
@ -84,27 +94,8 @@ au=7
snd=7 snd=7
wma=7 wma=7
wm=7 wm=7
avi=11
mpg=11
mpe=11
mpeg=11
flv=11
3gp=11
mkv=11
wmv=11
mov=11
mp4=11
img=5
ima=5
imz=5
bwz=5
dsk=5
vfd=5
wil=5
wlz=5
exe=8 exe=8
com=8 com=8
bat=8
7z=9 7z=9
rar=9 rar=9
zip=9 zip=9
@ -126,6 +117,16 @@ uu=9
xxe=9 xxe=9
z=9 z=9
dat=10 dat=10
avi=11
mpg=11
mpe=11
mpeg=11
flv=11
3gp=11
mkv=11
wmv=11
mov=11
mp4=11
ttf=12 ttf=12
ttc=12 ttc=12
chr=12 chr=12
@ -144,3 +145,13 @@ dll=18
ocx=18 ocx=18
so=18 so=18
drv=18 drv=18
iso=19
cue=19
mdf=19
grf=20
xls=21
xlsx=21
nes=23
bat=24
sh=24
sys=25

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -7,23 +7,26 @@
//libraries //libraries
#define MEMSIZE 4096 * 180 #define MEMSIZE 4096 * 180
#include "..\lib\clipboard.h" #include "../lib/clipboard.h"
#include "..\lib\strings.h" #include "../lib/strings.h"
#include "..\lib\mem.h" #include "../lib/mem.h"
#include "..\lib\file_system.h" #include "../lib/file_system.h"
#include "..\lib\gui.h" #include "../lib/gui.h"
#include "..\lib\list_box.h" #include "../lib/list_box.h"
#include "..\lib\random.h" #include "../lib/random.h"
#include "..\lib\kfont.h" #include "../lib/kfont.h"
#include "..\lib\collection.h" #include "../lib/collection.h"
#include "..\lib\menu.h" #include "../lib/menu.h"
#include "..\lib\obj\libini.h" #include "../lib/copyf.h"
#include "..\lib\obj\box_lib.h"
#include "..\lib\patterns\history.h" #include "../lib/obj/libini.h"
#include "../lib/obj/box_lib.h"
#include "../lib/patterns/history.h"
#include "../lib/patterns/libimg_load_skin.h"
//images //images
#include "imgs\left_p.txt" #include "imgs/left_p.txt"
#include "imgs\icons.txt"
//Button IDs //Button IDs
enum { enum {
@ -103,6 +106,9 @@ bool show_dev_name=true,
active_panel=1; active_panel=1;
//} settings; //} settings;
libimg_image icons16_default;
libimg_image icons16_selected;
#define STATUS_BAR_H 16; #define STATUS_BAR_H 16;
int status_bar_h = 0; int status_bar_h = 0;
@ -114,7 +120,6 @@ byte cmd_free=0;
#include "include\settings.h" #include "include\settings.h"
#include "include\progress_dialog.h" #include "include\progress_dialog.h"
#include "..\lib\copyf.h"
#include "include\copy.h" #include "include\copy.h"
#include "include\gui.h" #include "include\gui.h"
#include "include\sorting.h" #include "include\sorting.h"
@ -136,6 +141,8 @@ void main()
load_dll(boxlib, #box_lib_init,0); load_dll(boxlib, #box_lib_init,0);
load_dll(libini, #lib_init,1); load_dll(libini, #lib_init,1);
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1);
eolite_ini_path = abspath("Eolite.ini"); eolite_ini_path = abspath("Eolite.ini");
@ -143,6 +150,11 @@ void main()
SystemDiscs.Get(); SystemDiscs.Get();
SetAppColors(); SetAppColors();
Libimg_LoadImage(#icons16_default, "/sys/icons16.png");
Libimg_LoadImage(#icons16_selected, "/sys/icons16.png");
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, 0xFF94AECE);
//-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')
{ {
@ -316,7 +328,7 @@ void main()
id=GetButtonID(); id=GetButtonID();
switch(id) switch(id)
{ {
case 01: case CLOSE_BTN:
KillProcess(about_window); KillProcess(about_window);
SaveIniSettings(); SaveIniSettings();
ExitProcess(); ExitProcess();
@ -360,7 +372,7 @@ void main()
DeleteButton(POPUP_BTN1); DeleteButton(POPUP_BTN1);
DeleteButton(POPUP_BTN2); DeleteButton(POPUP_BTN2);
break; break;
case BREADCRUMB_ID...400: case BREADCRUMB_ID...360:
ClickOnBreadCrumb(id-BREADCRUMB_ID); ClickOnBreadCrumb(id-BREADCRUMB_ID);
break; break;
} }
@ -688,10 +700,10 @@ void Line_ReDraw(dword bgcol, filenum){
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,3,files.item_h,bgcol); DrawBar(files.x,y,4,files.item_h,bgcol);
DrawBar(files.x+19,y,files.w-19,files.item_h,bgcol); DrawBar(files.x+20,y,files.w-20,files.item_h,bgcol);
if (files.item_h>15) DrawBar(files.x+3,y,16,icon_y-y,bgcol); DrawBar(files.x+4,y,16,icon_y-y,bgcol);
if (files.item_h>16) DrawBar(files.x+3,icon_y+15,16,y+files.item_h-icon_y-15,bgcol); if (files.item_h>16) DrawBar(files.x+4,icon_y+15,16,y+files.item_h-icon_y-15,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];
@ -715,13 +727,13 @@ void Line_ReDraw(dword bgcol, filenum){
} }
else else
{ {
if (!strncmp(file_name_off,"..",3)) ext1=".."; else { if (!strncmp(file_name_off,"..",3)) ext1="<up>"; else {
ext1="<DIR>"; ext1="<DIR>";
WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1); WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1);
} }
} }
sprintf(#temp_path,"%s/%s",#path,file_name_off); sprintf(#temp_path,"%s/%s",#path,file_name_off);
DrawIconByExtension(#temp_path, ext1, files.x+3, icon_y, bgcol); DrawIconByExtension(#temp_path, ext1, files.x+4, icon_y, bgcol);
if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden? if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
if (bgcol!=0xFFFfff) if (bgcol!=0xFFFfff)

View File

@ -1,55 +1,32 @@
char *ext[]={ _ini icons = { "/sys/File managers/icons.ini", "icons16" };
"..", 17,
"<dir>",16, "<DIR>",16,
"txt", 1, "doc", 1, "rtf", 1, "odt", 1, "log", 1, "docx",1,
"htm", 2, "html",2, "mht", 2,
"ini", 3, "js", 3, "conf",3, "inf", 3,
"xlt", 4, "xls", 4, "ods", 4, "xlsx",4,
"cmd", 5, "bat", 5, "py", 5, "sh", 5, "ksh", 5, "com", 5,
"kex", 6, "lua", 6,
"exe", 7, "msi", 7,
"sys", 8, "ocx", 8, "drv", 8, "so", 8,
"inc", 9,
"chr", 10, "mt", 10, "ttf", 10, "fon", 10, "kf", 10,
"asm", 11,
"mp3", 12, "wav", 12, "mid", 12, "midi",12, "ogg", 12, "wma", 12, "flac",12,
"skn", 13,
"avi", 14, "flv", 14, "mpg", 14, "wmv", 14, "mov", 14, "mkv", 14, "mp4", 14, "vob", 14, "webm", 14,
"djvu",15, "pdf", 15, "fb2", 15,
"nes", 18, "smc", 18, "min", 18,
"gif", 19, "bmp", 19, "tga", 19, "pcx", 19, "png", 19, "pnm", 19, "jpg", 19, "xcf", 19, "ai", 19,
"jpeg",19, "raw", 11, "psd", 19, "wbmp",19, "tiff",19, "tif", 19,
"3ds", 20, "asc", 20, "ico", 20, "cur", 20, "ani", 20, "vox", 20,
"img", 21, "ima", 21,
"dll", 22, "obj", 22, "dict",22,
"rar", 23, "zip", 23, "cab", 23, "tar", 23, "ajr", 23, "jar", 23, "7z", 23, "gz", 23, "kexp", 23,
"iso", 24, "cue", 24, "nrg", 24, "mdf", 24,
"grf", 25,
0,0};
void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color) void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
{ {
char BYTE_HEAD_FILE[4]; char BYTE_HEAD_FILE[4];
char ext[512];
int i; int i;
dword icon_n=0; dword icon_n=0;
if (extension) for (i=0; ext[i]!=0; i+=2;)
if (extension)
{ {
if (strcmpi(extension, ext[i])==0) strcpy(#ext, extension);
{ strlwr(#ext);
icon_n = ext[i+1]; icon_n = icons.GetInt(#ext, 2);
break;
}
} }
else if (file_path) else if (file_path)
{ {
//if (!strncmp(file_path, "/rd/1",5)) || (!strncmp(file_path, "/tmp",4)) {
ReadFile(0,4,#BYTE_HEAD_FILE,file_path); ReadFile(0,4,#BYTE_HEAD_FILE,file_path);
IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM') icon_n = 6; IF(DSDWORD[#BYTE_HEAD_FILE]=='KCPK')||(DSDWORD[#BYTE_HEAD_FILE]=='UNEM') icon_n = icons.GetInt("kex", 2);
//} }
if (fairing_color==col_selec)
{
img_draw stdcall(icons16_selected.image, xx, yy, 16, 16, 0, icon_n*16);
IconFairing(icon_n, xx, yy, fairing_color);
}
else
{
img_draw stdcall(icons16_default.image, xx, yy, 16, 16, 0, icon_n*16);
} }
ficons_pal[0] = fairing_color;
PutPaletteImage(icon_n*16*15+#ficons,16,15,xx,yy,8,#ficons_pal);
if (fairing_color!=0xFFFfff) IconFairing(icon_n, xx, yy, fairing_color);
} }
@ -57,35 +34,24 @@ void IconFairing(dword filenum, x,y, color)
{ {
switch(filenum) switch(filenum)
{ {
case 0...1: //file case 0: //folder
case 3: //íàñòðîéêè case 22: //<up>
RIGHT_PAINT: DrawBar(x+7,y,8,2,color);
PutPixel(x+10,y,color); IF (filenum==22) PutPixel(x+10,y+1,0x1A7B17); //green arrow part
PutPixel(x+11,y+1,color); DrawBar(x,y+13,15,2,color);
PutPixel(x+12,y+2,color); PutPixel(x,y,color);
PutPixel(x+13,y+3,color); PutPixel(x+6,y,color);
PutPixel(x+14,y+2,color);
PutPixel(x,y+12,color);
PutPixel(x+14,y+12,color);
return; return;
case 2: //html case 13: //html
DrawBar(x,y,1,7,color); DrawBar(x,y,1,7,color);
DrawBar(x+1,y,1,6,color); DrawBar(x+1,y,1,6,color);
DrawBar(x,y+10,1,5,color); DrawBar(x,y+10,1,5,color);
DrawBar(x+1,y+11,1,4,color); DrawBar(x+1,y+11,1,4,color);
GOTO RIGHT_PAINT;
case 9: //inc
DrawBar(x+13,y,1,3,color);
DrawBar(x+14,y,2,4,color);
DrawBar(x+15,y,1,15,color);
PutPixel(x+3,y+14,color);
DrawBar(x+4,y+13,1,2,color);
DrawBar(x+5,y+12,10,3,color);
PutPixel(x+10,y+11,color);
DrawBar(x+11,y+10,1,2,color);
DrawBar(x+12,y+9,1,3,color);
PutPixel(x+12,y+7,color);
DrawBar(x+13,y+6,2,7,color);
PutPixel(x+14,y+5,color);
return; return;
case 10: //font case 12: //font
DrawBar(x+1,y+1,1,13,color); DrawBar(x+1,y+1,1,13,color);
DrawBar(x+2,y+1,1,11,color); DrawBar(x+2,y+1,1,11,color);
DrawBar(x+3,y+1,1,10,color); DrawBar(x+3,y+1,1,10,color);
@ -100,57 +66,10 @@ void IconFairing(dword filenum, x,y, color)
DrawBar(x+8,y+10,2,1,color); DrawBar(x+8,y+10,2,1,color);
DrawBar(x+7,y+11,2,3,color); DrawBar(x+7,y+11,2,3,color);
return; return;
case 12: //audio case 23: //nes
PutPixel(x+2,y+9,color);
PutPixel(x+1,y+10,color);
PutPixel(x+10,y+8,color);
PutPixel(x+9,y+9,color);
PutPixel(x+6,y+13,color);
PutPixel(x+5,y+14,color);
PutPixel(x+14,y+12,color);
PutPixel(x+13,y+13,color);
return;
case 13: //skin
PutPixel(x+15,y,color);
return;
case 16...17: //folder
DrawBar(x,y,1,15,color);
DrawBar(x+8,y,8,2,color);
IF (filenum==17) PutPixel(x+11,y+1,0x1A7B17); //green arrow part
DrawBar(x+1,y+13,15,2,color);
PutPixel(x+1,y,color);
PutPixel(x+7,y,color);
PutPixel(x+15,y+2,color);
PutPixel(x+1,y+12,color);
PutPixel(x+15,y+12,color);
return;
case 18:
DrawBar(x,y+11,1,2,color); DrawBar(x,y+11,1,2,color);
DrawBar(x+15,y+11,1,2,color); DrawBar(x+15,y+11,1,2,color);
DrawBar(x,y+13,16,1,color); DrawBar(x,y+13,16,1,color);
return; return;
case 24:
DrawBar(x,y,6,1,color);
DrawBar(x,y+1,4,1,color);
DrawBar(x,y+2,3,1,color);
DrawBar(x,y+3,2,2,color);
DrawBar(x,y+5,1,5,color);
DrawBar(x,y+10,2,2,color);
DrawBar(x,y+12,3,1,color);
DrawBar(x,y+13,4,1,color);
DrawBar(x,y+14,6,1,color);
DrawBar(x+11,y,5,1,color);
DrawBar(x+13,y+1,3,1,color);
DrawBar(x+14,y+2,2,1,color);
DrawBar(x+15,y+3,1,2,color);
DrawBar(x+15,y+10,1,2,color);
DrawBar(x+14,y+12,2,1,color);
DrawBar(x+13,y+13,3,1,color);
DrawBar(x+11,y+14,5,1,color);
} }
} }

View File

@ -76,7 +76,7 @@ void settings_dialog()
else if (id==24) two_panels ^= true; else if (id==24) two_panels ^= true;
else if (id==32) show_breadcrumb ^= true; else if (id==32) show_breadcrumb ^= true;
else if (id==25) { files.item_h++; files_active.item_h = files_inactive.item_h = files.item_h; } else if (id==25) { files.item_h++; files_active.item_h = files_inactive.item_h = files.item_h; }
else if (id==26) && (files.item_h>15) files_inactive.item_h = files.item_h = files.item_h-1; else if (id==26) && (files.item_h>16) files_inactive.item_h = files.item_h = files.item_h-1;
else if (id==27) show_status_bar ^= 1; else if (id==27) show_status_bar ^= 1;
else if (id==30) { kfont.size.pt++; IF(!kfont.changeSIZE()) kfont.size.pt--; BigFontsChange(); } else if (id==30) { kfont.size.pt++; IF(!kfont.changeSIZE()) kfont.size.pt--; BigFontsChange(); }
else if (id==31) { kfont.size.pt--; IF(!kfont.changeSIZE()) kfont.size.pt++; BigFontsChange(); } else if (id==31) { kfont.size.pt--; IF(!kfont.changeSIZE()) kfont.size.pt++; BigFontsChange(); }

View File

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

View File

@ -62,6 +62,8 @@ char program_path[4096];
#define BT_HIDE 0x40000000 #define BT_HIDE 0x40000000
#define BT_NOFRAME 0x20000000 #define BT_NOFRAME 0x20000000
#define CLOSE_BTN 1
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include "../lib/system.h" #include "../lib/system.h"

View File

@ -27,4 +27,12 @@
for (i = image_data; i < max_i; i += 4) if (DSDWORD[i]==0) DSDWORD[i] = new_transparent_color; for (i = image_data; i < max_i; i += 4) if (DSDWORD[i]==0) DSDWORD[i] = new_transparent_color;
} }
:void Libimg_ReplaceColor(dword struct_pointer, w, h, old_color, new_color)
{
dword i, max_i, image_data;
image_data = ESDWORD[struct_pointer + 24];
max_i = w * h * 4 + image_data;
for (i = image_data; i < max_i; i += 4) if (DSDWORD[i]==old_color) DSDWORD[i] = new_color;
}
#endif #endif