From bd8799a157828a7697239da7524a2e56063957da Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sat, 22 Aug 2015 13:27:12 +0000 Subject: [PATCH] Eolite: fix, font.h: simple smooth just for Eolite git-svn-id: svn://kolibrios.org@5761 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/eolite/Eolite.c | 25 +++++++++++----------- programs/cmm/eolite/include/settings.h | 19 +++++++--------- programs/cmm/eolite/include/translations.h | 4 ++-- programs/cmm/lib/font.h | 22 +++++++++++++++++++ programs/cmm/lib/gui.h | 13 +++++------ 5 files changed, 52 insertions(+), 31 deletions(-) diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index ef2bd339d3..2daec83d08 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -270,7 +270,6 @@ void main() break; } - if (two_panels) && (mouse.y > files.y) && (mouse.down) { if (mouse.x18) DrawBar(files.x+3,y+18,16,files.line_h-18,color); - if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,color); + DrawBar(files.x,y,3,files.line_h,bgcol); + DrawBar(files.x+19,y,files.w-19,files.line_h,bgcol); + 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,bgcol); + 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; attr = ESDWORD[file_offet]; @@ -670,17 +672,17 @@ void Line_ReDraw(dword color, filenum){ { ext1 = strrchr(file_name_off,'.') + file_name_off; 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)); } else { if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1=""; - 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 (color!=0xFFFfff) + if (bgcol!=0xFFFfff) { itdir = TestBit(attr, 4); strcpy(#file_name, file_name_off); @@ -703,7 +705,7 @@ void Line_ReDraw(dword color, filenum){ } 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); } 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, "-"); Open_Dir(#path,WITH_REDRAW); pause(10); - LoadIniSettings(); GetSystemDiscs(); Open_Dir(#path,WITH_REDRAW); DrawDeviceAndActionsLeftPanel(); diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h index 0a6908dc5c..6abc7a0b93 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -27,13 +27,13 @@ int WinX, WinY, WinW, WinH; void settings_dialog() { byte id; - + active_settings=1; loop(){ switch(WaitEvent()) { case evButton: id=GetButtonID(); - if (id==1) ExitSettings(); + if (id==1) { ExitSettings(); break; } else if (id==5) { 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==27) 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==31) && (font.size.text>9) { font.size.text--; BigFontsChange(); } - SaveIniSettings(); + else if (id==30) { font.size.text++; IF(!font.changeSIZE()) font.size.text--; BigFontsChange(); } + else if (id==31) { font.size.text--; IF(!font.changeSIZE()) font.size.text++; BigFontsChange(); } EventRedrawWindow(Form.left,Form.top); DrawSettingsCheckBoxes(); break; @@ -69,10 +68,9 @@ void settings_dialog() void ExitSettings() { - active_settings=0; + active_settings = 0; settings_window = 0; cmd_free = 4; - SaveIniSettings(); 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, "WinH", 500); WinH = EAX; 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; if (files.line_h<18) files.line_h = 18; 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; } diff --git a/programs/cmm/eolite/include/translations.h b/programs/cmm/eolite/include/translations.h index 0e7db16173..8bb81c7b5e 100644 --- a/programs/cmm/eolite/include/translations.h +++ b/programs/cmm/eolite/include/translations.h @@ -1,5 +1,5 @@ -#define TITLE "Eolite File Manager v3.1" -#define ABOUT_TITLE "Eolite 3.1" +#define TITLE "Eolite File Manager v3.12" +#define ABOUT_TITLE "Eolite 3.12" #ifdef LANG_RUS ?define T_FILE "” ©«" diff --git a/programs/cmm/lib/font.h b/programs/cmm/lib/font.h index f2458e0d08..44c8514dba 100644 --- a/programs/cmm/lib/font.h +++ b/programs/cmm/lib/font.h @@ -244,9 +244,31 @@ FONT font = 0; IF(weight)len+=math.ceil(size.text/17); text1++; } + IF (no_bg_copy) && (!color) SmoothFont(buffer, size.width, size.height); _PutImage(x,y,size.width,size.height,buffer); 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) { diff --git a/programs/cmm/lib/gui.h b/programs/cmm/lib/gui.h index debe44314a..7c11e2110b 100644 --- a/programs/cmm/lib/gui.h +++ b/programs/cmm/lib/gui.h @@ -162,17 +162,18 @@ :void GrayScaleImage(dword color_image, w, h) { - dword i,gray,rr,gg,bb; - for (i = 0; i < w*h*3; i+=3) + dword i,gray,to,rr,gg,bb; + to = w*h*3 + color_image; + for (i = color_image; i < to; i+=3) { - rr = DSBYTE[i+color_image]; - gg = DSBYTE[i+1+color_image]; - bb = DSBYTE[i+2+color_image]; + rr = DSBYTE[i]; + gg = DSBYTE[i+1]; + bb = DSBYTE[i+2]; gray = rr*rr; gray += gg*gg; gray += bb*bb; 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; } }