2019-03-10 19:08:50 +01:00
|
|
|
|
2021-12-31 01:14:50 +01:00
|
|
|
char path_to_file[PATHLEN];
|
|
|
|
char file_name2[PATHLEN];
|
2018-10-29 12:39:31 +01:00
|
|
|
edit_box file_name_ed = {230,59,32,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(file_name2)-2,#file_name2,NULL, 0b,2,2};
|
|
|
|
edit_box path_to_file_ed = {160,120,79,0xffffff,0x94AECE,0xFFFfff,0xffffff,2,sizeof(path_to_file)-2,#path_to_file,NULL, 0b,2,2};
|
2015-02-22 19:42:51 +01:00
|
|
|
|
2015-02-24 18:47:47 +01:00
|
|
|
BDVK file_info_general;
|
|
|
|
BDVK file_info_dirsize;
|
2015-02-22 19:42:51 +01:00
|
|
|
|
2019-03-10 19:08:50 +01:00
|
|
|
bool apply_question_active;
|
2018-04-19 22:12:07 +02:00
|
|
|
|
2020-05-06 17:53:34 +02:00
|
|
|
DIR_SIZE more_files_count;
|
|
|
|
DIR_SIZE dir_size;
|
2018-09-15 12:48:42 +02:00
|
|
|
|
2018-04-19 22:12:07 +02:00
|
|
|
checkbox ch_read_only = { PR_T_ONLY_READ, NULL };
|
|
|
|
checkbox ch_hidden = { PR_T_HIDDEN, NULL };
|
|
|
|
checkbox ch_system = { PR_T_SYSTEM, NULL };
|
|
|
|
|
|
|
|
void SetPropertiesFile(dword cur_file, bdvk_pointer)
|
|
|
|
{
|
|
|
|
GetFileInfo(cur_file, bdvk_pointer);
|
|
|
|
ESI = bdvk_pointer;
|
|
|
|
ESI.BDVK.readonly = ch_read_only.checked;
|
|
|
|
ESI.BDVK.hidden = ch_hidden.checked;
|
|
|
|
ESI.BDVK.system = ch_system.checked;
|
|
|
|
SetFileInfo(cur_file, bdvk_pointer);
|
|
|
|
}
|
2015-08-06 19:54:42 +02:00
|
|
|
|
|
|
|
void SetPropertiesDir(dword way)
|
|
|
|
{
|
|
|
|
dword dirbuf, fcount, i, filename;
|
|
|
|
dword cur_file;
|
2016-02-19 01:33:21 +01:00
|
|
|
if (dir_exists(way))
|
2015-08-06 19:54:42 +02:00
|
|
|
{
|
2021-12-31 01:14:50 +01:00
|
|
|
cur_file = malloc(PATHLEN);
|
2015-08-06 19:54:42 +02:00
|
|
|
GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL);
|
|
|
|
for (i=0; i<fcount; i++)
|
|
|
|
{
|
|
|
|
filename = i*304+dirbuf+72;
|
2021-12-31 01:14:50 +01:00
|
|
|
sprintf(cur_file, "%s/%s", way, filename);
|
2021-06-25 15:21:42 +02:00
|
|
|
if ( ESDWORD[filename-40] & ATR_FOLDER )
|
2015-08-06 19:54:42 +02:00
|
|
|
{
|
|
|
|
SetPropertiesDir(cur_file);
|
|
|
|
}
|
2018-04-19 22:12:07 +02:00
|
|
|
SetPropertiesFile(cur_file, #file_info_dirsize);
|
2015-08-06 19:54:42 +02:00
|
|
|
}
|
|
|
|
free(cur_file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-10 19:08:50 +01:00
|
|
|
#define SET_PROPERTIES_SINGLE_FILE 0
|
|
|
|
#define SET_PROPERTIES_NO_SUBFOLDER 1
|
|
|
|
#define SET_PROPERTIES_ALL_SUBFOLDER 2
|
|
|
|
void SetProperties(int mode)
|
2015-05-10 03:12:52 +02:00
|
|
|
{
|
2019-03-10 19:08:50 +01:00
|
|
|
char pcur_file[4096];
|
2018-10-01 18:41:14 +02:00
|
|
|
dword i;
|
2015-08-06 19:54:42 +02:00
|
|
|
|
2021-12-31 01:14:50 +01:00
|
|
|
apply_question_active = false;
|
2019-03-10 19:08:50 +01:00
|
|
|
|
|
|
|
if (SET_PROPERTIES_SINGLE_FILE == mode) {
|
|
|
|
SetPropertiesFile(#file_path, #file_info_general);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SET_PROPERTIES_ALL_SUBFOLDER == mode)
|
|
|
|
|| (SET_PROPERTIES_NO_SUBFOLDER == mode)
|
2015-08-06 19:54:42 +02:00
|
|
|
{
|
2021-06-30 13:38:29 +02:00
|
|
|
if (getSelectedCount())
|
2015-08-06 19:54:42 +02:00
|
|
|
{
|
|
|
|
for (i=0; i<files.count; i++)
|
|
|
|
{
|
2016-11-01 13:14:17 +01:00
|
|
|
if (getElementSelectedFlag(i) == true)
|
2015-08-06 19:54:42 +02:00
|
|
|
{
|
2021-06-27 11:28:59 +02:00
|
|
|
sprintf(#pcur_file,"%s/%s",path,items.get(i)*304+buf+72);
|
2019-03-10 19:08:50 +01:00
|
|
|
SetPropertiesFile(#pcur_file, #file_info_general);
|
|
|
|
if (SET_PROPERTIES_ALL_SUBFOLDER == mode) {
|
|
|
|
if (dir_exists(#pcur_file)) SetPropertiesDir(#pcur_file);
|
2015-08-06 19:54:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-19 22:12:07 +02:00
|
|
|
SetPropertiesFile(#file_path, #file_info_general);
|
2019-03-10 19:08:50 +01:00
|
|
|
if (SET_PROPERTIES_ALL_SUBFOLDER == mode) SetPropertiesDir(#file_path);
|
2015-08-06 19:54:42 +02:00
|
|
|
}
|
2015-05-10 03:12:52 +02:00
|
|
|
}
|
2019-03-10 19:08:50 +01:00
|
|
|
|
2015-08-06 19:54:42 +02:00
|
|
|
cmd_free=3;
|
2021-06-28 19:00:57 +02:00
|
|
|
OpenDir(ONLY_OPEN);
|
2015-08-06 19:54:42 +02:00
|
|
|
ExitProcess();
|
|
|
|
}
|
|
|
|
|
2016-02-21 22:57:22 +01:00
|
|
|
void ShowConfirmQuestionPopin()
|
2015-08-06 19:54:42 +02:00
|
|
|
{
|
2021-12-31 01:14:50 +01:00
|
|
|
apply_question_active = true;
|
2022-01-09 07:36:16 +01:00
|
|
|
DrawPopup(15,80,250,90,1,sc.work, sc.line);
|
2016-02-22 02:41:13 +01:00
|
|
|
WriteText(35, 102, 0x90, 0x000000, QUEST_1);
|
|
|
|
WriteText(65, 117, 0x90, 0x000000, QUEST_2);
|
2019-03-10 19:08:50 +01:00
|
|
|
DrawStandartCaptButton(62,138,B_SETINGS_APPLY_SUBFOLDER,T_YES);
|
|
|
|
DrawStandartCaptButton(155,138,B_SETINGS_APPLY_NO_SUBFOLDER,T_NO);
|
2015-05-10 03:12:52 +02:00
|
|
|
}
|
2015-02-27 21:25:28 +01:00
|
|
|
|
2015-03-08 16:25:21 +01:00
|
|
|
void GetSizeMoreFiles(dword way)
|
|
|
|
{
|
|
|
|
char cur_file[4096];
|
2018-10-01 18:41:14 +02:00
|
|
|
dword i;
|
2015-12-13 02:30:37 +01:00
|
|
|
|
2015-03-08 16:25:21 +01:00
|
|
|
for (i=0; i<files.count; i++)
|
2016-11-01 13:14:17 +01:00
|
|
|
{
|
|
|
|
if (getElementSelectedFlag(i) == true)
|
|
|
|
{
|
2020-05-23 13:26:58 +02:00
|
|
|
sprintf(#cur_file,"%s/%s",way,items.get(i)*304+buf+72);
|
2021-06-25 15:21:42 +02:00
|
|
|
if (ESDWORD[items.get(i)*304+buf+32] & ATR_FOLDER )
|
2015-03-08 16:25:21 +01:00
|
|
|
{
|
2018-09-15 12:48:42 +02:00
|
|
|
more_files_count.calculate_loop(#cur_file);
|
|
|
|
more_files_count.folders++;
|
2015-03-08 16:25:21 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-12-13 02:30:37 +01:00
|
|
|
GetFileInfo(#cur_file, #file_info_dirsize);
|
2022-02-07 00:16:38 +01:00
|
|
|
more_files_count.sizelo += file_info_dirsize.sizelo;
|
|
|
|
more_files_count.sizehi += file_info_dirsize.sizehi;
|
2018-09-15 12:48:42 +02:00
|
|
|
more_files_count.files++;
|
2015-03-08 16:25:21 +01:00
|
|
|
}
|
2016-11-01 13:14:17 +01:00
|
|
|
}
|
2015-03-08 16:25:21 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-22 19:42:51 +01:00
|
|
|
void properties_dialog()
|
|
|
|
{
|
2018-04-19 22:12:07 +02:00
|
|
|
int id;
|
2015-02-22 19:42:51 +01:00
|
|
|
|
2021-06-30 13:38:29 +02:00
|
|
|
if (getSelectedCount())
|
2015-08-06 19:54:42 +02:00
|
|
|
{
|
2018-09-15 12:48:42 +02:00
|
|
|
more_files_count.get(NULL);
|
2021-06-27 11:28:59 +02:00
|
|
|
GetSizeMoreFiles(path);
|
2018-04-19 22:12:07 +02:00
|
|
|
ch_read_only.checked = 0;
|
|
|
|
ch_hidden.checked = 0;
|
|
|
|
ch_system.checked = 0;
|
2015-08-06 19:54:42 +02:00
|
|
|
}
|
2015-03-08 16:25:21 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
GetFileInfo(#file_path, #file_info_general);
|
2020-12-07 19:19:13 +01:00
|
|
|
edit_box_set_text stdcall (#file_name_ed, #file_name);
|
2018-09-15 12:48:42 +02:00
|
|
|
if(itdir) dir_size.get(#file_path);
|
2018-04-19 22:12:07 +02:00
|
|
|
ch_read_only.checked = file_info_general.readonly;
|
|
|
|
ch_hidden.checked = file_info_general.hidden;
|
|
|
|
ch_system.checked = file_info_general.system;
|
2015-03-08 16:25:21 +01:00
|
|
|
}
|
2021-06-27 11:28:59 +02:00
|
|
|
edit_box_set_text stdcall (#path_to_file_ed, path);
|
2015-02-22 19:42:51 +01:00
|
|
|
|
2018-04-16 00:44:36 +02:00
|
|
|
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
|
2015-02-22 19:42:51 +01:00
|
|
|
loop() switch(WaitEvent())
|
|
|
|
{
|
|
|
|
case evButton:
|
|
|
|
id=GetButtonID();
|
2018-04-19 22:12:07 +02:00
|
|
|
ch_read_only.click(id);
|
|
|
|
ch_hidden.click(id);
|
|
|
|
ch_system.click(id);
|
2019-03-10 19:08:50 +01:00
|
|
|
if (apply_question_active)
|
2015-08-06 19:54:42 +02:00
|
|
|
{
|
2019-03-10 19:08:50 +01:00
|
|
|
IF (id==B_SETINGS_APPLY_SUBFOLDER)
|
|
|
|
SetProperties(SET_PROPERTIES_ALL_SUBFOLDER);
|
|
|
|
IF (id==B_SETINGS_APPLY_NO_SUBFOLDER)
|
|
|
|
SetProperties(SET_PROPERTIES_NO_SUBFOLDER);
|
2015-08-06 19:54:42 +02:00
|
|
|
break;
|
|
|
|
}
|
2019-03-10 19:08:50 +01:00
|
|
|
if (id==1) || (id==B_CLOSE)
|
2015-07-21 03:10:37 +02:00
|
|
|
{
|
|
|
|
cmd_free=3;
|
|
|
|
ExitProcess();
|
|
|
|
}
|
2022-02-07 00:16:38 +01:00
|
|
|
if (id==B_APPLY) goto _APPLY_PROPERTIES;
|
2015-02-22 19:42:51 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case evMouse:
|
|
|
|
edit_box_mouse stdcall (#file_name_ed);
|
|
|
|
edit_box_mouse stdcall (#path_to_file_ed);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evKey:
|
2015-08-10 12:55:14 +02:00
|
|
|
GetKeys();
|
2019-03-10 19:08:50 +01:00
|
|
|
|
|
|
|
if (apply_question_active)
|
2015-08-06 19:54:42 +02:00
|
|
|
{
|
2019-03-10 19:08:50 +01:00
|
|
|
IF (key_scancode==SCAN_CODE_ENTER)
|
|
|
|
SetProperties(SET_PROPERTIES_ALL_SUBFOLDER);
|
|
|
|
IF (key_scancode==SCAN_CODE_ESC)
|
|
|
|
SetProperties(SET_PROPERTIES_NO_SUBFOLDER);
|
2015-08-06 19:54:42 +02:00
|
|
|
break;
|
|
|
|
}
|
2019-03-10 19:08:50 +01:00
|
|
|
|
|
|
|
switch(key_scancode)
|
2015-08-09 23:59:25 +02:00
|
|
|
{
|
2019-03-10 19:08:50 +01:00
|
|
|
case SCAN_CODE_ESC:
|
|
|
|
cmd_free=3;
|
|
|
|
ExitProcess();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCAN_CODE_ENTER:
|
2022-02-07 00:16:38 +01:00
|
|
|
_APPLY_PROPERTIES:
|
|
|
|
if (getSelectedCount()) || (itdir) {
|
|
|
|
ShowConfirmQuestionPopin();
|
|
|
|
} else {
|
|
|
|
SetProperties(SET_PROPERTIES_SINGLE_FILE);
|
|
|
|
}
|
2019-03-10 19:08:50 +01:00
|
|
|
break;
|
|
|
|
|
2020-05-12 01:02:41 +02:00
|
|
|
case SCAN_CODE_KEY_A:
|
|
|
|
case SCAN_CODE_KEY_C:
|
2022-02-23 14:15:01 +01:00
|
|
|
if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) {
|
|
|
|
edit_box_key_c stdcall(#file_name_ed,key_editbox);
|
|
|
|
edit_box_key_c stdcall(#path_to_file_ed,key_editbox);
|
2019-03-13 01:02:58 +01:00
|
|
|
}
|
2015-08-09 23:59:25 +02:00
|
|
|
}
|
2015-02-22 19:42:51 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case evReDraw:
|
2015-08-06 19:54:42 +02:00
|
|
|
DrawPropertiesWindow();
|
|
|
|
}
|
|
|
|
}
|
2015-02-23 14:12:43 +01:00
|
|
|
|
2015-08-06 19:54:42 +02:00
|
|
|
void DrawPropertiesWindow()
|
|
|
|
{
|
2019-03-10 19:08:50 +01:00
|
|
|
proc_info pform;
|
2016-11-25 15:15:30 +01:00
|
|
|
dword ext1;
|
2018-04-19 22:12:07 +02:00
|
|
|
incn y;
|
2021-12-31 01:14:50 +01:00
|
|
|
char temp_path[PATHLEN];
|
|
|
|
bool show_date = false;
|
|
|
|
|
2022-02-07 00:16:38 +01:00
|
|
|
dword p_t_formated_size;
|
|
|
|
dword p_q_size_bytes;
|
|
|
|
dword t_contains_files_and_folders[200];
|
|
|
|
|
2021-12-31 01:14:50 +01:00
|
|
|
if (chrnum(path, '/')>1) || (streq(path, "/kolibrios")) || (streq(path, "/sys")) show_date = true;
|
|
|
|
if (getSelectedCount()) show_date = false;
|
|
|
|
|
2022-02-07 00:16:38 +01:00
|
|
|
DefineAndDrawWindow(Form.left + 150,150,315,show_date*60+342+skin_h,0x34,sc.work,WINDOW_TITLE_PROPERTIES,0);
|
2019-03-10 19:08:50 +01:00
|
|
|
GetProcessInfo(#pform, SelfInfo);
|
2017-10-03 14:10:48 +02:00
|
|
|
|
2019-03-10 19:08:50 +01:00
|
|
|
DrawStandartCaptButton(pform.cwidth - 96, pform.cheight-34, B_CLOSE, T_CLOSE);
|
|
|
|
DrawStandartCaptButton(pform.cwidth -208, pform.cheight-34, B_APPLY, T_APPLY);
|
2015-08-06 19:54:42 +02:00
|
|
|
|
2021-06-30 13:38:29 +02:00
|
|
|
if (getSelectedCount())
|
2017-10-03 14:10:48 +02:00
|
|
|
{
|
2017-10-11 00:26:56 +02:00
|
|
|
PropertiesDrawIcon(NULL, "<lot>");
|
2022-02-07 00:16:38 +01:00
|
|
|
WriteText(file_name_ed.left+4, 30, 0x90, sc.work_text, T_BULK_SELECTION);
|
|
|
|
p_t_formated_size = ConvertSize64(more_files_count.sizelo, more_files_count.sizehi);
|
|
|
|
p_q_size_bytes = #more_files_count.sizelo;
|
|
|
|
sprintf(#t_contains_files_and_folders,T_FILES_FOLDERS,more_files_count.files,more_files_count.folders);
|
|
|
|
} else {
|
|
|
|
WriteText(file_name_ed.left, file_name_ed.top-15, 0x80, sc.work_text, T_NAME);
|
2018-04-16 00:44:36 +02:00
|
|
|
DrawEditBox(#file_name_ed);
|
2022-02-07 00:16:38 +01:00
|
|
|
if (itdir) {
|
|
|
|
PropertiesDrawIcon(NULL, "<DIR>");
|
|
|
|
p_t_formated_size = ConvertSize64(dir_size.sizelo, dir_size.sizehi);
|
|
|
|
p_q_size_bytes = #dir_size.sizelo;
|
|
|
|
sprintf(#t_contains_files_and_folders,T_FILES_FOLDERS,dir_size.files,dir_size.folders);
|
2021-12-31 01:14:50 +01:00
|
|
|
} else {
|
2022-02-07 00:16:38 +01:00
|
|
|
sprintf(#temp_path,"%s/%s",path,#file_name2);
|
|
|
|
if (ext1 = strrchr(#file_name2,'.')) ext1 += #file_name2;
|
|
|
|
PropertiesDrawIcon(#temp_path, ext1);
|
|
|
|
p_t_formated_size = ConvertSize64(file_info_general.sizelo, file_info_general.sizehi);
|
|
|
|
p_q_size_bytes = #file_info_general.sizelo;
|
|
|
|
sprintf(#t_contains_files_and_folders,T_DATA);
|
|
|
|
}
|
2021-12-31 01:14:50 +01:00
|
|
|
}
|
2022-02-07 00:16:38 +01:00
|
|
|
WriteTextLines(10, y.set(78), 0x90, sc.work_text, T_PATH_SIZE, 20);
|
|
|
|
edit_box_draw stdcall (#path_to_file_ed);
|
|
|
|
|
|
|
|
WriteText(120, y.inc(20), 0x90, sc.work_text, p_t_formated_size);
|
|
|
|
WriteNumber(120, y.inc(20), 0x90, sc.work_text, 0xc0140001, p_q_size_bytes);
|
|
|
|
WriteText(120, y.inc(20), 0x90, sc.work_text, #t_contains_files_and_folders);
|
2021-12-31 01:14:50 +01:00
|
|
|
|
|
|
|
if (show_date) {
|
2022-02-07 00:16:38 +01:00
|
|
|
WriteTextLines(10, y.inc(32), 0x90, sc.work_text, CREATED_OPENED_MODIFIED, 20);
|
|
|
|
DrawDateTime(120, y.n, sc.work_text, #file_info_general.datecreate, #file_info_general.timecreate);
|
|
|
|
DrawDateTime(120, y.inc(20), sc.work_text, #file_info_general.datelastaccess, #file_info_general.timelastaccess);
|
|
|
|
DrawDateTime(120, y.inc(20), sc.work_text, #file_info_general.datelastedit, #file_info_general.timelastedit);
|
2015-02-22 19:42:51 +01:00
|
|
|
}
|
2021-12-31 01:14:50 +01:00
|
|
|
|
|
|
|
DrawFrame(10, y.set(pform.cheight - 143), -10*2 + pform.cwidth - 2, 92, FLAGS);
|
2018-04-19 22:12:07 +02:00
|
|
|
ch_read_only.draw(24, y.inc(18));
|
|
|
|
ch_hidden.draw(24, y.inc(24));
|
|
|
|
ch_system.draw(24, y.inc(24));
|
2019-03-10 19:08:50 +01:00
|
|
|
if (apply_question_active) ShowConfirmQuestionPopin();
|
2017-10-03 14:10:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void PropertiesDrawIcon(dword file_path, extension)
|
|
|
|
{
|
2022-01-05 21:24:25 +01:00
|
|
|
int icon_n = ini_icons.get(file_path, extension, 32);
|
|
|
|
draw_icon_32(12, 22, sc.work, icon_n);
|
2015-02-24 18:47:47 +01:00
|
|
|
}
|