Subversion Repositories Kolibri OS

Rev

Rev 7506 | Rev 7605 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7506 Rev 7593
Line 1... Line 1...
1
#ifdef LANG_RUS
1
#ifdef LANG_RUS
2
	?define WINDOW_TITLE_PROPERTIES "‘¢®©á⢠"
2
	?define WINDOW_TITLE_PROPERTIES "‘¢®©á⢠"
3
	?define BTN_CLOSE "‡ ªàëâì"
3
	?define T_CLOSE "‡ ªàëâì"
4
	?define BTN_APPLY "à¨¬¥­¨âì"
4
	?define T_APPLY "à¨¬¥­¨âì"
5
	?define QUEST_1 "à¨¬¥­¨âì ª® ¢á¥¬ ¢«®¦¥­­ë¬"
5
	?define QUEST_1 "à¨¬¥­¨âì ª® ¢á¥¬ ¢«®¦¥­­ë¬"
6
	?define QUEST_2 "ä ©« ¬ ¨ ¯ ¯ª ¬?"
6
	?define QUEST_2 "ä ©« ¬ ¨ ¯ ¯ª ¬?"
7
	?define PR_T_NAME "ˆ¬ï:"
7
	?define PR_T_NAME "ˆ¬ï:"
8
	?define PR_T_DEST " á¯®«®¦¥­¨¥:"
8
	?define PR_T_DEST " á¯®«®¦¥­¨¥:"
9
	?define PR_T_SIZE " §¬¥à:"
9
	?define PR_T_SIZE " §¬¥à:"
Line 16... Line 16...
16
	?define PR_T_SYSTEM "‘¨á⥬­ë©"
16
	?define PR_T_SYSTEM "‘¨á⥬­ë©"
17
	?define PR_T_ONLY_READ "’®«ìª® ç⥭¨¥"
17
	?define PR_T_ONLY_READ "’®«ìª® ç⥭¨¥"
18
	?define SET_BYTE_LANG "¡ ©â"
18
	?define SET_BYTE_LANG "¡ ©â"
19
#else // Apply to all subfolders
19
#else // Apply to all subfolders
20
	?define WINDOW_TITLE_PROPERTIES "Properties"
20
	?define WINDOW_TITLE_PROPERTIES "Properties"
21
	?define BTN_CLOSE "Close"
21
	?define T_CLOSE "Close"
22
	?define BTN_APPLY "Apply"
22
	?define T_APPLY "Apply"
23
	?define QUEST_1 "Apply to all subfolders"
23
	?define QUEST_1 "Apply to all subfolders"
24
	?define QUEST_2 "files and Folders?"
24
	?define QUEST_2 "files and Folders?"
25
	?define PR_T_NAME "Name:"
25
	?define PR_T_NAME "Name:"
26
	?define PR_T_DEST "Destination:"
26
	?define PR_T_DEST "Destination:"
27
	?define PR_T_SIZE "Size:"
27
	?define PR_T_SIZE "Size:"
Line 34... Line 34...
34
	?define PR_T_SYSTEM "System"
34
	?define PR_T_SYSTEM "System"
35
	?define PR_T_ONLY_READ "Read-only"
35
	?define PR_T_ONLY_READ "Read-only"
36
	?define SET_BYTE_LANG "byte"
36
	?define SET_BYTE_LANG "byte"
37
#endif
37
#endif
Line -... Line 38...
-
 
38
 
-
 
39
#define B_SETINGS_APPLY_SUBFOLDER 301
-
 
40
#define B_SETINGS_APPLY_NO_SUBFOLDER 302
-
 
41
#define B_APPLY 11
-
 
42
#define B_CLOSE 12
38
 
43
 
39
char path_to_file[4096];
44
char path_to_file[4096];
40
char file_name2[4096];
45
char file_name2[4096];
41
edit_box file_name_ed = {230,59,32,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(file_name2)-2,#file_name2,NULL, 0b,2,2};
46
edit_box file_name_ed = {230,59,32,0xffffff,0x94AECE,0xFFFfff,0xffffff,0x10000000,sizeof(file_name2)-2,#file_name2,NULL, 0b,2,2};
Line 42... Line 47...
42
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};
47
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};
43
 
48
 
Line 44... Line 49...
44
BDVK file_info_general;
49
BDVK file_info_general;
Line 45... Line 50...
45
BDVK file_info_dirsize;
50
BDVK file_info_dirsize;
Line 46... Line 51...
46
 
51
 
47
bool quest_active;
52
bool apply_question_active;
Line 84... Line 89...
84
		}
89
		}
85
		free(cur_file);
90
		free(cur_file);
86
	}
91
	}
87
}
92
}
Line -... Line 93...
-
 
93
 
-
 
94
#define SET_PROPERTIES_SINGLE_FILE 0
-
 
95
#define SET_PROPERTIES_NO_SUBFOLDER 1
88
 
96
#define SET_PROPERTIES_ALL_SUBFOLDER 2
89
void SetProperties(byte prop)
97
void SetProperties(int mode)
90
{
98
{
91
	dword cur_file;
99
	char pcur_file[4096];
Line 92... Line 100...
92
	dword i;
100
	dword i;
-
 
101
 
-
 
102
	apply_question_active=false;
-
 
103
 
-
 
104
	if (SET_PROPERTIES_SINGLE_FILE == mode) {
-
 
105
		SetPropertiesFile(#file_path, #file_info_general);
-
 
106
	}
-
 
107
 
93
 
108
	if (SET_PROPERTIES_ALL_SUBFOLDER == mode)
94
	if (prop==1) || (prop==2)
109
	|| (SET_PROPERTIES_NO_SUBFOLDER == mode)
95
	{
110
	{
96
		if (selected_count)
-
 
97
		{
111
		if (selected_count)
98
			cur_file = malloc(4096);
112
		{
99
			for (i=0; i
113
			for (i=0; i
100
			{
114
			{
101
				if (getElementSelectedFlag(i) == true) 
-
 
102
				{
115
				if (getElementSelectedFlag(i) == true) 
103
					strcpy(cur_file, #path);
116
				{
104
					strcat(cur_file, file_mas[i]*304+buf+72);
-
 
105
					SetPropertiesDir(cur_file);
-
 
106
					if (prop==2)
117
					sprintf(#pcur_file,"%s/%s",#path,file_mas[i]*304+buf+72);
107
					{
-
 
108
						if (dir_exists(cur_file))
118
					SetPropertiesFile(#pcur_file, #file_info_general);
109
						{
-
 
110
							SetPropertiesDir(cur_file);
119
					if (SET_PROPERTIES_ALL_SUBFOLDER == mode) {
111
						}
120
						if (dir_exists(#pcur_file)) SetPropertiesDir(#pcur_file);
112
					}
121
					}
113
				}
-
 
114
			}
122
				}
115
			free(cur_file);
123
			}
116
		}
124
		}
117
		else
125
		else
118
		{
126
		{
119
			SetPropertiesFile(#file_path, #file_info_general);
-
 
120
			if (prop==2) SetPropertiesDir(#file_path);
-
 
121
		}
-
 
122
		quest_active = 0;
127
			SetPropertiesFile(#file_path, #file_info_general);
123
		DrawPropertiesWindow();
-
 
124
	}
-
 
125
	else
-
 
126
	{
128
			if (SET_PROPERTIES_ALL_SUBFOLDER == mode) SetPropertiesDir(#file_path);
-
 
129
		}
127
		SetPropertiesFile(#file_path, #file_info_general);
130
	}
128
	}
131
 
129
	cmd_free=3;
132
	cmd_free=3;
130
	_not_draw = true;
133
	_not_draw = true;
131
	Open_Dir(#path,WITH_REDRAW);
134
	Open_Dir(#path,WITH_REDRAW);
132
	_not_draw = false;
135
	_not_draw = false;
133
	EventRedrawWindow(Form.left,Form.top);
136
	EventRedrawWindow(Form.left,Form.top);
Line 134... Line 137...
134
	ExitProcess();
137
	ExitProcess();
135
}
138
}
136
 
139
 
137
void ShowConfirmQuestionPopin()
140
void ShowConfirmQuestionPopin()
138
{
141
{
139
	quest_active = 1;
142
	apply_question_active = 1;
140
	DrawPopup(15,80,250,90,1,system.color.work, system.color.work_graph);
143
	DrawPopup(15,80,250,90,1,system.color.work, system.color.work_graph);
141
	WriteText(35, 102, 0x90, 0x000000, QUEST_1);
144
	WriteText(35, 102, 0x90, 0x000000, QUEST_1);
142
	WriteText(65, 117, 0x90, 0x000000, QUEST_2);
145
	WriteText(65, 117, 0x90, 0x000000, QUEST_2);
Line 143... Line 146...
143
	DrawStandartCaptButton(62,138,301,T_YES);
146
	DrawStandartCaptButton(62,138,B_SETINGS_APPLY_SUBFOLDER,T_YES);
144
	DrawStandartCaptButton(155,138,302,T_NO);
147
	DrawStandartCaptButton(155,138,B_SETINGS_APPLY_NO_SUBFOLDER,T_NO);
145
}
148
}
Line 200... Line 203...
200
		case evButton: 
203
		case evButton: 
201
				id=GetButtonID();
204
				id=GetButtonID();
202
				ch_read_only.click(id);
205
				ch_read_only.click(id);
203
				ch_hidden.click(id);
206
				ch_hidden.click(id);
204
				ch_system.click(id);
207
				ch_system.click(id);
205
				if (quest_active)
208
				if (apply_question_active)
206
				{
209
				{
207
					IF (id==301) SetProperties(2);
210
					IF (id==B_SETINGS_APPLY_SUBFOLDER) 
-
 
211
						SetProperties(SET_PROPERTIES_ALL_SUBFOLDER);
208
					IF (id==302) SetProperties(1);
212
					IF (id==B_SETINGS_APPLY_NO_SUBFOLDER) 
209
					quest_active=false;
213
						SetProperties(SET_PROPERTIES_NO_SUBFOLDER);
210
					break;
214
					break;
211
				}
215
				}
212
				if (id==1) || (id==10)
216
				if (id==1) || (id==B_CLOSE)
213
				{
217
				{
214
					cmd_free=3;
218
					cmd_free=3;
215
					ExitProcess();
219
					ExitProcess();
216
				}
220
				}
217
				IF (id==11) 
-
 
218
				{
-
 
219
					if (selected_count) || (itdir)
-
 
220
					{
-
 
221
						ShowConfirmQuestionPopin();
-
 
222
					}
-
 
223
					else 
-
 
224
					{
-
 
225
						SetProperties(0);
221
				if (id==B_APPLY) EventApplyProperties();
226
					}
-
 
227
					break;
-
 
228
				}
-
 
229
				break;
222
				break;
Line 230... Line 223...
230
				
223
				
231
		case evMouse:
224
		case evMouse:
232
				edit_box_mouse stdcall (#file_name_ed);
225
				edit_box_mouse stdcall (#file_name_ed);
233
				edit_box_mouse stdcall (#path_to_file_ed);
226
				edit_box_mouse stdcall (#path_to_file_ed);
Line 234... Line 227...
234
				break;
227
				break;
235
			
228
			
Line 236... Line 229...
236
		case evKey:
229
		case evKey:
237
				GetKeys();
230
				GetKeys();
238
				
231
 
-
 
232
				if (apply_question_active)
239
				if (quest_active)
233
				{
240
				{
234
					IF (key_scancode==SCAN_CODE_ENTER) 
241
					IF (key_scancode==SCAN_CODE_ENTER) SetProperties(2);
235
						SetProperties(SET_PROPERTIES_ALL_SUBFOLDER);
242
					IF (key_scancode==SCAN_CODE_ESC) SetProperties(1);
236
					IF (key_scancode==SCAN_CODE_ESC) 
-
 
237
						SetProperties(SET_PROPERTIES_NO_SUBFOLDER);
243
					quest_active=false;
238
					break;
244
					break;
239
				}
-
 
240
 
245
				}
241
				switch(key_scancode)
246
				if (key_scancode==SCAN_CODE_ESC)
242
				{
247
				{
-
 
248
					cmd_free=3;
-
 
249
					ExitProcess();
-
 
250
				}
-
 
251
				if (key_scancode==SCAN_CODE_ENTER)
-
 
252
				{
-
 
253
					if (selected_count) || (itdir)
-
 
254
					{
-
 
255
						ShowConfirmQuestionPopin();
-
 
256
					}
-
 
257
					else 
-
 
258
					{
243
					case SCAN_CODE_ESC:
-
 
244
						cmd_free=3;
-
 
245
						ExitProcess();
-
 
246
						break;
259
						SetProperties(0);
247
 
-
 
248
					case SCAN_CODE_ENTER:
-
 
249
						EventApplyProperties();
260
					}
250
						break;
261
					break;
251
 
-
 
252
					default:
262
				}
253
						edit_box_key stdcall(#file_name_ed);
Line 263... Line 254...
263
				edit_box_key stdcall(#file_name_ed);
254
						edit_box_key stdcall(#path_to_file_ed);
264
				edit_box_key stdcall(#path_to_file_ed);
255
				}
265
				break;
256
				break;
266
				
257
				
Line 267... Line 258...
267
		case evReDraw:
258
		case evReDraw:
268
				DrawPropertiesWindow();
259
				DrawPropertiesWindow();
269
	}
260
	}
270
}
261
}
271
 
262
 
272
void DrawPropertiesWindow()
263
void DrawPropertiesWindow()
273
{
264
{
274
	proc_info settings_form;
265
	proc_info pform;
275
	char element_size_label[32];
266
	char element_size_label[32];
276
	char folder_info[200];
267
	char folder_info[200];
277
	dword ext1;
268
	dword ext1;
Line 278... Line 269...
278
	dword element_size;
269
	dword element_size;
279
	incn y;
270
	incn y;
Line 280... Line 271...
280
	char temp_path[sizeof(file_path)];
271
	char temp_path[sizeof(file_path)];
281
	DefineAndDrawWindow(Form.left + 150,150,315,360+skin_height,0x34,system.color.work,WINDOW_TITLE_PROPERTIES,0);
272
	DefineAndDrawWindow(Form.left + 150,150,315,360+skin_height,0x34,system.color.work,WINDOW_TITLE_PROPERTIES,0);
Line 282... Line 273...
282
	GetProcessInfo(#settings_form, SelfInfo);
273
	GetProcessInfo(#pform, SelfInfo);
Line 324... Line 315...
324
		DrawDate(120, 176, system.color.work_text, #file_info_general.datelastedit);
315
		DrawDate(120, 176, system.color.work_text, #file_info_general.datelastedit);
Line 325... Line 316...
325
 
316
 
326
		sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(element_size, NULL),element_size,SET_BYTE_LANG);
317
		sprintf(#element_size_label,"%s (%d %s)",ConvertSize64(element_size, NULL),element_size,SET_BYTE_LANG);
327
		WriteText(120, 99, 0x90, system.color.work_text, #element_size_label);
318
		WriteText(120, 99, 0x90, system.color.work_text, #element_size_label);
328
	}
319
	}
329
	DrawFrame(10, 212, -10*2 + settings_form.cwidth - 2, 92, FLAGS);
320
	DrawFrame(10, 212, -10*2 + pform.cwidth - 2, 92, FLAGS);
330
	y.n = 212; //212 => attributes_frame.y
321
	y.n = 212; //212 => attributes_frame.y
331
	ch_read_only.draw(24, y.inc(18));
322
	ch_read_only.draw(24, y.inc(18));
332
	ch_hidden.draw(24, y.inc(24));
323
	ch_hidden.draw(24, y.inc(24));
-
 
324
	ch_system.draw(24, y.inc(24));
333
	ch_system.draw(24, y.inc(24));
325
	if (apply_question_active) ShowConfirmQuestionPopin();
Line 334... Line 326...
334
}
326
}
335
 
327
 
336
void PropertiesDrawIcon(dword file_path, extension)
328
void PropertiesDrawIcon(dword file_path, extension)
337
{
329
{
338
	#define ICON_PADDING 11
330
	#define ICON_PADDING 11
339
	DrawBar(20-ICON_PADDING, 30-ICON_PADDING-1, ICON_PADDING*2+16, ICON_PADDING*2+16, 0xFFFfff);
331
	DrawBar(20-ICON_PADDING, 30-ICON_PADDING-1, ICON_PADDING*2+16, ICON_PADDING*2+16, 0xFFFfff);
-
 
332
	DrawIconByExtension(file_path, extension, -icon_size/2+28, -icon_size/2+38, 0xFFFfff);
-
 
333
}
-
 
334
 
-
 
335
void EventApplyProperties()
-
 
336
{
-
 
337
	if (selected_count) || (itdir) {
-
 
338
		ShowConfirmQuestionPopin();
-
 
339
	} else {
-
 
340
		SetProperties(SET_PROPERTIES_SINGLE_FILE);
340
	DrawIconByExtension(file_path, extension, -icon_size/2+28, -icon_size/2+38, 0xFFFfff);
341
	}