Eolite 5.30: Added file search (#175)

Co-authored-by: Max Logaev <maxlogaev@proton.me>
Reviewed-on: #175
Reviewed-by: Max Logaev <maxlogaev@proton.me>
Co-authored-by: leency <lipatov.kiril@gmail.com>
Co-committed-by: leency <lipatov.kiril@gmail.com>
This commit is contained in:
2025-03-28 19:48:39 +01:00
committed by Max Logaev
parent 293e1d195a
commit 02b2395ef1
12 changed files with 92 additions and 82 deletions

View File

@@ -667,6 +667,7 @@ tup.append_table(img_files, {
{"EASYSHOT", VAR_PROGS .. "/cmm/misc/easyshot.com"}, {"EASYSHOT", VAR_PROGS .. "/cmm/misc/easyshot.com"},
{"MOUSECFG", VAR_PROGS .. "/cmm/mousecfg/mousecfg.com"}, {"MOUSECFG", VAR_PROGS .. "/cmm/mousecfg/mousecfg.com"},
{"BARSCFG", VAR_PROGS .. "/cmm/barscfg/barscfg.com"}, {"BARSCFG", VAR_PROGS .. "/cmm/barscfg/barscfg.com"},
{"SEARCH", VAR_PROGS .. "/cmm/misc/search.com"},
{"SYSPANEL", VAR_PROGS .. "/cmm/misc/software_widget.com"}, {"SYSPANEL", VAR_PROGS .. "/cmm/misc/software_widget.com"},
{"SYSMON", VAR_PROGS .. "/cmm/sysmon/sysmon.com"}, {"SYSMON", VAR_PROGS .. "/cmm/sysmon/sysmon.com"},
{"TMPDISK", VAR_PROGS .. "/cmm/tmpdisk/tmpdisk.com"}, {"TMPDISK", VAR_PROGS .. "/cmm/tmpdisk/tmpdisk.com"},

View File

@@ -12,6 +12,7 @@
23 Game Center |allgames 23 Game Center |allgames
60 System panel |syspanel 60 System panel |syspanel
18 Documentation |docpack 18 Documentation |docpack
49 Search |search
53 Run |run 53 Run |run
04 Shut down |end 04 Shut down |end
#1 **** DEMOS #1 **** DEMOS

View File

@@ -13,6 +13,7 @@
16 Centro de juegos |allgames 16 Centro de juegos |allgames
60 System panel |syspanel 60 System panel |syspanel
18 Ayuda |docpack 18 Ayuda |docpack
49 Buscar |search
53 Ejecutar aplicaci<63>n |run 53 Ejecutar aplicaci<63>n |run
04 Apagar |end 04 Apagar |end
#1 **** DEMOS #1 **** DEMOS

View File

@@ -12,6 +12,7 @@
23 <20><><EFBFBD><E0AEA2><><E6A5AD> |allgames 23 <20><><EFBFBD><E0AEA2><><E6A5AD> |allgames
60 <20><><EFBFBD><EFBFBD><E2A5AC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |syspanel 60 <20><><EFBFBD><EFBFBD><E2A5AC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |syspanel
18 <20><><EFBFBD><EFBFBD><E3ACA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |docpack 18 <20><><EFBFBD><EFBFBD><E3ACA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |docpack
49 <20><><EFBFBD><EFBFBD><EFBFBD> |search
53 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC> |run 53 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC> |run
04 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A5AD><><E0A0A1><EFBFBD> |end 04 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A5AD><><E0A0A1><EFBFBD> |end
#1 **** 2D <20><><EFBFBD><EFBFBD><EFBFBD> #1 **** 2D <20><><EFBFBD><EFBFBD><EFBFBD>

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"
@@ -26,12 +26,15 @@ TODO:
#include "../lib/kfont.h" #include "../lib/kfont.h"
#include "../lib/collection.h" #include "../lib/collection.h"
#include "../lib/copyf.h" #include "../lib/copyf.h"
#include "../lib/dll.h"
#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 +113,8 @@ 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 "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"
@@ -121,6 +126,8 @@ PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #t
#include "include\about.h" #include "include\about.h"
#include "include\properties.h" #include "include\properties.h"
#include "search.c"
void handle_param() void handle_param()
{ {
//-p <path> : just show file/folder properties dialog //-p <path> : just show file/folder properties dialog
@@ -146,6 +153,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 +453,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 +1340,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,16 +1,8 @@
if tup.getconfig("NO_CMM") ~= "" then return end if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("NO_TCC") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_tcc.lua")
if tup.getconfig("LANG") == "ru_RU" if tup.getconfig("LANG") == "ru_RU"
then C_LANG = "LANG_RUS" then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config else C_LANG = "LANG_ENG" -- this includes default case without config
end end
LFLAGS = LFLAGS .. " -stack=20480" tup.rule("Eolite.c", "c-- /D=$(C_LANG) /OPATH=%o %f" .. tup.getconfig("KPACK_CMD"), "Eolite.com")
LIBS += " ../../develop/ktcc/trunk/bin/lib/tiny.o -nostdlib -lbox_lib -lini -limg"
tup.rule("Eolite.c", "c-- -coff /D=" .. C_LANG .. " /OPATH=%o %f", "%B.obj")
tup.rule("Eolite.obj", "objconv -felf32 %f %o", "%B.o")
link_tcc("Eolite.o", "%B.com")

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,17 @@ 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); #ifndef __COFF__
load_dll(Proc_lib, #OpenDialog_init,0); load_dll(Proc_lib, #OpenDialog_init,0);
#endif
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())
@@ -132,8 +127,19 @@ void main()
case evKey: case evKey:
@GetKeys(); @GetKeys();
edit_box_key stdcall (#edit_name); edit_box_key_c stdcall (#edit_name);
edit_box_key stdcall (#edit_path); edit_box_key_c 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 +158,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 +182,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 +204,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 +295,4 @@ void find_loop(dword way)
} }
} }
stop:

View File

@@ -0,0 +1,13 @@
#define MEMSIZE 1024*20
#define ENTRY_POINT #main
#include "../lib/fs.h"
void main()
{
char param2[4096];
strcpy(#param2, "\\s ");
strncpy(#param2 + 3, #param, sizeof(param2) - 2 - 3);
RunProgram("/sys/File managers/Eolite", #param2);
ExitProcess();
}

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
)