Subversion Repositories Kolibri OS

Rev

Rev 8956 | Rev 9535 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5447 punk_joker 1
 
7041 leency 2
char file_name2[4096];
3
edit_box file_name_ed = {230,59,32,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(file_name2)-2,#file_name2,NULL, 0b,2,2};
7506 leency 4
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};
5
5447 punk_joker 6
 
5463 leency 7
BDVK file_info_dirsize;
8
5447 punk_joker 9
 
7593 leency 10
5688 punk_joker 11
 
7878 leency 12
DIR_SIZE dir_size;
13
7369 leency 14
 
7244 leency 15
checkbox ch_hidden = { PR_T_HIDDEN, NULL };
16
checkbox ch_system = { PR_T_SYSTEM, NULL };
17
18
 
19
{
20
	GetFileInfo(cur_file, bdvk_pointer);
21
	ESI = bdvk_pointer;
22
	ESI.BDVK.readonly = ch_read_only.checked;
23
	ESI.BDVK.hidden = ch_hidden.checked;
24
	ESI.BDVK.system = ch_system.checked;
25
	SetFileInfo(cur_file, bdvk_pointer);
26
}
27
28
 
5688 punk_joker 29
{
5554 punk_joker 30
	dword dirbuf, fcount, i, filename;
5688 punk_joker 31
	dword cur_file;
32
	if (dir_exists(way))
6251 leency 33
	{
5688 punk_joker 34
		cur_file = malloc(4096);
35
		GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL);
36
		for (i=0; i
37
		{
38
			filename = i*304+dirbuf+72;
39
			strcpy(cur_file, way);
40
			chrcat(cur_file, '/');
41
			strcat(cur_file, filename);
42
			if ( ESDWORD[filename-40] & ATR_FOLDER )
8944 leency 43
			{
5688 punk_joker 44
				SetPropertiesDir(cur_file);
45
			}
46
			SetPropertiesFile(cur_file, #file_info_dirsize);
7244 leency 47
		}
5688 punk_joker 48
		free(cur_file);
49
	}
50
}
51
52
 
7593 leency 53
#define SET_PROPERTIES_NO_SUBFOLDER 1
54
#define SET_PROPERTIES_ALL_SUBFOLDER 2
55
void SetProperties(int mode)
56
{
5688 punk_joker 57
	char pcur_file[4096];
7593 leency 58
	dword i;
7422 leency 59
5688 punk_joker 60
 
7593 leency 61
62
 
63
		SetPropertiesFile(#file_path, #file_info_general);
64
	}
65
66
 
67
	|| (SET_PROPERTIES_NO_SUBFOLDER == mode)
68
	{
5688 punk_joker 69
		if (getSelectedCount())
8983 leency 70
		{
5688 punk_joker 71
			for (i=0; i
72
			{
73
				if (getElementSelectedFlag(i) == true)
6646 leency 74
				{
5688 punk_joker 75
					sprintf(#pcur_file,"%s/%s",path,items.get(i)*304+buf+72);
8949 leency 76
					SetPropertiesFile(#pcur_file, #file_info_general);
7593 leency 77
					if (SET_PROPERTIES_ALL_SUBFOLDER == mode) {
78
						if (dir_exists(#pcur_file)) SetPropertiesDir(#pcur_file);
79
					}
5688 punk_joker 80
				}
81
			}
82
		}
83
		else
84
		{
85
			SetPropertiesFile(#file_path, #file_info_general);
7244 leency 86
			if (SET_PROPERTIES_ALL_SUBFOLDER == mode) SetPropertiesDir(#file_path);
7593 leency 87
		}
5688 punk_joker 88
	}
89
7593 leency 90
 
5688 punk_joker 91
	OpenDir(ONLY_OPEN);
8956 leency 92
	ExitProcess();
5688 punk_joker 93
}
5554 punk_joker 94
5487 leency 95
 
6278 leency 96
{
5688 punk_joker 97
	apply_question_active = 1;
7593 leency 98
	DrawPopup(15,80,250,90,1,sc.work, sc.work_graph);
7806 leency 99
	WriteText(35, 102, 0x90, 0x000000, QUEST_1);
6280 punk_joker 100
	WriteText(65, 117, 0x90, 0x000000, QUEST_2);
101
	DrawStandartCaptButton(62,138,B_SETINGS_APPLY_SUBFOLDER,T_YES);
7593 leency 102
	DrawStandartCaptButton(155,138,B_SETINGS_APPLY_NO_SUBFOLDER,T_NO);
103
}
5688 punk_joker 104
105
 
5510 punk_joker 106
{
107
	char cur_file[4096];
108
	dword i;
7422 leency 109
5957 punk_joker 110
 
5510 punk_joker 111
	{
6646 leency 112
		if (getElementSelectedFlag(i) == true)
113
		{
114
			sprintf(#cur_file,"%s/%s",way,items.get(i)*304+buf+72);
7972 leency 115
			if (ESDWORD[items.get(i)*304+buf+32] & ATR_FOLDER )
8944 leency 116
			{
5510 punk_joker 117
				more_files_count.calculate_loop(#cur_file);
7369 leency 118
				more_files_count.folders++;
119
			}
5510 punk_joker 120
			else
121
			{
122
				GetFileInfo(#cur_file, #file_info_dirsize);
5957 punk_joker 123
				more_files_count.bytes += file_info_dirsize.sizelo;
7369 leency 124
				more_files_count.files++;
125
			}
5510 punk_joker 126
		}
6646 leency 127
	}
5510 punk_joker 128
}
129
130
 
5447 punk_joker 131
{
132
	int id;
7244 leency 133
5447 punk_joker 134
 
8983 leency 135
	{
5688 punk_joker 136
		more_files_count.get(NULL);
7369 leency 137
		GetSizeMoreFiles(path);
8949 leency 138
		ch_read_only.checked = 0;
7244 leency 139
		ch_hidden.checked = 0;
140
		ch_system.checked = 0;
141
	}
5688 punk_joker 142
	else
5510 punk_joker 143
	{
144
		GetFileInfo(#file_path, #file_info_general);
145
		edit_box_set_text stdcall (#file_name_ed, #file_name);
8336 leency 146
		if(itdir) dir_size.get(#file_path);
7369 leency 147
		ch_read_only.checked = file_info_general.readonly;
7244 leency 148
		ch_hidden.checked = file_info_general.hidden;
149
		ch_system.checked = file_info_general.system;
150
	}
5510 punk_joker 151
	edit_box_set_text stdcall (#path_to_file_ed, path);
8949 leency 152
5447 punk_joker 153
 
7227 leency 154
	loop() switch(WaitEvent())
5447 punk_joker 155
	{
156
		case evButton:
157
				id=GetButtonID();
158
				ch_read_only.click(id);
7244 leency 159
				ch_hidden.click(id);
160
				ch_system.click(id);
161
				if (apply_question_active)
7593 leency 162
				{
5688 punk_joker 163
					IF (id==B_SETINGS_APPLY_SUBFOLDER)
7593 leency 164
						SetProperties(SET_PROPERTIES_ALL_SUBFOLDER);
165
					IF (id==B_SETINGS_APPLY_NO_SUBFOLDER)
166
						SetProperties(SET_PROPERTIES_NO_SUBFOLDER);
167
					break;
5688 punk_joker 168
				}
169
				if (id==1) || (id==B_CLOSE)
7593 leency 170
				{
5591 pavelyakov 171
					cmd_free=3;
172
					ExitProcess();
173
				}
174
				if (id==B_APPLY) EventApplyProperties();
7593 leency 175
				break;
5447 punk_joker 176
177
 
178
				edit_box_mouse stdcall (#file_name_ed);
179
				edit_box_mouse stdcall (#path_to_file_ed);
180
				break;
181
182
 
183
				GetKeys();
5707 leency 184
7593 leency 185
 
186
				{
5688 punk_joker 187
					IF (key_scancode==SCAN_CODE_ENTER)
7593 leency 188
						SetProperties(SET_PROPERTIES_ALL_SUBFOLDER);
189
					IF (key_scancode==SCAN_CODE_ESC)
190
						SetProperties(SET_PROPERTIES_NO_SUBFOLDER);
191
					break;
5688 punk_joker 192
				}
193
7593 leency 194
 
195
				{
5591 pavelyakov 196
					case SCAN_CODE_ESC:
7593 leency 197
						cmd_free=3;
198
						ExitProcess();
199
						break;
200
201
 
202
						EventApplyProperties();
203
						break;
204
205
 
7914 leency 206
					case SCAN_CODE_KEY_C:
207
						if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) {
7605 leency 208
							EAX = key_editbox;
209
							edit_box_key stdcall(#file_name_ed);
210
							edit_box_key stdcall(#path_to_file_ed);
211
						}
212
				}
5591 pavelyakov 213
				break;
5447 punk_joker 214
215
 
216
				DrawPropertiesWindow();
5688 punk_joker 217
	}
218
}
219
5450 leency 220
 
5688 punk_joker 221
{
222
	proc_info pform;
7593 leency 223
	char element_size_label[32];
7369 leency 224
	char folder_info[200];
225
	dword ext1;
6757 leency 226
	dword element_size;
7369 leency 227
	incn y;
7244 leency 228
	char temp_path[sizeof(file_path)];
6757 leency 229
	DefineAndDrawWindow(Form.left + 150,150,315,360+skin_height,0x34,sc.work,WINDOW_TITLE_PROPERTIES,0);
7806 leency 230
	GetProcessInfo(#pform, SelfInfo);
7593 leency 231
7041 leency 232
 
7593 leency 233
	DrawStandartCaptButton(pform.cwidth -208, pform.cheight-34, B_APPLY, T_APPLY);
234
5688 punk_joker 235
 
7806 leency 236
	edit_box_draw stdcall (#path_to_file_ed);
7041 leency 237
238
 
7806 leency 239
7041 leency 240
 
8983 leency 241
	{
6403 punk_joker 242
		PropertiesDrawIcon(NULL, "");
7086 leency 243
		sprintf(#folder_info,"%s%d%s%d",SET_6,more_files_count.files,SET_7,more_files_count.folders);
7369 leency 244
		WriteText(file_name_ed.left+4, 30, 0x90, sc.work_text, #folder_info);
7806 leency 245
		sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(more_files_count.bytes, NULL),more_files_count.bytes,SET_BYTE_LANG);
7369 leency 246
		WriteText(120, 97, 0x90, sc.work_text, #element_size_label);
7806 leency 247
	}
7041 leency 248
	else
249
	{
250
		if ( file_info_general.isfolder )
251
				PropertiesDrawIcon(NULL, "");
252
		else {
253
			sprintf(#temp_path,"%s/%s",path,#file_name2);
8949 leency 254
			ext1 = strrchr(#file_name2,'.');
7041 leency 255
			if (ext1) ext1 += #file_name2;
256
			PropertiesDrawIcon(#temp_path, ext1);
257
		}
258
		WriteText(file_name_ed.left, file_name_ed.top-15, 0x80, sc.work_text, PR_T_NAME);
7806 leency 259
		DrawEditBox(#file_name_ed);
7227 leency 260
5688 punk_joker 261
 
7041 leency 262
		else
263
		{
5688 punk_joker 264
			WriteText(10,116, 0x90, sc.work_text, PR_T_CONTAINS);
7806 leency 265
			sprintf(#folder_info,"%s%d%s%d",SET_6,dir_size.files,SET_7,dir_size.folders);
7369 leency 266
			WriteText(120, 116, 0x90, sc.work_text, #folder_info);
7806 leency 267
			element_size = dir_size.bytes;
7369 leency 268
		}
5688 punk_joker 269
		WriteTextLines(10,  136, 0x90, sc.work_text, CREATED_OPENED_MODIFIED, 20);
7806 leency 270
		DrawDate(120,  136, sc.work_text, #file_info_general.datecreate);
271
		DrawDate(120, 156, sc.work_text, #file_info_general.datelastaccess);
272
		DrawDate(120, 176, sc.work_text, #file_info_general.datelastedit);
273
7041 leency 274
 
275
		WriteText(120, 99, 0x90, sc.work_text, #element_size_label);
7806 leency 276
	}
5447 punk_joker 277
	DrawFrame(10, 212, -10*2 + pform.cwidth - 2, 92, FLAGS);
7593 leency 278
	y.n = 212; //212 => attributes_frame.y
7244 leency 279
	ch_read_only.draw(24, y.inc(18));
280
	ch_hidden.draw(24, y.inc(24));
281
	ch_system.draw(24, y.inc(24));
282
	if (apply_question_active) ShowConfirmQuestionPopin();
7593 leency 283
}
5463 leency 284
285
 
7041 leency 286
{
287
	#define ICON_PADDING 11
7227 leency 288
	DrawBar(20-ICON_PADDING, 30-ICON_PADDING-1, ICON_PADDING*2+16, ICON_PADDING*2+16, 0xFFFfff);
289
	DrawIconByExtension(file_path, extension, -icon_size/2+28, -icon_size/2+38, 0xFFFfff);
7425 leency 290
}
7041 leency 291
7593 leency 292
 
293
{
294
	if (getSelectedCount()) || (itdir) {
8983 leency 295
		ShowConfirmQuestionPopin();
7593 leency 296
	} else {
297
		SetProperties(SET_PROPERTIES_SINGLE_FILE);
298
	}
299
}
300