Eolite: fixed bags.

git-svn-id: svn://kolibrios.org@5591 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pavelyakov 2015-07-21 01:10:37 +00:00
parent 951d3fdb52
commit 1d9f0687b9
8 changed files with 525 additions and 481 deletions

View File

@ -156,6 +156,7 @@ int j, i;
int action_buf; int action_buf;
int rand_n; int rand_n;
int selected_count; int selected_count;
byte CMD_REFRESH;
mouse gestures; mouse gestures;
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
@ -183,6 +184,9 @@ void main()
{ {
word key, id, can_show, can_select, m_selected; word key, id, can_show, can_select, m_selected;
dword selected_offset; dword selected_offset;
dword IPC_LEN,IPC_ID;
char IPC_BUF[10];
dword tmp;
rand_n = random(40); rand_n = random(40);
gestures.get(); gestures.get();
mem_Init(); mem_Init();
@ -194,16 +198,19 @@ void main()
SetAppColors(); SetAppColors();
if (param) if (param)
{ {
strcpy(#path, #param); tmp = strlen(#path);
if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string strncpy(#path, #param, tmp);
$dec tmp
if (path[tmp]!='/') DSBYTE[#path+tmp] = '/'; //add "/" to the end of the string
} }
else else
{ {
strcpy(#path, "/rd/1/"); strncpy(#path, "/rd/1/", 6);
} }
Open_Dir(#path,ONLY_OPEN); Open_Dir(#path,ONLY_OPEN);
SetEventMask(0x27); SetEventMask(0x27);
loop(){ switch(WaitEvent()) loop(){
switch(WaitEvent())
{ {
case evMouse: case evMouse:
if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break; if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break;
@ -300,7 +307,7 @@ void main()
if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<files.y) if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<files.y)
{ {
IF (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,41,14,14,0xC7C7C7,0xFFFFFF); if (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,41,14,14,0xC7C7C7,0xFFFFFF);
WHILE (m.lkm==1) && (files.first>0) WHILE (m.lkm==1) && (files.first>0)
{ {
pause(8); pause(8);
@ -313,7 +320,7 @@ void main()
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.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(Form.cwidth - 17,onTop(21,0),14,14,0xC7C7C7,0xFFFFFF); if (m.lkm==1) DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xC7C7C7,0xFFFFFF);
while (m.lkm==1) && (files.first<files.count-files.visible) while (m.lkm==1) && (files.first<files.count-files.visible)
{ {
pause(8); pause(8);
@ -330,16 +337,16 @@ void main()
if (scroll_used) if (scroll_used)
{ {
IF (sc_slider_h/2+files.y>m.y) || (m.y<0) || (m.y>4000) m.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii if (sc_slider_h/2+files.y>m.y) || (m.y<0) || (m.y>4000) m.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii
id=files.first; id=files.first;
j= sc_slider_h/2; j= sc_slider_h/2;
files.first = m.y -j -files.y * files.count; files.first = m.y -j -files.y * files.count;
files.first /= onTop(22,files.y); files.first /= onTop(22,files.y);
IF (files.visible+files.first>files.count) files.first=files.count-files.visible; 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; break;
//Button pressed----------------------------------------------------------------------------- //Button pressed-----------------------------------------------------------------------------
case evButton: case evButton:
id=GetButtonID(); id=GetButtonID();
if (id==1) if (id==1)
@ -349,12 +356,12 @@ void main()
} }
if (del_active) if (del_active)
{ {
IF (id==301) || (id==302) Del_File(302-id); if (id==301) || (id==302) Del_File(302-id);
break; break;
} }
if (new_element_active) if (new_element_active)
{ {
IF (id==301) || (id==302) NewElement(302-id); if (id==301) || (id==302) NewElement(302-id);
break; break;
} }
@ -384,9 +391,9 @@ void main()
CreateThread(#Paste,copy_stak+4092); CreateThread(#Paste,copy_stak+4092);
break; break;
case 31...33: //sort case 31...33: //sort
IF(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10); if(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10);
IF(sort_num==2) DrawFilledBar(sorting_arrow_x,42,6,10); if(sort_num==2) DrawFilledBar(sorting_arrow_x,42,6,10);
IF(sort_num==3) DrawFilledBar(sorting_arrow_x,42,6,10); if(sort_num==3) DrawFilledBar(sorting_arrow_x,42,6,10);
sort_num=id-30; sort_num=id-30;
Open_Dir(#path,WITH_REDRAW); Open_Dir(#path,WITH_REDRAW);
break; break;
@ -404,25 +411,25 @@ void main()
break; break;
} }
break; break;
//Key pressed----------------------------------------------------------------------------- //Key pressed-----------------------------------------------------------------------------
case evKey: case evKey:
key = GetKey(); key = GetKey();
if (Form.status_window>2) break; if (Form.status_window>2) break;
IF (del_active) if (del_active)
{ {
IF (key==013) Del_File(true); if (key==013) Del_File(true);
IF (key==027) Del_File(false); if (key==027) Del_File(false);
break; break;
} }
IF (new_element_active) if (new_element_active)
{ {
IF (key==027) NewElement(0); if (key==027) NewElement(0);
IF (key==013) NewElement(1); if (key==013) NewElement(1);
EAX=key<<8; EAX=key<<8;
edit_box_key stdcall (#new_file_ed); edit_box_key stdcall (#new_file_ed);
break; break;
} }
IF (edit2.flags!=64) && (key!=13) && (key!=27) if (edit2.flags!=64) && (key!=13) && (key!=27)
{ {
EAX=key<<8; EAX=key<<8;
edit_box_key stdcall (#edit2); edit_box_key stdcall (#edit2);
@ -432,19 +439,19 @@ void main()
{ {
case 209...217: case 209...217:
id=key-110; id=key-110;
IF (id-100>=disc_num) break; if (id-100>=disc_num) break;
GOTO DEVICE_MARK; GOTO DEVICE_MARK;
case ASCII_KEY_BS: case ASCII_KEY_BS:
//GoBack(); //GoBack();
Dir_Up(); Dir_Up();
break; break;
case 004: //Ctrl+D set as bg case 004: //Ctrl+D set as bg
strcpy(#temp, "\\S__"); strncpy(#temp, "\\S__",4);
strcat(#temp, #file_path); strcat(#temp, #file_path);
RunProgram("/sys/media/kiv", #temp); RunProgram("/sys/media/kiv", #temp);
break; break;
case 014: //Ctrl+N new window case 014: //Ctrl+N new window
IF (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD);
RunProgram("/sys/File Managers/Eolite", #path); RunProgram("/sys/File Managers/Eolite", #path);
break; break;
case 024: //Ctrl+X case 024: //Ctrl+X
@ -534,7 +541,7 @@ void main()
for (i=files.current+files.first+1; i<files.count; i++) for (i=files.current+files.first+1; i<files.count; i++)
{ {
strcpy(#temp, file_mas[i]*304+buf+72); strcpy(#temp, file_mas[i]*304+buf+72);
IF (temp[0]==key) || (temp[0]==key-32) if (temp[0]==key) || (temp[0]==key-32)
{ {
List_Current(i-files.current-files.first); List_Current(i-files.current-files.first);
break; break;
@ -543,16 +550,31 @@ void main()
} }
break; break;
case evReDraw: case evReDraw:
DRAW_WINDOW:
draw_window(); draw_window();
if (action_buf) { menu_action(action_buf); action_buf=0;} if (action_buf)
{
menu_action(action_buf);
action_buf=0;
} }
if(cmd_free){ break;
/*default:
if(CMD_REFRESH)
{
CMD_REFRESH = false;
goto DRAW_WINDOW;
}
*/
}
if(cmd_free)
{
if(cmd_free==1) free(menu_stak); if(cmd_free==1) free(menu_stak);
else if(cmd_free==2)free(about_stak); else if(cmd_free==2)free(about_stak);
else if(cmd_free==3)free(properties_stak); else if(cmd_free==3)free(properties_stak);
else if(cmd_free==4)free(settings_stak); else if(cmd_free==4)free(settings_stak);
else if(cmd_free==5)free(copy_stak); else if(cmd_free==5)free(copy_stak);
cmd_free = 0; cmd_free = false;
} }
} }
} }
@ -561,10 +583,10 @@ void main()
inline fastcall signed int _strrchr( ESI,BL) inline fastcall signed int _strrchr( ESI,BL)
{ {
int jj=0, last=strlen(ESI); int jj=0, last=strlen(ESI);
do{ do {
jj++; jj++;
$lodsb $lodsb
IF(AL==BL) last=jj; if(AL==BL) last=jj;
} while(AL!=0); } while(AL!=0);
return last; return last;
} }
@ -583,12 +605,20 @@ void menu_action(dword id)
if (id==203) FnProcess(4); //F4 if (id==203) FnProcess(4); //F4
if (id==104) Copy(#file_path, NOCUT); if (id==104) Copy(#file_path, NOCUT);
if (id==105) Copy(#file_path, CUT); if (id==105) Copy(#file_path, CUT);
if (id==106) { copy_stak = malloc(4096); CreateThread(#Paste,copy_stak+4092);} if (id==106)
{
copy_stak = malloc(4096);
CreateThread(#Paste,copy_stak+4092);
}
if (id==207) FnProcess(2); if (id==207) FnProcess(2);
if (id==108) Del_Form(); if (id==108) Del_Form();
if (id==109) FnProcess(5); if (id==109) FnProcess(5);
if (id==110) FnProcess(8); if (id==110) FnProcess(8);
if (id==300) { FnProcess(5); List_ReDraw(); } if (id==300)
{
FnProcess(5);
List_ReDraw();
}
} }
@ -643,30 +673,8 @@ void List_Current(signed int cur)
{ {
if (cur<=0) //up if (cur<=0) //up
{ {
IF (files.first==0) && (files.current<=0) return; if (files.first==0) && (files.current<=0) return;
IF (-cur-1<files.current) if (-cur-1<files.current)
{
Line_ReDraw(0xFFFFFF, files.current);
files.current+=cur;
Line_ReDraw(col_selec, files.current);
return;
}
ELSE
{
IF (-cur<files.first) files.first+=cur; ELSE files.first=0;
files.current=0;
List_ReDraw();
return;
}
}
else //down
{
IF (files.first==files.count-files.visible) && (files.current==files.visible-1)
{
Line_ReDraw(col_selec, files.current);
return;
}
IF (files.visible-files.current>cur)
{ {
Line_ReDraw(0xFFFFFF, files.current); Line_ReDraw(0xFFFFFF, files.current);
files.current+=cur; files.current+=cur;
@ -675,18 +683,40 @@ void List_Current(signed int cur)
} }
else else
{ {
IF(files.first+files.current+cur>=files.count) if (-cur<files.first) files.first+=cur; else files.first=0;
files.current=0;
List_ReDraw();
return;
}
}
else //down
{
if (files.first==files.count-files.visible) && (files.current==files.visible-1)
{
Line_ReDraw(col_selec, files.current);
return;
}
if (files.visible-files.current>cur)
{
Line_ReDraw(0xFFFFFF, files.current);
files.current+=cur;
Line_ReDraw(col_selec, files.current);
return;
}
else
{
if(files.first+files.current+cur>=files.count)
{ {
files.first=files.count-files.visible; files.first=files.count-files.visible;
files.current=cur-files.first+files.current; files.current=cur-files.first+files.current;
} }
ELSE else
{ {
files.first+=cur+files.current-files.visible+1; files.first+=cur+files.current-files.visible+1;
files.current=files.visible-1; files.current=files.visible-1;
} }
IF (files.current<0) || (files.current>files.visible) if (files.current<0) || (files.current>files.visible)
{ {
files.current=files.visible-1; files.current=files.visible-1;
} }
@ -793,15 +823,15 @@ void Open_Dir(dword dir_path, redraw){
KEdit(); KEdit();
HistoryPath(ADD_NEW_PATH); HistoryPath(ADD_NEW_PATH);
files.visible = files.h / files.line_h; files.visible = files.h / files.line_h;
IF (files.count < files.visible) files.visible = files.count; if (files.count < files.visible) files.visible = files.count;
IF (sort_num==1) sorting_arrow_x = Form.width+60/2; if (sort_num==1) sorting_arrow_x = Form.width+60/2;
IF (sort_num==2) sorting_arrow_x = Form.width-115; if (sort_num==2) sorting_arrow_x = Form.width-115;
IF (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w; if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
WriteText(sorting_arrow_x,45,0x80,sc.work_graph,"\x19"); WriteText(sorting_arrow_x,45,0x80,sc.work_graph,"\x19");
IF (redraw!=ONLY_SHOW) Sorting(); if (redraw!=ONLY_SHOW) Sorting();
IF (redraw!=ONLY_OPEN) List_ReDraw(); 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();}
} }
@ -812,10 +842,10 @@ inline Sorting()
int i; int i;
if (!strcmp(#path,"/")) //do not sort if (!strcmp(#path,"/")) //do not sort
{ {
FOR(k=1;k<files.count;k++;) file_mas[k]=k; for(k=1;k<files.count;k++;) file_mas[k]=k;
return; return;
} }
FOR (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders
{ {
if (!real_files_names_case) strttl(file_off+40); if (!real_files_names_case) strttl(file_off+40);
if (TestBit(ESDWORD[file_off],4)) //directory? if (TestBit(ESDWORD[file_off],4)) //directory?
@ -831,12 +861,12 @@ inline Sorting()
} }
//sorting: files first, then folders //sorting: files first, then folders
Sort_by_Name(0,k-1); Sort_by_Name(0,k-1);
IF (sort_num==1) Sort_by_Name(k,files.count-1); 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==2) Sort_by_Type(k,files.count-1);
IF (sort_num==3) Sort_by_Size(k,files.count-1); if (sort_num==3) Sort_by_Size(k,files.count-1);
//make ".." first item in list //make ".." first item in list
IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")!=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;} for(k--; k>0; k--;) if (!strcmp(file_mas[k]*304+buf+72,"..")) {file_mas[k]><file_mas[0]; break;}
} }
@ -846,7 +876,7 @@ void Del_Form()
int cont = 0; int cont = 0;
byte f_count[128]; byte f_count[128];
int dform_x = files.w - 220 / 2 + files.x; int dform_x = files.w - 220 / 2 + files.x;
if (strcmp(#file_name,".")==0) || (strcmp(#file_name,"..")==0) return; if (!strncmp(#file_name,".",1)) || (!strncmp(#file_name,"..",2)) return;
if (del_active==2) if (del_active==2)
{ {
if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0); if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
@ -868,7 +898,7 @@ void Del_Form()
} }
else else
{ {
IF (strlen(#file_name)<28) if (strlen(#file_name)<28)
{ {
WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?"); WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?");
WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name); WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name);
@ -899,9 +929,10 @@ int Del_File2(dword way)
{ {
if (CheckEvent()==evReDraw) draw_window(); if (CheckEvent()==evReDraw) draw_window();
filename = i*304+dirbuf+72; filename = i*304+dirbuf+72;
strcpy(#del_from, way); /*strcpy(#del_from, way);
chrcat(#del_from, '/'); chrcat(#del_from, '/');
strcat(#del_from, filename); strcat(#del_from, filename);*/
sprintf(#del_from,"%s/%s",way,filename);
if ( TestBit(ESDWORD[filename-40], 4) ) if ( TestBit(ESDWORD[filename-40], 4) )
{ {
Del_File2(#del_from); Del_File2(#del_from);
@ -934,8 +965,9 @@ void Del_File(byte dodel)
{ {
selected_offset2 = file_mas[i]*304 + buf+32 + 7; selected_offset2 = file_mas[i]*304 + buf+32 + 7;
if (ESBYTE[selected_offset2]) { if (ESBYTE[selected_offset2]) {
strcpy(#del_from, #path); /*strcpy(#del_from, #path);
strcat(#del_from, file_mas[i]*304+buf+72); strcat(#del_from, file_mas[i]*304+buf+72);*/
sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
Del_File2(#del_from); Del_File2(#del_from);
} }
} }
@ -983,7 +1015,7 @@ void Open(byte rez)
selected_count = 0; selected_count = 0;
if (rez) if (rez)
{ {
if (!strcmp(#file_name,"..")) return; if (!strncmp(#file_name,"..",2)) return;
strcpy(#temp, #file_path); strcpy(#temp, #file_path);
if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end
RunProgram("/sys/File Managers/Eolite", #temp); RunProgram("/sys/File Managers/Eolite", #temp);
@ -996,7 +1028,7 @@ void Open(byte rez)
} }
else else
{ {
if (!strcmp(#file_name,"..")) { Dir_Up(); return; } if (!strncmp(#file_name,"..",2)) { Dir_Up(); return; }
strcpy(#path, #file_path); strcpy(#path, #file_path);
if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
files.first=files.current=0; files.first=files.current=0;
@ -1015,9 +1047,10 @@ inline fastcall void GoBack()
void ShowOpenWithDialog() void ShowOpenWithDialog()
{ {
byte param[4097]; byte param[4097];
param[0] = '~'; /*param[0] = '~';
param[1] = '\0'; param[1] = '\0';
strcat(#param, #file_path); strcat(#param, #file_path);*/
sprintf(#param,"~%s",#file_path);
RunProgram("/sys/@open", #param); RunProgram("/sys/@open", #param);
} }
@ -1027,8 +1060,9 @@ void NewElement(byte newf)
byte del_rezult, copy_rezult, info_result; byte del_rezult, copy_rezult, info_result;
if (newf) if (newf)
{ {
strcpy(#temp, #path); /*strcpy(#temp, #path);
strcat(#temp, new_file_ed.text); strcat(#temp, new_file_ed.text);*/
sprintf(#temp,"%s%s",#path,new_file_ed.text);
info_result = GetFileInfo(#temp, #element_info); info_result = GetFileInfo(#temp, #element_info);
switch(new_element_active) switch(new_element_active)
{ {
@ -1117,8 +1151,8 @@ void NewElement_Form(byte crt, dword strng)
edit_box_draw stdcall (#new_file_ed); edit_box_draw stdcall (#new_file_ed);
DrawRectangle(new_file_ed.left-1, new_file_ed.top-1, new_file_ed.width+2, 16, 0xFFFfff); DrawRectangle(new_file_ed.left-1, new_file_ed.top-1, new_file_ed.width+2, 16, 0xFFFfff);
DrawRectangle(new_file_ed.left-2, new_file_ed.top-2, new_file_ed.width+4, 18, sc.work_graph); DrawRectangle(new_file_ed.left-2, new_file_ed.top-2, new_file_ed.width+4, 18, sc.work_graph);
IF (new_element_active==3) DrawFlatButton(dform_x+22,208,85,22,301,0xFFB6B5,T_RENAME); if (new_element_active==3) DrawFlatButton(dform_x+22,208,85,22,301,0xFFB6B5,T_RENAME);
ELSE DrawFlatButton(dform_x+27,208,70,22,301,0xFFB6B5,T_CREATE); else DrawFlatButton(dform_x+27,208,70,22,301,0xFFB6B5,T_CREATE);
DrawFlatButton(dform_x+120,208,70,22,302,0xC6DFC6,T_CANCEL); DrawFlatButton(dform_x+120,208,70,22,302,0xC6DFC6,T_CANCEL);
} }
@ -1144,10 +1178,10 @@ void FnProcess(byte N)
NewElement_Form(RENAME_ITEM, #file_name); NewElement_Form(RENAME_ITEM, #file_name);
break; break;
case 3: case 3:
IF (!itdir) RunProgram("/sys/tinypad", #file_path); if (!itdir) RunProgram("/sys/tinypad", #file_path);
break; break;
case 4: case 4:
IF (!itdir) RunProgram("/sys/develop/heed", #file_path); if (!itdir) RunProgram("/sys/develop/heed", #file_path);
break; break;
case 5: //refresh cur dir & devs case 5: //refresh cur dir & devs
Tip(56, T_DEVICES, 55, "-"); Tip(56, T_DEVICES, 55, "-");

View File

@ -75,7 +75,7 @@ void FileMenu()
mm.get(); mm.get();
if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();} if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();}
else if (mm.move)&&(menu.ProcessMouse(mm.x, mm.y)) MenuListRedraw(); else if (mm.move)&&(menu.ProcessMouse(mm.x, mm.y)) MenuListRedraw();
else if (mm.key&MOUSE_LEFT)&&(mm.down) {action_buf = cur_action_buf; pause(5); cmd_free=1; ExitProcess(); } else if (mm.key&MOUSE_LEFT)&&(mm.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
break; break;
case evKey: case evKey:

View File

@ -14,6 +14,7 @@
?define PR_T_HIDDEN "‘ªàëâë©" ?define PR_T_HIDDEN "‘ªàëâë©"
?define PR_T_SYSTEM "‘¨á⥬­ë©" ?define PR_T_SYSTEM "‘¨á⥬­ë©"
?define PR_T_ONLY_READ "’®«ìª® ç⥭¨¥" ?define PR_T_ONLY_READ "’®«ìª® ç⥭¨¥"
?define SET_BYTE_LANG "¡ ©â"
#else #else
?define WINDOW_TITLE_PROPERTIES "Properties" ?define WINDOW_TITLE_PROPERTIES "Properties"
?define BTN_CLOSE "Close" ?define BTN_CLOSE "Close"
@ -30,6 +31,7 @@
?define PR_T_HIDDEN "Hidden" ?define PR_T_HIDDEN "Hidden"
?define PR_T_SYSTEM "System" ?define PR_T_SYSTEM "System"
?define PR_T_ONLY_READ "Read-only" ?define PR_T_ONLY_READ "Read-only"
?define SET_BYTE_LANG "byte"
#endif #endif
dword mouse_ddd2; dword mouse_ddd2;
@ -49,9 +51,9 @@ void SetProperties(byte id)
if (selected_count) return; if (selected_count) return;
else else
{ {
if (id==20) file_info_general.readonly ^= 1; if (id==20) file_info_general.readonly ^= true;
if (id==21) file_info_general.hidden ^= 1; if (id==21) file_info_general.hidden ^= true;
if (id==22) file_info_general.system ^= 1; if (id==22) file_info_general.system ^= true;
SetFileInfo(#file_path, #file_info_general); SetFileInfo(#file_path, #file_info_general);
} }
} }
@ -59,26 +61,30 @@ void SetProperties(byte id)
void GetSizeDir(dword way) void GetSizeDir(dword way)
{ {
dword dirbuf, fcount, i, filename; dword dirbuf, fcount, i, filename;
char cur_file[4096]; dword cur_file;
if (isdir(way)) if (isdir(way))
{ {
cur_file = malloc(4096);
// In the process of recursive descent, memory must be allocated dynamically, because the static memory -> was a bug !!! But unfortunately pass away to sacrifice speed.
GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL); GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL);
for (i=0; i<fcount; i++) for (i=0; i<fcount; i++)
{ {
filename = i*304+dirbuf+72; filename = i*304+dirbuf+72;
sprintf(#cur_file,"%s/%s",way,filename); sprintf(cur_file,"%s/%s",way,filename);
if ( TestBit(ESDWORD[filename-40], 4) )
if (TestBit(ESDWORD[filename-40], 4) )
{ {
dir_count++; dir_count++;
GetSizeDir(#cur_file); GetSizeDir(cur_file);
} }
else else
{ {
GetFileInfo(#cur_file, #file_info_dirsize); GetFileInfo(cur_file, #file_info_dirsize);
size_dir = size_dir + file_info_dirsize.sizelo; size_dir += file_info_dirsize.sizelo;
file_count++; file_count++;
} }
} }
free(cur_file);
} }
} }
@ -96,7 +102,7 @@ void GetSizeMoreFiles(dword way)
{ {
selected_offset2 = file_mas[i]*304 + buf+32 + 7; selected_offset2 = file_mas[i]*304 + buf+32 + 7;
if (ESBYTE[selected_offset2]) { if (ESBYTE[selected_offset2]) {
sprintf(#cur_file,way,file_mas[i]*304+buf+72); sprintf(#cur_file,"%s/%s",way,file_mas[i]*304+buf+72);
GetFileInfo(#cur_file, #file_info_general); GetFileInfo(#cur_file, #file_info_general);
if ( file_info_general.isfolder ) if ( file_info_general.isfolder )
@ -139,7 +145,7 @@ void properties_dialog()
GetFileInfo(#file_path, #file_info_general); GetFileInfo(#file_path, #file_info_general);
strcpy(#file_name2, #file_name); strcpy(#file_name2, #file_name);
file_name_ed.size = strlen(#file_name2); file_name_ed.size = strlen(#file_name2);
if (itdir) GetSizeDir(#file_path); if(itdir) GetSizeDir(#file_path);
} }
strcpy(#path_to_file, #path); strcpy(#path_to_file, #path);
path_to_file_ed.size = strlen(#path_to_file); path_to_file_ed.size = strlen(#path_to_file);
@ -149,7 +155,11 @@ void properties_dialog()
{ {
case evButton: case evButton:
id=GetButtonID(); id=GetButtonID();
IF (id==1) || (id==10){cmd_free=3;ExitProcess();} if (id==1) || (id==10)
{
cmd_free=3;
ExitProcess();
}
if (id==20) SetProperties(id); if (id==20) SetProperties(id);
if (id==21) SetProperties(id); if (id==21) SetProperties(id);
if (id==22) SetProperties(id); if (id==22) SetProperties(id);
@ -163,7 +173,11 @@ void properties_dialog()
case evKey: case evKey:
key = GetKey(); key = GetKey();
IF (key==27){cmd_free=3;ExitProcess();} if (key==27)
{
cmd_free=3;
ExitProcess();
}
EAX=key<<8; EAX=key<<8;
edit_box_key stdcall(#file_name_ed); edit_box_key stdcall(#file_name_ed);
edit_box_key stdcall(#path_to_file_ed); edit_box_key stdcall(#path_to_file_ed);
@ -185,13 +199,7 @@ void properties_dialog()
Put_icon('', 18, 19, 0xFFFfff, 0); Put_icon('', 18, 19, 0xFFFfff, 0);
sprintf(#folder_info,"%s%d%s%d",SET_6,file_count,SET_7,dir_count); sprintf(#folder_info,"%s%d%s%d",SET_6,file_count,SET_7,dir_count);
WriteText(50, 23, 0x80, 0x000000, #folder_info); WriteText(50, 23, 0x80, 0x000000, #folder_info);
EAX = ConvertSize(size_dir); sprintf(#element_size_label,"%s (%d %s)",ConvertSize(size_dir),size_dir,SET_BYTE_LANG);
strcpy(#element_size_label, EAX);
strcat(#element_size_label, " (");
strcat(#element_size_label, itoa(size_dir));
strcat(#element_size_label, " b)");
//tmp = ConvertSize(size_dir);
//sprintf(#element_size_label," ( byte)");
WriteText(100, 65, 0x80, 0x000000, #element_size_label); WriteText(100, 65, 0x80, 0x000000, #element_size_label);
} }
else else
@ -204,10 +212,7 @@ void properties_dialog()
WriteText(50, 13, 0x80, 0x000000, PR_T_NAME); WriteText(50, 13, 0x80, 0x000000, PR_T_NAME);
edit_box_draw stdcall (#file_name_ed); edit_box_draw stdcall (#file_name_ed);
if (!itdir) if (!itdir) element_size = file_info_general.sizelo;
{
element_size = file_info_general.sizelo;
}
else else
{ {
WriteText(10, 80, 0x80, 0x000000, PR_T_CONTAINS); WriteText(10, 80, 0x80, 0x000000, PR_T_CONTAINS);
@ -215,7 +220,6 @@ void properties_dialog()
WriteText(100, 80, 0x80, 0x000000, #folder_info); WriteText(100, 80, 0x80, 0x000000, #folder_info);
element_size = size_dir; element_size = size_dir;
} }
WriteText(10, 95, 0x80, 0x000000, SET_3); WriteText(10, 95, 0x80, 0x000000, SET_3);
WriteText(10, 110, 0x80, 0x000000, SET_4); WriteText(10, 110, 0x80, 0x000000, SET_4);
WriteText(10, 125, 0x80, 0x000000, SET_5); WriteText(10, 125, 0x80, 0x000000, SET_5);
@ -223,14 +227,7 @@ void properties_dialog()
DrawDate(100, 110, 0, #file_info_general.datelastaccess); DrawDate(100, 110, 0, #file_info_general.datelastaccess);
DrawDate(100, 125, 0, #file_info_general.datelastedit); DrawDate(100, 125, 0, #file_info_general.datelastedit);
EAX = ConvertSize(element_size); sprintf(#element_size_label,"%s (%d %s)",ConvertSize(element_size),element_size,SET_BYTE_LANG);
strcpy(#element_size_label, EAX);
strcat(#element_size_label, " (");
strcat(#element_size_label, itoa(element_size));
strcat(#element_size_label, " b)");
//sprintf(#element_size_label,"%s (%d byte)","",element_size);
//tmp = ConvertSize(element_size);
//sprintf(#element_size_label,"%s (%d byte)",tmp,element_size);
WriteText(100, 65, 0x80, 0x000000, #element_size_label); WriteText(100, 65, 0x80, 0x000000, #element_size_label);
flags_frame.size_x = - flags_frame.start_x * 2 + settings_form.cwidth - 2; flags_frame.size_x = - flags_frame.start_x * 2 + settings_form.cwidth - 2;

View File

@ -57,14 +57,9 @@ void settings_dialog()
save_files_h = files.line_h; save_files_h = files.line_h;
save_DBLTime = MOUSE_TIME; save_DBLTime = MOUSE_TIME;
//SetEventMask(0x27);
loop(){ loop(){
switch(WaitEvent()) switch(WaitEvent())
{ {
/*case evMouse:
break;*/
case evButton: case evButton:
id=GetButtonID(); id=GetButtonID();
if (id==10) if (id==10)
@ -75,25 +70,27 @@ void settings_dialog()
cmd_free = 4; cmd_free = 4;
ExitProcess(); ExitProcess();
} }
if (id==1) || (id==11) else if (id==1) || (id==11)
{ {
active_settings=0; active_settings=0;
goto EXIT_SETTING; goto EXIT_SETTING;
} }
if (id==5) else if (id==5)
{ {
RunProgram("tinypad", "/sys/settings/assoc.ini"); RunProgram("tinypad", "/sys/settings/assoc.ini");
break; break;
} }
if (id==20) show_dev_name ^= 1; else if (id==20) show_dev_name ^= 1;
if (id==21) real_files_names_case ^= 1; else if (id==21) real_files_names_case ^= 1;
if (id==22) info_after_copy ^= 1; else if (id==22) info_after_copy ^= 1;
if (id==23) use_big_fonts ^= 1; else if (id==23) use_big_fonts ^= 1;
if (id==25) files.line_h++; else if (id==25) files.line_h++;
if (id==26) && (files.line_h>8) files.line_h--; else if (id==26) && (files.line_h>14) files.line_h--;
if (id==27) MOUSE_TIME++; else if (id==27) MOUSE_TIME++;
if (id==28) && (MOUSE_TIME>30) MOUSE_TIME--; else if (id==28) && (MOUSE_TIME>29) MOUSE_TIME--;
RefreshWindow(Form.ID,settings_form.ID); //CMD_REFRESH = true;
MoveSize(-1,-1,-1,settings_form.height+1);
MoveSize(-1,-1,-1,settings_form.height);
DrawSettingsCheckBoxes(); DrawSettingsCheckBoxes();
break; break;

View File

@ -33,8 +33,8 @@
:void DrawDate(dword x, y, color, in_date) :void DrawDate(dword x, y, color, in_date)
{ {
char text[15]; //char text[15];
/*EDI = in_date; EDI = in_date;
EAX = 47; EAX = 47;
EBX = 2<<16; EBX = 2<<16;
EDX = x<<16+y; EDX = x<<16+y;
@ -47,10 +47,11 @@
EDX += 18<<16; EDX += 18<<16;
EBX = 4<<16; EBX = 4<<16;
ECX = EDI.date.year; ECX = EDI.date.year;
$int 0x40;*/ $int 0x40;
PutPixel(x+14,y+6,color);
//sprintf(#text,"%s","ddf"); PutPixel(x+32,y+6,color);
WriteText(x, y, 0x80, color, "adas\0"); //sprintf(#text,"%d",EDI.date.year);
//WriteText(x, y, 0x80, 0x000000, #text);
} }
@ -301,18 +302,17 @@ enum
return #absolute_path; return #absolute_path;
} }
:byte ConvertSize_size_prefix[8];
:dword ConvertSize(dword bytes) :dword ConvertSize(dword bytes)
{ {
byte size_prefix[8], size_nm[4]; byte size_nm[4];
if (bytes>=1073741824) strcpy(#size_nm, "Gb"); if (bytes>=1073741824) strncpy(#size_nm, "Gb",2);
else if (bytes>=1048576) strcpy(#size_nm, "Mb"); else if (bytes>=1048576) strncpy(#size_nm, "Mb",2);
else if (bytes>=1024) strcpy(#size_nm, "Kb"); else if (bytes>=1024) strncpy(#size_nm, "Kb",2);
else strcpy(#size_nm, "b"); else strncpy(#size_nm, "b ",2);
while (bytes>1023) bytes/=1024; while (bytes>1023) bytes/=1024;
itoa_(#size_prefix, bytes); sprintf(#ConvertSize_size_prefix,"%d %s",bytes,#size_nm);
strcat(#size_prefix, #size_nm); return #ConvertSize_size_prefix;
//sprintf(#size_prefix,"%s","123");
return #size_prefix;
} }
:dword ConvertSizeToKb(unsigned int bytes) :dword ConvertSizeToKb(unsigned int bytes)

View File

@ -302,6 +302,8 @@ inline fastcall dword WaitEvent()
$mov eax,10 $mov eax,10
$int 0x40 $int 0x40
wait_event_code = EAX; wait_event_code = EAX;
//if(wait_event_code==evMouse) MOUSE.get();
//return wait_event_code;
} }
inline fastcall dword CheckEvent() inline fastcall dword CheckEvent()
@ -786,6 +788,20 @@ inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
$int 0x40 $int 0x40
} }
inline getIPC(ECX,EDX)
{
$mov EAX,60
$mov EBX,2
$int 0x40
}
inline sendIPC(ECX,EDX,ESI)
{
$mov EAX,60
$mov EBX,1
$int 0x40
}
void UnsafeDefineButton(dword x,y,w,h,EDX,ESI) void UnsafeDefineButton(dword x,y,w,h,EDX,ESI)
{ {
EAX = 8; EAX = 8;
@ -818,6 +834,7 @@ inline fastcall dword GetStartTime()
DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Alert"); DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Alert");
WriteTextB(5,5,0x90,0x0,ALERT_TEXT); WriteTextB(5,5,0x90,0x0,ALERT_TEXT);
break; break;
case evKey:
case evButton: case evButton:
id=GetButtonID(); id=GetButtonID();
if (id==1) ExitProcess(); if (id==1) ExitProcess();

View File

@ -618,16 +618,15 @@ F3:
return #buffer; return #buffer;
} }
*/ */
:unsigned char BUF_ITOA[11];
inline dword itoa(signed long number) inline dword itoa(signed long number)
{ {
unsigned char buf[11];
dword ret,p; dword ret,p;
byte cmd; byte cmd;
long mask,tmp; long mask,tmp;
mask = 1000000000; mask = 1000000000;
cmd = true; cmd = true;
p = #buf; p = #BUF_ITOA;
if(!number){ if(!number){
ESBYTE[p] = '0'; ESBYTE[p] = '0';
ESBYTE[p+1] = 0; ESBYTE[p+1] = 0;

View File

@ -55,7 +55,7 @@ include '../../../develop/libraries/box_lib/load_lib.mac'
START: START:
mcall 68,11 mcall 68,11
mcall 40,0x27 mcall 40,0x80000027
load_libraries l_libs_start,load_lib_end load_libraries l_libs_start,load_lib_end
cmp eax,-1 cmp eax,-1