Eolite 5.30

- add search feature
- add Tab key to switch between text fields and the list
This commit is contained in:
2025-03-21 04:43:23 +02:00
parent 92f9d76f14
commit 6a00afb5a4
6 changed files with 67 additions and 71 deletions

View File

@@ -11,9 +11,9 @@ TODO:
http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334 http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334
*/ */
#define ABOUT_TITLE "EOLITE 5.29" #define ABOUT_TITLE "EOLITE 5.30"
#define TITLE_EOLITE "Eolite File Manager 5.29" #define TITLE_EOLITE "Eolite File Manager 5.30"
#define TITLE_KFM "Kolibri File Manager 2.29"; #define TITLE_KFM "Kolibri File Manager 2.30";
#define MEMSIZE 1024 * 250 #define MEMSIZE 1024 * 250
#include "../lib/clipboard.h" #include "../lib/clipboard.h"
@@ -30,8 +30,10 @@ TODO:
#include "../lib/obj/libini.h" #include "../lib/obj/libini.h"
#include "../lib/obj/box_lib.h" #include "../lib/obj/box_lib.h"
#include "../lib/obj/libimg.h" #include "../lib/obj/libimg.h"
#include "../lib/obj/proc_lib.h"
#include "../lib/patterns/history.h" #include "../lib/patterns/history.h"
#include "../lib/patterns/select_list.h"
#include "imgs/images.h" #include "imgs/images.h"
#include "include/const.h" #include "include/const.h"
@@ -110,6 +112,9 @@ edit_box popin_text = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x1000000
PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0}; PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
_ini icons_ini = { "/sys/File managers/icons.ini", NULL };
#include "search.c"
#include "include\settings.h" #include "include\settings.h"
#include "include\gui.h" #include "include\gui.h"
#include "include\progress_dialog.h" #include "include\progress_dialog.h"
@@ -146,6 +151,14 @@ void handle_param()
if (ESBYTE[p]=='\0') return; if (ESBYTE[p]=='\0') return;
if (ESBYTE[p]=='\\') switch (ESBYTE[p+1])
{
case 's':
strcpy(path, p + 3);
SearchThread();
ExitProcess();
}
if (ESBYTE[p]=='-') switch (ESBYTE[p+1]) if (ESBYTE[p]=='-') switch (ESBYTE[p+1])
{ {
case 'p': case 'p':
@@ -438,6 +451,9 @@ void main()
case SCAN_CODE_KEY_G: case SCAN_CODE_KEY_G:
EventOpenConsoleHere(); EventOpenConsoleHere();
break; break;
case SCAN_CODE_KEY_F:
EventOpenSearch();
break;
case SCAN_CODE_KEY_V: case SCAN_CODE_KEY_V:
EventPaste(path); EventPaste(path);
break; break;
@@ -1322,6 +1338,12 @@ void EventOpenConsoleHere()
RunProgram("/sys/shell", #param); RunProgram("/sys/shell", #param);
} }
void EventOpenSearch()
{
sprintf(#param, "\\s %s", path);
RunProgram(#program_path, #param);
}
void ProceedMouseGestures() void ProceedMouseGestures()
{ {
char stats; char stats;

View File

@@ -1,4 +1,3 @@
_ini icons_ini = { "/sys/File managers/icons.ini", NULL };
struct ICONS_INI { struct ICONS_INI {
collection exts; collection exts;

View File

@@ -1,13 +1,3 @@
#define MEMSIZE 100*1000
#include "../lib/fs.h"
#include "../lib/gui.h"
#include "../lib/list_box.h"
#include "../lib/obj/box_lib.h"
#include "../lib/obj/proc_lib.h"
#include "../lib/obj/libini.h"
#include "../lib/patterns/select_list.h"
//===================================================// //===================================================//
// // // //
// DATA // // DATA //
@@ -34,11 +24,11 @@ enum {
BTN_CHOOSE_PATH BTN_CHOOSE_PATH
}; };
proc_info Form; dword mouse_dd;
#define TOOLBAR_H 100 edit_box edit_name = {230,13, 30,0xffffff,0x94AECE,0xffffff,0xffffff,
0x10000000,sizeof(search_name)-2,#search_name,#mouse_dd, ed_focus,0,0};
edit_box edit_name = {230,13, 30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(search_name)-2,#search_name,0, ed_focus,0,0}; edit_box edit_path = {310,260,30,0xffffff,0x94AECE,0xffffff,0xffffff,
edit_box edit_path = {310,260,30,0xffffff,0x94AECE,0xffffff,0xffffff,0x10000000,sizeof(search_path)-2,#search_path,0, 0b,0,0}; 0x10000000,sizeof(search_path)-2,#search_path,#mouse_dd, 0b,0,0};
opendialog open_folder_dialog = opendialog open_folder_dialog =
{ {
@@ -49,7 +39,7 @@ opendialog open_folder_dialog =
0, //dword opendir_path, 0, //dword opendir_path,
#search_path, //dword dir_default_path, #search_path, //dword dir_default_path,
#open_dialog_path, #open_dialog_path,
#draw_window, #draw_window_search,
0, 0,
#search_path, //dword openfile_path, #search_path, //dword openfile_path,
0, //dword filename_area, 0, //dword filename_area,
@@ -60,6 +50,10 @@ opendialog open_folder_dialog =
NULL NULL
}; };
#define TOOLBAR_H 100
#define LISTX 0
#define LISTY TOOLBAR_H
//===================================================// //===================================================//
// // // //
// RESULTS // // RESULTS //
@@ -97,16 +91,14 @@ void RESULTS::drop()
// // // //
//===================================================// //===================================================//
void main() void SearchThread()
{ {
int prev_first, prev_cur_y; int prev_first, prev_cur_y;
load_dll(boxlib, #box_lib_init,0);
load_dll(libini, #lib_init,1);
load_dll(Proc_lib, #OpenDialog_init,0); load_dll(Proc_lib, #OpenDialog_init,0);
OpenDialog_init stdcall (#open_folder_dialog); OpenDialog_init stdcall (#open_folder_dialog);
edit_box_set_text stdcall (#edit_name, ".ini"); if (!ESBYTE[path]) strcpy(path, "/sys");
edit_box_set_text stdcall (#edit_path, "/kolibrios"); edit_box_set_text stdcall (#edit_path, path);
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); @SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
loop() switch(@WaitEvent()) loop() switch(@WaitEvent())
@@ -134,6 +126,17 @@ void main()
@GetKeys(); @GetKeys();
edit_box_key stdcall (#edit_name); edit_box_key stdcall (#edit_name);
edit_box_key stdcall (#edit_path); edit_box_key stdcall (#edit_path);
if (key_scancode == SCAN_CODE_TAB) {
if (edit_name.flags & ed_focus) {
edit_name.flags >< edit_path.flags;
} else if (edit_path.flags & ed_focus) {
edit_path.flags -= ed_focus;
} else {
edit_name.flags += ed_focus;
}
draw_window_search();
break;
}
if (edit_name.flags & ed_focus) || (edit_path.flags & ed_focus) { if (edit_name.flags & ed_focus) || (edit_path.flags & ed_focus) {
if (SCAN_CODE_ENTER == key_scancode) EventSearch(); if (SCAN_CODE_ENTER == key_scancode) EventSearch();
} else { } else {
@@ -152,22 +155,20 @@ void main()
break; break;
case evReDraw: case evReDraw:
draw_window(); sc.get();
DefineAndDrawWindow(screen.w-600/2,100,640,600,0x73,sc.work,T_WINDOW_HEADER,0);
GetProcessInfo(#Form, SelfInfo);
IF (Form.status_window&ROLLED_UP) break;
if (Form.width < 370) { MoveSize(OLD,OLD,370,OLD); break; }
if (Form.height < 250) { MoveSize(OLD,OLD,OLD,250); break; }
draw_window_search();
break; break;
} }
} }
void draw_window() void draw_window_search()
{ {
sc.get(); SelectList_Init(LISTX, LISTY, Form.cwidth-scroll1.size_x-1, Form.cheight-TOOLBAR_H-1);
DefineAndDrawWindow(screen.w-600/2,100,640,600,0x73,sc.work,T_WINDOW_HEADER,0);
GetProcessInfo(#Form, SelfInfo);
IF (Form.status_window&ROLLED_UP) return;
if (Form.width < 270) { MoveSize(OLD,OLD,270,OLD); return; }
if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); return; }
SelectList_Init( 0, TOOLBAR_H,
Form.cwidth-scroll1.size_x-1,
Form.cheight-TOOLBAR_H-1);
SelectList_Draw(); SelectList_Draw();
DrawBar(0, TOOLBAR_H-1, Form.cwidth, 1, sc.line); DrawBar(0, TOOLBAR_H-1, Form.cwidth, 1, sc.line);
DrawBar(0, 0, Form.cwidth, TOOLBAR_H-1, sc.work); DrawBar(0, 0, Form.cwidth, TOOLBAR_H-1, sc.work);
@@ -178,7 +179,6 @@ void draw_window()
DrawStandartCaptButton(10, 63, BTN_SEARCH, T_BUTTON_SEARCH); DrawStandartCaptButton(10, 63, BTN_SEARCH, T_BUTTON_SEARCH);
} }
_ini ini = { "/sys/File managers/icons.ini", "icons16" };
void SelectList_DrawLine(dword i) void SelectList_DrawLine(dword i)
{ {
int yyy = i*select_list.item_h+select_list.y; int yyy = i*select_list.item_h+select_list.y;
@@ -201,16 +201,19 @@ void SelectList_DrawLine(dword i)
} else { } else {
strcpy(#tname, results.name.get(select_list.first + i)); strcpy(#tname, results.name.get(select_list.first + i));
strlwr(#tname); strlwr(#tname);
icon = ini.GetInt(#tname + strrchr(#tname, '.'), 2); icons_ini.section = "icons16";
icon = icons_ini.GetInt(#tname + strrchr(#tname, '.'), 2);
} }
#define ICONX 7 #define ICONX 7
DrawBar(select_list.x, yyy, ICONX-1, select_list.item_h, 0xFFFfff); DrawBar(LISTX, yyy, ICONX, select_list.item_h, 0xFFFfff);
DrawBar(select_list.x+ICONX+18, yyy, select_list.w-ICONX-18, select_list.item_h, bg); DrawBar(LISTX+ICONX, yyy, 18, 1, 0xFFFfff);
draw_icon_16(select_list.x+ICONX, yyy+1, icon); DrawBar(LISTX+ICONX, yyy + select_list.item_h-1, 18, 1, 0xFFFfff);
DrawBar(LISTX+ICONX+18, yyy, select_list.w-ICONX-18, select_list.item_h, bg);
draw_icon_16(LISTX+ICONX, yyy+1, icon);
WriteText(select_list.x + ICONX+18+4,yyy+select_list.text_y,0x90, col, results.name.get(select_list.first + i)); WriteText(LISTX + ICONX+18+4,yyy+select_list.text_y,0x90, col, results.name.get(select_list.first + i));
WriteText(select_list.x + ICONX+18+206,yyy+select_list.text_y,0x90, col, results.path.get(select_list.first + i)); WriteText(LISTX + ICONX+18+206,yyy+select_list.text_y,0x90, col, results.path.get(select_list.first + i));
} }
void SelectList_LineChanged() void SelectList_LineChanged()
@@ -289,6 +292,4 @@ void find_loop(dword way)
} }
} }
stop:

View File

@@ -1,6 +0,0 @@
if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("LANG") == "ru_RU"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
tup.rule("search.c", "c-- /D=$(C_LANG) /OPATH=%o %f" .. tup.getconfig("KPACK_CMD"), "search.com")

View File

@@ -1,10 +0,0 @@
@del search
@c-- /D=LANG_ENG search.c
@rename search.com search
@del warning.txt
if exist search (
@exit
) else (
@pause
)

View File

@@ -1,10 +0,0 @@
@del search
@c-- /D=LANG_RUS search.c
@rename search.com search
@del warning.txt
if exist search (
@exit
) else (
@pause
)