forked from KolibriOS/kolibrios
b38aa8a9e9
git-svn-id: svn://kolibrios.org@773 a494cfbc-eb01-0410-851d-a64ba20cac60
1007 lines
36 KiB
Plaintext
1007 lines
36 KiB
Plaintext
//Leency & Veliant -=- KolibriOS Team -=- 2008
|
|
|
|
#pragma option J0
|
|
#pragma option LST
|
|
#pragma option OC
|
|
#pragma option 4
|
|
#pragma option A
|
|
#include "lib\kolibri.h--"
|
|
#include "lib\memory.h--"
|
|
#include "imgs\Imgs.cpp"
|
|
#include "imgs\icons.cpp"
|
|
#include "imgs\left_p.cpp"
|
|
#include "LVabout.c--"
|
|
#speed
|
|
|
|
//ëîêàëèçàöèÿ è íàñòðîéêè
|
|
char header = "Eolite File Manager v0.84";
|
|
char gotodev = "Goto:";
|
|
char actions = "Actions";
|
|
char preview = "Preview";
|
|
char tfile = "File";
|
|
char ttype = "Type";
|
|
char tsize = "Size";
|
|
dword videlenie=0x94AECE; //öâåò âûäåëåííîãî ýëåìåíòà èç ñïèñêà ôàéëîâ
|
|
//
|
|
|
|
int but_num, kolichestvo, curbtn, za_kadrom, longest_name;;
|
|
dword top_actions, show_actions=1, show_preview=0, top_pr;
|
|
int razm_scrl, on_y; //äëÿ ñêðîëà
|
|
int y,off; //äëÿ òåêñòà
|
|
char path[256] = "/rd/1/", edit_path[256], temp[256]; //äëÿ ïóòåé
|
|
char file_path[256], param[256], file_name[256]; //äëÿ ôàéëîâ
|
|
char copyfile[256],copy_name[256]; //êîïèðîâàíèå
|
|
int i=1; //äëÿ öèêëîâ
|
|
dword id=1;
|
|
dword ins_mas[200]=0; //Insert
|
|
dword file_mas[2000]; //ñïèñîê ôàéëîâ
|
|
int cut_active, rename_active, del_active;
|
|
int temp_int, str_len;
|
|
dword stak[100]=0;
|
|
|
|
proc_info Form;
|
|
|
|
struct {
|
|
int func;
|
|
int pos;
|
|
int rezerv;
|
|
int sizefile;
|
|
int buffer;
|
|
char rezerv2;
|
|
int stroka;
|
|
}open_file_70;
|
|
dword buf, size, isdir;
|
|
|
|
struct {
|
|
int func;
|
|
int flag;
|
|
int param;
|
|
int rez1;
|
|
int rez2;
|
|
char rezerv2;
|
|
int stroka;
|
|
}run_file_70;
|
|
|
|
void main()
|
|
dword pressed, key;
|
|
mouse m;
|
|
{
|
|
skin_width = GetSkinWidth();
|
|
buf = malloc(65536); //65536
|
|
draw_window();
|
|
$mov eax,40
|
|
$mov ebx,100111b
|
|
$int 0x40
|
|
loop()
|
|
{
|
|
switch(WaitEvent())
|
|
{
|
|
CASE 6:
|
|
IF (del_active==1) break;
|
|
m.get();
|
|
IF ((kolichestvo==but_num) || (m.y<57)) break; //åñëè ïðîêðóòêè íåò, òî íèêóäà íå ìîòàåì
|
|
IF (m.y>Form.width) m.y=57; //åñëè êóðñîð íàä îêíîì
|
|
IF (m.lkm==0) pressed=0; ELSE
|
|
//if (m.y>=on_y+skin_width) if (m.y<=on_y+razm_scrl+skin_width)
|
|
IF (m.x>=onLeft(21,0)) IF (m.x<=onLeft(6,0)) pressed=1;
|
|
if (pressed==1) IF (m.y>=on_y+razm_scrl+skin_width) //if (kolichestvo<za_kadrom+but_num)
|
|
{
|
|
IF (za_kadrom+but_num>=kolichestvo) break;
|
|
Line_ReDraw(0xFFFFFF); //áåëàÿ ïîëîñà
|
|
za_kadrom=za_kadrom+but_num; //za_kadrom=za_kadrom+1;
|
|
List_ReDraw();
|
|
}
|
|
ELSE IF (pressed==1) IF (m.y<=on_y) IF (on_y<>57)
|
|
{
|
|
IF (za_kadrom>but_num) za_kadrom=za_kadrom-but_num; //za_kadrom=za_kadrom-1;
|
|
ELSE za_kadrom=0;
|
|
List_ReDraw();
|
|
}
|
|
break;
|
|
CASE evButton:
|
|
id=GetButtonID();
|
|
IF (id==1) {ExitProcess(); break;}
|
|
IF (del_active==1)
|
|
{
|
|
IF (id==301) Del_File();
|
|
IF (id==302) {del_active=0; Open_Dir(#path,1);}
|
|
break;
|
|
}
|
|
switch(id)
|
|
{
|
|
CASE 23: IF (strcmp(#path,"/")==-1) Dir_Up(); break;//up!
|
|
case 26: Paste(); break;//paste
|
|
case 27: Goto_edit_path(); break; //goto edit_path
|
|
case 81: Del_Form(); break;//Delete file
|
|
case 24: //cut
|
|
case 25: //copy
|
|
if (isdir==1) break; //ïàïêè ïîêà ÷òî êîïèðîâàòü íå óìååì
|
|
copystr(#file_name,#copy_name);
|
|
copystr(#file_path,#copyfile); //âû÷èñëÿåì êàêîé ôàéë êîïèðîâàòü
|
|
IF (id==24) cut_active=1; ELSE cut_active=0; //ðåæåì èëè êîïèðóåì?
|
|
break;
|
|
case 30: //about
|
|
EAX = 51;
|
|
EBX = 1;
|
|
ECX = #authors;
|
|
EDX = #stak;
|
|
$int 40h;
|
|
break;
|
|
case 50: //ñòðåëêà ââåðõ íà ñêðîëå
|
|
IF (za_kadrom<=0) break;
|
|
za_kadrom=za_kadrom-1;
|
|
List_ReDraw();
|
|
break;
|
|
case 51: //ñòðåëêà âíèç íà ñêðîëå
|
|
IF (za_kadrom+but_num>=kolichestvo) break;
|
|
za_kadrom=za_kadrom+1;
|
|
List_ReDraw();
|
|
break;
|
|
case 77: //actions
|
|
IF (show_actions==1) show_actions=0; else show_actions=1;
|
|
Actions(); //äàëåå ðèñóåì ñäåñü ÷òîá ìåíüøå áûëà ïåðåðèñîâêà
|
|
IF (show_actions==1) DrawBar(22,top_actions*16+159,160,15,0x00699C);
|
|
ELSE {
|
|
DrawBar(22,top_actions*16+120,160,15,0x00699C);
|
|
DrawBar(22,top_actions*16+242,160,50,0x00699C);
|
|
}
|
|
Preview();
|
|
IF (show_preview==0) DrawBar(22,top_pr+18,160,101,0x00699C); //ñèíåå ðèñóåì ñäåñü
|
|
break;
|
|
case 78: //preview
|
|
if (show_preview==0)show_preview=1; else
|
|
{ show_preview=0; DrawBar(22,top_pr+18,160,101,0x00699C); } //ñèíåå
|
|
Preview();
|
|
break;
|
|
case 80: //rename
|
|
if (isdir==1) break; //ïàïêè ïîêà ÷òî ïåðåèìåíîâûâàòü íå óìååì
|
|
y= curbtn*18+85;
|
|
DrawRegion(219,curbtn*18+57,onLeft(50,197),17,0x94AECE); //îáîäîê
|
|
DrawBar(220,curbtn*18+58,onLeft(50,197)-1,16,0xFFFFCC); //æ¸ëòîå
|
|
WriteTextXY(224<<16+y, 0x80000000, #file_name, 0);
|
|
rename_active=1;
|
|
break;
|
|
case 21: //Íàçàä
|
|
GoBack(1);
|
|
break;
|
|
case 22: //Âïåð¸ä
|
|
GoBack(0);
|
|
break;
|
|
}//---------------------------ïåðåõîä ïî id----------------------
|
|
if (id>200) //êíîïêè èç ñïèñêà ôàéëîâ
|
|
{
|
|
if (curbtn!=id-201)
|
|
{
|
|
Line_ReDraw(0xFFFFFF); //áåëàÿ ïîëîñà
|
|
curbtn=id-201;
|
|
Line_ReDraw(videlenie); //âûäåëåíèå
|
|
break;
|
|
}
|
|
else
|
|
if ((isdir==1) if (strcmp(curbtn+1*304 + buf+72,"..")==-1)
|
|
{
|
|
copystr(#file_path, #path);
|
|
copystr("/", #path+strlen(#path));
|
|
za_kadrom=0; //ââåðõ ñïèñêà
|
|
curbtn=0;
|
|
Open_Dir(#path,1);
|
|
} else Dir_Up(); else Run_File();
|
|
break;
|
|
}
|
|
if (id>=100) //ïîäêëþ÷¸ííûå íîñèòåëè èíôîðìàöèè
|
|
{
|
|
Open_Dir("/",0);
|
|
copystr(id-100*304+ buf+72, #path);
|
|
if (strcmp(#path,"rd")==0) copystr("/rd/1/",#path);
|
|
else
|
|
{
|
|
copystr("/", #temp);
|
|
copystr(#path, #temp+strlen(#temp));
|
|
copystr("/", #temp+strlen(#temp));
|
|
copystr(#temp,#path);
|
|
}
|
|
za_kadrom=0; //ââåðõ ñïèñêà
|
|
curbtn=0;
|
|
Open_Dir(#path,1);
|
|
break;
|
|
}
|
|
case evKey:
|
|
key = GetKey();
|
|
IF (del_active==1)
|
|
{
|
|
IF (key==013) Del_File();
|
|
IF (key==027) {del_active=0; Open_Dir(#path,1);}
|
|
break;
|
|
}
|
|
switch (key)
|
|
{
|
|
case 0x08: //backspace
|
|
if (rename_active==1) {copystr(#file_name,#temp); if (strlen(#temp)<=0) break;}
|
|
else {copystr(#edit_path,#temp); if (strlen(#temp)<=1) break;} //îñòàâëÿåì òîëüêî "/"
|
|
EBX=#temp + strlen(#temp)-1;
|
|
ESBYTE[EBX] = 0;
|
|
if (rename_active==1)
|
|
{
|
|
DrawBar(strlen(#file_name)*6+218,curbtn*18+58,6,16,0xFFFFCC); //æ¸ëòîå
|
|
copystr(#temp,#file_name);
|
|
WriteTextXY(224<<16+y, 0x80000000, #file_name, 0);
|
|
} else { copystr(#temp,#edit_path); KEdit(); }
|
|
break;
|
|
case 014: //íîâîå îêíî
|
|
break;
|
|
case 024: //Ctrl+X cut
|
|
if (isdir==1) break; //ïàïêè ïîêà ÷òî êîïèðîâàòü íå óìååì
|
|
copystr(#file_name,#copy_name);
|
|
copystr(#file_path,#copyfile); //âû÷èñëÿåì êàêîé ôàéë êîïèðîâàòü
|
|
cut_active=1;
|
|
break;
|
|
case 089: //Ctrl+Ins copy
|
|
case 003: //Ctrl+C copy
|
|
if (isdir==1) break; //ïàïêè ïîêà ÷òî êîïèðîâàòü íå óìååì
|
|
copystr(#file_name,#copy_name);
|
|
copystr(#file_path,#copyfile); //âû÷èñëÿåì êàêîé ôàéë êîïèðîâàòü
|
|
cut_active=0;
|
|
break;
|
|
case 022: //Ctrl+V paste
|
|
Paste();
|
|
break;
|
|
case 027: //Esc
|
|
if (rename_active==1) { rename_active=0; Line_ReDraw(videlenie); }
|
|
break;
|
|
case 013: //Enter
|
|
if (rename_active==1) {Line_ReDraw(videlenie); break;}
|
|
if (strcmp(#path,#edit_path)==-1) Goto_edit_path(); else
|
|
if ((isdir==1) if (strcmp(curbtn+1*304 + buf+72,"..")==-1)
|
|
{
|
|
copystr(#file_path, #path);
|
|
copystr("/", #path+strlen(#path));
|
|
za_kadrom=0; //ââåðõ ñïèñêà
|
|
curbtn=0;
|
|
Open_Dir(#path,1);
|
|
} else Dir_Up(); else Run_File();
|
|
break;
|
|
case 178: //up
|
|
if (curbtn>=1)
|
|
{
|
|
Line_ReDraw(0xFFFFFF); //áåëàÿ ïîëîñà
|
|
curbtn=curbtn-1;
|
|
Line_ReDraw(videlenie); //âûäåëåíèå
|
|
break;
|
|
}
|
|
if (za_kadrom<=0) break;
|
|
za_kadrom=za_kadrom-1;
|
|
List_ReDraw();
|
|
break;
|
|
case 177: //down
|
|
if(curbtn<but_num-1)
|
|
{
|
|
Line_ReDraw(0xFFFFFF); //áåëàÿ ïîëîñà
|
|
curbtn=curbtn+1;
|
|
Line_ReDraw(videlenie); //âûäåëåíèå
|
|
break;
|
|
}
|
|
if (za_kadrom+but_num>=kolichestvo) break;
|
|
za_kadrom=za_kadrom+1;
|
|
List_ReDraw();
|
|
break;
|
|
case 180: //home
|
|
if (curbtn==0)
|
|
if (strcmp(".",buf+72)==-1) if (za_kadrom==0) break; else if (za_kadrom==1) break;
|
|
if (za_kadrom==0){
|
|
Line_ReDraw(0xFFFFFF); //áåëàÿ ïîëîñà
|
|
curbtn=0;
|
|
Line_ReDraw(videlenie); //âûäåëåíèå
|
|
break;
|
|
}
|
|
Line_ReDraw(0xFFFFFF); //áåëàÿ ïîëîñà
|
|
za_kadrom=0; //åñëè ìû óæå ïðîìîòàëè è ïåðâûé ýëåìåíò çà êàäðîì
|
|
curbtn=0;
|
|
List_ReDraw();
|
|
break;
|
|
case 181: //end
|
|
if (curbtn==kolichestvo-za_kadrom-1) break;
|
|
if (but_num==kolichestvo-za_kadrom){
|
|
Line_ReDraw(0xFFFFFF); //áåëàÿ ïîëîñà
|
|
curbtn=but_num-1;
|
|
Line_ReDraw(videlenie); //âûäåëåíèå
|
|
break;
|
|
}
|
|
Line_ReDraw(0xFFFFFF); //áåëàÿ ïîëîñà
|
|
za_kadrom=kolichestvo-but_num;
|
|
curbtn=but_num;
|
|
List_ReDraw();
|
|
break;
|
|
case 183: //Page Down
|
|
IF (but_num==kolichestvo-za_kadrom) break;
|
|
IF (kolichestvo-za_kadrom-but_num<but_num) || (kolichestvo==but_num)
|
|
za_kadrom=kolichestvo-but_num; ELSE za_kadrom=za_kadrom+but_num;
|
|
List_ReDraw();
|
|
break;
|
|
case 184: //Page Up
|
|
IF (za_kadrom==0) break;
|
|
IF (za_kadrom<=but_num) za_kadrom=0; ELSE za_kadrom=za_kadrom-but_num;
|
|
List_ReDraw();
|
|
break;
|
|
case 185: //Insert
|
|
if (ins_mas[file_mas[za_kadrom+curbtn]]==0) ins_mas[file_mas[za_kadrom+curbtn]]=1;
|
|
else ins_mas[file_mas[za_kadrom+curbtn]]=0;
|
|
if(curbtn<but_num-1)
|
|
{
|
|
Line_ReDraw(0xFFFFFF); //áåëàÿ ïîëîñà
|
|
curbtn++;
|
|
Line_ReDraw(videlenie); //âûäåëåíèå
|
|
break;
|
|
}
|
|
if (za_kadrom+but_num>=kolichestvo) Line_ReDraw(videlenie);
|
|
else { za_kadrom=za_kadrom+1; List_ReDraw(); }
|
|
break;
|
|
case 182: Del_Form(); break; //delete file
|
|
case 054: IF (rename_active==0) {draw_window(); break;} ELSE goto REN_; //ïåðåðèñîâàòü îêíî F5
|
|
case 051: //Íàæàòà F2
|
|
if (rename_active==0){
|
|
if (isdir==1) break; //ïàïêè ïîêà ÷òî ïåðåèìåíîâûâàòü íå óìååì
|
|
y= curbtn*18+85;
|
|
DrawRegion(219,curbtn*18+57,onLeft(50,197),17,0x94AECE);
|
|
DrawBar(220,curbtn*18+58,onLeft(50,197)-1,16,0xFFFFCC);
|
|
WriteTextXY(224<<16+y, 0x80000000, #file_name, 0);
|
|
rename_active=1;
|
|
} ELSE GOTO REN_;
|
|
break;
|
|
default:
|
|
REN_:
|
|
if (rename_active==1) copystr(#file_name,#temp); else copystr(#edit_path,#temp);
|
|
if (strlen(#temp)>256) break;
|
|
EBX=#temp + strlen(#temp);
|
|
ESBYTE[EBX] = key;
|
|
ESBYTE[EBX+1] = 0;
|
|
//
|
|
if (rename_active==1)
|
|
{
|
|
DrawBar(220,curbtn*18+58,onLeft(50,197)-1,16,0xFFFFCC); //æ¸ëòîå
|
|
copystr(#temp,#file_name);
|
|
WriteTextXY(224<<16+y, 0x80000000, #file_name, 0);
|
|
} else { copystr(#temp,#edit_path); KEdit(); }
|
|
break;
|
|
}
|
|
break;
|
|
CASE evReDraw:
|
|
draw_window();
|
|
break;
|
|
}
|
|
}
|
|
ExitProcess();
|
|
}
|
|
|
|
void draw_window()
|
|
{
|
|
WindowRedrawStatus(1);
|
|
DefineAndDrawWindow(100,100,600,410,0x03,0x00E4DFE1,0,0,0);
|
|
DrawTitle(#header);
|
|
Form.getme();
|
|
if (Form.height<skin_width+10) return;
|
|
if (Form.width<493) MoveSize(OLD,OLD,493,OLD);
|
|
//control buttons
|
|
DefineButton(14,5,31,29,21+BT_HIDE,0xE4DFE1); //back
|
|
PutImage(#back,30,28,15,6);
|
|
DefineButton(50,5,31,29,22+BT_HIDE,0xE4DFE1); //forward
|
|
PutImage(#forward,30,28,51,6);
|
|
DefineButton(89,5,31,29,23+BT_HIDE,0xE4DFE1); //up!
|
|
PutImage(#up,30,28,90,6);
|
|
DrawBar(132,8,1,25,0x94AECE);
|
|
DefineButton(140,5,31,29,24+BT_HIDE,0xE4DFE1); //cut
|
|
PutImage(#fcut,30,28,141,6);
|
|
DefineButton(176,5,31,29,25+BT_HIDE,0xE4DFE1); //copy
|
|
PutImage(#fcopy,30,28,177,6);
|
|
DefineButton(212,5,31,29,26+BT_HIDE,0xE4DFE1); //paste
|
|
PutImage(#fpaste,30,28,213,6);
|
|
DefineButton(onLeft(34,0),6,27,28,30+BT_HIDE+BT_NOFRAME,0xE4DFE1); //about
|
|
PutImage(#about,25,26,onLeft(34,0),7);
|
|
//ïîëîñà àäðåñà
|
|
DrawRegion(251,12,onLeft(61,251),16,0x94AECE);//îáîäîê
|
|
DefineButton(onLeft(61,0),12,18,16,27+BT_HIDE,0xE4DFE1); //goto there
|
|
PutImage(#Edit_Goto,18,17,onLeft(60,0),12);
|
|
//ãëàâíûé ïðÿìîóãîëüíèê âíóòðè
|
|
DrawRegion(6,40,Form.width-12,Form.height-skin_width-46,0x94AECE);
|
|
DrawBar(7,41,190,onTop(6,41),0x00699C); //ñèíèé ïðÿìîóãîëüíèê
|
|
LeftBar(); //ïàíåëü ñëåâà íà ñèíåì ôîíå
|
|
//Íàçâàíèÿ ñòîëáöîâ
|
|
DrawBar(197,41,onLeft(6,197),1,0xFFFFFF); //áåëàÿ ïîëîñà ñâåðõó
|
|
DrawBar(197,56,onLeft(6,197),1,0x94AECE); //ïîëîñà ñíèçó
|
|
DrawBar(onLeft(163,0),41,1,16,0x94AECE); //ïîëîñà âåðòèêàëüíàÿ 1
|
|
DrawBar(onLeft(90,0),41,1,16,0x94AECE); //ïîëîñà âåðòèêàëüíàÿ 2
|
|
temp_int=Form.width-163-197>>1-15; //íàõîäèì ñåðåäèíó ïîëÿ text File
|
|
WriteText(temp_int+197,45,0x80,0,#tfile,0);//text File
|
|
WriteText(onLeft(137,0),45,0x80,0,#ttype,0);//text Type
|
|
WriteText(onLeft(66,0),45,0x80,0,#tsize,0);//text Size
|
|
if (curbtn<>0) DrawBar(197,57,onLeft(22,197),18,0xFFFFFF);
|
|
Open_Dir(#path,1);
|
|
//ïðîêðóòêà
|
|
DefineButton(onLeft(22,0),40,16,16,50+BT_HIDE,0xE4DFE1); //ïðîêðóòêà ââåðõ
|
|
DrawBar(onLeft(21,0),42,1,14,0x00FFFFFF); //áåëàÿ ïîëîñà ñëåâà
|
|
WriteText(onLeft(16,0),45,0x80,0,"\x18",0); //ñòðåëêà ââåðõ
|
|
DefineButton(onLeft(22,0),onTop(22,0),16,16,51+BT_DEL,0xE4DFE1); //óäàëÿåì
|
|
DrawFlatButton(onLeft(22,0),onTop(22,0),16,16,51,0xE4DFE1); //ïðîêðóòêà âíèç
|
|
DrawBar(onLeft(21,0),onTop(22,0)+15,15,1,0xE4DFE1); //óäàëÿåì òåíü
|
|
DrawBar(onLeft(7,0),onTop(20,0),1,14,0xE4DFE1); //óäàëÿåì òåíü
|
|
WriteText(onLeft(16,0),onTop(17,0),0x80,0,"\x19",0); //ñòðåëêà âíèç
|
|
DrawBar(onLeft(22,0),41,1,onTop(6,57),0x94AECE); //ëèíèÿ ñëåâà îò ïðîêðóòêè
|
|
IF (del_active==1) Del_Form();
|
|
WindowRedrawStatus(2);
|
|
}
|
|
|
|
void KEdit()
|
|
{
|
|
temp_int=onLeft(61,252)/6;
|
|
IF (strlen(#edit_path)<temp_int)
|
|
{
|
|
DrawBar(strlen(#edit_path)*6+252+5,17,6,9,0xFFFFFF); //áåëàÿ îáëàñòü ïîä KEdit
|
|
WriteText(257,17,0x80,0,#edit_path,0); //text 'path'
|
|
}
|
|
ELSE
|
|
{
|
|
DrawBar(252,17,onLeft(61,252),9,0xFFFFFF); //áåëàÿ îáëàñòü
|
|
WriteText(257,17,0x80,0,#edit_path+strlen(#edit_path)-temp_int,0); //text 'path'
|
|
}
|
|
}
|
|
|
|
char drive_name[30];
|
|
dword dev_icon;
|
|
void LeftBar(){
|
|
//ñïèñîê äèñêîâ
|
|
DrawBar(22,56,160,17,0xE4DFE1); //ñåðîå ñâåðõó
|
|
WriteText(30,61,0x80,0,#gotodev,0); //text Goto:
|
|
DrawBar(22,73,160,1,0x94AECE); //ïîä÷¸ðêèâàíèå
|
|
Open_Dir("/",0);
|
|
DrawBar(22,74,160,kolichestvo*16+1,0xFFFFFF); //áåëîå
|
|
for (i=0;i<kolichestvo;i++)
|
|
{
|
|
copystr("Unknown drive",#drive_name); //èçíà÷àëüíî íåèçâåñíûé íîñèòåëü
|
|
DefineButton(22,i*16+74,159,16,100+i+BT_HIDE,0xE4DFE1); //ñîçäà¸ì êíîïêè, à ïîòîì âûâîäèì íàçâàíèÿ äèñêîâ
|
|
IF (strcmp(i*304+ buf+72,"rd")<>-1) { copystr("RAM-disk /rd/1/",#drive_name); dev_icon=#rd; }
|
|
IF (strcmp(i*304+ buf+72,"fd")<>-1) { copystr("Floppy disk /fd/",#drive_name); dev_icon=#fd; }
|
|
IF (strcmp(i*304+ buf+72,"hd0")<>-1) { copystr("Hard disk drive /hd0/",#drive_name); dev_icon=#hd; }
|
|
IF (strcmp(i*304+ buf+72,"hd1")<>-1) { copystr("Hard disk drive /hd1/",#drive_name); dev_icon=#hd; }
|
|
IF (strcmp(i*304+ buf+72,"hd2")<>-1) { copystr("Hard disk drive /hd2/",#drive_name); dev_icon=#hd; }
|
|
IF (strcmp(i*304+ buf+72,"bd0")<>-1) { copystr("Hard disk drive /bd0/",#drive_name); dev_icon=#hd; }
|
|
IF (strcmp(i*304+ buf+72,"bd1")<>-1) { copystr("Hard disk drive /bd1/",#drive_name); dev_icon=#hd; }
|
|
IF (strcmp(i*304+ buf+72,"bd2")<>-1) { copystr("Hard disk drive /bd2/",#drive_name); dev_icon=#hd; }
|
|
IF (strcmp(i*304+ buf+72,"cd1")<>-1) { copystr("CD-drive /cd1/",#drive_name); dev_icon=#cd; }
|
|
IF (strcmp(i*304+ buf+72,"cd2")<>-1) { copystr("CD-drive /cd2/",#drive_name); dev_icon=#cd; }
|
|
WriteText(45,i*16+79,0x80,0,#drive_name,0);
|
|
PutImage(dev_icon,14,13,26,i*16+76);
|
|
}
|
|
//ôóíêöèè ôàéëîâ è ïàïîê
|
|
top_actions=kolichestvo;
|
|
Actions();
|
|
Preview();
|
|
}
|
|
|
|
void Actions()
|
|
{
|
|
DrawBar(22,top_actions*16+90,160,17,0xE4DFE1); //ñåðîå ñâåðõó
|
|
WriteText(30,top_actions*16+95,0x80,0,#actions,0); //text Actions
|
|
DefineButton(164,top_actions*16+91,16,16,77+BT_HIDE+BT_NOFRAME,0xE4DFE1); //êíîïà äëÿ ñòðåëêè
|
|
DrawBar(22,top_actions*16+107,160,1,0x94AECE); //ïîä÷¸ðêèâàíèå
|
|
if (show_actions==1)
|
|
{
|
|
WriteText(170,top_actions*16+95,0x80,0,"\x19",0); //ñòðåëêà âíèç
|
|
DrawBar(22,top_actions*16+108,160,51,0xFFFFFF); //áåëîå
|
|
//rename file
|
|
DefineButton(22,top_actions*16+108,159,16,80+BT_HIDE,0xE4DFE1);
|
|
WriteText(47,top_actions*16+113,0x80,0,"Rename file <F2>",0);
|
|
PutImage(#ren_file,16,15,26,top_actions*16+109);
|
|
//delete file
|
|
DefineButton(22,top_actions*16+125,159,16,81+BT_HIDE,0xE4DFE1);
|
|
WriteText(47,top_actions*16+130,0x80,0,"Delete file <Del>",0);
|
|
PutImage(#del_file,16,15,26,top_actions*16+125);
|
|
//create folder
|
|
DefineButton(22,top_actions*16+142,159,16,82+BT_HIDE,0xE4DFE1);
|
|
WriteText(47,top_actions*16+147,0x80,0,"Create folder <F6>",0);
|
|
PutImage(#new_fol,16,15,26,top_actions*16+142);
|
|
}
|
|
else
|
|
{
|
|
DefineButton(22,top_actions*16+108,159,16,80+BT_DEL,0xE4DFE1);
|
|
DefineButton(22,top_actions*16+125,159,16,81+BT_DEL,0xE4DFE1);
|
|
DefineButton(22,top_actions*16+142,159,16,82+BT_DEL,0xE4DFE1);
|
|
WriteText(170,top_actions*16+95,0x80,0,"\x18",0); //ñòðåëêà ââåðõ
|
|
DrawBar(22,top_actions*16+108,160,51,0x00699C); //ñèíåå
|
|
}
|
|
}
|
|
|
|
void Preview()
|
|
{
|
|
IF (show_actions==1) top_pr=top_actions*16+174; ELSE top_pr=top_actions*16+174-51;
|
|
DrawBar(22,top_pr,160,17,0xE4DFE1); //ñåðîå ñâåðõó
|
|
WriteText(30,top_pr+5,0x80,0,#preview,0); //text Preview
|
|
DefineButton(164,top_pr+1,16,16,78+BT_DEL,0xE4DFE1);
|
|
DefineButton(164,top_pr+1,16,16,78+BT_HIDE+BT_NOFRAME,0xE4DFE1); //êíîïà äëÿ ñòðåëêè
|
|
DrawBar(22,top_pr+17,160,1,0x94AECE); //ïîä÷¸ðêèâàíèå
|
|
IF (show_preview==0) WriteText(170,top_pr+5,0x80,0,"\x18",0); else//ñòðåëêà ââåðõ
|
|
{
|
|
WriteText(170,top_pr+5,0x80,0,"\x19",0); //ñòðåëêà âíèç
|
|
DrawBar(22,top_pr+18,160,100,0xFFFFFF); //áåëîå
|
|
/*WriteText(30,top_pr+30,0x80,0,IntToStr(kolichestvo),0);
|
|
WriteText(30,top_pr+50,0x80,0,IntToStr(but_num),0);
|
|
WriteText(30,top_pr+60,0x80,0,IntToStr(za_kadrom),0);
|
|
WriteText(30,top_pr+70,0x80,0,#file_path,0);
|
|
WriteText(30,top_pr+80,0x80,0,#param,0);*/
|
|
WriteText(30,top_pr+60,0x80,0,"Not realized... Yet.",0);
|
|
}
|
|
}
|
|
|
|
void TVScroll() { //Ïðîêðóòêà
|
|
if (but_num==kolichestvo)
|
|
{
|
|
DefineButton(onLeft(22,0),57,15,on_y-57,54+BT_DEL,0xE4DFE1); //óäàëÿåì
|
|
DefineButton(onLeft(22,0),on_y+razm_scrl+2,16,onTop(22,57)-razm_scrl-on_y+55,55+BT_DEL,0xE4DFE1); //óäàëÿåì
|
|
DrawBar(onLeft(21,0),57,15,onTop(79,0),0xCED0D0); //ñåðóþ îáëàñòü ðèñóåì
|
|
}
|
|
else
|
|
{
|
|
razm_scrl=onTop(22,57) * but_num - but_num / kolichestvo; //ñ÷èòàåò ïî-ïîðÿäêó
|
|
on_y = za_kadrom / but_num * razm_scrl+57;
|
|
IF (razm_scrl<20) razm_scrl = 20; //óñòàíàâëèâàåì ìèíèìàëüíûé ðàçìåð ñêðîëëà
|
|
IF (za_kadrom==0) on_y= 57; ELSE IF (za_kadrom<but_num) on_y=70;
|
|
IF (za_kadrom+but_num==kolichestvo) on_y= onTop(23,57)-razm_scrl+57; //â êîíåö åñëè òàì íè÷¸ íåò
|
|
//ïîëçóíîê, ðèñóåì âèäèìûé, êðàñèâûé ïðÿìîóãîëüíèê
|
|
DrawBar(onLeft(21,0),on_y,15,1,0x94AECE); //ñèíÿÿ ëèíèÿ ñâåðõó
|
|
DrawBar(onLeft(21,0),on_y+razm_scrl,15,1,0x94AECE); //ñèíÿÿ ëèíèÿ ñíèçó
|
|
DrawBar(onLeft(21,0),on_y+1,1,razm_scrl-1,0x00FFFFFF); //áåëàÿ ïîëîñà ñëåâà
|
|
DrawBar(onLeft(21,0),on_y+1,15,1,0x00FFFFFF); //áåëàÿ ïîëîñà ñâåðõó
|
|
DrawBar(onLeft(20,0),on_y+2,14,razm_scrl-2,0x00E4DFE1); //ïðÿìîóãîëüíèê âíóòðè
|
|
//ïîëîñû
|
|
DrawBar(onLeft(21,0),57,15,on_y-57,0xCED0D0); //ïîëå äî ïîëçóíêà
|
|
DrawBar(onLeft(21,0),on_y+razm_scrl+1,15,onTop(22,57)-razm_scrl-on_y+56,0xCED0D0); //ïîëå ïîñëå ïîëçóíêà
|
|
}
|
|
}
|
|
|
|
void List_ReDraw()
|
|
{
|
|
y=85;
|
|
if ((kolichestvo-za_kadrom<but_num) && (za_kadrom>1)) //åñëè ìû â êîíöå ñïèñêà ôàéëîâ ðàçâåðí¸ì îêíî ïîÿâÿòüñÿ ïóñòÿå áåëûå êíîïêè
|
|
{
|
|
za_kadrom=kolichestvo-but_num;
|
|
curbtn=but_num-1;
|
|
} else if (curbtn>but_num-1) curbtn=but_num-1; //ýòî åñëè âûäåëåíèå ïîñëå ñõëîïûâàíèÿ îêíà çà êàäðîì
|
|
//
|
|
if (onLeft(165,220)/6<longest_name) longest_name= onLeft(165,220)/6+1; //îãðàíè÷åíèå íà ðàçìåð áåëîãî ïîëÿ
|
|
DrawBar(220,57,longest_name*6,curbtn-3*18+57-3,0xFFFFFF); //áåëàÿ îáëàñòü ñëåâà
|
|
DrawBar(220,curbtn+1*18+57,longest_name*6,onTop(6,curbtn+1*18+57),0xFFFFFF); //áåëàÿ îáëàñòü ñëåâà
|
|
DrawBar(onLeft(155,0),57,121,curbtn-3*18+57-3,0xFFFFFF); //áåëàÿ îáëàñòü ñïðàâà
|
|
DrawBar(onLeft(155,0),curbtn+1*18+57,121,onTop(6,curbtn+1*18+57),0xFFFFFF); //áåëàÿ îáëàñòü ñïðàâà
|
|
//
|
|
str_len = onLeft(220,160)/6; //äëèííà íàçâàíèÿ ôàéëà
|
|
longest_name=strlen(off);
|
|
for (i=za_kadrom;i<za_kadrom+but_num;i++)
|
|
{
|
|
if (strcmp(".",buf+72)==-1) off = file_mas[i]*304 + buf+72; else off = file_mas[i+1]*304 + buf+72;
|
|
EAX = off - 8;
|
|
size=ESDWORD[EAX];
|
|
EAX = off - 40;
|
|
EAX=ESDWORD[EAX];
|
|
$shr eax,4
|
|
$and eax,1
|
|
isdir=EAX;
|
|
if (curbtn<>i) if (isdir==1) Put_icon("<dir>"); else
|
|
{
|
|
WriteText(7-strlen(ConvertSize(size))*6+onLeft(75,0),y-22,0x80,0,ConvertSize(size),0);
|
|
Put_icon(off+strlen(off)-4);
|
|
}
|
|
if (strlen(off)<str_len) temp_int=strlen(off); else temp_int=str_len; //äëèííà íàçâàíèÿ ôàéëà
|
|
if (ins_mas[file_mas[i]]==0)
|
|
WriteTextXY(220<<16+y, 0, off, temp_int); //âûäåëåíî ëè èíñåðòîì?
|
|
else WriteTextXY(220<<16+y, 0x00FF9900, off, temp_int);
|
|
y=y+18;
|
|
if (longest_name<temp_int) longest_name=temp_int; //ñòðàííî: ïî÷åìó íå ðàáîòàåò
|
|
}
|
|
Line_ReDraw(videlenie);
|
|
DrawBar(onLeft(90,0),57,1,onTop(7,57),0xE4DFE1); //ïîëîñà ñåðàÿ âåðòèêàëüíàÿ 2
|
|
TVScroll();
|
|
}
|
|
|
|
void Line_ReDraw(dword color){
|
|
if (rename_active==1)
|
|
{
|
|
rename_active=0;
|
|
copystr(#path,#temp);
|
|
copystr(#file_name,#temp+strlen(#temp));
|
|
if (strcmp(#file_path,#temp)==-1) if (strlen(#file_name)>0)
|
|
{
|
|
CopyFile(#file_path,#temp);
|
|
Del_File();
|
|
//za_kadrom=kolichestvo-but_num;
|
|
//curbtn=but_num-1;
|
|
//Line_ReDraw(videlenie);
|
|
}
|
|
}
|
|
DrawBar(197,curbtn*18+57,onLeft(22,197),18,color); //ïîëîñà áåëàÿ èëè âûäåëåíèÿ
|
|
y= curbtn*18+85; //ïîëîæåíèå òåêñòà ïî Y
|
|
if (strcmp(".",buf+72)==-1) off = file_mas[curbtn+za_kadrom]*304 + buf+72; else off = file_mas[curbtn+za_kadrom+1]*304 + buf+72;
|
|
temp_int = onLeft(220,160)/6;
|
|
if (strlen(off)<temp_int) temp_int = strlen(off); //äëèííà íàçâàíèÿ ôàéëà
|
|
if (ins_mas[file_mas[za_kadrom+curbtn]]==0)
|
|
WriteTextXY(220<<16+y, 0, off, temp_int); //âûäåëåíî ëè èíñåðòîì?
|
|
//EDI = 0x80FFFFFF;
|
|
//WriteTextXY(temp_int<<16+y, 0xC0000000,#temp, 7); //DD8500 èëè FF3399
|
|
else WriteTextXY(220<<16+y, 0x80DD8500, off, temp_int); //DD8500 èëè FF3399
|
|
EAX = off - 8;
|
|
size=ESDWORD[EAX];
|
|
EAX = off - 40;
|
|
EAX=ESDWORD[EAX];
|
|
$shr eax,4
|
|
$and eax,1
|
|
isdir=EAX;
|
|
if (isdir==1) Put_icon("<dir>"); else
|
|
{
|
|
WriteText(7-strlen(ConvertSize(size))*6+onLeft(75,0),y-22,0x80,0,ConvertSize(size),0);
|
|
Put_icon(off+strlen(off)-4);
|
|
}
|
|
copystr(#path,#file_path);
|
|
copystr(off,#file_name);
|
|
copystr(off,#file_path+strlen(#file_path)); //èòàê, file_path=ôàéëó, ò.ê. ïî-óìîë÷àíèþ ýòî ïðîãà
|
|
DrawBar(onLeft(163,0),curbtn*18+57,1,18,0xE4DFE1); //ïîëîñà ñåðàÿ âåðòèêàëüíàÿ 1
|
|
DrawBar(onLeft(90,0),curbtn*18+57,1,18,0xE4DFE1); //ïîëîñà ñåðàÿ âåðòèêàëüíàÿ 2
|
|
if (color==videlenie) //çàêðàøèâàåì èêîíêó
|
|
{
|
|
if (temp_int==1) //ôàéëèê
|
|
{
|
|
DrawBar(200,y-26,2,15,videlenie);
|
|
DrawBar(214,y-26,2,15,videlenie);
|
|
DrawBar(210,y-26,4,1,videlenie);//ëå
|
|
DrawBar(211,y-25,3,1,videlenie);//ñåí
|
|
DrawBar(212,y-24,2,1,videlenie);//êà
|
|
DrawBar(213,y-23,1,1,videlenie);//
|
|
}
|
|
if (temp_int==2) //ïàïêà
|
|
{
|
|
DrawBar(201,y-13,15,2,videlenie); //ñíèçó ëèíèÿ
|
|
DrawBar(200,y-26,1,15,videlenie); //ñëåâà ëèíèÿ
|
|
DrawBar(208,y-26,8,2,videlenie); //ñâåðõó ñïðàâà ëèíèÿ
|
|
//.òî÷êè
|
|
PutPixel(201,y-26+skin_width,videlenie); //ñâåðõó ñëåâà òî÷êà
|
|
PutPixel(207,y-26+skin_width,videlenie); //ñâåðõó ñïðàâà òî÷êà
|
|
PutPixel(201,y-14+skin_width,videlenie); //ñëåâà ñíèçó òî÷êà
|
|
PutPixel(215,y-14+skin_width,videlenie); //ñïðàâà ñíèçó òî÷êà
|
|
PutPixel(215,y-24+skin_width,videlenie); //êàêàÿ ðàçíèöà ãäå
|
|
}
|
|
IF (temp_int==3) PutPixel(215,y-26+skin_width,videlenie); //skin
|
|
IF (temp_int==5) {DrawBar(200,y-26,1,15,videlenie); DrawBar(215,y-26,1,15,videlenie);} //video
|
|
}
|
|
}
|
|
|
|
void Open_Dir(dword path_,redraw){
|
|
for (i=0;i<kolichestvo;i++) ins_mas[i]=0;
|
|
//temp=path+3;
|
|
//copestr(#temp
|
|
//if (strcmp(#temp,"/rd")==0) ExitProcess(); //realloc(500000
|
|
open_file_70.func = 1;
|
|
open_file_70.pos = 0;
|
|
open_file_70.rezerv = 0;
|
|
open_file_70.sizefile = 65536;
|
|
open_file_70.buffer = buf;
|
|
open_file_70.rezerv2 = 0;
|
|
open_file_70.stroka = path_;
|
|
$mov eax,70
|
|
$mov ebx,#open_file_70.func
|
|
$int 0x40
|
|
kolichestvo=EBX;
|
|
//
|
|
if (kolichestvo<>-1) if (redraw==1)
|
|
{
|
|
FOR (i=0;i<but_num;i++) DefineButton(197,i+1*18+39,onLeft(22,197),18,201+i+BT_DEL,0xFFFFFF); //óäàëÿåì ñòàðûå
|
|
but_num=onTop(6,57)/18;
|
|
if (strcmp(".",buf+72)==0) kolichestvo--; //ôèëüòðóåì ýëåìåíò "."
|
|
IF (but_num>100) but_num=1; ELSE//ýòà ñòðàííàÿ ñòðî÷êà äëÿ òîãî åñëè ðàçìåðû îêðà ñëèøêîì ìàëåíüêèå
|
|
IF (kolichestvo<but_num) but_num=kolichestvo;
|
|
FOR (i=0;i<but_num;i++) DefineButton(197,i+1*18+39,onLeft(22,197),18,201+i+BT_HIDE+BT_NOFRAME,0xFFFFFF); //åáîøèì íîâûå
|
|
DrawBar(197,75,onLeft(22,197),onTop(6,75),0xFFFFFF); //áåëàÿ îáëàñòü
|
|
DrawBar(onLeft(163,0),57,1,onTop(7,57),0xE4DFE1); //ïîëîñà ñåðàÿ âåðòèêàëüíàÿ 1
|
|
FoldesGoUp();
|
|
List_ReDraw();
|
|
copystr(path_,#edit_path);
|
|
DrawBar(252,13,onLeft(61,252),15,0xFFFFFF); //áåëàÿ îáëàñòü ïîä KEdit
|
|
KEdit();
|
|
}
|
|
}
|
|
|
|
int k,l;
|
|
void FoldesGoUp(){
|
|
if (strcmp(#path,"/rd/1/")==0) kolichestvo--; else if (strcmp(#path,"/fd/1/")==0) kolichestvo--;
|
|
else if (strlen(#path)>7) if (strcmp(".",buf+72)==-1) kolichestvo--; //>7 ýòî äëÿ /hd1/ è ò.ä.
|
|
k=0; l=0;
|
|
off=buf+72;
|
|
FOR (i=0;i<=kolichestvo;i++)
|
|
{
|
|
EAX = off - 8;
|
|
EAX = off - 40;
|
|
EAX=ESDWORD[EAX];
|
|
$shr eax,4
|
|
$and eax,1
|
|
isdir=EAX;
|
|
IF (isdir==1) {file_mas[k]=i; k++;}
|
|
ELSE {file_mas[kolichestvo-l]=i; l++;}
|
|
off = off + 304;
|
|
}
|
|
}
|
|
|
|
dword offs_put_icon, file_type;
|
|
void Put_icon(dword extension){
|
|
lowcase(extension);
|
|
offs_put_icon = #somefile; //åøè íåèçâåñíûé ôàéë
|
|
file_type = ""; temp_int=1;
|
|
IF (strcmp(extension,".kex")==0) { offs_put_icon = #kex; file_type="Program"; temp_int=0;}
|
|
IF (strcmp(extension,".cmd")==0) { offs_put_icon = #cmd; file_type="CMD skript"; temp_int=0;}
|
|
IF (strcmp(extension,".skn")==0) { offs_put_icon = #skn; file_type="Skin"; temp_int=3;}
|
|
IF (strcmp(extension,".chr")==0) { offs_put_icon = #font; file_type="Font"; temp_int=4;}
|
|
IF (strcmp(extension,".avi")==0) { offs_put_icon = #video; file_type="Video"; temp_int=5;}
|
|
IF (strcmp(extension,".ini")==0) { offs_put_icon = #ini; file_type="Config"; temp_int=1;}
|
|
IF (strcmp(extension,"conf")==0) { offs_put_icon = #ini; file_type="Config"; temp_int=1;}
|
|
IF (strcmp(extension,".htm")==0) { offs_put_icon = #web; file_type="Web-page"; temp_int=1;}
|
|
IF (strcmp(extension,"html")==0) { offs_put_icon = #web; file_type="Web-page"; temp_int=1;}
|
|
IF (strcmp(extension,".asm")==0) { offs_put_icon = #source; file_type="Source"; }
|
|
IF (strcmp(extension,".inc")==0) { offs_put_icon = #inc ; temp_int=8;}
|
|
IF (strcmp(extension,".exe")==0) { offs_put_icon = #exe; file_type="Win32 Exec"; temp_int=0;}
|
|
IF (strcmp(extension,".dll")==0) { offs_put_icon = #lib; file_type="Library"; temp_int=0;}
|
|
IF (strcmp(extension,".obj")==0) { offs_put_icon = #lib; file_type="Library"; temp_int=0;}
|
|
//text
|
|
IF (strcmp(extension,".txt")==0) { offs_put_icon = #text; file_type="Text"; temp_int=1;}
|
|
IF (strcmp(extension,".doc")==0) { offs_put_icon = #text; file_type="Text"; temp_int=1;}
|
|
IF (strcmp(extension,".rtf")==0) { offs_put_icon = #text; file_type="Text"; temp_int=1;}
|
|
//èçîáðàæåíèÿ
|
|
IF (strcmp(extension,".gif")==0) { offs_put_icon = #pic; file_type="Image"; temp_int=1;}
|
|
IF (strcmp(extension,".bmp")==0) { offs_put_icon = #pic; file_type="Image"; temp_int=1;}
|
|
IF (strcmp(extension,".png")==0) { offs_put_icon = #pic; file_type="Image"; temp_int=1;}
|
|
IF (strcmp(extension,".jpg")==0) { offs_put_icon = #pic; file_type="Image"; temp_int=1;}
|
|
IF (strcmp(extension,"jpeg")==0) { offs_put_icon = #pic; file_type="Image"; temp_int=1;}
|
|
IF (strcmp(extension,".raw")==0) { offs_put_icon = #pic; file_type="Image"; temp_int=1;}
|
|
//àðõèâû
|
|
IF (strcmp(extension,".rar")==0) { offs_put_icon = #arhiv; file_type="Archive"; temp_int=6;}
|
|
IF (strcmp(extension,".zip")==0) { offs_put_icon = #arhiv; file_type="Archive"; temp_int=6;}
|
|
IF (strcmp(extension,".cab")==0) { offs_put_icon = #arhiv; file_type="Archive"; temp_int=6;}
|
|
IF (strcmp(extension,".tar")==0) { offs_put_icon = #arhiv; file_type="Archive"; temp_int=6;}
|
|
IF (strcmp(extension,".ajr")==0) { offs_put_icon = #arhiv; file_type="Archive"; temp_int=6;}
|
|
//audio
|
|
IF (strcmp(extension,".mp3")==0) { offs_put_icon = #audio; file_type="Music"; temp_int=7;}
|
|
IF (strcmp(extension,".wav")==0) { offs_put_icon = #audio; file_type="Audio"; temp_int=7;}
|
|
IF (strcmp(extension,".mid")==0) { offs_put_icon = #audio; file_type="Audio"; temp_int=7;}
|
|
IF (strcmp(extension,"midi")==0) { offs_put_icon = #audio; file_type="Audio"; temp_int=7;}
|
|
IF (strcmp(extension,".ogg")==0) { offs_put_icon = #audio; file_type="Audio"; temp_int=7;}
|
|
//ïàïêà
|
|
IF (strcmp(extension,"<dir>")==0) { offs_put_icon = #folder; WriteText(onLeft(140,0),y-22,0x80,0,"<DIR>",0); temp_int=2;}
|
|
PutImage(offs_put_icon,16,15,200,y-26);
|
|
WriteText(onLeft(155,0),y-22,0x80,0,file_type,0);
|
|
}
|
|
|
|
void Dir_Up()
|
|
{
|
|
i=strlen(#path)-1;
|
|
do
|
|
{
|
|
path[i]=0x00;
|
|
i--;
|
|
IF (i==0) break;
|
|
}
|
|
while (path[i]!='/');
|
|
za_kadrom=0; //â ñàìûé ââåðõ ñïèñêà
|
|
curbtn=0;
|
|
Open_Dir(#path,1);
|
|
}
|
|
|
|
dword onLeft(dword right,left) {return Form.width-right-left;}
|
|
dword onTop(dword down,up) {return Form.height-skin_width-down-up;}
|
|
|
|
char extension[5];
|
|
void Run_File(){
|
|
copystr(#file_path,#param); //ïî-óìîë÷àíèþ ïðîãà è ïàðàìåòð ðàâíû, åñëè îêàæåòñÿ ÷òî ýòî ôàéë, ïàðàì - ñáðîñèì
|
|
copystr(#file_path+strlen(#file_path)-4,#extension); //óçíà¸ì ðàñøèðåíèå ôàéëà ñ êàêèì ðàáîòàåì
|
|
lowcase(#extension);
|
|
//òóò ìû ýòî ðàñøèðåíèå ñðàâíèìàåì, è, åñëè îíî àñîöèèðóåòñÿ ñ ïðîãîé, ïðîãà - ýòî file_path
|
|
IF (strcmp(#extension,".skn")==0) copystr("/rd/1/desktop",#file_path);
|
|
IF (strcmp(#extension,".avi")==0) copystr("/rd/1/kvid",#file_path);
|
|
IF (strcmp(#extension,".htm")==0) copystr("/rd/1/network/hTTPC",#file_path);
|
|
IF (strcmp(#extension,"html")==0) copystr("/rd/1/network/hTTPC",#file_path);
|
|
IF (strcmp(#extension,".3ds")==0) copystr("/rd/1/3d/view3ds",#file_path);
|
|
IF (strcmp(#extension,".lif")==0) copystr("/rd/1/demos/life2",#file_path);
|
|
//audio
|
|
IF (strcmp(#extension,".mp3")==0) copystr("/rd/1/AC97SND",#file_path);
|
|
IF (strcmp(#extension,".wav")==0) copystr("/rd/1/AC97SND",#file_path);
|
|
IF (strcmp(#extension,".mid")==0) copystr("/rd/1/MIDAMP",#file_path);
|
|
IF (strcmp(#extension,"midi")==0) copystr("/rd/1/MIDAMP",#file_path);
|
|
//text
|
|
IF (strcmp(#extension,".rtf")==0) copystr("/rd/1/RtfRead",#file_path);
|
|
IF (strcmp(#extension,".txt")==0) copystr("/rd/1/TinyPad",#file_path);
|
|
IF (strcmp(#extension,".inc")==0) copystr("/rd/1/TinyPad",#file_path);
|
|
IF (strcmp(#extension,".ini")==0) copystr("/rd/1/TinyPad",#file_path);
|
|
IF (strcmp(#extension,"conf")==0) copystr("/rd/1/TinyPad",#file_path);
|
|
IF (strcmp(#extension,".dat")==0) copystr("/rd/1/TinyPad",#file_path);
|
|
IF (strcmp(#extension,".asm")==0) copystr("/rd/1/TinyPad",#file_path); //AsmMenu1,AsmMenu2
|
|
//èçîáðàæåíèÿ
|
|
IF (strcmp(#extension,".gif")==0) copystr("/rd/1/GIFVIEW",#file_path); //GifMenu1,MenuAnimage
|
|
IF (strcmp(#extension,".bmp")==0) copystr("/rd/1/MV",#file_path); //BmpMenu1,MenuAnimage
|
|
IF (strcmp(#extension,".png")==0) copystr("/rd/1/@rcher",#file_path);
|
|
IF (strcmp(#extension,".jpg")==0) copystr("/rd/1/JpegView",#file_path);
|
|
IF (strcmp(#extension,"jpeg")==0) copystr("/rd/1/JpegView",#file_path);
|
|
IF (strcmp(#file_path,#param)==0) copystr("",#param); //åñëè file_path íå èçìåíèëñÿ, òî ýòî òàêè, íàâåðíîå, ïðîãà, ïàðàìåòðîâ íåò.
|
|
Run_Program(); //çàïóñê!
|
|
}
|
|
|
|
void Run_Program()
|
|
{
|
|
run_file_70.func = 7;
|
|
run_file_70.flag = 0;
|
|
run_file_70.param= #param;
|
|
run_file_70.rez1 = 0;
|
|
run_file_70.rez2 = 0;
|
|
run_file_70.rezerv2 = 0;
|
|
run_file_70.stroka = #file_path;
|
|
$mov eax,70
|
|
$mov ebx,#run_file_70.func
|
|
$int 0x40
|
|
}
|
|
|
|
void Del_Form()
|
|
{
|
|
if (isdir==0){//ïàïêè ïîêà ÷òî óäàëÿòü íå óìååì
|
|
temp_int=Form.width-200+197/2;
|
|
//òèïà îêíî
|
|
FOR (i=5;i<11;i++) DefineButton(197,i+1*18+39,onLeft(22,197),18,201+i+BT_DEL,0xFFFFFF); //óäàëÿåì êíîïêè ïîä ôîðìîé
|
|
DrawFlatButton(temp_int,160,200,80,0,0xE4DFE1); //ôîðìà
|
|
WriteText(temp_int+19,175,0x80,0,"Do you really want to delete",28);
|
|
WriteTextXY(220<<16+y, 0, off, strlen(off));
|
|
WriteText(temp_int+20,190,0x80,0,#file_name,0); //ïèøåì èìÿ è îíî ìîæåò áûòü î÷åíü äëèííûì
|
|
WriteText(strlen(#file_name)*6+temp_int+20,190,0x80,0,"?",1);
|
|
//êíîïî÷êè
|
|
DrawFlatButton(temp_int+20,208,70,20,301,0xFFB6B5);
|
|
WriteText(temp_int+46,215,0x80,0,"Yes",3);
|
|
DrawFlatButton(temp_int+111,208,70,20,302,0xC6DFC6);
|
|
WriteText(temp_int+141,215,0x80,0,"No",2);
|
|
del_active=1;
|
|
}}
|
|
|
|
void Del_File()
|
|
{
|
|
run_file_70.func = 8;
|
|
run_file_70.flag = 0;
|
|
run_file_70.param= 0;
|
|
run_file_70.rez1 = 0;
|
|
run_file_70.rez2 = 0;
|
|
run_file_70.rezerv2 = 0;
|
|
run_file_70.stroka = #file_path;
|
|
$mov eax,70
|
|
$mov ebx,#run_file_70.func
|
|
$int 0x40
|
|
del_active=0;
|
|
Open_Dir(#path,1);
|
|
}
|
|
|
|
dword size_prefix;
|
|
dword ConvertSize(dword bytes)
|
|
{
|
|
copystr(IntToStr(bytes),#size_prefix);
|
|
copystr(" b ",#size_prefix+strlen(#size_prefix));
|
|
if (bytes>=1024)
|
|
{
|
|
bytes=bytes/1024;
|
|
copystr(IntToStr(bytes),#size_prefix);
|
|
copystr(" Kb",#size_prefix+strlen(#size_prefix));
|
|
}
|
|
if (bytes>=1024)
|
|
{
|
|
bytes=bytes/1024;
|
|
copystr(IntToStr(bytes),#size_prefix);
|
|
copystr(" Mb",#size_prefix+strlen(#size_prefix));
|
|
}
|
|
if (bytes>=1024)
|
|
{
|
|
bytes=bytes/1024;
|
|
copystr(IntToStr(bytes),#size_prefix);
|
|
copystr(" Gb",#size_prefix+strlen(#size_prefix));
|
|
}
|
|
return #size_prefix;
|
|
}
|
|
|
|
void Paste()
|
|
{
|
|
if (strcmp(#copyfile,"")==-1){ //îòìåíà, åøè åù¸ íè÷¸ íå ñêîïèðîâàëè
|
|
copystr(#path,#temp);
|
|
copystr(#copy_name,#temp+strlen(#temp));
|
|
if (strcmp(#copyfile,#temp)==0) //åñëè ìû êîïèðóåì è âñòàâëÿåì â îäíîé è òîé æå ïàïêå
|
|
{
|
|
copystr(#path,#temp);
|
|
copystr("new_",#temp+strlen(#temp));
|
|
copystr(#copy_name,#temp+strlen(#temp));
|
|
}
|
|
CopyFile(#copyfile,#temp);
|
|
//
|
|
if (cut_active==1) //åñëè ìû âûáðàëè âûðåçàòü
|
|
{
|
|
copystr(#copyfile,#file_path);
|
|
Del_File();
|
|
copystr("",#copyfile);
|
|
}
|
|
Open_Dir(#path,1);
|
|
}}
|
|
|
|
void Goto_edit_path()
|
|
{
|
|
if (strcmp(#path,#edit_path)==-1) //ïðîâåðêà íå â ýòîé ëè ìû ïàïêå
|
|
{
|
|
copystr(#edit_path+strlen(#edit_path)-1,#temp); //åñëè ëåíü áûëî ñòàâèòü /
|
|
if (strcmp(#temp,"/")==-1) copystr("/",#edit_path+strlen(#edit_path));
|
|
copystr(#edit_path,#temp);
|
|
Open_Dir(#temp,0);
|
|
if (kolichestvo==-1) KEdit(); else //ïðîñòî î÷èùàåì ïîëîñó àäðåñà
|
|
{
|
|
za_kadrom=0; //íàâåðõ ñïèñêà
|
|
curbtn=0;
|
|
copystr(#temp,#path);
|
|
}
|
|
Open_Dir(#path,1);
|
|
}
|
|
}
|
|
|
|
//
|
|
dword PathHistory[256*8]="/rd/1/";
|
|
dword PathHistory_Len[8]=0;
|
|
int cur_path=0;
|
|
//
|
|
void GoBack(dword back)
|
|
{
|
|
if (back==0) //IF (cur_path<=8)
|
|
{
|
|
cur_path++;
|
|
copystr(#path,256*cur_path+#PathHistory); //ïèøåì
|
|
PathHistory_Len[cur_path]=strlen(#path);
|
|
}
|
|
if (back==1) IF (cur_path>=1)
|
|
{
|
|
cur_path--;
|
|
copystr(256*cur_path+#PathHistory,#edit_path); //÷èòàåì
|
|
}
|
|
DrawBar(252,13,onLeft(61,252),15,0xFFFFFF); //áåëàÿ îáëàñòü ïîä KEdit
|
|
copystr(IntToStr(cur_path),#edit_path); //÷èòàåì
|
|
KEdit();
|
|
//Open_Dir(#path);
|
|
}
|
|
|
|
/*int i,j,k;
|
|
int n=20;
|
|
|
|
void sort_by_name(int z){
|
|
for(i = 0; i <= n-1; i++)
|
|
{
|
|
for(j = 0; j <= n-2-i; j++)
|
|
{
|
|
if( mas[j][z]>mas[j+1][z] )
|
|
{
|
|
if (mas[j][z-1] == mas[j+1][z-1])
|
|
{
|
|
strcpy(back,mas[j]);
|
|
strcpy(mas[j],mas[j+1]);
|
|
strcpy(mas[j+1],back);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}*/
|
|
|
|
/*int q,z;
|
|
int n=20;
|
|
void sort_by_name(int z)
|
|
{
|
|
for(q = 0; q <= n-1; q++) for(i = 0; i <= n-2-i; i++)
|
|
if( mas[i][z]>mas[j+1][z]) if (mas[i][z-1]==mas[i+1][z-1])
|
|
{
|
|
strcpy(back,mas[i]);
|
|
strcpy(mas[i],mas[i+1]);
|
|
strcpy(mas[i+1],back);
|
|
}
|
|
}*/
|
|
|
|
/*âûçûâàòü òàê
|
|
for (k=0;k<255;k++) sort(k);
|
|
*/
|
|
|
|
stop:
|