mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2025-08-03 19:56:31 -04:00
Eolite 5.32: Search fix (#191)
- LMB to open file, RMB to show in folder - fix: correctly open folders - fix UI: better list alignment - Eolite: optimize OpenDir - SelectList_ProcessMouse() better react on click Reviewed-on: https://git.kolibrios.org/KolibriOS/kolibrios/pulls/191 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:
parent
5abc319817
commit
8da45bab3e
@ -10,9 +10,9 @@ TODO:
|
||||
http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334
|
||||
*/
|
||||
|
||||
#define ABOUT_TITLE "Eolite 5.31"
|
||||
#define TITLE_EOLITE "Eolite File Manager 5.31"
|
||||
#define TITLE_KFM "Kolibri File Manager 2.31";
|
||||
#define ABOUT_TITLE "Eolite 5.32"
|
||||
#define TITLE_EOLITE "Eolite File Manager 5.32"
|
||||
#define TITLE_KFM "Kolibri File Manager 2.32";
|
||||
|
||||
#define MEMSIZE 1024 * 250
|
||||
#include "../lib/clipboard.h"
|
||||
@ -718,7 +718,7 @@ void DrawFilePanels()
|
||||
DrawButtonsAroundList();
|
||||
path = location[active_panel^1];
|
||||
active_panel ^= 1;
|
||||
OpenDir2(WITH_REDRAW);
|
||||
OpenDir_without_unselect(WITH_REDRAW);
|
||||
active_panel ^= 1;
|
||||
if (!getSelectedCount()) files_inactive.count = files.count;
|
||||
llist_copy(#files, #files_active);
|
||||
@ -731,38 +731,22 @@ void DrawFilePanels()
|
||||
|
||||
DrawButtonsAroundList();
|
||||
path = location[active_panel];
|
||||
OpenDir2(WITH_REDRAW);
|
||||
OpenDir_without_unselect(WITH_REDRAW);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenDir2(char redraw){
|
||||
if (buf) free(buf);
|
||||
if (GetDir(#buf, #files.count, path, DIRS_NOROOT)) {
|
||||
Write_Error(EAX);
|
||||
history.add(path);
|
||||
EventHistoryGoBack();
|
||||
return;
|
||||
}
|
||||
SetCurDir(path);
|
||||
if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
|
||||
files.visible = math.min(files.h / files.item_h, files.count);
|
||||
if (!strncmp(path, "/rd/1",5)) || (!strncmp(path, "/sys/",4))
|
||||
dir_at_fat16 = true; else dir_at_fat16 = false;
|
||||
Sorting();
|
||||
SystemDiscs.Draw();
|
||||
list_full_redraw = true;
|
||||
List_ReDraw();
|
||||
DrawPathBar();
|
||||
}
|
||||
|
||||
|
||||
void OpenDir(char redraw){
|
||||
int errornum;
|
||||
void OpenDir(char redraw) {
|
||||
unselectAll();
|
||||
OpenDir_without_unselect(redraw);
|
||||
}
|
||||
|
||||
|
||||
void OpenDir_without_unselect(char redraw) {
|
||||
int errornum;
|
||||
|
||||
if (buf) free(buf);
|
||||
if (errornum = GetDir(#buf, #files.count, path, DIRS_NOROOT)) {
|
||||
history.add(path);
|
||||
//EventHistoryGoBack();
|
||||
Dir_Up();
|
||||
Write_Error(errornum);
|
||||
return;
|
||||
|
@ -50,10 +50,6 @@ opendialog open_folder_dialog =
|
||||
NULL
|
||||
};
|
||||
|
||||
#define TOOLBAR_H 100
|
||||
#define LISTX 0
|
||||
#define LISTY TOOLBAR_H
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// RESULTS //
|
||||
@ -95,9 +91,7 @@ void SearchThread()
|
||||
{
|
||||
int prev_first, prev_cur_y;
|
||||
|
||||
#ifndef __COFF__
|
||||
load_dll(Proc_lib, #OpenDialog_init,0);
|
||||
#endif
|
||||
OpenDialog_init stdcall (#open_folder_dialog);
|
||||
|
||||
if (!ESBYTE[path]) strcpy(path, "/sys");
|
||||
@ -107,28 +101,43 @@ void SearchThread()
|
||||
loop() switch(@WaitEvent())
|
||||
{
|
||||
case evMouse:
|
||||
|
||||
edit_box_mouse stdcall (#edit_name);
|
||||
edit_box_mouse stdcall (#edit_path);
|
||||
|
||||
|
||||
prev_cur_y = select_list.cur_y;
|
||||
|
||||
if (SelectList_ProcessMouse()) {
|
||||
SelectList_Draw();
|
||||
} else {
|
||||
SelectList_DrawLine(select_list.cur_y);
|
||||
}
|
||||
if (mouse.key&MOUSE_RIGHT) && (mouse.up) && (select_list.MouseOver()) EventOpenFile(false);
|
||||
break;
|
||||
|
||||
if (select_list.MouseOver(mouse.x, mouse.y))
|
||||
{
|
||||
if (mouse.key&MOUSE_LEFT) && (mouse.up) {
|
||||
if (prev_cur_y == select_list.cur_y) EventRunFile();
|
||||
}
|
||||
|
||||
if (mouse.key&MOUSE_RIGHT) && (mouse.up) {
|
||||
EventShowFileInFolder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case evButton:
|
||||
switch (@GetButtonID()) {
|
||||
case 1: @ExitProcess(); break;
|
||||
case BTN_SEARCH: EventSearch(); break;
|
||||
case BTN_CHOOSE_PATH: EventChooseSearchInPath();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
break;
|
||||
case evKey:
|
||||
@GetKeys();
|
||||
edit_box_key stdcall (#edit_name);
|
||||
edit_box_key stdcall (#edit_path);
|
||||
GetKeys();
|
||||
edit_box_key_c stdcall (#edit_name, key_editbox);
|
||||
edit_box_key_c stdcall (#edit_path, key_editbox);
|
||||
if (key_scancode == SCAN_CODE_TAB) {
|
||||
if (edit_name.flags & ed_focus) {
|
||||
edit_name.flags >< edit_path.flags;
|
||||
@ -143,7 +152,7 @@ void SearchThread()
|
||||
if (edit_name.flags & ed_focus) || (edit_path.flags & ed_focus) {
|
||||
if (SCAN_CODE_ENTER == key_scancode) EventSearch();
|
||||
} else {
|
||||
if (SCAN_CODE_ENTER == key_scancode) EventOpenFile(true);
|
||||
if (SCAN_CODE_ENTER == key_scancode) EventRunFile();
|
||||
prev_first = select_list.first;
|
||||
prev_cur_y = select_list.cur_y;
|
||||
if (select_list.ProcessKey(key_scancode)) {
|
||||
@ -169,17 +178,24 @@ void SearchThread()
|
||||
}
|
||||
}
|
||||
|
||||
#define TOOLBAR_H 100
|
||||
#define PAD 10
|
||||
#define LISTX PAD
|
||||
#define LISTY TOOLBAR_H
|
||||
|
||||
void draw_window_search()
|
||||
{
|
||||
SelectList_Init(LISTX, LISTY, Form.cwidth-scroll1.size_x-1, Form.cheight-TOOLBAR_H-1);
|
||||
SelectList_Init(LISTX, LISTY, Form.cwidth-scroll1.size_x-LISTX-LISTX, Form.cheight-TOOLBAR_H-PAD);
|
||||
SelectList_Draw();
|
||||
DrawBar(0, TOOLBAR_H-1, Form.cwidth, 1, sc.line);
|
||||
DrawWideRectangle(0, LISTY-PAD-1, Form.cwidth, Form.cheight-TOOLBAR_H+PAD+1, 9, sc.work);
|
||||
DrawRectangle(PAD-1, LISTY-1, select_list.w+1, select_list.h+1, sc.line);
|
||||
|
||||
DrawBar(0, 0, Form.cwidth, TOOLBAR_H-1, sc.work);
|
||||
DrawEditBox(#edit_name);
|
||||
WriteText(edit_name.left-2, edit_name.top-20, 0x90, sc.work_text, T_SEARCH_NAME);
|
||||
edit_path.width = Form.cwidth - 314;
|
||||
DrawStandartCaptButton(PAD, 63, BTN_SEARCH, T_BUTTON_SEARCH);
|
||||
DrawFileBox(#edit_path, T_SEARCH_PATH, BTN_CHOOSE_PATH);
|
||||
DrawStandartCaptButton(10, 63, BTN_SEARCH, T_BUTTON_SEARCH);
|
||||
}
|
||||
|
||||
void SelectList_DrawLine(dword i)
|
||||
@ -224,6 +240,12 @@ void SelectList_LineChanged()
|
||||
return;
|
||||
}
|
||||
|
||||
void getfullpath(dword to, path, name) {
|
||||
strcpy(to, path);
|
||||
chrcat(to, '/');
|
||||
strcat(to, name);
|
||||
}
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
// EVENTS //
|
||||
@ -238,22 +260,21 @@ void EventChooseSearchInPath()
|
||||
}
|
||||
}
|
||||
|
||||
void getfullpath(dword to, path, name) {
|
||||
strcpy(to, path);
|
||||
chrcat(to, '/');
|
||||
strcat(to, name);
|
||||
}
|
||||
|
||||
void EventOpenFile(int run_file_not_show_in_folder)
|
||||
void EventShowFileInFolder()
|
||||
{
|
||||
char full_path[4096];
|
||||
int pos = select_list.cur_y;
|
||||
getfullpath(#full_path, results.path.get(pos), results.name.get(pos));
|
||||
if (run_file_not_show_in_folder) {
|
||||
RunProgram("/sys/@open", #full_path);
|
||||
} else {
|
||||
RunProgram("/sys/file managers/eolite", #full_path);
|
||||
}
|
||||
RunProgram(#program_path, #full_path);
|
||||
}
|
||||
|
||||
void EventRunFile()
|
||||
{
|
||||
char full_path[4096];
|
||||
int pos = select_list.cur_y;
|
||||
getfullpath(#full_path, results.path.get(pos), results.name.get(pos));
|
||||
if (dir_exists(#full_path)) chrcat(#full_path, '/');
|
||||
RunProgram("/sys/@open", #full_path);
|
||||
}
|
||||
|
||||
void EventSearch()
|
||||
|
@ -9,7 +9,6 @@
|
||||
#pragma option -CPA
|
||||
#initallvar 0
|
||||
|
||||
#ifndef __COFF__
|
||||
#jumptomain FALSE
|
||||
|
||||
#startaddress 0
|
||||
@ -30,17 +29,6 @@ dword I_Param = #param;
|
||||
dword I_Path = #program_path;
|
||||
char param[4096];
|
||||
char program_path[4096];
|
||||
#else
|
||||
extern dword __argv;
|
||||
extern dword __path;
|
||||
|
||||
dword I_Param = #__argv;
|
||||
dword I_Path = #__path;
|
||||
|
||||
#define param __argv
|
||||
#define program_path __path
|
||||
#define ______INIT______ start
|
||||
#endif
|
||||
|
||||
#define bool int
|
||||
|
||||
@ -403,6 +391,7 @@ inline fastcall int TestBit( EAX, CL)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define MINIMIZED 0x02
|
||||
#define ROLLED_UP 0x04
|
||||
:void DefineAndDrawWindow(dword _x, _y, _w, _h, _window_type, _bgcolor, _title, _flags)
|
||||
{
|
||||
|
@ -116,17 +116,10 @@
|
||||
EAX = 37;
|
||||
EBX = 2;
|
||||
$int 64
|
||||
$mov ebx, eax
|
||||
$mov ecx, eax
|
||||
key = EAX;
|
||||
$and eax, 0x00000001
|
||||
$shr ebx, 1
|
||||
$and ebx, 0x00000001
|
||||
$shr ecx, 2
|
||||
$and ecx, 0x00000001
|
||||
lkm = EAX;
|
||||
pkm = EBX;
|
||||
mkm = ECX;
|
||||
lkm = EAX&MOUSE_LEFT;
|
||||
pkm = EAX&MOUSE_RIGHT;
|
||||
mkm = EAX&MOUSE_MIDDLE;
|
||||
|
||||
//when you release the MOUSE button
|
||||
// Mouse Move Event
|
||||
|
@ -44,15 +44,14 @@ signed SelectList_ProcessMouse()
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mouse.up) && (mouse.click)
|
||||
if (select_list.ProcessMouse(mouse.x, mouse.y)) {
|
||||
SelectList_LineChanged();
|
||||
return true;
|
||||
}
|
||||
if (mouse.up) && (select_list.ProcessMouse(mouse.x, mouse.y)) {
|
||||
SelectList_LineChanged();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void SelectList_DrawBorder() {
|
||||
:void SelectList_DrawBorder() {
|
||||
DrawRectangle3D(select_list.x-2, select_list.y-2,
|
||||
select_list.w+3+scroll1.size_x, select_list.h+3,
|
||||
sc.dark, sc.light);
|
||||
@ -61,8 +60,8 @@ void SelectList_DrawBorder() {
|
||||
|
||||
void SelectList_DrawScroller()
|
||||
{
|
||||
scroll1.bckg_col = MixColors(sc.work, 0xBBBbbb, 80);
|
||||
scroll1.frnt_col = MixColors(sc.work,0xFFFfff,120);
|
||||
scroll1.bckg_col = sc.dark; // MixColors(sc.work, 0xBBBbbb, 80);
|
||||
scroll1.frnt_col = sc.light; // MixColors(sc.work,0xFFFfff,120);
|
||||
scroll1.line_col = sc.line;
|
||||
|
||||
scroll1.max_area = select_list.count;
|
||||
|
Loading…
x
Reference in New Issue
Block a user