2013-03-11 22:16:24 +04:00
|
|
|
|
//Leency & Veliant 2008-2013
|
|
|
|
|
//GNU GPL licence.
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//libraries
|
|
|
|
|
#define MEMSIZE 0xA0000
|
|
|
|
|
#include "..\lib\kolibri.h"
|
|
|
|
|
#include "..\lib\strings.h"
|
|
|
|
|
#include "..\lib\mem.h"
|
|
|
|
|
#include "..\lib\dll.h"
|
|
|
|
|
#include "..\lib\lib.obj\box_lib.h"
|
|
|
|
|
#include "..\lib\file_system.h"
|
|
|
|
|
#include "..\lib\figures.h"
|
2013-03-26 02:50:35 +04:00
|
|
|
|
#include "..\lib\encoding.h"
|
2013-04-01 00:25:54 +04:00
|
|
|
|
#include "..\lib\list_box.h"
|
|
|
|
|
#include "..\lib\copyf.h"
|
2013-03-11 22:16:24 +04:00
|
|
|
|
//images
|
|
|
|
|
#include "imgs\toolbar.txt"
|
|
|
|
|
#include "imgs\left_p.txt"
|
|
|
|
|
|
|
|
|
|
//for OpenDir
|
|
|
|
|
#define ONLY_SHOW 0
|
|
|
|
|
#define WITH_REDRAW 1
|
|
|
|
|
#define ONLY_OPEN 2
|
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
#define TITLE "Eolite File Manager v1.77"
|
|
|
|
|
#define ABOUT_TITLE "Eolite v1.77"
|
2013-03-11 22:16:24 +04:00
|
|
|
|
dword col_work = 0xE4DFE1;
|
|
|
|
|
dword col_border = 0x819FC5;
|
|
|
|
|
dword col_padding = 0xC8C9C9;
|
|
|
|
|
dword col_selec = 0x94AECE;
|
|
|
|
|
dword col_lpanel = 0x00699C;
|
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
int toolbar_buttons_x[7]={9,46,85,134,167,203};
|
|
|
|
|
char tmp_disk_del_param[3]="d0";
|
|
|
|
|
struct path_string { char Item[4096]; };
|
|
|
|
|
|
|
|
|
|
llist files;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
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],
|
2013-03-11 22:16:24 +04:00
|
|
|
|
copy_file[4096],
|
2013-04-01 00:25:54 +04:00
|
|
|
|
temp[4096];
|
|
|
|
|
byte
|
|
|
|
|
cut_active,
|
|
|
|
|
rename_active,
|
|
|
|
|
del_active;
|
|
|
|
|
byte
|
|
|
|
|
show_dev_name=1,
|
|
|
|
|
sort_num=2,
|
|
|
|
|
isdir;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
|
|
|
|
proc_info Form;
|
|
|
|
|
mouse m;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
int mouse_dd, scroll_used, scroll_size;
|
|
|
|
|
dword buf, off;
|
|
|
|
|
dword file_mas[6898];
|
|
|
|
|
int j, i;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
|
|
|
|
edit_box edit2= {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6};
|
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};
|
|
|
|
|
|
|
|
|
|
#include "include\some_code.h"
|
|
|
|
|
#include "include\about_dialog.h"
|
|
|
|
|
#include "include\sorting.h"
|
|
|
|
|
#include "include\icons_f.h"
|
|
|
|
|
#include "include\ini.h"
|
|
|
|
|
#include "include\left_panel.h"
|
|
|
|
|
#include "include\history.h"
|
2013-04-01 00:25:54 +04:00
|
|
|
|
#include "include\file_menu.h"
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
|
|
|
|
void main()
|
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
word key, id, can_show, can_select;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
files.line_h=18;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
mem_Init();
|
|
|
|
|
if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Error while loading library /rd/1/lib/box_lib.obj");
|
2013-04-01 00:25:54 +04:00
|
|
|
|
SystemDiscsGet();
|
2013-03-30 04:52:50 +04:00
|
|
|
|
GetIni(1);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
if (param)
|
|
|
|
|
{
|
|
|
|
|
strcpy(#path, #param);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
|
|
|
|
else
|
2013-03-30 04:52:50 +04:00
|
|
|
|
strcpy(#path, "/rd/1/");
|
2013-03-11 22:16:24 +04:00
|
|
|
|
Open_Dir(#path,ONLY_OPEN);
|
2013-03-30 04:52:50 +04:00
|
|
|
|
SetEventMask(0x27);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
loop() switch(WaitEvent())
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
|
|
|
|
case evMouse:
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (del_active) break;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
id=GetProcessSlot(Form.ID);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (id<>GetActiveProcess()) || (Form.status_window>2) break;
|
|
|
|
|
IF (rename_active) { edit_box_mouse stdcall(#edit2); break; }
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
|
|
|
|
m.get();
|
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
if (m.lkm) can_select = 1;
|
|
|
|
|
if (m.pkm)
|
|
|
|
|
{
|
|
|
|
|
can_show = 1;
|
|
|
|
|
if (m.y - 57 / files.line_h != files.current) can_select = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//select/open file {
|
|
|
|
|
if (!m.lkm) && (!m.pkm) && (can_select)
|
|
|
|
|
{
|
|
|
|
|
can_select = 0;
|
|
|
|
|
if (m.y<57) break;
|
|
|
|
|
id = m.y - 57 / files.line_h;
|
|
|
|
|
if (files.current!=id) FileList_ReDraw(id-files.current);
|
|
|
|
|
else Open();
|
|
|
|
|
};
|
|
|
|
|
// } select/open file
|
|
|
|
|
|
|
|
|
|
//file menu {
|
|
|
|
|
if (!m.pkm) && (!m.lkm) && (can_show)
|
|
|
|
|
{
|
|
|
|
|
can_show = 0;
|
|
|
|
|
if (m.y<57) break;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
SwitchToAnotherThread();
|
|
|
|
|
CreateThread(#FileMenu,#stak2);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// } file menu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (m.vert)
|
|
|
|
|
{
|
|
|
|
|
files.MouseScroll(m.vert);
|
|
|
|
|
List_ReDraw();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
|
|
|
|
if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<57)
|
|
|
|
|
{
|
|
|
|
|
IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),41,14,14,0xC7C7C7,0xFFFFFF);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
WHILE (m.lkm==1) && (files.first>0)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
pause(8);
|
|
|
|
|
files.first--;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
List_ReDraw();
|
|
|
|
|
m.get();
|
|
|
|
|
}
|
|
|
|
|
DrawRectangle3D(onLeft(26,0),41,14,14,0xFFFFFF,0xC7C7C7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y<onTop(22,0)+16)
|
|
|
|
|
{
|
|
|
|
|
IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),onTop(21,0),14,14,0xC7C7C7,0xFFFFFF);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
while (m.lkm==1) && (files.first<files.count-files.visible)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
pause(8);
|
|
|
|
|
files.first++;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
List_ReDraw();
|
|
|
|
|
m.get();
|
|
|
|
|
}
|
|
|
|
|
DrawRectangle3D(onLeft(26,0),onTop(21,0),14,14,0xFFFFFF,0xC7C7C7);
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
//Scrooll
|
|
|
|
|
if (!m.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); }
|
|
|
|
|
if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y<Form.height) && (m.lkm) && (!scroll_used) {scroll_used=1;Scroll();}
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
|
|
|
|
if (scroll_used)
|
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (scroll_size/2+57>m.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+57; //anee eo?ni? iaa ieiii
|
|
|
|
|
id=files.first;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
j= scroll_size/2;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
files.first = m.y -j -57 * files.count;
|
|
|
|
|
files.first /= onTop(22,57);
|
|
|
|
|
IF (files.visible+files.first>files.count) files.first=files.count-files.visible;
|
|
|
|
|
IF (id<>files.first) List_ReDraw();
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
//Button pressed-----------------------------------------------------------------------------
|
|
|
|
|
case evButton:
|
|
|
|
|
id=GetButtonID();
|
|
|
|
|
IF (id==1) ExitProcess();
|
|
|
|
|
|
|
|
|
|
IF (del_active)
|
|
|
|
|
{
|
|
|
|
|
IF (id==301) || (id==302) Del_File(302-id);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
switch(id)
|
|
|
|
|
{
|
|
|
|
|
case 21: //Back
|
|
|
|
|
GoBack();
|
|
|
|
|
break;
|
|
|
|
|
case 22: //Forward
|
|
|
|
|
if (HistoryPath(GO_FORWARD))
|
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
files.first=files.current=NULL; //aaa?o nienea
|
2013-03-11 22:16:24 +04:00
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 23: //up!
|
|
|
|
|
Dir_Up();
|
|
|
|
|
break;
|
|
|
|
|
case 24: //cut
|
|
|
|
|
key=24;
|
|
|
|
|
case 25: //copy
|
|
|
|
|
goto CTRLC_MARK;
|
|
|
|
|
case 26: //paste
|
|
|
|
|
Paste();
|
|
|
|
|
break;
|
|
|
|
|
case 31...33: //sort
|
|
|
|
|
IF(sort_num==1) DrawFilledBar(onLeft(192,168)/2+210,42,6,10);
|
|
|
|
|
IF(sort_num==2) DrawFilledBar(onLeft(115,0),42,6,10);
|
|
|
|
|
IF(sort_num==3) DrawFilledBar(onLeft(44,0),42,6,10);
|
|
|
|
|
sort_num=id-30;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
break;
|
|
|
|
|
case 78: //rescan devices
|
|
|
|
|
Tip(56, "Devices", 78, "-");
|
|
|
|
|
pause(10);
|
|
|
|
|
GetIni(1);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
SystemDiscsGet();
|
2013-03-11 22:16:24 +04:00
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
|
DrawLeftPanel();
|
|
|
|
|
break;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
case 50...60: //Actions
|
|
|
|
|
ActionsProcess(id-50);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
break;
|
|
|
|
|
case 100...120:
|
|
|
|
|
DEVICE_MARK:
|
2013-04-01 00:25:54 +04:00
|
|
|
|
DrawRectangle3D(17,id-100*16+74,159,16, 0, 0); //auaaeaiea
|
2013-03-11 22:16:24 +04:00
|
|
|
|
strcpy(#path, #disk_list[id-100].Item);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
files.first=files.current=0;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
Open_Dir(#path,1);
|
|
|
|
|
pause(5);
|
|
|
|
|
DrawRectangle3D(17,id-100*16+74,159,16, 0xFFFFFF, 0xFFFFFF);
|
|
|
|
|
break;
|
|
|
|
|
case 130...160:
|
|
|
|
|
tmp_disk_del_param[1]=disk_list[id-130].Item[4];
|
|
|
|
|
RunProgram("/sys/tmpdisk", #tmp_disk_del_param);
|
|
|
|
|
pause(10);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
SystemDiscsGet();
|
2013-03-11 22:16:24 +04:00
|
|
|
|
Open_Dir(#path,WITH_REDRAW);
|
|
|
|
|
DrawLeftPanel();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
//Key pressed-----------------------------------------------------------------------------
|
|
|
|
|
case evKey:
|
|
|
|
|
key = GetKey();
|
|
|
|
|
if (Form.status_window>2) break;
|
|
|
|
|
IF (del_active)
|
|
|
|
|
{
|
|
|
|
|
IF (key==013) Del_File(true);
|
|
|
|
|
IF (key==027) Del_File(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
IF (edit2.flags<>64) && (key<>13) && (key<>27)
|
|
|
|
|
{
|
|
|
|
|
EAX=key<<8;
|
|
|
|
|
edit_box_key stdcall (#edit2);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
switch (key)
|
|
|
|
|
{
|
|
|
|
|
case 209...217:
|
|
|
|
|
id=key-110;
|
|
|
|
|
IF (id-100>=disc_num) break;
|
|
|
|
|
GOTO DEVICE_MARK;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
case 008:
|
2013-03-11 22:16:24 +04:00
|
|
|
|
//GoBack();
|
|
|
|
|
Dir_Up();
|
|
|
|
|
break;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
case 004: //Ctrl+D set as bg
|
2013-03-11 22:16:24 +04:00
|
|
|
|
strcpy(#temp, "\\S__");
|
|
|
|
|
strcat(#temp, #file_path);
|
|
|
|
|
RunProgram("/sys/media/kiv", #temp);
|
|
|
|
|
break;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
case 014: //Ctrl+N new window
|
2013-03-11 22:16:24 +04:00
|
|
|
|
IF (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD);
|
|
|
|
|
RunProgram("/sys/File Managers/Eolite", #path);
|
|
|
|
|
break;
|
|
|
|
|
case 024: //Ctrl+X
|
|
|
|
|
case 003: //Ctrl+C
|
|
|
|
|
CTRLC_MARK:
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (isdir) break;
|
|
|
|
|
strcpy(#copy_file, #file_path);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
IF (key==24) cut_active=1; ELSE cut_active=0;
|
|
|
|
|
break;
|
|
|
|
|
case 022: //Ctrl+V
|
|
|
|
|
Paste();
|
|
|
|
|
break;
|
|
|
|
|
case 027: //Esc
|
|
|
|
|
IF (rename_active==1) ReName(false);
|
|
|
|
|
break;
|
|
|
|
|
case 013: //Enter
|
|
|
|
|
IF (rename_active==1) {ReName(true); break;}
|
2013-04-01 00:25:54 +04:00
|
|
|
|
Open();
|
2013-03-11 22:16:24 +04:00
|
|
|
|
break;
|
|
|
|
|
case 178: //up
|
|
|
|
|
FileList_ReDraw(-1);
|
|
|
|
|
break;
|
|
|
|
|
case 177: //down
|
|
|
|
|
FileList_ReDraw(1);
|
|
|
|
|
break;
|
|
|
|
|
case 180: //home
|
2013-04-01 00:25:54 +04:00
|
|
|
|
files.first=0;
|
|
|
|
|
files.current=0;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
List_ReDraw();
|
|
|
|
|
break;
|
|
|
|
|
case 181: //end
|
2013-04-01 00:25:54 +04:00
|
|
|
|
files.first=files.count-files.visible;
|
|
|
|
|
files.current=files.visible-1;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
List_ReDraw();
|
|
|
|
|
break;
|
|
|
|
|
case 183: //Page Down
|
2013-04-01 00:25:54 +04:00
|
|
|
|
FileList_ReDraw(files.visible-1);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
break;
|
|
|
|
|
case 184: //Page Up
|
2013-04-01 00:25:54 +04:00
|
|
|
|
FileList_ReDraw(-files.visible+1);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
break;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
case 182: //del
|
2013-03-11 22:16:24 +04:00
|
|
|
|
Del_Form();
|
2013-04-01 00:25:54 +04:00
|
|
|
|
break;
|
|
|
|
|
case 050...059: //F1-F10
|
|
|
|
|
ActionsProcess(key-49);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2013-04-01 00:25:54 +04:00
|
|
|
|
for (i=files.current+files.first+1; i<files.count; i++)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
|
|
|
|
strcpy(#temp, file_mas[i]*304+buf+72);
|
|
|
|
|
IF (temp[0]==key) || (temp[0]==key-32)
|
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
FileList_ReDraw(i-files.current-files.first);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case evReDraw:
|
2013-03-26 02:50:35 +04:00
|
|
|
|
DefineAndDrawWindow(40,20,550,500,0x73,col_work,TITLE);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
|
if (Form.status_window>2) break;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
files.SetSizes(192, 57, onLeft(192,27), onTop(57,6), disc_num*16+195,files.line_h);
|
|
|
|
|
if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
if (Form.width<480) MoveSize(OLD,OLD,480,OLD);
|
|
|
|
|
draw_window();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline fastcall void draw_window()
|
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
//toolbar
|
2013-03-11 22:16:24 +04:00
|
|
|
|
PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
|
|
|
|
|
for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,col_work);
|
|
|
|
|
for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,col_work);
|
|
|
|
|
DrawBar(246,0,onLeft(246,60),12, col_work); //<2F><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2013-04-01 00:25:54 +04:00
|
|
|
|
DrawBar(246,29,onLeft(246,60),5,col_work); //<2F><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
DrawRectangle3D(246,12,onLeft(66,246),16,col_border,col_border);
|
|
|
|
|
DefineButton(onLeft(34,0),6,27,28,51+BT_HIDE+BT_NOFRAME,col_work); //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
|
|
|
|
|
DrawRectangle3D(1,40,Form.cwidth-3,onTop(46,0),col_border,col_border);
|
|
|
|
|
DrawRectangle3D(0,39,Form.cwidth-1,onTop(44,0),col_palette[4],col_palette[4]); //bg
|
2013-03-11 22:16:24 +04:00
|
|
|
|
for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);
|
|
|
|
|
DrawLeftPanel();
|
2013-04-01 00:25:54 +04:00
|
|
|
|
//ListBox
|
|
|
|
|
DrawFlatButton(files.x,40,onLeft(files.x,168),16,31,col_work,"File");
|
2013-03-11 22:16:24 +04:00
|
|
|
|
DrawFlatButton(onLeft(168,0),40,73,16,32,col_work,"Type");
|
|
|
|
|
DrawFlatButton(onLeft(95,0),40,68,16,33,col_work,"Size");
|
2013-04-01 00:25:54 +04:00
|
|
|
|
DrawBar(onLeft(27,0),57,1,onTop(22,57),col_border); //line to the left from the scroll
|
|
|
|
|
DrawFlatButton(onLeft(27,0),40,16,16,0,col_work,"\x18");
|
|
|
|
|
DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,col_work,"\x19");
|
2013-03-11 22:16:24 +04:00
|
|
|
|
Open_Dir(#path,ONLY_SHOW);
|
|
|
|
|
if (del_active) Del_Form();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KEdit()
|
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
if (Form.width<480) return;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
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-04-01 00:25:54 +04:00
|
|
|
|
void FileList_ReDraw(int cur)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
if (cur<=0) //up
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (files.first==0) && (files.current<=0) return;
|
|
|
|
|
IF (-cur-1<files.current)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
Line_ReDraw(0xFFFFFF, files.current);
|
|
|
|
|
files.current+=cur;
|
|
|
|
|
Line_ReDraw(col_selec, files.current);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ELSE
|
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (-cur<files.first) files.first+=cur; ELSE files.first=0;
|
|
|
|
|
files.current=0;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
List_ReDraw();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
|
else //down
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (files.first==files.count-files.visible) && (files.current==files.visible-1) return;
|
|
|
|
|
IF (files.visible-files.current>cur)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
Line_ReDraw(0xFFFFFF, files.current);
|
|
|
|
|
files.current+=cur;
|
|
|
|
|
Line_ReDraw(col_selec, files.current);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF(files.first+files.current+cur>=files.count)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
files.first=files.count-files.visible;
|
|
|
|
|
files.current=cur-files.first+files.current;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
|
|
|
|
ELSE
|
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
files.first+=cur+files.current-files.visible+1;
|
|
|
|
|
files.current=files.visible-1;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (files.current<0) || (files.current>files.visible)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
files.current=files.visible-1;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
|
|
|
|
List_ReDraw();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void List_ReDraw()
|
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
int paint_y;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD> <20><> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (files.count-files.first<files.visible) || (files.current>files.visible-1)
|
|
|
|
|
{ files.first=files.count-files.visible; files.current=files.visible-1; }
|
|
|
|
|
|
|
|
|
|
for (j=0; j<files.visible; j++) if (files.current<>j) Line_ReDraw(0xFFFFFF, j); else Line_ReDraw(col_selec, files.current);
|
|
|
|
|
//in the bottom
|
|
|
|
|
paint_y = j * files.line_h + files.y;
|
|
|
|
|
DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF);
|
|
|
|
|
DrawBar(onLeft(168,0),paint_y,1,onTop(paint_y,6),col_work);
|
|
|
|
|
DrawBar(onLeft(95,0),paint_y,1,onTop(paint_y,6),col_work);
|
|
|
|
|
Scroll();
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Line_ReDraw(dword color, filenum){
|
2013-04-01 00:25:54 +04:00
|
|
|
|
dword text_col=0, name_len=0, y=filenum*files.line_h+57;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
IF (rename_active==1) ReName(false);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
DrawBar(192,y,3,files.line_h,color);
|
|
|
|
|
DrawBar(192+19,y,onLeft(46,192),files.line_h,color); DrawBar(195,y+17,16,1,color);
|
|
|
|
|
if (files.line_h>18) DrawBar(195,y+18,16,files.line_h-18,color);
|
|
|
|
|
if (files.line_h>15) DrawBar(195,y,16,files.line_h-15,color);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
off=file_mas[filenum+files.first]*304 + buf+72;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
if (!TestBit(ESDWORD[off-40], 4)) //file or folder?
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
|
|
|
|
strcpy(#temp, off);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
Put_icon(#temp+_strrchr(#temp,'.'), files.line_h/2-7+y, color);
|
|
|
|
|
WriteText(7-strlen(ConvertMemSize(ESDWORD[off-8]))*6+onLeft(75,0),files.line_h-6/2+y,0x80,0,ConvertMemSize(ESDWORD[off-8])); //size
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (!strcmp("..",off))
|
2013-04-01 00:25:54 +04:00
|
|
|
|
Put_icon("..", files.line_h/2-7+y, color);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
else
|
2013-04-01 00:25:54 +04:00
|
|
|
|
Put_icon("<DIR>", files.line_h/2-7+y, color);
|
|
|
|
|
if (TestBit(ESDWORD[off-40],1)) || (TestBit(ESDWORD[off-40],2)) text_col=0xA6A6B7; //system or hiden?
|
2013-03-11 22:16:24 +04:00
|
|
|
|
if (color<>0xFFFfff)
|
|
|
|
|
{
|
|
|
|
|
isdir=TestBit(ESDWORD[off-40], 4);
|
|
|
|
|
strcpy(#file_name, off);
|
|
|
|
|
strcpy(#file_path, #path);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
strcat(#file_path, #file_name);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
if (text_col==0xA6A6B7) text_col=0xFFFFFF;
|
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
|
if (Form.width>=480)
|
|
|
|
|
{
|
|
|
|
|
FileShow.font_color = text_col;
|
|
|
|
|
FileShow.area_size_x = Form.width - 380;
|
|
|
|
|
FileShow.text_pointer = off;
|
|
|
|
|
FileShow.start_y = files.line_h/2-3+y;
|
|
|
|
|
PathShow_prepare stdcall(#FileShow);
|
|
|
|
|
PathShow_draw stdcall(#FileShow);
|
|
|
|
|
}
|
|
|
|
|
DrawBar(onLeft(168,0),y,1,files.line_h,col_work); //gray line 1
|
|
|
|
|
DrawBar(onLeft(95,0),y,1,files.line_h,col_work); //gray line 2
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Open_Dir(dword temp_, redraw){
|
2013-04-01 00:25:54 +04:00
|
|
|
|
int errornum, count;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
char path_[4096],
|
|
|
|
|
somelen=strlen(temp_)-1;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
|
if (redraw<>ONLY_SHOW)
|
|
|
|
|
{
|
|
|
|
|
strcpy(#path_, temp_);
|
|
|
|
|
if (somelen) path_[somelen]=NULL;
|
|
|
|
|
|
|
|
|
|
if (buf) free(buf);
|
|
|
|
|
buf = malloc(32);
|
|
|
|
|
errornum=ReadDir(0, buf, #path_);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
if (errornum<>0)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
|
|
|
|
HistoryPath(ADD_NEW_PATH);
|
|
|
|
|
GoBack();
|
|
|
|
|
Write_Error(errornum);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
|
files.count = ESDWORD[buf+8];
|
|
|
|
|
buf = realloc(buf, files.count * 304 + 32);
|
|
|
|
|
ReadDir(files.count, buf, #path_);
|
|
|
|
|
files.count=EBX;
|
|
|
|
|
count = sizeof(file_mas)/sizeof(dword)-1;
|
|
|
|
|
if (files.count>count) files.count=count;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
|
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
|
if (files.count<>-1)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
|
|
|
|
KEdit();
|
|
|
|
|
HistoryPath(ADD_NEW_PATH);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (!strcmp(".",buf+72)) {files.count--; memmov(buf,buf+304,files.count*304);} //oeeuo?oai yeaiaio "."
|
|
|
|
|
files.visible=onTop(6,57)/files.line_h;
|
|
|
|
|
IF (files.count<files.visible) files.visible=files.count;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
IF (sort_num==1) WriteText(Form.width+60/2,45,0x80,0x4E78AC,"\x19");
|
|
|
|
|
IF (sort_num==2) WriteText(Form.width-115,45,0x80,0x4E78AC,"\x19");
|
|
|
|
|
IF (sort_num==3) WriteText(Form.width-44,45,0x80,0x4E78AC,"\x19");
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (redraw<>ONLY_SHOW) Sorting();
|
2013-03-11 22:16:24 +04:00
|
|
|
|
IF (redraw<>ONLY_OPEN) List_ReDraw();
|
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (files.count==-1) && (redraw<>ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();}
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline Sorting()
|
|
|
|
|
{
|
|
|
|
|
dword k=0, l=1;
|
|
|
|
|
int i;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
if (!strcmp(#path,"/")) //do not sort
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
FOR(k=1;k<files.count;k++;) file_mas[k]=k;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
|
FOR (j=files.count-1, off=files.count-1*304+buf+32; j>=0; j--, off-=304;) //files | folders
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
|
|
|
|
strttl(off+40);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
if (TestBit(ESDWORD[off],4)) //isdir?
|
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);
|
2013-04-01 00:25:54 +04: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);
|
|
|
|
|
//".." should be first
|
2013-03-11 22:16:24 +04:00
|
|
|
|
IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")<>0) FOR(k--; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) file_mas[k]><file_mas[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Del_Form()
|
|
|
|
|
{
|
|
|
|
|
int dform_x=Form.width/2-13;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
//oeia ieii
|
|
|
|
|
if (!files.count) return;
|
|
|
|
|
DrawFlatButton(dform_x,160,200,80,0,col_work, ""); //oi?ia
|
2013-03-11 22:16:24 +04:00
|
|
|
|
WriteText(dform_x+19,175,0x80,0,"Do you really want to delete");
|
|
|
|
|
IF (strlen(#file_name)<28)
|
|
|
|
|
{
|
|
|
|
|
WriteText(strlen(#file_name)*6+dform_x+20,190,0x80,0,"?");
|
2013-04-01 00:25:54 +04:00
|
|
|
|
WriteText(dform_x+20,190,0x80,0,#file_name); //ieoai eiy
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
|
|
|
|
ELSE
|
|
|
|
|
{
|
|
|
|
|
WriteText(164+dform_x,190,0x80,0,"...?");
|
|
|
|
|
ESI = 24;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
WriteText(dform_x+20,190,0,0,#file_name); //ieoai eiy
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
|
//eiiii?ee
|
2013-03-11 22:16:24 +04:00
|
|
|
|
DrawFlatButton(dform_x+20,208,70,20,301,0xFFB6B5,"Yes");
|
|
|
|
|
DrawFlatButton(dform_x+111,208,70,20,302,0xC6DFC6,"No");
|
|
|
|
|
del_active=1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Del_File(byte dodel)
|
|
|
|
|
{
|
2013-03-23 04:00:11 +04:00
|
|
|
|
int del_rezult;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
IF (dodel==true)
|
|
|
|
|
{
|
2013-03-23 04:00:11 +04:00
|
|
|
|
del_rezult = DeleteFile(#file_path);
|
|
|
|
|
IF (del_rezult<>0)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-03-23 04:00:11 +04:00
|
|
|
|
Write_Error(del_rezult);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
IF ( isdir) ShowMessage("Error. Folder isn't empty.");
|
|
|
|
|
IF (!isdir) ShowMessage("Error. Filesystem read-only.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
del_active=0;
|
2013-04-01 00:25:54 +04:00
|
|
|
|
DeleteButton(301); DeleteButton(302);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
Open_Dir(#path,1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Paste()
|
|
|
|
|
{
|
|
|
|
|
char new_copy_path[4096];
|
|
|
|
|
int copy_rezult;
|
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (!copy_file) return;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
strcpy(#new_copy_path, #path);
|
|
|
|
|
strcat(#new_copy_path, #copy_file+strrchr(#copy_file,'/'));
|
2013-04-01 00:25:54 +04:00
|
|
|
|
if (!strcmp(#copy_file,#new_copy_path))
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
|
|
|
|
strcpy(#new_copy_path, #path);
|
|
|
|
|
strcat(#new_copy_path, "new_");
|
|
|
|
|
strcat(#new_copy_path, #copy_file+strrchr(#copy_file,'/'));
|
|
|
|
|
}
|
2013-03-23 04:00:11 +04:00
|
|
|
|
copy_rezult = CopyFile(#copy_file,#new_copy_path);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (copy_rezult!=0)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
|
|
|
|
Write_Error(copy_rezult);
|
2013-03-23 04:00:11 +04:00
|
|
|
|
return;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
|
IF (cut_active)
|
2013-03-23 04:00:11 +04:00
|
|
|
|
{
|
|
|
|
|
strcpy(#file_path, #copy_file);
|
|
|
|
|
Del_File(true);
|
|
|
|
|
copy_file=NULL;
|
|
|
|
|
cut_active=false;
|
|
|
|
|
}
|
2013-03-11 22:16:24 +04:00
|
|
|
|
SelectFile(#new_copy_path+strrchr(#new_copy_path,'/'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ReName(byte rename)
|
|
|
|
|
{
|
2013-03-23 04:00:11 +04:00
|
|
|
|
int del_rezult, copy_rezult;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
char edit_name[256];
|
|
|
|
|
rename_active=0;
|
|
|
|
|
edit2.flags=64;
|
|
|
|
|
if (rename==true)
|
|
|
|
|
{
|
|
|
|
|
strcpy(#temp, #path);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
strcpy(#edit_name, #file_name); //save edit name to select it later
|
2013-03-11 22:16:24 +04:00
|
|
|
|
strcat(#temp, #file_name);
|
|
|
|
|
if (strcmp(#file_path,#temp)<>0) && (file_name)
|
|
|
|
|
IF (isdir)
|
|
|
|
|
{
|
2013-03-23 04:00:11 +04:00
|
|
|
|
del_rezult = DeleteFile(#file_path);
|
|
|
|
|
IF (del_rezult!=0)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
{
|
2013-03-23 04:00:11 +04:00
|
|
|
|
Write_Error(del_rezult);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
ShowMessage("Error. Folder isn't empty.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
ELSE CreateDir(#temp);
|
|
|
|
|
Open_Dir(#path,1);
|
|
|
|
|
}
|
|
|
|
|
ELSE
|
|
|
|
|
{
|
2013-03-23 04:00:11 +04:00
|
|
|
|
copy_rezult = CopyFile(#file_path,#temp);
|
|
|
|
|
if (copy_rezult!=0) Write_Error(copy_rezult); else Del_File(true);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
|
|
|
|
SelectFile(#edit_name);
|
|
|
|
|
}
|
2013-04-01 00:25:54 +04:00
|
|
|
|
Line_ReDraw(col_selec,files.current);
|
2013-03-11 22:16:24 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SelectFile(dword that_file)
|
|
|
|
|
{
|
2013-04-01 00:25:54 +04:00
|
|
|
|
files.first=files.current=0;
|
2013-03-11 22:16:24 +04:00
|
|
|
|
Open_Dir(#path,ONLY_OPEN);
|
|
|
|
|
strttl(that_file);
|
2013-04-01 00:25:54 +04:00
|
|
|
|
for (i=files.count-1; i>=0; i--;)
|
2013-03-11 22:16:24 +04:00
|
|
|
|
if (!strcmp(file_mas[i]*304+buf+72,that_file)) break;
|
|
|
|
|
FileList_ReDraw(i);
|
|
|
|
|
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;
|
|
|
|
|
SelectFile(#cur_folder);
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
void Open()
|
|
|
|
|
{
|
|
|
|
|
if (!isdir)
|
|
|
|
|
{
|
|
|
|
|
GetIni(0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!strcmp(#file_name,"..")) { Dir_Up(); return; }
|
|
|
|
|
strcpy(#path, #file_path);
|
|
|
|
|
if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
|
|
|
|
|
files.first=files.current=0;
|
|
|
|
|
Open_Dir(#path,1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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());
|
|
|
|
|
if (HistoryPath(GO_BACK)) SelectFile(#cur_folder);
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
void ActionsProcess(char N)
|
|
|
|
|
{
|
|
|
|
|
switch(N)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
SwitchToAnotherThread();
|
|
|
|
|
CreateThread(#about_dialog,#stak1);
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
if (!files.count) break;
|
|
|
|
|
DeleteButton(files.current+201);
|
|
|
|
|
edit2.flags=100000000000010b; //set active
|
|
|
|
|
edit2.width=onLeft(24,217);
|
|
|
|
|
edit2.top=files.current*files.line_h+59;
|
|
|
|
|
edit2.size=edit2.pos=strlen(#file_name);
|
|
|
|
|
edit_box_draw stdcall (#edit2);
|
|
|
|
|
DrawBar(213,files.current*files.line_h+58,edit2.width+1,1,0xFFFFCC); //bg
|
|
|
|
|
rename_active=1;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
IF (!isdir) RunProgram("/sys/tinypad", #file_path);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
IF (!isdir) RunProgram("/sys/develop/heed", #file_path);
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
Open_Dir(#path,1);
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
strcpy(#temp, #path);
|
|
|
|
|
strcat(#temp, "New folder");
|
|
|
|
|
CreateDir(#temp);
|
|
|
|
|
if (!EAX){
|
|
|
|
|
SelectFile("New folder");
|
|
|
|
|
ActionsProcess(2);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Write_Error(EAX);
|
|
|
|
|
ShowMessage("Folder can not be created.");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
|
|
|
|
strcpy(#temp, #path);
|
|
|
|
|
strcat(#temp, "New file");
|
|
|
|
|
WriteFile(0, 0, #temp);
|
|
|
|
|
if (!EAX){
|
|
|
|
|
SelectFile("New file");
|
|
|
|
|
ActionsProcess(2);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Write_Error(EAX);
|
|
|
|
|
ShowMessage("File can not be created.");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 10: //F10
|
|
|
|
|
RunProgram(EDITOR_PATH, abspath("Eolite.ini"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void copyf_Action() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-11 22:16:24 +04:00
|
|
|
|
stop:
|
|
|
|
|
|
2013-04-01 00:25:54 +04:00
|
|
|
|
char stak1[512];
|
|
|
|
|
char stak2[512];
|