From a12ef7aa3c9172b470a2e60c332b918981e2ec66 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 21 Dec 2015 16:37:24 +0000 Subject: [PATCH] 1. move kos_mouse_functions.h to lib/mouse.h 2. Eolite: use system value for double click, remove old code 3. Eolite: fix long file names while using big fonts git-svn-id: svn://kolibrios.org@5996 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/eolite/Eolite.c | 13 ++++- programs/cmm/eolite/include/settings.h | 17 +----- programs/cmm/lib/font.h | 4 +- programs/cmm/lib/kolibri.h | 2 +- programs/cmm/lib/mouse.h | 58 ++++++++++++++++++-- programs/cmm/mouse_cfg/kos_mouse_functions.h | 42 -------------- programs/cmm/mouse_cfg/mouse_cfg.c | 2 - programs/cmm/textreader/textreader.c | 2 +- 8 files changed, 70 insertions(+), 70 deletions(-) delete mode 100644 programs/cmm/mouse_cfg/kos_mouse_functions.h diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 8f0f3740d0..612bd74ef8 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -36,7 +36,6 @@ dword col_padding, col_selec, col_lpanel; int toolbar_buttons_x[7]={9,46,85,134,167,203}; -byte smooth_font=false; byte active_about=0; word about_window; word settings_window; @@ -667,6 +666,7 @@ void Line_ReDraw(dword bgcol, filenum){ file_name_off, y=filenum*files.item_h+files.y; BDVK file; + char label_file_name[4096]; if (filenum==-1) return; DrawBar(files.x,y,3,files.item_h,bgcol); DrawBar(files.x+19,y,files.w-19,files.item_h,bgcol); @@ -717,8 +717,15 @@ void Line_ReDraw(dword bgcol, filenum){ } else { - label.smooth = smooth_font; - label.write(files.x + 23, files.item_h - label.height / 2 + y, bgcol, text_col, label.size.pt, file_name_off); + strcpy(#label_file_name, file_name_off); + if (label.getsize(#label_file_name) + 141 + 26 > files.w) + { + while (label.getsize(#label_file_name) + 141 + 26 > files.w) { + ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL; + } + strcpy(#label_file_name+strlen(#label_file_name)-2, "..."); + } + label.write(files.x + 23, files.item_h - label.height / 2 + y, bgcol, text_col, label.size.pt, #label_file_name); } DrawBar(files.x+files.w-141,y,1,files.item_h,system.color.work); //gray line 1 DrawBar(files.x+files.w-68,y,1,files.item_h,system.color.work); //gray line 2 diff --git a/programs/cmm/eolite/include/settings.h b/programs/cmm/eolite/include/settings.h index 265111c9db..fe87211dbc 100644 --- a/programs/cmm/eolite/include/settings.h +++ b/programs/cmm/eolite/include/settings.h @@ -9,7 +9,6 @@ ?define smooth_FONT "Использовать сглаженный шрифт" ?define LIST_LINE_HEIGHT "Высота строки в списке" ?define NOTIFY_COPY_END "Уведомлять о завершении копирования" - ?define T_DOUBLE_CLICK "Время двойного клика (в сотых)" #define SAVE_PATH_AS_DEFAULT "Сохранить текущий путь по умолчанию" #else ?define EDIT_FILE_ASSOCIATIONS "Edit file associations" @@ -21,7 +20,6 @@ ?define smooth_FONT "Use smooth font" ?define LIST_LINE_HEIGHT "List line height" ?define NOTIFY_COPY_END "Notify when copying finished" - ?define T_DOUBLE_CLICK "Double click time (in hundredths)" #define SAVE_PATH_AS_DEFAULT "Save the current default path" #endif @@ -55,8 +53,6 @@ void settings_dialog() else if (id==24) two_panels ^= true; else if (id==25) { files.item_h++; files_active.item_h = files_inactive.item_h = files.item_h; } else if (id==26) && (files.item_h>18) files.item_h--; - else if (id==27) MOUSE_TIME++; - else if (id==28) && (MOUSE_TIME>29) MOUSE_TIME--; //else if (id==29) smooth_font ^= true; else if (id==30) { label.size.pt++; IF(!label.changeSIZE()) label.size.pt--; BigFontsChange(); } else if (id==31) { label.size.pt--; IF(!label.changeSIZE()) label.size.pt++; BigFontsChange(); } @@ -91,9 +87,7 @@ 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); - CheckBox2(10, 77, 24, USE_TWO_PANELS, two_panels); - //CheckBox2(10, 99, 29, smooth_FONT, smooth_font); - MoreLessBox(10, 99, 18, 27, 28, #system.color, MOUSE_TIME, T_DOUBLE_CLICK); + CheckBox2(10, 77, 24, USE_TWO_PANELS, two_panels); MoreLessBox(10, 125, 18, 25, 26, #system.color, files.item_h, LIST_LINE_HEIGHT); if (label.font) MoreLessBox(10, 152, 18, 30, 31, #system.color, label.size.pt, FONT_SIZE_LABEL); } @@ -109,9 +103,7 @@ void LoadIniSettings() ini_get_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", 0); info_after_copy = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "FontSize", 9); label.size.pt = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "TwoPanels", 0); two_panels = EAX; - //ini_get_int stdcall (eolite_ini_path, #config_section, "UseSmoothFont", true);smooth_font = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "LineHeight", 18); files.item_h = EAX; - ini_get_int stdcall (eolite_ini_path, #config_section, "TimeDoubleClick", 50); MOUSE_TIME = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "WinX", 200); WinX = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "WinY", 50); WinY = EAX; ini_get_int stdcall (eolite_ini_path, #config_section, "WinW", 550); WinW = EAX; @@ -121,8 +113,7 @@ void LoadIniSettings() ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font file",#temp,4096,DEFAULT_FONT); label.init(#temp); ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on"); - if(!strcmp(#temp,"off"))smooth_font = false; - else smooth_font = true; + if(!strcmp(#temp,"off")) label.smooth = false; else label.smooth = true; } @@ -134,9 +125,7 @@ void SaveIniSettings() ini_set_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", info_after_copy); ini_set_int stdcall (eolite_ini_path, #config_section, "FontSize", label.size.pt); ini_set_int stdcall (eolite_ini_path, #config_section, "TwoPanels", two_panels); - //ini_set_int stdcall (eolite_ini_path, #config_section, "UseSmoothFont", smooth_font); ini_set_int stdcall (eolite_ini_path, #config_section, "LineHeight", files.item_h); - ini_set_int stdcall (eolite_ini_path, #config_section, "TimeDoubleClick", MOUSE_TIME); ini_set_int stdcall (eolite_ini_path, #config_section, "WinX", Form.left); ini_set_int stdcall (eolite_ini_path, #config_section, "WinY", Form.top); ini_set_int stdcall (eolite_ini_path, #config_section, "WinW", Form.width); @@ -149,9 +138,7 @@ void SaveIniSettings() ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "InfoAfterCopy", info_after_copy); ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "FontSize", label.size.pt); ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "TwoPanels", two_panels); - //ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "UseSmoothFont", smooth_font); ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "LineHeight", files.item_h); - ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "TimeDoubleClick", MOUSE_TIME); ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "WinX", Form.left); ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "WinY", Form.top); ini_set_int stdcall (fd_path_eolite_ini_path, #config_section, "WinW", Form.width); diff --git a/programs/cmm/lib/font.h b/programs/cmm/lib/font.h index 6715b7cdf7..9c5688dcd7 100644 --- a/programs/cmm/lib/font.h +++ b/programs/cmm/lib/font.h @@ -73,8 +73,8 @@ } $neg size.offset_y $neg size.offset_x - size.height += size.offset_y; size.height++; - size.width += size.offset_x; size.width++; + size.height += size.offset_y+1; + size.width += size.offset_x+1; IF(italic) { size.w_italic = size.height/3; diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index cb48fed44c..99d237a58a 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -802,7 +802,7 @@ void ______INIT______() screen.height = GetScreenHeight(); //program_path_length = strlen(I_Path); - MOUSE_TIME = 50; //Default 500 ms. + DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay(); __generator = GetStartTime(); $push ebx diff --git a/programs/cmm/lib/mouse.h b/programs/cmm/lib/mouse.h index 6300892b8f..b3e81eab6e 100644 --- a/programs/cmm/lib/mouse.h +++ b/programs/cmm/lib/mouse.h @@ -22,11 +22,11 @@ * up - key release events * move - event MOUSE movements * click - when clicked - * dblclick - double-click the default 50 (500 ms) + * dblclick - double-click get system value * drag - drag the element event */ -:dword __TMP_TIME,MOUSE_TIME; +:dword __TMP_TIME,DOUBLE_CLICK_DELAY; :struct MOUSE { signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,drag,left,top; @@ -42,7 +42,7 @@ } mouse; :void MOUSE::clearTime() { - tmp_time = GetStartTime()+MOUSE_TIME; + tmp_time = GetStartTime()+DOUBLE_CLICK_DELAY; } :void MOUSE::show() { @@ -149,7 +149,7 @@ drag = false; if(!move) click = true; __TMP_TIME = GetStartTime(); - if(__TMP_TIME-tmp_time<=MOUSE_TIME) + if(__TMP_TIME-tmp_time<=DOUBLE_CLICK_DELAY) { dblclick = true; click = false; @@ -212,4 +212,54 @@ pause(5); } + +/*===================================================================================== +=========================== =========================== +=========================== SYSTEM =========================== +=========================== =========================== +=====================================================================================*/ + + +inline fastcall int GetMouseSpeed() { + $mov eax,18 + $mov ebx,19 + $mov ecx,0 + $int 0x40 +} + +inline fastcall void SetMouseSpeed(EDX) { + $mov eax,18 + $mov ebx,19 + $mov ecx,1 + $int 0x40 +} + +inline fastcall int GetMouseAcceleration() { + $mov eax,18 + $mov ebx,19 + $mov ecx,2 + $int 0x40 +} + +inline fastcall void SetMouseAcceleration(EDX) { + $mov eax,18 + $mov ebx,19 + $mov ecx,3 + $int 0x40 +} + +inline fastcall int GetMouseDoubleClickDelay() { + $mov eax,18 + $mov ebx,19 + $mov ecx,6 + $int 0x40 +} + +inline fastcall void SetMouseDoubleClickDelay(DL) { + $mov eax,18 + $mov ebx,19 + $mov ecx,7 + $int 0x40 +} + #endif \ No newline at end of file diff --git a/programs/cmm/mouse_cfg/kos_mouse_functions.h b/programs/cmm/mouse_cfg/kos_mouse_functions.h deleted file mode 100644 index 26366a21ef..0000000000 --- a/programs/cmm/mouse_cfg/kos_mouse_functions.h +++ /dev/null @@ -1,42 +0,0 @@ - -inline fastcall int GetMouseSpeed() { - $mov eax,18 - $mov ebx,19 - $mov ecx,0 - $int 0x40 -} - -inline fastcall void SetMouseSpeed(EDX) { - $mov eax,18 - $mov ebx,19 - $mov ecx,1 - $int 0x40 -} - -inline fastcall int GetMouseAcceleration() { - $mov eax,18 - $mov ebx,19 - $mov ecx,2 - $int 0x40 -} - -inline fastcall void SetMouseAcceleration(EDX) { - $mov eax,18 - $mov ebx,19 - $mov ecx,3 - $int 0x40 -} - -inline fastcall int GetMouseDoubleClickDelay() { - $mov eax,18 - $mov ebx,19 - $mov ecx,6 - $int 0x40 -} - -inline fastcall void SetMouseDoubleClickDelay(DL) { - $mov eax,18 - $mov ebx,19 - $mov ecx,7 - $int 0x40 -} \ No newline at end of file diff --git a/programs/cmm/mouse_cfg/mouse_cfg.c b/programs/cmm/mouse_cfg/mouse_cfg.c index ad649b9f62..4bcc081245 100644 --- a/programs/cmm/mouse_cfg/mouse_cfg.c +++ b/programs/cmm/mouse_cfg/mouse_cfg.c @@ -14,8 +14,6 @@ #include "..\lib\obj\libini.h" #include "..\lib\patterns\restart_process.h" -#include "kos_mouse_functions.h" - #ifdef LANG_RUS ?define WINDOW_TITLE "Проверка и настройка параметров мыши" ?define CHECK_MOUSE_1 "Нажмите на этой области" diff --git a/programs/cmm/textreader/textreader.c b/programs/cmm/textreader/textreader.c index 21ad95c343..f1bf19cb6f 100644 --- a/programs/cmm/textreader/textreader.c +++ b/programs/cmm/textreader/textreader.c @@ -18,7 +18,7 @@ #define DEFAULT_EDITOR "/sys/tinypad" #define INTRO_TEXT "This is a plain Text Reader.\nTry to open some text file." -#define VERSION "Text Reader v1.05" +#define VERSION "Text Reader v1.06" #define ABOUT "Idea: Leency, punk_joker Code: Leency, Veliant, KolibriOS Team