2015-02-27 01:29:09 +03:00
|
|
|
//Leency, Veliant, Punk_Joker & KolibriOS Team 2008-2015
|
2013-03-11 22:16:24 +04:00
|
|
|
//GNU GPL licence.
|
|
|
|
|
2013-10-14 02:18:41 +04:00
|
|
|
#ifndef AUTOBUILD
|
|
|
|
#include "lang.h--"
|
|
|
|
#endif
|
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
//libraries
|
2015-08-13 18:28:53 +03:00
|
|
|
#define MEMSIZE 510000
|
2014-01-06 04:36:08 +04:00
|
|
|
#include "..\lib\clipboard.h"
|
2013-03-11 22:16:24 +04:00
|
|
|
#include "..\lib\strings.h"
|
|
|
|
#include "..\lib\mem.h"
|
|
|
|
#include "..\lib\file_system.h"
|
2015-03-05 23:55:28 +03:00
|
|
|
#include "..\lib\gui.h"
|
2013-04-01 00:25:54 +04:00
|
|
|
#include "..\lib\list_box.h"
|
|
|
|
#include "..\lib\copyf.h"
|
2014-04-20 17:00:51 +04:00
|
|
|
#include "..\lib\random.h"
|
2015-02-27 23:25:28 +03:00
|
|
|
//obj
|
2015-03-05 23:55:28 +03:00
|
|
|
#include "..\lib\obj\libini.h"
|
|
|
|
#include "..\lib\obj\box_lib.h"
|
2013-03-11 22:16:24 +04:00
|
|
|
//images
|
|
|
|
#include "imgs\toolbar.txt"
|
|
|
|
#include "imgs\left_p.txt"
|
2014-04-17 22:07:07 +04:00
|
|
|
#include "imgs\icons.txt"
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2013-04-04 21:07:38 +04:00
|
|
|
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
|
2015-08-09 22:08:57 +03:00
|
|
|
enum {CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement
|
2013-04-04 21:07:38 +04:00
|
|
|
|
2013-10-23 21:55:07 +04:00
|
|
|
dword col_padding, col_selec, col_lpanel;
|
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};
|
|
|
|
struct path_string { char Item[4096]; };
|
|
|
|
|
2013-10-30 01:50:46 +04:00
|
|
|
byte active_about=0;
|
2013-10-22 02:24:36 +04:00
|
|
|
word about_window;
|
2015-02-17 19:46:38 +03:00
|
|
|
byte active_settings=0;
|
|
|
|
word settings_window;
|
2015-07-23 14:54:26 +03:00
|
|
|
dword _not_draw = false;
|
2013-10-30 01:50:46 +04:00
|
|
|
byte menu_call_mouse=0;
|
|
|
|
|
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;
|
|
|
|
dword file_mas[6898];
|
|
|
|
int selected_count;
|
|
|
|
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
byte
|
2013-03-11 22:16:24 +04:00
|
|
|
path[4096],
|
|
|
|
file_path[4096],
|
2013-03-23 04:00:11 +04:00
|
|
|
file_name[256],
|
2015-05-14 19:09:36 +03:00
|
|
|
new_element_name[256],
|
2015-08-09 22:08:57 +03:00
|
|
|
temp[4096],
|
2013-04-02 17:39:25 +04:00
|
|
|
itdir;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2015-08-09 22:08:57 +03:00
|
|
|
//struct t_settings {
|
|
|
|
byte use_big_fonts=false,
|
|
|
|
sort_num=2,
|
|
|
|
show_dev_name=true,
|
|
|
|
real_files_names_case=false,
|
|
|
|
info_after_copy=false,
|
2015-08-13 18:28:53 +03:00
|
|
|
two_panels=false,
|
|
|
|
active_panel=1;
|
2015-08-09 22:08:57 +03:00
|
|
|
//} settings;
|
|
|
|
|
2015-08-13 18:28:53 +03:00
|
|
|
char active_path[4096], inactive_path[4096];
|
|
|
|
|
2015-02-21 15:24:30 +03:00
|
|
|
dword eolite_ini_path;
|
|
|
|
|
2015-08-09 22:08:57 +03:00
|
|
|
char scroll_used=false;
|
2015-08-07 18:12:03 +03:00
|
|
|
|
2015-07-23 15:15:53 +03:00
|
|
|
dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak;
|
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
proc_info Form;
|
2015-08-17 15:45:56 +03:00
|
|
|
int mouse_dd, sc_slider_h, kolibrios_drive;
|
2013-04-01 00:25:54 +04:00
|
|
|
int j, i;
|
2013-10-15 03:16:04 +04:00
|
|
|
int action_buf;
|
2014-04-20 17:00:51 +04:00
|
|
|
int rand_n;
|
2015-07-21 04:10:37 +03:00
|
|
|
byte CMD_REFRESH;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2015-04-03 00:27:51 +03:00
|
|
|
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
|
2015-08-07 17:55:16 +03:00
|
|
|
|
2015-04-03 00:27:51 +03:00
|
|
|
|
2015-07-19 21:45:59 +03:00
|
|
|
edit_box new_file_ed = {171,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0,248,#new_element_name,#mouse_dd,100000000000010b,6,0};
|
2013-04-01 00:25:54 +04:00
|
|
|
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
|
2013-03-11 22:16:24 +04:00
|
|
|
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 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"
|
2013-10-17 03:48:20 +04:00
|
|
|
#include "include\copy.h"
|
2015-02-20 18:25:51 +03:00
|
|
|
#include "include\gui.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"
|
|
|
|
#include "include\history.h"
|
2013-10-17 03:48:20 +04:00
|
|
|
#include "include\menu.h"
|
|
|
|
#include "include\about.h"
|
2015-02-17 19:46:38 +03:00
|
|
|
#include "include\settings.h"
|
2015-02-22 21:42:51 +03:00
|
|
|
#include "include\properties.h"
|
2013-10-23 21:55:07 +04:00
|
|
|
|
2015-07-16 04:44:30 +03:00
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
void main()
|
|
|
|
{
|
2015-08-10 13:47:21 +03:00
|
|
|
word id;
|
2015-08-07 18:12:03 +03:00
|
|
|
char can_show, can_select, stats;
|
2014-04-26 13:49:20 +04:00
|
|
|
dword selected_offset;
|
2015-07-21 04:10:37 +03:00
|
|
|
dword IPC_LEN,IPC_ID;
|
|
|
|
char IPC_BUF[10];
|
|
|
|
dword tmp;
|
2014-04-20 17:00:51 +04:00
|
|
|
rand_n = random(40);
|
2015-08-02 18:15:15 +03:00
|
|
|
|
2015-07-29 23:43:05 +03:00
|
|
|
load_dll(boxlib, #box_lib_init,0);
|
|
|
|
load_dll(libini, #lib_init,1);
|
2015-02-21 15:24:30 +03:00
|
|
|
eolite_ini_path = abspath("Eolite.ini");
|
|
|
|
LoadIniSettings();
|
|
|
|
GetSystemDiscs();
|
2013-10-23 21:55:07 +04:00
|
|
|
SetAppColors();
|
2013-03-11 22:16:24 +04:00
|
|
|
if (param)
|
|
|
|
{
|
2015-07-21 04:10:37 +03:00
|
|
|
tmp = strlen(#path);
|
2015-08-03 02:43:40 +03:00
|
|
|
strlcpy(#path, #param, tmp);
|
2015-07-21 04:10:37 +03:00
|
|
|
$dec tmp
|
|
|
|
if (path[tmp]!='/') DSBYTE[#path+tmp] = '/'; //add "/" to the end of the string
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
else
|
2013-06-22 02:49:43 +04:00
|
|
|
{
|
2015-08-03 02:43:40 +03:00
|
|
|
strlcpy(#path, "/rd/1/", 6);
|
2013-06-22 02:49:43 +04: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);
|
2015-07-23 14:54:26 +03:00
|
|
|
SetEventMask(1100111b);
|
2015-07-21 04:10:37 +03:00
|
|
|
loop(){
|
|
|
|
switch(WaitEvent())
|
|
|
|
{
|
|
|
|
case evMouse:
|
|
|
|
if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break;
|
|
|
|
if (new_element_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2)
|
|
|
|
{
|
|
|
|
edit_box_mouse stdcall(#new_file_ed);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-08-02 01:08:58 +03:00
|
|
|
mouse.get();
|
2015-07-21 04:10:37 +03:00
|
|
|
|
2015-08-02 01:08:58 +03:00
|
|
|
if (!mouse.mkm) && (stats>0) stats = 0;
|
2015-08-03 02:43:40 +03:00
|
|
|
if (mouse.mkm) && (!stats)
|
2015-04-03 00:27:51 +03:00
|
|
|
{
|
2015-08-02 01:08:58 +03:00
|
|
|
x_old = mouse.x;
|
|
|
|
y_old = mouse.y;
|
2015-07-21 04:10:37 +03:00
|
|
|
stats = 1;
|
|
|
|
}
|
2015-08-02 01:08:58 +03:00
|
|
|
if (mouse.mkm) && (stats==1)
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
2015-08-02 01:08:58 +03:00
|
|
|
dif_x = mouse.x-x_old;
|
|
|
|
dif_y = mouse.y-y_old;
|
2015-07-21 04:10:37 +03:00
|
|
|
adif_x = fabs(dif_x);
|
|
|
|
adif_y = fabs(dif_y);
|
|
|
|
|
|
|
|
if (adif_x>adif_y)
|
2015-04-03 00:27:51 +03:00
|
|
|
{
|
2015-07-21 04:10:37 +03:00
|
|
|
if (dif_x > 150)
|
|
|
|
{
|
|
|
|
if (HistoryPath(GO_FORWARD))
|
|
|
|
{
|
2015-08-07 17:55:16 +03:00
|
|
|
files.KeyHome();
|
2015-07-21 04:10:37 +03:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
}
|
|
|
|
stats = 0;
|
|
|
|
}
|
|
|
|
if (dif_x < -150)
|
|
|
|
{
|
|
|
|
GoBack();
|
|
|
|
stats = 0;
|
|
|
|
}
|
2015-04-03 00:27:51 +03:00
|
|
|
}
|
2015-07-21 04:10:37 +03:00
|
|
|
else
|
2015-04-03 00:27:51 +03:00
|
|
|
{
|
2015-07-21 04:10:37 +03:00
|
|
|
if (dif_y < -100)
|
|
|
|
{
|
|
|
|
Dir_Up();
|
|
|
|
stats = 0;
|
|
|
|
}
|
2015-04-03 00:27:51 +03:00
|
|
|
}
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
2015-08-03 03:06:27 +03:00
|
|
|
if (files.MouseOver(mouse.x, mouse.y))&&((mouse.down|mouse.dblclick|mouse.up))
|
2015-04-03 00:27:51 +03:00
|
|
|
{
|
2015-07-21 04:10:37 +03:00
|
|
|
//select/open file {
|
2015-08-02 01:08:58 +03:00
|
|
|
if (mouse.key&MOUSE_LEFT)&&((mouse.down)||(mouse.dblclick))
|
2015-04-03 00:27:51 +03:00
|
|
|
{
|
2015-08-02 01:08:58 +03:00
|
|
|
if (mouse.y>=files.y)//&&(mouse.click)
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
2015-08-07 17:55:16 +03:00
|
|
|
id = mouse.y - files.y / files.line_h + files.first;
|
|
|
|
if (files.current!=id)
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
2015-08-02 01:08:58 +03:00
|
|
|
mouse.clearTime();
|
2015-08-07 17:55:16 +03:00
|
|
|
if(!mouse.up)&&(id-files.first<files.visible) {
|
|
|
|
files.current = id;
|
|
|
|
List_ReDraw();
|
|
|
|
}
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
2015-08-03 03:06:27 +03:00
|
|
|
else IF(mouse.dblclick)Open(0);
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
2015-04-03 00:27:51 +03:00
|
|
|
}
|
2015-07-21 04:10:37 +03:00
|
|
|
// } select/open file
|
|
|
|
else
|
|
|
|
//file menu {
|
2015-08-02 01:08:58 +03:00
|
|
|
if (mouse.key&MOUSE_RIGHT)&&(mouse.up)
|
2015-07-12 02:45:19 +03:00
|
|
|
{
|
2015-07-21 04:10:37 +03:00
|
|
|
menu_call_mouse = 1;
|
2015-08-07 17:55:16 +03:00
|
|
|
|
|
|
|
if (files.MouseOver(mouse.x, mouse.y))
|
2015-07-12 02:45:19 +03:00
|
|
|
{
|
2015-08-07 17:55:16 +03:00
|
|
|
files.current = mouse.y - files.y / files.line_h + files.first;
|
2015-08-10 15:06:47 +03:00
|
|
|
List_ReDraw();
|
2015-07-21 04:10:37 +03:00
|
|
|
menu_stak = malloc(4096);
|
2015-08-07 17:55:16 +03:00
|
|
|
CreateThread(#FileMenu,menu_stak+4092);
|
2015-07-12 02:45:19 +03:00
|
|
|
}
|
2015-07-21 04:10:37 +03:00
|
|
|
break;
|
2015-07-12 02:45:19 +03:00
|
|
|
}
|
2015-07-21 04:10:37 +03:00
|
|
|
// } file menu
|
2015-07-12 02:45:19 +03:00
|
|
|
}
|
2015-07-21 04:10:37 +03:00
|
|
|
|
2015-08-02 01:08:58 +03:00
|
|
|
if (mouse.vert)
|
2015-07-12 02:45:19 +03:00
|
|
|
{
|
2015-08-02 01:08:58 +03:00
|
|
|
if (files.MouseScroll(mouse.vert)) List_ReDraw();
|
2015-07-12 02:45:19 +03:00
|
|
|
break;
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
|
2015-08-14 17:47:36 +03: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 22:16:24 +04:00
|
|
|
{
|
2015-08-14 17:47:36 +03:00
|
|
|
if (mouse.lkm==1) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,0xC7C7C7,0xFFFFFF);
|
2015-08-02 01:08:58 +03:00
|
|
|
WHILE (mouse.lkm==1) && (files.first>0)
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
|
|
|
pause(8);
|
|
|
|
files.first--;
|
|
|
|
List_ReDraw();
|
2015-08-02 01:08:58 +03:00
|
|
|
mouse.get();
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
2015-08-14 17:47:36 +03:00
|
|
|
DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,0xFFFFFF,0xC7C7C7);
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
2015-08-14 17:47:36 +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)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2015-08-14 17:47:36 +03:00
|
|
|
if (mouse.lkm==1) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,0xC7C7C7,0xFFFFFF);
|
2015-08-02 01:08:58 +03:00
|
|
|
while (mouse.lkm==1) && (files.first<files.count-files.visible)
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
|
|
|
pause(8);
|
|
|
|
files.first++;
|
|
|
|
List_ReDraw();
|
2015-08-02 01:08:58 +03:00
|
|
|
mouse.get();
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
2015-08-14 17:47:36 +03:00
|
|
|
DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,0xFFFFFF,0xC7C7C7);
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
2015-07-21 04:10:37 +03:00
|
|
|
//Scrooll
|
2015-08-07 18:12:03 +03:00
|
|
|
if (!mouse.lkm) && (scroll_used) { scroll_used=false; Scroll(); }
|
2015-08-14 17:47:36 +03: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 04:10:37 +03:00
|
|
|
|
|
|
|
if (scroll_used)
|
|
|
|
{
|
2015-08-02 01:08:58 +03: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 17:47:36 +03:00
|
|
|
id = files.first;
|
|
|
|
files.first = -sc_slider_h / 2 + mouse.y -j -files.y * files.count;
|
|
|
|
files.first /= Form.cheight - 18 - files.y;
|
2015-07-21 04:10:37 +03:00
|
|
|
if (files.visible+files.first>files.count) files.first=files.count-files.visible;
|
|
|
|
if (id!=files.first) List_ReDraw();
|
2015-08-13 18:28:53 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-08-17 16:59:14 +03:00
|
|
|
|
|
|
|
if (two_panels) && (mouse.y > files.y) && (mouse.down) {
|
2015-08-13 18:28:53 +03:00
|
|
|
if (mouse.x<Form.cwidth/2)
|
|
|
|
{
|
|
|
|
if (active_panel!=1)
|
|
|
|
{
|
|
|
|
active_panel = 1;
|
2015-08-14 17:47:36 +03:00
|
|
|
goto __SET_VALS_AND_DRAW;
|
2015-08-13 18:28:53 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (active_panel!=2)
|
|
|
|
{
|
|
|
|
active_panel = 2;
|
2015-08-14 17:47:36 +03:00
|
|
|
__SET_VALS_AND_DRAW:
|
2015-08-17 15:45:56 +03:00
|
|
|
llist_copy(#files_active, #files_inactive);
|
|
|
|
llist_copy(#files_inactive, #files);
|
2015-08-13 18:28:53 +03:00
|
|
|
strcpy(#active_path, #inactive_path);
|
|
|
|
strcpy(#inactive_path, #path);
|
2015-08-14 17:47:36 +03:00
|
|
|
DrawFilePanels();
|
2015-08-13 18:28:53 +03:00
|
|
|
}
|
|
|
|
}
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
//Button pressed-----------------------------------------------------------------------------
|
|
|
|
case evButton:
|
|
|
|
id=GetButtonID();
|
|
|
|
if (id==1)
|
|
|
|
{
|
|
|
|
KillProcess(about_window);
|
|
|
|
ExitProcess();
|
|
|
|
}
|
|
|
|
if (del_active)
|
|
|
|
{
|
|
|
|
if (id==301) || (id==302) Del_File(302-id);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (new_element_active)
|
|
|
|
{
|
|
|
|
if (id==301) || (id==302) NewElement(302-id);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(id)
|
|
|
|
{
|
|
|
|
case 21: //Back
|
|
|
|
GoBack();
|
|
|
|
break;
|
|
|
|
case 22: //Forward
|
|
|
|
if (HistoryPath(GO_FORWARD))
|
|
|
|
{
|
2015-08-07 17:55:16 +03:00
|
|
|
files.KeyHome();
|
2015-07-21 04:10:37 +03:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
}
|
|
|
|
break;
|
2015-07-23 15:15:53 +03:00
|
|
|
case 23:
|
2013-03-11 22:16:24 +04:00
|
|
|
Dir_Up();
|
|
|
|
break;
|
2015-07-23 15:15:53 +03:00
|
|
|
case 24:
|
2013-04-04 21:07:38 +04:00
|
|
|
Copy(#file_path, CUT);
|
|
|
|
break;
|
2015-07-23 15:15:53 +03:00
|
|
|
case 25:
|
2013-04-04 21:07:38 +04:00
|
|
|
Copy(#file_path, NOCUT);
|
2013-03-11 22:16:24 +04:00
|
|
|
break;
|
2015-07-23 15:15:53 +03:00
|
|
|
case 26:
|
|
|
|
Paste();
|
2013-03-11 22:16:24 +04:00
|
|
|
break;
|
2015-08-17 15:45:56 +03:00
|
|
|
case 31...33: //sorting
|
|
|
|
sort_num = id - 30;
|
|
|
|
DrawList();
|
2015-07-21 04:10:37 +03:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2013-03-11 22:16:24 +04:00
|
|
|
break;
|
2015-07-21 04:10:37 +03:00
|
|
|
case 50...60: //Actions
|
|
|
|
FnProcess(id-50);
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
2015-07-21 04:10:37 +03:00
|
|
|
case 100...120:
|
2015-08-09 22:08:57 +03:00
|
|
|
ClickOnDisk(id-100);
|
|
|
|
break;
|
2015-07-21 04:10:37 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
//Key pressed-----------------------------------------------------------------------------
|
|
|
|
case evKey:
|
2015-08-10 13:47:21 +03:00
|
|
|
GetKeys();
|
2015-08-09 22:08:57 +03:00
|
|
|
|
2015-07-21 04:10:37 +03:00
|
|
|
if (Form.status_window>2) break;
|
|
|
|
if (del_active)
|
|
|
|
{
|
2015-08-10 13:47:21 +03:00
|
|
|
if (key_scancode == SCAN_CODE_ENTER) Del_File(true);
|
|
|
|
if (key_scancode == SCAN_CODE_ESC) Del_File(false);
|
2015-07-21 04:10:37 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (new_element_active)
|
|
|
|
{
|
2015-08-10 13:47:21 +03:00
|
|
|
if (key_scancode == SCAN_CODE_ESC) NewElement(0);
|
|
|
|
if (key_scancode == SCAN_CODE_ENTER) NewElement(1);
|
|
|
|
EAX= key_ascii << 8;
|
2015-07-21 04:10:37 +03:00
|
|
|
edit_box_key stdcall (#new_file_ed);
|
|
|
|
break;
|
|
|
|
}
|
2015-08-10 13:47:21 +03:00
|
|
|
if (files.ProcessKey(key_scancode))
|
2015-08-07 17:55:16 +03:00
|
|
|
{
|
|
|
|
List_ReDraw();
|
|
|
|
break;
|
|
|
|
}
|
2015-08-09 22:08:57 +03:00
|
|
|
|
2015-08-10 13:47:21 +03:00
|
|
|
if (TestBit(key_modifier, 2))
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
2015-08-10 13:47:21 +03:00
|
|
|
switch(key_scancode)
|
2015-08-09 21:23:01 +03:00
|
|
|
{
|
2015-08-10 00:59:25 +03:00
|
|
|
case 059...068:
|
2015-08-10 13:47:21 +03:00
|
|
|
key_scancode -= 59;
|
|
|
|
if (key_scancode<disc_num)
|
2015-08-10 00:59:25 +03:00
|
|
|
{
|
2015-08-14 17:47:36 +03:00
|
|
|
if (!two_panels)
|
|
|
|
{
|
|
|
|
DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click
|
|
|
|
pause(7);
|
|
|
|
}
|
2015-08-10 13:47:21 +03:00
|
|
|
ClickOnDisk(key_scancode);
|
2015-08-10 00:59:25 +03:00
|
|
|
}
|
|
|
|
break;
|
2015-08-09 21:23:01 +03: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-07-21 04:10:37 +03:00
|
|
|
strncpy(#temp, "\\S__",4);
|
|
|
|
strcat(#temp, #file_path);
|
|
|
|
RunProgram("/sys/media/kiv", #temp);
|
|
|
|
break;
|
2015-08-09 21:23:01 +03:00
|
|
|
case 049: //Ctrl+N - create new window
|
2015-07-21 04:10:37 +03:00
|
|
|
if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD);
|
|
|
|
RunProgram("/sys/File Managers/Eolite", #path);
|
|
|
|
break;
|
2015-08-10 00:59:25 +03:00
|
|
|
case 028: //Ctrl+Enter
|
|
|
|
if (!itdir) ShowOpenWithDialog();
|
|
|
|
else Open(1);
|
|
|
|
break;
|
2015-08-09 21:23:01 +03:00
|
|
|
case 030: //Ctrl+A - select all files
|
2015-07-21 04:10:37 +03:00
|
|
|
for (i=0; i<files.count; i++)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2015-07-21 04:10:37 +03:00
|
|
|
selected_offset = file_mas[i]*304 + buf+32 + 7;
|
2015-08-03 13:56:46 +03:00
|
|
|
if (!i) if (!strncmp(selected_offset+33, "..", 2)) continue; //do not selec ".." directory
|
2015-07-21 04:10:37 +03:00
|
|
|
ESBYTE[selected_offset] = 1;
|
|
|
|
selected_count++;
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
2015-07-21 04:10:37 +03:00
|
|
|
List_ReDraw();
|
|
|
|
break;
|
2015-08-09 21:23:01 +03:00
|
|
|
case 022: //Ctrl+U - unselect all files
|
2015-07-21 04:10:37 +03:00
|
|
|
for (i=0; i<files.count; i++)
|
|
|
|
{
|
|
|
|
selected_offset = file_mas[i]*304 + buf+32 + 7;
|
|
|
|
ESBYTE[selected_offset] = 0;
|
|
|
|
}
|
|
|
|
selected_count = 0;
|
|
|
|
List_ReDraw();
|
|
|
|
break;
|
2015-08-09 21:23:01 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2015-08-09 22:08:57 +03:00
|
|
|
|
2015-08-10 13:47:21 +03:00
|
|
|
switch (key_scancode)
|
2015-08-09 21:23:01 +03:00
|
|
|
{
|
2015-08-10 00:59:25 +03:00
|
|
|
case SCAN_CODE_BS:
|
2015-08-09 21:23:01 +03:00
|
|
|
//GoBack();
|
|
|
|
Dir_Up();
|
|
|
|
break;
|
2015-08-10 00:59:25 +03:00
|
|
|
case SCAN_CODE_ENTER:
|
2015-07-21 04:10:37 +03:00
|
|
|
Open(0);
|
|
|
|
break;
|
2015-08-10 00:59:25 +03:00
|
|
|
case 093: //menu
|
2015-07-21 04:10:37 +03:00
|
|
|
menu_call_mouse=0;
|
|
|
|
menu_stak = malloc(4096);
|
|
|
|
CreateThread(#FileMenu,menu_stak+4092);
|
|
|
|
break;
|
2015-08-10 00:59:25 +03:00
|
|
|
case SCAN_CODE_DEL:
|
2015-07-21 04:10:37 +03:00
|
|
|
Del_Form();
|
|
|
|
break;
|
2015-08-10 00:59:25 +03:00
|
|
|
case SCAN_CODE_INS:
|
2015-08-07 17:55:16 +03:00
|
|
|
selected_offset = file_mas[files.current]*304 + buf+32 + 7;
|
|
|
|
if (files.current==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory
|
2015-07-21 04:10:37 +03:00
|
|
|
if (ESBYTE[selected_offset])
|
|
|
|
{
|
|
|
|
ESBYTE[selected_offset]=0;
|
|
|
|
selected_count--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ESBYTE[selected_offset] = 1;
|
|
|
|
selected_count++;
|
|
|
|
}
|
2015-08-03 13:56:46 +03:00
|
|
|
_INSERT_END:
|
2015-08-07 17:55:16 +03:00
|
|
|
if (files.KeyDown()) List_ReDraw();
|
2015-07-21 04:10:37 +03:00
|
|
|
break;
|
2015-08-10 00:59:25 +03:00
|
|
|
case 059...068: //F1-F10
|
2015-08-10 13:47:21 +03:00
|
|
|
FnProcess(key_scancode-58);
|
2015-07-21 04:10:37 +03:00
|
|
|
break;
|
|
|
|
default:
|
2015-08-07 17:55:16 +03:00
|
|
|
for (i=files.current+1; i<files.count; i++)
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
|
|
|
strcpy(#temp, file_mas[i]*304+buf+72);
|
2015-08-10 13:47:21 +03:00
|
|
|
if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
|
2015-07-21 04:10:37 +03:00
|
|
|
{
|
2015-08-07 17:55:16 +03:00
|
|
|
files.current = i - 1;
|
|
|
|
files.KeyDown();
|
|
|
|
List_ReDraw();
|
2015-07-21 04:10:37 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
break;
|
2015-08-09 22:08:57 +03:00
|
|
|
case evIPC:
|
2015-07-21 04:10:37 +03:00
|
|
|
case evReDraw:
|
|
|
|
draw_window();
|
|
|
|
if (action_buf)
|
|
|
|
{
|
2015-08-09 22:08:57 +03:00
|
|
|
if (action_buf==COPY_PASTE_END)
|
|
|
|
{
|
|
|
|
FnProcess(5);
|
|
|
|
SelectFileByName(#copy_to+strrchr(#copy_to,'/'));
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
if (action_buf==300) { FnProcess(5); List_ReDraw(); }
|
2015-07-21 04:10:37 +03:00
|
|
|
action_buf=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cmd_free)
|
|
|
|
{
|
2015-07-16 04:44:30 +03:00
|
|
|
if(cmd_free==1) free(menu_stak);
|
|
|
|
else if(cmd_free==2)free(about_stak);
|
|
|
|
else if(cmd_free==3)free(properties_stak);
|
|
|
|
else if(cmd_free==4)free(settings_stak);
|
|
|
|
else if(cmd_free==5)free(copy_stak);
|
2015-07-21 04:10:37 +03:00
|
|
|
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()
|
|
|
|
{
|
2015-08-04 17:36:07 +03:00
|
|
|
DefineAndDrawWindow(GetScreenWidth()-550/4+rand_n,rand_n+30,550,500,0x73,system.color.work,TITLE,0);
|
2013-04-04 21:07:38 +04:00
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
if (Form.status_window>2) return;
|
2015-08-10 15:06:47 +03:00
|
|
|
if (Form.height < 350) MoveSize(OLD,OLD,OLD,350);
|
|
|
|
if (Form.width < 480) MoveSize(OLD,OLD,480,OLD);
|
2013-04-04 21:07:38 +04:00
|
|
|
GetProcessInfo(#Form, SelfInfo); //if win_size changed
|
2013-03-11 22:16:24 +04:00
|
|
|
PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
|
2015-08-04 17:36:07 +03:00
|
|
|
DrawBar(127, 8, 1, 25, system.color.work_graph);
|
|
|
|
for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,system.color.work);
|
|
|
|
for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,system.color.work);
|
|
|
|
DrawBar(246,0,Form.cwidth - 297,12, system.color.work); //upper editbox
|
|
|
|
DrawBar(246,29,Form.cwidth - 297,5,system.color.work); //under editbox
|
|
|
|
DrawRectangle(246,12,Form.cwidth - 303,16,system.color.work_graph);
|
2015-07-16 04:44:30 +03:00
|
|
|
DefineButton(Form.cwidth - 32,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about
|
2013-03-11 22:16:24 +04:00
|
|
|
PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
|
2013-04-01 00:25:54 +04:00
|
|
|
//main rectangles
|
2015-08-09 22:08:57 +03:00
|
|
|
DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42,system.color.work_graph);
|
|
|
|
DrawRectangle(0,39,Form.cwidth-1,Form.cheight - 40,col_palette[4]); //bg
|
2015-08-14 17:47:36 +03:00
|
|
|
for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);
|
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);
|
|
|
|
DrawFilePanels();
|
|
|
|
if (del_active) Del_Form();
|
|
|
|
if (new_element_active) NewElement_Form(new_element_active, #new_element_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawList()
|
|
|
|
{
|
2015-08-17 15:45:56 +03:00
|
|
|
word sorting_arrow_x;
|
|
|
|
DrawFlatButton(files.x, files.y-17, files.w - 141,16,31,system.color.work,T_FILE);
|
|
|
|
DrawFlatButton(files.x + files.w - 141, files.y-17,73,16,32,system.color.work,T_TYPE);
|
|
|
|
DrawFlatButton(files.x + files.w - 68, files.y-17,68,16,33,system.color.work,T_SIZE);
|
|
|
|
DrawFlatButton(files.x + files.w, files.y-17,16,16, 0,system.color.work,"\x18");
|
|
|
|
DrawFlatButton(files.x + files.w,files.y+files.h-16,16,16,0,system.color.work,"\x19");
|
|
|
|
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;
|
|
|
|
WriteText(sorting_arrow_x,files.y-12,0x80,system.color.work_graph,"\x19");
|
2015-08-14 17:47:36 +03:00
|
|
|
DrawBar(files.x+files.w,files.y,1,files.h,system.color.work_graph);
|
2015-08-17 15:45:56 +03:00
|
|
|
if (two_panels) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,system.color.work_graph);
|
2015-08-14 17:47:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void DrawFilePanels()
|
|
|
|
{
|
2015-08-09 22:08:57 +03:00
|
|
|
if (!two_panels)
|
|
|
|
{
|
2015-08-14 17:47:36 +03:00
|
|
|
DrawDeviceAndActionsLeftPanel();
|
2015-08-10 15:06:47 +03:00
|
|
|
files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59, files.line_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
|
|
|
|
{
|
2015-08-17 15:45:56 +03:00
|
|
|
llist_copy(#files, #files_inactive);
|
|
|
|
strcpy(#path, #inactive_path);
|
|
|
|
col_selec = 0xCCCccc;
|
|
|
|
|
2015-08-13 18:28:53 +03:00
|
|
|
if (active_panel==1)
|
|
|
|
{
|
|
|
|
files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.line_h);
|
|
|
|
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);
|
2015-08-17 15:45:56 +03:00
|
|
|
col_selec = 0x94AECE;
|
2015-08-13 18:28:53 +03:00
|
|
|
files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.line_h);
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
files.SetSizes(2, 57+22, Form.cwidth/2-2-17, Form.cheight-59-22, files.line_h);
|
|
|
|
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);
|
2015-08-17 15:45:56 +03:00
|
|
|
col_selec = 0x94AECE;
|
2015-08-13 18:28:53 +03:00
|
|
|
files.SetSizes(Form.cwidth/2, 57+22, Form.cwidth/2 -17, Form.cheight-59-22, files.line_h);
|
|
|
|
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;
|
2015-08-07 17:55:16 +03:00
|
|
|
static int old_current, 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-08-07 17:55:16 +03:00
|
|
|
old_current = files.current;
|
|
|
|
old_first = files.first;
|
|
|
|
list_full_redraw = false;
|
|
|
|
goto _ALL_LIST_REDRAW;
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
2015-08-07 17:55:16 +03:00
|
|
|
if (old_current != files.current)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2015-08-09 22:08:57 +03:00
|
|
|
if (old_current-files.first<files.visible) Line_ReDraw(0xFFFFFF, old_current-files.first);
|
2015-08-07 17:55:16 +03:00
|
|
|
Line_ReDraw(col_selec, files.current-files.first);
|
|
|
|
old_current = files.current;
|
|
|
|
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
|
|
|
|
2015-08-07 17:55:16 +03:00
|
|
|
for (j=0; j<files.visible; j++) if (files.current-files.first!=j) Line_ReDraw(0xFFFFFF, j); else Line_ReDraw(col_selec, files.current-files.first);
|
2013-04-01 00:25:54 +04:00
|
|
|
//in the bottom
|
2015-08-13 18:28:53 +03:00
|
|
|
all_lines_h = j * files.line_h;
|
|
|
|
DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h,0xFFFFFF);
|
|
|
|
DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work);
|
|
|
|
DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work);
|
2013-04-01 00:25:54 +04:00
|
|
|
Scroll();
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
2013-04-04 21:07:38 +04:00
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
void Line_ReDraw(dword color, filenum){
|
2013-04-12 04:15:39 +04:00
|
|
|
dword text_col=0,
|
2015-02-27 23:25:28 +03:00
|
|
|
ext1, attr,
|
2014-04-26 13:49:20 +04:00
|
|
|
file_offet,
|
|
|
|
file_name_off,
|
2013-10-17 03:48:20 +04:00
|
|
|
y=filenum*files.line_h+files.y;
|
2014-04-26 13:49:20 +04:00
|
|
|
BDVK file;
|
2014-04-20 13:01:20 +04:00
|
|
|
if (filenum==-1) return;
|
2013-04-05 04:26:21 +04:00
|
|
|
DrawBar(files.x,y,3,files.line_h,color);
|
|
|
|
DrawBar(files.x+19,y,files.w-19,files.line_h,color);
|
|
|
|
DrawBar(files.x+3,y+17,16,1,color);
|
|
|
|
if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,color);
|
|
|
|
if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,color);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2014-04-26 13:49:20 +04:00
|
|
|
file_offet = file_mas[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];
|
|
|
|
file_name_off = file_offet+40;
|
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;
|
|
|
|
if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing
|
|
|
|
Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0);
|
2015-08-13 18:28:53 +03:00
|
|
|
WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y + y,files.font_type,0,ConvertSize(file.sizelo));
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
else
|
2014-04-17 22:07:07 +04:00
|
|
|
{
|
2015-07-23 14:54:26 +03:00
|
|
|
if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1="<DIR>";
|
2014-04-17 22:07:07 +04:00
|
|
|
Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0);
|
|
|
|
}
|
|
|
|
|
2015-02-27 23:25:28 +03:00
|
|
|
if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
|
2013-04-04 21:07:38 +04:00
|
|
|
if (color!=0xFFFfff)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
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);
|
2015-07-23 14:54:26 +03:00
|
|
|
sprintf(#file_path,"%s%s",#path,file_name_off);
|
2013-03-11 22:16:24 +04:00
|
|
|
if (text_col==0xA6A6B7) text_col=0xFFFFFF;
|
|
|
|
}
|
2014-04-26 13:49:20 +04:00
|
|
|
if (file.selected) text_col=0xFF0000;
|
2013-04-01 00:25:54 +04:00
|
|
|
if (Form.width>=480)
|
|
|
|
{
|
2013-04-05 04:26:21 +04:00
|
|
|
FileShow.start_x = files.x + 23;
|
2013-04-01 00:25:54 +04:00
|
|
|
FileShow.font_color = text_col;
|
2015-08-06 19:13:03 +03:00
|
|
|
FileShow.area_size_x = files.w - 164;
|
2014-04-26 13:49:20 +04:00
|
|
|
FileShow.text_pointer = file_name_off;
|
2015-08-10 15:45:00 +03:00
|
|
|
FileShow.start_y = files.text_y + y;
|
2013-04-01 00:25:54 +04:00
|
|
|
PathShow_prepare stdcall(#FileShow);
|
|
|
|
PathShow_draw stdcall(#FileShow);
|
|
|
|
}
|
2015-08-13 18:28:53 +03:00
|
|
|
DrawBar(files.x+files.w-141,y,1,files.line_h,system.color.work); //gray line 1
|
|
|
|
DrawBar(files.x+files.w-68,y,1,files.line_h,system.color.work); //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){
|
|
|
|
int errornum, maxcount;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
2013-04-04 21:07:38 +04:00
|
|
|
if (redraw!=ONLY_SHOW)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2013-04-04 21:07:38 +04:00
|
|
|
if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\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 (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/');
|
|
|
|
if (errornum)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
|
|
|
HistoryPath(ADD_NEW_PATH);
|
|
|
|
GoBack();
|
|
|
|
Write_Error(errornum);
|
|
|
|
return;
|
|
|
|
}
|
2013-04-04 21:07:38 +04:00
|
|
|
maxcount = sizeof(file_mas)/sizeof(dword)-1;
|
2013-11-14 04:22:55 +04:00
|
|
|
if (files.count>maxcount) files.count = maxcount;
|
2015-08-07 17:55:16 +03:00
|
|
|
if (files.count>0) && (files.current-files.first==-1) files.current=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
|
|
|
{
|
2015-08-07 17:55:16 +03:00
|
|
|
if(!_not_draw)
|
|
|
|
{
|
|
|
|
PathShow.area_size_x = Form.cwidth-306;
|
|
|
|
DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
|
|
|
|
PathShow_prepare stdcall(#PathShow);
|
|
|
|
PathShow_draw stdcall(#PathShow);
|
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
HistoryPath(ADD_NEW_PATH);
|
2013-04-04 21:07:38 +04:00
|
|
|
files.visible = files.h / files.line_h;
|
2015-07-21 04:10:37 +03:00
|
|
|
if (files.count < files.visible) files.visible = files.count;
|
|
|
|
if (redraw!=ONLY_SHOW) Sorting();
|
2015-08-07 17:55:16 +03:00
|
|
|
list_full_redraw = true;
|
2015-07-23 14:54:26 +03:00
|
|
|
if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw();
|
2015-07-31 02:11:23 +03:00
|
|
|
DrawSystemDiscs();
|
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();
|
|
|
|
if(!_not_draw) { list_full_redraw=true; List_ReDraw(); }
|
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline Sorting()
|
|
|
|
{
|
|
|
|
dword k=0, l=1;
|
2014-04-26 13:49:20 +04:00
|
|
|
dword file_off;
|
2015-07-23 14:54:26 +03:00
|
|
|
if (!strncmp(#path,"/",2)) //do not sort
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2015-07-21 04:10:37 +03:00
|
|
|
for(k=1;k<files.count;k++;) file_mas[k]=k;
|
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
|
|
|
{
|
2014-04-26 13:49:20 +04:00
|
|
|
if (!real_files_names_case) strttl(file_off+40);
|
|
|
|
if (TestBit(ESDWORD[file_off],4)) //directory?
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
|
|
|
file_mas[k]=j;
|
|
|
|
k++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
file_mas[files.count-l]=j;
|
2013-03-11 22:16:24 +04:00
|
|
|
l++;
|
|
|
|
}
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
//sorting: files first, then folders
|
2013-03-11 22:16:24 +04:00
|
|
|
Sort_by_Name(0,k-1);
|
2015-07-21 04:10:37 +03: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 21:45:59 +03:00
|
|
|
//make ".." first item in list
|
2015-08-17 15:45:56 +03: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 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Del_Form()
|
|
|
|
{
|
2015-03-09 18:14:09 +03:00
|
|
|
dword selected_offset2;
|
|
|
|
int cont = 0;
|
|
|
|
byte f_count[128];
|
2015-07-19 21:45:59 +03:00
|
|
|
int dform_x = files.w - 220 / 2 + files.x;
|
2015-07-23 14:54:26 +03:00
|
|
|
if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return;
|
2013-10-10 11:16:37 +04:00
|
|
|
if (del_active==2)
|
2013-10-09 22:10:23 +04:00
|
|
|
{
|
2013-10-10 11:16:37 +04:00
|
|
|
if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
|
2013-10-09 22:10:23 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-10-10 11:16:37 +04:00
|
|
|
if (!files.count) return;
|
2015-08-04 17:36:07 +03:00
|
|
|
DrawPopup(dform_x,160,220,85,1,system.color.work,system.color.work_graph);
|
|
|
|
WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE);
|
2015-03-09 18:14:09 +03:00
|
|
|
for (i=0; i<files.count; i++)
|
2013-10-10 11:16:37 +04:00
|
|
|
{
|
2015-03-09 18:14:09 +03:00
|
|
|
selected_offset2 = file_mas[i]*304 + buf+32 + 7;
|
|
|
|
if (ESBYTE[selected_offset2]) cont++;
|
|
|
|
}
|
|
|
|
if (cont)
|
|
|
|
{
|
2015-07-16 04:44:30 +03:00
|
|
|
sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,cont,DEL_MORE_FILES_2);
|
2015-08-04 17:36:07 +03:00
|
|
|
WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.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
|
|
|
{
|
2015-08-04 17:36:07 +03: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 18:14:09 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WriteText(164+dform_x,190,0x80,0,"...?");
|
|
|
|
ESI = 24;
|
|
|
|
WriteText(dform_x+20,190,0,0,#file_name);
|
|
|
|
}
|
2013-10-10 11:16:37 +04:00
|
|
|
}
|
|
|
|
DrawFlatButton(dform_x+27,208,70,20,301,0xFFB6B5,T_YES);
|
|
|
|
DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO);
|
|
|
|
del_active=1;
|
2013-10-09 22:10:23 +04:00
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
2013-10-14 02:18:41 +04:00
|
|
|
int del_error;
|
|
|
|
int Del_File2(dword way)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2013-10-07 02:56:22 +04:00
|
|
|
dword dirbuf, fcount, i, filename;
|
2013-10-14 02:18:41 +04:00
|
|
|
int error;
|
|
|
|
char del_from[4096];
|
|
|
|
if (isdir(way))
|
2013-10-10 02:46:17 +04:00
|
|
|
{
|
2013-10-14 02:18:41 +04:00
|
|
|
if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error;
|
2013-10-10 02:46:17 +04:00
|
|
|
for (i=0; i<fcount; i++)
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
2013-10-10 11:16:37 +04:00
|
|
|
if (CheckEvent()==evReDraw) draw_window();
|
2013-10-10 02:46:17 +04:00
|
|
|
filename = i*304+dirbuf+72;
|
2015-07-21 04:10:37 +03:00
|
|
|
sprintf(#del_from,"%s/%s",way,filename);
|
2013-10-10 02:46:17 +04:00
|
|
|
if ( TestBit(ESDWORD[filename-40], 4) )
|
2015-07-19 21:45:59 +03:00
|
|
|
{
|
2013-10-10 02:46:17 +04:00
|
|
|
Del_File2(#del_from);
|
2015-07-19 21:45:59 +03:00
|
|
|
}
|
2013-10-10 02:46:17 +04:00
|
|
|
else
|
2013-10-14 02:18:41 +04:00
|
|
|
{
|
|
|
|
if (error = DeleteFile(#del_from)) del_error = error;
|
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
2013-10-10 02:46:17 +04:00
|
|
|
}
|
2013-10-14 02:18:41 +04:00
|
|
|
if (error = DeleteFile(way)) del_error = error;
|
2013-10-07 02:56:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Del_File(byte dodel)
|
2013-10-14 02:18:41 +04:00
|
|
|
{
|
2014-04-26 02:31:07 +04:00
|
|
|
byte del_from[4096];
|
2014-12-03 04:04:03 +03:00
|
|
|
dword selected_offset2;
|
|
|
|
int tst, count, i;
|
2014-04-26 02:31:07 +04:00
|
|
|
|
2013-10-07 02:56:22 +04:00
|
|
|
if (dodel==true)
|
|
|
|
{
|
2013-10-10 11:16:37 +04:00
|
|
|
del_active=2;
|
2013-10-10 02:46:17 +04:00
|
|
|
if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
|
2013-10-14 02:18:41 +04:00
|
|
|
del_error = 0;
|
2014-12-03 04:04:03 +03:00
|
|
|
|
2015-03-09 21:02:10 +03:00
|
|
|
if (selected_count)
|
2014-12-03 04:04:03 +03:00
|
|
|
{
|
2015-03-09 21:02:10 +03:00
|
|
|
for (i=0; i<files.count; i++)
|
|
|
|
{
|
|
|
|
selected_offset2 = file_mas[i]*304 + buf+32 + 7;
|
|
|
|
if (ESBYTE[selected_offset2]) {
|
2015-07-21 04:10:37 +03:00
|
|
|
sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
|
2015-03-09 21:02:10 +03:00
|
|
|
Del_File2(#del_from);
|
|
|
|
}
|
|
|
|
}
|
2014-12-03 04:04:03 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-03-09 21:02:10 +03:00
|
|
|
Del_File2(#file_path);
|
2014-12-03 04:04:03 +03:00
|
|
|
}
|
2013-10-14 02:18:41 +04:00
|
|
|
if (del_error) Write_Error(del_error);
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
del_active=0;
|
2013-10-10 02:46:17 +04:00
|
|
|
DeleteButton(301);
|
|
|
|
DeleteButton(302);
|
2013-04-04 21:07:38 +04:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
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();
|
2013-03-11 22:16:24 +04:00
|
|
|
Open_Dir(#path,ONLY_OPEN);
|
2013-11-14 04:22:55 +04:00
|
|
|
if (!real_files_names_case) strttl(that_file);
|
2015-08-07 17:55:16 +03:00
|
|
|
for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
|
|
|
|
files.current = ind - 1;
|
|
|
|
files.KeyDown();
|
2013-03-11 22:16:24 +04:00
|
|
|
List_ReDraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Dir_Up()
|
|
|
|
{
|
|
|
|
char cur_folder[4096];
|
|
|
|
i=strlen(#path)-1;
|
|
|
|
if (i==0) return;
|
|
|
|
path[i]=0x00;
|
|
|
|
i = strrchr(#path, '/');
|
|
|
|
strcpy(#cur_folder, #path+i);
|
|
|
|
path[i]=0x00;
|
2015-08-07 17:55:16 +03:00
|
|
|
SelectFileByName(#cur_folder);
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
2015-02-22 00:32:15 +03:00
|
|
|
void Open(byte rez)
|
2013-04-01 00:25:54 +04:00
|
|
|
{
|
2015-02-21 23:12:52 +03:00
|
|
|
byte temp[4096];
|
2015-03-09 21:02:10 +03:00
|
|
|
selected_count = 0;
|
2015-02-21 23:12:52 +03:00
|
|
|
if (rez)
|
|
|
|
{
|
2015-07-23 14:54:26 +03:00
|
|
|
if (!strncmp(#file_name,"..",3)) return;
|
2015-02-21 23:12:52 +03:00
|
|
|
strcpy(#temp, #file_path);
|
|
|
|
if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end
|
|
|
|
RunProgram("/sys/File Managers/Eolite", #temp);
|
|
|
|
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);
|
|
|
|
if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
|
|
|
|
files.first=files.current=0;
|
2013-04-04 21:07:38 +04:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2013-04-01 00:25:54 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
inline fastcall void GoBack()
|
2013-03-11 22:16:24 +04:00
|
|
|
{
|
|
|
|
char cur_folder[4096];
|
|
|
|
strcpy(#cur_folder, GetCurrentFolder());
|
2015-08-07 17:55:16 +03:00
|
|
|
if (HistoryPath(GO_BACK)) SelectFileByName(#cur_folder);
|
2013-03-11 22:16:24 +04:00
|
|
|
}
|
|
|
|
|
2015-02-12 15:52:49 +03:00
|
|
|
void ShowOpenWithDialog()
|
|
|
|
{
|
|
|
|
byte param[4097];
|
2015-07-21 04:10:37 +03:00
|
|
|
sprintf(#param,"~%s",#file_path);
|
2015-02-12 15:52:49 +03:00
|
|
|
RunProgram("/sys/@open", #param);
|
|
|
|
}
|
|
|
|
|
2015-05-14 19:09:36 +03:00
|
|
|
void NewElement(byte newf)
|
|
|
|
{
|
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;
|
2015-05-14 19:09:36 +03:00
|
|
|
if (newf)
|
|
|
|
{
|
2015-07-21 04:10:37 +03:00
|
|
|
sprintf(#temp,"%s%s",#path,new_file_ed.text);
|
2015-07-19 21:45:59 +03:00
|
|
|
info_result = GetFileInfo(#temp, #element_info);
|
2015-06-20 01:23:51 +03:00
|
|
|
switch(new_element_active)
|
2015-05-14 19:09:36 +03:00
|
|
|
{
|
2015-07-19 21:45:59 +03:00
|
|
|
case CREATE_FILE:
|
|
|
|
if (info_result==5)
|
2015-05-15 15:32:26 +03:00
|
|
|
{
|
2015-06-20 01:23:51 +03:00
|
|
|
WriteFile(0, 0, #temp);
|
|
|
|
if (EAX)
|
|
|
|
{
|
|
|
|
Write_Error(EAX);
|
|
|
|
ShowMessage(NOT_CREATE_FILE, 150);
|
|
|
|
}
|
2015-05-15 15:32:26 +03:00
|
|
|
}
|
2015-06-20 01:23:51 +03:00
|
|
|
else
|
2015-05-15 15:32:26 +03:00
|
|
|
{
|
2015-07-29 15:14:49 +03:00
|
|
|
notify(FS_ITEM_ALREADY_EXISTS);
|
2015-06-20 01:23:51 +03:00
|
|
|
}
|
2015-07-19 21:45:59 +03:00
|
|
|
break;
|
|
|
|
case CREATE_FOLDER:
|
|
|
|
if (info_result==5)
|
2015-06-20 01:23:51 +03:00
|
|
|
{
|
|
|
|
CreateDir(#temp);
|
|
|
|
if (EAX)
|
|
|
|
{
|
|
|
|
Write_Error(EAX);
|
|
|
|
ShowMessage(NOT_CREATE_FOLDER, 150);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-29 15:14:49 +03:00
|
|
|
notify(FS_ITEM_ALREADY_EXISTS);
|
2015-06-20 01:23:51 +03:00
|
|
|
}
|
2015-07-19 21:45:59 +03:00
|
|
|
break;
|
|
|
|
case RENAME_ITEM:
|
|
|
|
if (info_result==5)
|
2015-06-20 01:23:51 +03:00
|
|
|
{
|
|
|
|
if (itdir)
|
|
|
|
{
|
|
|
|
if (del_rezult = DeleteFile(#file_path))
|
|
|
|
{
|
|
|
|
Write_Error(del_rezult);
|
|
|
|
ShowMessage(T_DEL_ERROR_1, 150);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (CreateDir(#temp)) CreateDir(#file_path);
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2015-08-07 17:55:16 +03:00
|
|
|
SelectFileByName(new_file_ed.text);
|
2015-06-20 01:23:51 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (copy_rezult = CopyFile(#file_path,#temp))
|
|
|
|
{
|
|
|
|
Write_Error(copy_rezult);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Del_File(true);
|
2015-08-07 17:55:16 +03:00
|
|
|
SelectFileByName(new_file_ed.text);
|
2015-06-20 01:23:51 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-29 15:14:49 +03:00
|
|
|
notify(FS_ITEM_ALREADY_EXISTS);
|
2015-05-15 15:32:26 +03:00
|
|
|
}
|
2015-05-14 19:09:36 +03:00
|
|
|
}
|
2015-05-15 15:32:26 +03:00
|
|
|
new_element_active = 0;
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2015-08-07 17:55:16 +03:00
|
|
|
SelectFileByName(new_file_ed.text);
|
2015-05-14 19:09:36 +03:00
|
|
|
}
|
|
|
|
new_element_active = 0;
|
2015-05-15 15:32:26 +03:00
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
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;
|
2015-06-20 01:23:51 +03:00
|
|
|
strcpy(#new_element_name, strng);
|
|
|
|
new_file_ed.size = new_file_ed.pos = strlen(strng);
|
2015-05-14 19:09:36 +03:00
|
|
|
}
|
2015-08-04 17:36:07 +03:00
|
|
|
DrawPopup(dform_x,160,220,85,1,system.color.work,system.color.work_graph);
|
2015-07-19 21:45:59 +03:00
|
|
|
new_file_ed.left = dform_x+24;
|
2015-05-14 19:09:36 +03:00
|
|
|
edit_box_draw stdcall (#new_file_ed);
|
2015-07-19 21:45:59 +03:00
|
|
|
DrawRectangle(new_file_ed.left-1, new_file_ed.top-1, new_file_ed.width+2, 16, 0xFFFfff);
|
2015-08-04 17:36:07 +03:00
|
|
|
DrawRectangle(new_file_ed.left-2, new_file_ed.top-2, new_file_ed.width+4, 18, system.color.work_graph);
|
2015-07-21 04:10:37 +03:00
|
|
|
if (new_element_active==3) DrawFlatButton(dform_x+22,208,85,22,301,0xFFB6B5,T_RENAME);
|
|
|
|
else DrawFlatButton(dform_x+27,208,70,22,301,0xFFB6B5,T_CREATE);
|
2015-07-19 21:45:59 +03:00
|
|
|
DrawFlatButton(dform_x+120,208,70,22,302,0xC6DFC6,T_CANCEL);
|
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:
|
2013-12-22 04:09:21 +04:00
|
|
|
if (!active_about)
|
|
|
|
{
|
2015-07-16 04:44:30 +03:00
|
|
|
about_stak = malloc(4096);
|
|
|
|
about_window = CreateThread(#about_dialog,about_stak+4092);
|
2013-12-22 04:09:21 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ActivateWindow(GetProcessSlot(about_window));
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (!files.count) break;
|
2015-07-19 21:45:59 +03:00
|
|
|
NewElement_Form(RENAME_ITEM, #file_name);
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
|
|
|
case 3:
|
2015-07-21 04:10:37 +03:00
|
|
|
if (!itdir) RunProgram("/sys/tinypad", #file_path);
|
2013-04-01 00:25:54 +04:00
|
|
|
break;
|
|
|
|
case 4:
|
2015-07-21 04:10:37 +03:00
|
|
|
if (!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
|
2015-08-13 18:28:53 +03:00
|
|
|
if (two_panels)
|
|
|
|
{
|
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);
|
|
|
|
LoadIniSettings();
|
|
|
|
GetSystemDiscs();
|
|
|
|
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:
|
2015-07-16 04:44:30 +03:00
|
|
|
properties_stak = malloc(8096);
|
|
|
|
CreateThread(#properties_dialog, properties_stak+8092);
|
2015-02-22 21:42:51 +03:00
|
|
|
break;
|
2013-04-01 00:25:54 +04:00
|
|
|
case 10: //F10
|
2015-02-17 19:46:38 +03:00
|
|
|
if (!active_settings)
|
|
|
|
{
|
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-02-20 18:25:51 +03:00
|
|
|
//need to remove these functiones, they are a very old shit :)
|
|
|
|
dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;}
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
stop:
|