2020-04-12 00:17:55 +03:00
|
|
|
//Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2020
|
2018-10-20 00:13:36 +03:00
|
|
|
//GNU GPL license.
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2018-09-14 21:07:55 +03:00
|
|
|
// 70.5 - get volume info and label
|
|
|
|
|
2020-12-16 13:23:59 +03:00
|
|
|
#define TITLE "Eolite File Manager 4.49"
|
|
|
|
#define ABOUT_TITLE "EOLITE 4.49"
|
2020-05-30 14:36:52 +03:00
|
|
|
|
2013-10-14 02:18:41 +04:00
|
|
|
#ifndef AUTOBUILD
|
|
|
|
#include "lang.h--"
|
|
|
|
#endif
|
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
//libraries
|
2020-12-16 13:23:59 +03:00
|
|
|
#define MEMSIZE 1024 * 250
|
2017-10-06 00:38:09 +03:00
|
|
|
#include "../lib/clipboard.h"
|
|
|
|
#include "../lib/strings.h"
|
|
|
|
#include "../lib/mem.h"
|
2018-04-03 16:57:56 +03:00
|
|
|
#include "../lib/fs.h"
|
2017-10-06 00:38:09 +03: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 12:33:37 +03:00
|
|
|
#include "../lib/obj/libimg.h"
|
2017-10-06 00:38:09 +03:00
|
|
|
|
|
|
|
#include "../lib/patterns/history.h"
|
2015-10-08 00:09:49 +03:00
|
|
|
|
2018-10-14 13:47:23 +03:00
|
|
|
#include "imgs/images.h"
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2016-02-22 00:57:22 +03:00
|
|
|
//Button IDs
|
|
|
|
enum {
|
2018-10-01 19:41:14 +03:00
|
|
|
PATH_BTN = 10,
|
2016-02-22 00:57:22 +03:00
|
|
|
POPUP_BTN1 = 201,
|
2016-02-24 19:49:57 +03:00
|
|
|
POPUP_BTN2 = 202,
|
|
|
|
BREADCRUMB_ID = 300
|
2016-02-22 00:57:22 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
//NewElement options
|
|
|
|
enum {
|
|
|
|
CREATE_FILE=1,
|
|
|
|
CREATE_FOLDER,
|
|
|
|
RENAME_ITEM
|
|
|
|
};
|
|
|
|
|
|
|
|
//OpenDir options
|
|
|
|
enum {
|
|
|
|
ONLY_SHOW,
|
|
|
|
WITH_REDRAW,
|
|
|
|
ONLY_OPEN
|
|
|
|
};
|
2013-04-04 21:07:38 +04:00
|
|
|
|
2020-03-29 13:57:14 +03:00
|
|
|
_history history;
|
|
|
|
|
2019-04-17 15:11:31 +03:00
|
|
|
struct Eolite_colors
|
|
|
|
{
|
2019-05-10 15:51:47 +03:00
|
|
|
bool def;
|
2019-04-17 15:11:31 +03: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 16:31:55 +03:00
|
|
|
dword waves_pal[256];
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
int toolbar_buttons_x[7]={9,46,85,134,167,203};
|
|
|
|
|
2019-04-17 00:21:19 +03:00
|
|
|
bool active_about = false;
|
|
|
|
bool active_settings = false;
|
|
|
|
bool _not_draw = false;
|
|
|
|
bool exif_load = false;
|
|
|
|
bool dir_at_fat16 = NULL;
|
|
|
|
|
|
|
|
word about_thread_id;
|
2015-02-17 19:46:38 +03:00
|
|
|
word settings_window;
|
2013-10-30 01:50:46 +04:00
|
|
|
|
2015-08-17 15:45:56 +03:00
|
|
|
byte del_active=0;
|
|
|
|
byte new_element_active=0;
|
2015-08-09 22:08:57 +03:00
|
|
|
|
2015-08-17 15:45:56 +03:00
|
|
|
llist files, files_active, files_inactive;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2015-08-07 17:55:16 +03:00
|
|
|
byte list_full_redraw;
|
|
|
|
|
2015-08-09 22:08:57 +03:00
|
|
|
dword buf;
|
2020-05-23 14:26:58 +03:00
|
|
|
collection_int items=0;
|
2015-08-09 22:08:57 +03:00
|
|
|
int selected_count;
|
2016-04-22 00:50:46 +03:00
|
|
|
int count_dir;
|
2015-08-09 22:08:57 +03:00
|
|
|
|
2019-04-17 00:21:19 +03:00
|
|
|
byte path[4096];
|
|
|
|
byte file_path[4096];
|
|
|
|
byte file_name[256];
|
|
|
|
byte new_element_name[256];
|
|
|
|
byte temp[4096];
|
|
|
|
bool itdir;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2015-08-13 18:28:53 +03:00
|
|
|
char active_path[4096], inactive_path[4096];
|
|
|
|
|
2018-03-22 02:26:31 +03:00
|
|
|
dword eolite_ini_path[4096];
|
|
|
|
_ini ini;
|
2015-02-21 15:24:30 +03:00
|
|
|
|
2015-08-09 22:08:57 +03:00
|
|
|
char scroll_used=false;
|
2015-08-07 18:12:03 +03:00
|
|
|
|
2020-05-06 18:53:34 +03:00
|
|
|
dword about_stak=0,properties_stak=0,settings_stak=0,delete_stak=0;
|
2015-07-23 15:15:53 +03:00
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
proc_info Form;
|
2018-04-21 15:28:00 +03:00
|
|
|
int sc_slider_h;
|
2013-10-15 03:16:04 +04:00
|
|
|
int action_buf;
|
2014-04-20 17:00:51 +04:00
|
|
|
int rand_n;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2018-10-20 00:13:36 +03:00
|
|
|
char sort_type=2;
|
|
|
|
bool sort_desc=false;
|
2018-04-19 23:12:07 +03:00
|
|
|
int active_panel=1;
|
2015-04-03 00:27:51 +03:00
|
|
|
|
2017-10-06 00:38:09 +03:00
|
|
|
libimg_image icons16_default;
|
|
|
|
libimg_image icons16_selected;
|
|
|
|
|
2018-04-18 17:07:12 +03:00
|
|
|
libimg_image icons32_default;
|
|
|
|
libimg_image icons32_selected;
|
2018-03-20 20:03:14 +03:00
|
|
|
|
2016-10-05 02:11:59 +03:00
|
|
|
#define STATUS_BAR_H 16;
|
|
|
|
int status_bar_h = 0;
|
|
|
|
|
2018-03-20 20:03:14 +03:00
|
|
|
int icon_size = 16;
|
|
|
|
|
2018-04-21 15:28:00 +03:00
|
|
|
edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000,
|
2020-12-07 00:01:31 +03:00
|
|
|
248,#new_element_name,0,ed_focus+ed_always_focus,6,0};
|
2017-09-23 14:02:57 +03:00
|
|
|
PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
|
2015-08-07 17:55:16 +03:00
|
|
|
byte cmd_free=0;
|
2015-08-09 22:08:57 +03:00
|
|
|
#include "include\translations.h"
|
2015-10-08 00:09:49 +03:00
|
|
|
|
2018-10-14 13:47:23 +03:00
|
|
|
#include "include\gui.h"
|
2015-08-19 16:17:24 +03:00
|
|
|
#include "include\settings.h"
|
2015-09-05 20:50:37 +03:00
|
|
|
#include "include\progress_dialog.h"
|
2020-05-06 18:53:34 +03:00
|
|
|
#include "include\copy_and_delete.h"
|
2013-03-11 22:16:24 +04:00
|
|
|
#include "include\sorting.h"
|
2013-10-17 03:48:20 +04:00
|
|
|
#include "include\icons.h"
|
2013-03-11 22:16:24 +04:00
|
|
|
#include "include\left_panel.h"
|
2013-10-17 03:48:20 +04:00
|
|
|
#include "include\menu.h"
|
|
|
|
#include "include\about.h"
|
2015-02-22 21:42:51 +03:00
|
|
|
#include "include\properties.h"
|
2016-02-24 19:49:57 +03:00
|
|
|
#include "include\breadcrumbs.h"
|
2013-10-23 21:55:07 +04:00
|
|
|
|
2020-04-14 14:29:55 +03:00
|
|
|
void load_libraries()
|
|
|
|
{
|
|
|
|
load_dll(boxlib, #box_lib_init,0);
|
|
|
|
load_dll(libini, #lib_init,1);
|
|
|
|
load_dll(libimg, #libimg_init,1);
|
|
|
|
}
|
|
|
|
|
2020-05-06 18:53:34 +03:00
|
|
|
void handle_param()
|
|
|
|
{
|
2020-05-06 20:54:44 +03:00
|
|
|
//-p <path> : just show file/folder properties dialog
|
|
|
|
//-d <path> : delete file/folder
|
|
|
|
//-v : paste files/folder from clipboard
|
2020-05-06 18:53:34 +03:00
|
|
|
if (param) && (param[0]=='-') switch (param[1])
|
|
|
|
{
|
|
|
|
case 'p':
|
|
|
|
strcpy(#file_path, #param + 3);
|
|
|
|
itdir = dir_exists(#file_path);
|
2020-05-15 11:09:03 +03:00
|
|
|
strcpy(#file_name, #param + strrchr(#param, '/'));
|
|
|
|
param[strrchr(#param, '/')-1] = '\0';
|
|
|
|
strcpy(#path, #param + 3);
|
2020-05-06 18:53:34 +03:00
|
|
|
properties_dialog();
|
2020-06-04 01:21:39 +03:00
|
|
|
ExitProcess();
|
2020-05-06 18:53:34 +03:00
|
|
|
return;
|
|
|
|
case 'd':
|
|
|
|
strcpy(#file_path, #param + 3);
|
|
|
|
itdir = dir_exists(#file_path);
|
|
|
|
DisplayOperationForm(DELETE_FLAG);
|
|
|
|
DeleteSingleElement();
|
2020-06-04 01:21:39 +03:00
|
|
|
ExitProcess();
|
2020-05-06 18:53:34 +03:00
|
|
|
return;
|
2020-05-06 20:54:44 +03:00
|
|
|
case 'v':
|
|
|
|
cut_active = param[2] - '0';
|
|
|
|
strcpy(#path, #param + 4);
|
|
|
|
PasteThread();
|
2020-06-04 01:21:39 +03:00
|
|
|
ExitProcess();
|
2020-05-06 20:54:44 +03:00
|
|
|
return;
|
2020-05-06 18:53:34 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
void main()
|
|
|
|
{
|
2016-02-24 19:49:57 +03:00
|
|
|
dword id;
|
2020-05-27 23:38:18 +03:00
|
|
|
int old_cur_y;
|
2020-04-14 14:29:55 +03:00
|
|
|
|
2020-04-20 12:50:47 +03:00
|
|
|
rand_n = random(80);
|
2015-08-02 18:15:15 +03:00
|
|
|
|
2020-04-14 14:29:55 +03:00
|
|
|
load_libraries();
|
2015-10-08 00:09:49 +03:00
|
|
|
|
2018-09-17 01:30:13 +03:00
|
|
|
SetAppColors();
|
2015-02-21 15:24:30 +03:00
|
|
|
LoadIniSettings();
|
2016-01-06 23:50:19 +03:00
|
|
|
SystemDiscs.Get();
|
2017-10-03 15:10:48 +03:00
|
|
|
|
2020-05-06 18:53:34 +03:00
|
|
|
handle_param();
|
2017-10-03 15:10:48 +03:00
|
|
|
|
2018-10-01 19:41:14 +03:00
|
|
|
ESBYTE[0] = NULL;
|
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
if (param)
|
|
|
|
{
|
2018-04-20 12:43:15 +03:00
|
|
|
if (strlen(#param)>1) && (param[strlen(#param)-1]=='/') param[strlen(#param)-1]=NULL; //no "/" at the end
|
2017-07-04 18:14:51 +03:00
|
|
|
|
2020-04-14 14:29:55 +03:00
|
|
|
if (dir_exists(#param)) {
|
2017-07-04 18:14:51 +03:00
|
|
|
strcpy(#path, #param);
|
2020-04-14 14:29:55 +03:00
|
|
|
} else {
|
2020-12-13 15:31:53 +03:00
|
|
|
if (file_exists(#param)) {
|
2020-05-12 02:02:41 +03:00
|
|
|
param[strrchr(#param, '/')-1] = '\0';
|
|
|
|
strcpy(#path, #param);
|
2020-05-15 22:59:10 +03:00
|
|
|
SelectFileByName(#param+strlen(#param)+1);
|
2020-12-13 15:31:53 +03:00
|
|
|
} else {
|
|
|
|
notify(T_NOTIFY_APP_PARAM_WRONG);
|
2020-05-12 02:02:41 +03:00
|
|
|
}
|
2017-07-04 18:14:51 +03:00
|
|
|
}
|
2017-10-03 15:10:48 +03:00
|
|
|
}
|
2015-09-29 23:05:29 +03:00
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
Open_Dir(#path,ONLY_OPEN);
|
2015-08-17 15:45:56 +03:00
|
|
|
strcpy(#inactive_path, #path);
|
|
|
|
llist_copy(#files_inactive, #files);
|
2017-10-05 12:37:50 +03:00
|
|
|
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
|
2020-05-11 17:11:23 +03:00
|
|
|
loop() switch(@WaitEventTimeout(80))
|
2020-04-14 14:29:55 +03:00
|
|
|
{
|
|
|
|
case evMouse:
|
|
|
|
if (del_active) || (Form.status_window>2) break;
|
|
|
|
if (new_element_active)
|
|
|
|
{
|
|
|
|
edit_box_mouse stdcall(#new_file_ed);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
mouse.get();
|
2018-10-01 19:41:14 +03:00
|
|
|
|
2020-04-14 14:29:55 +03:00
|
|
|
ProceedMouseGestures();
|
2020-05-26 18:07:13 +03:00
|
|
|
|
2020-05-27 23:38:18 +03:00
|
|
|
if (mouse.vert)
|
|
|
|
{
|
|
|
|
if (files.MouseScroll(mouse.vert)) List_ReDraw();
|
2020-05-26 18:07:13 +03:00
|
|
|
break;
|
|
|
|
}
|
2020-05-27 23:38:18 +03:00
|
|
|
|
2020-04-14 14:29:55 +03:00
|
|
|
if (files.MouseOver(mouse.x, mouse.y))
|
|
|
|
{
|
|
|
|
//select file
|
|
|
|
if (mouse.key&MOUSE_LEFT) && (mouse.up)
|
2015-04-03 00:27:51 +03:00
|
|
|
{
|
2020-05-27 23:38:18 +03:00
|
|
|
GetKeyModifier();
|
|
|
|
old_cur_y = files.cur_y;
|
2020-05-30 14:36:52 +03:00
|
|
|
if (files.ProcessMouse(mouse.x, mouse.y)) && (!key_modifier) {
|
|
|
|
List_ReDraw();
|
|
|
|
break;
|
|
|
|
}
|
2020-05-27 23:38:18 +03:00
|
|
|
if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) {
|
|
|
|
EventChooseFilesRange(old_cur_y, files.cur_y);
|
|
|
|
} else if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) {
|
|
|
|
EventChooseFile(files.cur_y);
|
|
|
|
DrawStatusBar();
|
2020-05-26 18:07:13 +03:00
|
|
|
List_ReDraw();
|
|
|
|
} else {
|
2020-12-16 13:23:59 +03:00
|
|
|
if (mouse.y - files.y / files.item_h + files.first == files.cur_y) EventOpen(0);
|
2020-04-14 14:29:55 +03:00
|
|
|
}
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
2020-04-14 14:29:55 +03:00
|
|
|
//file menu
|
|
|
|
if (mouse.key&MOUSE_RIGHT) && (mouse.up)
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
2020-04-14 14:29:55 +03:00
|
|
|
if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw();
|
|
|
|
if (getElementSelectedFlag(files.cur_y) == false) selected_count = 0; //on redraw selection would be flashed, see [L001]
|
|
|
|
EventShowListMenu();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
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 02:52:24 +03:00
|
|
|
if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_dark,sc.work_light);
|
2020-04-14 14:29:55 +03:00
|
|
|
WHILE (mouse.lkm) && (files.first>0)
|
2015-04-03 00:27:51 +03:00
|
|
|
{
|
2020-04-14 14:29:55 +03:00
|
|
|
pause(8);
|
|
|
|
files.first--;
|
|
|
|
List_ReDraw();
|
|
|
|
mouse.get();
|
2015-07-12 02:45:19 +03:00
|
|
|
}
|
2020-04-18 02:52:24 +03:00
|
|
|
DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_light,sc.work_dark);
|
2020-04-14 14:29:55 +03:00
|
|
|
}
|
2015-07-21 04:10:37 +03:00
|
|
|
|
2020-04-14 14:29:55 +03: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 02:52:24 +03: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 14:29:55 +03:00
|
|
|
while (mouse.lkm) && (files.first<files.count-files.visible)
|
2015-07-12 02:45:19 +03:00
|
|
|
{
|
2020-04-14 14:29:55 +03:00
|
|
|
pause(8);
|
|
|
|
files.first++;
|
|
|
|
List_ReDraw();
|
|
|
|
mouse.get();
|
2015-07-12 02:45:19 +03:00
|
|
|
}
|
2020-04-18 02:52:24 +03:00
|
|
|
DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_light,sc.work_dark);
|
2020-04-14 14:29:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//Scrooll
|
|
|
|
if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) && (mouse.y<files.y+files.h-18) && (mouse.lkm) && (!scroll_used) {scroll_used=true; Scroll();}
|
|
|
|
if (scroll_used) && (mouse.up) { scroll_used=false; Scroll(); }
|
|
|
|
|
|
|
|
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-04-01 00:25:54 +04:00
|
|
|
|
2020-04-14 14:29:55 +03:00
|
|
|
if (two_panels.checked) && (mouse.y > files.y) && (mouse.down) {
|
|
|
|
if (mouse.x<Form.cwidth/2)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2020-04-14 14:29:55 +03:00
|
|
|
if (active_panel!=1)
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
2020-04-14 14:29:55 +03:00
|
|
|
active_panel = 1;
|
|
|
|
ChangeActivePanel();
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
2020-04-14 14:29:55 +03:00
|
|
|
else
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2020-04-14 14:29:55 +03:00
|
|
|
if (active_panel!=2)
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
2020-04-14 14:29:55 +03:00
|
|
|
active_panel = 2;
|
|
|
|
ChangeActivePanel();
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
2020-04-14 14:29:55 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
//Button pressed-----------------------------------------------------------------------------
|
|
|
|
case evButton:
|
2020-12-16 13:23:59 +03:00
|
|
|
id = GetButtonID();
|
2020-04-14 14:29:55 +03:00
|
|
|
|
|
|
|
if (new_element_active) || (del_active) {
|
2020-05-06 18:53:34 +03:00
|
|
|
if (POPUP_BTN1==id) && (del_active) EventDelete();
|
|
|
|
if (POPUP_BTN1==id) && (new_element_active) NewElement();
|
|
|
|
if (POPUP_BTN2==id) EventClosePopinForm();
|
2020-04-14 14:29:55 +03:00
|
|
|
break;
|
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2020-04-14 14:29:55 +03:00
|
|
|
switch(id)
|
|
|
|
{
|
|
|
|
case CLOSE_BTN:
|
|
|
|
KillProcess(about_thread_id);
|
|
|
|
SaveIniSettings();
|
|
|
|
ExitProcess();
|
|
|
|
case PATH_BTN:
|
|
|
|
notify(COPY_PATH_STR);
|
|
|
|
Clipboard__CopyText(#path);
|
|
|
|
break;
|
|
|
|
case 21: //Back
|
|
|
|
EventHistoryGoBack();
|
|
|
|
break;
|
|
|
|
case 22: //Forward
|
|
|
|
EventHistoryGoForward();
|
|
|
|
break;
|
|
|
|
case 23:
|
|
|
|
Dir_Up();
|
|
|
|
break;
|
|
|
|
case 24:
|
2020-05-06 18:53:34 +03:00
|
|
|
EventCopy(CUT);
|
2020-04-14 14:29:55 +03:00
|
|
|
break;
|
|
|
|
case 25:
|
2020-05-06 18:53:34 +03:00
|
|
|
EventCopy(NOCUT);
|
2020-04-14 14:29:55 +03:00
|
|
|
break;
|
|
|
|
case 26:
|
2020-05-06 18:53:34 +03:00
|
|
|
EventPaste();
|
2020-04-14 14:29:55 +03:00
|
|
|
break;
|
|
|
|
case 31...33:
|
|
|
|
EventSort(id-30);
|
|
|
|
break;
|
2020-04-20 12:37:37 +03:00
|
|
|
case 51:
|
|
|
|
EventShowBurgerMenu();
|
|
|
|
break;
|
|
|
|
case 52...60: //Actions
|
2020-04-14 14:29:55 +03:00
|
|
|
FnProcess(id-50);
|
|
|
|
break;
|
|
|
|
case 61: // Set path as default
|
|
|
|
SetDefaultPath(#path);
|
|
|
|
break;
|
|
|
|
case 100...120:
|
|
|
|
SystemDiscs.Click(id-100);
|
2015-08-13 18:28:53 +03:00
|
|
|
break;
|
2020-04-14 14:29:55 +03:00
|
|
|
case BREADCRUMB_ID...360:
|
|
|
|
ClickOnBreadCrumb(id-BREADCRUMB_ID);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
//Key pressed-----------------------------------------------------------------------------
|
|
|
|
case evKey:
|
|
|
|
GetKeys();
|
2015-08-13 18:28:53 +03:00
|
|
|
|
2020-04-14 14:29:55 +03:00
|
|
|
if (Form.status_window>2) break;
|
|
|
|
|
|
|
|
if (new_element_active) || (del_active)
|
|
|
|
{
|
|
|
|
if (del_active)
|
|
|
|
{
|
2020-05-06 18:53:34 +03:00
|
|
|
if (key_scancode == SCAN_CODE_ENTER) EventDelete();
|
|
|
|
if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm();
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
2020-04-14 14:29:55 +03:00
|
|
|
if (new_element_active)
|
|
|
|
{
|
2020-05-06 18:53:34 +03:00
|
|
|
if (key_scancode == SCAN_CODE_ENTER) NewElement();
|
|
|
|
if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm();
|
2020-04-14 14:29:55 +03:00
|
|
|
EAX = key_editbox;
|
|
|
|
edit_box_key stdcall (#new_file_ed);
|
2018-09-19 11:57:00 +03:00
|
|
|
}
|
2020-04-14 14:29:55 +03:00
|
|
|
break;
|
|
|
|
}
|
2018-09-19 11:57:00 +03:00
|
|
|
|
2020-05-26 18:07:13 +03:00
|
|
|
if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) {
|
2020-12-16 13:23:59 +03:00
|
|
|
|
|
|
|
if (key_scancode == SCAN_CODE_ENTER) {
|
|
|
|
EventOpenSelected();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-05-27 23:38:18 +03:00
|
|
|
old_cur_y = files.cur_y;
|
|
|
|
files.ProcessKey(key_scancode);
|
|
|
|
EventChooseFilesRange(old_cur_y, files.cur_y);
|
2020-05-26 18:07:13 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-04-14 14:29:55 +03:00
|
|
|
if (files.ProcessKey(key_scancode))
|
|
|
|
{
|
|
|
|
List_ReDraw();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL)
|
|
|
|
{
|
|
|
|
switch(key_scancode)
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
2020-04-14 14:29:55 +03:00
|
|
|
case SCAN_CODE_F1...SCAN_CODE_F3:
|
|
|
|
EventSort(key_scancode - 58);
|
2015-07-21 04:10:37 +03:00
|
|
|
break;
|
2020-04-14 14:29:55 +03:00
|
|
|
case SCAN_CODE_1...SCAN_CODE_10:
|
|
|
|
key_scancode-=2;
|
|
|
|
if (key_scancode >= SystemDiscs.list.count) break;
|
|
|
|
if (!two_panels.checked)
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
2020-04-14 14:29:55 +03:00
|
|
|
DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click
|
|
|
|
pause(7);
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
2020-04-14 14:29:55 +03:00
|
|
|
SystemDiscs.Click(key_scancode);
|
2015-07-21 04:10:37 +03:00
|
|
|
break;
|
2020-04-14 14:29:55 +03:00
|
|
|
case SCAN_CODE_KEY_X:
|
2020-05-06 18:53:34 +03:00
|
|
|
EventCopy(CUT);
|
2020-04-14 14:29:55 +03:00
|
|
|
break;
|
|
|
|
case SCAN_CODE_KEY_C:
|
2020-05-06 18:53:34 +03:00
|
|
|
EventCopy(NOCUT);
|
2013-03-11 22:16:24 +04:00
|
|
|
break;
|
2020-04-20 12:37:37 +03:00
|
|
|
case SCAN_CODE_KEY_G:
|
|
|
|
EventOpenConsoleHere();
|
|
|
|
break;
|
2020-04-14 14:29:55 +03:00
|
|
|
case SCAN_CODE_KEY_V:
|
2020-05-06 18:53:34 +03:00
|
|
|
EventPaste();
|
2013-03-11 22:16:24 +04:00
|
|
|
break;
|
2020-04-14 14:29:55 +03:00
|
|
|
case SCAN_CODE_KEY_D: //set image as bg
|
|
|
|
strlcpy(#temp, "\\S__",4);
|
|
|
|
strcat(#temp, #file_path);
|
|
|
|
RunProgram("/sys/media/kiv", #temp);
|
2013-03-11 22:16:24 +04:00
|
|
|
break;
|
2020-04-20 12:37:37 +03:00
|
|
|
case SCAN_CODE_KEY_N:
|
|
|
|
EventOpenNewEolite();
|
2020-04-14 14:29:55 +03:00
|
|
|
break;
|
|
|
|
case SCAN_CODE_KEY_M:
|
|
|
|
Open_Dir(#inactive_path,WITH_REDRAW);
|
|
|
|
break;
|
|
|
|
case SCAN_CODE_ENTER:
|
|
|
|
if (!itdir) ShowOpenWithDialog();
|
2020-12-16 13:23:59 +03:00
|
|
|
else EventOpen(1);
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
2020-04-14 14:29:55 +03:00
|
|
|
case SCAN_CODE_KEY_A:
|
2020-05-27 23:38:18 +03:00
|
|
|
EventChooseAllFiles(true);
|
2020-04-14 14:29:55 +03:00
|
|
|
break;
|
|
|
|
case SCAN_CODE_KEY_U: //unselect all files
|
2020-05-27 23:38:18 +03:00
|
|
|
EventChooseAllFiles(false);
|
2018-09-18 18:09:58 +03:00
|
|
|
break;
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
|
|
|
break;
|
2020-04-14 14:29:55 +03:00
|
|
|
}
|
2015-08-09 22:08:57 +03:00
|
|
|
|
2020-04-14 14:29:55 +03:00
|
|
|
switch (key_scancode)
|
|
|
|
{
|
|
|
|
case SCAN_CODE_BS:
|
|
|
|
//EventHistoryGoBack();
|
|
|
|
Dir_Up();
|
|
|
|
break;
|
|
|
|
case SCAN_CODE_ENTER:
|
2020-12-16 13:23:59 +03:00
|
|
|
EventOpen(0);
|
2020-04-14 14:29:55 +03:00
|
|
|
break;
|
|
|
|
case SCAN_CODE_TAB:
|
|
|
|
if (!two_panels.checked) break;
|
|
|
|
if (active_panel==1) active_panel=2; else active_panel=1;
|
|
|
|
ChangeActivePanel();
|
|
|
|
DrawFilePanels();
|
|
|
|
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:
|
|
|
|
Del_Form();
|
|
|
|
break;
|
|
|
|
case SCAN_CODE_INS:
|
2020-05-26 18:07:13 +03:00
|
|
|
EventChooseFile(files.cur_y);
|
2020-04-14 14:29:55 +03:00
|
|
|
files.KeyDown();
|
2020-05-29 14:05:55 +03:00
|
|
|
DrawStatusBar();
|
2020-04-14 14:29:55 +03:00
|
|
|
List_ReDraw();
|
|
|
|
break;
|
|
|
|
case SCAN_CODE_F1...SCAN_CODE_F10:
|
|
|
|
FnProcess(key_scancode-58);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
EventSelectFileByKeyPress();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case evIPC:
|
|
|
|
case evReDraw:
|
|
|
|
draw_window();
|
|
|
|
if (CheckActiveProcess(Form.ID)) && (GetMenuClick()) break;
|
|
|
|
if (action_buf==OPERATION_END)
|
|
|
|
{
|
|
|
|
FnProcess(5);
|
|
|
|
action_buf=0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (Form.status_window>2) break;
|
|
|
|
EventRefreshDisksAndFolders();
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
else if(cmd_free==6) delete_stak=free(delete_stak);
|
|
|
|
cmd_free = false;
|
2015-07-16 04:44:30 +03:00
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
2013-04-04 21:07:38 +04:00
|
|
|
void draw_window()
|
|
|
|
{
|
2019-04-17 15:11:31 +03:00
|
|
|
dword i;
|
2018-04-19 23:12:07 +03:00
|
|
|
if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0;
|
2018-05-13 19:06:20 +03:00
|
|
|
DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,TITLE,0);
|
2013-04-04 21:07:38 +04:00
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
if (Form.status_window>2) return;
|
2015-09-06 15:34:30 +03:00
|
|
|
if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; }
|
2018-11-12 19:27:48 +03:00
|
|
|
if (!two_panels.checked) && (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; }
|
|
|
|
if ( two_panels.checked) && (Form.width < 573) { MoveSize(OLD,OLD,573,OLD); return; }
|
2018-10-20 00:13:36 +03:00
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
2019-04-18 12:38:01 +03:00
|
|
|
SetAppColors();
|
2020-04-18 02:52:24 +03:00
|
|
|
ESDWORD[#toolbar_pal] = sc.work;
|
|
|
|
ESDWORD[#toolbar_pal+4] = MixColors(0, sc.work, 35);
|
2018-10-14 13:47:23 +03:00
|
|
|
PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal);
|
2020-04-18 02:52:24 +03:00
|
|
|
DrawBar(127, 8, 1, 25, sc.work_graph);
|
2018-10-01 19:41:14 +03:00
|
|
|
for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,21+i);
|
|
|
|
for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i], 5,31, 29, 21+i);
|
2020-04-18 02:52:24 +03:00
|
|
|
DrawBar(246,0, Form.cwidth - 246, 34, sc.work);
|
2018-10-14 13:47:23 +03:00
|
|
|
DrawDot(Form.cwidth-17,12);
|
|
|
|
DrawDot(Form.cwidth-17,12+6);
|
|
|
|
DrawDot(Form.cwidth-17,12+12);
|
2018-10-01 19:41:14 +03:00
|
|
|
DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots
|
2013-04-01 00:25:54 +04:00
|
|
|
//main rectangles
|
2020-04-18 02:52:24 +03:00
|
|
|
DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,sc.work_graph);
|
2019-04-17 15:11:31 +03:00
|
|
|
DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg
|
2020-04-18 02:52:24 +03: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 23:42:35 +03: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 15:45:56 +03:00
|
|
|
llist_copy(#files_active, #files);
|
2015-08-14 17:47:36 +03:00
|
|
|
strcpy(#active_path, #path);
|
2016-10-05 02:11:59 +03:00
|
|
|
DrawStatusBar();
|
2020-05-27 23:38:18 +03:00
|
|
|
if (!selected_count) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001]
|
2016-04-22 00:50:46 +03:00
|
|
|
DrawFilePanels();
|
2015-08-14 17:47:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void DrawList()
|
|
|
|
{
|
2015-08-17 15:45:56 +03:00
|
|
|
word sorting_arrow_x;
|
2018-10-20 00:13:36 +03:00
|
|
|
dword sorting_arrow_t = "\x19";
|
|
|
|
if (sort_desc) sorting_arrow_t = "\x18";
|
2016-11-05 13:13:29 +03:00
|
|
|
DrawFlatButtonSmall(files.x, files.y-17, files.w - 141,16,31,T_FILE);
|
|
|
|
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-20 00:13:36 +03: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 02:52:24 +03: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);
|
|
|
|
if (two_panels.checked) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,sc.work_graph);
|
2015-08-14 17:47:36 +03:00
|
|
|
}
|
|
|
|
|
2016-04-20 03:11:28 +03:00
|
|
|
void DrawStatusBar()
|
|
|
|
{
|
2016-10-07 11:44:03 +03:00
|
|
|
char status_bar_str[80];
|
2016-10-05 22:33:49 +03:00
|
|
|
int go_up_folder_exists=0;
|
2018-04-19 23:12:07 +03:00
|
|
|
if (!show_status_bar.checked) return;
|
2020-05-23 14:26:58 +03:00
|
|
|
if (files.count>0) && (streq(items.get(0)*304+buf+72,"..")) go_up_folder_exists=1;
|
2020-04-18 02:52:24 +03:00
|
|
|
DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work);
|
2020-04-17 20:04:54 +03:00
|
|
|
sprintf(#status_bar_str, T_STATUS_EVEMENTS, count_dir-go_up_folder_exists, files.count-count_dir);
|
2020-04-18 02:52:24 +03:00
|
|
|
WriteText(6,Form.cheight - 13,0x80,sc.work_text,#status_bar_str);
|
2020-04-17 20:04:54 +03:00
|
|
|
if (selected_count) {
|
|
|
|
sprintf(#status_bar_str, T_STATUS_SELECTED, selected_count);
|
|
|
|
WriteText(Form.cwidth - calc(strlen(#status_bar_str)*6)-6,Form.cheight - 13,
|
2020-04-18 02:52:24 +03:00
|
|
|
0x80,sc.work_text,#status_bar_str);
|
2020-04-17 20:04:54 +03:00
|
|
|
}
|
2016-04-20 03:11:28 +03:00
|
|
|
}
|
|
|
|
|
2015-08-14 17:47:36 +03:00
|
|
|
void DrawFilePanels()
|
|
|
|
{
|
2016-01-06 23:50:19 +03:00
|
|
|
int files_y;
|
2018-04-19 23:12:07 +03:00
|
|
|
if (!two_panels.checked)
|
2015-08-09 22:08:57 +03:00
|
|
|
{
|
2015-08-14 17:47:36 +03:00
|
|
|
DrawDeviceAndActionsLeftPanel();
|
2016-10-05 02:11:59 +03:00
|
|
|
files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h);
|
2015-08-13 18:28:53 +03:00
|
|
|
DrawList();
|
2015-08-17 15:45:56 +03:00
|
|
|
Open_Dir(#path,ONLY_SHOW);
|
2015-08-09 22:08:57 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-02-07 03:29:45 +03:00
|
|
|
SystemDiscs.Get();
|
2015-08-17 15:45:56 +03:00
|
|
|
llist_copy(#files, #files_inactive);
|
|
|
|
strcpy(#path, #inactive_path);
|
2019-04-17 15:11:31 +03:00
|
|
|
col.selec = col.selec_inactive;
|
2016-01-06 23:50:19 +03:00
|
|
|
SystemDiscs.Draw();
|
|
|
|
files_y = files.y;
|
2015-08-17 15:45:56 +03:00
|
|
|
|
2015-08-13 18:28:53 +03:00
|
|
|
if (active_panel==1)
|
|
|
|
{
|
2015-08-22 16:27:12 +03:00
|
|
|
llist_copy(#files, #files_inactive);
|
|
|
|
strcpy(#path, #inactive_path);
|
2019-04-17 15:11:31 +03:00
|
|
|
col.selec = col.selec_inactive; //this is a bad code: need to use some var to set inactive panel for DrawList();
|
2016-10-05 02:11:59 +03:00
|
|
|
files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h);
|
2015-08-13 18:28:53 +03:00
|
|
|
DrawList();
|
2015-08-17 15:45:56 +03:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
llist_copy(#files, #files_active);
|
2015-08-13 18:28:53 +03:00
|
|
|
strcpy(#path, #active_path);
|
2019-04-17 15:11:31 +03:00
|
|
|
col.selec = col.selec_active;
|
2016-10-05 02:11:59 +03:00
|
|
|
files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h);
|
2015-08-13 18:28:53 +03:00
|
|
|
DrawList();
|
2015-08-17 15:45:56 +03:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2015-08-13 18:28:53 +03:00
|
|
|
}
|
|
|
|
if (active_panel==2)
|
|
|
|
{
|
2016-10-05 02:11:59 +03:00
|
|
|
files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2 - status_bar_h, files.item_h);
|
2015-08-13 18:28:53 +03:00
|
|
|
DrawList();
|
2015-08-17 15:45:56 +03:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
llist_copy(#files, #files_active);
|
2015-08-13 18:28:53 +03:00
|
|
|
strcpy(#path, #active_path);
|
2019-04-17 15:11:31 +03:00
|
|
|
col.selec = col.selec_active;
|
2016-10-05 02:11:59 +03:00
|
|
|
files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2 - status_bar_h, files.item_h);
|
2015-08-13 18:28:53 +03:00
|
|
|
DrawList();
|
2015-08-17 15:45:56 +03:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2015-08-13 18:28:53 +03:00
|
|
|
}
|
2015-08-09 22:08:57 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2015-08-07 17:55:16 +03:00
|
|
|
void List_ReDraw()
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2015-08-13 18:28:53 +03:00
|
|
|
int all_lines_h;
|
2018-10-01 19:41:14 +03:00
|
|
|
dword j;
|
2015-09-09 17:24:42 +03:00
|
|
|
static int old_cur_y, old_first;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2015-08-07 17:55:16 +03:00
|
|
|
files.CheckDoesValuesOkey(); //prevent some shit
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2015-08-07 17:55:16 +03:00
|
|
|
if (list_full_redraw) || (old_first != files.first)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2015-09-09 17:24:42 +03:00
|
|
|
old_cur_y = files.cur_y;
|
2015-08-07 17:55:16 +03:00
|
|
|
old_first = files.first;
|
|
|
|
list_full_redraw = false;
|
|
|
|
goto _ALL_LIST_REDRAW;
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
2015-09-09 17:24:42 +03:00
|
|
|
if (old_cur_y != files.cur_y)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2019-04-17 15:11:31 +03: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 17:24:42 +03:00
|
|
|
old_cur_y = files.cur_y;
|
2015-08-07 17:55:16 +03:00
|
|
|
return;
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
2015-08-07 17:55:16 +03:00
|
|
|
_ALL_LIST_REDRAW:
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2019-04-17 15:11:31 +03:00
|
|
|
for (j=0; j<files.visible; j++) {
|
|
|
|
if (files.cur_y-files.first!=j) Line_ReDraw(col.list_bg, j);
|
|
|
|
else Line_ReDraw(col.selec, files.cur_y-files.first);
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
//in the bottom
|
2015-09-09 17:24:42 +03:00
|
|
|
all_lines_h = j * files.item_h;
|
2019-04-17 15:11:31 +03:00
|
|
|
DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h, col.list_bg);
|
|
|
|
DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,col.list_vert_line);
|
|
|
|
DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,col.list_vert_line);
|
2013-04-01 00:25:54 +04:00
|
|
|
Scroll();
|
2018-09-19 11:57:00 +03:00
|
|
|
|
|
|
|
if (del_active) Del_Form();
|
2019-04-17 15:11:31 +03:00
|
|
|
if (new_element_active) && (col.selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name);
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
2019-04-17 00:21:19 +03:00
|
|
|
bool file_name_is_8_3(dword name)
|
|
|
|
{
|
|
|
|
int name_len = strlen(name);
|
|
|
|
int dot_pos = strrchr(name, '.');
|
|
|
|
if (name_len<=12)
|
|
|
|
{
|
|
|
|
if (dot_pos) {
|
|
|
|
if (name_len - dot_pos > 3) return false;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (name_len>8) return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2013-04-04 21:07:38 +04:00
|
|
|
|
2015-08-22 16:27:12 +03:00
|
|
|
void Line_ReDraw(dword bgcol, filenum){
|
2019-04-17 15:11:31 +03:00
|
|
|
dword text_col=col.list_gb_text,
|
2015-12-21 00:56:53 +03:00
|
|
|
ext1, attr,
|
|
|
|
file_offet,
|
|
|
|
file_name_off,
|
2018-10-31 19:50:25 +03:00
|
|
|
file_size=0,
|
2016-02-25 01:30:04 +03:00
|
|
|
y=filenum*files.item_h+files.y,
|
2018-03-20 20:03:14 +03:00
|
|
|
icon_y = files.item_h-icon_size/2+1+y;
|
2015-12-21 00:56:53 +03:00
|
|
|
BDVK file;
|
2020-05-15 22:59:10 +03:00
|
|
|
char full_path[4096];
|
2015-12-21 19:37:24 +03:00
|
|
|
char label_file_name[4096];
|
2014-04-20 13:01:20 +04:00
|
|
|
if (filenum==-1) return;
|
2017-10-06 00:38:09 +03:00
|
|
|
DrawBar(files.x,y,4,files.item_h,bgcol);
|
2018-03-20 20:03:14 +03:00
|
|
|
DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol);
|
|
|
|
if (files.item_h>icon_size) DrawBar(files.x+4,icon_y+icon_size-1,icon_size,y+files.item_h-icon_y-icon_size+1,bgcol);
|
2019-04-17 15:11:31 +03:00
|
|
|
if (colored_lines.checked) && (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line;
|
2018-10-01 19:41:14 +03:00
|
|
|
DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2020-05-23 14:26:58 +03:00
|
|
|
file_offet = items.get(filenum+files.first)*304 + buf+32;
|
2015-02-27 23:25:28 +03:00
|
|
|
attr = ESDWORD[file_offet];
|
2014-04-26 13:49:20 +04:00
|
|
|
file.selected = ESBYTE[file_offet+7];
|
|
|
|
file.sizelo = ESDWORD[file_offet+32];
|
2017-09-18 11:12:27 +03:00
|
|
|
file.sizehi = ESDWORD[file_offet+36];
|
2014-04-26 13:49:20 +04:00
|
|
|
file_name_off = file_offet+40;
|
2020-05-15 22:59:10 +03:00
|
|
|
sprintf(#full_path,"%s/%s",#path,file_name_off);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2015-02-27 23:25:28 +03:00
|
|
|
if (! TestBit(attr, 4) ) //file or folder?
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2015-08-09 22:08:57 +03:00
|
|
|
ext1 = strrchr(file_name_off,'.') + file_name_off;
|
2018-10-31 19:50:25 +03:00
|
|
|
if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing
|
|
|
|
file_size = ConvertSize64(file.sizelo, file.sizehi);
|
2019-04-17 15:11:31 +03:00
|
|
|
if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
else
|
2014-04-17 22:07:07 +04:00
|
|
|
{
|
2018-02-07 18:43:26 +03:00
|
|
|
if (!strcmp(file_name_off,"..")) ext1="<up>"; else {
|
2016-02-22 00:57:22 +03:00
|
|
|
ext1="<DIR>";
|
2019-04-17 15:11:31 +03:00
|
|
|
WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
|
2016-02-22 00:57:22 +03:00
|
|
|
}
|
2020-11-29 01:36:31 +03:00
|
|
|
if (chrnum(#path, '/')==1) && (streq(#path, "/kolibrios")==false) file_size = GetDeviceSizeLabel(#full_path);
|
2014-04-17 22:07:07 +04:00
|
|
|
}
|
2018-10-31 19:50:25 +03:00
|
|
|
if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58,
|
2019-04-17 15:11:31 +03:00
|
|
|
files.text_y+y+1, files.font_type, col.list_gb_text, file_size);
|
2020-05-15 22:59:10 +03:00
|
|
|
DrawIconByExtension(#full_path, ext1, files.x+4, icon_y, bgcol);
|
2014-04-17 22:07:07 +04:00
|
|
|
|
2019-04-17 15:11:31 +03:00
|
|
|
if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=col.list_text_hidden; //system or hiden?
|
|
|
|
if (bgcol==col.selec)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2019-04-17 00:21:19 +03:00
|
|
|
file_name_is_8_3(file_name_off);
|
2015-02-27 23:25:28 +03:00
|
|
|
itdir = TestBit(attr, 4);
|
2014-04-26 13:49:20 +04:00
|
|
|
strcpy(#file_name, file_name_off);
|
2016-10-30 22:17:46 +03:00
|
|
|
if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off);
|
|
|
|
else sprintf(#file_path,"%s/%s",#path,file_name_off);
|
2019-04-17 15:11:31 +03:00
|
|
|
if (text_col==col.list_text_hidden) {
|
|
|
|
text_col=MixColors(col.selec_text, col.list_text_hidden, 65);
|
|
|
|
} else text_col=col.selec_text;
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
2014-04-26 13:49:20 +04:00
|
|
|
if (file.selected) text_col=0xFF0000;
|
2016-12-21 22:50:13 +03:00
|
|
|
if (kfont.size.pt==9) || (!kfont.font)
|
2013-04-01 00:25:54 +04:00
|
|
|
{
|
2015-08-19 14:14:15 +03:00
|
|
|
if (Form.width>=480)
|
|
|
|
{
|
|
|
|
FileShow.start_x = files.x + 23;
|
|
|
|
FileShow.font_color = text_col;
|
|
|
|
FileShow.area_size_x = files.w - 164;
|
|
|
|
FileShow.text_pointer = file_name_off;
|
2017-09-23 14:02:57 +03:00
|
|
|
FileShow.start_y = files.text_y + y - 3;
|
2015-08-19 14:14:15 +03:00
|
|
|
PathShow_prepare stdcall(#FileShow);
|
|
|
|
PathShow_draw stdcall(#FileShow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-12-21 19:37:24 +03:00
|
|
|
strcpy(#label_file_name, file_name_off);
|
2016-12-21 22:50:13 +03:00
|
|
|
if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w)
|
2015-12-21 19:37:24 +03:00
|
|
|
{
|
2016-12-21 22:50:13 +03:00
|
|
|
while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) {
|
2015-12-21 19:37:24 +03:00
|
|
|
ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL;
|
|
|
|
}
|
|
|
|
strcpy(#label_file_name+strlen(#label_file_name)-2, "...");
|
|
|
|
}
|
2019-04-17 15:11:31 +03:00
|
|
|
kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y,
|
|
|
|
bgcol, text_col, kfont.size.pt, #label_file_name);
|
2013-04-01 00:25:54 +04:00
|
|
|
}
|
2019-04-17 15:11:31 +03:00
|
|
|
DrawBar(files.x+files.w-141,y,1,files.item_h,col.list_vert_line); //gray line 1
|
|
|
|
DrawBar(files.x+files.w-68,y,1,files.item_h,col.list_vert_line); //gray line 2
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-04 21:07:38 +04:00
|
|
|
void Open_Dir(dword dir_path, redraw){
|
2016-04-22 00:50:46 +03:00
|
|
|
int errornum, maxcount, i;
|
2013-04-04 21:07:38 +04:00
|
|
|
if (redraw!=ONLY_SHOW)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2016-10-17 04:31:59 +03:00
|
|
|
selected_count = 0;
|
2013-03-11 22:16:24 +04:00
|
|
|
if (buf) free(buf);
|
2013-04-04 21:07:38 +04:00
|
|
|
errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
|
|
|
|
if (errornum)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2016-01-01 19:51:53 +03:00
|
|
|
history.add(#path);
|
2020-04-14 14:29:55 +03:00
|
|
|
EventHistoryGoBack();
|
2013-03-11 22:16:24 +04:00
|
|
|
Write_Error(errornum);
|
|
|
|
return;
|
|
|
|
}
|
2015-09-09 17:24:42 +03:00
|
|
|
if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
2013-04-04 21:07:38 +04:00
|
|
|
if (files.count!=-1)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2018-04-19 23:12:07 +03:00
|
|
|
if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar();
|
2016-01-01 19:51:53 +03:00
|
|
|
history.add(#path);
|
2016-01-06 23:50:19 +03:00
|
|
|
SystemDiscs.Draw();
|
2015-09-09 17:24:42 +03:00
|
|
|
files.visible = files.h / files.item_h;
|
2015-07-21 04:10:37 +03:00
|
|
|
if (files.count < files.visible) files.visible = files.count;
|
2019-04-17 00:21:19 +03:00
|
|
|
if (!strncmp(dir_path, "/rd/1/",5))
|
|
|
|
dir_at_fat16 = true; else dir_at_fat16 = false;
|
2015-07-21 04:10:37 +03:00
|
|
|
if (redraw!=ONLY_SHOW) Sorting();
|
2015-08-07 17:55:16 +03:00
|
|
|
list_full_redraw = true;
|
2016-10-05 02:11:59 +03:00
|
|
|
if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();}
|
2016-10-05 22:33:49 +03:00
|
|
|
SetCurDir(dir_path);
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
2015-08-07 17:55:16 +03:00
|
|
|
if (files.count==-1) && (redraw!=ONLY_OPEN)
|
|
|
|
{
|
|
|
|
files.KeyHome();
|
2016-10-05 02:11:59 +03:00
|
|
|
if(!_not_draw) { list_full_redraw=true; DrawStatusBar(); List_ReDraw(); }
|
2015-08-07 17:55:16 +03:00
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline Sorting()
|
|
|
|
{
|
2018-10-20 00:13:36 +03:00
|
|
|
dword d=0, f=1;
|
2018-10-01 19:41:14 +03:00
|
|
|
int j=0;
|
2020-05-23 14:26:58 +03:00
|
|
|
dword tmp;
|
2014-04-26 13:49:20 +04:00
|
|
|
dword file_off;
|
2018-10-01 19:41:14 +03:00
|
|
|
|
2020-05-23 14:26:58 +03:00
|
|
|
items.drop();
|
|
|
|
|
2016-10-17 17:39:22 +03:00
|
|
|
if (!strcmp(#path,"/")) //do not sort root folder
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2020-05-23 14:26:58 +03:00
|
|
|
for(d=1;d<files.count;d++;) items.set(d, d);
|
2018-10-20 00:13:36 +03:00
|
|
|
count_dir = d;
|
2013-03-11 22:16:24 +04:00
|
|
|
return;
|
|
|
|
}
|
2015-07-21 04:10:37 +03: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 22:16:24 +04:00
|
|
|
{
|
2019-04-17 00:21:19 +03:00
|
|
|
if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40);
|
2014-04-26 13:49:20 +04:00
|
|
|
if (TestBit(ESDWORD[file_off],4)) //directory?
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2020-05-23 14:26:58 +03:00
|
|
|
items.set(d, j);
|
2018-10-20 00:13:36 +03:00
|
|
|
d++;
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-23 14:26:58 +03:00
|
|
|
items.set(files.count-f, j);
|
2018-10-20 00:13:36 +03:00
|
|
|
f++;
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
}
|
2018-10-20 00:13:36 +03:00
|
|
|
count_dir = d;
|
2013-04-01 00:25:54 +04:00
|
|
|
//sorting: files first, then folders
|
2018-10-20 00:13:36 +03: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 14:26:58 +03: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-20 00:13:36 +03:00
|
|
|
}
|
2015-07-19 21:45:59 +03:00
|
|
|
//make ".." first item in list
|
2020-05-23 14:26:58 +03: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 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Del_Form()
|
|
|
|
{
|
2015-03-09 18:14:09 +03:00
|
|
|
byte f_count[128];
|
2015-07-19 21:45:59 +03:00
|
|
|
int dform_x = files.w - 220 / 2 + files.x;
|
2020-05-27 23:38:18 +03:00
|
|
|
if (!selected_count) && (!strncmp(#file_name,"..",2)) return;
|
2013-10-09 22:10:23 +04:00
|
|
|
else
|
|
|
|
{
|
2013-10-10 11:16:37 +04:00
|
|
|
if (!files.count) return;
|
2015-12-26 14:03:17 +03:00
|
|
|
DrawEolitePopup(T_YES, T_NO);
|
2020-04-18 02:52:24 +03:00
|
|
|
WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,sc.work_text,T_DELETE_FILE);
|
2016-02-22 00:57:22 +03:00
|
|
|
if (selected_count)
|
2015-03-09 18:14:09 +03:00
|
|
|
{
|
2016-02-22 00:57:22 +03:00
|
|
|
sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2);
|
2020-04-18 02:52:24 +03:00
|
|
|
WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count);
|
2013-10-10 11:16:37 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-21 04:10:37 +03:00
|
|
|
if (strlen(#file_name)<28)
|
2015-03-09 18:14:09 +03:00
|
|
|
{
|
2020-04-18 02:52:24 +03:00
|
|
|
WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?");
|
|
|
|
WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name);
|
2015-03-09 18:14:09 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WriteText(164+dform_x,190,0x80,0,"...?");
|
|
|
|
ESI = 24;
|
|
|
|
WriteText(dform_x+20,190,0,0,#file_name);
|
|
|
|
}
|
2015-12-26 14:03:17 +03:00
|
|
|
}
|
2013-10-10 11:16:37 +04:00
|
|
|
del_active=1;
|
2013-10-09 22:10:23 +04:00
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
2015-08-07 17:55:16 +03:00
|
|
|
void SelectFileByName(dword that_file)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2015-08-07 17:55:16 +03:00
|
|
|
int ind;
|
|
|
|
files.KeyHome();
|
2015-12-21 00:56:53 +03:00
|
|
|
Open_Dir(#path,ONLY_OPEN);
|
2019-04-17 00:21:19 +03:00
|
|
|
if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file);
|
2020-12-13 15:31:53 +03:00
|
|
|
for (ind=files.count-1; ind>=0; ind--;) { if (!strcmpi(items.get(ind)*304+buf+72,that_file)) break; }
|
2015-09-09 17:24:42 +03:00
|
|
|
files.cur_y = ind - 1;
|
2015-08-07 17:55:16 +03:00
|
|
|
files.KeyDown();
|
2016-10-05 22:33:49 +03:00
|
|
|
DrawStatusBar();
|
2013-03-11 22:16:24 +04:00
|
|
|
List_ReDraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Dir_Up()
|
|
|
|
{
|
2018-10-01 19:41:14 +03:00
|
|
|
int iii;
|
2016-10-30 22:17:46 +03:00
|
|
|
char old_folder_name[4096];
|
2018-10-01 19:41:14 +03:00
|
|
|
iii=strlen(#path)-1;
|
|
|
|
if (iii==0) return;
|
|
|
|
iii = strrchr(#path, '/');
|
|
|
|
strcpy(#old_folder_name, #path+iii);
|
|
|
|
if (iii>1) path[iii-1]=NULL; else path[iii]=NULL;
|
2016-10-30 22:17:46 +03:00
|
|
|
SelectFileByName(#old_folder_name);
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
2020-12-16 13:23:59 +03:00
|
|
|
void EventOpenSelected()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
dword file_off;
|
|
|
|
for (i=0; i<files.count; i++) if (getElementSelectedFlag(i)) {
|
|
|
|
EDX = items.get(i)*304 + buf+32;
|
|
|
|
if (TestBit(ESDWORD[EDX], 4)) continue; //is foder
|
|
|
|
sprintf(#param,"%s/%s",#path, EDX+40);
|
|
|
|
RunProgram("/sys/@open", #param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventOpen(byte _new_window)
|
2013-04-01 00:25:54 +04:00
|
|
|
{
|
2020-12-16 13:23:59 +03:00
|
|
|
if (selected_count) && (!itdir) notify(T_USE_SHIFT_ENTER);
|
|
|
|
if (_new_window)
|
2015-02-21 23:12:52 +03:00
|
|
|
{
|
2020-12-16 13:23:59 +03:00
|
|
|
if (streq(#file_name,"..")) return;
|
|
|
|
RunProgram(I_Path, #file_path);
|
2015-02-21 23:12:52 +03:00
|
|
|
return;
|
|
|
|
}
|
2013-04-04 21:07:38 +04:00
|
|
|
if (!files.count) return;
|
2013-04-02 17:39:25 +04:00
|
|
|
if (!itdir)
|
2013-04-01 00:25:54 +04:00
|
|
|
{
|
2015-02-14 01:54:42 +03:00
|
|
|
if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
|
2013-04-01 00:25:54 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-23 14:54:26 +03:00
|
|
|
if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
|
2013-04-01 00:25:54 +04:00
|
|
|
strcpy(#path, #file_path);
|
2015-09-09 17:24:42 +03:00
|
|
|
files.first=files.cur_y=0;
|
2013-04-04 21:07:38 +04:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2013-04-01 00:25:54 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-14 14:29:55 +03:00
|
|
|
inline fastcall void EventHistoryGoBack()
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
|
|
|
char cur_folder[4096];
|
2015-12-16 19:13:34 +03:00
|
|
|
strcpy(#cur_folder, #path);
|
2016-01-01 19:51:53 +03:00
|
|
|
if (history.back()) {
|
|
|
|
strcpy(#path, history.current());
|
2015-12-17 01:08:01 +03:00
|
|
|
SelectFileByName(#cur_folder+strrchr(#cur_folder,'/'));
|
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
2015-02-12 15:52:49 +03:00
|
|
|
void ShowOpenWithDialog()
|
|
|
|
{
|
2017-07-04 18:14:51 +03:00
|
|
|
byte open_param[4097];
|
|
|
|
sprintf(#open_param,"~%s",#file_path);
|
|
|
|
RunProgram("/sys/@open", #open_param);
|
2015-02-12 15:52:49 +03:00
|
|
|
}
|
|
|
|
|
2020-05-06 18:53:34 +03:00
|
|
|
void NewElement()
|
2015-05-14 19:09:36 +03:00
|
|
|
{
|
2015-05-15 15:32:26 +03:00
|
|
|
BDVK element_info;
|
2015-07-19 21:45:59 +03:00
|
|
|
byte del_rezult, copy_rezult, info_result;
|
2020-05-06 18:53:34 +03:00
|
|
|
|
|
|
|
sprintf(#temp,"%s/%s",#path,new_file_ed.text);
|
|
|
|
info_result = GetFileInfo(#temp, #element_info);
|
|
|
|
switch(new_element_active)
|
2015-05-14 19:09:36 +03:00
|
|
|
{
|
2020-05-06 18:53:34 +03:00
|
|
|
case CREATE_FILE:
|
|
|
|
if (info_result==5)
|
|
|
|
{
|
|
|
|
CreateFile(0, 0, #temp);
|
|
|
|
if (EAX)
|
2015-05-15 15:32:26 +03:00
|
|
|
{
|
2020-05-06 18:53:34 +03:00
|
|
|
if (EAX==5) notify(NOT_CREATE_FILE);
|
|
|
|
else Write_Error(EAX);
|
2015-05-15 15:32:26 +03:00
|
|
|
}
|
2020-05-06 18:53:34 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
notify(FS_ITEM_ALREADY_EXISTS);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CREATE_FOLDER:
|
|
|
|
if (info_result==5)
|
|
|
|
{
|
|
|
|
CreateDir(#temp);
|
|
|
|
if (EAX)
|
2015-05-15 15:32:26 +03:00
|
|
|
{
|
2020-05-06 18:53:34 +03:00
|
|
|
if (EAX==5) notify(NOT_CREATE_FOLDER);
|
|
|
|
else Write_Error(EAX);
|
2015-06-20 01:23:51 +03:00
|
|
|
}
|
2020-05-06 18:53:34 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
notify(FS_ITEM_ALREADY_EXISTS);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RENAME_ITEM:
|
|
|
|
if (info_result==5)
|
|
|
|
{
|
|
|
|
if (itdir)
|
2015-06-20 01:23:51 +03:00
|
|
|
{
|
2020-05-06 18:53:34 +03:00
|
|
|
//rename only empty folders
|
|
|
|
if (del_rezult = DeleteFile(#file_path))
|
2015-06-20 01:23:51 +03:00
|
|
|
{
|
2020-05-06 18:53:34 +03:00
|
|
|
Write_Error(del_rezult);
|
|
|
|
return;
|
2015-06-20 01:23:51 +03:00
|
|
|
}
|
2020-05-06 18:53:34 +03:00
|
|
|
if (CreateDir(#temp)) CreateDir(#file_path);
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
SelectFileByName(new_file_ed.text);
|
2015-06-20 01:23:51 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-06 18:53:34 +03:00
|
|
|
if (copy_rezult = CopyFile(#file_path,#temp))
|
2015-06-20 01:23:51 +03:00
|
|
|
{
|
2020-05-06 18:53:34 +03:00
|
|
|
Write_Error(copy_rezult);
|
2015-06-20 01:23:51 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-06 18:53:34 +03:00
|
|
|
DeleteFile(#file_path);
|
|
|
|
SelectFileByName(new_file_ed.text);
|
2015-06-20 01:23:51 +03:00
|
|
|
}
|
|
|
|
}
|
2020-05-06 18:53:34 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
notify(FS_ITEM_ALREADY_EXISTS);
|
|
|
|
}
|
2015-05-14 19:09:36 +03:00
|
|
|
}
|
2015-05-15 15:32:26 +03:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2020-05-06 18:53:34 +03:00
|
|
|
SelectFileByName(new_file_ed.text);
|
|
|
|
EventClosePopinForm();
|
2015-05-14 19:09:36 +03:00
|
|
|
}
|
|
|
|
|
2015-06-20 01:23:51 +03:00
|
|
|
void NewElement_Form(byte crt, dword strng)
|
2015-05-14 19:09:36 +03:00
|
|
|
{
|
|
|
|
int dform_x=files.w-220/2+files.x;
|
2015-05-15 15:32:26 +03:00
|
|
|
if (!new_element_active)
|
2015-05-14 19:09:36 +03:00
|
|
|
{
|
2015-05-15 15:32:26 +03:00
|
|
|
new_element_active = crt;
|
2020-12-07 00:01:31 +03:00
|
|
|
edit_box_set_text stdcall (#new_file_ed, strng);
|
2015-05-14 19:09:36 +03:00
|
|
|
}
|
2015-12-26 14:03:17 +03:00
|
|
|
if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL);
|
|
|
|
else DrawEolitePopup(T_CREATE, T_CANCEL);
|
2016-11-05 13:13:29 +03:00
|
|
|
new_file_ed.left = dform_x+10;
|
2016-02-22 00:57:22 +03:00
|
|
|
DrawEditBox(#new_file_ed);
|
2015-05-14 19:09:36 +03:00
|
|
|
}
|
|
|
|
|
2015-07-16 04:44:30 +03:00
|
|
|
void FnProcess(byte N)
|
2013-04-01 00:25:54 +04:00
|
|
|
{
|
|
|
|
switch(N)
|
|
|
|
{
|
|
|
|
case 1:
|
2020-04-14 14:29:55 +03:00
|
|
|
if (!active_about) {
|
2015-07-16 04:44:30 +03:00
|
|
|
about_stak = malloc(4096);
|
2019-04-17 00:21:19 +03:00
|
|
|
about_thread_id = CreateThread(#about_dialog,about_stak+4092);
|
2013-12-22 04:09:21 +04:00
|
|
|
break;
|
2020-04-14 14:29:55 +03:00
|
|
|
} else {
|
2019-04-17 00:21:19 +03:00
|
|
|
ActivateWindow(GetProcessSlot(about_thread_id));
|
2013-12-22 04:09:21 +04:00
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
|
|
|
case 2:
|
2020-04-14 14:29:55 +03:00
|
|
|
if (files.count) NewElement_Form(RENAME_ITEM, #file_name);
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
|
|
|
case 3:
|
2020-04-14 14:29:55 +03:00
|
|
|
if (files.count) && (!itdir) RunProgram("/sys/tinypad", #file_path);
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
|
|
|
case 4:
|
2020-04-14 14:29:55 +03:00
|
|
|
if (files.count) && (!itdir) RunProgram("/sys/develop/heed", #file_path);
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
2013-04-02 17:33:32 +04:00
|
|
|
case 5: //refresh cur dir & devs
|
2018-04-19 23:12:07 +03:00
|
|
|
if (two_panels.checked)
|
2015-08-13 18:28:53 +03:00
|
|
|
{
|
2015-08-14 17:47:36 +03:00
|
|
|
DrawFilePanels();
|
2015-08-13 18:28:53 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Tip(56, T_DEVICES, 55, "-");
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
pause(10);
|
2016-01-06 23:50:19 +03:00
|
|
|
SystemDiscs.Get();
|
2015-08-13 18:28:53 +03:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2015-08-14 17:47:36 +03:00
|
|
|
DrawDeviceAndActionsLeftPanel();
|
2015-08-13 18:28:53 +03:00
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
|
|
|
case 6:
|
2015-07-19 21:45:59 +03:00
|
|
|
NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER);
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
|
|
|
case 7:
|
2015-07-19 21:45:59 +03:00
|
|
|
NewElement_Form(CREATE_FILE, T_NEW_FILE);
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
2015-02-22 21:42:51 +03:00
|
|
|
case 8:
|
2020-05-06 18:53:34 +03:00
|
|
|
EventShowProperties();
|
2015-02-22 21:42:51 +03:00
|
|
|
break;
|
2013-04-01 00:25:54 +04:00
|
|
|
case 10: //F10
|
2015-08-20 18:04:18 +03:00
|
|
|
if (!active_settings)
|
2015-02-17 19:46:38 +03:00
|
|
|
{
|
2015-07-16 04:44:30 +03:00
|
|
|
settings_stak = malloc(4096);
|
|
|
|
settings_window = CreateThread(#settings_dialog, settings_stak+4092);
|
2015-02-17 19:46:38 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ActivateWindow(GetProcessSlot(settings_window));
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-18 00:24:56 +03:00
|
|
|
void ChangeActivePanel()
|
|
|
|
{
|
|
|
|
llist_copy(#files_active, #files_inactive);
|
|
|
|
llist_copy(#files_inactive, #files);
|
|
|
|
strcpy(#active_path, #inactive_path);
|
|
|
|
strcpy(#inactive_path, #path);
|
|
|
|
DrawFilePanels();
|
|
|
|
}
|
|
|
|
|
2018-10-01 19:41:14 +03:00
|
|
|
void EventSelectFileByKeyPress()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i=files.cur_y+1; i<files.count; i++)
|
|
|
|
{
|
2020-05-23 14:26:58 +03:00
|
|
|
strcpy(#temp, items.get(i)*304+buf+72);
|
2018-10-01 19:41:14 +03:00
|
|
|
if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
|
|
|
|
{
|
|
|
|
files.cur_y = i - 1;
|
|
|
|
files.KeyDown();
|
|
|
|
List_ReDraw();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-31 19:50:25 +03:00
|
|
|
dword GetDeviceSizeLabel(dword path)
|
|
|
|
{
|
|
|
|
BDVK bdvk;
|
|
|
|
char cdname[8];
|
|
|
|
if (ESBYTE[path+1] == '/') path++;
|
|
|
|
if (ESBYTE[path+1] == 'c') && (ESBYTE[path+2] == 'd')
|
2018-11-01 12:23:57 +03:00
|
|
|
&& (ESBYTE[path+4] == 0) return 0;
|
2018-10-31 19:50:25 +03:00
|
|
|
GetFileInfo(path, #bdvk);
|
|
|
|
return ConvertSize64(bdvk.sizelo, bdvk.sizehi);
|
|
|
|
}
|
|
|
|
|
2018-10-01 19:41:14 +03: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()
|
|
|
|
{
|
|
|
|
if(GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) {
|
|
|
|
FnProcess(5);
|
|
|
|
}
|
|
|
|
if(two_panels.checked)
|
|
|
|
{
|
|
|
|
if(GetRealFileCountInFolder(#inactive_path) != files_inactive.count) {
|
|
|
|
ChangeActivePanel();
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
ChangeActivePanel();
|
|
|
|
}
|
|
|
|
if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(GetRealFileCountInFolder(#path) != files.count) Open_Dir(#path,WITH_REDRAW);
|
|
|
|
}
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
|
2019-04-17 00:21:19 +03: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);
|
|
|
|
DrawList();
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
SelectFileByName(#selected_filename);
|
|
|
|
}
|
|
|
|
|
2020-04-14 14:29:55 +03:00
|
|
|
void EventHistoryGoForward()
|
|
|
|
{
|
|
|
|
if (history.forward()) {
|
|
|
|
strcpy(#path, history.current());
|
|
|
|
files.KeyHome();
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-20 12:37:37 +03:00
|
|
|
void EventOpenNewEolite()
|
|
|
|
{
|
|
|
|
RunProgram(I_Path, #path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventOpenConsoleHere()
|
|
|
|
{
|
|
|
|
sprintf(#param, "pwd cd %s", #path);
|
|
|
|
RunProgram("/sys/shell", #param);
|
|
|
|
}
|
|
|
|
|
2020-04-14 14:29:55 +03: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);
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-06 18:53:34 +03:00
|
|
|
void EventPaste() {
|
|
|
|
char paste_line[4096+6];
|
|
|
|
sprintf(#paste_line, "-v%i %s", cut_active, #path);
|
|
|
|
RunProgram(#program_path, #paste_line);
|
|
|
|
EventClosePopinForm();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventDelete()
|
|
|
|
char line_param[4096+5];
|
|
|
|
{
|
|
|
|
EventClosePopinForm();
|
|
|
|
if (!selected_count) {
|
|
|
|
sprintf(#line_param, "-d %s", #file_path);
|
|
|
|
RunProgram(#program_path, #line_param);
|
|
|
|
} else {
|
|
|
|
delete_stak = malloc(40000);
|
|
|
|
CreateThread(#DeleteSelectedElements,delete_stak+40000-4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventClosePopinForm()
|
|
|
|
{
|
|
|
|
del_active=0;
|
|
|
|
new_element_active = 0;
|
|
|
|
draw_window();
|
|
|
|
DeleteButton(POPUP_BTN1);
|
|
|
|
DeleteButton(POPUP_BTN2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventShowProperties()
|
|
|
|
char line_param[4096+5];
|
|
|
|
{
|
|
|
|
if (!selected_count) {
|
|
|
|
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 18:07:13 +03:00
|
|
|
void EventChooseFile(int _id)
|
|
|
|
{
|
|
|
|
if (getElementSelectedFlag(_id) == true) {
|
|
|
|
setElementSelectedFlag(_id, false);
|
|
|
|
} else {
|
|
|
|
setElementSelectedFlag(_id, true);
|
|
|
|
}
|
2020-05-27 23:38:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void EventChooseFilesRange(int _start, _end)
|
|
|
|
{
|
|
|
|
if (_start > _end) _start >< _end;
|
|
|
|
if (_end - _start > 1) list_full_redraw = true;
|
|
|
|
while (_start < _end) {
|
|
|
|
EventChooseFile(_start);
|
|
|
|
_start++;
|
|
|
|
}
|
2020-05-26 18:07:13 +03:00
|
|
|
DrawStatusBar();
|
2020-05-27 23:38:18 +03:00
|
|
|
List_ReDraw();
|
2020-05-26 18:07:13 +03:00
|
|
|
}
|
|
|
|
|
2020-05-27 23:38:18 +03:00
|
|
|
void EventChooseAllFiles(dword state)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i=0; i<files.count; i++) setElementSelectedFlag(i, state);
|
|
|
|
List_ReDraw();
|
|
|
|
DrawStatusBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
stop:
|