Eolite: Update when you change file attributes

git-svn-id: svn://kolibrios.org@5606 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pavelyakov 2015-07-23 11:54:26 +00:00
parent 272fd42b90
commit 8f2060bd2b
7 changed files with 90 additions and 60 deletions

View File

@ -122,7 +122,7 @@ byte active_about=0;
word about_window;
byte active_settings=0;
word settings_window;
dword _not_draw = false;
byte menu_call_mouse=0;
llist files;
@ -208,7 +208,7 @@ void main()
strncpy(#path, "/rd/1/", 6);
}
Open_Dir(#path,ONLY_OPEN);
SetEventMask(0x27);
SetEventMask(1100111b);
loop(){
switch(WaitEvent())
{
@ -558,13 +558,9 @@ void main()
action_buf=0;
}
break;
/*default:
if(CMD_REFRESH)
{
CMD_REFRESH = false;
goto DRAW_WINDOW;
}
*/
case evIPC:
goto DRAW_WINDOW;
break;
}
if(cmd_free)
@ -769,7 +765,7 @@ void Line_ReDraw(dword color, filenum){
}
else
{
if (strcmp("..",file_name_off)==0) ext1=".."; else ext1="<DIR>";
if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1="<DIR>";
Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0);
}
@ -778,8 +774,7 @@ void Line_ReDraw(dword color, filenum){
{
itdir = TestBit(attr, 4);
strcpy(#file_name, file_name_off);
strcpy(#file_path, #path);
strcat(#file_path, #file_name);
sprintf(#file_path,"%s%s",#path,file_name_off);
if (text_col==0xA6A6B7) text_col=0xFFFFFF;
}
if (file.selected) text_col=0xFF0000;
@ -820,7 +815,7 @@ void Open_Dir(dword dir_path, redraw){
}
if (files.count!=-1)
{
KEdit();
if(!_not_draw)KEdit();
HistoryPath(ADD_NEW_PATH);
files.visible = files.h / files.line_h;
if (files.count < files.visible) files.visible = files.count;
@ -829,9 +824,9 @@ void Open_Dir(dword dir_path, redraw){
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_OPEN)&&(!_not_draw) 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; if(!_not_draw)List_ReDraw();}
}
@ -840,7 +835,7 @@ inline Sorting()
dword k=0, l=1;
dword file_off;
int i;
if (!strcmp(#path,"/")) //do not sort
if (!strncmp(#path,"/",2)) //do not sort
{
for(k=1;k<files.count;k++;) file_mas[k]=k;
return;
@ -865,8 +860,8 @@ inline Sorting()
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) && (!strncmp(file_mas[0]*304+buf+72,"..",3))
for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",3)) {file_mas[k]><file_mas[0]; break;}
}
@ -876,7 +871,7 @@ void Del_Form()
int cont = 0;
byte f_count[128];
int dform_x = files.w - 220 / 2 + files.x;
if (!strncmp(#file_name,".",1)) || (!strncmp(#file_name,"..",2)) return;
if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return;
if (del_active==2)
{
if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
@ -929,9 +924,6 @@ int Del_File2(dword way)
{
if (CheckEvent()==evReDraw) draw_window();
filename = i*304+dirbuf+72;
/*strcpy(#del_from, way);
chrcat(#del_from, '/');
strcat(#del_from, filename);*/
sprintf(#del_from,"%s/%s",way,filename);
if ( TestBit(ESDWORD[filename-40], 4) )
{
@ -965,8 +957,6 @@ void Del_File(byte dodel)
{
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);*/
sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
Del_File2(#del_from);
}
@ -1015,7 +1005,7 @@ void Open(byte rez)
selected_count = 0;
if (rez)
{
if (!strncmp(#file_name,"..",2)) return;
if (!strncmp(#file_name,"..",3)) return;
strcpy(#temp, #file_path);
if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end
RunProgram("/sys/File Managers/Eolite", #temp);
@ -1028,7 +1018,7 @@ void Open(byte rez)
}
else
{
if (!strncmp(#file_name,"..",2)) { Dir_Up(); return; }
if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
strcpy(#path, #file_path);
if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
files.first=files.current=0;
@ -1047,9 +1037,6 @@ inline fastcall void GoBack()
void ShowOpenWithDialog()
{
byte param[4097];
/*param[0] = '~';
param[1] = '\0';
strcat(#param, #file_path);*/
sprintf(#param,"~%s",#file_path);
RunProgram("/sys/@open", #param);
}
@ -1060,8 +1047,6 @@ void NewElement(byte newf)
byte del_rezult, copy_rezult, info_result;
if (newf)
{
/*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)

View File

@ -161,8 +161,16 @@ void properties_dialog()
ExitProcess();
}
if (id==20) SetProperties(id);
if (id==21) SetProperties(id);
if (id==21)
{
SetProperties(id);
_not_draw = true;
Open_Dir(#path,WITH_REDRAW);
_not_draw = false;
EventRedrawWindow(Form.left,Form.top);
}
if (id==22) SetProperties(id);
DrawPropertiesCheckBoxes();
break;
@ -235,7 +243,6 @@ void properties_dialog()
flags_frame.font_backgr_color = sc.work;
flags_frame.ext_col = sc.work_graph;
frame_draw stdcall (#flags_frame);
DrawPropertiesCheckBoxes();
}
}

View File

@ -39,23 +39,26 @@ void settings_dialog()
if (active_settings){
EXIT_SETTING:
show_dev_name = save_show_dev_name;
show_dev_name = save_show_dev_name;
real_files_names_case = save_real_files_names_case;
info_after_copy = save_info_after_copy;
use_big_fonts = save_use_big_fonts;
files.line_h = save_files_h;
MOUSE_TIME = save_DBLTime;
info_after_copy = save_info_after_copy;
use_big_fonts = save_use_big_fonts;
files.line_h = save_files_h;
MOUSE_TIME = save_DBLTime;
cmd_free = 4;
ExitProcess();
}
active_settings=1;
save_show_dev_name = show_dev_name;
save_show_dev_name = show_dev_name;
save_real_files_names_case = real_files_names_case;
save_info_after_copy = info_after_copy;
save_use_big_fonts = use_big_fonts;
save_files_h = files.line_h;
save_DBLTime = MOUSE_TIME;
save_info_after_copy = info_after_copy;
save_use_big_fonts = use_big_fonts;
save_files_h = files.line_h;
save_DBLTime = MOUSE_TIME;
loop(){
switch(WaitEvent())
@ -64,7 +67,7 @@ void settings_dialog()
id=GetButtonID();
if (id==10)
{
SaveIniSettings();
//SaveIniSettings();
active_settings=0;
action_buf = 300;
cmd_free = 4;
@ -88,9 +91,7 @@ void settings_dialog()
else if (id==26) && (files.line_h>14) files.line_h--;
else if (id==27) MOUSE_TIME++;
else if (id==28) && (MOUSE_TIME>29) MOUSE_TIME--;
//CMD_REFRESH = true;
MoveSize(-1,-1,-1,settings_form.height+1);
MoveSize(-1,-1,-1,settings_form.height);
EventRedrawWindow(Form.left,Form.top);
DrawSettingsCheckBoxes();
break;

View File

@ -3,9 +3,9 @@
void Sort_by_Size(int a, b) // äë˙ ďĺđâîăî âűçîâŕ: a = 0, b = <ýëĺěĺíňîâ â ěŕńńčâĺ> - 1
{
int iss = a;
IF (a >= b) return;
FOR (j = a; j <= b; j++)
IF (ESDWORD[file_mas[j]*304 + buf+64] <= ESDWORD[file_mas[b]*304 + buf+64]) { file_mas[iss] >< file_mas[j]; iss++;}
if (a >= b) return;
for (j = a; j <= b; j++)
if (ESDWORD[file_mas[j]*304 + buf+64] <= ESDWORD[file_mas[b]*304 + buf+64]) { file_mas[iss] >< file_mas[j]; iss++;}
Sort_by_Size (a, iss-2);
Sort_by_Size (iss, b);
}
@ -14,9 +14,9 @@ void Sort_by_Size(int a, b) //
void Sort_by_Name(int a, b) // äë˙ ďĺđâîăî âűçîâŕ: a = 0, b = <ýëĺěĺíňîâ â ěŕńńčâĺ> - 1
{
int isn = a;
IF (a >= b) return;
FOR (j = a; j <= b; j++)
IF (strcmp(file_mas[j]*304 + buf+72, file_mas[b]*304 + buf+72)<=0) { file_mas[isn] >< file_mas[j]; isn++;}
if (a >= b) return;
for (j = a; j <= b; j++)
if (strcmp(file_mas[j]*304 + buf+72, file_mas[b]*304 + buf+72)<=0) { file_mas[isn] >< file_mas[j]; isn++;}
Sort_by_Name(a, isn-2);
Sort_by_Name(isn, b);
}
@ -26,7 +26,7 @@ void Sort_by_Type(int a, b) //
{
dword filename1, filename2, ext1, ext2;
int n, isn = a;
IF (a >= b) return;
if (a >= b) return;
for (j = a; j <= b; j++)
{
filename1 = file_mas[j]*304 + buf+72;
@ -34,14 +34,14 @@ void Sort_by_Type(int a, b) //
n=strlen(filename1)-1;
WHILE (n>0) && (ESBYTE[filename1+n]<>'.') n--;
IF (n) ext1 = filename1+n+1; else ext1=0;
if (n) ext1 = filename1+n+1; else ext1=0;
n=strlen(filename2)-1;
WHILE (n>0) && (ESBYTE[filename2+n]<>'.') n--;
IF (n) ext2 = filename2+n+1; else ext2=0;
if (n) ext2 = filename2+n+1; else ext2=0;
n=strcmp(ext1, ext2);
IF (n<0) { file_mas[isn] >< file_mas[j]; isn++;}
IF (n==0) && (strcmp(filename1, filename2)<=0) { file_mas[isn] >< file_mas[j]; isn++;}
if (n<0) { file_mas[isn] >< file_mas[j]; isn++;}
if (n==0) && (strcmp(filename1, filename2)<=0) { file_mas[isn] >< file_mas[j]; isn++;}
}
Sort_by_Type(a, isn-2);
Sort_by_Type(isn, b);

View File

@ -251,6 +251,8 @@ char program_path[4096];
vert = EBX;
}
:void mouse::slider()
{
signed _x,_y;
@ -824,6 +826,27 @@ inline fastcall dword GetStartTime()
$int 0x40
}
:dword X_EventRedrawWindow,Y_EventRedrawWindow;
:void _EventRedrawWindow()
{
loop()switch(WaitEvent())
{
case evReDraw:
DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,1,0x34,0xFFFFFF,"");
pause(10);
ExitProcess();
break;
}
}
:void EventRedrawWindow(dword x,y)
{
dword mem = malloc(4096);
X_EventRedrawWindow = x;
Y_EventRedrawWindow = y;
CreateThread(#_EventRedrawWindow,mem+4092);
}
:dword ALERT_TEXT;
:void dialog_alert()
{
@ -841,7 +864,6 @@ inline fastcall dword GetStartTime()
break;
}
}
:dword alert(dword text)
{
dword mem = malloc(4096);

View File

@ -1,6 +1,10 @@
#ifndef INCLUDE_MEM_H
#define INCLUDE_MEM_H
#ifndef INCLUDE_KOLIBRI_H
#include "../lib/kolibri.h"
#endif
dword mem_init()
{
$push ebx

View File

@ -116,7 +116,18 @@ L1:
}
}
/*
inline signed int strncmp(dword text1,text2,len)
{
loop()
{
if(DSBYTE[text1]!=DSBYTE[text2])return text1-text2;
$dec len
if(!len)return 0;
}
}
*/
inline fastcall unsigned int strlen( EDI)
{
$xor eax, eax