cmm: proper testbit

git-svn-id: svn://kolibrios.org@8944 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-06-25 13:21:42 +00:00
parent f39a809e66
commit ee9c0f97fc
8 changed files with 17 additions and 24 deletions

View File

@ -831,7 +831,7 @@ void Line_ReDraw(dword bgcol, filenum){
file.sizehi = ESDWORD[file_offet+36];
file_name_off = file_offet+40;
if (! TestBit(attr, 4) ) //file or folder?
if (! attr & ATR_FOLDER) //file or folder?
{
ext1 = strrchr(file_name_off,'.') + file_name_off;
if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing
@ -849,11 +849,11 @@ void Line_ReDraw(dword bgcol, filenum){
if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58,
files.text_y+y+1, files.font_type, col.list_gb_text, file_size);
if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=col.list_text_hidden; //system or hiden?
if (attr&2) || (attr&4) text_col=col.list_text_hidden; //system or hiden?
if (bgcol==col.selec)
{
file_name_is_8_3(file_name_off);
itdir = TestBit(attr, 4);
itdir = attr & ATR_FOLDER;
strcpy(#file_name, file_name_off);
if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off);
else sprintf(#file_path,"%s/%s",#path,file_name_off);
@ -948,13 +948,10 @@ inline Sorting()
for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;) //files | folders
{
if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40);
if (TestBit(ESDWORD[file_off],4)) //directory?
{
if (ESDWORD[file_off] & ATR_FOLDER) {
items.set(d, j);
d++;
}
else
{
} else {
items.set(files.count-f, j);
f++;
}
@ -1042,7 +1039,7 @@ void EventOpenSelected()
int i;
for (i=0; i<files.count; i++) if (getElementSelectedFlag(i)) {
EDX = items.get(i)*304 + buf+32;
if (TestBit(ESDWORD[EDX], 4)) continue; //is foder
if (ESDWORD[EDX]&ATR_FOLDER) continue; //is foder
sprintf(#param,"%s/%s",#path, EDX+40);
RunProgram("/sys/@open", #param);
}

View File

@ -197,12 +197,9 @@ int RecursiveDelete(dword way, bool show_progress)
//if (CheckEvent()==evReDraw) draw_window();
filename = i*304+dirbuf+72;
sprintf(#del_from,"%s/%s",way,filename);
if ( TestBit(ESDWORD[filename-40], 4) )
{
if ( ESDWORD[filename-40] & ATR_FOLDER ) {
RecursiveDelete(#del_from, true);
}
else
{
} else {
if (show_progress) Operation_Draw_Progress(filename);
if (error = DeleteFile(#del_from)) del_error = error;
}

View File

@ -82,7 +82,7 @@ void SetPropertiesDir(dword way)
strcpy(cur_file, way);
chrcat(cur_file, '/');
strcat(cur_file, filename);
if ( TestBit(ESDWORD[filename-40], 4) )
if ( ESDWORD[filename-40] & ATR_FOLDER )
{
SetPropertiesDir(cur_file);
}
@ -158,7 +158,7 @@ void GetSizeMoreFiles(dword way)
if (getElementSelectedFlag(i) == true)
{
sprintf(#cur_file,"%s/%s",way,items.get(i)*304+buf+72);
if (TestBit(ESDWORD[items.get(i)*304+buf+32], 4) )
if (ESDWORD[items.get(i)*304+buf+32] & ATR_FOLDER )
{
more_files_count.calculate_loop(#cur_file);
more_files_count.folders++;

View File

@ -83,7 +83,7 @@
sprintf(#copy_from2,"%s/%s",from2,filename);
sprintf(#copy_in2,"%s/%s",in2,filename);
if ( TestBit(ESDWORD[filename-40], 4) ) //dir_exists?
if ( ESDWORD[filename-40] & ATR_FOLDER ) //dir_exists?
{
if ( (!strncmp(filename, ".",1)) || (!strncmp(filename, "..",2)) ) continue;
CopyFolder(#copy_from2, #copy_in2);

View File

@ -40,7 +40,7 @@
dword sizehi;
char name[518];
};
#define ATR_FOLDER 0x10
:dword GetFileInfo(dword file_path, bdvk_struct)
@ -480,7 +480,7 @@ int block_size=1024*1024*4; //copy by 4 MiB
filename = i*304+dirbuf+72;
sprintf(cur_file,"%s/%s",way,filename);
if (TestBit(ESDWORD[filename-40], 4) )
if (ESDWORD[filename-40] & ATR_FOLDER )
{
folders++;
calculate_loop(cur_file);

View File

@ -70,8 +70,7 @@
{
dword tx = -strlen(text)*8+w/2+x;
dword ty = h/2-7+y;
if (id>0) DefineButton(x,y,w,h,id,color_b);
DefineButton(x,y,w,h,id,color_b);
WriteText(tx+1,ty+1,0x90,MixColors(color_b,0,230),text);
WriteText(tx,ty,0x90,color_t,text);
}
@ -90,7 +89,7 @@
unsigned darker_color = MixColors(sc.button,0,230);
if (id>0) DefineButton(x,y,w,h,id,sc.button);
DefineButton(x,y,w,h,id,sc.button);
WriteText(tx+1,ty+1,0x90,darker_color,text);
WriteText(tx,ty,0x90,sc.button_text,text);

View File

@ -392,7 +392,7 @@
if(tmp==-1)return -1;
size_tmp += tmp;
i++;
if (TestBit(ESDWORD[filename-40], 4))count_dirs++;
if (ESDWORD[filename-40] & ATR_FOLDER)count_dirs++;
else count_files++;
}

View File

@ -276,7 +276,7 @@ void find_loop(dword way)
{
filename = i*304+dirbuf+72;
getfullpath(cur_file,way,filename);
if (TestBit(ESDWORD[filename-40], 4) ) folder = true; else folder = false;
if (ESDWORD[filename-40] & ATR_FOLDER) folder = true; else folder = false;
if (strstri(filename, #search_name)) {
results.add(filename, way, folder);