Eolite 3.71: fix crash while using Insert key, two tiny fixes

git-svn-id: svn://kolibrios.org@6646 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-11-01 12:14:17 +00:00
parent 58a1a17acf
commit 0485fe792b
6 changed files with 23 additions and 35 deletions

View File

@ -50,10 +50,6 @@ void properties_dialog()
{ {
byte id; byte id;
byte key; byte key;
dword file_name_off;
dword element_size;
dword selected_offset2;
char element_size_label[32];
proc_info settings_form; proc_info settings_form;
IF (active_properties) ExitProcess(); IF (active_properties) ExitProcess();

View File

@ -458,10 +458,8 @@ void main()
Del_Form(); Del_Form();
break; break;
case SCAN_CODE_INS: case SCAN_CODE_INS:
selected_offset = file_mas[files.cur_y]*304 + buf+32 + 7; if (getElementSelectedFlag(files.cur_y) == true) setElementSelectedFlag(files.cur_y, false);
if (ESBYTE[selected_offset]) setElementSelectedFlag(files.cur_y, false);
else setElementSelectedFlag(files.cur_y, true); else setElementSelectedFlag(files.cur_y, true);
_INSERT_END:
files.KeyDown(); files.KeyDown();
List_ReDraw(); List_ReDraw();
DrawStatusBar(); DrawStatusBar();

View File

@ -7,17 +7,21 @@ enum {NOCUT, CUT};
Clipboard clipboard; Clipboard clipboard;
void setElementSelectedFlag(dword n, bool state) { void setElementSelectedFlag(dword n, int state) {
dword selected_offset = file_mas[n]*304 + buf+32 + 7; dword selected_offset = file_mas[n]*304 + buf+32 + 7;
if (!n) if (!strncmp(selected_offset+33, "..", 2)) return; //do not selec ".." directory
ESBYTE[selected_offset] = state; ESBYTE[selected_offset] = state;
if (n==0) && (strncmp(file_mas[n]*304+buf+72,"..",2)==0) ESBYTE[selected_offset] = false; //do not selec ".." directory
if (state==true) selected_count++; if (state==true) selected_count++;
if (state==false) selected_count--; if (state==false) selected_count--;
} }
int getElementSelectedFlag(dword n) {
dword selected_offset = file_mas[n]*304 + buf+32 + 7;
return ESBYTE[selected_offset];
}
void Copy(dword pcth, char cut) void Copy(dword pcth, char cut)
{ {
dword selected_offset2;
byte copy_t[4096]; byte copy_t[4096];
dword buff_data; dword buff_data;
dword path_len = 0; dword path_len = 0;
@ -29,8 +33,7 @@ void Copy(dword pcth, char cut)
size_buf = 4; size_buf = 4;
for (i=0; i<files.count; i++) for (i=0; i<files.count; i++)
{ {
selected_offset2 = file_mas[i]*304 + buf+32 + 7; if (getElementSelectedFlag(i) == true) {
if (ESBYTE[selected_offset2]) {
sprintf(#copy_t,"%s/%s",#path,file_mas[i]*304+buf+72); sprintf(#copy_t,"%s/%s",#path,file_mas[i]*304+buf+72);
path_len = strlen(#copy_t); path_len = strlen(#copy_t);
size_buf += path_len + 1; size_buf += path_len + 1;
@ -44,8 +47,7 @@ void Copy(dword pcth, char cut)
copy_buf_offset = buff_data + 10; copy_buf_offset = buff_data + 10;
for (i=0; i<files.count; i++) for (i=0; i<files.count; i++)
{ {
selected_offset2 = file_mas[i]*304 + buf+32 + 7; if (getElementSelectedFlag(i) == true) {
if (ESBYTE[selected_offset2]) {
sprintf(copy_buf_offset,"%s/%s",#path,file_mas[i]*304+buf+72); sprintf(copy_buf_offset,"%s/%s",#path,file_mas[i]*304+buf+72);
copy_buf_offset += strlen(copy_buf_offset) + 1; copy_buf_offset += strlen(copy_buf_offset) + 1;
} }

View File

@ -29,7 +29,6 @@ int Del_File2(dword way, sh_progr)
void Del_File_Thread() void Del_File_Thread()
{ {
byte del_from[4096]; byte del_from[4096];
dword selected_offset2;
int tst, count, i; int tst, count, i;
file_count_copy = 0; file_count_copy = 0;
@ -40,8 +39,7 @@ void Del_File_Thread()
{ {
for (i=0; i<files.count; i++) for (i=0; i<files.count; i++)
{ {
selected_offset2 = file_mas[i]*304 + buf+32 + 7; if (getElementSelectedFlag(i) == true) {
if (ESBYTE[selected_offset2]) {
sprintf(#del_from,"%s/%s",#path,file_mas[i]*304+buf+72); sprintf(#del_from,"%s/%s",#path,file_mas[i]*304+buf+72);
GetFileInfo(#del_from, #file_info_count); GetFileInfo(#del_from, #file_info_count);
if ( file_info_count.isfolder ) DirFileCount(#del_from); if ( file_info_count.isfolder ) DirFileCount(#del_from);
@ -63,8 +61,7 @@ void Del_File_Thread()
{ {
for (i=0; i<files.count; i++) for (i=0; i<files.count; i++)
{ {
selected_offset2 = file_mas[i]*304 + buf+32 + 7; if (getElementSelectedFlag(i) == true) {
if (ESBYTE[selected_offset2]) {
sprintf(#del_from,"%s/%s",#path,file_mas[i]*304+buf+72); sprintf(#del_from,"%s/%s",#path,file_mas[i]*304+buf+72);
Del_File2(#del_from, 1); Del_File2(#del_from, 1);
} }

View File

@ -95,7 +95,6 @@ void SetPropertiesDir(dword way)
void SetProperties(byte prop) void SetProperties(byte prop)
{ {
dword cur_file; dword cur_file;
dword selected_offset2;
if (prop==1) || (prop==2) if (prop==1) || (prop==2)
{ {
@ -104,8 +103,7 @@ void SetProperties(byte prop)
cur_file = malloc(4096); cur_file = malloc(4096);
for (i=0; i<files.count; i++) for (i=0; i<files.count; i++)
{ {
selected_offset2 = file_mas[i]*304 + buf+32 + 7; if (getElementSelectedFlag(i) == true)
if (ESBYTE[selected_offset2])
{ {
strcpy(cur_file, #path); strcpy(cur_file, #path);
strcat(cur_file, file_mas[i]*304+buf+72); strcat(cur_file, file_mas[i]*304+buf+72);
@ -197,12 +195,11 @@ void GetSizeDir(dword way)
void GetSizeMoreFiles(dword way) void GetSizeMoreFiles(dword way)
{ {
char cur_file[4096]; char cur_file[4096];
dword selected_offset2;
for (i=0; i<files.count; i++) for (i=0; i<files.count; i++)
{ {
selected_offset2 = file_mas[i]*304 + buf+32 + 7; if (getElementSelectedFlag(i) == true)
if (ESBYTE[selected_offset2]) { {
sprintf(#cur_file,"%s/%s",way,file_mas[i]*304+buf+72); sprintf(#cur_file,"%s/%s",way,file_mas[i]*304+buf+72);
if (TestBit(ESDWORD[file_mas[i]*304+buf+32], 4) ) if (TestBit(ESDWORD[file_mas[i]*304+buf+32], 4) )
{ {
@ -222,8 +219,6 @@ void GetSizeMoreFiles(dword way)
void properties_dialog() void properties_dialog()
{ {
byte id; byte id;
dword file_name_off;
dword selected_offset2;
DSBYTE[#folder_info]=0; DSBYTE[#folder_info]=0;
file_count = 0; file_count = 0;
@ -386,7 +381,7 @@ void DrawPropertiesWindow()
if (selected_count) if (selected_count)
{ {
DrawIconByExtension(NULL, 18, 19, system.color.work); DrawIconByExtension(NULL, 18, 49, system.color.work);
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, 49, 0x90, 0x000000, #folder_info); WriteText(50, 49, 0x90, 0x000000, #folder_info);
sprintf(#element_size_label,"%s (%d %s)",ConvertSize(size_dir),size_dir,SET_BYTE_LANG); sprintf(#element_size_label,"%s (%d %s)",ConvertSize(size_dir),size_dir,SET_BYTE_LANG);

View File

@ -1,5 +1,5 @@
#define TITLE "Eolite File Manager v3.7" #define TITLE "Eolite File Manager v3.71"
#define ABOUT_TITLE "EOLITE 3.7" #define ABOUT_TITLE "EOLITE 3.71"
#ifdef LANG_RUS #ifdef LANG_RUS
?define T_FILE "” ©«" ?define T_FILE "” ©«"