Eolite 2.94: change attributes for selected elements

git-svn-id: svn://kolibrios.org@5688 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Serhii Sakhno 2015-08-06 17:54:42 +00:00
parent d1fc876276
commit 13153fc632
2 changed files with 201 additions and 77 deletions

View File

@ -103,8 +103,8 @@
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
enum { CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement enum { CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement
#define TITLE "Eolite File Manager v2.93" #define TITLE "Eolite File Manager v2.94"
#define ABOUT_TITLE "Eolite 2.93" #define ABOUT_TITLE "Eolite 2.94"
dword col_padding, col_selec, col_lpanel; dword col_padding, col_selec, col_lpanel;
int toolbar_buttons_x[7]={9,46,85,134,167,203}; int toolbar_buttons_x[7]={9,46,85,134,167,203};

View File

@ -1,6 +1,9 @@
#ifdef LANG_RUS #ifdef LANG_RUS
?define WINDOW_TITLE_PROPERTIES "‘¢®©á⢠" ?define WINDOW_TITLE_PROPERTIES "‘¢®©á⢠"
?define BTN_CLOSE "‡ ªàëâì" ?define BTN_CLOSE "‡ ªàëâì"
?define BTN_APPLY "<EFBFBD>ਬ¥­¨âì"
?define QUEST_1 "<EFBFBD>ਬ¥­¨âì ª® ¢á¥¬ ¢«®¦¥­­ë¬"
?define QUEST_2 "ä ©« ¬ ¨ ¯ ¯ª ¬"
?define PR_T_NAME "ˆ¬ï:" ?define PR_T_NAME "ˆ¬ï:"
?define PR_T_DEST "<EFBFBD> á¯®«®¦¥­¨¥:" ?define PR_T_DEST "<EFBFBD> á¯®«®¦¥­¨¥:"
?define PR_T_SIZE "<EFBFBD> §¬¥à:" ?define PR_T_SIZE "<EFBFBD> §¬¥à:"
@ -18,6 +21,9 @@
#else #else
?define WINDOW_TITLE_PROPERTIES "Properties" ?define WINDOW_TITLE_PROPERTIES "Properties"
?define BTN_CLOSE "Close" ?define BTN_CLOSE "Close"
?define BTN_APPLY "Apply"
?define QUEST_1 "<EFBFBD>ਬ¥­¨âì ª® ¢á¥¬ ¢«®¦¥­­ë¬"
?define QUEST_2 "ä ©« ¬ ¨ ¯ ¯ª ¬"
?define PR_T_NAME "Name:" ?define PR_T_NAME "Name:"
?define PR_T_DEST "Destination:" ?define PR_T_DEST "Destination:"
?define PR_T_SIZE "Size:" ?define PR_T_SIZE "Size:"
@ -39,23 +45,114 @@ char path_to_file[4096]="\0";
char file_name2[4096]="\0"; char file_name2[4096]="\0";
edit_box file_name_ed = {195,50,25,0xffffff,0x94AECE,0x000000,0xffffff,2,4098,#file_name2,#mouse_ddd2, 1000000000000000b,2,2}; edit_box file_name_ed = {195,50,25,0xffffff,0x94AECE,0x000000,0xffffff,2,4098,#file_name2,#mouse_ddd2, 1000000000000000b,2,2};
edit_box path_to_file_ed = {145,100,46,0xffffff,0x94AECE,0x000000,0xffffff,2,4098,#path_to_file,#mouse_ddd2, 1000000000000000b,2,2}; edit_box path_to_file_ed = {145,100,46,0xffffff,0x94AECE,0x000000,0xffffff,2,4098,#path_to_file,#mouse_ddd2, 1000000000000000b,2,2};
frame flags_frame = { 0, 280, 10, 83, 151, 0x000111, 0xFFFfff, 1, FLAGS, 0, 0, 6, 0x000111, 0xCCCccc }; frame flags_frame = { 0, 280, 10, 83, 151, 0x000111, 0xFFFfff, 1, FLAGS, 0, 0, 6, 0x000111, 0xFFFFFF };
int file_count, dir_count, size_dir; int file_count, dir_count, size_dir;
char folder_info[200]; char folder_info[200];
dword element_size;
char element_size_label[32];
BDVK file_info_general; BDVK file_info_general;
BDVK file_info_dirsize; BDVK file_info_dirsize;
void SetProperties(byte id) proc_info settings_form;
byte quest_active, atr_readonly, atr_hidden, atr_system;
void SetPropertiesDir(dword way)
{ {
if (selected_count) return; dword dirbuf, fcount, i, filename;
dword cur_file;
if (isdir(way))
{
cur_file = malloc(4096);
GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL);
for (i=0; i<fcount; i++)
{
filename = i*304+dirbuf+72;
strcpy(cur_file, way);
chrcat(cur_file, '/');
strcat(cur_file, filename);
if ( TestBit(ESDWORD[filename-40], 4) )
{
SetPropertiesDir(cur_file);
}
GetFileInfo(cur_file, #file_info_dirsize);
file_info_dirsize.readonly = atr_readonly;
file_info_dirsize.hidden = atr_hidden;
file_info_dirsize.system = atr_system;
SetFileInfo(cur_file, #file_info_dirsize);
}
free(cur_file);
}
}
void SetProperties(byte prop)
{
dword cur_file;
dword selected_offset2;
if (prop==1) || (prop==2)
{
if (selected_count)
{
cur_file = malloc(4096);
for (i=0; i<files.count; i++)
{
selected_offset2 = file_mas[i]*304 + buf+32 + 7;
if (ESBYTE[selected_offset2])
{
strcpy(cur_file, #path);
strcat(cur_file, file_mas[i]*304+buf+72);
GetFileInfo(cur_file, #file_info_general);
file_info_general.readonly = atr_readonly;
file_info_general.hidden = atr_hidden;
file_info_general.system = atr_system;
SetFileInfo(cur_file, #file_info_general);
if (prop==2)
{
if (isdir(cur_file))
{
SetPropertiesDir(cur_file);
}
}
}
}
free(cur_file);
}
else else
{ {
if (id==20) file_info_general.readonly ^= true; GetFileInfo(#file_path, #file_info_general);
if (id==21) file_info_general.hidden ^= true; file_info_general.readonly = atr_readonly;
if (id==22) file_info_general.system ^= true; file_info_general.hidden = atr_hidden;
file_info_general.system = atr_system;
SetFileInfo(#file_path, #file_info_general);
if (prop==2) SetPropertiesDir(#file_path);
}
quest_active = 0;
DrawPropertiesWindow();
}
else
{
GetFileInfo(#file_path, #file_info_general);
file_info_general.readonly = atr_readonly;
file_info_general.hidden = atr_hidden;
file_info_general.system = atr_system;
SetFileInfo(#file_path, #file_info_general); SetFileInfo(#file_path, #file_info_general);
} }
cmd_free=3;
_not_draw = true;
Open_Dir(#path,WITH_REDRAW);
_not_draw = false;
EventRedrawWindow(Form.left,Form.top);
ExitProcess();
}
void Quest()
{
DrawPopup(30,80,200,90,1,system.color.work, system.color.work_graph);
WriteText(50, 100, 0x80, 0x000000, QUEST_1);
WriteText(80, 115, 0x80, 0x000000, QUEST_2);
DrawFlatButton(52,138,70,20,301,0xFFB6B5,T_YES);
DrawFlatButton(145,138,70,20,302,0xC6DFC6,T_NO);
} }
void GetSizeDir(dword way) void GetSizeDir(dword way)
@ -129,23 +226,29 @@ void properties_dialog()
byte id; byte id;
byte key; byte key;
dword file_name_off; dword file_name_off;
dword element_size;
dword selected_offset2; dword selected_offset2;
char element_size_label[32],tmp;
proc_info settings_form;
DSBYTE[#folder_info]=0; DSBYTE[#folder_info]=0;
file_count = 0; file_count = 0;
dir_count = 0; dir_count = 0;
size_dir = 0; size_dir = 0;
if (selected_count) GetSizeMoreFiles(#path); if (selected_count)
{
GetSizeMoreFiles(#path);
atr_readonly = 0;
atr_hidden = 0;
atr_system = 0;
}
else else
{ {
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);
atr_readonly = file_info_general.readonly;
atr_hidden = file_info_general.hidden;
atr_system = file_info_general.system;
} }
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);
@ -155,22 +258,33 @@ void properties_dialog()
{ {
case evButton: case evButton:
id=GetButtonID(); id=GetButtonID();
if (quest_active)
{
IF (id==301) SetProperties(2);
IF (id==302) SetProperties(1);
break;
}
if (id==1) || (id==10) if (id==1) || (id==10)
{ {
cmd_free=3; cmd_free=3;
ExitProcess(); ExitProcess();
} }
if (id==20) SetProperties(id); IF (id==11)
if (id==21)
{ {
SetProperties(id); if (selected_count) || (itdir)
_not_draw = true; {
Open_Dir(#path,WITH_REDRAW); quest_active = 1;
_not_draw = false; Quest();
EventRedrawWindow(Form.left,Form.top);
} }
if (id==22) SetProperties(id); else
{
SetProperties(0);
}
break;
}
if (id==20) atr_readonly ^= 1;
if (id==21) atr_hidden ^= 1;
if (id==22) atr_system ^= 1;
DrawPropertiesCheckBoxes(); DrawPropertiesCheckBoxes();
break; break;
@ -181,6 +295,12 @@ void properties_dialog()
case evKey: case evKey:
key = GetKey(); key = GetKey();
if (quest_active)
{
IF (key==013) SetProperties(2);
IF (key==027) SetProperties(1);
break;
}
if (key==27) if (key==27)
{ {
cmd_free=3; cmd_free=3;
@ -192,9 +312,16 @@ void properties_dialog()
break; break;
case evReDraw: case evReDraw:
DefineAndDrawWindow(Form.left + 150,150,270,285+GetSkinHeight(),0x34,system.color.work,WINDOW_TITLE_PROPERTIES); DrawPropertiesWindow();
}
}
void DrawPropertiesWindow()
{
DefineAndDrawWindow(Form.left + 150,150,270,285+GetSkinHeight(),0x34,0xFFFFFF,WINDOW_TITLE_PROPERTIES);
GetProcessInfo(#settings_form, SelfInfo); GetProcessInfo(#settings_form, SelfInfo);
DrawFlatButton(settings_form.cwidth - 70 - 13, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, BTN_CLOSE); DrawFlatButton(settings_form.cwidth - 70 - 13, settings_form.cheight - 34, 70, 22, 10, 0xE4DFE1, BTN_CLOSE);
DrawFlatButton(settings_form.cwidth - 150 - 13, settings_form.cheight - 34, 70, 22, 11, 0xE4DFE1, BTN_APPLY);
DrawBar(10, 10, 32, 32, 0xFFFfff); DrawBar(10, 10, 32, 32, 0xFFFfff);
WriteText(10, 50, 0x80, 0x000000, PR_T_DEST); WriteText(10, 50, 0x80, 0x000000, PR_T_DEST);
@ -237,20 +364,17 @@ void properties_dialog()
sprintf(#element_size_label,"%s (%d %s)",ConvertSize(element_size),element_size,SET_BYTE_LANG); sprintf(#element_size_label,"%s (%d %s)",ConvertSize(element_size),element_size,SET_BYTE_LANG);
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;
flags_frame.font_color = system.color.work_text; flags_frame.font_color = system.color.work_text;
flags_frame.font_backgr_color = system.color.work;
flags_frame.ext_col = system.color.work_graph; flags_frame.ext_col = system.color.work_graph;
frame_draw stdcall (#flags_frame); frame_draw stdcall (#flags_frame);
DrawPropertiesCheckBoxes(); DrawPropertiesCheckBoxes();
}
}
} }
void DrawPropertiesCheckBoxes() void DrawPropertiesCheckBoxes()
{ {
CheckBox2(22, flags_frame.start_y + 14, 20, PR_T_ONLY_READ, file_info_general.readonly); CheckBox2(22, flags_frame.start_y + 14, 20, PR_T_ONLY_READ, atr_readonly);
CheckBox2(22, flags_frame.start_y + 36, 21, PR_T_HIDDEN, file_info_general.hidden); CheckBox2(22, flags_frame.start_y + 36, 21, PR_T_HIDDEN, atr_hidden);
CheckBox2(22, flags_frame.start_y + 58, 22, PR_T_SYSTEM, file_info_general.system); CheckBox2(22, flags_frame.start_y + 58, 22, PR_T_SYSTEM, atr_system);
} }