From abde4bc0d87ed9f37ceacbe32b014a0407e4cd8f Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 10 Aug 2015 12:45:00 +0000 Subject: [PATCH] More flexible fonts Eolite, WebView (part1) git-svn-id: svn://kolibrios.org@5710 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/TWB/TWB.c | 4 ++-- programs/cmm/browser/WebView.c | 3 ++- programs/cmm/eolite/Eolite.c | 6 ++---- programs/cmm/eolite/include/icons.h | 2 +- programs/cmm/eolite/include/settings.h | 10 ++++------ programs/cmm/lib/list_box.h | 15 ++++++++++++--- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c index 121c22eec7..e3562a1aa4 100644 --- a/programs/cmm/TWB/TWB.c +++ b/programs/cmm/TWB/TWB.c @@ -75,10 +75,10 @@ void TWebBrowser::DrawPage() 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; 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; diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index c49af83986..e0c947dd9f 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -286,7 +286,8 @@ void SetElementSizes() 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, 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.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.line_h); } diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 5234f46def..e646b8b775 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -60,8 +60,6 @@ byte //struct t_settings { byte use_big_fonts=false, - font_type=0x80, - font_h=9, sort_num=2, show_dev_name=true, real_files_names_case=false, @@ -615,7 +613,7 @@ 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); - 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 { @@ -638,7 +636,7 @@ void Line_ReDraw(dword color, filenum){ FileShow.font_color = text_col; FileShow.area_size_x = files.w - 164; 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_draw stdcall(#FileShow); } diff --git a/programs/cmm/eolite/include/icons.h b/programs/cmm/eolite/include/icons.h index 5639597628..3f3a6ccd1c 100644 --- a/programs/cmm/eolite/include/icons.h +++ b/programs/cmm/eolite/include/icons.h @@ -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); 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 (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); } diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h index 5e2b4aa655..2ec8a4e6fa 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -179,16 +179,14 @@ void BigFontsChange() { if (use_big_fonts) { - font_type = 10110000b; - font_h = 14; - FileShow.font_size_x = 8; + files.SetFont(8, 14, 10110000b); + FileShow.font_size_x = files.font_w; FileShow.font_number = 3; } else { - font_type=10000000b; - font_h = 6; - FileShow.font_size_x = 6; + files.SetFont(6, 6, 10000000b); + FileShow.font_size_x = files.font_w; FileShow.font_number = 0; } } diff --git a/programs/cmm/lib/list_box.h b/programs/cmm/lib/list_box.h index a4c1fd6e34..42f85d5513 100644 --- a/programs/cmm/lib/list_box.h +++ b/programs/cmm/lib/list_box.h @@ -9,7 +9,8 @@ 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 active; void ClearList(); @@ -23,7 +24,8 @@ struct llist int KeyPgDown(); int KeyPgUp(); 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 MouseScrollNoSelection(dword scroll_state); void debug_values(); @@ -53,11 +55,18 @@ void llist::SetSizes(int xx, yy, ww, hh, line_hh) w = ww; h = hh; line_h = line_hh; - text_y = line_h / 2 - 4; + text_y = line_h - font_h / 2; visible = h / line_h; //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) {