More flexible fonts Eolite, WebView (part1)

git-svn-id: svn://kolibrios.org@5710 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2015-08-10 12:45:00 +00:00
parent 3372b13bc3
commit abde4bc0d8
6 changed files with 23 additions and 17 deletions

View File

@ -75,10 +75,10 @@ void TWebBrowser::DrawPage()
if (stroka >= 0) && (stroka - 2 < list.visible) && (line) && (!anchor) if (stroka >= 0) && (stroka - 2 < list.visible) && (line) && (!anchor)
{ {
start_x = stolbec * 6 + magrin_left * DrawBuf.zoom + list.x; start_x = stolbec * list.font_w + magrin_left * DrawBuf.zoom + list.x;
start_y = stroka * list.line_h + magrin_left + list.y; start_y = stroka * list.line_h + magrin_left + list.y;
stolbec_len = strlen(#line); stolbec_len = strlen(#line);
line_length = stolbec_len * 6 * DrawBuf.zoom; line_length = stolbec_len * list.font_w * DrawBuf.zoom;
if (DrawBuf.zoom==1) font_type = 0x88; else font_type = 0x89; if (DrawBuf.zoom==1) font_type = 0x88; else font_type = 0x89;

View File

@ -286,7 +286,8 @@ void SetElementSizes()
address_box.width = Form.cwidth - address_box.left - 25 - 22; address_box.width = Form.cwidth - address_box.left - 25 - 22;
WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom, WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom,
Form.cheight - TOOLBAR_H - STATUSBAR_H, 11*WB1.DrawBuf.zoom); Form.cheight - TOOLBAR_H - STATUSBAR_H, 11*WB1.DrawBuf.zoom);
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / 6; WB1.list.SetFont(6, 9, 0x88);
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h; WB1.list.visible = WB1.list.h - 5 / WB1.list.line_h;
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.line_h); WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.line_h);
} }

View File

@ -60,8 +60,6 @@ byte
//struct t_settings { //struct t_settings {
byte use_big_fonts=false, byte use_big_fonts=false,
font_type=0x80,
font_h=9,
sort_num=2, sort_num=2,
show_dev_name=true, show_dev_name=true,
real_files_names_case=false, real_files_names_case=false,
@ -615,7 +613,7 @@ 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, color, 0);
WriteText(7-strlen(ConvertSize(file.sizelo))*6+Form.cwidth - 76, files.line_h - font_h/ 2 + y,font_type,0,ConvertSize(file.sizelo)); WriteText(7-strlen(ConvertSize(file.sizelo))*6+Form.cwidth - 76, files.text_y + y,files.font_type,0,ConvertSize(file.sizelo));
} }
else else
{ {
@ -638,7 +636,7 @@ void Line_ReDraw(dword color, filenum){
FileShow.font_color = text_col; FileShow.font_color = text_col;
FileShow.area_size_x = files.w - 164; FileShow.area_size_x = files.w - 164;
FileShow.text_pointer = file_name_off; FileShow.text_pointer = file_name_off;
FileShow.start_y = files.line_h - font_h/ 2 + y; FileShow.start_y = files.text_y + y;
PathShow_prepare stdcall(#FileShow); PathShow_prepare stdcall(#FileShow);
PathShow_draw stdcall(#FileShow); PathShow_draw stdcall(#FileShow);
} }

View File

@ -44,7 +44,7 @@ void Put_icon(dword extension, xx, yy, fairing_color, icon_n)
PutPaletteImage(icon_n*16*15+#ficons,16,15,xx,yy,8,#ficons_pal); PutPaletteImage(icon_n*16*15+#ficons,16,15,xx,yy,8,#ficons_pal);
if (fairing_color!=0xFFFfff) IconFairing(icon_n, xx, yy, fairing_color); if (fairing_color!=0xFFFfff) IconFairing(icon_n, xx, yy, fairing_color);
if (use_big_fonts) font_half_height=0; else font_half_height=4; if (use_big_fonts) font_half_height=0; else font_half_height=4;
if (icon_n!=17) && (strlen(extension)<9) WriteText(-FileShow.font_size_x/2*strlen(extension)+Form.cwidth-121,yy+font_half_height,font_type,0,extension); if (icon_n!=17) && (strlen(extension)<9) WriteText(-FileShow.font_size_x/2*strlen(extension)+Form.cwidth-121,yy+font_half_height,files.font_type,0,extension);
} }

View File

@ -179,16 +179,14 @@ void BigFontsChange()
{ {
if (use_big_fonts) if (use_big_fonts)
{ {
font_type = 10110000b; files.SetFont(8, 14, 10110000b);
font_h = 14; FileShow.font_size_x = files.font_w;
FileShow.font_size_x = 8;
FileShow.font_number = 3; FileShow.font_number = 3;
} }
else else
{ {
font_type=10000000b; files.SetFont(6, 6, 10000000b);
font_h = 6; FileShow.font_size_x = files.font_w;
FileShow.font_size_x = 6;
FileShow.font_number = 0; FileShow.font_number = 0;
} }
} }

View File

@ -9,7 +9,8 @@
struct llist struct llist
{ {
int x, y, w, h, line_h, char_w, char_h, text_y; int x, y, w, h, line_h, text_y;
dword font_w, font_h, font_type;
int count, visible, first, current, column_max; //visible = row_max int count, visible, first, current, column_max; //visible = row_max
int active; int active;
void ClearList(); void ClearList();
@ -23,7 +24,8 @@ struct llist
int KeyPgDown(); int KeyPgDown();
int KeyPgUp(); int KeyPgUp();
void CheckDoesValuesOkey(); void CheckDoesValuesOkey();
void SetSizes(int xx, yy, ww, hh, min_hh, line_hh); void SetSizes(int xx, yy, ww, hh, line_hh);
void SetFont(dword font_ww, font_hh, font_tt);
int MouseScroll(dword scroll_state); int MouseScroll(dword scroll_state);
int MouseScrollNoSelection(dword scroll_state); int MouseScrollNoSelection(dword scroll_state);
void debug_values(); void debug_values();
@ -53,11 +55,18 @@ void llist::SetSizes(int xx, yy, ww, hh, line_hh)
w = ww; w = ww;
h = hh; h = hh;
line_h = line_hh; line_h = line_hh;
text_y = line_h / 2 - 4; text_y = line_h - font_h / 2;
visible = h / line_h; visible = h / line_h;
//if (visible > count) visible=count; //if (visible > count) visible=count;
} }
void llist::SetFont(dword font_ww, font_hh, font_tt)
{
font_w = font_ww;
font_h = font_hh;
font_type = font_tt;
}
int llist::MouseScroll(dword scroll_state) int llist::MouseScroll(dword scroll_state)
{ {