2018-03-22 00:26:31 +01:00
|
|
|
//Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2018
|
2013-03-11 19:16:24 +01:00
|
|
|
//GNU GPL licence.
|
|
|
|
|
2018-09-14 20:07:55 +02:00
|
|
|
// 70.5 - get volume info and label
|
|
|
|
|
2013-10-14 00:18:41 +02:00
|
|
|
#ifndef AUTOBUILD
|
|
|
|
#include "lang.h--"
|
|
|
|
#endif
|
|
|
|
|
2013-03-11 19:16:24 +01:00
|
|
|
//libraries
|
2018-04-03 17:45:21 +02:00
|
|
|
#define MEMSIZE 1024 * 720
|
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/menu.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
|
|
|
|
2013-03-11 19:16:24 +01:00
|
|
|
//images
|
2017-10-05 23:38:09 +02:00
|
|
|
#include "imgs/left_p.txt"
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2016-02-21 22:57:22 +01:00
|
|
|
//Button IDs
|
|
|
|
enum {
|
|
|
|
POPUP_BTN1 = 201,
|
2016-02-24 17:49:57 +01:00
|
|
|
POPUP_BTN2 = 202,
|
|
|
|
BREADCRUMB_ID = 300
|
2016-02-21 22:57:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
//NewElement options
|
|
|
|
enum {
|
|
|
|
CREATE_FILE=1,
|
|
|
|
CREATE_FOLDER,
|
|
|
|
RENAME_ITEM
|
|
|
|
};
|
|
|
|
|
|
|
|
//OpenDir options
|
|
|
|
enum {
|
|
|
|
ONLY_SHOW,
|
|
|
|
WITH_REDRAW,
|
|
|
|
ONLY_OPEN
|
|
|
|
};
|
2013-04-04 19:07:38 +02:00
|
|
|
|
2017-09-05 15:38:37 +02:00
|
|
|
dword col_padding, col_selec, col_lpanel, col_work, col_graph, col_list_line=0xDDD7CF;
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2013-03-31 22:25:54 +02:00
|
|
|
int toolbar_buttons_x[7]={9,46,85,134,167,203};
|
|
|
|
|
2013-10-29 22:50:46 +01:00
|
|
|
byte active_about=0;
|
2013-10-22 00:24:36 +02:00
|
|
|
word about_window;
|
2015-02-17 17:46:38 +01:00
|
|
|
word settings_window;
|
2015-08-20 17:04:18 +02:00
|
|
|
byte active_settings=0;
|
2015-07-23 13:54:26 +02:00
|
|
|
dword _not_draw = false;
|
2013-10-29 22:50:46 +01:00
|
|
|
byte menu_call_mouse=0;
|
2016-04-19 20:42:13 +02:00
|
|
|
byte exif_load=0;
|
2013-10-29 22:50:46 +01:00
|
|
|
|
2015-08-17 14:45:56 +02:00
|
|
|
byte del_active=0;
|
|
|
|
byte new_element_active=0;
|
2015-08-09 21:08:57 +02:00
|
|
|
|
2015-08-17 14:45:56 +02:00
|
|
|
llist files, files_active, files_inactive;
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2015-08-07 16:55:16 +02:00
|
|
|
byte list_full_redraw;
|
|
|
|
|
2015-08-09 21:08:57 +02:00
|
|
|
dword buf;
|
|
|
|
dword file_mas[6898];
|
|
|
|
int selected_count;
|
2016-04-21 23:50:46 +02:00
|
|
|
int count_dir;
|
2015-08-09 21:08:57 +02:00
|
|
|
|
2013-03-31 22:25:54 +02:00
|
|
|
byte
|
2013-03-11 19:16:24 +01:00
|
|
|
path[4096],
|
|
|
|
file_path[4096],
|
2013-03-23 01:00:11 +01:00
|
|
|
file_name[256],
|
2015-05-14 18:09:36 +02:00
|
|
|
new_element_name[256],
|
2015-08-09 21:08:57 +02:00
|
|
|
temp[4096],
|
2013-04-02 15:39:25 +02:00
|
|
|
itdir;
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2015-08-13 17:28:53 +02:00
|
|
|
char active_path[4096], inactive_path[4096];
|
|
|
|
|
2018-03-22 00:26:31 +01:00
|
|
|
dword eolite_ini_path[4096];
|
|
|
|
_ini ini;
|
2015-02-21 13:24:30 +01:00
|
|
|
|
2015-08-09 21:08:57 +02:00
|
|
|
char scroll_used=false;
|
2015-08-07 17:12:03 +02:00
|
|
|
|
2015-09-05 19:50:37 +02:00
|
|
|
dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak,delete_stak;
|
2015-07-23 14:15:53 +02:00
|
|
|
|
2013-03-11 19:16:24 +01:00
|
|
|
proc_info Form;
|
2018-04-21 14:28:00 +02:00
|
|
|
int sc_slider_h;
|
2013-03-31 22:25:54 +02:00
|
|
|
int j, i;
|
2013-10-15 01:16:04 +02:00
|
|
|
int action_buf;
|
2014-04-20 15:00:51 +02:00
|
|
|
int rand_n;
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2016-02-25 15:07:16 +01:00
|
|
|
char sort_num=2;
|
2018-04-19 22:12:07 +02:00
|
|
|
int active_panel=1;
|
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
|
|
|
|
2016-10-05 01:11:59 +02:00
|
|
|
#define STATUS_BAR_H 16;
|
|
|
|
int status_bar_h = 0;
|
|
|
|
|
2018-03-20 18:03:14 +01:00
|
|
|
int icon_size = 16;
|
|
|
|
|
2018-04-21 14:28:00 +02:00
|
|
|
edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000,
|
|
|
|
248,#new_element_name,0,100000000000010b,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};
|
2015-08-07 16:55:16 +02:00
|
|
|
byte cmd_free=0;
|
2015-08-09 21:08:57 +02:00
|
|
|
#include "include\translations.h"
|
2015-09-05 19:50:37 +02:00
|
|
|
#include "include\fs.h"
|
2015-10-07 23:09:49 +02:00
|
|
|
|
2015-08-19 15:17:24 +02:00
|
|
|
#include "include\settings.h"
|
2015-09-05 19:50:37 +02:00
|
|
|
#include "include\progress_dialog.h"
|
2013-10-17 01:48:20 +02:00
|
|
|
#include "include\copy.h"
|
2015-02-20 16:25:51 +01:00
|
|
|
#include "include\gui.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"
|
2016-02-21 22:57:22 +01:00
|
|
|
#include "include\delete.h"
|
2013-10-17 01:48:20 +02:00
|
|
|
#include "include\about.h"
|
2015-02-22 19:42:51 +01:00
|
|
|
#include "include\properties.h"
|
2016-02-24 17:49:57 +01:00
|
|
|
#include "include\breadcrumbs.h"
|
2013-10-23 19:55:07 +02:00
|
|
|
|
2013-03-11 19:16:24 +01:00
|
|
|
void main()
|
|
|
|
{
|
2018-08-12 11:46:12 +02:00
|
|
|
byte update = 0;
|
|
|
|
dword files_count = 0;
|
|
|
|
dword countPathFile = 0;
|
|
|
|
dword countPathFile2 = 0;
|
2018-08-12 00:49:29 +02:00
|
|
|
dword files_y = 0;
|
2018-08-12 02:40:47 +02:00
|
|
|
dword countDisk = 0;
|
2016-02-24 17:49:57 +01:00
|
|
|
dword id;
|
2018-08-12 02:40:47 +02:00
|
|
|
dword devbuf;
|
2015-10-07 23:09:49 +02:00
|
|
|
byte count_sl = 0;
|
2015-08-19 15:17:24 +02:00
|
|
|
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
|
2016-11-21 21:25:00 +01:00
|
|
|
char stats;
|
2014-04-20 15:00:51 +02:00
|
|
|
rand_n = random(40);
|
2015-08-02 17:15:15 +02:00
|
|
|
|
2018-08-12 02:40:47 +02:00
|
|
|
devbuf = malloc(10000);
|
|
|
|
|
2015-07-29 22:43:05 +02:00
|
|
|
load_dll(boxlib, #box_lib_init,0);
|
2015-12-20 22:56:53 +01:00
|
|
|
load_dll(libini, #lib_init,1);
|
2017-10-05 23:38:09 +02:00
|
|
|
load_dll(libio, #libio_init,1);
|
|
|
|
load_dll(libimg, #libimg_init,1);
|
2015-10-07 23:09:49 +02:00
|
|
|
|
2015-02-21 13:24:30 +01:00
|
|
|
LoadIniSettings();
|
2016-01-06 21:50:19 +01:00
|
|
|
SystemDiscs.Get();
|
2013-10-23 19:55:07 +02:00
|
|
|
SetAppColors();
|
2017-10-03 14:10:48 +02:00
|
|
|
|
2017-10-05 23:38:09 +02:00
|
|
|
Libimg_LoadImage(#icons16_default, "/sys/icons16.png");
|
|
|
|
Libimg_LoadImage(#icons16_selected, "/sys/icons16.png");
|
2018-03-22 15:36:04 +01:00
|
|
|
Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffFFFfff, col_selec);
|
|
|
|
Libimg_ReplaceColor(icons16_selected.image, icons16_selected.w, icons16_selected.h, 0xffCACBD6, MixColors(col_selec, 0, 200));
|
2017-10-05 23:38:09 +02:00
|
|
|
|
2017-10-03 14:10:48 +02:00
|
|
|
//-p just show file/folder properties dialog
|
|
|
|
if (param) && (param[0]=='-') && (param[1]=='p')
|
|
|
|
{
|
|
|
|
strcpy(#file_path, #param + 3);
|
|
|
|
strcpy(#file_name, #param + strrchr(#param, '/'));
|
|
|
|
properties_dialog();
|
|
|
|
ExitProcess();
|
|
|
|
}
|
|
|
|
|
2013-03-11 19:16:24 +01:00
|
|
|
if (param)
|
|
|
|
{
|
2018-04-20 11:43:15 +02:00
|
|
|
if (strlen(#param)>1) && (param[strlen(#param)-1]=='/') param[strlen(#param)-1]=NULL; //no "/" at the end
|
2017-07-04 17:14:51 +02:00
|
|
|
|
|
|
|
if (dir_exists(#param)==true)
|
|
|
|
{
|
|
|
|
strcpy(#path, #param);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
notify(T_NOTIFY_APP_PARAM_WRONG);
|
|
|
|
}
|
2017-10-03 14:10:48 +02:00
|
|
|
}
|
2015-09-29 22:05:29 +02:00
|
|
|
|
2013-03-11 19:16:24 +01:00
|
|
|
Open_Dir(#path,ONLY_OPEN);
|
2015-08-17 14:45:56 +02:00
|
|
|
strcpy(#inactive_path, #path);
|
|
|
|
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);
|
2015-07-21 03:10:37 +02:00
|
|
|
loop(){
|
2018-08-11 22:02:54 +02:00
|
|
|
switch(WaitEventTimeout(50))
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
|
|
|
case evMouse:
|
2017-10-05 11:37:50 +02:00
|
|
|
if (del_active) || (Form.status_window>2) break;
|
|
|
|
if (new_element_active)
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
|
|
|
edit_box_mouse stdcall(#new_file_ed);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-08-02 00:08:58 +02:00
|
|
|
mouse.get();
|
2015-07-21 03:10:37 +02:00
|
|
|
|
2015-08-02 00:08:58 +02:00
|
|
|
if (!mouse.mkm) && (stats>0) stats = 0;
|
2015-08-03 01:43:40 +02:00
|
|
|
if (mouse.mkm) && (!stats)
|
2015-04-02 23:27:51 +02:00
|
|
|
{
|
2015-08-02 00:08:58 +02:00
|
|
|
x_old = mouse.x;
|
|
|
|
y_old = mouse.y;
|
2015-07-21 03:10:37 +02:00
|
|
|
stats = 1;
|
|
|
|
}
|
2015-08-02 00:08:58 +02:00
|
|
|
if (mouse.mkm) && (stats==1)
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
2015-08-02 00:08:58 +02:00
|
|
|
dif_x = mouse.x-x_old;
|
|
|
|
dif_y = mouse.y-y_old;
|
2015-07-21 03:10:37 +02:00
|
|
|
adif_x = fabs(dif_x);
|
|
|
|
adif_y = fabs(dif_y);
|
|
|
|
|
|
|
|
if (adif_x>adif_y)
|
2015-04-02 23:27:51 +02:00
|
|
|
{
|
2015-07-21 03:10:37 +02:00
|
|
|
if (dif_x > 150)
|
|
|
|
{
|
2016-01-01 17:51:53 +01:00
|
|
|
if (history.forward())
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
2016-01-01 17:51:53 +01:00
|
|
|
strcpy(#path, history.current());
|
2015-08-07 16:55:16 +02:00
|
|
|
files.KeyHome();
|
2015-07-21 03:10:37 +02:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
}
|
|
|
|
stats = 0;
|
|
|
|
}
|
|
|
|
if (dif_x < -150)
|
|
|
|
{
|
|
|
|
GoBack();
|
|
|
|
stats = 0;
|
|
|
|
}
|
2015-04-02 23:27:51 +02:00
|
|
|
}
|
2015-07-21 03:10:37 +02:00
|
|
|
else
|
2015-04-02 23:27:51 +02:00
|
|
|
{
|
2015-07-21 03:10:37 +02:00
|
|
|
if (dif_y < -100)
|
|
|
|
{
|
|
|
|
Dir_Up();
|
|
|
|
stats = 0;
|
|
|
|
}
|
2015-04-02 23:27:51 +02:00
|
|
|
}
|
2015-07-21 03:10:37 +02:00
|
|
|
}
|
2016-02-11 02:07:04 +01:00
|
|
|
if (files.MouseOver(mouse.x, mouse.y))
|
2015-04-02 23:27:51 +02:00
|
|
|
{
|
2016-02-11 02:07:04 +01:00
|
|
|
//select file
|
2016-02-21 22:57:22 +01:00
|
|
|
if (mouse.key&MOUSE_LEFT) && (mouse.up)
|
2016-02-11 02:07:04 +01:00
|
|
|
{
|
2017-10-26 22:17:02 +02:00
|
|
|
if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw(); else {
|
|
|
|
if (mouse.y - files.y / files.item_h + files.first == files.cur_y) Open(0);
|
|
|
|
}
|
2016-02-11 02:07:04 +01:00
|
|
|
}
|
|
|
|
//file menu
|
2016-02-21 22:57:22 +01:00
|
|
|
if (mouse.key&MOUSE_RIGHT)
|
2015-07-12 01:45:19 +02:00
|
|
|
{
|
2015-07-21 03:10:37 +02:00
|
|
|
menu_call_mouse = 1;
|
2016-02-21 22:57:22 +01:00
|
|
|
if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw();
|
2017-09-12 17:32:38 +02:00
|
|
|
if (getElementSelectedFlag(files.cur_y) == false) selected_count = 0; //on redraw selection would be flashed, see [L001]
|
2016-02-21 22:57:22 +01:00
|
|
|
menu_stak = malloc(4096);
|
|
|
|
CreateThread(#FileMenu,menu_stak+4092);
|
2015-07-21 03:10:37 +02:00
|
|
|
break;
|
2015-07-12 01:45:19 +02:00
|
|
|
}
|
|
|
|
}
|
2015-07-21 03:10:37 +02:00
|
|
|
|
2015-08-02 00:08:58 +02:00
|
|
|
if (mouse.vert)
|
2015-07-12 01:45:19 +02:00
|
|
|
{
|
2015-08-02 00:08:58 +02:00
|
|
|
if (files.MouseScroll(mouse.vert)) List_ReDraw();
|
2015-07-12 01:45:19 +02:00
|
|
|
break;
|
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
|
2015-08-14 16:47:36 +02:00
|
|
|
if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y<files.y)
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2015-08-14 16:47:36 +02:00
|
|
|
if (mouse.lkm==1) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,0xC7C7C7,0xFFFFFF);
|
2015-08-02 00:08:58 +02:00
|
|
|
WHILE (mouse.lkm==1) && (files.first>0)
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
|
|
|
pause(8);
|
|
|
|
files.first--;
|
|
|
|
List_ReDraw();
|
2015-08-02 00:08:58 +02:00
|
|
|
mouse.get();
|
2015-07-21 03:10:37 +02:00
|
|
|
}
|
2015-08-14 16:47:36 +02:00
|
|
|
DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,0xFFFFFF,0xC7C7C7);
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
2015-08-14 16:47:36 +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)
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2015-08-14 16:47:36 +02:00
|
|
|
if (mouse.lkm==1) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,0xC7C7C7,0xFFFFFF);
|
2015-08-02 00:08:58 +02:00
|
|
|
while (mouse.lkm==1) && (files.first<files.count-files.visible)
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
|
|
|
pause(8);
|
|
|
|
files.first++;
|
|
|
|
List_ReDraw();
|
2015-08-02 00:08:58 +02:00
|
|
|
mouse.get();
|
2015-07-21 03:10:37 +02:00
|
|
|
}
|
2015-08-14 16:47:36 +02:00
|
|
|
DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,0xFFFFFF,0xC7C7C7);
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
2015-07-21 03:10:37 +02:00
|
|
|
//Scrooll
|
2015-08-07 17:12:03 +02:00
|
|
|
if (!mouse.lkm) && (scroll_used) { scroll_used=false; Scroll(); }
|
2015-08-14 16:47:36 +02:00
|
|
|
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();}
|
2015-07-21 03:10:37 +02:00
|
|
|
|
|
|
|
if (scroll_used)
|
|
|
|
{
|
2015-08-02 00:08:58 +02:00
|
|
|
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
|
2015-08-14 16:47:36 +02:00
|
|
|
id = files.first;
|
|
|
|
files.first = -sc_slider_h / 2 + mouse.y -j -files.y * files.count;
|
2015-08-18 17:02:42 +02:00
|
|
|
files.first /= files.h - 18;
|
2015-07-21 03:10:37 +02:00
|
|
|
if (files.visible+files.first>files.count) files.first=files.count-files.visible;
|
2015-08-18 17:02:42 +02:00
|
|
|
if (files.first<0) files.first=0;
|
2015-07-21 03:10:37 +02:00
|
|
|
if (id!=files.first) List_ReDraw();
|
2015-08-13 17:28:53 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2018-04-19 22:12:07 +02:00
|
|
|
if (two_panels.checked) && (mouse.y > files.y) && (mouse.down) {
|
2015-08-13 17:28:53 +02:00
|
|
|
if (mouse.x<Form.cwidth/2)
|
|
|
|
{
|
|
|
|
if (active_panel!=1)
|
|
|
|
{
|
|
|
|
active_panel = 1;
|
2015-08-17 23:24:56 +02:00
|
|
|
ChangeActivePanel();
|
2015-08-13 17:28:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (active_panel!=2)
|
|
|
|
{
|
|
|
|
active_panel = 2;
|
2015-08-17 23:24:56 +02:00
|
|
|
ChangeActivePanel();
|
2015-08-13 17:28:53 +02:00
|
|
|
}
|
|
|
|
}
|
2015-07-21 03:10:37 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
//Button pressed-----------------------------------------------------------------------------
|
|
|
|
case evButton:
|
2016-02-21 22:57:22 +01:00
|
|
|
id=GetButtonID();
|
2015-07-21 03:10:37 +02:00
|
|
|
switch(id)
|
|
|
|
{
|
2017-10-05 23:38:09 +02:00
|
|
|
case CLOSE_BTN:
|
2016-02-21 22:57:22 +01:00
|
|
|
KillProcess(about_window);
|
|
|
|
SaveIniSettings();
|
|
|
|
ExitProcess();
|
2015-07-21 03:10:37 +02:00
|
|
|
case 21: //Back
|
|
|
|
GoBack();
|
|
|
|
break;
|
|
|
|
case 22: //Forward
|
2016-01-01 17:51:53 +01:00
|
|
|
if (history.forward())
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
2016-01-01 17:51:53 +01:00
|
|
|
strcpy(#path, history.current());
|
2015-08-07 16:55:16 +02:00
|
|
|
files.KeyHome();
|
2015-07-21 03:10:37 +02:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
}
|
|
|
|
break;
|
2015-07-23 14:15:53 +02:00
|
|
|
case 23:
|
2013-03-11 19:16:24 +01:00
|
|
|
Dir_Up();
|
|
|
|
break;
|
2015-07-23 14:15:53 +02:00
|
|
|
case 24:
|
2013-04-04 19:07:38 +02:00
|
|
|
Copy(#file_path, CUT);
|
|
|
|
break;
|
2015-07-23 14:15:53 +02:00
|
|
|
case 25:
|
2013-04-04 19:07:38 +02:00
|
|
|
Copy(#file_path, NOCUT);
|
2013-03-11 19:16:24 +01:00
|
|
|
break;
|
2015-07-23 14:15:53 +02:00
|
|
|
case 26:
|
|
|
|
Paste();
|
2013-03-11 19:16:24 +01:00
|
|
|
break;
|
2015-08-17 14:45:56 +02:00
|
|
|
case 31...33: //sorting
|
|
|
|
sort_num = id - 30;
|
|
|
|
DrawList();
|
2015-07-21 03:10:37 +02:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2013-03-11 19:16:24 +01:00
|
|
|
break;
|
2015-07-21 03:10:37 +02:00
|
|
|
case 50...60: //Actions
|
|
|
|
FnProcess(id-50);
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
2015-07-21 03:10:37 +02:00
|
|
|
case 100...120:
|
2016-01-06 21:50:19 +01:00
|
|
|
SystemDiscs.Click(id-100);
|
2015-08-09 21:08:57 +02:00
|
|
|
break;
|
2016-03-02 18:44:25 +01:00
|
|
|
case POPUP_BTN1...POPUP_BTN2:
|
|
|
|
if (del_active) Del_File(id-POPUP_BTN2);
|
2016-02-21 22:57:22 +01:00
|
|
|
if (new_element_active) NewElement(id-POPUP_BTN2);
|
|
|
|
DeleteButton(POPUP_BTN1);
|
|
|
|
DeleteButton(POPUP_BTN2);
|
|
|
|
break;
|
2017-10-05 23:38:09 +02:00
|
|
|
case BREADCRUMB_ID...360:
|
2016-02-24 17:49:57 +01:00
|
|
|
ClickOnBreadCrumb(id-BREADCRUMB_ID);
|
|
|
|
break;
|
2015-07-21 03:10:37 +02:00
|
|
|
}
|
|
|
|
break;
|
2017-04-11 18:24:25 +02:00
|
|
|
|
2015-07-21 03:10:37 +02:00
|
|
|
//Key pressed-----------------------------------------------------------------------------
|
|
|
|
case evKey:
|
2015-08-10 12:47:21 +02:00
|
|
|
GetKeys();
|
2015-08-09 21:08:57 +02:00
|
|
|
|
2015-07-21 03:10:37 +02:00
|
|
|
if (Form.status_window>2) break;
|
|
|
|
if (del_active)
|
|
|
|
{
|
2015-08-10 12:47:21 +02:00
|
|
|
if (key_scancode == SCAN_CODE_ENTER) Del_File(true);
|
|
|
|
if (key_scancode == SCAN_CODE_ESC) Del_File(false);
|
2015-07-21 03:10:37 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (new_element_active)
|
|
|
|
{
|
2015-12-20 22:56:53 +01:00
|
|
|
if (key_scancode == SCAN_CODE_ENTER) NewElement(true);
|
|
|
|
if (key_scancode == SCAN_CODE_ESC) NewElement(false);
|
2016-10-31 13:37:22 +01:00
|
|
|
EAX = key_editbox;
|
2015-07-21 03:10:37 +02:00
|
|
|
edit_box_key stdcall (#new_file_ed);
|
|
|
|
break;
|
|
|
|
}
|
2015-08-10 12:47:21 +02:00
|
|
|
if (files.ProcessKey(key_scancode))
|
2015-08-07 16:55:16 +02:00
|
|
|
{
|
|
|
|
List_ReDraw();
|
|
|
|
break;
|
|
|
|
}
|
2015-08-09 21:08:57 +02:00
|
|
|
|
2015-09-05 00:47:08 +02:00
|
|
|
if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL)
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
2015-08-10 12:47:21 +02:00
|
|
|
switch(key_scancode)
|
2015-08-09 20:23:01 +02:00
|
|
|
{
|
2015-08-09 23:59:25 +02:00
|
|
|
case 059...068:
|
2015-08-10 12:47:21 +02:00
|
|
|
key_scancode -= 59;
|
2016-01-06 21:50:19 +01:00
|
|
|
if (key_scancode < SystemDiscs.list.count)
|
2015-08-09 23:59:25 +02:00
|
|
|
{
|
2018-04-19 22:12:07 +02:00
|
|
|
if (!two_panels.checked)
|
2015-08-14 16:47:36 +02:00
|
|
|
{
|
|
|
|
DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click
|
|
|
|
pause(7);
|
|
|
|
}
|
2016-01-06 21:50:19 +01:00
|
|
|
SystemDiscs.Click(key_scancode);
|
2015-08-09 23:59:25 +02:00
|
|
|
}
|
|
|
|
break;
|
2015-08-09 20:23:01 +02:00
|
|
|
case 45: //Ctrl+X
|
|
|
|
Copy(#file_path, CUT);
|
|
|
|
break;
|
|
|
|
case 46: //Ctrl+C
|
|
|
|
Copy(#file_path, NOCUT);
|
|
|
|
break;
|
|
|
|
case 47: //Ctrl+V
|
|
|
|
Paste();
|
|
|
|
break;
|
|
|
|
case 032: //Ctrl+D - set as bg
|
2015-09-05 16:04:04 +02:00
|
|
|
strlcpy(#temp, "\\S__",4);
|
2015-07-21 03:10:37 +02:00
|
|
|
strcat(#temp, #file_path);
|
|
|
|
RunProgram("/sys/media/kiv", #temp);
|
|
|
|
break;
|
2015-08-09 20:23:01 +02:00
|
|
|
case 049: //Ctrl+N - create new window
|
2015-07-21 03:10:37 +02:00
|
|
|
if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD);
|
2016-11-21 21:25:00 +01:00
|
|
|
RunProgram(I_Path, #path);
|
2015-07-21 03:10:37 +02:00
|
|
|
break;
|
2016-02-07 00:57:07 +01:00
|
|
|
case 050: //Ctrl+M
|
|
|
|
Open_Dir(#inactive_path,WITH_REDRAW);
|
|
|
|
break;
|
2016-02-21 22:57:22 +01:00
|
|
|
case SCAN_CODE_ENTER: //Ctrl+Enter
|
2015-08-09 23:59:25 +02:00
|
|
|
if (!itdir) ShowOpenWithDialog();
|
|
|
|
else Open(1);
|
|
|
|
break;
|
2015-08-09 20:23:01 +02:00
|
|
|
case 030: //Ctrl+A - select all files
|
2016-10-17 03:31:59 +02:00
|
|
|
for (i=0; i<files.count; i++) setElementSelectedFlag(i, true);
|
2015-07-21 03:10:37 +02:00
|
|
|
List_ReDraw();
|
2016-10-05 01:11:59 +02:00
|
|
|
DrawStatusBar();
|
2015-07-21 03:10:37 +02:00
|
|
|
break;
|
2015-08-09 20:23:01 +02:00
|
|
|
case 022: //Ctrl+U - unselect all files
|
2016-10-17 03:31:59 +02:00
|
|
|
for (i=0; i<files.count; i++) setElementSelectedFlag(i, false);
|
2015-07-21 03:10:37 +02:00
|
|
|
selected_count = 0;
|
|
|
|
List_ReDraw();
|
2016-10-05 01:11:59 +02:00
|
|
|
DrawStatusBar();
|
2015-07-21 03:10:37 +02:00
|
|
|
break;
|
2015-08-09 20:23:01 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2015-08-09 21:08:57 +02:00
|
|
|
|
2015-08-10 12:47:21 +02:00
|
|
|
switch (key_scancode)
|
2015-08-09 20:23:01 +02:00
|
|
|
{
|
2015-08-09 23:59:25 +02:00
|
|
|
case SCAN_CODE_BS:
|
2015-08-09 20:23:01 +02:00
|
|
|
//GoBack();
|
|
|
|
Dir_Up();
|
|
|
|
break;
|
2015-08-09 23:59:25 +02:00
|
|
|
case SCAN_CODE_ENTER:
|
2015-07-21 03:10:37 +02:00
|
|
|
Open(0);
|
|
|
|
break;
|
2015-08-17 23:24:56 +02:00
|
|
|
case SCAN_CODE_TAB:
|
2018-04-19 22:12:07 +02:00
|
|
|
if (!two_panels.checked) break;
|
2015-08-17 23:24:56 +02:00
|
|
|
if (active_panel==1) active_panel=2; else active_panel=1;
|
|
|
|
ChangeActivePanel();
|
2016-10-05 01:11:59 +02:00
|
|
|
DrawStatusBar();
|
2015-08-17 23:24:56 +02:00
|
|
|
break;
|
2015-08-09 23:59:25 +02:00
|
|
|
case 093: //menu
|
2015-07-21 03:10:37 +02:00
|
|
|
menu_call_mouse=0;
|
|
|
|
menu_stak = malloc(4096);
|
|
|
|
CreateThread(#FileMenu,menu_stak+4092);
|
|
|
|
break;
|
2015-08-09 23:59:25 +02:00
|
|
|
case SCAN_CODE_DEL:
|
2015-07-21 03:10:37 +02:00
|
|
|
Del_Form();
|
|
|
|
break;
|
2015-08-09 23:59:25 +02:00
|
|
|
case SCAN_CODE_INS:
|
2016-11-01 13:14:17 +01:00
|
|
|
if (getElementSelectedFlag(files.cur_y) == true) setElementSelectedFlag(files.cur_y, false);
|
2016-10-17 03:31:59 +02:00
|
|
|
else setElementSelectedFlag(files.cur_y, true);
|
2015-12-11 15:05:47 +01:00
|
|
|
files.KeyDown();
|
|
|
|
List_ReDraw();
|
2016-10-05 01:11:59 +02:00
|
|
|
DrawStatusBar();
|
2015-07-21 03:10:37 +02:00
|
|
|
break;
|
2015-08-09 23:59:25 +02:00
|
|
|
case 059...068: //F1-F10
|
2015-08-10 12:47:21 +02:00
|
|
|
FnProcess(key_scancode-58);
|
2015-07-21 03:10:37 +02:00
|
|
|
break;
|
2015-12-16 17:13:34 +01:00
|
|
|
default:
|
2015-09-09 16:24:42 +02:00
|
|
|
for (i=files.cur_y+1; i<files.count; i++)
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
|
|
|
strcpy(#temp, file_mas[i]*304+buf+72);
|
2015-08-10 12:47:21 +02:00
|
|
|
if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
2015-09-09 16:24:42 +02:00
|
|
|
files.cur_y = i - 1;
|
2015-08-07 16:55:16 +02:00
|
|
|
files.KeyDown();
|
|
|
|
List_ReDraw();
|
2015-07-21 03:10:37 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-03-11 19:16:24 +01:00
|
|
|
break;
|
2015-08-09 21:08:57 +02:00
|
|
|
case evIPC:
|
2015-07-21 03:10:37 +02:00
|
|
|
case evReDraw:
|
|
|
|
draw_window();
|
|
|
|
if (action_buf)
|
|
|
|
{
|
2015-09-05 19:50:37 +02:00
|
|
|
if (action_buf==OPERATION_END)
|
2015-08-09 21:08:57 +02:00
|
|
|
{
|
|
|
|
FnProcess(5);
|
2015-12-20 22:56:53 +01:00
|
|
|
if (copy_stak) SelectFileByName(#copy_to+strrchr(#copy_to,'/'));
|
2015-08-09 21:08:57 +02:00
|
|
|
}
|
|
|
|
if (action_buf==100) Open(0);
|
|
|
|
if (action_buf==201) ShowOpenWithDialog();
|
|
|
|
if (action_buf==202) FnProcess(3); //F3
|
|
|
|
if (action_buf==203) FnProcess(4); //F4
|
|
|
|
if (action_buf==104) Copy(#file_path, NOCUT);
|
|
|
|
if (action_buf==105) Copy(#file_path, CUT);
|
|
|
|
if (action_buf==106) Paste();
|
|
|
|
if (action_buf==207) FnProcess(2);
|
|
|
|
if (action_buf==108) Del_Form();
|
|
|
|
if (action_buf==109) FnProcess(5);
|
|
|
|
if (action_buf==110) FnProcess(8);
|
2015-07-21 03:10:37 +02:00
|
|
|
action_buf=0;
|
|
|
|
}
|
2018-08-11 22:02:54 +02:00
|
|
|
break;
|
|
|
|
default:
|
2018-08-12 02:40:47 +02:00
|
|
|
|
2018-08-12 11:46:12 +02:00
|
|
|
ReadDir(19, devbuf, "/"); // get disk
|
|
|
|
IF(countDisk != EBX) // if different then
|
2018-08-12 00:49:29 +02:00
|
|
|
{
|
2018-08-12 02:40:47 +02:00
|
|
|
countDisk = EBX;
|
|
|
|
FnProcess(5);
|
2018-08-12 00:49:29 +02:00
|
|
|
}
|
2018-08-12 11:46:12 +02:00
|
|
|
else // get current files
|
|
|
|
{
|
|
|
|
if(two_panels.checked)
|
|
|
|
{
|
|
|
|
// this add code update list files
|
|
|
|
update = 0;
|
|
|
|
//strcpy(#inactive_path,#path);
|
|
|
|
ReadDir(19, devbuf, #inactive_path);
|
|
|
|
IF(countPathFile != EBX) // if different then
|
|
|
|
{
|
|
|
|
countPathFile = EBX;
|
|
|
|
update = 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
//strcpy(#active_path,#path);
|
|
|
|
ReadDir(19, devbuf, #active_path);
|
|
|
|
IF(countPathFile2 != EBX) // if different then
|
|
|
|
{
|
|
|
|
countPathFile2 = EBX;
|
|
|
|
update = 0xFF;
|
|
|
|
}
|
|
|
|
IF(update) DrawFilePanels();
|
|
|
|
}
|
|
|
|
ELSE
|
|
|
|
{
|
|
|
|
ReadDir(19, devbuf, #path);
|
|
|
|
IF(countPathFile != EBX) // if different then
|
|
|
|
{
|
|
|
|
countPathFile = EBX;
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-07-21 03:10:37 +02:00
|
|
|
}
|
2018-08-11 22:02:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2015-07-21 03:10:37 +02:00
|
|
|
if(cmd_free)
|
|
|
|
{
|
2015-12-20 22:56:53 +01:00
|
|
|
if(cmd_free==1) menu_stak=free(menu_stak);
|
|
|
|
else 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==5) copy_stak=free(copy_stak);
|
|
|
|
else if(cmd_free==6) delete_stak=free(delete_stak);
|
2015-07-21 03:10:37 +02:00
|
|
|
cmd_free = false;
|
2015-07-16 03:44:30 +02:00
|
|
|
}
|
|
|
|
}
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
2016-02-25 15:07:16 +01:00
|
|
|
void DrawFavButton(int x)
|
|
|
|
{
|
|
|
|
_PutImage(x,10,20,22,#fav);
|
|
|
|
DefineButton(x,11,20-2,22-2,61+BT_HIDE+BT_NOFRAME,0);
|
|
|
|
}
|
|
|
|
|
2013-04-04 19:07:38 +02:00
|
|
|
void draw_window()
|
|
|
|
{
|
2018-04-19 22:12:07 +02:00
|
|
|
if (show_status_bar.checked) status_bar_h = STATUS_BAR_H; else status_bar_h = 0;
|
2018-05-13 18:06:20 +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);
|
|
|
|
if (Form.status_window>2) return;
|
2015-09-06 14:34:30 +02:00
|
|
|
if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; }
|
|
|
|
if (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; }
|
2013-04-04 19:07:38 +02:00
|
|
|
GetProcessInfo(#Form, SelfInfo); //if win_size changed
|
2016-02-25 15:07:16 +01:00
|
|
|
_PutImage(0,0,246,34,#toolbar);
|
2016-02-11 02:07:04 +01:00
|
|
|
DrawBar(127, 8, 1, 25, col_graph);
|
|
|
|
for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,NULL);
|
|
|
|
for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,NULL);
|
2016-02-24 17:49:57 +01:00
|
|
|
DrawBar(246,0, Form.cwidth - 246, 34, col_work);
|
2016-02-25 15:07:16 +01:00
|
|
|
_PutImage(Form.cwidth-17,11,6,18,#dots);
|
|
|
|
DefineButton(Form.cwidth-24,7,20,25,51+BT_HIDE+BT_NOFRAME,0); //dots
|
2013-03-31 22:25:54 +02:00
|
|
|
//main rectangles
|
2016-10-05 01:11:59 +02:00
|
|
|
DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,col_graph);
|
2015-08-09 21:08:57 +02:00
|
|
|
DrawRectangle(0,39,Form.cwidth-1,Form.cheight - 40,col_palette[4]); //bg
|
2015-08-14 16:47:36 +02:00
|
|
|
for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);
|
2015-08-17 14:45:56 +02:00
|
|
|
llist_copy(#files_active, #files);
|
2015-08-14 16:47:36 +02:00
|
|
|
strcpy(#active_path, #path);
|
2016-10-05 01:11:59 +02:00
|
|
|
DrawStatusBar();
|
2017-09-12 17:32:38 +02:00
|
|
|
if (selected_count==0) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001]
|
2016-04-21 23:50:46 +02:00
|
|
|
DrawFilePanels();
|
2015-08-14 16:47:36 +02:00
|
|
|
if (del_active) Del_Form();
|
|
|
|
if (new_element_active) NewElement_Form(new_element_active, #new_element_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawList()
|
|
|
|
{
|
2015-08-17 14:45:56 +02:00
|
|
|
word sorting_arrow_x;
|
2016-11-05 11:13:29 +01: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");
|
2015-08-17 14:45:56 +02:00
|
|
|
if (sort_num==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;
|
|
|
|
if (sort_num==2) sorting_arrow_x = files.x + files.w - 90;
|
|
|
|
if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
|
2016-02-11 02:07:04 +01:00
|
|
|
WriteText(sorting_arrow_x,files.y-12,0x80,col_graph,"\x19");
|
|
|
|
DrawBar(files.x+files.w,files.y,1,files.h,col_graph);
|
2018-04-19 22:12:07 +02:00
|
|
|
if (two_panels.checked) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,col_graph);
|
2015-08-14 16:47:36 +02:00
|
|
|
}
|
|
|
|
|
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;
|
2018-04-19 22:12:07 +02:00
|
|
|
if (!show_status_bar.checked) return;
|
2016-10-17 16:39:22 +02:00
|
|
|
if (files.count>0) && (strcmp(file_mas[0]*304+buf+72,"..")==0) go_up_folder_exists=1;
|
2016-12-04 19:51:23 +01:00
|
|
|
DrawBar(1, Form.cheight - status_bar_h-1, Form.cwidth-2, status_bar_h, system.color.work);
|
2016-10-05 21:33:49 +02:00
|
|
|
sprintf(#status_bar_str, STATUS_STR, files.count-go_up_folder_exists, count_dir-go_up_folder_exists, files.count-count_dir, selected_count);
|
2016-12-04 19:51:23 +01:00
|
|
|
WriteText(6,Form.cheight - 13,0x80,system.color.work_text,#status_bar_str);
|
2016-04-20 02:11:28 +02:00
|
|
|
}
|
|
|
|
|
2015-08-14 16:47:36 +02:00
|
|
|
void DrawFilePanels()
|
|
|
|
{
|
2016-01-06 21:50:19 +01:00
|
|
|
int files_y;
|
2018-04-19 22:12:07 +02:00
|
|
|
if (!two_panels.checked)
|
2015-08-09 21:08:57 +02:00
|
|
|
{
|
2015-08-14 16:47:36 +02:00
|
|
|
DrawDeviceAndActionsLeftPanel();
|
2016-10-05 01:11:59 +02:00
|
|
|
files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h);
|
2015-08-13 17:28:53 +02:00
|
|
|
DrawList();
|
2015-08-17 14:45:56 +02:00
|
|
|
Open_Dir(#path,ONLY_SHOW);
|
2015-08-09 21:08:57 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-02-07 01:29:45 +01:00
|
|
|
SystemDiscs.Get();
|
2015-08-17 14:45:56 +02:00
|
|
|
llist_copy(#files, #files_inactive);
|
|
|
|
strcpy(#path, #inactive_path);
|
|
|
|
col_selec = 0xCCCccc;
|
2016-01-06 21:50:19 +01:00
|
|
|
SystemDiscs.Draw();
|
|
|
|
files_y = files.y;
|
2015-08-17 14:45:56 +02:00
|
|
|
|
2015-08-13 17:28:53 +02:00
|
|
|
if (active_panel==1)
|
|
|
|
{
|
2015-08-22 15:27:12 +02:00
|
|
|
llist_copy(#files, #files_inactive);
|
|
|
|
strcpy(#path, #inactive_path);
|
|
|
|
col_selec = 0xCCCccc;
|
2016-10-05 01:11:59 +02: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 17:28:53 +02:00
|
|
|
DrawList();
|
2015-08-17 14:45:56 +02:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
llist_copy(#files, #files_active);
|
2015-08-13 17:28:53 +02:00
|
|
|
strcpy(#path, #active_path);
|
2015-08-17 14:45:56 +02:00
|
|
|
col_selec = 0x94AECE;
|
2016-10-05 01:11:59 +02: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 17:28:53 +02:00
|
|
|
DrawList();
|
2015-08-17 14:45:56 +02:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2015-08-13 17:28:53 +02:00
|
|
|
}
|
|
|
|
if (active_panel==2)
|
|
|
|
{
|
2016-10-05 01:11:59 +02: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 17:28:53 +02:00
|
|
|
DrawList();
|
2015-08-17 14:45:56 +02:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
llist_copy(#files, #files_active);
|
2015-08-13 17:28:53 +02:00
|
|
|
strcpy(#path, #active_path);
|
2015-08-17 14:45:56 +02:00
|
|
|
col_selec = 0x94AECE;
|
2016-10-05 01:11:59 +02: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 17:28:53 +02:00
|
|
|
DrawList();
|
2015-08-17 14:45:56 +02:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2015-08-13 17:28:53 +02:00
|
|
|
}
|
2015-08-09 21:08:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-11 19:16:24 +01: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;
|
2015-09-09 16:24:42 +02:00
|
|
|
static int old_cur_y, old_first;
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2015-08-07 16:55:16 +02:00
|
|
|
files.CheckDoesValuesOkey(); //prevent some shit
|
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
|
|
|
{
|
2015-09-09 16:24:42 +02:00
|
|
|
if (old_cur_y-files.first<files.visible) Line_ReDraw(0xFFFFFF, old_cur_y-files.first);
|
|
|
|
Line_ReDraw(col_selec, files.cur_y-files.first);
|
|
|
|
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
|
|
|
|
2015-09-09 16:24:42 +02:00
|
|
|
for (j=0; j<files.visible; j++) if (files.cur_y-files.first!=j) Line_ReDraw(0xFFFFFF, j); else Line_ReDraw(col_selec, files.cur_y-files.first);
|
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;
|
2015-08-13 17:28:53 +02:00
|
|
|
DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h,0xFFFFFF);
|
2017-09-05 15:38:37 +02:00
|
|
|
DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,col_list_line);
|
|
|
|
DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,col_list_line);
|
2013-03-31 22:25:54 +02:00
|
|
|
Scroll();
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
2013-04-04 19:07:38 +02:00
|
|
|
|
2015-08-22 15:27:12 +02:00
|
|
|
void Line_ReDraw(dword bgcol, filenum){
|
2013-04-12 02:15:39 +02:00
|
|
|
dword text_col=0,
|
2015-12-20 22:56:53 +01:00
|
|
|
ext1, attr,
|
|
|
|
file_offet,
|
|
|
|
file_name_off,
|
2016-02-24 23:30:04 +01:00
|
|
|
y=filenum*files.item_h+files.y,
|
2018-03-20 18:03:14 +01:00
|
|
|
icon_y = files.item_h-icon_size/2+1+y;
|
2015-12-20 22:56:53 +01:00
|
|
|
BDVK file;
|
2016-11-25 15:15:30 +01:00
|
|
|
char temp_path[sizeof(file_path)];
|
2015-12-21 17:37:24 +01:00
|
|
|
char label_file_name[4096];
|
2014-04-20 11:01:20 +02:00
|
|
|
if (filenum==-1) return;
|
2017-10-05 23:38:09 +02:00
|
|
|
DrawBar(files.x,y,4,files.item_h,bgcol);
|
|
|
|
DrawBar(files.x+20,y,files.w-20,files.item_h,bgcol);
|
2018-03-20 18:03:14 +01: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);
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2014-04-26 11:49:20 +02:00
|
|
|
file_offet = file_mas[filenum+files.first]*304 + buf+32;
|
2015-02-27 21:25:28 +01:00
|
|
|
attr = ESDWORD[file_offet];
|
2014-04-26 11:49:20 +02:00
|
|
|
file.selected = ESBYTE[file_offet+7];
|
|
|
|
file.sizelo = ESDWORD[file_offet+32];
|
2017-09-18 10:12:27 +02:00
|
|
|
file.sizehi = ESDWORD[file_offet+36];
|
2014-04-26 11:49:20 +02:00
|
|
|
file_name_off = file_offet+40;
|
2013-03-11 19:16:24 +01:00
|
|
|
|
2015-02-27 21:25:28 +01:00
|
|
|
if (! TestBit(attr, 4) ) //file or folder?
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2015-08-09 21:08:57 +02:00
|
|
|
ext1 = strrchr(file_name_off,'.') + file_name_off;
|
2016-02-21 22:57:22 +01:00
|
|
|
if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing
|
2017-09-18 10:12:27 +02:00
|
|
|
WriteText(
|
|
|
|
7-strlen(ConvertSize64(file.sizelo, file.sizehi))*6+files.x+files.w - 58,
|
|
|
|
files.text_y+y+1,
|
|
|
|
files.font_type,
|
|
|
|
0,
|
|
|
|
ConvertSize64(file.sizelo, file.sizehi)
|
|
|
|
);
|
2016-02-21 22:57:22 +01:00
|
|
|
if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1);
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
else
|
2014-04-17 20:07:07 +02: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>";
|
|
|
|
WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, 0, ext1);
|
|
|
|
}
|
2014-04-17 20:07:07 +02:00
|
|
|
}
|
2016-11-25 15:15:30 +01:00
|
|
|
sprintf(#temp_path,"%s/%s",#path,file_name_off);
|
2017-10-05 23:38:09 +02:00
|
|
|
DrawIconByExtension(#temp_path, ext1, files.x+4, icon_y, bgcol);
|
2014-04-17 20:07:07 +02:00
|
|
|
|
2015-02-27 21:25:28 +01:00
|
|
|
if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
|
2015-08-22 15:27:12 +02:00
|
|
|
if (bgcol!=0xFFFfff)
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2015-02-27 21:25:28 +01:00
|
|
|
itdir = TestBit(attr, 4);
|
2014-04-26 11:49:20 +02:00
|
|
|
strcpy(#file_name, file_name_off);
|
2016-10-30 20:17:46 +01:00
|
|
|
if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off);
|
|
|
|
else sprintf(#file_path,"%s/%s",#path,file_name_off);
|
2013-03-11 19:16:24 +01:00
|
|
|
if (text_col==0xA6A6B7) text_col=0xFFFFFF;
|
|
|
|
}
|
2014-04-26 11:49:20 +02:00
|
|
|
if (file.selected) 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)
|
|
|
|
{
|
|
|
|
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 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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-12-21 17:37:24 +01:00
|
|
|
strcpy(#label_file_name, file_name_off);
|
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;
|
|
|
|
}
|
|
|
|
strcpy(#label_file_name+strlen(#label_file_name)-2, "...");
|
|
|
|
}
|
2018-03-20 18:03:14 +01: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-03-31 22:25:54 +02:00
|
|
|
}
|
2017-09-05 15:38:37 +02:00
|
|
|
DrawBar(files.x+files.w-141,y,1,files.item_h,col_list_line); //gray line 1
|
|
|
|
DrawBar(files.x+files.w-68,y,1,files.item_h,col_list_line); //gray line 2
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-04 19:07:38 +02:00
|
|
|
void Open_Dir(dword dir_path, redraw){
|
2016-04-21 23:50:46 +02:00
|
|
|
int errornum, maxcount, i;
|
2013-04-04 19:07:38 +02:00
|
|
|
if (redraw!=ONLY_SHOW)
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2016-10-17 03:31:59 +02:00
|
|
|
selected_count = 0;
|
2013-03-11 19:16:24 +01:00
|
|
|
if (buf) free(buf);
|
2013-04-04 19:07:38 +02:00
|
|
|
errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
|
|
|
|
if (errornum)
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2016-01-01 17:51:53 +01:00
|
|
|
history.add(#path);
|
2013-03-11 19:16:24 +01:00
|
|
|
GoBack();
|
|
|
|
Write_Error(errornum);
|
|
|
|
return;
|
|
|
|
}
|
2013-04-04 19:07:38 +02:00
|
|
|
maxcount = sizeof(file_mas)/sizeof(dword)-1;
|
2013-11-14 01:22:55 +01:00
|
|
|
if (files.count>maxcount) files.count = maxcount;
|
2015-09-09 16:24:42 +02:00
|
|
|
if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
2013-04-04 19:07:38 +02:00
|
|
|
if (files.count!=-1)
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2018-04-19 22:12:07 +02:00
|
|
|
if(!_not_draw) if (show_breadcrumb.checked) DrawBreadCrumbs(); else DrawPathBar();
|
2016-01-01 17:51:53 +01:00
|
|
|
history.add(#path);
|
2016-01-06 21:50:19 +01:00
|
|
|
SystemDiscs.Draw();
|
2015-09-09 16:24:42 +02:00
|
|
|
files.visible = files.h / files.item_h;
|
2015-07-21 03:10:37 +02:00
|
|
|
if (files.count < files.visible) files.visible = files.count;
|
|
|
|
if (redraw!=ONLY_SHOW) Sorting();
|
2015-08-07 16:55:16 +02:00
|
|
|
list_full_redraw = true;
|
2016-10-05 01:11:59 +02:00
|
|
|
if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();}
|
2016-10-05 21:33:49 +02:00
|
|
|
SetCurDir(dir_path);
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
2015-08-07 16:55:16 +02:00
|
|
|
if (files.count==-1) && (redraw!=ONLY_OPEN)
|
|
|
|
{
|
|
|
|
files.KeyHome();
|
2016-10-05 01:11:59 +02:00
|
|
|
if(!_not_draw) { list_full_redraw=true; DrawStatusBar(); List_ReDraw(); }
|
2015-08-07 16:55:16 +02:00
|
|
|
}
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
inline Sorting()
|
|
|
|
{
|
|
|
|
dword k=0, l=1;
|
2014-04-26 11:49:20 +02:00
|
|
|
dword file_off;
|
2016-10-17 16:39:22 +02:00
|
|
|
if (!strcmp(#path,"/")) //do not sort root folder
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
2015-07-21 03:10:37 +02:00
|
|
|
for(k=1;k<files.count;k++;) file_mas[k]=k;
|
2016-10-17 16:39:22 +02:00
|
|
|
count_dir = k;
|
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
|
|
|
{
|
2018-04-19 22:12:07 +02:00
|
|
|
if (!show_real_names.checked) strttl(file_off+40);
|
2014-04-26 11:49:20 +02:00
|
|
|
if (TestBit(ESDWORD[file_off],4)) //directory?
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
|
|
|
file_mas[k]=j;
|
|
|
|
k++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-31 22:25:54 +02:00
|
|
|
file_mas[files.count-l]=j;
|
2013-03-11 19:16:24 +01:00
|
|
|
l++;
|
|
|
|
}
|
|
|
|
}
|
2016-10-05 21:33:49 +02:00
|
|
|
count_dir = k;
|
2013-03-31 22:25:54 +02:00
|
|
|
//sorting: files first, then folders
|
2013-03-11 19:16:24 +01:00
|
|
|
Sort_by_Name(0,k-1);
|
2015-07-21 03:10:37 +02:00
|
|
|
if (sort_num==1) Sort_by_Name(k,files.count-1);
|
|
|
|
if (sort_num==2) Sort_by_Type(k,files.count-1);
|
|
|
|
if (sort_num==3) Sort_by_Size(k,files.count-1);
|
2015-07-19 20:45:59 +02:00
|
|
|
//make ".." first item in list
|
2015-08-17 14:45:56 +02:00
|
|
|
if (k>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0)
|
|
|
|
for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",2)) {file_mas[k]><file_mas[0]; break;}
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Del_Form()
|
|
|
|
{
|
2015-03-09 16:14:09 +01:00
|
|
|
byte f_count[128];
|
2015-07-19 20:45:59 +02:00
|
|
|
int dform_x = files.w - 220 / 2 + files.x;
|
2017-09-23 13:02:57 +02:00
|
|
|
if (selected_count==0) && (!strncmp(#file_name,"..",2)) return;
|
2013-10-09 20:10:23 +02:00
|
|
|
else
|
|
|
|
{
|
2013-10-10 09:16:37 +02:00
|
|
|
if (!files.count) return;
|
2015-12-26 12:03:17 +01:00
|
|
|
DrawEolitePopup(T_YES, T_NO);
|
2015-08-04 16:36:07 +02:00
|
|
|
WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE);
|
2016-02-21 22:57:22 +01:00
|
|
|
if (selected_count)
|
2015-03-09 16:14:09 +01:00
|
|
|
{
|
2016-02-21 22:57:22 +01:00
|
|
|
sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2);
|
2015-08-04 16:36:07 +02:00
|
|
|
WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count);
|
2013-10-10 09:16:37 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-21 03:10:37 +02:00
|
|
|
if (strlen(#file_name)<28)
|
2015-03-09 16:14:09 +01:00
|
|
|
{
|
2015-08-04 16:36:07 +02:00
|
|
|
WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,system.color.work_text,"?");
|
|
|
|
WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,system.color.work_text,#file_name);
|
2015-03-09 16:14:09 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WriteText(164+dform_x,190,0x80,0,"...?");
|
|
|
|
ESI = 24;
|
|
|
|
WriteText(dform_x+20,190,0,0,#file_name);
|
|
|
|
}
|
2015-12-26 12:03:17 +01:00
|
|
|
}
|
2013-10-10 09:16:37 +02:00
|
|
|
del_active=1;
|
2013-10-09 20:10:23 +02:00
|
|
|
}
|
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();
|
2015-12-20 22:56:53 +01:00
|
|
|
Open_Dir(#path,ONLY_OPEN);
|
2018-04-19 22:12:07 +02:00
|
|
|
if (!show_real_names.checked) strttl(that_file);
|
2015-08-07 16:55:16 +02:00
|
|
|
for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[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()
|
|
|
|
{
|
2016-10-30 20:17:46 +01:00
|
|
|
char old_folder_name[4096];
|
2013-03-11 19:16:24 +01:00
|
|
|
i=strlen(#path)-1;
|
|
|
|
if (i==0) return;
|
2016-10-30 20:17:46 +01:00
|
|
|
//path[i]=0x00;
|
2013-03-11 19:16:24 +01:00
|
|
|
i = strrchr(#path, '/');
|
2016-10-30 20:17:46 +01:00
|
|
|
strcpy(#old_folder_name, #path+i);
|
|
|
|
if (i>1) path[i-1]=NULL; else path[i]=NULL;
|
|
|
|
SelectFileByName(#old_folder_name);
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
2015-02-21 22:32:15 +01:00
|
|
|
void Open(byte rez)
|
2013-03-31 22:25:54 +02:00
|
|
|
{
|
2015-02-21 21:12:52 +01:00
|
|
|
byte temp[4096];
|
2015-03-09 19:02:10 +01:00
|
|
|
selected_count = 0;
|
2015-02-21 21:12:52 +01:00
|
|
|
if (rez)
|
|
|
|
{
|
2015-07-23 13:54:26 +02:00
|
|
|
if (!strncmp(#file_name,"..",3)) return;
|
2015-02-21 21:12:52 +01:00
|
|
|
strcpy(#temp, #file_path);
|
2016-11-21 21:25:00 +01:00
|
|
|
RunProgram(I_Path, #temp);
|
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);
|
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; }
|
2013-03-31 22:25:54 +02:00
|
|
|
strcpy(#path, #file_path);
|
2015-09-09 16:24:42 +02:00
|
|
|
files.first=files.cur_y=0;
|
2013-04-04 19:07:38 +02:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2013-03-31 22:25:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline fastcall void GoBack()
|
2013-03-11 19:16:24 +01:00
|
|
|
{
|
|
|
|
char cur_folder[4096];
|
2015-12-16 17:13:34 +01:00
|
|
|
strcpy(#cur_folder, #path);
|
2016-01-01 17:51:53 +01:00
|
|
|
if (history.back()) {
|
|
|
|
strcpy(#path, history.current());
|
2015-12-16 23:08:01 +01:00
|
|
|
SelectFileByName(#cur_folder+strrchr(#cur_folder,'/'));
|
|
|
|
}
|
2013-03-11 19:16:24 +01:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2015-05-14 18:09:36 +02:00
|
|
|
void NewElement(byte newf)
|
|
|
|
{
|
2015-05-15 14:32:26 +02:00
|
|
|
BDVK element_info;
|
2015-07-19 20:45:59 +02:00
|
|
|
byte del_rezult, copy_rezult, info_result;
|
2015-05-14 18:09:36 +02:00
|
|
|
if (newf)
|
|
|
|
{
|
2016-10-30 20:17:46 +01:00
|
|
|
sprintf(#temp,"%s/%s",#path,new_file_ed.text);
|
2015-07-19 20:45:59 +02:00
|
|
|
info_result = GetFileInfo(#temp, #element_info);
|
2015-06-20 00:23:51 +02:00
|
|
|
switch(new_element_active)
|
2015-05-14 18:09:36 +02:00
|
|
|
{
|
2015-07-19 20:45:59 +02:00
|
|
|
case CREATE_FILE:
|
|
|
|
if (info_result==5)
|
2015-05-15 14:32:26 +02:00
|
|
|
{
|
2018-04-16 00:44:36 +02:00
|
|
|
CreateFile(0, 0, #temp);
|
2015-06-20 00:23:51 +02:00
|
|
|
if (EAX)
|
|
|
|
{
|
2015-12-26 12:03:17 +01:00
|
|
|
if (EAX==5) notify(NOT_CREATE_FILE);
|
|
|
|
else Write_Error(EAX);
|
2015-06-20 00:23:51 +02:00
|
|
|
}
|
2015-05-15 14:32:26 +02:00
|
|
|
}
|
2015-06-20 00:23:51 +02:00
|
|
|
else
|
2015-05-15 14:32:26 +02:00
|
|
|
{
|
2015-07-29 14:14:49 +02:00
|
|
|
notify(FS_ITEM_ALREADY_EXISTS);
|
2015-06-20 00:23:51 +02:00
|
|
|
}
|
2015-07-19 20:45:59 +02:00
|
|
|
break;
|
|
|
|
case CREATE_FOLDER:
|
|
|
|
if (info_result==5)
|
2015-06-20 00:23:51 +02:00
|
|
|
{
|
|
|
|
CreateDir(#temp);
|
|
|
|
if (EAX)
|
|
|
|
{
|
2015-12-26 12:03:17 +01:00
|
|
|
if (EAX==5) notify(NOT_CREATE_FOLDER);
|
|
|
|
else Write_Error(EAX);
|
2015-06-20 00:23:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-29 14:14:49 +02:00
|
|
|
notify(FS_ITEM_ALREADY_EXISTS);
|
2015-06-20 00:23:51 +02:00
|
|
|
}
|
2015-07-19 20:45:59 +02:00
|
|
|
break;
|
|
|
|
case RENAME_ITEM:
|
|
|
|
if (info_result==5)
|
2015-06-20 00:23:51 +02:00
|
|
|
{
|
|
|
|
if (itdir)
|
|
|
|
{
|
2016-01-07 13:22:05 +01:00
|
|
|
//rename only empty folders
|
2015-06-20 00:23:51 +02:00
|
|
|
if (del_rezult = DeleteFile(#file_path))
|
|
|
|
{
|
|
|
|
Write_Error(del_rezult);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (CreateDir(#temp)) CreateDir(#file_path);
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2015-08-07 16:55:16 +02:00
|
|
|
SelectFileByName(new_file_ed.text);
|
2015-06-20 00:23:51 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (copy_rezult = CopyFile(#file_path,#temp))
|
|
|
|
{
|
|
|
|
Write_Error(copy_rezult);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-01-07 13:22:05 +01:00
|
|
|
DeleteFile(#file_path);
|
2015-08-07 16:55:16 +02:00
|
|
|
SelectFileByName(new_file_ed.text);
|
2015-06-20 00:23:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-29 14:14:49 +02:00
|
|
|
notify(FS_ITEM_ALREADY_EXISTS);
|
2015-05-15 14:32:26 +02:00
|
|
|
}
|
2015-05-14 18:09:36 +02:00
|
|
|
}
|
2015-05-15 14:32:26 +02:00
|
|
|
new_element_active = 0;
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2015-08-07 16:55:16 +02:00
|
|
|
SelectFileByName(new_file_ed.text);
|
2015-05-14 18:09:36 +02:00
|
|
|
}
|
|
|
|
new_element_active = 0;
|
2015-05-15 14:32:26 +02:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2015-05-14 18:09:36 +02:00
|
|
|
}
|
|
|
|
|
2015-06-20 00:23:51 +02:00
|
|
|
void NewElement_Form(byte crt, dword strng)
|
2015-05-14 18:09:36 +02:00
|
|
|
{
|
|
|
|
int dform_x=files.w-220/2+files.x;
|
2015-05-15 14:32:26 +02:00
|
|
|
if (!new_element_active)
|
2015-05-14 18:09:36 +02:00
|
|
|
{
|
2015-05-15 14:32:26 +02:00
|
|
|
new_element_active = crt;
|
2015-06-20 00:23:51 +02:00
|
|
|
strcpy(#new_element_name, strng);
|
|
|
|
new_file_ed.size = new_file_ed.pos = strlen(strng);
|
2015-05-14 18:09:36 +02:00
|
|
|
}
|
2015-12-26 12:03:17 +01:00
|
|
|
if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL);
|
|
|
|
else DrawEolitePopup(T_CREATE, T_CANCEL);
|
2016-11-05 11:13:29 +01:00
|
|
|
new_file_ed.left = dform_x+10;
|
2016-02-21 22:57:22 +01:00
|
|
|
DrawEditBox(#new_file_ed);
|
2015-05-14 18:09:36 +02:00
|
|
|
}
|
|
|
|
|
2015-07-16 03:44:30 +02:00
|
|
|
void FnProcess(byte N)
|
2013-03-31 22:25:54 +02:00
|
|
|
{
|
|
|
|
switch(N)
|
|
|
|
{
|
|
|
|
case 1:
|
2013-12-22 01:09:21 +01:00
|
|
|
if (!active_about)
|
|
|
|
{
|
2015-07-16 03:44:30 +02:00
|
|
|
about_stak = malloc(4096);
|
|
|
|
about_window = CreateThread(#about_dialog,about_stak+4092);
|
2013-12-22 01:09:21 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ActivateWindow(GetProcessSlot(about_window));
|
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (!files.count) break;
|
2015-07-19 20:45:59 +02:00
|
|
|
NewElement_Form(RENAME_ITEM, #file_name);
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2015-07-21 03:10:37 +02:00
|
|
|
if (!itdir) RunProgram("/sys/tinypad", #file_path);
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
2015-07-21 03:10:37 +02:00
|
|
|
if (!itdir) RunProgram("/sys/develop/heed", #file_path);
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
2013-04-02 15:33:32 +02:00
|
|
|
case 5: //refresh cur dir & devs
|
2018-04-19 22:12:07 +02:00
|
|
|
if (two_panels.checked)
|
2015-08-13 17:28:53 +02:00
|
|
|
{
|
2015-08-14 16:47:36 +02:00
|
|
|
DrawFilePanels();
|
2015-08-13 17:28:53 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Tip(56, T_DEVICES, 55, "-");
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
pause(10);
|
2016-01-06 21:50:19 +01:00
|
|
|
SystemDiscs.Get();
|
2015-08-13 17:28:53 +02:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2015-08-14 16:47:36 +02:00
|
|
|
DrawDeviceAndActionsLeftPanel();
|
2015-08-13 17:28:53 +02:00
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
|
|
|
case 6:
|
2015-07-19 20:45:59 +02:00
|
|
|
NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER);
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
|
|
|
case 7:
|
2015-07-19 20:45:59 +02:00
|
|
|
NewElement_Form(CREATE_FILE, T_NEW_FILE);
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
2015-02-22 19:42:51 +01:00
|
|
|
case 8:
|
2015-07-16 03:44:30 +02:00
|
|
|
properties_stak = malloc(8096);
|
|
|
|
CreateThread(#properties_dialog, properties_stak+8092);
|
2015-02-22 19:42:51 +01:00
|
|
|
break;
|
2013-03-31 22:25:54 +02:00
|
|
|
case 10: //F10
|
2015-08-20 17:04:18 +02:00
|
|
|
if (!active_settings)
|
2015-02-17 17:46:38 +01:00
|
|
|
{
|
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
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ActivateWindow(GetProcessSlot(settings_window));
|
|
|
|
}
|
2013-03-31 22:25:54 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-17 23:24:56 +02:00
|
|
|
void ChangeActivePanel()
|
|
|
|
{
|
|
|
|
llist_copy(#files_active, #files_inactive);
|
|
|
|
llist_copy(#files_inactive, #files);
|
|
|
|
strcpy(#active_path, #inactive_path);
|
|
|
|
strcpy(#inactive_path, #path);
|
|
|
|
DrawFilePanels();
|
|
|
|
}
|
|
|
|
|
2013-03-31 22:25:54 +02:00
|
|
|
|
2013-03-11 19:16:24 +01:00
|
|
|
stop:
|