Before: ```ini doc=3 docx=3 exc=3 inf=3 log=3 ob07=3 ob7=3 odt=3 rtf=3 txt=3 wtx=3 ``` Now: ```ini 3=doc,docx,exc,inf,log,ob07,odt,rtf,txt,wtx ``` Reviewed-on: #534 Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com> Reviewed-by: Ivan B <1+dunkaist@noreply.localhost> Reviewed-by: bad_Dr3dd0x <1702+bad_dr3dd0x@noreply.localhost> Co-authored-by: leency <lipatov.kiril@gmail.com> Co-committed-by: leency <lipatov.kiril@gmail.com>
This commit was merged in pull request #534.
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ img_files = {
|
||||
{"LANG.INC", build_type .. "/lang.inc"},
|
||||
{"NOTIFY3.PNG", "common/notify3.png"},
|
||||
{"3D/HOUSE.3DS", "common/3d/house.3ds"},
|
||||
{"File Managers/ICONS.INI", "common/File Managers/icons.ini"},
|
||||
{"File Managers/ICON2EXT.INI", "common/File Managers/icon2ext.ini"},
|
||||
{"FONTS/TAHOMA.KF", "common/fonts/tahoma.kf"},
|
||||
-- {"LIB/ICONV.OBJ", "common/lib/iconv.obj"},
|
||||
{"LIB/KMENU.OBJ", "common/lib/kmenu.obj"},
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
[icons18]
|
||||
0=<dir>
|
||||
1=<up>
|
||||
3=dic,doc,docx,exc,inf,log,ob07,odt,rtf,txt,wtx
|
||||
4=h,inc
|
||||
5=bwz,dsk,ima,img,imz,vfd,wil,wlz
|
||||
6=ani,bmp,cr2,crw,cur,dcr,dcx,dib,djv,djvu,fpx,gif,ico,iff,ilbm,iw4,j2c,j2k,jfif,jif,jp2,jpc,jpe,jpeg,jpg,jpk,jpx,lbm,mrw,nef,orf,pbm,pcd,pct,pcx,pef,pgm,pic,pict,pix,png,pnm,ppm,psd,psp,raf,ras,raw,rle,tga,tif,tiff,wbm,wbmp,x3f,xbm,xcf,xif,xpm
|
||||
7=aif,aifc,aiff,au,mp3,snd,wav,wm,wma,xm
|
||||
8=com,exe
|
||||
9=7z,arj,bz,bz2,cab,gz,ice,lha,lzh,rar,tar,taz,tbz,tbz2,tgz,uu,uue,xxe,z,zip,a
|
||||
10=ini
|
||||
11=3gp,avi,flv,mkv,mov,mp4,mpe,mpeg,mpg,vob,webm,wmv
|
||||
12=eml,htm,html,mht,url
|
||||
14=c,cpp,js,json
|
||||
15=3ds,asc,bjs,lif,stl,o
|
||||
16=kex
|
||||
17=skn
|
||||
18=dll,drv,obj,ocx,so
|
||||
19=cue,iso,mdf
|
||||
20=<lot>
|
||||
21=csv,xls,xlsx
|
||||
22=mid,midi
|
||||
23=min,nes,sna,snes,rom
|
||||
24=bat,sh
|
||||
25=sys
|
||||
26=pdf
|
||||
27=asm,h,java,pas,pp,xml
|
||||
28=bas
|
||||
29=fb2,ob7
|
||||
47=grf,mgb
|
||||
48=ch8
|
||||
52=css,dtp,pal
|
||||
59=chr,kf,mt,ttc,ttf
|
||||
60=cfg
|
||||
61=scr
|
||||
74=vox
|
||||
|
||||
[icons32]
|
||||
1=bat,com
|
||||
2=exe
|
||||
3=img
|
||||
5=ini
|
||||
13=lif
|
||||
28=csv,xls,xlsx
|
||||
30=vox
|
||||
31=htm,html,mht,url
|
||||
38=sys
|
||||
40=3gp,avi,flv,mkv,mov,mp4,mpe,mpeg,mpg,vob,webm,wmv
|
||||
44=fb2
|
||||
45=<dir>,<up>
|
||||
55=asm,log,sh
|
||||
60=<lot>
|
||||
64=mp3,wav,xm
|
||||
70=bmp,gif,jpeg,jpg,pcx,png
|
||||
73=pdf
|
||||
74=mid,midi
|
||||
78=3ds,stl
|
||||
80=skn
|
||||
88=kex
|
||||
89=7z,zip
|
||||
92=dll,obj
|
||||
118=kf
|
||||
121=mgb
|
||||
122=docx,rtf,txt
|
||||
|
||||
[drives18]
|
||||
r=58
|
||||
f=5
|
||||
t=51
|
||||
h=50
|
||||
b=50
|
||||
u=57
|
||||
c=19
|
||||
v=73
|
||||
|
||||
[drives32]
|
||||
r=49
|
||||
f=3
|
||||
t=36
|
||||
h=50
|
||||
b=50
|
||||
u=50
|
||||
c=50
|
||||
@@ -1,274 +0,0 @@
|
||||
[icons18]
|
||||
<dir>=0
|
||||
<up>=1
|
||||
<lot>=20
|
||||
mnt=2
|
||||
dic=3
|
||||
doc=3
|
||||
docx=3
|
||||
exc=3
|
||||
inf=3
|
||||
log=3
|
||||
ob07=3
|
||||
ob7=3
|
||||
odt=3
|
||||
rtf=3
|
||||
txt=3
|
||||
wtx=3
|
||||
h=4
|
||||
inc=4
|
||||
bwz=5
|
||||
dsk=5
|
||||
ima=5
|
||||
img=5
|
||||
imz=5
|
||||
vfd=5
|
||||
wil=5
|
||||
wlz=5
|
||||
ani=6
|
||||
bmp=6
|
||||
cr2=6
|
||||
crw=6
|
||||
cur=6
|
||||
dcr=6
|
||||
dcx=6
|
||||
dib=6
|
||||
djv=6
|
||||
djvu=6
|
||||
fpx=6
|
||||
gif=6
|
||||
ico=6
|
||||
iff=6
|
||||
ilbm=6
|
||||
iw4=6
|
||||
j2c=6
|
||||
j2k=6
|
||||
jfif=6
|
||||
jif=6
|
||||
jp2=6
|
||||
jpc=6
|
||||
jpe=6
|
||||
jpeg=6
|
||||
jpg=6
|
||||
jpk=6
|
||||
jpx=6
|
||||
lbm=6
|
||||
mrw=6
|
||||
nef=6
|
||||
orf=6
|
||||
pbm=6
|
||||
pcd=6
|
||||
pct=6
|
||||
pcx=6
|
||||
pef=6
|
||||
pgm=6
|
||||
pic=6
|
||||
pict=6
|
||||
pix=6
|
||||
png=6
|
||||
pnm=6
|
||||
ppm=6
|
||||
psd=6
|
||||
psp=6
|
||||
raf=6
|
||||
ras=6
|
||||
raw=6
|
||||
rle=6
|
||||
tga=6
|
||||
tif=6
|
||||
tiff=6
|
||||
wbm=6
|
||||
wbmp=6
|
||||
x3f=6
|
||||
xbm=6
|
||||
xcf=6
|
||||
xif=6
|
||||
xpm=6
|
||||
aif=7
|
||||
aifc=7
|
||||
aiff=7
|
||||
au=7
|
||||
mp3=7
|
||||
snd=7
|
||||
wav=7
|
||||
wm=7
|
||||
wma=7
|
||||
xm=7
|
||||
com=8
|
||||
exe=8
|
||||
7z=9
|
||||
arj=9
|
||||
bz=9
|
||||
bz2=9
|
||||
cab=9
|
||||
gz=9
|
||||
ice=9
|
||||
lha=9
|
||||
lzh=9
|
||||
rar=9
|
||||
tar=9
|
||||
taz=9
|
||||
tbz=9
|
||||
tbz2=9
|
||||
tgz=9
|
||||
uu=9
|
||||
uue=9
|
||||
xxe=9
|
||||
z=9
|
||||
zip=9
|
||||
ini=10
|
||||
3gp=11
|
||||
avi=11
|
||||
flv=11
|
||||
mkv=11
|
||||
mov=11
|
||||
mp4=11
|
||||
mpe=11
|
||||
mpeg=11
|
||||
mpg=11
|
||||
vob=11
|
||||
webm=11
|
||||
wmv=11
|
||||
eml=12
|
||||
htm=12
|
||||
html=12
|
||||
mht=12
|
||||
url=12
|
||||
c=14
|
||||
cpp=14
|
||||
js=14
|
||||
json=14
|
||||
3ds=15
|
||||
asc=15
|
||||
bjs=15
|
||||
lif=15
|
||||
stl=15
|
||||
vox=15
|
||||
kex=16
|
||||
skn=17
|
||||
dll=18
|
||||
drv=18
|
||||
obj=18
|
||||
ocx=18
|
||||
so=18
|
||||
cue=19
|
||||
iso=19
|
||||
mdf=19
|
||||
csv=21
|
||||
xls=21
|
||||
xlsx=21
|
||||
mid=22
|
||||
midi=22
|
||||
min=23
|
||||
nes=23
|
||||
sna=23
|
||||
snes=23
|
||||
rom=23
|
||||
bat=24
|
||||
sh=24
|
||||
sys=25
|
||||
pdf=26
|
||||
asm=27
|
||||
h=27
|
||||
java=27
|
||||
pas=27
|
||||
pp=27
|
||||
xml=27
|
||||
bas=28
|
||||
fb2=18
|
||||
grf=47
|
||||
mgb=47
|
||||
ch8=48
|
||||
css=52
|
||||
dtp=52
|
||||
pal=52
|
||||
chr=59
|
||||
kf=59
|
||||
mt=59
|
||||
ttc=59
|
||||
ttf=59
|
||||
cfg=60
|
||||
scr=61
|
||||
com=63
|
||||
|
||||
|
||||
[icons32]
|
||||
<dir>=45
|
||||
<up>=45
|
||||
<lot>=60
|
||||
bat=1
|
||||
com=1
|
||||
exe=2
|
||||
img=3
|
||||
ini=5
|
||||
lif=13
|
||||
csv=28
|
||||
xls=28
|
||||
xlsx=28
|
||||
vox=30
|
||||
htm=31
|
||||
html=31
|
||||
mht=31
|
||||
url=31
|
||||
sys=38
|
||||
3gp=40
|
||||
avi=40
|
||||
flv=40
|
||||
mkv=40
|
||||
mov=40
|
||||
mp4=40
|
||||
mpe=40
|
||||
mpeg=40
|
||||
mpg=40
|
||||
vob=40
|
||||
webm=40
|
||||
wmv=40
|
||||
fb2=44
|
||||
asm=55
|
||||
log=55
|
||||
sh=55
|
||||
mp3=64
|
||||
wav=64
|
||||
xm=64
|
||||
bmp=70
|
||||
gif=70
|
||||
jpeg=70
|
||||
jpg=70
|
||||
pcx=70
|
||||
png=70
|
||||
pdf=73
|
||||
mid=74
|
||||
midi=74
|
||||
3ds=78
|
||||
stl=78
|
||||
skn=80
|
||||
kex=88
|
||||
7z=89
|
||||
zip=89
|
||||
dll=92
|
||||
obj=92
|
||||
kf=118
|
||||
mgb=121
|
||||
docx=122
|
||||
rtf=122
|
||||
txt=122
|
||||
|
||||
|
||||
[drives16]
|
||||
r=58
|
||||
f=5
|
||||
t=51
|
||||
h=50
|
||||
b=50
|
||||
u=57
|
||||
c=19
|
||||
|
||||
|
||||
[drives32]
|
||||
r=49
|
||||
f=3
|
||||
t=36
|
||||
h=50
|
||||
b=50
|
||||
u=50
|
||||
c=50
|
||||
@@ -112,7 +112,7 @@ edit_box popin_text = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x1000000
|
||||
|
||||
PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
|
||||
|
||||
_ini icons_ini = { "/sys/File managers/icons.ini", NULL };
|
||||
_ini icons_ini = { "/sys/File managers/icon2ext.ini", NULL };
|
||||
|
||||
#include "include\settings.h"
|
||||
#include "include\gui.h"
|
||||
|
||||
@@ -3,13 +3,71 @@ struct ICONS_INI {
|
||||
collection exts;
|
||||
collection_int i18;
|
||||
collection_int i32;
|
||||
byte loaded;
|
||||
int get();
|
||||
void load();
|
||||
void put();
|
||||
} ini_icons;
|
||||
|
||||
// Stores the icon number for a single extension, keeping the exts/i18/i32
|
||||
// collections aligned by position regardless of the order keys are read in.
|
||||
void ICONS_INI::put(dword _ext, int size, icon_n)
|
||||
{
|
||||
int ext_pos = exts.get_pos_by_name(_ext);
|
||||
if (ext_pos == -1) {
|
||||
exts.add(_ext);
|
||||
ext_pos = exts.count - 1;
|
||||
}
|
||||
if (size == 18) i18.set(ext_pos, icon_n);
|
||||
else i32.set(ext_pos, icon_n);
|
||||
}
|
||||
|
||||
// Callback for ini_enum_keys: key_name is the icon number, key_value is a
|
||||
// comma-separated list of extensions sharing that icon, e.g.
|
||||
// 3=doc,docx,exc,inf,log,ob07,odt,rtf,txt,wtx
|
||||
byte icons_ini_enum_key(dword key_value, key_name, sec_name, f_name)
|
||||
{
|
||||
char ext[7];
|
||||
int icon_n, size, i;
|
||||
dword src;
|
||||
|
||||
icon_n = atoi(key_name);
|
||||
if (streq(sec_name, "icons18")) size = 18; else size = 32;
|
||||
|
||||
src = key_value;
|
||||
while (ESBYTE[src]) {
|
||||
i = 0;
|
||||
while (ESBYTE[src]) && (ESBYTE[src] != ',') {
|
||||
if (ESBYTE[src] != ' ') && (i < 6) {
|
||||
ext[i] = ESBYTE[src];
|
||||
i++;
|
||||
}
|
||||
src++;
|
||||
}
|
||||
ext[i] = '\0';
|
||||
if (i) {
|
||||
strlwr(#ext);
|
||||
ini_icons.put(#ext, size, icon_n);
|
||||
}
|
||||
if (ESBYTE[src] == ',') src++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reads the whole icon map once into the collections.
|
||||
void ICONS_INI::load()
|
||||
{
|
||||
if (loaded) return;
|
||||
loaded = true;
|
||||
ini_enum_keys stdcall (icons_ini.path, "icons18", #icons_ini_enum_key);
|
||||
ini_enum_keys stdcall (icons_ini.path, "icons32", #icons_ini_enum_key);
|
||||
}
|
||||
|
||||
int ICONS_INI::get(dword _file_path, _ext, int size)
|
||||
{
|
||||
char file_4bytes[4], ext[7];
|
||||
int ext_pos;
|
||||
load();
|
||||
if (!_ext) {
|
||||
ReadFile(0,4,#file_4bytes,_file_path);
|
||||
IF(DSDWORD[#file_4bytes]=='KCPK')
|
||||
@@ -22,16 +80,10 @@ int ICONS_INI::get(dword _file_path, _ext, int size)
|
||||
ext_pos = exts.get_pos_by_name(#ext);
|
||||
if (ext_pos != -1) {
|
||||
if (size == 18) return i18.get(ext_pos);
|
||||
else if (size == 32) return i32.get(ext_pos);
|
||||
} else {
|
||||
exts.add(#ext);
|
||||
icons_ini.section = "icons18";
|
||||
i18.set(exts.count-1, icons_ini.GetInt(#ext, 2));
|
||||
|
||||
icons_ini.section = "icons32";
|
||||
i32.set(exts.count-1, icons_ini.GetInt(#ext, 95));
|
||||
return get(#ext, size);
|
||||
if (size == 32) return i32.get(ext_pos);
|
||||
}
|
||||
if (size == 18) return 2;
|
||||
return 95;
|
||||
}
|
||||
|
||||
void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
|
||||
@@ -49,7 +101,7 @@ void DrawIconByExtension(dword file_path, extension, xx, yy, fairing_color)
|
||||
icons_ini.section = "drives32";
|
||||
icon_n = icons_ini.GetInt(#ext, 50);
|
||||
} else {
|
||||
icons_ini.section = "drives16";
|
||||
icons_ini.section = "drives18";
|
||||
icon_n = icons_ini.GetInt(#ext, 50);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -89,7 +89,7 @@ void RESULTS::drop()
|
||||
|
||||
void SearchThread()
|
||||
{
|
||||
int prev_first, prev_cur_y, clicked_item;
|
||||
int prev_first, prev_cur_y, clicked_item;
|
||||
|
||||
load_dll(Proc_lib, #OpenDialog_init,0);
|
||||
OpenDialog_init stdcall (#open_folder_dialog);
|
||||
@@ -112,17 +112,17 @@ void SearchThread()
|
||||
SelectList_Draw();
|
||||
} else {
|
||||
SelectList_DrawLine(select_list.cur_y);
|
||||
|
||||
clicked_item = mouse.y - select_list.y / select_list.item_h + select_list.first;
|
||||
|
||||
clicked_item = mouse.y - select_list.y / select_list.item_h + select_list.first;
|
||||
|
||||
if (select_list.MouseOver(mouse.x, mouse.y))
|
||||
{
|
||||
if (mouse.key&MOUSE_LEFT) && (mouse.up) {
|
||||
if ((prev_cur_y == select_list.cur_y) && (clicked_item < results.count)) EventRunFile();
|
||||
if ((prev_cur_y == select_list.cur_y) && (clicked_item < results.count)) EventRunFile();
|
||||
}
|
||||
|
||||
if (mouse.key&MOUSE_RIGHT) && (mouse.up) {
|
||||
if ((prev_cur_y == select_list.cur_y) && (clicked_item < results.count)) EventShowFileInFolder();
|
||||
if ((prev_cur_y == select_list.cur_y) && (clicked_item < results.count)) EventShowFileInFolder();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,8 +222,7 @@ void SelectList_DrawLine(dword i)
|
||||
} else {
|
||||
strcpy(#tname, results.name.get(select_list.first + i));
|
||||
strlwr(#tname);
|
||||
icons_ini.section = "icons18";
|
||||
icon = icons_ini.GetInt(#tname + strrchr(#tname, '.'), 2);
|
||||
icon = ini_icons.get(0, #tname + strrchr(#tname, '.'), 18);
|
||||
}
|
||||
|
||||
#define ICONX 7
|
||||
|
||||
@@ -1969,24 +1969,102 @@ convert_icons:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
calc_ini:
|
||||
mov eax,[image_file]
|
||||
mov [file_browser_data_1.ini_file_start],eax
|
||||
; Convert the new "ID=ext,ext,..." icons18 layout from the loaded ini file into
|
||||
; the "ext=ID" CR/LF text that box_lib's FileBrowser expects, storing the result
|
||||
; in converted_ini_buffer. Every scan is bounded by ini_src_end, so a truncated
|
||||
; or malformed file can never read past the loaded buffer (it has no 0 terminator).
|
||||
pusha
|
||||
mov esi, [image_file]
|
||||
mov eax, esi
|
||||
add eax, [img_size]
|
||||
mov [ini_src_end], eax
|
||||
mov edi, converted_ini_buffer
|
||||
mov [file_browser_data_1.ini_file_start], edi
|
||||
|
||||
mov edi,eax
|
||||
add edi,[img_size]
|
||||
dec edi
|
||||
mov esi,eax
|
||||
add esi,9 ; after [icons18]
|
||||
cld
|
||||
@@:
|
||||
; find the "[icons18]" section header
|
||||
.find_section:
|
||||
cmp esi, [ini_src_end]
|
||||
jae .finished
|
||||
lodsb
|
||||
cmp esi,edi
|
||||
je @f
|
||||
cmp al,byte '['
|
||||
jne @r
|
||||
cmp al, '['
|
||||
jne .find_section
|
||||
cmp dword [esi], 'icon'
|
||||
jne .find_section
|
||||
.skip_header:
|
||||
cmp esi, [ini_src_end]
|
||||
jae .finished
|
||||
lodsb
|
||||
cmp al, 10
|
||||
jne .skip_header
|
||||
|
||||
@@:
|
||||
mov [file_browser_data_1.ini_file_end],esi
|
||||
; convert each "ID=ext,ext,..." line until the next section or EOF
|
||||
.parse_line:
|
||||
cmp esi, [ini_src_end]
|
||||
jae .finished
|
||||
cmp byte [esi], '['
|
||||
je .finished
|
||||
mov edx, esi ; edx = ID start
|
||||
.find_eq:
|
||||
cmp esi, [ini_src_end]
|
||||
jae .finished
|
||||
lodsb
|
||||
cmp al, '='
|
||||
jne .find_eq
|
||||
lea ebx, [esi-1]
|
||||
sub ebx, edx ; ebx = ID length
|
||||
|
||||
.next_ext:
|
||||
mov ebp, esi ; ebp = extension start
|
||||
.scan_ext:
|
||||
cmp esi, [ini_src_end]
|
||||
jae .finished
|
||||
lodsb
|
||||
cmp al, ','
|
||||
je .ext_sep
|
||||
cmp al, 13
|
||||
je .ext_eol
|
||||
cmp al, 10
|
||||
je .ext_eol
|
||||
jmp .scan_ext
|
||||
.ext_sep:
|
||||
call .emit_ext
|
||||
jmp .next_ext
|
||||
.ext_eol:
|
||||
call .emit_ext
|
||||
.skip_eol: ; absorb the whole CR/LF run (and blank lines)
|
||||
cmp esi, [ini_src_end]
|
||||
jae .finished
|
||||
lodsb
|
||||
cmp al, 13
|
||||
je .skip_eol
|
||||
cmp al, 10
|
||||
je .skip_eol
|
||||
dec esi
|
||||
jmp .parse_line
|
||||
|
||||
.finished:
|
||||
mov [file_browser_data_1.ini_file_end], edi
|
||||
popa
|
||||
ret
|
||||
|
||||
; Emit one "ext=ID\r\n" record. esi-1 = delimiter just consumed, ebp = ext start,
|
||||
; edx/ebx = ID start/length. Empty extensions are skipped, esi is preserved.
|
||||
.emit_ext:
|
||||
push esi
|
||||
lea ecx, [esi-1]
|
||||
sub ecx, ebp ; ecx = extension length
|
||||
jecxz .emit_done ; drop empty extension
|
||||
mov esi, ebp
|
||||
rep movsb ; ext
|
||||
mov al, '='
|
||||
stosb
|
||||
mov esi, edx
|
||||
mov ecx, ebx
|
||||
rep movsb ; ID
|
||||
mov ax, 0x0A0D
|
||||
stosw ; CR, LF
|
||||
.emit_done:
|
||||
pop esi
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
load_ini:
|
||||
@@ -2877,7 +2955,7 @@ root_pach:
|
||||
|
||||
icons_file_name_2 db 'buttons/'
|
||||
icons_path db '/sys/icons18.png',0
|
||||
ini_file_name db '/sys/File managers/icons.ini',0
|
||||
ini_file_name db '/sys/File managers/icon2ext.ini',0
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
message:
|
||||
@@ -3265,6 +3343,11 @@ dir_path_temp:
|
||||
text_work_area:
|
||||
rb 1024
|
||||
;---------------------------------------------------------------------
|
||||
converted_ini_buffer:
|
||||
rb 8192
|
||||
ini_src_end:
|
||||
rd 1
|
||||
;---------------------------------------------------------------------
|
||||
procinfo:
|
||||
process_info:
|
||||
rb 1024
|
||||
|
||||
Reference in New Issue
Block a user