Eolite: fix, font.h: simple smooth just for Eolite

git-svn-id: svn://kolibrios.org@5761 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2015-08-22 13:27:12 +00:00
parent 1649825db0
commit bd8799a157
5 changed files with 52 additions and 31 deletions

View File

@ -270,7 +270,6 @@ void main()
break; break;
} }
if (two_panels) && (mouse.y > files.y) && (mouse.down) { if (two_panels) && (mouse.y > files.y) && (mouse.down) {
if (mouse.x<Form.cwidth/2) if (mouse.x<Form.cwidth/2)
{ {
@ -586,6 +585,9 @@ void DrawFilePanels()
if (active_panel==1) if (active_panel==1)
{ {
llist_copy(#files, #files_inactive);
strcpy(#path, #inactive_path);
col_selec = 0xCCCccc;
files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.line_h); files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.line_h);
DrawList(); DrawList();
Open_Dir(#path,WITH_REDRAW); Open_Dir(#path,WITH_REDRAW);
@ -646,7 +648,7 @@ void List_ReDraw()
} }
void Line_ReDraw(dword color, filenum){ void Line_ReDraw(dword bgcol, filenum){
dword text_col=0, dword text_col=0,
ext1, attr, ext1, attr,
file_offet, file_offet,
@ -654,11 +656,11 @@ void Line_ReDraw(dword color, filenum){
y=filenum*files.line_h+files.y; y=filenum*files.line_h+files.y;
BDVK file; BDVK file;
if (filenum==-1) return; if (filenum==-1) return;
DrawBar(files.x,y,3,files.line_h,color); DrawBar(files.x,y,3,files.line_h,bgcol);
DrawBar(files.x+19,y,files.w-19,files.line_h,color); DrawBar(files.x+19,y,files.w-19,files.line_h,bgcol);
DrawBar(files.x+3,y+17,16,1,color); DrawBar(files.x+3,y+17,16,1,bgcol);
if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,color); if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,bgcol);
if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,color); if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-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];
@ -670,17 +672,17 @@ void Line_ReDraw(dword color, filenum){
{ {
ext1 = strrchr(file_name_off,'.') + file_name_off; ext1 = strrchr(file_name_off,'.') + file_name_off;
if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing
Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0); Put_icon(ext1, files.x+3, files.line_h/2-7+y, bgcol, 0);
WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y + y,files.font_type,0,ConvertSize(file.sizelo)); WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y + y,files.font_type,0,ConvertSize(file.sizelo));
} }
else else
{ {
if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1="<DIR>"; if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1="<DIR>";
Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0); Put_icon(ext1, files.x+3, files.line_h/2-7+y, bgcol, 0);
} }
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 (color!=0xFFFfff) if (bgcol!=0xFFFfff)
{ {
itdir = TestBit(attr, 4); itdir = TestBit(attr, 4);
strcpy(#file_name, file_name_off); strcpy(#file_name, file_name_off);
@ -703,7 +705,7 @@ void Line_ReDraw(dword color, filenum){
} }
else else
{ {
font.bg_color = color; font.bg_color = bgcol;
font.text(files.x + 23, files.line_h - font.height / 2 - 1 + y, file_name_off); font.text(files.x + 23, files.line_h - font.height / 2 - 1 + y, file_name_off);
} }
DrawBar(files.x+files.w-141,y,1,files.line_h,system.color.work); //gray line 1 DrawBar(files.x+files.w-141,y,1,files.line_h,system.color.work); //gray line 1
@ -1103,7 +1105,6 @@ void FnProcess(byte N)
Tip(56, T_DEVICES, 55, "-"); Tip(56, T_DEVICES, 55, "-");
Open_Dir(#path,WITH_REDRAW); Open_Dir(#path,WITH_REDRAW);
pause(10); pause(10);
LoadIniSettings();
GetSystemDiscs(); GetSystemDiscs();
Open_Dir(#path,WITH_REDRAW); Open_Dir(#path,WITH_REDRAW);
DrawDeviceAndActionsLeftPanel(); DrawDeviceAndActionsLeftPanel();

View File

@ -27,13 +27,13 @@ int WinX, WinY, WinW, WinH;
void settings_dialog() void settings_dialog()
{ {
byte id; byte id;
active_settings=1;
loop(){ loop(){
switch(WaitEvent()) switch(WaitEvent())
{ {
case evButton: case evButton:
id=GetButtonID(); id=GetButtonID();
if (id==1) ExitSettings(); if (id==1) { ExitSettings(); break; }
else if (id==5) else if (id==5)
{ {
RunProgram("tinypad", "/sys/settings/assoc.ini"); RunProgram("tinypad", "/sys/settings/assoc.ini");
@ -47,9 +47,8 @@ void settings_dialog()
else if (id==26) && (files.line_h>18) files.line_h--; else if (id==26) && (files.line_h>18) files.line_h--;
else if (id==27) MOUSE_TIME++; else if (id==27) MOUSE_TIME++;
else if (id==28) && (MOUSE_TIME>29) MOUSE_TIME--; else if (id==28) && (MOUSE_TIME>29) MOUSE_TIME--;
else if (id==30) && (font.size.text<22) { font.size.text++; BigFontsChange(); } else if (id==30) { font.size.text++; IF(!font.changeSIZE()) font.size.text--; BigFontsChange(); }
else if (id==31) && (font.size.text>9) { font.size.text--; BigFontsChange(); } else if (id==31) { font.size.text--; IF(!font.changeSIZE()) font.size.text++; BigFontsChange(); }
SaveIniSettings();
EventRedrawWindow(Form.left,Form.top); EventRedrawWindow(Form.left,Form.top);
DrawSettingsCheckBoxes(); DrawSettingsCheckBoxes();
break; break;
@ -69,10 +68,9 @@ void settings_dialog()
void ExitSettings() void ExitSettings()
{ {
active_settings=0; active_settings = 0;
settings_window = 0; settings_window = 0;
cmd_free = 4; cmd_free = 4;
SaveIniSettings();
ExitProcess(); ExitProcess();
} }
@ -103,6 +101,9 @@ void LoadIniSettings()
ini_get_int stdcall (eolite_ini_path, #config_section, "WinW", 550); WinW = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "WinW", 550); WinW = EAX;
ini_get_int stdcall (eolite_ini_path, #config_section, "WinH", 500); WinH = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "WinH", 500); WinH = EAX;
BigFontsChange(); BigFontsChange();
files.SetFont(6, 6, 10000000b);
FileShow.font_size_x = files.font_w;
FileShow.font_number = 0;
} }
@ -152,10 +153,6 @@ void BigFontsChange()
files.line_h = font.height + 4; files.line_h = font.height + 4;
if (files.line_h<18) files.line_h = 18; if (files.line_h<18) files.line_h = 18;
files_active.line_h = files_inactive.line_h = files.line_h; files_active.line_h = files_inactive.line_h = files.line_h;
files.SetFont(6, 6, 10000000b);
FileShow.font_size_x = files.font_w;
FileShow.font_number = 0;
} }

View File

@ -1,5 +1,5 @@
#define TITLE "Eolite File Manager v3.1" #define TITLE "Eolite File Manager v3.12"
#define ABOUT_TITLE "Eolite 3.1" #define ABOUT_TITLE "Eolite 3.12"
#ifdef LANG_RUS #ifdef LANG_RUS
?define T_FILE "” ©«" ?define T_FILE "” ©«"

View File

@ -244,9 +244,31 @@ FONT font = 0;
IF(weight)len+=math.ceil(size.text/17); IF(weight)len+=math.ceil(size.text/17);
text1++; text1++;
} }
IF (no_bg_copy) && (!color) SmoothFont(buffer, size.width, size.height);
_PutImage(x,y,size.width,size.height,buffer); _PutImage(x,y,size.width,size.height,buffer);
return len; return len;
} }
inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; }
:void SmoothFont(dword color_image, w, h)
{
byte rr,gg,bb;
dword i,line_w,to, pixel;
line_w = w * 3;
to = w*h*3 + color_image - line_w - 3;
for (i = color_image; i < to; i+=3) {
if (i-color_image%line_w +3 == line_w) continue;
if (b24(i)==0x000000) && (b24(i+3)!=0x000000) && (b24(i+line_w)!=0x000000) && (b24(i+3+line_w)==0x000000)
{
ShadowImage(i+3, 1, 1, 2);
ShadowImage(i+line_w, 1, 1, 2);
}
else if (b24(i)!=0x000000) && (b24(i+3)==0x000000) && (b24(i+line_w)==0x000000) && (b24(i+3+line_w)!=0x000000)
{
ShadowImage(i, 1, 1, 2);
ShadowImage(i+3+line_w, 1, 1, 2);
}
}
}
:dword FONT::textarea(word x,y;dword text1,c;byte size) :dword FONT::textarea(word x,y;dword text1,c;byte size)
{ {

View File

@ -162,17 +162,18 @@
:void GrayScaleImage(dword color_image, w, h) :void GrayScaleImage(dword color_image, w, h)
{ {
dword i,gray,rr,gg,bb; dword i,gray,to,rr,gg,bb;
for (i = 0; i < w*h*3; i+=3) to = w*h*3 + color_image;
for (i = color_image; i < to; i+=3)
{ {
rr = DSBYTE[i+color_image]; rr = DSBYTE[i];
gg = DSBYTE[i+1+color_image]; gg = DSBYTE[i+1];
bb = DSBYTE[i+2+color_image]; bb = DSBYTE[i+2];
gray = rr*rr; gray = rr*rr;
gray += gg*gg; gray += gg*gg;
gray += bb*bb; gray += bb*bb;
gray = sqrt(gray) / 3; gray = sqrt(gray) / 3;
DSBYTE[i +color_image] = DSBYTE[i+1+color_image] = DSBYTE[i+2+color_image] = gray; DSBYTE[i] = DSBYTE[i+1] = DSBYTE[i+2] = gray;
} }
} }