Eolite 3.05: use sizable fonts *.kf

git-svn-id: svn://kolibrios.org@5745 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2015-08-19 11:14:15 +00:00
parent b64a33bcda
commit 383b55f4be
7 changed files with 87 additions and 37 deletions

View File

@ -0,0 +1,9 @@
@del lang.h--
@echo #define LANG_ENG 1 >lang.h--
c-- end.c
@del end
@rename end.com end
@del warning.txt
@del lang.h--
@pause

View File

@ -0,0 +1,10 @@
@del lang.h--
@echo #define LANG_RUS 1 >lang.h--
c-- end.c
@del end
@rename end.com end
@del warning.txt
@del lang.h--
@pause
kpack end

View File

@ -130,7 +130,6 @@ void main()
Open_Dir(#path,ONLY_OPEN); Open_Dir(#path,ONLY_OPEN);
strcpy(#inactive_path, #path); strcpy(#inactive_path, #path);
llist_copy(#files_inactive, #files); llist_copy(#files_inactive, #files);
//font.load("/sys/font/Verdana.kf");
SetEventMask(1100111b); SetEventMask(1100111b);
loop(){ loop(){
switch(WaitEvent()) switch(WaitEvent())
@ -688,15 +687,23 @@ void Line_ReDraw(dword color, filenum){
if (text_col==0xA6A6B7) text_col=0xFFFFFF; if (text_col==0xA6A6B7) text_col=0xFFFFFF;
} }
if (file.selected) text_col=0xFF0000; if (file.selected) text_col=0xFF0000;
if (Form.width>=480) if (font_size==9) || (!font.data)
{ {
FileShow.start_x = files.x + 23; if (Form.width>=480)
FileShow.font_color = text_col; {
FileShow.area_size_x = files.w - 164; FileShow.start_x = files.x + 23;
FileShow.text_pointer = file_name_off; FileShow.font_color = text_col;
FileShow.start_y = files.text_y + y; FileShow.area_size_x = files.w - 164;
PathShow_prepare stdcall(#FileShow); FileShow.text_pointer = file_name_off;
PathShow_draw stdcall(#FileShow); FileShow.start_y = files.text_y + y;
PathShow_prepare stdcall(#FileShow);
PathShow_draw stdcall(#FileShow);
}
}
else
{
font.bg_color = color;
font.text(files.x + 23, files.line_h - font.height / 2 - 1 + y, file_name_off, 0, font_size);
} }
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
DrawBar(files.x+files.w-68,y,1,files.line_h,system.color.work); //gray line 2 DrawBar(files.x+files.w-68,y,1,files.line_h,system.color.work); //gray line 2

View File

@ -47,8 +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<30) { font_size++; BigFontsChange(); } else if (id==30) && (font_size<22) { font_size++; BigFontsChange(); }
else if (id==31) && (font_size>10) { font_size--; BigFontsChange(); } else if (id==31) && (font_size>9) { font_size--; BigFontsChange(); }
SaveIniSettings(); SaveIniSettings();
EventRedrawWindow(Form.left,Form.top); EventRedrawWindow(Form.left,Form.top);
DrawSettingsCheckBoxes(); DrawSettingsCheckBoxes();
@ -81,9 +81,9 @@ void DrawSettingsCheckBoxes()
CheckBox2(10, 33, 21, SHOW_REAL_NAMES, real_files_names_case); CheckBox2(10, 33, 21, SHOW_REAL_NAMES, real_files_names_case);
CheckBox2(10, 55, 22, NOTIFY_COPY_END, info_after_copy); CheckBox2(10, 55, 22, NOTIFY_COPY_END, info_after_copy);
CheckBox2(10, 77, 24, USE_TWO_PANELS, two_panels); CheckBox2(10, 77, 24, USE_TWO_PANELS, two_panels);
MoreLessBox(10, 103, 18, 30, 31, #system.color, font_size, FONT_SIZE_LABEL); MoreLessBox(10, 103, 18, 27, 28, #system.color, MOUSE_TIME, T_DOUBLE_CLICK);
MoreLessBox(10, 130, 18, 25, 26, #system.color, files.line_h, LIST_LINE_HEIGHT); MoreLessBox(10, 130, 18, 25, 26, #system.color, files.line_h, LIST_LINE_HEIGHT);
MoreLessBox(10, 157, 18, 27, 28, #system.color, MOUSE_TIME, T_DOUBLE_CLICK); if (font.data) MoreLessBox(10, 157, 18, 30, 31, #system.color, font_size, FONT_SIZE_LABEL);
} }
@ -98,6 +98,8 @@ void LoadIniSettings()
ini_get_int stdcall (eolite_ini_path, #confir_section, "LineHeight", 18); files.line_h = EAX; ini_get_int stdcall (eolite_ini_path, #confir_section, "LineHeight", 18); files.line_h = EAX;
ini_get_int stdcall (eolite_ini_path, #confir_section, "TimeDoubleClick", 50); MOUSE_TIME = EAX; ini_get_int stdcall (eolite_ini_path, #confir_section, "TimeDoubleClick", 50); MOUSE_TIME = EAX;
BigFontsChange(); BigFontsChange();
font.no_bg_copy = true;
font.load("/sys/font/Tahoma.kf");
} }
@ -142,19 +144,11 @@ 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;
if (font_size!=9) files.SetFont(6, 6, 10000000b);
{ FileShow.font_size_x = files.font_w;
files.SetFont(8, 14, 10110000b); FileShow.font_number = 0;
FileShow.font_size_x = files.font_w;
FileShow.font_number = 3;
}
else
{
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.01" #define TITLE "Eolite File Manager v3.05"
#define ABOUT_TITLE "Eolite 3.01" #define ABOUT_TITLE "Eolite 3.05"
#ifdef LANG_RUS #ifdef LANG_RUS
?define T_FILE "” ©«" ?define T_FILE "” ©«"

View File

@ -23,12 +23,14 @@
byte load(...); byte load(...);
byte symbol(word x;byte s;dword c); byte symbol(word x;byte s;dword c);
byte symbol_size(byte s); byte symbol_size(byte s);
dword text(word x,y;dword text,c;byte size); dword text(word x,y;dword text1,c;byte size);
dword text_width(dword text1;byte size); dword text_width(dword text1;byte size);
dword textarea(word x,y;dword text,c;byte size); dword textarea(word x,y;dword text,c;byte size);
byte changeSIZE(byte size); byte changeSIZE(byte size);
void PixelRGB(word x,y); void PixelRGB(word x,y);
dword tmp_y,tmp_height,tmp_x; dword tmp_y,tmp_height,tmp_x;
byte no_bg_copy;
dword bg_color;
}; };
FONT font = 0; FONT font = 0;
@ -128,12 +130,31 @@ FONT font = 0;
c>>=16; c>>=16;
AX = c; AX = c;
b = AL; b = AL;
width_buffer = width; width_buffer = text_width(text1,size);
width_buffer *= strlen(text1); //width_buffer *= strlen(text1);
IF(!buffer_size)buffer = malloc(width_buffer*height*3); IF(!buffer_size)
ELSE IF(buffer_size<width_buffer*height)buffer = realloc(width_buffer*height*3); {
CopyScreen(buffer,x+Form_SELF_FONTS.left+5,y+Form_SELF_FONTS.top+GetSkinHeight(),width_buffer,height); buffer_size = width_buffer*height*3;
buffer = malloc(buffer_size);
}
ELSE IF(buffer_size<width_buffer*height*3)
{
buffer_size = width_buffer*height*3;
buffer = realloc(buffer,buffer_size);
}
IF (no_bg_copy)
{
EBX = bg_color;
EAX = buffer_size+buffer;
EDI = buffer;
WHILE (EDI<EAX)
{
ESDWORD[EDI] = EBX;
$add edi,3
}
}
ELSE CopyScreen(buffer,x+Form_SELF_FONTS.left+5,y+Form_SELF_FONTS.top+GetSkinHeight(),width_buffer,height);
//width_buffer = text_width(text1);
WHILE(DSBYTE[text1]) WHILE(DSBYTE[text1])
{ {
symbol(len,DSBYTE[text1],c); symbol(len,DSBYTE[text1],c);
@ -189,8 +210,15 @@ FONT font = 0;
:byte FONT::load(dword path) :byte FONT::load(dword path)
{ {
dword tmp; dword tmp;
buffer_size = 0;
IF(data)free(data); IF(data)free(data);
tmp = io.read(path); if (io.read(path)!=0)
{
debug("Error while loading font: ");
debugln(path);
return 0;
}
tmp = io.buffer_data;
data = tmp; data = tmp;
begin = data; begin = data;
size_file = io.FILES_SIZE; size_file = io.FILES_SIZE;

View File

@ -317,12 +317,14 @@
} }
:dword IO::read(dword PATH) :dword IO::read(dword PATH)
{ {
int result;
___GetFileInfo(PATH, #BDVK); ___GetFileInfo(PATH, #BDVK);
if(BDVK.isfolder)return 0; if(BDVK.isfolder)return 0;
FILES_SIZE = BDVK.sizelo; FILES_SIZE = BDVK.sizelo;
buffer_data = malloc(FILES_SIZE+1); buffer_data = malloc(FILES_SIZE+1);
file.read(0,FILES_SIZE,buffer_data,PATH); result = file.read(0,FILES_SIZE,buffer_data,PATH);
return buffer_data; if (result!=0) buffer_data = free(buffer_data); //file read failed
return result;
} }
:signed int IO::run(dword rpath,rparam) :signed int IO::run(dword rpath,rparam)