From b995e57c1ee41e8d773cfb77eab1ee3a2a38aa63 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sat, 19 Jun 2021 20:42:09 +0000 Subject: [PATCH] kfm2: add clickable funclional buttons, return template app accidentally deleted git-svn-id: svn://kolibrios.org@8881 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/eolite/Eolite.c | 40 +++++++++++++++------- programs/cmm/eolite/build_en.bat | 5 +++ programs/cmm/eolite/build_ru.bat | 5 +++ programs/cmm/eolite/compile_en.bat | 11 ------ programs/cmm/eolite/compile_ru.bat | 12 ------- programs/cmm/eolite/include/translations.h | 26 ++++++++++++-- programs/cmm/menu/menu.c | 6 ++-- programs/cmm/template/build.bat | 5 +++ programs/cmm/template/t.c | 27 +++++++++++++++ 9 files changed, 96 insertions(+), 41 deletions(-) create mode 100644 programs/cmm/eolite/build_en.bat create mode 100644 programs/cmm/eolite/build_ru.bat delete mode 100644 programs/cmm/eolite/compile_en.bat delete mode 100644 programs/cmm/eolite/compile_ru.bat create mode 100644 programs/cmm/template/build.bat create mode 100644 programs/cmm/template/t.c diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index ba8bb24b8b..33b4971a01 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -3,15 +3,10 @@ // 70.5 - get volume info and label -#define ABOUT_TITLE "EOLITE 5 Beta5" -#define TITLE_EOLITE "Eolite File Manager 5 Beta5" -#define TITLE_KFM "Kolibri File Manager 2 Beta5"; +#define ABOUT_TITLE "EOLITE 5 Beta6" +#define TITLE_EOLITE "Eolite File Manager 5 Beta6" +#define TITLE_KFM "Kolibri File Manager 2 Beta6"; -#ifndef AUTOBUILD -#include "lang.h--" -#endif - -//libraries #define MEMSIZE 1024 * 250 #include "../lib/clipboard.h" #include "../lib/strings.h" @@ -47,7 +42,8 @@ enum { GOUP_BTN, COPY_BTN, CUT_BTN, - PASTE_BTN + PASTE_BTN, + KFM_FUNC_ID = 450 }; //NewElement options @@ -141,8 +137,7 @@ libimg_image icons16_selected; libimg_image icons32_default; libimg_image icons32_selected; -#define STATUS_BAR_H 16; -int status_bar_h = 0; +int status_bar_h; int icon_size = 18; @@ -407,6 +402,9 @@ void main() case BREADCRUMB_ID...360: ClickOnBreadCrumb(id-BREADCRUMB_ID); break; + case KFM_FUNC_ID...KFM_FUNC_ID+10: + FnProcess(id-KFM_FUNC_ID); + break; } break; @@ -576,7 +574,10 @@ void draw_window() incn x; dword title; if (show_status_bar.checked) { - status_bar_h = STATUS_BAR_H; + #define STBAR_EOLITE_H 16; + #define STBAR_KFM_H 21; + if (efm) status_bar_h = STBAR_KFM_H; + else status_bar_h = STBAR_EOLITE_H; } else { status_bar_h = 0; } @@ -650,6 +651,19 @@ void DrawButtonsAroundList() if (efm) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,sc.work_graph); } +void DrawFuncButtonsInKfm() +{ + int i, x=0, len, min_w=0, padding; + for (i=0; i<10; i++) min_w += strlen(kfm_func[i])*6 + 2; + padding = Form.cwidth - min_w + 4 / 10; + for (i=0; i<10; i++) { + len = strlen(kfm_func[i])*6 + padding; + if (i==9) len = Form.cwidth - x - 3; + DrawFlatButtonSmall(x+1, Form.cheight - 19, len, 16, i+KFM_FUNC_ID+1, kfm_func[i]); + x += len + 2; + } +} + void DrawStatusBar() { char status_bar_str[80]; @@ -657,7 +671,7 @@ void DrawStatusBar() if (efm) { DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work); - WriteTextCenter(0,Form.cheight - 12, Form.cwidth,sc.work_text,T_KFM_FUNC); + DrawFuncButtonsInKfm(); return; } diff --git a/programs/cmm/eolite/build_en.bat b/programs/cmm/eolite/build_en.bat new file mode 100644 index 0000000000..814a984329 --- /dev/null +++ b/programs/cmm/eolite/build_en.bat @@ -0,0 +1,5 @@ +@del Eolite +@c-- /D=LANG_ENG Eolite.c +@rename Eolite.com Eolite +if not exist Eolite ( @pause ) +@del warning.txt \ No newline at end of file diff --git a/programs/cmm/eolite/build_ru.bat b/programs/cmm/eolite/build_ru.bat new file mode 100644 index 0000000000..8379f73075 --- /dev/null +++ b/programs/cmm/eolite/build_ru.bat @@ -0,0 +1,5 @@ +@del Eolite +@c-- /D=LANG_RUS Eolite.c +@rename Eolite.com Eolite +if not exist Eolite ( @pause ) +@del warning.txt diff --git a/programs/cmm/eolite/compile_en.bat b/programs/cmm/eolite/compile_en.bat deleted file mode 100644 index a3ee5e971c..0000000000 --- a/programs/cmm/eolite/compile_en.bat +++ /dev/null @@ -1,11 +0,0 @@ -@del lang.h-- -@echo #define LANG_ENG 1 >lang.h-- - -@del Eolite -cls -@c-- Eolite.c -rem @kpack Eolite.com -@rename Eolite.com Eolite -@del warning.txt -@del lang.h-- -@pause \ No newline at end of file diff --git a/programs/cmm/eolite/compile_ru.bat b/programs/cmm/eolite/compile_ru.bat deleted file mode 100644 index 89117a5a9e..0000000000 --- a/programs/cmm/eolite/compile_ru.bat +++ /dev/null @@ -1,12 +0,0 @@ -@del lang.h-- -@echo #define LANG_RUS 1 >lang.h-- - -@del Eolite -cls -@c-- Eolite.c -rem @kpack Eolite.com -@rename Eolite.com Eolite - -@del warning.txt -@del lang.h-- -@pause \ No newline at end of file diff --git a/programs/cmm/eolite/include/translations.h b/programs/cmm/eolite/include/translations.h index 4eb9c7939b..1884eed9ae 100644 --- a/programs/cmm/eolite/include/translations.h +++ b/programs/cmm/eolite/include/translations.h @@ -26,6 +26,18 @@ ?define COPY_PATH_STR "'Путь папки скопирован в буфер обмена' -I" ?define T_ABOUT "О программе" ?define T_USE_SHIFT_ENTER "'Используйте Shift+Enter чтобы открыть все выделенные файлы.' -I" +char *kfm_func = { + "F1 Инфо", + "F2 Переим.", + "F3 Просм.", + "F4 Редакт.", + "F5 Копировать", + "F6 Переместить", + "F7 Папка", + "F8 Удалить", + "F9 Файл", + "F10 Настройки" +} #else ?define T_FILE "File" ?define T_TYPE "Type" @@ -55,7 +67,17 @@ ?define COPY_PATH_STR "'Directory path copied to clipboard' -I" ?define T_ABOUT "About" ?define T_USE_SHIFT_ENTER "'Use Shift+Enter to open all selected files.' -I" +char *kfm_func = { + "F1 Info", + "F2 Rename", + "F3 View", + "F4 Edit", + "F5 Copy", + "F6 Move", + "F7 Folder", + "F8 Delete", + "F9 File", + "F10 Settings" +} #endif -?define T_KFM_FUNC "F1 Info | F2 Rename | F3 View | F4 Edit | F5 Copy | F6 Move | F7 Folder | F8 Delete | F9 File | F10 Settings" -//?define T_KFM_FUNC "F1 Инфо | F2 Переим. | F3 Просм. | F4 Редакт. | F5 Копировать | F6 Переместить | F7 Папка | F8 Удалить | F9 Файл | F10 Настройки" \ No newline at end of file diff --git a/programs/cmm/menu/menu.c b/programs/cmm/menu/menu.c index bc7f51ae42..73fcf0b527 100644 --- a/programs/cmm/menu/menu.c +++ b/programs/cmm/menu/menu.c @@ -154,8 +154,8 @@ void CorrectLastItem() inline ProcessKeys() { - key_scancode = @GetKeyScancode(); - switch(key_scancode) + @GetKeyScancode(); + switch(AL) { case SCAN_CODE_ESC: exit(); @@ -184,7 +184,7 @@ inline ProcessKeys() break; default: - if (menu1.ProcessKey(key_scancode)) draw_list(); + if (menu1.ProcessKey(AL)) draw_list(); } } diff --git a/programs/cmm/template/build.bat b/programs/cmm/template/build.bat new file mode 100644 index 0000000000..ad5938d594 --- /dev/null +++ b/programs/cmm/template/build.bat @@ -0,0 +1,5 @@ +@del t +@c-- t.c +@pause +@rename t.com t +@del warning.txt diff --git a/programs/cmm/template/t.c b/programs/cmm/template/t.c new file mode 100644 index 0000000000..ecd8f7299a --- /dev/null +++ b/programs/cmm/template/t.c @@ -0,0 +1,27 @@ +#define MEMSIZE 4096*40 + +#include "../lib/gui.h" +#include "../lib/fs.h" + +void main() +{ + proc_info Form; + + @SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE); + loop() switch(WaitEvent()) + { + case evMouse: + mouse.get(); + break; + + case evKey: + @GetKeyScancode(); + if (AL == SCAN_CODE_ESC) @ExitProcess(); + break; + + case evReDraw: + sc.get(); + DefineAndDrawWindow(100, 100, 300, 250, 0x34, sc.work, "Template app", 0); + GetProcessInfo(#Form, SelfInfo); + } +}