Eolite 1.88: copying in another thread, copying folders

git-svn-id: svn://kolibrios.org@3444 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2013-04-04 17:07:38 +00:00
parent 75a54cbc0f
commit 99555c3bb5
15 changed files with 257 additions and 255 deletions

View File

@ -9,7 +9,7 @@
unsigned char speaker[23*40*3]= FROM "speaker.raw";
char title[]= "Dictionary v1.3";
char title[]= "Dictionary v1.31";
char direction[] = "Translate direction:";
char translate_caption[] = "Translate";
char dict_not_found[] = "Dictionary not found";
@ -62,7 +62,7 @@ void main()
case evButton:
id=GetButtonID();
if (id==1) ExitProcess();
if (id==1) {KillProcess(speaker_id); ExitProcess();}
if (id==10) { Translate(); DrawTranslation(); }
if (id==11) ShowDictList();
if (id==12) DrawWindowContent();
@ -229,7 +229,7 @@ void ShowDictList()
int j, fcount, error;
free(dir_buf);
error = GetDir(#dir_buf, #fcount, #dict_folder);
error = GetDir(#dir_buf, #fcount, #dict_folder, DIRS_ONLYREAL);
if (!error)
{
DefineButton(0,0, Form.width,Form.height, 12+BT_HIDE+BT_NOFRAME, sc.work_button);

View File

@ -19,15 +19,13 @@
#include "imgs\toolbar.txt"
#include "imgs\left_p.txt"
//for OpenDir
#define ONLY_SHOW 0
#define WITH_REDRAW 1
#define ONLY_OPEN 2
#define TITLE "Eolite File Manager v1.81"
#define ABOUT_TITLE "Eolite v1.81"
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
#define TITLE "Eolite File Manager v1.88"
#define ABOUT_TITLE "Eolite v1.88"
dword col_work = 0xE4DFE1;
dword col_border = 0x819FC5;
dword col_border = 0x9098B0; //A0A0B8; //0x819FC5;
dword col_padding = 0xC8C9C9;
dword col_selec = 0x94AECE;
dword col_lpanel = 0x00699C;
@ -42,10 +40,8 @@ byte
path[4096],
file_path[4096],
file_name[256],
copy_file[4096],
temp[4096];
byte
cut_active=0,
rename_active=0,
del_active=0,
show_dev_name=1,
@ -71,10 +67,11 @@ PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #t
#include "include\left_panel.h"
#include "include\history.h"
#include "include\file_menu.h"
#include "include\copypaste.h"
void main()
{
word key, id, can_show, can_select;
word key, id, can_show, can_select, m_selected;
files.line_h=18;
mem_Init();
@ -95,13 +92,14 @@ void main()
case evMouse:
IF (del_active) break;
id=GetProcessSlot(Form.ID);
IF (id<>GetActiveProcess()) || (Form.status_window>2) break;
IF (id!=GetActiveProcess()) || (Form.status_window>2) break;
IF (rename_active) { edit_box_mouse stdcall(#edit2); break; }
m.get();
if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h)
if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h) && (!can_select)
{
m_selected = m.y - 57 / files.line_h;
if (m.lkm) can_select = 1;
if (m.pkm)
{
@ -116,7 +114,8 @@ void main()
can_select = 0;
if (m.y<57) break;
id = m.y - 57 / files.line_h;
if (files.current!=id) FileList_ReDraw(id-files.current);
if (id!=m_selected) {can_show=0; break;}
if (files.current!=id) List_Current(id-files.current);
else Open();
};
// } select/open file
@ -127,7 +126,7 @@ void main()
can_show = 0;
if (m.y<57) break;
SwitchToAnotherThread();
CreateThread(#FileMenu,#stak2);
CreateThread(#FileMenu,#menu_stak);
break;
}
// } file menu
@ -178,7 +177,7 @@ void main()
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();
IF (id!=files.first) List_ReDraw();
}
break;
//Button pressed-----------------------------------------------------------------------------
@ -208,11 +207,13 @@ void main()
Dir_Up();
break;
case 24: //cut
key=24;
Copy(#file_path, NOCUT);
break;
case 25: //copy
goto CTRLC_MARK;
Copy(#file_path, CUT);
break;
case 26: //paste
Paste();
CreateThread(#Paste,#copy_stak);
break;
case 31...33: //sort
IF(sort_num==1) DrawFilledBar(onLeft(192,168)/2+210,42,6,10);
@ -222,16 +223,16 @@ void main()
Open_Dir(#path,WITH_REDRAW);
break;
case 50...60: //Actions
ActionsProcess(id-50);
FnProcess(id-50);
break;
case 100...120:
DEVICE_MARK:
DrawRectangle3D(17,id-100*16+74,159,16, 0, 0); //auaaeaiea
DrawRectangle(17,id-100*16+74,159,16, 0); //auaaeaiea
strcpy(#path, #disk_list[id-100].Item);
files.first=files.current=0;
Open_Dir(#path,1);
Open_Dir(#path,WITH_REDRAW);
pause(5);
DrawRectangle3D(17,id-100*16+74,159,16, 0xFFFFFF, 0xFFFFFF);
DrawRectangle(17,id-100*16+74,159,16, 0xFFFFFF);
break;
case 130...160:
tmp_disk_del_param[1]=disk_list[id-130].Item[4];
@ -253,7 +254,7 @@ void main()
IF (key==027) Del_File(false);
break;
}
IF (edit2.flags<>64) && (key<>13) && (key<>27)
IF (edit2.flags!=64) && (key!=13) && (key!=27)
{
EAX=key<<8;
edit_box_key stdcall (#edit2);
@ -279,14 +280,13 @@ void main()
RunProgram("/sys/File Managers/Eolite", #path);
break;
case 024: //Ctrl+X
Copy(#file_path, CUT);
break;
case 003: //Ctrl+C
CTRLC_MARK:
IF (itdir) break;
strcpy(#copy_file, #file_path);
IF (key==24) cut_active=1; ELSE cut_active=0;
Copy(#file_path, NOCUT);
break;
case 022: //Ctrl+V
Paste();
CreateThread(#Paste,#copy_stak);
break;
case 027: //Esc
IF (rename_active==1) ReName(false);
@ -296,10 +296,10 @@ void main()
Open();
break;
case 178: //up
FileList_ReDraw(-1);
List_Current(-1);
break;
case 177: //down
FileList_ReDraw(1);
List_Current(1);
break;
case 180: //home
files.first=0;
@ -312,16 +312,16 @@ void main()
List_ReDraw();
break;
case 183: //Page Down
FileList_ReDraw(files.visible-1);
List_Current(files.visible-1);
break;
case 184: //Page Up
FileList_ReDraw(-files.visible+1);
List_Current(-files.visible+1);
break;
case 182: //del
Del_Form();
break;
case 050...059: //F1-F10
ActionsProcess(key-49);
FnProcess(key-49);
break;
default:
for (i=files.current+files.first+1; i<files.count; i++)
@ -329,39 +329,40 @@ void main()
strcpy(#temp, file_mas[i]*304+buf+72);
IF (temp[0]==key) || (temp[0]==key-32)
{
FileList_ReDraw(i-files.current-files.first);
List_Current(i-files.current-files.first);
break;
}
}
}
break;
case evReDraw:
DefineAndDrawWindow(40,20,550,500,0x73,col_work,TITLE);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) break;
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);
if (Form.width<480) MoveSize(OLD,OLD,480,OLD);
GetProcessInfo(#Form, SelfInfo); //if win_size changed
draw_window();
}
}
inline fastcall void draw_window()
{
//toolbar
void draw_window()
{
DefineAndDrawWindow(40,20,550,500,0x73,col_work,TITLE);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) return;
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);
if (Form.width<480) MoveSize(OLD,OLD,480,OLD);
GetProcessInfo(#Form, SelfInfo); //if win_size changed
PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
DrawBar(127, 8, 1, 25, col_border);
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); //ôîí íàä ïîëîñîé àäðåñà
DrawBar(246,29,onLeft(246,60),5,col_work); //ôîí ïîä ïîëîñîé àäðåñà
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
DrawBar(246,0,onLeft(246,60),12, col_work); //upper editbox
DrawBar(246,29,onLeft(246,60),5,col_work); //under editbox
DrawRectangle(246,12,onLeft(66,246),16,col_border);
DefineButton(onLeft(34,0),6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about
PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
//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
DrawRectangle(1,40,Form.cwidth-3,onTop(46,0),col_border);
DrawRectangle(0,39,Form.cwidth-1,onTop(44,0),col_palette[4]); //bg
for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);
DrawLeftPanel();
//ListBox
@ -373,7 +374,7 @@ inline fastcall void draw_window()
DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,col_work,"\x19");
Open_Dir(#path,ONLY_SHOW);
if (del_active) Del_Form();
if (rename_active) ActionsProcess(2);
if (rename_active) FnProcess(2);
}
@ -387,7 +388,7 @@ void KEdit()
}
void FileList_ReDraw(int cur)
void List_Current(int cur)
{
if (cur<=0) //up
{
@ -440,8 +441,6 @@ void FileList_ReDraw(int cur)
}
void List_ReDraw()
{
int paint_y;
@ -450,7 +449,7 @@ void List_ReDraw()
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);
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);
@ -459,6 +458,7 @@ void List_ReDraw()
Scroll();
}
void Line_ReDraw(dword color, filenum){
dword text_col=0, name_len=0, y=filenum*files.line_h+57;
DrawBar(192,y,3,files.line_h,color);
@ -480,7 +480,7 @@ void Line_ReDraw(dword color, filenum){
else
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?
if (color<>0xFFFfff)
if (color!=0xFFFfff)
{
itdir=TestBit(ESDWORD[off-40], 4);
strcpy(#file_name, off);
@ -502,52 +502,41 @@ void Line_ReDraw(dword color, filenum){
}
void Open_Dir(dword temp_, redraw){
int errornum, count;
char path_[4096],
somelen=strlen(temp_)-1;
void Open_Dir(dword dir_path, redraw){
int errornum, maxcount;
if (redraw<>ONLY_SHOW)
if (redraw!=ONLY_SHOW)
{
strcpy(#path_, temp_);
if (somelen) path_[somelen]=NULL;
if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0';
if (buf) free(buf);
buf = malloc(32);
errornum=ReadDir(0, buf, #path_);
if (errornum<>0)
errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/');
if (errornum)
{
HistoryPath(ADD_NEW_PATH);
GoBack();
Write_Error(errornum);
return;
}
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;
maxcount = sizeof(file_mas)/sizeof(dword)-1;
if (files.count>maxcount) files.count = maxcount;
}
if (files.count<>-1)
if (files.count!=-1)
{
KEdit();
HistoryPath(ADD_NEW_PATH);
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;
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");
IF (redraw<>ONLY_SHOW) Sorting();
IF (redraw<>ONLY_OPEN) List_ReDraw();
files.visible = files.h / files.line_h;
IF (files.count < files.visible) files.visible = files.count;
IF (sort_num==1) WriteText(Form.width+60/2,45,0x80,col_border,"\x19");
IF (sort_num==2) WriteText(Form.width-115,45,0x80,col_border,"\x19");
IF (sort_num==3) WriteText(Form.width-44,45,0x80,col_border,"\x19");
IF (redraw!=ONLY_SHOW) Sorting();
IF (redraw!=ONLY_OPEN) List_ReDraw();
}
IF (files.count==-1) && (redraw<>ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();}
IF (files.count==-1) && (redraw!=ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();}
}
inline Sorting()
{
dword k=0, l=1;
@ -577,13 +566,14 @@ inline Sorting()
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
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];
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]; break;}
}
void Del_Form()
{
int dform_x=Form.width/2-13;
int dform_x = files.w - 200 / 2 + files.x;
//oeia ieii
if (!files.count) return;
DrawFlatButton(dform_x,160,200,80,0,col_work, ""); //oi?ia
@ -599,7 +589,6 @@ void Del_Form()
ESI = 24;
WriteText(dform_x+20,190,0,0,#file_name); //ieoai eiy
}
//eiiii?ee
DrawFlatButton(dform_x+20,208,70,20,301,0xFFB6B5,"Yes");
DrawFlatButton(dform_x+111,208,70,20,302,0xC6DFC6,"No");
del_active=1;
@ -612,7 +601,7 @@ void Del_File(byte dodel)
IF (dodel==true)
{
del_rezult = DeleteFile(#file_path);
IF (del_rezult<>0)
IF (del_rezult)
{
Write_Error(del_rezult);
IF ( itdir) ShowMessage("Error. Folder isn't empty.");
@ -621,37 +610,7 @@ void Del_File(byte dodel)
}
del_active=0;
DeleteButton(301); DeleteButton(302);
Open_Dir(#path,1);
}
void Paste()
{
char new_copy_path[4096];
int copy_rezult;
IF (!copy_file) return;
strcpy(#new_copy_path, #path);
strcat(#new_copy_path, #copy_file+strrchr(#copy_file,'/'));
if (!strcmp(#copy_file,#new_copy_path))
{
strcpy(#new_copy_path, #path);
strcat(#new_copy_path, "new_");
strcat(#new_copy_path, #copy_file+strrchr(#copy_file,'/'));
}
copy_rezult = CopyFile(#copy_file,#new_copy_path);
IF (copy_rezult!=0)
{
Write_Error(copy_rezult);
return;
}
IF (cut_active)
{
strcpy(#file_path, #copy_file);
Del_File(true);
copy_file=NULL;
cut_active=false;
}
SelectFile(#new_copy_path+strrchr(#new_copy_path,'/'));
Open_Dir(#path,WITH_REDRAW);
}
@ -666,18 +625,18 @@ void ReName(byte rename)
strcpy(#temp, #path);
strcpy(#edit_name, #file_name); //save edit name to select it later
strcat(#temp, #file_name);
if (strcmp(#file_path,#temp)<>0) && (file_name)
IF (itdir)
if (strcmp(#file_path,#temp)!=0) && (file_name)
if (itdir)
{
del_rezult = DeleteFile(#file_path);
IF (del_rezult!=0)
if (del_rezult!=0)
{
Write_Error(del_rezult);
ShowMessage("Error. Folder isn't empty.");
return;
}
ELSE CreateDir(#temp);
Open_Dir(#path,1);
Open_Dir(#path,WITH_REDRAW);
}
ELSE
{
@ -697,7 +656,7 @@ void SelectFile(dword that_file)
strttl(that_file);
for (i=files.count-1; i>=0; i--;)
if (!strcmp(file_mas[i]*304+buf+72,that_file)) break;
FileList_ReDraw(i);
List_Current(i);
List_ReDraw();
}
@ -716,6 +675,7 @@ void Dir_Up()
void Open()
{
if (!files.count) return;
if (!itdir)
{
GetIni(0);
@ -726,7 +686,7 @@ void Open()
strcpy(#path, #file_path);
if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
files.first=files.current=0;
Open_Dir(#path,1);
Open_Dir(#path,WITH_REDRAW);
}
}
@ -738,13 +698,13 @@ inline fastcall void GoBack()
if (HistoryPath(GO_BACK)) SelectFile(#cur_folder);
}
void ActionsProcess(char N)
void FnProcess(char N)
{
switch(N)
{
case 1:
SwitchToAnotherThread();
CreateThread(#about_dialog,#stak1);
CreateThread(#about_dialog,#about_stak);
break;
case 2:
if (!files.count) break;
@ -768,7 +728,7 @@ void ActionsProcess(char N)
pause(10);
GetIni(1);
SystemDiscsGet();
Open_Dir(#path,1);
Open_Dir(#path,WITH_REDRAW);
DrawLeftPanel();
break;
case 6:
@ -777,7 +737,7 @@ void ActionsProcess(char N)
CreateDir(#temp);
if (!EAX){
SelectFile("New folder");
ActionsProcess(2);
FnProcess(2);
}
else
{
@ -791,7 +751,7 @@ void ActionsProcess(char N)
WriteFile(0, 0, #temp);
if (!EAX){
SelectFile("New file");
ActionsProcess(2);
FnProcess(2);
}
else
{
@ -805,11 +765,9 @@ void ActionsProcess(char N)
}
}
void copyf_Action() {
return;
}
stop:
char stak1[512];
char stak2[512];
char about_stak[512];
char menu_stak[512];
char copy_stak[4096];

View File

@ -0,0 +1,61 @@
//Leency 2008-2013
byte copy_from[4096], cut_active=0;
enum {NOCUT, CUT};
#define WIN_W 300
#define WIN_H 20
void Copy(dword pcth, char cut)
{
strcpy(#copy_from, pcth);
cut_active = cut;
}
void copyf_Action(dword filename) {
DefineAndDrawWindow(5000,0,WIN_W,WIN_H-1,0x01,col_work,0);
DrawBar(WIN_W, 0, 1, WIN_H, 0x333333);
DrawBar(0, 0, WIN_W, WIN_H, 0xDDDddd);
WriteText(5,6, 0x80, 0, "Copying file:");
WriteText(90,6, 0x80, 0, filename);
pause(20);
}
void Paste()
{
char copy_to[4096], copy_rezult;
if (!copy_from) ExitProcess();
strcpy(#copy_to, #path);
strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
if (!strcmp(#copy_from,#copy_to))
{
strcpy(#copy_to, #path);
strcat(#copy_to, "new_");
strcat(#copy_to, #copy_from+strrchr(#copy_from,'/'));
}
if (strstr(#copy_to, #copy_from))
{
notify("Copy directory into itself is a bad idea...");
ExitProcess();
}
copy_rezult = copyf(#copy_from,#copy_to);
if (copy_rezult)
{
Write_Error(copy_rezult);
ExitProcess();
}
if (cut_active)
{
strcpy(#file_path, #copy_from);
Del_File(true);
copy_from=NULL;
cut_active=false;
}
ActivateWindow(GetProcessSlot(Form.ID));
SendWindowMessage(evKey, 54);
SelectFile(#copy_to+strrchr(#copy_to,'/'));
ExitProcess();
}

View File

@ -45,11 +45,11 @@ void FileMenu()
id=GetButtonID();
if (id==100) Open();
if (id==101) notify("Not compleated yet");
if (id==102) ActionsProcess(3);
if (id==103) ActionsProcess(4);
if (id==104) ActionsProcess(2);
if (id==102) FnProcess(3);
if (id==103) FnProcess(4);
if (id==104) FnProcess(2);
if (id==105) Del_Form();
if (id==106) ActionsProcess(5);
if (id==106) FnProcess(5);
ExitProcess();
break;
@ -58,13 +58,15 @@ void FileMenu()
break;
case evReDraw: _MENU_DRAW:
DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+2,ccount*lineh+5,0x01, 0, 0, 0x01fffFFF);
DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF);
GetProcessInfo(#MenuForm, SelfInfo);
/* _PutImage(1,23, 16,44, #factions); //èêîíêè */
DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border);
DrawBar(1,1,linew,1,0xFFFfff);
PutShadow(linew+2,1,1,ccount*lineh+2,0,1);
PutShadow(1,ccount*lineh+3,linew+2,1,0,1);
PutShadow(linew+2,1,1,ccount*lineh+2,0,2);
PutShadow(linew+3,2,1,ccount*lineh+2,0,1);
PutShadow(1,ccount*lineh+3,linew+2,1,0,2);
PutShadow(2,ccount*lineh+4,linew+1,1,0,1);
_ITEMS_DRAW:
for (i=0; captions[i*2]!=0; i++)

View File

@ -6,9 +6,9 @@ void Tip(int y, dword caption, id, arrow)
DrawBar(17,y,160,1,0xEFEDEE);
DrawFilledBar(17, y+1, 160, 16);
WriteText(25,y+5,0x80,0,caption);
IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0xE4DFE1); //êíîïà äëÿ ñòðåëêè
IF (id<>0) DefineButton(159,y+1,16,16,id+BT_HIDE+BT_NOFRAME,0); //êíîïà äëÿ ñòðåëêè
WriteText(165,y+5,0x80,0,arrow); //ñòðåëêà âíèç
DrawBar(17,y+17,160,1,0x94AECE); //ïîä÷¸ðêèâàíèå
DrawBar(17,y+17,160,1,col_border); //ïîä÷¸ðêèâàíèå
}
@ -132,7 +132,7 @@ void LeftPanelBgDraw()
int start_y = actions_y+156;
DrawBar(2,41,190,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - íàä äåâàéñàìè
DrawBar(17,actions_y+75,160,15,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ïîä äåâàéñàìè
PutShadow(17,actions_y+75,160,1,1,2);
PutShadow(17,actions_y+75,160,1,1,4);
PutShadow(18,actions_y+75+1,158,1,1,1);
DrawBar(2,56,15,actions_y+103,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ñëåâà
DrawBar(177,56,15,actions_y+103,col_lpanel); //ñèíèé ïðÿìîóãîëüíèê - ñïðàâà
@ -143,7 +143,7 @@ void LeftPanelBgDraw()
DrawBar(2,start_y,190,onTop(start_y,6+268),col_lpanel);
PutPaletteImage(#blue_hl, 190, 268, 2, onTop(268,6), 8, #blue_hl_pal);
}
PutShadow(17,start_y,160,1,1,2);
PutShadow(17,start_y,160,1,1,4);
PutShadow(18,start_y+1,158,1,1,1);
}

View File

@ -1,3 +1,8 @@
04.05.13 -- v1.88
- копирование через поток;
- копирование папок;
- небольшие изменения в GUI.
01.05.13 -- v1.8
- исправлено падение при изменении размера окна (нашёл 0CodErr);
- меню файлов;

View File

@ -58,7 +58,7 @@ void Install()
ShowProgress("Copying files...");
copyf("/sys/docpack", "/tmp9/1/docpack");
DeleteFile("/sys/docpack");
copyf(abspath("sys"), "/sys");
copyf(abspath("sys"), "/rd/1");
copyf(abspath("tmp"), "/tmp9/1");
ShowProgress("Post install actions...");
RunProgram("/sys/launcher", NULL);

View File

@ -14,7 +14,7 @@ void main()
signed int result;
mem_Init();
GetDir(#dirbuf, #fcount, "/");
GetDir(#dirbuf, #fcount, "/", DIRS_ONLYREAL);
for (i=0; i<fcount; i++)
{
@ -24,7 +24,7 @@ void main()
strcpy(#cd_path, "/");
strcat(#cd_path, filename);
free(dirbuf2);
GetDir(#dirbuf2, #fcount2, #cd_path);
GetDir(#dirbuf2, #fcount2, #cd_path, DIRS_ONLYREAL);
for (j=0; j<fcount2; j++)
{

View File

@ -1,93 +1,95 @@
// универсальность добавления /
:void copyf(dword from1, in1)
//copyf - copy file or folder with content
:int copyf(dword from1, in1)
{
dword error;
BDVK CopyFile_atr1;
if (!from1) || (!in1) { notify("Error: too less copyf params!"); notify(from1); notify(in1); return; }
error = GetFileInfo(from1, #CopyFile_atr1);
if (error)
if (!from1) || (!in1)
{
notify("Error: too less copyf params!");
notify(from1);
notify(in1);
return;
}
if (error = GetFileInfo(from1, #CopyFile_atr1))
{
debug("Error: copyf->GetFileInfo");
return error;
}
if (isdir(from1))
return CopyFolder(from1, in1);
else
if (isdir(from1)) CopyFolder(from1, in1); else CopyFile(from1, in1);
return CopyFile(from1, in1);
}
:int CopyFile(dword copy_from3, copy_in3)
{
BDVK CopyFile_atr;
dword error, cbuf;
debug(copy_from3);
error = GetFileInfo(copy_from3, #CopyFile_atr);
if (error)
{debug("Error: CopyFile->GetFileInfo"); debug(copy_from3);}
if (error = GetFileInfo(copy_from3, #CopyFile_atr))
debug("Error: CopyFile->GetFileInfo");
else
{
cbuf = malloc(CopyFile_atr.sizelo);
error = ReadFile(0, CopyFile_atr.sizelo, cbuf, copy_from3);
if (error)
if (error = ReadFile(0, CopyFile_atr.sizelo, cbuf, copy_from3))
debug("Error: CopyFile->ReadFile");
else
{
error = WriteFile(CopyFile_atr.sizelo, cbuf, copy_in3);
if (error) debug("Error: CopyFile->WriteFile");
if (error = WriteFile(CopyFile_atr.sizelo, cbuf, copy_in3)) debug("Error: CopyFile->WriteFile");
}
}
free(cbuf);
if (error) debug(copy_from3);
if (error) debug_error(copy_from3, error);
return error;
}
:void CopyFolder(dword from2, in2)
:int CopyFolder(dword from2, in2)
{
dword dirbuf, fcount, filename;
int i, error, isdir;
char copy_from2[4096], copy_in2[4096];
dword dirbuf, fcount, i, filename;
char copy_from2[4096], copy_in2[4096], error;
error = GetDir(#dirbuf, #fcount, from2);
if (error)
if (error = GetDir(#dirbuf, #fcount, from2, DIRS_ONLYREAL))
{
debug("Error: CopyFolder->GetDir");
debug_error(from2, error);
debug_error(in2, error);
free(dirbuf);
return;
return error;
}
if ((strcmp(in2, "/sys")!=0) && (strcmp(in2, "/tmp9/1")!=0))
if (chrnum(in2, '/')>2) && (error = CreateDir(in2))
{
error = CreateDir(in2);
if (error) debug_error(in2, error);
debug("Error: CopyFolder->CreateDir");
debug_error(in2, error);
free(dirbuf);
return error;
}
chrcat(in2, '/');
chrcat(from2, '/');
for (i=0; i<fcount; i++)
{
filename = i*304+dirbuf+72;
isdir = TestBit(ESDWORD[filename-40], 4);
if (isdir)
strcpy(#copy_from2, from2);
chrcat(#copy_from2, '/');
strcat(#copy_from2, filename);
strcpy(#copy_in2, in2);
chrcat(#copy_in2, '/');
strcat(#copy_in2, filename);
if ( TestBit(ESDWORD[filename-40], 4) ) //isdir?
{
if ( (!strcmp(filename, ".")) || (!strcmp(filename, "..")) ) continue;
strcpy(#copy_from2, from2);
strcpy(#copy_in2, in2);
strcat(#copy_from2, filename);
strcat(#copy_in2, filename);
CopyFolder(#copy_from2, #copy_in2);
}
else
{
strcpy(#copy_from2, from2);
strcat(#copy_from2, filename);
strcpy(#copy_in2, in2);
strcat(#copy_in2, filename);
copyf_Action(filename);
if (CopyFile(#copy_from2, #copy_in2)!=0) CopyFile(#copy_from2, #copy_in2); // #2 :)
if (error=CopyFile(#copy_from2, #copy_in2))
{
if (fabs(error)==8) { debug("Stop copying."); break;} //TODO: may be need grobal var like stop_all
error=CopyFile(#copy_from2, #copy_in2); // #2 :)
}
}
}
free(dirbuf);
return error;
}

View File

@ -1,49 +0,0 @@
//BOX_LIB
dword boxlib = #aEdit_box_lib; //Asper
char aEdit_box_lib[22]="/sys/lib/box_lib.obj\0"; //Asper
dword edit_box_draw = #aEdit_box_draw;
dword edit_box_key = #aEdit_box_key;
dword edit_box_mouse = #aEdit_box_mouse;
dword version_ed = #aVersion_ed;
dword am__ = 0x0;
dword bm__ = 0x0;
char aEdit_box_draw[9] = "edit_box\0";
char aEdit_box_key[13] = "edit_box_key\0";
char aEdit_box_mouse[15] = "edit_box_mouse\0";
char aVersion_ed[11] = "version_ed\0";
char aCheck_box_draw [15] = "check_box_draw\0";
char aCheck_box_mouse [16] = "check_box_mouse\0";
char aVersion_ch [11] = "version_ch\0";
char aOption_box_draw [16] = "option_box_draw\0";
char aOption_box_mouse[17] = "option_box_mouse\0";
char aVersion_op [11] = "version_op\0" ;
struct edit_box{
dword width, left, top, color, shift_color, focus_border_color, blur_border_color,
text_color, max, text, mouse_variable, flags, size, pos, offset, cl_curs_x, cl_curs_y, shift, shift_old;
};
//ed_width equ [edi] ;è¨à¨­  ª®¬¯®­¥­â 
//ed_left equ [edi+4] ;¯®«®¦¥­¨¥ ¯® ®á¨ å
//ed_top equ [edi+8] ;¯®«®¦¥­¨¥ ¯® ®á¨ ã
//ed_color equ [edi+12] ;梥â ä®­  ª®¬¯®­¥­â 
//shift_color equ [edi+16] ;=0x6a9480
//ed_focus_border_color equ [edi+20] ;梥â à ¬ª¨ ª®¬¯®­¥­â 
//ed_blur_border_color equ [edi+24] ;梥⠭¥  ªâ¨¢­®£® ª®¬¯®­¥­â 
//ed_text_color equ [edi+28] ;梥â ⥪áâ 
//ed_max equ [edi+32] ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦­® ¬ ªá¨¬ «ì­® ¢¢¥áâ¨
//ed_text equ [edi+36] ;㪠§ â¥«ì ­  ¡ãä¥à
//ed_flags equ [edi+40] ;ä« £¨
//ed_size equ [edi+42] ;ª®«-¢® ᨬ¢®«®¢
//ed_pos equ [edi+46] ;¯®§¨æ¨ï ªãàá®à 
//ed_offset equ [edi+50] ;ᬥ饭¨¥
//cl_curs_x equ [edi+54] ;¯à¥¤ë¤ãé ï ª®®à¤¨­ â  ªãàá®à  ¯® å
//cl_curs_y equ [edi+58] ;¯à¥¤ë¤ãé ï ª®®à¤¨­ â  ªãàá®à  ¯® ã
//ed_shift_pos equ [edi+62] ;¯®«®¦¥­¨¥ ªãàá®à 
//ed_shift_pos_old equ [edi+66] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 

View File

@ -52,7 +52,7 @@ f70 getinfo_file_70;
getinfo_file_70.name = file_path;
$mov eax,70
$mov ebx,#getinfo_file_70.func
$int 0x40
$int 0x40
}
///////////////////////////
@ -187,7 +187,13 @@ char isdir(dword fpath)
return 0;
}
:int GetDir(dword dir_buf, file_count, path)
enum
{
DIRS_ALL,
DIRS_NOROOT,
DIRS_ONLYREAL
};
:int GetDir(dword dir_buf, file_count, path, doptions)
{
dword buf, fcount, error;
buf = malloc(32);
@ -198,8 +204,17 @@ char isdir(dword fpath)
buf = realloc(buf, fcount+1*304+32);
ReadDir(fcount, buf, path);
//fcount=EBX;
if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);}
if (!strcmp("..",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);}
if (doptions == DIRS_ONLYREAL)
{
if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);}
if (!strcmp("..",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);}
}
if (doptions == DIRS_NOROOT)
{
if (!strcmp(".",buf+72)) {fcount--; memmov(buf,buf+304,fcount*304);}
}
ESDWORD[dir_buf] = buf;
ESDWORD[file_count] = fcount;
}

View File

@ -240,6 +240,13 @@ inline fastcall void SwitchToAnotherThread()
$int 0x40
}
inline fastcall void SendWindowMessage( ECX, EDX)
{
$mov eax, 72
$mov ebx, 1
$int 0x40
}
inline fastcall int KillProcess( ECX)
{
$mov eax,18;

View File

@ -21,7 +21,7 @@ inline fastcall int StatusSocket( ECX)
$int 0x40
}
inline fastcall dword ReadSocket( ECX) //ecx - handle
inline fastcall dword ReadSocket( ECX)
{
$mov eax,53
$mov ebx,3

View File

@ -12,6 +12,7 @@
// strlwr( ESI) --- kyrillic symbols may not work
// strttl( EDX)
// strtok( ESI)
// chrnum(dword searchin, char symbol)
// strcpyb(dword searchin, copyin, startstr, endstr) --- copy string between strings
// strnumb(dword searchin, startstr, endstr) --- get number between strings
//------------------------------------------------------------------------------

View File

@ -4,13 +4,13 @@
#define MEMSIZE 0xA0000
#include "..\lib\kolibri.h"
#include "..\lib\strings.h"
#include "..\lib\encoding.h"
#include "..\lib\file_system.h"
#include "..\lib\figures.h"
#include "..\lib\list_box.h"
#include "..\lib\socket.h"
#include "..\lib\mem.h"
#include "..\lib\dll.h"
#include "..\lib\encoding.h"
#include "..\lib\figures.h"
#include "..\lib\file_system.h"
#include "..\lib\list_box.h"
#include "..\lib\socket.h"
//*.obj libraries
#include "..\lib\lib.obj\box_lib.h"
#include "..\lib\lib.obj\network.h"