From ef2e4e1bef56947d15b765b73f74b5e6e75796d0 Mon Sep 17 00:00:00 2001
From: "Kirill Lipatov (Leency)" <lipatov.kiril@gmail.com>
Date: Thu, 19 Mar 2015 13:49:26 +0000
Subject: [PATCH] Eolite 2.7: option to use big fonts

git-svn-id: svn://kolibrios.org@5532 a494cfbc-eb01-0410-851d-a64ba20cac60
---
 programs/cmm/eolite/Eolite.c             | 14 ++++---
 programs/cmm/eolite/include/gui.h        | 51 +++++++++++++++---------
 programs/cmm/eolite/include/icons.h      |  5 ++-
 programs/cmm/eolite/include/left_panel.h |  6 +--
 programs/cmm/eolite/include/settings.h   | 41 ++++++++++++-------
 programs/cmm/panels_cfg/panels_cfg.c     |  4 +-
 6 files changed, 75 insertions(+), 46 deletions(-)

diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c
index 61a322f14e..1d1e8f59c6 100644
--- a/programs/cmm/eolite/Eolite.c
+++ b/programs/cmm/eolite/Eolite.c
@@ -95,8 +95,8 @@
 
 enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
 
-#define TITLE "Eolite File Manager v2.66"
-#define ABOUT_TITLE "Eolite v2.66"
+#define TITLE "Eolite File Manager v2.7"
+#define ABOUT_TITLE "Eolite v2.7"
 dword col_padding, col_selec, col_lpanel;
 
 int toolbar_buttons_x[7]={9,46,85,134,167,203};
@@ -121,6 +121,8 @@ byte
 	del_active=0,
 	show_dev_name=1,
 	real_files_names_case=0,
+	use_big_fonts=0,
+	font_type,
 	info_after_copy=0,
 	sort_num=2,
 	itdir;
@@ -130,7 +132,7 @@ dword eolite_ini_path;
 proc_info Form;
 system_colors sc;
 mouse m;
-int mouse_dd, scroll_used, scroll_size, sorting_arrow_x, kolibrios_drive;
+int mouse_dd, scroll_used, sc_slider_h, sorting_arrow_x, kolibrios_drive;
 dword buf;
 dword file_mas[6898];
 int j, i;
@@ -270,9 +272,9 @@ void main()
 			
 			if (scroll_used)
 			{
-				IF (scroll_size/2+files.y>m.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+files.y; //anee eo?ni? iaa ieiii
+				IF (sc_slider_h/2+files.y>m.y) || (m.y<0) || (m.y>4000) m.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii
 				id=files.first;
-				j= scroll_size/2;
+				j= sc_slider_h/2;
 				files.first = m.y -j -files.y * files.count;
 				files.first /= onTop(22,files.y);
 				IF (files.visible+files.first>files.count) files.first=files.count-files.visible;
@@ -653,7 +655,7 @@ void Line_ReDraw(dword color, filenum){
 	if (! TestBit(attr, 4) ) //file or folder?
 	{	
 		Put_icon(file_name_off+_strrchr(file_name_off,'.'), files.x+3, files.line_h/2-7+y, color, 0);
-		WriteText(7-strlen(ConvertSize(file.sizelo))*6+Form.cwidth - 76,files.line_h-6/2+y,0x80,0,ConvertSize(file.sizelo));
+		WriteText(7-strlen(ConvertSize(file.sizelo))*6+Form.cwidth - 76,files.line_h-6/2+y,font_type,0,ConvertSize(file.sizelo));
 	}
 	else
 	{
diff --git a/programs/cmm/eolite/include/gui.h b/programs/cmm/eolite/include/gui.h
index 0a1e2490bb..a7724a4c2e 100644
--- a/programs/cmm/eolite/include/gui.h
+++ b/programs/cmm/eolite/include/gui.h
@@ -2,31 +2,44 @@
 dword col_palette[14] = {0xD2D3D3,0xD4D4D4,0xD6D5D6,0xD8D7D8,0xDAD8D9,0xDCDADB,
 0xDFDCDD,0xE1DDDE,0xE2DEE0,0xE4DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1};
 
-inline fastcall void Scroll() { //���������
-	dword on_y, i;
+void Scroll() {
+	dword i;
+
+	word sc_x = Form.cwidth - 18;
+	word sc_y = 57;
+	word sc_h = Form.cheight - 18 - sc_y;
+	word sc_slider_y;
+
 	if (files.count<=0)
 	{
-		on_y = 57;
-		scroll_size = onTop(22,58);
+		sc_slider_y = sc_y;
+		sc_slider_h = sc_h - 1;
 	}
 	else
 	{
-		on_y = files.first * onTop(22,57) / files.count +57;
-		scroll_size=onTop(22,57) * files.visible - files.visible / files.count;
-		if (scroll_size<20) scroll_size = 20; //������������� ����������� ������ �������
-		if (scroll_size>onTop(22,57)-on_y+56) || (files.first+files.visible>=files.count) on_y=onTop(23+scroll_size,0); //��� �������� ������ 
+		sc_slider_y = files.first * sc_h / files.count + sc_y;
+		sc_slider_h = sc_h * files.visible - files.visible / files.count;
+		if (sc_slider_h < 20) sc_slider_h = 20; //minimal scroll width
+		if (sc_slider_h > sc_h-sc_slider_y+56) || (files.first+files.visible>=files.count) sc_slider_y=onTop(23+sc_slider_h,0); //��� �������� ������ 
+	}
+	//slider
+	DrawFlatButton(sc_x,sc_slider_y,16,sc_slider_h,0,-1,"");
+	if (!scroll_used) for (i=0; i<13; i++) DrawBar(sc_x + 2 + i, sc_slider_y+2, 1, sc_slider_h-3, col_palette[13-i]);
+	if (scroll_used)  for (i=0; i<13; i++) DrawBar(sc_x + 2 + i, sc_slider_y+2, 1, sc_slider_h-3, col_palette[i]);
+	//area before slider
+	if (sc_slider_y > sc_y + 1) 
+	{
+		DrawBar(sc_x+1, sc_y,   15, 1, 0xC7C9C9);
+		DrawBar(sc_x+1, sc_y+1,  1, sc_slider_y-sc_y-1, 0xC7C9C9);
+		DrawBar(sc_x+2, sc_y+1, 14, sc_slider_y-sc_y-1, 0xCED0D0);
+	}
+	//area after slider
+	if (sc_h-sc_slider_h+55>sc_slider_y)
+	{
+		DrawBar(sc_x+1, sc_slider_y + sc_slider_h+1, 15, 1, 0xC7C9C9);
+		DrawBar(sc_x+1, sc_slider_y + sc_slider_h+2,  1, sc_h-sc_slider_h-sc_slider_y+55, 0xC7C9C9);
+		DrawBar(sc_x+2, sc_slider_y + sc_slider_h+2, 14, sc_h-sc_slider_h-sc_slider_y+55, 0xCED0D0);
 	}
-	DrawFlatButton(Form.cwidth - 18,on_y,16,scroll_size,0,-1,"");//��������
-	if (!scroll_used) for (i=0; i<13; i++) DrawBar(Form.cwidth - 16 + i, on_y+2, 1, scroll_size-3, col_palette[13-i]);
-	if (scroll_used)  for (i=0; i<13; i++) DrawBar(Form.cwidth - 16 + i, on_y+2, 1, scroll_size-3, col_palette[i]);
-	//���� �� ��������
-	if (on_y>58) DrawBar(Form.cwidth - 17,57,15,1, 0xC7C9C9);
-	DrawBar(Form.cwidth - 17,58,1, on_y-58,0xC7C9C9);
-	DrawBar(Form.cwidth - 16,58,14,on_y-58,0xCED0D0);
-	//���� ����� ��������
-	if (onTop(22,57)-scroll_size+55>on_y) DrawBar(Form.cwidth - 17,on_y+scroll_size+1,15,1,0xC7C9C9);
-	DrawBar(Form.cwidth - 17,on_y+scroll_size+2,1,onTop(22,57)-scroll_size-on_y+55,0xC7C9C9);
-	DrawBar(Form.cwidth - 16,on_y+scroll_size+2,14,onTop(22,57)-scroll_size-on_y+55,0xCED0D0);
 }
 
 void DrawFlatButton(dword x,y,width,height,id,color,text)
diff --git a/programs/cmm/eolite/include/icons.h b/programs/cmm/eolite/include/icons.h
index 2b346ba1e3..0033d23071 100644
--- a/programs/cmm/eolite/include/icons.h
+++ b/programs/cmm/eolite/include/icons.h
@@ -29,7 +29,7 @@ char *ext[]={
 
 void Put_icon(dword extension, xx, yy, fairing_color, icon_n)
 {
-	int i;
+	int i, font_half_width;
 
 	if (extension) for (i=0; ext[i]!=0; i+=2;)
 	{
@@ -43,7 +43,8 @@ void Put_icon(dword extension, xx, yy, fairing_color, icon_n)
 	ficons_pal[0] = fairing_color;
 	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 (icon_n<>17) && (strlen(extension)<9) WriteText(-strlen(extension)*3+Form.cwidth-120,yy+4,0x80,0,extension);
+	if (use_big_fonts) font_half_width=4; else font_half_width=3;
+	if (icon_n<>17) && (strlen(extension)<9) WriteText(-strlen(extension)*font_half_width+Form.cwidth-120,yy+4,font_type,0,extension);
 }
 
 
diff --git a/programs/cmm/eolite/include/left_panel.h b/programs/cmm/eolite/include/left_panel.h
index aee1d61f02..7e06b10c95 100644
--- a/programs/cmm/eolite/include/left_panel.h
+++ b/programs/cmm/eolite/include/left_panel.h
@@ -36,9 +36,9 @@ void Tip(int y, dword caption, id, arrow)
 	DrawBar(17,y,160,1,0xEFEDEE);
 	DrawFilledBar(17, y+1, 160, 16);
 	WriteText(25,y+5,0x80,sc.work_text,caption);
-	IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //����� ��� �������
-	WriteText(165,y+5,0x80,sc.work_text,arrow); //������� ����
-	DrawBar(17,y+17,160,1,sc.work_graph);		//�������������
+	IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //arrow button
+	WriteText(165,y+5,0x80,sc.work_text,arrow); //arrow
+	DrawBar(17,y+17,160,1,sc.work_graph);
 }
 
 
diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h
index 340f4e6a32..e37a87cfc8 100644
--- a/programs/cmm/eolite/include/settings.h
+++ b/programs/cmm/eolite/include/settings.h
@@ -7,6 +7,7 @@
 	?define TITLE_SETT "����ன��"
 	?define SHOW_DEVICE_CLASS "�뢮���� �������� ����� ���ன��"
 	?define SHOW_REAL_NAMES "�����뢠�� ����� 䠩��� �� ����� ॣ����"
+	?define USE_BIG_FONTS "�ᯮ�짮���� 㢥��祭�� �����"
 	?define LIST_LINE_HEIGHT "���� ��ப� � ᯨ᪥"
 	?define NOTIFY_COPY_END "���������� � �����襭�� ����஢����"
 	?define CANCEL_T "�⬥��"
@@ -16,6 +17,7 @@
 	?define TITLE_SETT "Settings"
 	?define SHOW_DEVICE_CLASS "Show device class name"
 	?define SHOW_REAL_NAMES "Show real file names without changing case"
+	?define USE_BIG_FONTS "Use big fonts"
 	?define LIST_LINE_HEIGHT "List line height"
 	?define NOTIFY_COPY_END "Notify when copying finished"
 	?define CANCEL_T "Cancel"
@@ -58,6 +60,7 @@ void settings_dialog()
 				if (id==20) show_dev_name ^= 1;
 				if (id==21) real_files_names_case ^= 1;
 				if (id==22) info_after_copy ^= 1;
+				if (id==23) use_big_fonts ^= 1;
 				if (id==25) files.line_h++;
 				if (id==26) && (files.line_h>8) files.line_h--;
 				DrawSettingsCheckBoxes();
@@ -74,10 +77,10 @@ void settings_dialog()
 				break;
 			
 		case evReDraw:
-				DefineAndDrawWindow(Form.left + 100, 150, 300, 210+GetSkinHeight(),0x34,sc.work,TITLE_SETT);
+				DefineAndDrawWindow(Form.left + 100, 150, 300, 232+GetSkinHeight(),0x34,sc.work,TITLE_SETT);
 				GetProcessInfo(#settings_form, SelfInfo);
 				DrawSettingsCheckBoxes();
-				DrawFlatButton(9, 116, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
+				DrawFlatButton(9, 138, strlen(EDIT_FILE_ASSOCIATIONS)+4*6, 22, 5, 0xE4DFE1, EDIT_FILE_ASSOCIATIONS);
 				DrawFlatButton(128, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, APPLY_T);
 				DrawFlatButton(208, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, CANCEL_T);
 	}
@@ -88,23 +91,32 @@ void DrawSettingsCheckBoxes()
 	CheckBox2(10, 11, 20, SHOW_DEVICE_CLASS,  show_dev_name);
 	CheckBox2(10, 33, 21, SHOW_REAL_NAMES,  real_files_names_case);
 	CheckBox2(10, 55, 22, NOTIFY_COPY_END,  info_after_copy);
-	MoreLessBox(10, 82, 18, 25, 26, sc.work_graph, 0xD2D3D3, 0x000000, files.line_h, LIST_LINE_HEIGHT);
+	CheckBox2(10, 77, 23, USE_BIG_FONTS,  use_big_fonts);
+	MoreLessBox(10, 104, 18, 25, 26, sc.work_graph, 0xD2D3D3, 0x000000, files.line_h, LIST_LINE_HEIGHT);
 }
 
 
 void LoadIniSettings()
 {
-	ini_get_color stdcall (eolite_ini_path, #confir_section, "SelectionColor", 0x94AECE);
-	edit2.shift_color = EAX;
-	col_selec = 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, "ShowDeviceName", 1);
-	show_dev_name = EAX;
-	ini_get_int stdcall (eolite_ini_path, #confir_section, "RealFileNamesCase", 0);
-	real_files_names_case = EAX;
-	ini_get_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", 0);
-	info_after_copy = EAX;
+	ini_get_color stdcall (eolite_ini_path, #confir_section, "SelectionColor",   0x94AECE); edit2.shift_color = col_selec = EAX;
+	ini_get_int stdcall   (eolite_ini_path, #confir_section, "ShowDeviceName",    1); show_dev_name = EAX;
+	ini_get_int stdcall   (eolite_ini_path, #confir_section, "RealFileNamesCase", 0); real_files_names_case = EAX;
+	ini_get_int stdcall   (eolite_ini_path, #confir_section, "InfoAfterCopy",     0); info_after_copy = EAX;
+	ini_get_int stdcall   (eolite_ini_path, #confir_section, "UseBigFonts",       0); use_big_fonts = EAX;
+	ini_get_int stdcall   (eolite_ini_path, #confir_section, "LineHeight",       18); files.line_h = EAX;
+
+	if (use_big_fonts) 
+	{
+		font_type = 0x90;
+		PathShow.font_size_x = FileShow.font_size_x = 8;
+		PathShow.font_number = FileShow.font_number = 1;
+	}
+	else
+	{
+		font_type=0x80;
+		PathShow.font_size_x = FileShow.font_size_x = 8;
+		PathShow.font_number = FileShow.font_number = 0;
+	} 
 }
 
 void SaveIniSettings()
@@ -112,6 +124,7 @@ void SaveIniSettings()
 	ini_set_int stdcall (eolite_ini_path, #confir_section, "ShowDeviceName", show_dev_name);
 	ini_set_int stdcall (eolite_ini_path, #confir_section, "RealFileNamesCase", real_files_names_case);
 	ini_set_int stdcall (eolite_ini_path, #confir_section, "InfoAfterCopy", info_after_copy);
+	ini_set_int stdcall (eolite_ini_path, #confir_section, "UseBigFonts", use_big_fonts);
 	ini_set_int stdcall (eolite_ini_path, #confir_section, "LineHeight", files.line_h);
 }
 
diff --git a/programs/cmm/panels_cfg/panels_cfg.c b/programs/cmm/panels_cfg/panels_cfg.c
index f2822d7a88..b03828547d 100644
--- a/programs/cmm/panels_cfg/panels_cfg.c
+++ b/programs/cmm/panels_cfg/panels_cfg.c
@@ -173,7 +173,7 @@ void DrawWindowContent()
   frame_draw stdcall (#taskbar_frame);
 	DefineButton(22, taskbar_frame.start_y + 12, panels_img.w-1, 27-1, 100 + BT_HIDE, 0);
 	_PutImage(22, taskbar_frame.start_y + 12,  37, 27, taskbar_cfg.Attachment * 37 * 27 * 3 + panels_img.data);
-	WriteText(68, taskbar_frame.start_y + 20, 0x80, 0x333222, CHANGE_POS);
+	WriteText(68, taskbar_frame.start_y + 20, 0x80, work_text, CHANGE_POS);
 	PanelCfg_CheckBox(22, taskbar_frame.start_y +  48, 105, SOFTEN_UP, taskbar_cfg.SoftenUp);
 	PanelCfg_CheckBox(22, taskbar_frame.start_y +  68, 106, SOFTEN_DOWN, taskbar_cfg.SoftenDown);
 	PanelCfg_CheckBox(22, taskbar_frame.start_y +  88, 107, MIN_LEFT_BUTTON, taskbar_cfg.MinLeftButton);
@@ -190,7 +190,7 @@ void DrawWindowContent()
   frame_draw stdcall (#docky_frame);
 	DefineButton(22, docky_frame.start_y + 12, panels_img.w-1, 27-1, 200 + BT_HIDE, 0);
 	_PutImage(22, docky_frame.start_y + 12,  37, 27, docky_cfg.location + 1 * 37 * 27 * 3 + panels_img.data);
-	WriteText(68, docky_frame.start_y + 20, 0x80, 0x333222, CHANGE_POS);
+	WriteText(68, docky_frame.start_y + 20, 0x80, work_text, CHANGE_POS);
 
 	PanelCfg_CheckBox(22, docky_frame.start_y + 48, 201, FSIZE,  docky_cfg.fsize);
 	PanelCfg_CheckBox(win_center_x, docky_frame.start_y + 48, 202, ASHOW, docky_cfg.ashow);