Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5590 → Rev 5591

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