Subversion Repositories Kolibri OS

Rev

Rev 7819 | Rev 7879 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7819 Rev 7878
Line 105... Line 105...
105
dword eolite_ini_path[4096];
105
dword eolite_ini_path[4096];
106
_ini ini;
106
_ini ini;
Line 107... Line 107...
107
 
107
 
Line 108... Line 108...
108
char scroll_used=false;
108
char scroll_used=false;
Line 109... Line 109...
109
 
109
 
110
dword about_stak,properties_stak,settings_stak,copy_stak,delete_stak;
110
dword about_stak=0,properties_stak=0,settings_stak=0,delete_stak=0;
111
 
111
 
112
proc_info Form;
112
proc_info Form;
Line 136... Line 136...
136
#include "include\translations.h"
136
#include "include\translations.h"
Line 137... Line 137...
137
 
137
 
138
#include "include\gui.h"
138
#include "include\gui.h"
139
#include "include\settings.h"
139
#include "include\settings.h"
140
#include "include\progress_dialog.h"
140
#include "include\progress_dialog.h"
141
#include "include\copy.h"
141
#include "include\copy_and_delete.h"
142
#include "include\sorting.h"
142
#include "include\sorting.h"
143
#include "include\icons.h"
143
#include "include\icons.h"
144
#include "include\left_panel.h"
144
#include "include\left_panel.h"
145
#include "include\menu.h"
-
 
146
#include "include\delete.h"
145
#include "include\menu.h"
147
#include "include\about.h"
146
#include "include\about.h"
148
#include "include\properties.h"
147
#include "include\properties.h"
Line 149... Line 148...
149
#include "include\breadcrumbs.h"
148
#include "include\breadcrumbs.h"
Line 154... Line 153...
154
	load_dll(libini, #lib_init,1);
153
	load_dll(libini, #lib_init,1);
155
	load_dll(libio,  #libio_init,1);
154
	load_dll(libio,  #libio_init,1);
156
	load_dll(libimg, #libimg_init,1);
155
	load_dll(libimg, #libimg_init,1);
157
}
156
}
Line -... Line 157...
-
 
157
 
-
 
158
void handle_param()
-
 
159
{
-
 
160
	//-p : just show file/folder properties dialog
-
 
161
	//-v : paste thread
-
 
162
	//-d : delete thread
-
 
163
	if (param) && (param[0]=='-') switch (param[1]) 
-
 
164
	{
-
 
165
		case 'p':
-
 
166
			strcpy(#file_path, #param + 3);
-
 
167
			strcpy(#file_name, #param + strrchr(#param, '/'));
-
 
168
			itdir = dir_exists(#file_path);
-
 
169
			properties_dialog();
-
 
170
			return;
-
 
171
		case 'v':
-
 
172
			cut_active = param[2] - '0';
-
 
173
			strcpy(#path, #param + 4);
-
 
174
			PasteThread();
-
 
175
			return;
-
 
176
		case 'd':
-
 
177
			strcpy(#file_path, #param + 3);
-
 
178
			itdir = dir_exists(#file_path);
-
 
179
			DisplayOperationForm(DELETE_FLAG);
-
 
180
			DeleteSingleElement();
-
 
181
			return;
-
 
182
	}
-
 
183
}
158
 
184
 
159
void main() 
185
void main() 
160
{
186
{
161
	dword id;
187
	dword id;
Line 167... Line 193...
167
	
193
	
168
	SetAppColors();
194
	SetAppColors();
169
	LoadIniSettings();
195
	LoadIniSettings();
Line 170... Line -...
170
	SystemDiscs.Get();
-
 
171
 
-
 
172
	//-p just show file/folder properties dialog
-
 
173
	if (param) && (param[0]=='-') && (param[1]=='p')
-
 
174
	{
-
 
175
		strcpy(#file_path, #param + 3);
-
 
176
		strcpy(#file_name, #param + strrchr(#param, '/'));
196
	SystemDiscs.Get();
177
		properties_dialog();
-
 
Line 178... Line 197...
178
		ExitProcess();	
197
 
Line 179... Line 198...
179
	}
198
	handle_param();
180
 
199
 
Line 298... Line 317...
298
//Button pressed-----------------------------------------------------------------------------
317
//Button pressed-----------------------------------------------------------------------------
299
		case evButton:
318
		case evButton:
300
			id=GetButtonID();
319
			id=GetButtonID();
Line 301... Line 320...
301
 
320
 
302
			if (new_element_active) || (del_active) {
321
			if (new_element_active) || (del_active) {
303
				if(POPUP_BTN1==id) || (POPUP_BTN2==id) {
-
 
304
					if (del_active) Del_File(id-POPUP_BTN2);
322
				if (POPUP_BTN1==id) && (del_active) EventDelete();
305
					if (new_element_active) NewElement(id-POPUP_BTN2);
-
 
306
					DeleteButton(POPUP_BTN1);
323
				if (POPUP_BTN1==id) && (new_element_active) NewElement();
307
					DeleteButton(POPUP_BTN2);
-
 
308
				}
324
				if (POPUP_BTN2==id) EventClosePopinForm();
309
				break;					
325
				break;					
Line 310... Line 326...
310
			}
326
			}
311
 
327
 
Line 327... Line 343...
327
						break;
343
						break;
328
				case 23:
344
				case 23:
329
						Dir_Up();
345
						Dir_Up();
330
						break;
346
						break;
331
				case 24:
347
				case 24:
332
						Copy(#file_path, CUT);
348
						EventCopy(CUT);
333
						break;
349
						break;
334
				case 25:
350
				case 25:
335
						Copy(#file_path, NOCUT);
351
						EventCopy(NOCUT);
336
						break;
352
						break;
337
				case 26:
353
				case 26:
338
						Paste();
354
						EventPaste();
339
						break;
355
						break;
340
				case 31...33:
356
				case 31...33:
341
						EventSort(id-30);
357
						EventSort(id-30);
342
						break;
358
						break;
343
				case 51:
359
				case 51:
Line 366... Line 382...
366
 
382
 
367
			if (new_element_active) || (del_active)
383
			if (new_element_active) || (del_active)
368
			{
384
			{
369
				if (del_active)
385
				if (del_active)
370
				{
386
				{
371
					if (key_scancode == SCAN_CODE_ENTER) Del_File(true);
387
					if (key_scancode == SCAN_CODE_ENTER) EventDelete();
372
					if (key_scancode == SCAN_CODE_ESC) Del_File(false);
388
					if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm();
373
				}
389
				}
374
				if (new_element_active)
390
				if (new_element_active)
375
				{
391
				{
376
					if (key_scancode == SCAN_CODE_ENTER) NewElement(true);
392
					if (key_scancode == SCAN_CODE_ENTER) NewElement();
377
					if (key_scancode == SCAN_CODE_ESC) NewElement(false);
393
					if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm();
378
					EAX = key_editbox;
394
					EAX = key_editbox;
379
					edit_box_key stdcall (#new_file_ed);
395
					edit_box_key stdcall (#new_file_ed);
380
				}
396
				}
381
				break;
397
				break;
Line 403... Line 419...
403
								pause(7);										
419
								pause(7);										
404
							}
420
							}
405
							SystemDiscs.Click(key_scancode);
421
							SystemDiscs.Click(key_scancode);
406
							break;
422
							break;
407
					case SCAN_CODE_KEY_X:
423
					case SCAN_CODE_KEY_X:
408
							Copy(#file_path, CUT);
424
							EventCopy(CUT);
409
							break;						
425
							break;						
410
					case SCAN_CODE_KEY_C:
426
					case SCAN_CODE_KEY_C:
411
							Copy(#file_path, NOCUT);
427
							EventCopy(NOCUT);
412
							break;
428
							break;
413
					case SCAN_CODE_KEY_G:
429
					case SCAN_CODE_KEY_G:
414
							EventOpenConsoleHere();
430
							EventOpenConsoleHere();
415
							break;
431
							break;
416
					case SCAN_CODE_KEY_V:
432
					case SCAN_CODE_KEY_V:
417
							Paste();
433
							EventPaste();
418
							break;
434
							break;
419
					case SCAN_CODE_KEY_D: //set image as bg
435
					case SCAN_CODE_KEY_D: //set image as bg
420
							strlcpy(#temp, "\\S__",4);
436
							strlcpy(#temp, "\\S__",4);
421
							strcat(#temp, #file_path);
437
							strcat(#temp, #file_path);
422
							RunProgram("/sys/media/kiv", #temp);
438
							RunProgram("/sys/media/kiv", #temp);
Line 483... Line 499...
483
			draw_window();
499
			draw_window();
484
			if (CheckActiveProcess(Form.ID)) && (GetMenuClick()) break;
500
			if (CheckActiveProcess(Form.ID)) && (GetMenuClick()) break;
485
			if (action_buf==OPERATION_END)
501
			if (action_buf==OPERATION_END)
486
			{
502
			{
487
				FnProcess(5);
503
				FnProcess(5);
488
				if (copy_stak) SelectFileByName(#copy_to+strrchr(#copy_to,'/'));
-
 
489
				action_buf=0;
504
				action_buf=0;
490
			}
505
			}
491
		break;
506
		break;
492
		default:
507
		default:
493
			if (Form.status_window>2) break;
508
			if (Form.status_window>2) break;
Line 497... Line 512...
497
	if(cmd_free)
512
	if(cmd_free)
498
	{
513
	{
499
		if(cmd_free==2) about_stak=free(about_stak);
514
		if(cmd_free==2) about_stak=free(about_stak);
500
		else if(cmd_free==3) properties_stak=free(properties_stak);
515
		else if(cmd_free==3) properties_stak=free(properties_stak);
501
		else if(cmd_free==4) settings_stak=free(settings_stak);
516
		else if(cmd_free==4) settings_stak=free(settings_stak);
502
		else if(cmd_free==5) copy_stak=free(copy_stak);
-
 
503
		else if(cmd_free==6) delete_stak=free(delete_stak);
517
		else if(cmd_free==6) delete_stak=free(delete_stak);
504
		cmd_free = false;
518
		cmd_free = false;
505
	}
519
	}
506
}
520
}
Line 951... Line 965...
951
	byte open_param[4097];
965
	byte open_param[4097];
952
	sprintf(#open_param,"~%s",#file_path);
966
	sprintf(#open_param,"~%s",#file_path);
953
	RunProgram("/sys/@open", #open_param);
967
	RunProgram("/sys/@open", #open_param);
954
}
968
}
Line 955... Line 969...
955
 
969
 
956
void NewElement(byte newf)
970
void NewElement()
957
{
971
{
958
	BDVK element_info;
972
	BDVK element_info;
-
 
973
	byte del_rezult, copy_rezult, info_result;
-
 
974
 
-
 
975
	sprintf(#temp,"%s/%s",#path,new_file_ed.text);
959
	byte del_rezult, copy_rezult, info_result;
976
	info_result = GetFileInfo(#temp, #element_info);
960
	if (newf)
977
	switch(new_element_active)
961
	{
-
 
962
		sprintf(#temp,"%s/%s",#path,new_file_ed.text);
978
	{
963
		info_result = GetFileInfo(#temp, #element_info);
979
		case CREATE_FILE:
964
		switch(new_element_active)
980
			if (info_result==5)
965
		{
981
			{
966
			case CREATE_FILE:
982
				CreateFile(0, 0, #temp);
967
				if (info_result==5)
983
				if (EAX)
968
				{
-
 
969
					CreateFile(0, 0, #temp);
-
 
970
					if (EAX)
-
 
971
					{
984
				{
972
						if (EAX==5) notify(NOT_CREATE_FILE);
985
					if (EAX==5) notify(NOT_CREATE_FILE);
973
						else Write_Error(EAX);
-
 
974
					}
986
					else Write_Error(EAX);
-
 
987
				}
975
				}
988
			}
-
 
989
			else
-
 
990
			{
-
 
991
				notify(FS_ITEM_ALREADY_EXISTS);
-
 
992
			}
-
 
993
			break;
-
 
994
		case CREATE_FOLDER:
-
 
995
			if (info_result==5)
-
 
996
			{
-
 
997
				CreateDir(#temp);
976
				else
998
				if (EAX)
977
				{
999
				{
-
 
1000
					if (EAX==5) notify(NOT_CREATE_FOLDER);
978
					notify(FS_ITEM_ALREADY_EXISTS);
1001
					else Write_Error(EAX);
-
 
1002
				}
-
 
1003
			}
-
 
1004
			else
-
 
1005
			{
-
 
1006
				notify(FS_ITEM_ALREADY_EXISTS);
979
				}
1007
			}
980
				break;
1008
			break;
981
			case CREATE_FOLDER:
1009
		case RENAME_ITEM:
-
 
1010
			if (info_result==5)
-
 
1011
			{
982
				if (info_result==5)
1012
				if (itdir)
983
				{
1013
				{
984
					CreateDir(#temp);
1014
					//rename only empty folders
985
					if (EAX)
1015
					if (del_rezult = DeleteFile(#file_path))
986
					{
1016
					{
987
						if (EAX==5) notify(NOT_CREATE_FOLDER);
1017
						Write_Error(del_rezult);
988
						else Write_Error(EAX);
1018
						return;
-
 
1019
					}
-
 
1020
					if (CreateDir(#temp)) CreateDir(#file_path);
-
 
1021
					Open_Dir(#path,WITH_REDRAW);
989
					}
1022
					SelectFileByName(new_file_ed.text);
990
				}
1023
				}
991
				else
1024
				else
992
				{
-
 
993
					notify(FS_ITEM_ALREADY_EXISTS);
-
 
994
				}
-
 
995
				break;
-
 
996
			case RENAME_ITEM:
1025
				{
997
				if (info_result==5)
-
 
998
				{
-
 
999
					if (itdir)
1026
					if (copy_rezult = CopyFile(#file_path,#temp))
1000
					{
-
 
1001
						//rename only empty folders
-
 
1002
						if (del_rezult = DeleteFile(#file_path))
-
 
1003
						{
1027
					{
1004
							Write_Error(del_rezult);
-
 
1005
							return;
-
 
1006
						}
-
 
1007
						if (CreateDir(#temp)) CreateDir(#file_path);
-
 
1008
						Open_Dir(#path,WITH_REDRAW);
-
 
1009
						SelectFileByName(new_file_ed.text);
1028
						Write_Error(copy_rezult);
1010
					}
1029
					}
1011
					else
1030
					else
1012
					{
-
 
1013
						if (copy_rezult = CopyFile(#file_path,#temp))
-
 
1014
						{
-
 
1015
							Write_Error(copy_rezult);
-
 
1016
						}
-
 
1017
						else
-
 
1018
						{
1031
					{
1019
							DeleteFile(#file_path);
1032
						DeleteFile(#file_path);
1020
							SelectFileByName(new_file_ed.text);
-
 
1021
						}
1033
						SelectFileByName(new_file_ed.text);
1022
					}
1034
					}
-
 
1035
				}
1023
				}
1036
			}
1024
				else
1037
			else
1025
				{
1038
			{
1026
					notify(FS_ITEM_ALREADY_EXISTS);
1039
				notify(FS_ITEM_ALREADY_EXISTS);
1027
				}
-
 
1028
		}
-
 
1029
		new_element_active = 0;
-
 
1030
		Open_Dir(#path,WITH_REDRAW);
-
 
1031
		SelectFileByName(new_file_ed.text);
1040
			}
1032
	}
-
 
1033
	new_element_active = 0;
1041
	}
-
 
1042
	Open_Dir(#path,WITH_REDRAW);
-
 
1043
	SelectFileByName(new_file_ed.text);
1034
	Open_Dir(#path,WITH_REDRAW);
1044
	EventClosePopinForm();
Line 1035... Line 1045...
1035
}
1045
}
1036
 
1046
 
1037
void NewElement_Form(byte crt, dword strng)
1047
void NewElement_Form(byte crt, dword strng)
Line 1091... Line 1101...
1091
			break;
1101
			break;
1092
		case 7:
1102
		case 7:
1093
			NewElement_Form(CREATE_FILE, T_NEW_FILE);
1103
			NewElement_Form(CREATE_FILE, T_NEW_FILE);
1094
			break;
1104
			break;
1095
		case 8:
1105
		case 8:
1096
			properties_stak = malloc(8096);
1106
			EventShowProperties();
1097
			CreateThread(#properties_dialog, properties_stak+8092);
-
 
1098
			break;
1107
			break;
1099
		case 10: //F10
1108
		case 10: //F10
1100
			if (!active_settings) 
1109
			if (!active_settings) 
1101
			{
1110
			{
1102
				settings_stak = malloc(4096);
1111
				settings_stak = malloc(4096);
Line 1251... Line 1260...
1251
			}
1260
			}
1252
		}
1261
		}
1253
	}
1262
	}
1254
}
1263
}
Line -... Line 1264...
-
 
1264
 
-
 
1265
void EventPaste() {
-
 
1266
	char paste_line[4096+6];
-
 
1267
	sprintf(#paste_line, "-v%i %s", cut_active, #path);
-
 
1268
	RunProgram(#program_path, #paste_line);
-
 
1269
	EventClosePopinForm();
-
 
1270
}
-
 
1271
 
-
 
1272
void EventDelete() 
-
 
1273
char line_param[4096+5];
-
 
1274
{
-
 
1275
	EventClosePopinForm();
-
 
1276
	if (!selected_count) {
-
 
1277
		sprintf(#line_param, "-d %s", #file_path);
-
 
1278
		RunProgram(#program_path, #line_param);
-
 
1279
	} else {
-
 
1280
		delete_stak = malloc(40000);
-
 
1281
		CreateThread(#DeleteSelectedElements,delete_stak+40000-4);
-
 
1282
	}
-
 
1283
}
-
 
1284
 
-
 
1285
void EventClosePopinForm()
-
 
1286
{
-
 
1287
	del_active=0;
-
 
1288
	new_element_active = 0;
-
 
1289
	draw_window();
-
 
1290
	DeleteButton(POPUP_BTN1);
-
 
1291
	DeleteButton(POPUP_BTN2);
-
 
1292
}
-
 
1293
 
-
 
1294
void EventShowProperties()
-
 
1295
char line_param[4096+5];
-
 
1296
{
-
 
1297
	if (!selected_count) {
-
 
1298
		sprintf(#line_param, "-p %s", #file_path);
-
 
1299
		RunProgram(#program_path, #line_param);
-
 
1300
	} else {
-
 
1301
		properties_stak = malloc(8096);
-
 
1302
		CreateThread(#properties_dialog, properties_stak+8092);
-
 
1303
	}
-
 
1304
}
1255
 
1305