2021-05-28 01:40:55 +02:00
|
|
|
//Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2021
|
2018-10-19 23:13:36 +02:00
|
|
|
//GNU GPL license.
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2021-06-28 00:16:37 +02:00
|
|
|
/*
|
2021-06-28 12:55:08 +02:00
|
|
|
BUGS:
|
2021-06-30 13:38:29 +02:00
|
|
|
- F1 in KFM (move Properties to an external app)
|
2021-12-30 21:54:18 +01:00
|
|
|
- Ctrl+1+2+3+4 in KFM
|
|
|
|
- Highlight another commands on Ctrl|Shift in KFM like in Classic KFM
|
2021-06-28 12:55:08 +02:00
|
|
|
TODO:
|
2021-11-16 01:35:51 +01:00
|
|
|
- add option Preserve all timestamps (Created, Opened, Modified)
|
|
|
|
http://board.kolibrios.org/viewtopic.php?f=23&t=4521&p=77334#p77334
|
2021-06-28 00:16:37 +02:00
|
|
|
*/
|
|
|
|
|
2022-01-05 22:36:44 +01:00
|
|
|
#define ABOUT_TITLE "EOLITE 5.2a"
|
|
|
|
#define TITLE_EOLITE "Eolite File Manager 5.2a"
|
|
|
|
#define TITLE_KFM "Kolibri File Manager 2.2a";
|
2020-05-30 13:36:52 +02:00
|
|
|
|
2020-12-16 11:23:59 +01:00
|
|
|
#define MEMSIZE 1024 * 250
|
2017-10-05 23:38:09 +02:00
|
|
|
#include "../lib/clipboard.h"
|
|
|
|
#include "../lib/strings.h"
|
|
|
|
#include "../lib/mem.h"
|
2018-04-03 15:57:56 +02:00
|
|
|
#include "../lib/fs.h"
|
2017-10-05 23:38:09 +02:00
|
|
|
#include "../lib/gui.h"
|
|
|
|
#include "../lib/list_box.h"
|
|
|
|
#include "../lib/random.h"
|
|
|
|
#include "../lib/kfont.h"
|
|
|
|
#include "../lib/collection.h"
|
|
|
|
#include "../lib/copyf.h"
|
|
|
|
|
|
|
|
#include "../lib/obj/libini.h"
|
|
|
|
#include "../lib/obj/box_lib.h"
|
2018-04-16 11:33:37 +02:00
|
|
|
#include "../lib/obj/libimg.h"
|
2017-10-05 23:38:09 +02:00
|
|
|
|
|
|
|
#include "../lib/patterns/history.h"
|
2015-10-07 23:09:49 +02:00
|
|
|
|
2018-10-14 12:47:23 +02:00
|
|
|
#include "imgs/images.h"
|
2021-06-26 19:36:34 +02:00
|
|
|
#include "include/const.h"
|
2013-04-04 19:07:38 +02:00
|
|
|
|
2019-04-17 14:11:31 +02:00
|
|
|
struct Eolite_colors
|
|
|
|
{
|
2021-06-28 12:55:08 +02:00
|
|
|
bool skin_is_dark;
|
2019-04-17 14:11:31 +02:00
|
|
|
dword lpanel;
|
|
|
|
dword list_vert_line; //vertical line between columns in list
|
|
|
|
dword selec;
|
|
|
|
dword selec_active;
|
|
|
|
dword selec_inactive;
|
|
|
|
dword selec_text;
|
|
|
|
dword list_bg;
|
|
|
|
dword list_gb_text;
|
|
|
|
dword list_text_hidden;
|
|
|
|
dword work_gradient[24];
|
|
|
|
dword slider_bg_big;
|
|
|
|
dword slider_bg_left;
|
|
|
|
dword odd_line;
|
|
|
|
} col;
|
2020-11-23 14:31:55 +01:00
|
|
|
dword waves_pal[256];
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2021-06-28 12:55:08 +02:00
|
|
|
//Global data
|
|
|
|
bool efm = false;
|
|
|
|
_history history;
|
2021-06-26 19:36:34 +02:00
|
|
|
|
|
|
|
//Folder data
|
2021-06-28 19:00:57 +02:00
|
|
|
dword buf, buf_inactive;
|
2021-06-26 19:36:34 +02:00
|
|
|
collection_int items=0;
|
|
|
|
int folder_count;
|
2021-06-27 11:28:59 +02:00
|
|
|
dword path;
|
2021-06-28 00:16:37 +02:00
|
|
|
bool dir_at_fat16 = NULL;
|
2021-06-26 19:36:34 +02:00
|
|
|
|
2021-06-28 12:55:08 +02:00
|
|
|
//Selected element data
|
2021-06-26 19:36:34 +02:00
|
|
|
byte file_path[4096];
|
|
|
|
byte file_name[256];
|
|
|
|
byte temp[4096];
|
|
|
|
bool itdir;
|
|
|
|
|
|
|
|
//Window data
|
|
|
|
proc_info Form;
|
|
|
|
int sc_slider_h;
|
|
|
|
bool scroll_used=false;
|
|
|
|
char sort_type=2;
|
|
|
|
bool sort_desc=false;
|
|
|
|
int status_bar_h;
|
|
|
|
int icon_size = 18;
|
2021-06-28 12:55:08 +02:00
|
|
|
char active_popin = NULL;
|
|
|
|
bool list_full_redraw;
|
2015-08-07 16:55:16 +02:00
|
|
|
|
2021-06-28 00:16:37 +02:00
|
|
|
//Threads data
|
|
|
|
dword about_thread_id;
|
|
|
|
dword settings_window;
|
|
|
|
bool active_about = false;
|
|
|
|
bool active_settings = false;
|
|
|
|
dword about_stak=0,properties_stak=0,settings_stak=0;
|
|
|
|
byte cmd_free=0;
|
2015-08-13 17:28:53 +02:00
|
|
|
|
2021-06-28 00:16:37 +02:00
|
|
|
//Multipanes
|
|
|
|
int active_panel=0;
|
|
|
|
#define PANES_COUNT 2
|
|
|
|
dword location[PANES_COUNT];
|
2021-06-28 12:55:08 +02:00
|
|
|
llist files, files_active, files_inactive;
|
2021-06-30 13:38:29 +02:00
|
|
|
collection_int selected0, selected1;
|
|
|
|
dword selected_count[PANES_COUNT]=0;
|
2015-04-02 23:27:51 +02:00
|
|
|
|
2017-10-05 23:38:09 +02:00
|
|
|
libimg_image icons16_default;
|
|
|
|
libimg_image icons16_selected;
|
2018-04-18 16:07:12 +02:00
|
|
|
libimg_image icons32_default;
|
|
|
|
libimg_image icons32_selected;
|
2018-03-20 18:03:14 +01:00
|
|
|
|
2021-06-28 12:55:08 +02:00
|
|
|
byte popin_string[4096];
|
|
|
|
edit_box popin_text = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000,
|
|
|
|
248,#popin_string,0,ed_focus+ed_always_focus,6,0};
|
|
|
|
|
2017-09-23 13:02:57 +02:00
|
|
|
PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
|
2021-06-26 19:36:34 +02:00
|
|
|
|
2015-08-19 15:17:24 +02:00
|
|
|
#include "include\settings.h"
|
2021-06-27 14:32:00 +02:00
|
|
|
#include "include\gui.h"
|
2015-09-05 19:50:37 +02:00
|
|
|
#include "include\progress_dialog.h"
|
2020-05-06 17:53:34 +02:00
|
|
|
#include "include\copy_and_delete.h"
|
2013-03-11 19:16:24 +01:00
|
|
|
#include "include\sorting.h"
|
2013-10-17 01:48:20 +02:00
|
|
|
#include "include\icons.h"
|
2013-03-11 19:16:24 +01:00
|
|
|
#include "include\left_panel.h"
|
2013-10-17 01:48:20 +02:00
|
|
|
#include "include\menu.h"
|
|
|
|
#include "include\about.h"
|
2015-02-22 19:42:51 +01:00
|
|
|
#include "include\properties.h"
|
2013-10-23 19:55:07 +02:00
|
|
|
|
2020-05-06 17:53:34 +02:00
|
|
|
void handle_param()
|
|
|
|
{
|
2020-05-06 19:54:44 +02:00
|
|
|
//-p <path> : just show file/folder properties dialog
|
|
|
|
//-d <path> : delete file/folder
|
|
|
|
//-v : paste files/folder from clipboard
|
2021-06-26 19:36:34 +02:00
|
|
|
int i;
|
2021-06-05 21:30:53 +02:00
|
|
|
dword p = #param;
|
2021-06-30 13:38:29 +02:00
|
|
|
if (streq(#program_path+strrchr(#program_path,'/'), "KFM")) {
|
|
|
|
efm = true;
|
|
|
|
//now we need to restore the original app name
|
|
|
|
//without this external operations down won't work
|
|
|
|
strcpy(#program_path+strrchr(#program_path,'/'), "EOLITE");
|
|
|
|
}
|
2021-06-05 21:30:53 +02:00
|
|
|
|
2022-01-06 00:18:43 +01:00
|
|
|
SetAppColors();
|
2021-06-07 22:03:19 +02:00
|
|
|
LoadIniSettings();
|
|
|
|
|
2021-06-26 19:36:34 +02:00
|
|
|
for (i=0; i<PANES_COUNT; i++) {
|
|
|
|
location[i] = malloc(4096);
|
|
|
|
strcpy(location[i], #path_start);
|
|
|
|
}
|
2021-06-27 11:28:59 +02:00
|
|
|
path = location[0];
|
2021-06-26 19:36:34 +02:00
|
|
|
|
2021-06-05 21:30:53 +02:00
|
|
|
if (ESBYTE[p]=='\0') return;
|
|
|
|
|
2021-11-15 00:16:56 +01:00
|
|
|
if (ESBYTE[p]=='-') switch (ESBYTE[p+1])
|
2020-05-06 17:53:34 +02:00
|
|
|
{
|
|
|
|
case 'p':
|
2021-06-05 21:30:53 +02:00
|
|
|
strcpy(#file_path, p + 3);
|
2020-05-06 17:53:34 +02:00
|
|
|
itdir = dir_exists(#file_path);
|
2021-06-05 21:30:53 +02:00
|
|
|
strcpy(#file_name, p + strrchr(p, '/'));
|
|
|
|
ESBYTE[strrchr(p, '/')+p-1] = '\0';
|
2021-06-27 11:28:59 +02:00
|
|
|
strcpy(path, p + 3);
|
2020-05-06 17:53:34 +02:00
|
|
|
properties_dialog();
|
2020-06-04 00:21:39 +02:00
|
|
|
ExitProcess();
|
2020-05-06 17:53:34 +02:00
|
|
|
case 'd':
|
2021-06-27 11:28:59 +02:00
|
|
|
strcpy(path, p + 3);
|
2021-06-15 20:22:58 +02:00
|
|
|
DeleteThread();
|
2020-06-04 00:21:39 +02:00
|
|
|
ExitProcess();
|
2020-05-06 19:54:44 +02:00
|
|
|
case 'v':
|
2021-06-05 21:30:53 +02:00
|
|
|
cut_active = ESBYTE[p+2] - '0';
|
2021-06-27 11:28:59 +02:00
|
|
|
strcpy(path, p + 4);
|
2020-05-06 19:54:44 +02:00
|
|
|
PasteThread();
|
2020-06-04 00:21:39 +02:00
|
|
|
ExitProcess();
|
2020-05-06 17:53:34 +02:00
|
|
|
}
|
2021-06-05 21:30:53 +02:00
|
|
|
|
2021-11-16 01:35:51 +01:00
|
|
|
if (param[strlen(#param)-1]=='/') param[strlen(#param)-1]='\0'; //no "/" at the end
|
2021-06-05 21:30:53 +02:00
|
|
|
|
|
|
|
if (dir_exists(p)) {
|
2021-06-27 11:28:59 +02:00
|
|
|
strcpy(path, p);
|
2021-06-05 21:30:53 +02:00
|
|
|
} else {
|
|
|
|
if (file_exists(p)) {
|
|
|
|
ESBYTE[strrchr(p, '/')+p-1] = '\0';
|
2021-06-27 11:28:59 +02:00
|
|
|
strcpy(path, p);
|
|
|
|
SelectFileByName(p+strlen(path)+1);
|
2021-06-05 21:30:53 +02:00
|
|
|
} else {
|
|
|
|
notify(T_NOTIFY_APP_PARAM_WRONG);
|
|
|
|
}
|
2021-11-15 00:16:56 +01:00
|
|
|
}
|
2020-05-06 17:53:34 +02:00
|
|
|
}
|
|
|
|
|
2021-11-15 00:16:56 +01:00
|
|
|
void main()
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2016-02-24 17:49:57 +01:00
|
|
|
dword id;
|
2020-05-27 22:38:18 +02:00
|
|
|
int old_cur_y;
|
2020-04-14 13:29:55 +02:00
|
|
|
|
2021-06-26 19:36:34 +02:00
|
|
|
load_dll(boxlib, #box_lib_init,0);
|
|
|
|
load_dll(libini, #lib_init,1);
|
|
|
|
load_dll(libimg, #libimg_init,1);
|
2021-06-07 23:45:46 +02:00
|
|
|
|
2021-06-05 21:30:53 +02:00
|
|
|
handle_param();
|
2015-08-02 17:15:15 +02:00
|
|
|
|
2016-01-06 21:50:19 +01:00
|
|
|
SystemDiscs.Get();
|
2021-06-28 19:00:57 +02:00
|
|
|
OpenDir(ONLY_OPEN);
|
2015-08-17 14:45:56 +02:00
|
|
|
llist_copy(#files_inactive, #files);
|
2017-10-05 11:37:50 +02:00
|
|
|
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
|
2021-06-26 19:36:34 +02:00
|
|
|
loop() switch(@WaitEventTimeout(100))
|
2020-04-14 13:29:55 +02:00
|
|
|
{
|
|
|
|
case evMouse:
|
2021-06-28 12:55:08 +02:00
|
|
|
if (Form.status_window&ROLLED_UP) break;
|
|
|
|
|
|
|
|
if (active_popin) {
|
|
|
|
if (popin_string[0]!=-1) edit_box_mouse stdcall(#popin_text);
|
2020-04-14 13:29:55 +02:00
|
|
|
break;
|
2021-06-28 12:55:08 +02:00
|
|
|
}
|
2021-11-15 00:16:56 +01:00
|
|
|
|
2020-04-14 13:29:55 +02:00
|
|
|
mouse.get();
|
2018-10-01 18:41:14 +02:00
|
|
|
|
2020-04-14 13:29:55 +02:00
|
|
|
ProceedMouseGestures();
|
2020-05-26 17:07:13 +02:00
|
|
|
|
2020-05-27 22:38:18 +02:00
|
|
|
if (mouse.vert)
|
|
|
|
{
|
|
|
|
if (files.MouseScroll(mouse.vert)) List_ReDraw();
|
2020-05-26 17:07:13 +02:00
|
|
|
break;
|
|
|
|
}
|
2020-05-27 22:38:18 +02:00
|
|
|
|
2020-04-14 13:29:55 +02:00
|
|
|
if (files.MouseOver(mouse.x, mouse.y))
|
|
|
|
{
|
|
|
|
//select file
|
|
|
|
if (mouse.key&MOUSE_LEFT) && (mouse.up)
|
2015-04-02 23:27:51 +02:00
|
|
|
{
|
2021-11-16 02:00:59 +01:00
|
|
|
GetKeyModifier();
|
2020-05-27 22:38:18 +02:00
|
|
|
old_cur_y = files.cur_y;
|
2021-11-16 02:00:59 +01:00
|
|
|
if (files.ProcessMouse(mouse.x, mouse.y)) && (!key_modifier) {
|
2020-05-30 13:36:52 +02:00
|
|
|
List_ReDraw();
|
2021-11-16 02:00:59 +01:00
|
|
|
break;
|
2020-05-30 13:36:52 +02:00
|
|
|
}
|
2021-11-16 02:00:59 +01:00
|
|
|
if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) {
|
|
|
|
EventChooseFilesRange(old_cur_y, files.cur_y);
|
2020-05-27 22:38:18 +02:00
|
|
|
} else if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) {
|
|
|
|
EventChooseFile(files.cur_y);
|
|
|
|
DrawStatusBar();
|
2020-05-26 17:07:13 +02:00
|
|
|
List_ReDraw();
|
2021-11-16 02:00:59 +01:00
|
|
|
} else {
|
|
|
|
if (mouse.y - files.y / files.item_h + files.first == files.cur_y) EventOpen(0);
|
2020-04-14 13:29:55 +02:00
|
|
|
}
|
2015-07-21 03:10:37 +02:00
|
|
|
}
|
2020-04-14 13:29:55 +02:00
|
|
|
//file menu
|
|
|
|
if (mouse.key&MOUSE_RIGHT) && (mouse.up)
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
2020-04-14 13:29:55 +02:00
|
|
|
if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw();
|
2021-11-15 00:16:56 +01:00
|
|
|
if (getElementSelectedFlag(files.cur_y) == false) unselectAll(); //on redraw selection would be flashed, see [L001]
|
2020-04-14 13:29:55 +02:00
|
|
|
EventShowListMenu();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y<files.y)
|
|
|
|
{
|
2020-04-18 01:52:24 +02:00
|
|
|
if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_dark,sc.work_light);
|
2020-04-14 13:29:55 +02:00
|
|
|
WHILE (mouse.lkm) && (files.first>0)
|
2015-04-02 23:27:51 +02:00
|
|
|
{
|
2020-04-14 13:29:55 +02:00
|
|
|
pause(8);
|
|
|
|
files.first--;
|
|
|
|
List_ReDraw();
|
|
|
|
mouse.get();
|
2015-07-12 01:45:19 +02:00
|
|
|
}
|
2020-04-18 01:52:24 +02:00
|
|
|
DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_light,sc.work_dark);
|
2020-04-14 13:29:55 +02:00
|
|
|
}
|
2015-07-21 03:10:37 +02:00
|
|
|
|
2020-04-14 13:29:55 +02:00
|
|
|
if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y+files.h-16) && (mouse.y<files.y+files.h)
|
|
|
|
{
|
2020-04-18 01:52:24 +02:00
|
|
|
if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_dark,sc.work_light);
|
2020-04-14 13:29:55 +02:00
|
|
|
while (mouse.lkm) && (files.first<files.count-files.visible)
|
2015-07-12 01:45:19 +02:00
|
|
|
{
|
2020-04-14 13:29:55 +02:00
|
|
|
pause(8);
|
|
|
|
files.first++;
|
|
|
|
List_ReDraw();
|
|
|
|
mouse.get();
|
2015-07-12 01:45:19 +02:00
|
|
|
}
|
2020-04-18 01:52:24 +02:00
|
|
|
DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_light,sc.work_dark);
|
2020-04-14 13:29:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//Scrooll
|
2021-11-15 00:16:56 +01:00
|
|
|
if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y)
|
2021-06-26 19:36:34 +02:00
|
|
|
&& (mouse.y<files.y+files.h-18) && (mouse.lkm) && (!scroll_used) {scroll_used=true; DrawScroll(scroll_used);}
|
|
|
|
if (scroll_used) && (!mouse.key&MOUSE_LEFT) { scroll_used=false; DrawScroll(scroll_used); }
|
2021-11-15 00:16:56 +01:00
|
|
|
|
2020-04-14 13:29:55 +02:00
|
|
|
if (scroll_used)
|
|
|
|
{
|
|
|
|
if (sc_slider_h/2+files.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii
|
|
|
|
id = files.first;
|
|
|
|
files.first = -sc_slider_h / 2 + mouse.y -files.y * files.count;
|
|
|
|
files.first /= files.h - 18;
|
|
|
|
if (files.visible+files.first>files.count) files.first=files.count-files.visible;
|
|
|
|
if (files.first<0) files.first=0;
|
|
|
|
if (id!=files.first) List_ReDraw();
|
|
|
|
break;
|
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
|
2021-06-21 12:17:09 +02:00
|
|
|
if (efm) && (mouse.y < files.y + files.h) && (mouse.down) {
|
2021-06-17 23:29:58 +02:00
|
|
|
if (mouse.x<Form.cwidth/2) {
|
2021-06-26 09:59:13 +02:00
|
|
|
SetActivePanel(0);
|
2021-06-15 20:22:58 +02:00
|
|
|
} else {
|
2021-06-26 09:59:13 +02:00
|
|
|
SetActivePanel(1);
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
2020-04-14 13:29:55 +02:00
|
|
|
}
|
2021-11-15 00:16:56 +01:00
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
//Button pressed-----------------------------------------------------------------------------
|
|
|
|
case evButton:
|
2020-12-16 11:23:59 +01:00
|
|
|
id = GetButtonID();
|
2020-04-14 13:29:55 +02:00
|
|
|
|
2021-06-28 12:55:08 +02:00
|
|
|
if (CLOSE_BTN == id) {
|
2021-06-17 23:29:58 +02:00
|
|
|
KillProcess(about_thread_id);
|
|
|
|
SaveIniSettings();
|
|
|
|
ExitProcess();
|
|
|
|
}
|
|
|
|
|
2021-06-28 12:55:08 +02:00
|
|
|
if (active_popin) {
|
2021-06-28 19:00:57 +02:00
|
|
|
if (POPUP_BTN2==id) { EventClosePopinForm(); break; }
|
|
|
|
if (POPUP_BTN1==id) { EventPopinClickOkay(); break; }
|
|
|
|
|
2021-06-28 12:55:08 +02:00
|
|
|
if (POPIN_DISK==active_popin) {
|
2021-06-28 19:00:57 +02:00
|
|
|
active_popin = NULL;
|
|
|
|
EventDriveClick(id-100);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (POPIN_BREADCR==active_popin) {
|
|
|
|
EventClosePopinForm();
|
|
|
|
ClickOnBreadCrumb(id-BREADCRUMB_ID);
|
|
|
|
}
|
|
|
|
|
2021-11-15 00:16:56 +01:00
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
}
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2021-11-15 00:16:56 +01:00
|
|
|
switch(id)
|
2020-04-14 13:29:55 +02:00
|
|
|
{
|
2021-06-15 01:33:54 +02:00
|
|
|
case KFM_DEV_DROPDOWN_1:
|
|
|
|
case KFM_DEV_DROPDOWN_2:
|
2021-06-28 12:55:08 +02:00
|
|
|
ShowPopinForm(POPIN_DISK);
|
2020-04-14 13:29:55 +02:00
|
|
|
break;
|
2021-06-15 01:33:54 +02:00
|
|
|
case BACK_BTN...PASTE_BTN:
|
|
|
|
EventToolbarButtonClick(id);
|
2020-04-14 13:29:55 +02:00
|
|
|
break;
|
2021-06-28 12:55:08 +02:00
|
|
|
case BTN_PATH:
|
|
|
|
case BTN_PATH+1:
|
|
|
|
ShowPopinForm(POPIN_PATH);
|
|
|
|
break;
|
|
|
|
case BTN_BREADCRUMB:
|
|
|
|
case BTN_BREADCRUMB+1:
|
|
|
|
ShowPopinForm(POPIN_BREADCR);
|
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
case 31...33:
|
|
|
|
EventSort(id-30);
|
|
|
|
break;
|
2020-04-20 11:37:37 +02:00
|
|
|
case 51:
|
|
|
|
EventShowBurgerMenu();
|
|
|
|
break;
|
|
|
|
case 52...60: //Actions
|
2020-04-14 13:29:55 +02:00
|
|
|
FnProcess(id-50);
|
|
|
|
break;
|
|
|
|
case 100...120:
|
2021-06-28 19:00:57 +02:00
|
|
|
EventDriveClick(id-100);
|
2021-06-28 12:55:08 +02:00
|
|
|
break;
|
2021-06-19 22:42:09 +02:00
|
|
|
case KFM_FUNC_ID...KFM_FUNC_ID+10:
|
2021-06-28 12:55:08 +02:00
|
|
|
FnProcess(id-KFM_FUNC_ID);
|
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
}
|
|
|
|
break;
|
2021-11-15 00:16:56 +01:00
|
|
|
|
2020-04-14 13:29:55 +02:00
|
|
|
//Key pressed-----------------------------------------------------------------------------
|
|
|
|
case evKey:
|
|
|
|
GetKeys();
|
2015-08-13 17:28:53 +02:00
|
|
|
|
2021-06-26 09:59:13 +02:00
|
|
|
if (Form.status_window&ROLLED_UP) break;
|
2020-04-14 13:29:55 +02:00
|
|
|
|
2021-06-28 12:55:08 +02:00
|
|
|
if (active_popin)
|
2020-04-14 13:29:55 +02:00
|
|
|
{
|
2021-06-15 20:22:58 +02:00
|
|
|
if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm();
|
|
|
|
|
2021-06-28 12:55:08 +02:00
|
|
|
if (POPIN_DISK == active_popin) {
|
2021-11-15 00:16:56 +01:00
|
|
|
if (key_scancode >= SCAN_CODE_1)
|
2021-06-28 19:00:57 +02:00
|
|
|
&& (key_scancode <= SCAN_CODE_10) {
|
|
|
|
EventDriveClick(key_scancode-2);
|
2021-06-28 12:55:08 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (key_scancode == SCAN_CODE_ENTER) EventPopinClickOkay();
|
|
|
|
if (popin_string[0] != -1) {
|
|
|
|
EAX = key_editbox;
|
|
|
|
edit_box_key stdcall (#popin_text);
|
2021-11-15 00:16:56 +01:00
|
|
|
}
|
2018-09-19 10:57:00 +02:00
|
|
|
}
|
2020-04-14 13:29:55 +02:00
|
|
|
break;
|
|
|
|
}
|
2018-09-19 10:57:00 +02:00
|
|
|
|
2021-11-28 00:03:47 +01:00
|
|
|
if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT)
|
|
|
|
{
|
2020-12-16 11:23:59 +01:00
|
|
|
if (key_scancode == SCAN_CODE_ENTER) {
|
2021-11-15 00:16:56 +01:00
|
|
|
EventOpenSelected();
|
2020-12-16 11:23:59 +01:00
|
|
|
break;
|
|
|
|
}
|
2020-05-27 22:38:18 +02:00
|
|
|
old_cur_y = files.cur_y;
|
|
|
|
files.ProcessKey(key_scancode);
|
|
|
|
EventChooseFilesRange(old_cur_y, files.cur_y);
|
2020-05-26 17:07:13 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-04-14 13:29:55 +02:00
|
|
|
if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL)
|
|
|
|
{
|
|
|
|
switch(key_scancode)
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
2020-04-14 13:29:55 +02:00
|
|
|
case SCAN_CODE_F1...SCAN_CODE_F3:
|
|
|
|
EventSort(key_scancode - 58);
|
2015-07-21 03:10:37 +02:00
|
|
|
break;
|
2021-06-28 12:55:08 +02:00
|
|
|
case SCAN_CODE_1...SCAN_CODE_2:
|
|
|
|
if (efm) {
|
|
|
|
active_panel = key_scancode - SCAN_CODE_1;
|
|
|
|
ShowPopinForm(POPIN_DISK);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SCAN_CODE_3...SCAN_CODE_10:
|
2020-04-14 13:29:55 +02:00
|
|
|
key_scancode-=2;
|
|
|
|
if (key_scancode >= SystemDiscs.list.count) break;
|
2021-06-15 20:22:58 +02:00
|
|
|
if (!efm) {
|
2021-06-28 19:00:57 +02:00
|
|
|
DrawRectangle(17,key_scancode*17+74,159,17, 0); //display click
|
2021-11-15 00:16:56 +01:00
|
|
|
pause(7);
|
2015-07-21 03:10:37 +02:00
|
|
|
}
|
2021-06-28 19:00:57 +02:00
|
|
|
EventDriveClick(key_scancode);
|
2015-07-21 03:10:37 +02:00
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
case SCAN_CODE_KEY_X:
|
2021-06-15 20:22:58 +02:00
|
|
|
CopyFilesListToClipboard(CUT);
|
2021-11-15 00:16:56 +01:00
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
case SCAN_CODE_KEY_C:
|
2021-06-15 20:22:58 +02:00
|
|
|
CopyFilesListToClipboard(COPY);
|
2013-03-11 19:16:24 +01:00
|
|
|
break;
|
2020-04-20 11:37:37 +02:00
|
|
|
case SCAN_CODE_KEY_G:
|
|
|
|
EventOpenConsoleHere();
|
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
case SCAN_CODE_KEY_V:
|
2021-06-27 11:28:59 +02:00
|
|
|
EventPaste(path);
|
2013-03-11 19:16:24 +01:00
|
|
|
break;
|
2021-12-02 20:28:12 +01:00
|
|
|
case SCAN_CODE_KEY_S: //set image as bg tile
|
|
|
|
sprintf(#temp, "\\S__%s",#file_path);
|
|
|
|
RunProgram("/sys/media/kiv", #temp);
|
|
|
|
break;
|
|
|
|
case SCAN_CODE_KEY_T: //set image as bg stretch
|
|
|
|
sprintf(#temp, "\\T__%s",#file_path);
|
2020-04-14 13:29:55 +02:00
|
|
|
RunProgram("/sys/media/kiv", #temp);
|
2013-03-11 19:16:24 +01:00
|
|
|
break;
|
2020-04-20 11:37:37 +02:00
|
|
|
case SCAN_CODE_KEY_N:
|
|
|
|
EventOpenNewEolite();
|
2021-11-15 00:16:56 +01:00
|
|
|
break;
|
2021-06-15 01:33:54 +02:00
|
|
|
case SCAN_CODE_KEY_R:
|
2021-06-26 19:36:34 +02:00
|
|
|
EventManualFolderRefresh();
|
2021-06-15 01:33:54 +02:00
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
case SCAN_CODE_ENTER:
|
|
|
|
if (!itdir) ShowOpenWithDialog();
|
2020-12-16 11:23:59 +01:00
|
|
|
else EventOpen(1);
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
case SCAN_CODE_KEY_A:
|
2020-05-27 22:38:18 +02:00
|
|
|
EventChooseAllFiles(true);
|
2020-04-14 13:29:55 +02:00
|
|
|
break;
|
|
|
|
case SCAN_CODE_KEY_U: //unselect all files
|
2020-05-27 22:38:18 +02:00
|
|
|
EventChooseAllFiles(false);
|
2018-09-18 17:09:58 +02:00
|
|
|
break;
|
2015-07-21 03:10:37 +02:00
|
|
|
}
|
|
|
|
break;
|
2021-11-28 00:03:47 +01:00
|
|
|
}
|
2021-11-30 21:14:26 +01:00
|
|
|
|
|
|
|
switch (calc(key_scancode))
|
2020-04-14 13:29:55 +02:00
|
|
|
{
|
|
|
|
case SCAN_CODE_BS:
|
|
|
|
Dir_Up();
|
2021-11-15 00:16:56 +01:00
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
case SCAN_CODE_ENTER:
|
2020-12-16 11:23:59 +01:00
|
|
|
EventOpen(0);
|
2021-11-15 00:16:56 +01:00
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
case SCAN_CODE_TAB:
|
2021-06-15 01:33:54 +02:00
|
|
|
if (!efm) break;
|
2021-06-26 09:59:13 +02:00
|
|
|
SetActivePanel(active_panel^1);
|
2020-04-14 13:29:55 +02:00
|
|
|
break;
|
|
|
|
case SCAN_CODE_MENU:
|
|
|
|
mouse.x = files.x+15;
|
|
|
|
mouse.y = files.cur_y - files.first * files.item_h + files.y + 5;
|
|
|
|
EventShowListMenu();
|
|
|
|
break;
|
|
|
|
case SCAN_CODE_DEL:
|
2021-06-28 12:55:08 +02:00
|
|
|
ShowPopinForm(POPIN_DELETE);
|
2020-04-14 13:29:55 +02:00
|
|
|
break;
|
2021-06-17 23:29:58 +02:00
|
|
|
case SCAN_CODE_SPACE:
|
|
|
|
EventChooseFile(files.cur_y);
|
|
|
|
DrawStatusBar();
|
|
|
|
Line_ReDraw(col.selec, files.cur_y);
|
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
case SCAN_CODE_INS:
|
2020-05-26 17:07:13 +02:00
|
|
|
EventChooseFile(files.cur_y);
|
2020-04-14 13:29:55 +02:00
|
|
|
files.KeyDown();
|
2020-05-29 13:05:55 +02:00
|
|
|
DrawStatusBar();
|
2020-04-14 13:29:55 +02:00
|
|
|
List_ReDraw();
|
|
|
|
break;
|
2021-06-07 23:45:46 +02:00
|
|
|
case SCAN_CODE_F1...SCAN_CODE_F10:
|
2020-04-14 13:29:55 +02:00
|
|
|
FnProcess(key_scancode-58);
|
2021-11-15 00:16:56 +01:00
|
|
|
break;
|
2021-11-28 00:03:47 +01:00
|
|
|
case SCAN_CODE_DOWN:
|
|
|
|
case SCAN_CODE_UP:
|
|
|
|
case SCAN_CODE_HOME:
|
|
|
|
case SCAN_CODE_END:
|
|
|
|
case SCAN_CODE_PGUP:
|
|
|
|
case SCAN_CODE_PGDN:
|
|
|
|
if (files.ProcessKey(key_scancode)) List_ReDraw();
|
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
default:
|
|
|
|
EventSelectFileByKeyPress();
|
2021-11-15 00:16:56 +01:00
|
|
|
}
|
2021-06-15 20:22:58 +02:00
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
case evIPC:
|
|
|
|
case evReDraw:
|
|
|
|
draw_window();
|
|
|
|
if (CheckActiveProcess(Form.ID)) && (GetMenuClick()) break;
|
2021-06-15 20:22:58 +02:00
|
|
|
break;
|
2020-04-14 13:29:55 +02:00
|
|
|
default:
|
2021-06-26 19:36:34 +02:00
|
|
|
if (!Form.status_window&ROLLED_UP) EventRefreshDisksAndFolders();
|
2020-04-14 13:29:55 +02:00
|
|
|
}
|
2021-11-15 00:16:56 +01:00
|
|
|
|
2020-04-14 13:29:55 +02:00
|
|
|
if(cmd_free)
|
|
|
|
{
|
|
|
|
if(cmd_free==2) about_stak=free(about_stak);
|
|
|
|
else if(cmd_free==3) properties_stak=free(properties_stak);
|
|
|
|
else if(cmd_free==4) settings_stak=free(settings_stak);
|
|
|
|
cmd_free = false;
|
2015-07-16 03:44:30 +02:00
|
|
|
}
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
2013-04-04 19:07:38 +02:00
|
|
|
void draw_window()
|
|
|
|
{
|
2021-06-15 01:33:54 +02:00
|
|
|
dword i=0;
|
2021-06-05 21:30:53 +02:00
|
|
|
incn x;
|
2021-06-15 01:33:54 +02:00
|
|
|
dword title;
|
2021-06-26 19:36:34 +02:00
|
|
|
static int rand_n;
|
2021-11-15 00:16:56 +01:00
|
|
|
if (!rand_n) rand_n = random(80);
|
2021-06-26 19:36:34 +02:00
|
|
|
|
2021-06-17 23:29:58 +02:00
|
|
|
if (show_status_bar.checked) {
|
2021-06-28 00:16:37 +02:00
|
|
|
#define STBAR_EOLITE_H 16
|
|
|
|
#define STBAR_KFM_H 21
|
2021-06-19 22:42:09 +02:00
|
|
|
if (efm) status_bar_h = STBAR_KFM_H;
|
|
|
|
else status_bar_h = STBAR_EOLITE_H;
|
2021-06-17 23:29:58 +02:00
|
|
|
} else {
|
|
|
|
status_bar_h = 0;
|
|
|
|
}
|
2021-06-15 20:22:58 +02:00
|
|
|
if (efm) title = TITLE_KFM; else title = TITLE_EOLITE;
|
2021-06-15 01:33:54 +02:00
|
|
|
DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,title,0);
|
2013-04-04 19:07:38 +02:00
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
2021-06-26 09:59:13 +02:00
|
|
|
if (Form.status_window&ROLLED_UP) return;
|
2021-06-15 01:33:54 +02:00
|
|
|
if (Form.height < 356) { MoveSize(OLD,OLD,OLD,356); return; }
|
2018-10-19 23:13:36 +02:00
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
2019-04-18 11:38:01 +02:00
|
|
|
SetAppColors();
|
2021-06-15 01:33:54 +02:00
|
|
|
if (efm) {
|
2022-01-08 20:52:20 +01:00
|
|
|
if (screen.w > 693) && (Form.width < 693) { MoveSize(OLD,OLD,693,OLD); return; }
|
2021-06-28 00:16:37 +02:00
|
|
|
DrawBar(0, 4, Form.cwidth, SELECTY-5, sc.work);
|
|
|
|
DrawBar(0, SELECTY+KFM2_DEVH+1, Form.cwidth, 3, sc.work);
|
|
|
|
DrawBar(0, SELECTY-1, 1, KFM2_DEVH+2, sc.work);
|
|
|
|
DrawBar(Form.cwidth-1, SELECTY-1, 1, KFM2_DEVH+2, sc.work);
|
2021-06-28 12:55:08 +02:00
|
|
|
DrawBar(Form.cwidth/2-16, SELECTY-1, 15, KFM2_DEVH+2, sc.work);
|
2021-06-28 00:16:37 +02:00
|
|
|
/*
|
2021-06-05 21:30:53 +02:00
|
|
|
#define PAD 7
|
|
|
|
#define GAP_S 26+5
|
|
|
|
#define GAP_B 26+14
|
2021-06-15 01:33:54 +02:00
|
|
|
x.set(Form.cwidth/2-DDW-203/2-GAP_S);
|
|
|
|
while (i<200) {
|
|
|
|
DrawTopPanelButton(i+BACK_BTN, x.inc(GAP_S), PAD, 30, false);
|
|
|
|
DrawTopPanelButton(i+FWRD_BTN, x.inc(GAP_S), PAD, 31, false);
|
|
|
|
DrawTopPanelButton(i+GOUP_BTN, x.inc(GAP_B), PAD, 01, false);
|
|
|
|
DrawTopPanelButton(i+COPY_BTN, x.inc(GAP_B), PAD, 55, false);
|
|
|
|
DrawTopPanelButton(i+CUT_BTN, x.inc(GAP_S), PAD, 20, false);
|
|
|
|
DrawTopPanelButton(i+PASTE_BTN,x.inc(GAP_S), PAD, 56, false);
|
|
|
|
x.set(Form.cwidth/2-DDW-203/2-GAP_S+calc(Form.cwidth/2));
|
|
|
|
i+=100;
|
|
|
|
}
|
|
|
|
//DrawTopPanelButton(51, Form.cwidth-GAP_S-PAD, PAD, -1, false); //burger menu
|
2021-06-28 00:16:37 +02:00
|
|
|
*/
|
2021-06-05 21:30:53 +02:00
|
|
|
} else {
|
|
|
|
if (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; }
|
|
|
|
ESDWORD[#toolbar_pal] = sc.work;
|
|
|
|
ESDWORD[#toolbar_pal+4] = MixColors(0, sc.work, 35);
|
2021-11-15 00:16:56 +01:00
|
|
|
PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal);
|
2021-06-15 20:22:58 +02:00
|
|
|
for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,BACK_BTN+i);
|
|
|
|
for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i], 5,31, 29, BACK_BTN+i);
|
2021-06-05 21:30:53 +02:00
|
|
|
DrawBar(127, 8, 1, 25, sc.work_graph);
|
|
|
|
DrawBar(246,0, Form.cwidth - 246, 34, sc.work);
|
|
|
|
DrawDot(Form.cwidth-17,12);
|
|
|
|
DrawDot(Form.cwidth-17,12+6);
|
|
|
|
DrawDot(Form.cwidth-17,12+12);
|
|
|
|
DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots
|
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
//main rectangles
|
2020-04-18 01:52:24 +02:00
|
|
|
DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,sc.work_graph);
|
2021-12-28 19:24:06 +01:00
|
|
|
DrawBar(0,39,1,-show_status_bar.checked*status_bar_h + Form.cheight - 40, sc.work);
|
|
|
|
EBX = Form.cwidth-1 * 65536 + 1;
|
|
|
|
$int 64
|
2020-04-18 01:52:24 +02:00
|
|
|
for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10));
|
2020-04-22 22:42:35 +02:00
|
|
|
for (i=0; i<6; i++) DrawBar(0, 5-i, Form.cwidth, 1, MixColors(sc.work_light, sc.work, i*10));
|
2015-08-17 14:45:56 +02:00
|
|
|
llist_copy(#files_active, #files);
|
2016-10-05 01:11:59 +02:00
|
|
|
DrawStatusBar();
|
2021-06-30 13:38:29 +02:00
|
|
|
if (!getSelectedCount()) {
|
2021-11-15 00:16:56 +01:00
|
|
|
OpenDir(ONLY_OPEN); //if there are no selected files -> refresh folder [L001]
|
2021-06-28 00:16:37 +02:00
|
|
|
}
|
2016-04-21 23:50:46 +02:00
|
|
|
DrawFilePanels();
|
2021-06-28 19:00:57 +02:00
|
|
|
|
|
|
|
if (files.x!=files_inactive.x) {
|
|
|
|
if (active_popin) ShowPopinForm(active_popin);
|
|
|
|
}
|
2015-08-14 16:47:36 +02:00
|
|
|
}
|
|
|
|
|
2021-11-15 00:16:56 +01:00
|
|
|
void DrawButtonsAroundList()
|
2015-08-14 16:47:36 +02:00
|
|
|
{
|
2015-08-17 14:45:56 +02:00
|
|
|
word sorting_arrow_x;
|
2018-10-19 23:13:36 +02:00
|
|
|
dword sorting_arrow_t = "\x19";
|
|
|
|
if (sort_desc) sorting_arrow_t = "\x18";
|
2021-06-05 21:30:53 +02:00
|
|
|
DrawFlatButtonSmall(files.x - efm, files.y-17,files.w-141+efm,16,31,T_FILE);
|
2016-11-05 11:13:29 +01:00
|
|
|
DrawFlatButtonSmall(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE);
|
|
|
|
DrawFlatButtonSmall(files.x + files.w - 68, files.y-17,68,16,33,T_SIZE);
|
|
|
|
DrawFlatButtonSmall(files.x + files.w, files.y-17,16,16, 0,"\x18");
|
|
|
|
DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19");
|
2018-10-19 23:13:36 +02:00
|
|
|
if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;
|
|
|
|
if (sort_type==2) sorting_arrow_x = files.x + files.w - 90;
|
|
|
|
if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
|
2020-04-18 01:52:24 +02:00
|
|
|
WriteText(sorting_arrow_x,files.y-12,0x80, sc.work_text, sorting_arrow_t);
|
|
|
|
DrawBar(files.x+files.w,files.y,1,files.h,sc.work_graph);
|
2021-06-27 11:28:59 +02:00
|
|
|
if (efm) && (files.x<5) {
|
|
|
|
DrawBar(files.x+files.w+16,files.y,1,files.h,EDX); //line between panel
|
|
|
|
}
|
2015-08-14 16:47:36 +02:00
|
|
|
}
|
|
|
|
|
2021-06-19 22:42:09 +02:00
|
|
|
void DrawFuncButtonsInKfm()
|
|
|
|
{
|
|
|
|
int i, x=0, len, min_w=0, padding;
|
2021-06-22 22:16:57 +02:00
|
|
|
for (i=0; i<10; i++) min_w += strlen(kfm_func[i])+2*6 + 2;
|
2021-06-19 22:42:09 +02:00
|
|
|
padding = Form.cwidth - min_w + 4 / 10;
|
|
|
|
for (i=0; i<10; i++) {
|
2021-06-22 22:16:57 +02:00
|
|
|
len = strlen(kfm_func[i])+2*6 + padding;
|
2021-06-19 22:42:09 +02:00
|
|
|
if (i==9) len = Form.cwidth - x - 3;
|
2021-06-27 11:28:59 +02:00
|
|
|
DrawBar(x, Form.cheight - 19, 1, 17, sc.work);
|
2021-06-22 22:16:57 +02:00
|
|
|
DrawFuncButton(x+1, Form.cheight - 19, len, i+KFM_FUNC_ID+1, i+1, kfm_func[i]);
|
2021-06-19 22:42:09 +02:00
|
|
|
x += len + 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-20 02:11:28 +02:00
|
|
|
void DrawStatusBar()
|
|
|
|
{
|
2016-10-07 10:44:03 +02:00
|
|
|
char status_bar_str[80];
|
2016-10-05 21:33:49 +02:00
|
|
|
int go_up_folder_exists=0;
|
2021-12-28 19:24:06 +01:00
|
|
|
dword topcolor;
|
|
|
|
|
|
|
|
if (show_status_bar.checked) topcolor=sc.work_light; else topcolor=sc.work;
|
|
|
|
DrawBar(0, Form.cheight - status_bar_h-1, Form.cwidth, 1, topcolor);
|
2021-06-15 01:33:54 +02:00
|
|
|
|
2021-11-15 00:16:56 +01:00
|
|
|
if (efm) {
|
2021-06-28 00:16:37 +02:00
|
|
|
DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, 2, sc.work);
|
2021-12-28 19:24:06 +01:00
|
|
|
DrawBar(0, Form.cheight - 2, Form.cwidth, 2, EDX);
|
|
|
|
DrawBar(Form.cwidth-1, Form.cheight - 19, 1, 17, EDX);
|
2021-06-19 22:42:09 +02:00
|
|
|
DrawFuncButtonsInKfm();
|
2021-12-28 19:24:06 +01:00
|
|
|
} else if (show_status_bar.checked) {
|
2021-06-28 00:16:37 +02:00
|
|
|
if (files.count>0) && (streq(items.get(0)*304+buf+72,"..")) go_up_folder_exists=1;
|
|
|
|
DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work);
|
|
|
|
sprintf(#status_bar_str, T_STATUS_EVEMENTS, folder_count-go_up_folder_exists, files.count-folder_count);
|
|
|
|
WriteText(6,Form.cheight - 13,0x80,sc.work_text,#status_bar_str);
|
2021-06-30 13:38:29 +02:00
|
|
|
if (getSelectedCount()) {
|
|
|
|
sprintf(#status_bar_str, T_STATUS_SELECTED, getSelectedCount());
|
2021-06-28 00:16:37 +02:00
|
|
|
WriteText(Form.cwidth - calc(strlen(#status_bar_str)*6)-6,Form.cheight - 13,
|
|
|
|
0x80,sc.work_text,#status_bar_str);
|
|
|
|
}
|
2020-04-17 19:04:54 +02:00
|
|
|
}
|
2016-04-20 02:11:28 +02:00
|
|
|
}
|
|
|
|
|
2015-08-14 16:47:36 +02:00
|
|
|
void DrawFilePanels()
|
|
|
|
{
|
2021-06-27 11:28:59 +02:00
|
|
|
int files_y = files.y;
|
2021-06-12 23:12:15 +02:00
|
|
|
int w2 = -Form.cwidth-1/2+Form.cwidth;
|
2021-06-27 11:28:59 +02:00
|
|
|
int h2 = Form.cheight-files_y-2 - status_bar_h;
|
2021-06-15 01:33:54 +02:00
|
|
|
if (!efm)
|
2015-08-09 21:08:57 +02:00
|
|
|
{
|
2021-06-27 14:32:00 +02:00
|
|
|
SystemDiscs.Draw();
|
2021-12-01 14:48:58 +01:00
|
|
|
files.SetSizes(SIDEBAR_W, 57, Form.cwidth - SIDEBAR_W-18, Form.cheight - 59 - status_bar_h, files.item_h);
|
2021-06-17 23:29:58 +02:00
|
|
|
DrawButtonsAroundList();
|
|
|
|
List_ReDraw();
|
2021-06-28 00:16:37 +02:00
|
|
|
DrawPathBar();
|
2015-08-09 21:08:57 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-06-28 00:16:37 +02:00
|
|
|
llist_copy(#files_active, #files);
|
|
|
|
llist_copy(#files, #files_inactive);
|
|
|
|
|
2021-06-27 14:32:00 +02:00
|
|
|
if (!active_panel) {
|
2021-06-12 23:12:15 +02:00
|
|
|
files.SetSizes(Form.cwidth/2, files_y, w2-17, h2, files.item_h);
|
2021-06-27 14:32:00 +02:00
|
|
|
} else {
|
2021-06-12 23:12:15 +02:00
|
|
|
files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h);
|
2015-08-13 17:28:53 +02:00
|
|
|
}
|
2021-06-27 14:32:00 +02:00
|
|
|
|
|
|
|
files_inactive.x = files.x;
|
|
|
|
DrawButtonsAroundList();
|
|
|
|
path = location[active_panel^1];
|
2021-06-30 13:38:29 +02:00
|
|
|
active_panel ^= 1;
|
|
|
|
OpenDir2(WITH_REDRAW);
|
|
|
|
active_panel ^= 1;
|
|
|
|
if (!getSelectedCount()) files_inactive.count = files.count;
|
2021-06-28 00:16:37 +02:00
|
|
|
llist_copy(#files, #files_active);
|
2021-06-27 14:32:00 +02:00
|
|
|
|
|
|
|
if (!active_panel) {
|
2021-06-12 23:12:15 +02:00
|
|
|
files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h);
|
2021-06-27 14:32:00 +02:00
|
|
|
} else {
|
2021-06-12 23:12:15 +02:00
|
|
|
files.SetSizes(Form.cwidth/2, files_y, w2 -17, h2, files.item_h);
|
2015-08-13 17:28:53 +02:00
|
|
|
}
|
2021-06-27 14:32:00 +02:00
|
|
|
|
|
|
|
DrawButtonsAroundList();
|
|
|
|
path = location[active_panel];
|
2021-06-30 13:38:29 +02:00
|
|
|
OpenDir2(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);
|
2021-11-15 00:16:56 +01:00
|
|
|
if (!strncmp(path, "/rd/1",5)) || (!strncmp(path, "/sys/",4))
|
|
|
|
dir_at_fat16 = true; else dir_at_fat16 = false;
|
2021-06-30 13:38:29 +02:00
|
|
|
Sorting();
|
|
|
|
SystemDiscs.Draw();
|
|
|
|
list_full_redraw = true;
|
|
|
|
List_ReDraw();
|
|
|
|
DrawPathBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OpenDir(char redraw){
|
|
|
|
int errornum;
|
|
|
|
unselectAll();
|
|
|
|
if (buf) free(buf);
|
|
|
|
if (errornum = GetDir(#buf, #files.count, path, DIRS_NOROOT)) {
|
|
|
|
history.add(path);
|
2021-11-15 00:16:56 +01:00
|
|
|
//EventHistoryGoBack();
|
|
|
|
Dir_Up();
|
2021-06-30 13:38:29 +02:00
|
|
|
Write_Error(errornum);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
|
|
|
|
history.add(path);
|
|
|
|
SystemDiscs.Draw();
|
|
|
|
files.visible = math.min(files.h / files.item_h, files.count);
|
2021-11-15 00:16:56 +01:00
|
|
|
if (!strncmp(path, "/rd/1",5)) || (!strncmp(path, "/sys/",4))
|
|
|
|
dir_at_fat16 = true; else dir_at_fat16 = false;
|
2021-06-30 13:38:29 +02:00
|
|
|
Sorting();
|
|
|
|
list_full_redraw = true;
|
|
|
|
SetCurDir(path);
|
|
|
|
if (redraw!=ONLY_OPEN) {
|
|
|
|
List_ReDraw();
|
|
|
|
DrawStatusBar();
|
|
|
|
DrawPathBar();
|
2015-08-09 21:08:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-30 13:38:29 +02:00
|
|
|
|
2015-08-07 16:55:16 +02:00
|
|
|
void List_ReDraw()
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2015-08-13 17:28:53 +02:00
|
|
|
int all_lines_h;
|
2018-10-01 18:41:14 +02:00
|
|
|
dword j;
|
2015-09-09 16:24:42 +02:00
|
|
|
static int old_cur_y, old_first;
|
2021-06-07 22:03:19 +02:00
|
|
|
dword separator_color;
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2015-08-07 16:55:16 +02:00
|
|
|
files.CheckDoesValuesOkey(); //prevent some shit
|
2021-06-17 23:29:58 +02:00
|
|
|
if (files.count < files.visible) files.visible = files.count;
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2015-08-07 16:55:16 +02:00
|
|
|
if (list_full_redraw) || (old_first != files.first)
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2015-09-09 16:24:42 +02:00
|
|
|
old_cur_y = files.cur_y;
|
2015-08-07 16:55:16 +02:00
|
|
|
old_first = files.first;
|
|
|
|
list_full_redraw = false;
|
|
|
|
goto _ALL_LIST_REDRAW;
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
2015-09-09 16:24:42 +02:00
|
|
|
if (old_cur_y != files.cur_y)
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2019-04-17 14:11:31 +02:00
|
|
|
if (old_cur_y-files.first<files.visible) Line_ReDraw(col.list_bg, old_cur_y-files.first);
|
|
|
|
Line_ReDraw(col.selec, files.cur_y-files.first);
|
2015-09-09 16:24:42 +02:00
|
|
|
old_cur_y = files.cur_y;
|
2015-08-07 16:55:16 +02:00
|
|
|
return;
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
2015-08-07 16:55:16 +02:00
|
|
|
_ALL_LIST_REDRAW:
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2019-04-17 14:11:31 +02:00
|
|
|
for (j=0; j<files.visible; j++) {
|
2021-11-15 00:16:56 +01:00
|
|
|
if (files.cur_y-files.first!=j) Line_ReDraw(col.list_bg, j);
|
|
|
|
else Line_ReDraw(col.selec, files.cur_y-files.first);
|
2019-04-17 14:11:31 +02:00
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
//in the bottom
|
2015-09-09 16:24:42 +02:00
|
|
|
all_lines_h = j * files.item_h;
|
2019-04-17 14:11:31 +02:00
|
|
|
DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h, col.list_bg);
|
2021-06-07 22:03:19 +02:00
|
|
|
if (colored_lines.checked) separator_color = col.list_bg; else separator_color = col.list_vert_line;
|
|
|
|
DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h, separator_color);
|
|
|
|
DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h, separator_color);
|
2021-06-26 19:36:34 +02:00
|
|
|
DrawScroll(scroll_used);
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
2021-12-30 17:35:47 +01:00
|
|
|
void Line_ReDraw(dword bgcol, signed filenum){
|
2019-04-17 14:11:31 +02:00
|
|
|
dword text_col=col.list_gb_text,
|
2015-12-20 22:56:53 +01:00
|
|
|
ext1, attr,
|
|
|
|
file_name_off,
|
2018-10-31 17:50:25 +01:00
|
|
|
file_size=0,
|
2016-02-24 23:30:04 +01:00
|
|
|
y=filenum*files.item_h+files.y,
|
2021-06-05 17:18:11 +02:00
|
|
|
icon_y = files.item_h-icon_size/2+y;
|
2015-12-20 22:56:53 +01:00
|
|
|
BDVK file;
|
2020-05-15 21:59:10 +02:00
|
|
|
char full_path[4096];
|
2021-06-07 22:03:19 +02:00
|
|
|
dword separator_color;
|
2021-06-27 11:28:59 +02:00
|
|
|
bool current_inactive = false;
|
2021-11-16 03:05:12 +01:00
|
|
|
char volume_label[64] = 0;
|
2015-12-21 17:37:24 +01:00
|
|
|
char label_file_name[4096];
|
2021-12-30 17:35:47 +01:00
|
|
|
if (filenum<0) return; //if hold lkm and scroll down by mouse wheel this may be the case
|
2021-06-07 22:03:19 +02:00
|
|
|
|
2021-06-27 11:28:59 +02:00
|
|
|
if (bgcol==col.selec) && (files.x==files_inactive.x) {
|
|
|
|
bgcol = col.list_bg;
|
|
|
|
current_inactive = true;
|
|
|
|
}
|
|
|
|
|
2017-10-05 23:38:09 +02:00
|
|
|
DrawBar(files.x,y,4,files.item_h,bgcol);
|
2018-03-20 18:03:14 +01:00
|
|
|
DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol);
|
2021-06-28 12:55:08 +02:00
|
|
|
if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size,icon_size,y+files.item_h-icon_y-icon_size,bgcol);
|
2021-06-07 22:03:19 +02:00
|
|
|
if (colored_lines.checked) {
|
|
|
|
if (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line;
|
|
|
|
separator_color = bgcol;
|
|
|
|
} else {
|
|
|
|
separator_color = col.list_vert_line;
|
|
|
|
}
|
2018-10-01 18:41:14 +02:00
|
|
|
DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol);
|
2021-06-07 22:03:19 +02:00
|
|
|
DrawBar(files.x+files.w-141,y,1,files.item_h, separator_color);
|
|
|
|
DrawBar(files.x+files.w-68,y,1,files.item_h, separator_color);
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2021-06-27 11:28:59 +02:00
|
|
|
ESI = items.get(filenum+files.first)*304 + buf+32;
|
|
|
|
attr = ESDWORD[ESI];
|
2021-11-16 01:35:51 +01:00
|
|
|
file.sizelo = ESI.BDVK.sizelo;
|
|
|
|
file.sizehi = ESI.BDVK.sizehi;
|
|
|
|
file_name_off = #ESI.BDVK.name;
|
2021-11-16 03:05:12 +01:00
|
|
|
sprintf(#full_path,"%s/%s",path,file_name_off);
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2021-06-27 11:28:59 +02:00
|
|
|
if (attr&ATR_FOLDER)
|
2021-11-15 00:16:56 +01:00
|
|
|
{
|
2018-02-07 16:43:26 +01:00
|
|
|
if (!strcmp(file_name_off,"..")) ext1="<up>"; else {
|
2016-02-21 22:57:22 +01:00
|
|
|
ext1="<DIR>";
|
2019-04-17 14:11:31 +02:00
|
|
|
WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
|
2016-02-21 22:57:22 +01:00
|
|
|
}
|
2021-11-15 00:16:56 +01:00
|
|
|
if (chrnum(path, '/')==1) && (streq(path, "/kolibrios")==false)
|
2021-11-16 03:05:12 +01:00
|
|
|
&& (streq(path, "/sys")==false) {
|
|
|
|
file_size = GetDeviceSize(#full_path);
|
|
|
|
if (ESBYTE[path+1]) strlcpy(#volume_label, GetVolumeLabel(#full_path), sizeof(volume_label));
|
|
|
|
}
|
2021-06-27 11:28:59 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ext1 = strrchr(file_name_off,'.') + file_name_off;
|
|
|
|
if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing
|
|
|
|
file_size = ConvertSize64(file.sizelo, file.sizehi);
|
|
|
|
if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
|
2014-04-17 20:07:07 +02:00
|
|
|
}
|
2021-11-15 00:16:56 +01:00
|
|
|
if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58,
|
2019-04-17 14:11:31 +02:00
|
|
|
files.text_y+y+1, files.font_type, col.list_gb_text, file_size);
|
2014-04-17 20:07:07 +02:00
|
|
|
|
2021-06-27 11:28:59 +02:00
|
|
|
if (attr&ATR_HIDDEN) || (attr&ATR_SYSTEM) text_col=col.list_text_hidden;
|
2019-04-17 14:11:31 +02:00
|
|
|
if (bgcol==col.selec)
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2019-04-16 23:21:19 +02:00
|
|
|
file_name_is_8_3(file_name_off);
|
2021-06-25 15:21:42 +02:00
|
|
|
itdir = attr & ATR_FOLDER;
|
2014-04-26 11:49:20 +02:00
|
|
|
strcpy(#file_name, file_name_off);
|
2021-06-27 11:28:59 +02:00
|
|
|
if (streq(path,"/")) sprintf(#file_path,"%s%s",path,file_name_off);
|
|
|
|
else sprintf(#file_path,"%s/%s",path,file_name_off);
|
2019-04-17 14:11:31 +02:00
|
|
|
if (text_col==col.list_text_hidden) {
|
2021-11-15 00:16:56 +01:00
|
|
|
text_col=MixColors(col.selec_text, col.list_text_hidden, 65);
|
2019-04-17 14:11:31 +02:00
|
|
|
} else text_col=col.selec_text;
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
2021-06-30 13:38:29 +02:00
|
|
|
if (getElementSelectedFlag(filenum+files.first)) text_col=0xFF0000;
|
2016-12-21 20:50:13 +01:00
|
|
|
if (kfont.size.pt==9) || (!kfont.font)
|
2013-03-31 22:25:54 +02:00
|
|
|
{
|
2015-08-19 13:14:15 +02:00
|
|
|
if (Form.width>=480)
|
|
|
|
{
|
2021-06-10 13:18:19 +02:00
|
|
|
FileShow.start_x = files.x + icon_size + 7;
|
2015-08-19 13:14:15 +02:00
|
|
|
FileShow.font_color = text_col;
|
|
|
|
FileShow.area_size_x = files.w - 164;
|
|
|
|
FileShow.text_pointer = file_name_off;
|
2017-09-23 13:02:57 +02:00
|
|
|
FileShow.start_y = files.text_y + y - 3;
|
2015-08-19 13:14:15 +02:00
|
|
|
PathShow_prepare stdcall(#FileShow);
|
|
|
|
PathShow_draw stdcall(#FileShow);
|
2021-11-15 00:16:56 +01:00
|
|
|
}
|
2015-08-19 13:14:15 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-16 03:05:12 +01:00
|
|
|
//that shit must be in a library
|
2015-12-21 17:37:24 +01:00
|
|
|
strcpy(#label_file_name, file_name_off);
|
2021-11-16 03:05:12 +01:00
|
|
|
if (volume_label) sprintf(#label_file_name, "%s [%s]", file_name_off, #volume_label);
|
2016-12-21 20:50:13 +01:00
|
|
|
if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w)
|
2015-12-21 17:37:24 +01:00
|
|
|
{
|
2016-12-21 20:50:13 +01:00
|
|
|
while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) {
|
2015-12-21 17:37:24 +01:00
|
|
|
ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL;
|
|
|
|
}
|
2021-11-15 00:16:56 +01:00
|
|
|
strcpy(#label_file_name+strlen(#label_file_name)-2, "...");
|
2015-12-21 17:37:24 +01:00
|
|
|
}
|
2021-11-15 00:16:56 +01:00
|
|
|
kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y,
|
2019-04-17 14:11:31 +02:00
|
|
|
bgcol, text_col, kfont.size.pt, #label_file_name);
|
2013-03-31 22:25:54 +02:00
|
|
|
}
|
2021-06-07 22:03:19 +02:00
|
|
|
DrawIconByExtension(#full_path, ext1, files.x+4, icon_y, bgcol);
|
2021-06-28 12:55:08 +02:00
|
|
|
if (current_inactive) DrawWideRectangle(files.x+2, y, files.w-4, files.item_h, 2, col.selec);
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
inline Sorting()
|
|
|
|
{
|
2018-10-19 23:13:36 +02:00
|
|
|
dword d=0, f=1;
|
2018-10-01 18:41:14 +02:00
|
|
|
int j=0;
|
2014-04-26 11:49:20 +02:00
|
|
|
dword file_off;
|
2018-10-01 18:41:14 +02:00
|
|
|
|
2020-05-23 13:26:58 +02:00
|
|
|
items.drop();
|
|
|
|
|
2021-06-27 11:28:59 +02:00
|
|
|
if (streq(path,"/")) //do not sort root folder
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2020-05-23 13:26:58 +02:00
|
|
|
for(d=1;d<files.count;d++;) items.set(d, d);
|
2021-06-26 19:36:34 +02:00
|
|
|
folder_count = d;
|
2013-03-11 19:16:24 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-07-21 03:10:37 +02:00
|
|
|
for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2019-04-16 23:21:19 +02:00
|
|
|
if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40);
|
2021-06-25 15:21:42 +02:00
|
|
|
if (ESDWORD[file_off] & ATR_FOLDER) {
|
2020-05-23 13:26:58 +02:00
|
|
|
items.set(d, j);
|
2018-10-19 23:13:36 +02:00
|
|
|
d++;
|
2021-06-25 15:21:42 +02:00
|
|
|
} else {
|
2020-05-23 13:26:58 +02:00
|
|
|
items.set(files.count-f, j);
|
2018-10-19 23:13:36 +02:00
|
|
|
f++;
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
}
|
2021-06-26 19:36:34 +02:00
|
|
|
folder_count = d;
|
2013-03-31 22:25:54 +02:00
|
|
|
//sorting: files first, then folders
|
2018-10-19 23:13:36 +02:00
|
|
|
Sort_by_Name(0,d-1);
|
|
|
|
if (sort_type==1) Sort_by_Name(d,files.count-1);
|
|
|
|
else if (sort_type==2) Sort_by_Type(d,files.count-1);
|
|
|
|
else if (sort_type==3) Sort_by_Size(d,files.count-1);
|
|
|
|
//reversed sorting
|
|
|
|
if (sort_desc) {
|
2020-05-23 13:26:58 +02:00
|
|
|
for (j=0; j<f/2; j++) {
|
|
|
|
items.swap(files.count-j-1, d+j);
|
|
|
|
}
|
|
|
|
//if (sort_type==1) for (j=0; j<d/2; j++) items[d-j]><items[j];
|
2018-10-19 23:13:36 +02:00
|
|
|
}
|
2015-07-19 20:45:59 +02:00
|
|
|
//make ".." first item in list
|
2020-05-23 13:26:58 +02:00
|
|
|
if (d>0) && (strncmp(items.get(0)*304+buf+72,"..",2)!=0)
|
|
|
|
for(d--; d>0; d--;) if (!strncmp(items.get(d)*304+buf+72,"..",2)) {items.swap(d,0); break;}
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-07 16:55:16 +02:00
|
|
|
void SelectFileByName(dword that_file)
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2015-08-07 16:55:16 +02:00
|
|
|
int ind;
|
|
|
|
files.KeyHome();
|
2021-06-28 19:00:57 +02:00
|
|
|
OpenDir(ONLY_OPEN);
|
2019-04-16 23:21:19 +02:00
|
|
|
if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file);
|
2020-12-13 13:31:53 +01:00
|
|
|
for (ind=files.count-1; ind>=0; ind--;) { if (!strcmpi(items.get(ind)*304+buf+72,that_file)) break; }
|
2015-09-09 16:24:42 +02:00
|
|
|
files.cur_y = ind - 1;
|
2015-08-07 16:55:16 +02:00
|
|
|
files.KeyDown();
|
2016-10-05 21:33:49 +02:00
|
|
|
DrawStatusBar();
|
2013-03-11 19:16:24 +01:00
|
|
|
List_ReDraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Dir_Up()
|
|
|
|
{
|
2018-10-01 18:41:14 +02:00
|
|
|
int iii;
|
2016-10-30 20:17:46 +01:00
|
|
|
char old_folder_name[4096];
|
2021-06-27 11:28:59 +02:00
|
|
|
iii=strlen(path)-1;
|
2018-10-01 18:41:14 +02:00
|
|
|
if (iii==0) return;
|
2021-06-27 11:28:59 +02:00
|
|
|
iii = strrchr(path, '/');
|
|
|
|
strcpy(#old_folder_name, path+iii);
|
|
|
|
if (iii>1) ESBYTE[path+iii-1]=NULL; else ESBYTE[path+iii]=NULL;
|
2016-10-30 20:17:46 +01:00
|
|
|
SelectFileByName(#old_folder_name);
|
2021-06-29 22:31:23 +02:00
|
|
|
DrawPathBar();
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
2020-12-16 11:23:59 +01:00
|
|
|
void EventOpenSelected()
|
|
|
|
{
|
|
|
|
int i;
|
2021-11-15 00:16:56 +01:00
|
|
|
for (i=0; i<files.count; i++) if (getElementSelectedFlag(i)) {
|
2020-12-16 11:23:59 +01:00
|
|
|
EDX = items.get(i)*304 + buf+32;
|
2021-06-25 15:21:42 +02:00
|
|
|
if (ESDWORD[EDX]&ATR_FOLDER) continue; //is foder
|
2021-06-27 11:28:59 +02:00
|
|
|
sprintf(#param,"%s/%s",path, EDX+40);
|
2020-12-16 11:23:59 +01:00
|
|
|
RunProgram("/sys/@open", #param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventOpen(byte _new_window)
|
2013-03-31 22:25:54 +02:00
|
|
|
{
|
2021-06-30 13:38:29 +02:00
|
|
|
if (getSelectedCount()) && (!itdir) notify(T_USE_SHIFT_ENTER);
|
2020-12-16 11:23:59 +01:00
|
|
|
if (_new_window)
|
2015-02-21 21:12:52 +01:00
|
|
|
{
|
2020-12-16 11:23:59 +01:00
|
|
|
if (streq(#file_name,"..")) return;
|
|
|
|
RunProgram(I_Path, #file_path);
|
2015-02-21 21:12:52 +01:00
|
|
|
return;
|
|
|
|
}
|
2013-04-04 19:07:38 +02:00
|
|
|
if (!files.count) return;
|
2013-04-02 15:39:25 +02:00
|
|
|
if (!itdir)
|
2013-03-31 22:25:54 +02:00
|
|
|
{
|
2015-02-13 23:54:42 +01:00
|
|
|
if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
|
2021-11-15 00:16:56 +01:00
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
else
|
|
|
|
{
|
2015-07-23 13:54:26 +02:00
|
|
|
if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
|
2021-06-27 11:28:59 +02:00
|
|
|
strcpy(path, #file_path);
|
2015-09-09 16:24:42 +02:00
|
|
|
files.first=files.cur_y=0;
|
2021-06-28 19:00:57 +02:00
|
|
|
OpenDir(WITH_REDRAW);
|
2013-03-31 22:25:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-28 19:00:57 +02:00
|
|
|
void EventHistoryGoBack()
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
|
|
|
char cur_folder[4096];
|
2021-06-27 11:28:59 +02:00
|
|
|
strcpy(#cur_folder, path);
|
2016-01-01 17:51:53 +01:00
|
|
|
if (history.back()) {
|
2021-06-27 11:28:59 +02:00
|
|
|
strcpy(path, history.current());
|
2015-12-16 23:08:01 +01:00
|
|
|
SelectFileByName(#cur_folder+strrchr(#cur_folder,'/'));
|
2021-06-28 19:00:57 +02:00
|
|
|
DrawPathBar();
|
2015-12-16 23:08:01 +01:00
|
|
|
}
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
2021-06-28 19:00:57 +02:00
|
|
|
void EventHistoryGoForward()
|
|
|
|
{
|
|
|
|
if (history.forward()) {
|
|
|
|
strcpy(path, history.current());
|
|
|
|
files.KeyHome();
|
|
|
|
OpenDir(WITH_REDRAW);
|
|
|
|
DrawPathBar();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-12 13:52:49 +01:00
|
|
|
void ShowOpenWithDialog()
|
|
|
|
{
|
2017-07-04 17:14:51 +02:00
|
|
|
byte open_param[4097];
|
|
|
|
sprintf(#open_param,"~%s",#file_path);
|
|
|
|
RunProgram("/sys/@open", #open_param);
|
2015-02-12 13:52:49 +01:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:55:08 +02:00
|
|
|
bool EventCreateAndRename()
|
2015-05-14 18:09:36 +02:00
|
|
|
{
|
2021-06-28 12:55:08 +02:00
|
|
|
sprintf(#temp,"%s/%s",path,popin_text.text);
|
|
|
|
if (file_exists(#temp)) {
|
|
|
|
notify(FS_ITEM_ALREADY_EXISTS);
|
|
|
|
return false;
|
|
|
|
}
|
2021-11-15 00:16:56 +01:00
|
|
|
switch(active_popin)
|
2015-05-14 18:09:36 +02:00
|
|
|
{
|
2021-06-28 12:55:08 +02:00
|
|
|
case POPIN_NEW_FILE:
|
|
|
|
if (CreateFile(0, 0, #temp)) goto __FAIL;
|
|
|
|
break;
|
|
|
|
case POPIN_NEW_FOLDER:
|
|
|
|
if (CreateDir(#temp)) goto __FAIL;
|
|
|
|
break;
|
|
|
|
case POPIN_RENAME:
|
|
|
|
if (RenameMove(popin_text.text, #file_path))
|
2015-06-20 00:23:51 +02:00
|
|
|
{
|
2021-05-28 01:40:55 +02:00
|
|
|
if (itdir) {
|
2021-06-28 12:55:08 +02:00
|
|
|
goto __FAIL;
|
2021-05-28 01:40:55 +02:00
|
|
|
} else {
|
2021-06-28 12:55:08 +02:00
|
|
|
if (CopyFile(#file_path,#temp)) {
|
|
|
|
goto __FAIL;
|
2021-05-28 01:40:55 +02:00
|
|
|
} else {
|
|
|
|
DeleteFile(#file_path);
|
|
|
|
}
|
2015-06-20 00:23:51 +02:00
|
|
|
}
|
|
|
|
}
|
2015-05-14 18:09:36 +02:00
|
|
|
}
|
2021-06-28 12:55:08 +02:00
|
|
|
SelectFileByName(popin_text.text);
|
|
|
|
return true;
|
|
|
|
__FAIL:
|
|
|
|
Write_Error(EAX);
|
2021-11-15 00:16:56 +01:00
|
|
|
return false;
|
2021-06-28 12:55:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EventPopinClickOkay()
|
|
|
|
{
|
|
|
|
switch(active_popin) {
|
|
|
|
case POPIN_PATH:
|
|
|
|
strcpy(path, #popin_string);
|
2021-06-28 19:00:57 +02:00
|
|
|
OpenDir(WITH_REDRAW);
|
2021-06-28 12:55:08 +02:00
|
|
|
break;
|
|
|
|
case POPIN_DELETE:
|
|
|
|
CopyFilesListToClipboard(DELETE);
|
2021-07-04 14:21:21 +02:00
|
|
|
EventChooseAllFiles(false);
|
2021-06-28 12:55:08 +02:00
|
|
|
sprintf(#param, "-d %s", #file_path);
|
|
|
|
RunProgram(#program_path, #param);
|
2021-11-15 00:16:56 +01:00
|
|
|
break;
|
2021-06-28 12:55:08 +02:00
|
|
|
case POPIN_RENAME:
|
|
|
|
case POPIN_NEW_FILE:
|
|
|
|
case POPIN_NEW_FOLDER:
|
|
|
|
if (!EventCreateAndRename()) return;
|
|
|
|
}
|
2020-05-06 17:53:34 +02:00
|
|
|
EventClosePopinForm();
|
2015-05-14 18:09:36 +02:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:55:08 +02:00
|
|
|
void EventClosePopinForm()
|
2015-05-14 18:09:36 +02:00
|
|
|
{
|
2021-06-28 12:55:08 +02:00
|
|
|
active_popin = NULL;
|
|
|
|
draw_window();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ShowPopinForm(byte _popin_type)
|
|
|
|
{
|
|
|
|
int popinx;
|
|
|
|
popin_string[0] = -1;
|
|
|
|
switch(_popin_type) {
|
|
|
|
case POPIN_PATH:
|
|
|
|
edit_box_set_text stdcall (#popin_text, path);
|
|
|
|
DrawEolitePopup(T_GOPATH, T_CANCEL);
|
|
|
|
break;
|
|
|
|
case POPIN_NEW_FILE:
|
|
|
|
edit_box_set_text stdcall (#popin_text, T_NEW_FILE);
|
|
|
|
DrawEolitePopup(T_CREATE, T_CANCEL);
|
|
|
|
break;
|
|
|
|
case POPIN_NEW_FOLDER:
|
|
|
|
edit_box_set_text stdcall (#popin_text, T_NEW_FOLDER);
|
|
|
|
DrawEolitePopup(T_CREATE, T_CANCEL);
|
|
|
|
break;
|
|
|
|
case POPIN_RENAME:
|
|
|
|
edit_box_set_text stdcall (#popin_text, #file_name);
|
|
|
|
DrawEolitePopup(T_RENAME, T_CANCEL);
|
|
|
|
break;
|
|
|
|
case POPIN_DELETE:
|
|
|
|
if (!files.count) return;
|
2021-06-30 13:38:29 +02:00
|
|
|
if (!getSelectedCount()) && (!strncmp(#file_name,"..",2)) return;
|
2021-06-28 12:55:08 +02:00
|
|
|
popinx = DrawEolitePopup(T_YES, T_NO);
|
|
|
|
WriteTextCenter(popinx, 178, POPIN_W, sc.work_text, T_DELETE_FILE);
|
2021-06-30 13:38:29 +02:00
|
|
|
if (getSelectedCount()) {
|
|
|
|
sprintf(#param,"%s%d%s",DEL_MORE_FILES_1,getSelectedCount(),DEL_MORE_FILES_2);
|
2021-06-28 12:55:08 +02:00
|
|
|
} else {
|
|
|
|
if (strlen(#file_name)<28) {
|
|
|
|
sprintf(#param,"%s ?",#file_name);
|
|
|
|
} else {
|
|
|
|
strncpy(#param, #file_name, POPIN_W-20/6-4);
|
|
|
|
strcat(#param, "...?");
|
|
|
|
}
|
|
|
|
}
|
2021-12-01 14:48:58 +01:00
|
|
|
WriteTextCenter(popinx, SIDEBAR_W, POPIN_W, sc.work_text, #param);
|
2021-06-28 12:55:08 +02:00
|
|
|
break;
|
|
|
|
case POPIN_DISK:
|
2021-06-28 19:00:57 +02:00
|
|
|
DefineHiddenButton(0,0,5000,3000,POPUP_BTN2+BT_NOFRAME);
|
2021-06-28 12:55:08 +02:00
|
|
|
if (active_panel==0) {
|
|
|
|
SystemDiscs.DrawOptions(1);
|
|
|
|
} else {
|
|
|
|
SystemDiscs.DrawOptions(Form.cwidth/2-1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case POPIN_BREADCR:
|
2021-06-28 19:00:57 +02:00
|
|
|
DefineHiddenButton(0,0,5000,3000,POPUP_BTN2+BT_NOFRAME);
|
|
|
|
DrawBreadCrumbs();
|
2021-06-28 12:55:08 +02:00
|
|
|
break;
|
2015-05-14 18:09:36 +02:00
|
|
|
}
|
2021-06-28 12:55:08 +02:00
|
|
|
active_popin = _popin_type;
|
2015-05-14 18:09:36 +02:00
|
|
|
}
|
|
|
|
|
2021-06-07 23:45:46 +02:00
|
|
|
void EventShowAbout()
|
|
|
|
{
|
|
|
|
if (!active_about) {
|
|
|
|
about_stak = malloc(4096);
|
|
|
|
about_thread_id = CreateThread(#about_dialog,about_stak+4092);
|
|
|
|
} else {
|
|
|
|
ActivateWindow(GetProcessSlot(about_thread_id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-16 03:44:30 +02:00
|
|
|
void FnProcess(byte N)
|
2013-03-31 22:25:54 +02:00
|
|
|
{
|
|
|
|
switch(N)
|
|
|
|
{
|
|
|
|
case 1:
|
2021-06-07 23:45:46 +02:00
|
|
|
EventShowProperties();
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-06-28 12:55:08 +02:00
|
|
|
if (files.count) ShowPopinForm(POPIN_RENAME);
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2022-01-05 16:22:46 +01:00
|
|
|
if (files.count) && (!itdir) RunProgram("/kolibrios/utils/quark", #file_path);
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
2021-06-07 23:45:46 +02:00
|
|
|
if (files.count) && (!itdir) RunProgram("/sys/develop/cedit", #file_path);
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
2021-06-15 01:33:54 +02:00
|
|
|
case 5:
|
|
|
|
if (efm) {
|
2021-06-15 20:22:58 +02:00
|
|
|
CopyFilesListToClipboard(COPY);
|
2021-06-27 11:28:59 +02:00
|
|
|
EventPaste(location[active_panel^1]);
|
2021-06-07 22:03:19 +02:00
|
|
|
} else {
|
2021-06-26 19:36:34 +02:00
|
|
|
EventManualFolderRefresh();
|
2015-08-13 17:28:53 +02:00
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
|
|
|
case 6:
|
2021-06-15 01:33:54 +02:00
|
|
|
if (efm) {
|
2021-06-15 20:22:58 +02:00
|
|
|
CopyFilesListToClipboard(CUT);
|
2021-07-04 14:21:21 +02:00
|
|
|
EventChooseAllFiles(false);
|
2021-06-27 11:28:59 +02:00
|
|
|
EventPaste(location[active_panel^1]);
|
2021-06-15 01:33:54 +02:00
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
|
|
|
case 7:
|
2021-06-28 12:55:08 +02:00
|
|
|
ShowPopinForm(POPIN_NEW_FOLDER);
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
2015-02-22 19:42:51 +01:00
|
|
|
case 8:
|
2021-06-28 12:55:08 +02:00
|
|
|
ShowPopinForm(POPIN_DELETE);
|
2021-06-07 23:45:46 +02:00
|
|
|
break;
|
|
|
|
case 9:
|
2021-06-28 12:55:08 +02:00
|
|
|
ShowPopinForm(POPIN_NEW_FILE);
|
2015-02-22 19:42:51 +01:00
|
|
|
break;
|
2013-03-31 22:25:54 +02:00
|
|
|
case 10: //F10
|
2021-06-27 11:28:59 +02:00
|
|
|
if (active_settings) {
|
|
|
|
ActivateWindow(GetProcessSlot(settings_window));
|
|
|
|
} else {
|
2015-07-16 03:44:30 +02:00
|
|
|
settings_stak = malloc(4096);
|
|
|
|
settings_window = CreateThread(#settings_dialog, settings_stak+4092);
|
2015-02-17 17:46:38 +01:00
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-26 09:59:13 +02:00
|
|
|
void SetActivePanel(int _active)
|
2015-08-17 23:24:56 +02:00
|
|
|
{
|
2021-11-15 00:16:56 +01:00
|
|
|
if (active_panel != _active) {
|
2021-06-26 09:59:13 +02:00
|
|
|
active_panel = _active;
|
|
|
|
llist_copy(#files_active, #files_inactive);
|
|
|
|
llist_copy(#files_inactive, #files);
|
2021-06-27 11:28:59 +02:00
|
|
|
llist_copy(#files, #files_active);
|
|
|
|
path = location[active_panel];
|
2021-06-26 09:59:13 +02:00
|
|
|
DrawFilePanels();
|
|
|
|
}
|
2015-08-17 23:24:56 +02:00
|
|
|
}
|
|
|
|
|
2018-10-01 18:41:14 +02:00
|
|
|
void EventSelectFileByKeyPress()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i=files.cur_y+1; i<files.count; i++)
|
|
|
|
{
|
2020-05-23 13:26:58 +02:00
|
|
|
strcpy(#temp, items.get(i)*304+buf+72);
|
2018-10-01 18:41:14 +02:00
|
|
|
if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
|
|
|
|
{
|
|
|
|
files.cur_y = i - 1;
|
|
|
|
files.KeyDown();
|
|
|
|
List_ReDraw();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-27 11:28:59 +02:00
|
|
|
dword GetDeviceSize(dword p)
|
2018-10-31 17:50:25 +01:00
|
|
|
{
|
|
|
|
BDVK bdvk;
|
2021-06-27 11:28:59 +02:00
|
|
|
if (ESBYTE[p+1] == '/') p++;
|
|
|
|
if (ESBYTE[p+1] == 'c') && (ESBYTE[p+2] == 'd')
|
|
|
|
&& (ESBYTE[p+4] == 0) return 0;
|
2021-07-09 10:03:31 +02:00
|
|
|
if (GetFileInfo(p, #bdvk)) {
|
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
ConvertSize64(bdvk.sizelo, bdvk.sizehi);
|
|
|
|
}
|
2018-10-31 17:50:25 +01:00
|
|
|
}
|
|
|
|
|
2018-10-01 18:41:14 +02:00
|
|
|
int GetRealFileCountInFolder(dword folder_path)
|
|
|
|
{
|
|
|
|
int fcount;
|
|
|
|
dword countbuf;
|
|
|
|
|
|
|
|
GetDir(#countbuf, #fcount, folder_path, DIRS_NOROOT);
|
|
|
|
if (countbuf) free(countbuf);
|
|
|
|
|
|
|
|
return fcount;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventRefreshDisksAndFolders()
|
|
|
|
{
|
2021-06-26 19:36:34 +02:00
|
|
|
if(efm) {
|
2021-06-27 11:28:59 +02:00
|
|
|
if (GetRealFileCountInFolder(location[active_panel^1]) != files_inactive.count) {
|
2021-06-26 19:36:34 +02:00
|
|
|
DrawFilePanels();
|
|
|
|
return;
|
|
|
|
}
|
2021-06-21 12:17:09 +02:00
|
|
|
} else {
|
2021-06-26 19:36:34 +02:00
|
|
|
if (GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) {
|
|
|
|
SystemDiscs.Get();
|
2021-06-27 14:32:00 +02:00
|
|
|
SystemDiscs.Draw();
|
2018-10-01 18:41:14 +02:00
|
|
|
}
|
|
|
|
}
|
2021-06-28 19:00:57 +02:00
|
|
|
if(GetRealFileCountInFolder(path) != files.count) OpenDir(WITH_REDRAW);
|
2021-06-26 19:36:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EventManualFolderRefresh()
|
|
|
|
{
|
|
|
|
Tip(56, T_DEVICES, 55, "-");
|
|
|
|
pause(10);
|
2021-06-27 14:32:00 +02:00
|
|
|
DrawFilePanels();
|
2018-10-01 18:41:14 +02:00
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
|
2019-04-16 23:21:19 +02:00
|
|
|
void EventSort(dword id)
|
|
|
|
{
|
|
|
|
char selected_filename[256];
|
|
|
|
if (sort_type == id) sort_desc ^= 1;
|
|
|
|
else sort_type = id;
|
|
|
|
strcpy(#selected_filename, #file_name);
|
2021-06-17 23:29:58 +02:00
|
|
|
DrawButtonsAroundList();
|
2021-06-28 19:00:57 +02:00
|
|
|
OpenDir(WITH_REDRAW);
|
2019-04-16 23:21:19 +02:00
|
|
|
SelectFileByName(#selected_filename);
|
|
|
|
}
|
|
|
|
|
2020-04-20 11:37:37 +02:00
|
|
|
void EventOpenNewEolite()
|
|
|
|
{
|
2021-06-27 11:28:59 +02:00
|
|
|
RunProgram(I_Path, path);
|
2020-04-20 11:37:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EventOpenConsoleHere()
|
|
|
|
{
|
2021-06-27 11:28:59 +02:00
|
|
|
sprintf(#param, "pwd cd %s", path);
|
2020-04-20 11:37:37 +02:00
|
|
|
RunProgram("/sys/shell", #param);
|
|
|
|
}
|
|
|
|
|
2020-04-14 13:29:55 +02:00
|
|
|
void ProceedMouseGestures()
|
|
|
|
{
|
|
|
|
char stats;
|
|
|
|
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
|
|
|
|
if (!mouse.mkm) && (stats>0) stats = 0;
|
|
|
|
if (mouse.mkm) && (!stats)
|
|
|
|
{
|
|
|
|
x_old = mouse.x;
|
|
|
|
y_old = mouse.y;
|
|
|
|
stats = 1;
|
|
|
|
}
|
|
|
|
if (mouse.mkm) && (stats==1)
|
|
|
|
{
|
|
|
|
dif_x = mouse.x-x_old;
|
|
|
|
dif_y = mouse.y-y_old;
|
|
|
|
adif_x = fabs(dif_x);
|
|
|
|
adif_y = fabs(dif_y);
|
2021-11-15 00:16:56 +01:00
|
|
|
|
2020-04-14 13:29:55 +02:00
|
|
|
if (adif_x>adif_y) {
|
|
|
|
if (dif_x > 150) {
|
|
|
|
EventHistoryGoForward();
|
|
|
|
stats = 0;
|
|
|
|
}
|
|
|
|
if (dif_x < -150) {
|
|
|
|
EventHistoryGoBack();
|
|
|
|
stats = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (dif_y < -100) {
|
|
|
|
Dir_Up();
|
|
|
|
stats = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-15 01:33:54 +02:00
|
|
|
void EventPaste(dword _into_path) {
|
2020-05-06 17:53:34 +02:00
|
|
|
char paste_line[4096+6];
|
2021-06-15 01:33:54 +02:00
|
|
|
sprintf(#paste_line, "-v%i %s", cut_active, _into_path);
|
2020-05-06 17:53:34 +02:00
|
|
|
RunProgram(#program_path, #paste_line);
|
|
|
|
EventClosePopinForm();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventShowProperties()
|
|
|
|
char line_param[4096+5];
|
|
|
|
{
|
2021-06-30 13:38:29 +02:00
|
|
|
if (!getSelectedCount()) {
|
2020-05-06 17:53:34 +02:00
|
|
|
sprintf(#line_param, "-p %s", #file_path);
|
|
|
|
RunProgram(#program_path, #line_param);
|
|
|
|
} else {
|
|
|
|
properties_stak = malloc(8096);
|
|
|
|
CreateThread(#properties_dialog, properties_stak+8092);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-26 17:07:13 +02:00
|
|
|
void EventChooseFile(int _id)
|
|
|
|
{
|
|
|
|
if (getElementSelectedFlag(_id) == true) {
|
|
|
|
setElementSelectedFlag(_id, false);
|
|
|
|
} else {
|
|
|
|
setElementSelectedFlag(_id, true);
|
|
|
|
}
|
2020-05-27 22:38:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EventChooseFilesRange(int _start, _end)
|
|
|
|
{
|
|
|
|
if (_start > _end) _start >< _end;
|
|
|
|
if (_end - _start > 1) list_full_redraw = true;
|
|
|
|
while (_start < _end) {
|
2021-11-15 00:16:56 +01:00
|
|
|
EventChooseFile(_start);
|
2020-05-27 22:38:18 +02:00
|
|
|
_start++;
|
|
|
|
}
|
2020-05-26 17:07:13 +02:00
|
|
|
DrawStatusBar();
|
2020-05-27 22:38:18 +02:00
|
|
|
List_ReDraw();
|
2020-05-26 17:07:13 +02:00
|
|
|
}
|
|
|
|
|
2020-05-27 22:38:18 +02:00
|
|
|
void EventChooseAllFiles(dword state)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i=0; i<files.count; i++) setElementSelectedFlag(i, state);
|
|
|
|
List_ReDraw();
|
|
|
|
DrawStatusBar();
|
|
|
|
}
|
|
|
|
|
2021-06-15 01:33:54 +02:00
|
|
|
void EventToolbarButtonClick(int _btid)
|
|
|
|
{
|
|
|
|
switch(_btid) {
|
|
|
|
case BACK_BTN: EventHistoryGoBack(); break;
|
|
|
|
case FWRD_BTN: EventHistoryGoForward(); break;
|
|
|
|
case GOUP_BTN: Dir_Up(); break;
|
2021-06-15 20:22:58 +02:00
|
|
|
case COPY_BTN: CopyFilesListToClipboard(CUT); break;
|
|
|
|
case CUT_BTN: CopyFilesListToClipboard(COPY); break;
|
2021-11-15 00:16:56 +01:00
|
|
|
case PASTE_BTN:EventPaste(path); break;
|
2021-06-15 01:33:54 +02:00
|
|
|
}
|
|
|
|
}
|
2020-05-27 22:38:18 +02:00
|
|
|
|
2021-06-15 01:33:54 +02:00
|
|
|
void EventDriveClick(int __id)
|
|
|
|
{
|
2021-06-28 19:00:57 +02:00
|
|
|
if (__id >= SystemDiscs.list.count) return;
|
2021-06-15 01:33:54 +02:00
|
|
|
if (efm) {
|
2021-06-28 19:00:57 +02:00
|
|
|
EventClosePopinForm();
|
2021-06-15 01:33:54 +02:00
|
|
|
draw_window();
|
|
|
|
}
|
2021-06-28 19:00:57 +02:00
|
|
|
strcpy(path, SystemDiscs.list.get(__id));
|
|
|
|
files.KeyHome();
|
2021-11-15 00:16:56 +01:00
|
|
|
OpenDir(WITH_REDRAW);
|
2021-06-17 23:29:58 +02:00
|
|
|
}
|
|
|
|
|
2013-03-11 19:16:24 +01:00
|
|
|
stop:
|