Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
5481 leency 1
//Leency, Veliant, Punk_Joker & KolibriOS Team 2008-2015
3363 leency 2
//GNU GPL licence.
3
 
4022 leency 4
#ifndef AUTOBUILD
5
#include "lang.h--"
6
#endif
7
 
3363 leency 8
//libraries
5676 pavelyakov 9
#define MEMSIZE 500000
4427 punk_joker 10
#include "..\lib\clipboard.h"
3363 leency 11
#include "..\lib\strings.h"
12
#include "..\lib\mem.h"
13
#include "..\lib\file_system.h"
5499 leency 14
#include "..\lib\gui.h"
3434 leency 15
#include "..\lib\list_box.h"
16
#include "..\lib\copyf.h"
4863 leency 17
#include "..\lib\random.h"
5487 leency 18
//obj
5499 leency 19
#include "..\lib\obj\libini.h"
20
#include "..\lib\obj\box_lib.h"
3363 leency 21
//images
22
#include "imgs\toolbar.txt"
23
#include "imgs\left_p.txt"
4846 leency 24
#include "imgs\icons.txt"
3363 leency 25
 
3848 punk_joker 26
#ifdef LANG_RUS
5623 leency 27
	?define T_FILE "Файл"
28
	?define T_TYPE "Тип"
29
	?define T_SIZE "Размер"
30
	?define T_NEW_FOLDER "Новая папка"
31
	?define T_NEW_FILE "Новый файл"
32
	?define T_DELETE_FILE "Вы действительно хотите удалить"
33
	?define T_YES "Да"
34
	?define T_NO "Нет"
35
	?define T_CANCEL "Отмена"
36
	?define T_CREATE "Создать"
37
	?define T_RENAME "Переименовать"
38
	?define FS_ITEM_ALREADY_EXISTS "'Элемент с таким именем уже существует' -E"
39
	?define T_DEL_ERROR_1 "Ошибка. Папка не пустая."
40
	?define WAIT_DELETING_FOLDER "Удаляется папка. Подожите..."
41
	?define NOT_CREATE_FOLDER "Не удалось создать папку."
42
	?define NOT_CREATE_FILE "Не удалось создать файл."
43
	?define T_PASTE_WINDOW_TITLE "Копирую..."
44
	?define T_PASTE_WINDOW_TEXT "Копируется файл:"
45
	?define T_PASTE_WINDOW_BUTTON "Прервать"
46
	?define INFO_AFTER_COPY "Копирование завершено"
47
	?define T_CANCEL_PASTE "Копирование прекращено. Папка скопирована не полностью."
48
	?define T_SELECT_APP_TO_OPEN_WITH "Выберите программу для открытия файла"
49
	?define DEL_MORE_FILES_1 "выбранные элементы ("
50
	?define DEL_MORE_FILES_2 " шт.)?"
3933 kaitz 51
#elif LANG_EST
52
	?define T_FILE "Fail"
5620 leency 53
	?define T_TYPE "TтДЦтДЦp"
3933 kaitz 54
	?define T_SIZE "Suurus"
55
	?define T_NEW_FOLDER "Uus kataloog"
56
	?define T_NEW_FILE "Uus fail"
5620 leency 57
	?define T_DELETE_FILE "Kas sa tahad t╤Чesti kustutada"
3933 kaitz 58
	?define T_YES "Jah"
59
	?define T_NO "Ei"
5556 punk_joker 60
	?define T_CANCEL "Cancel"
61
	?define T_CREATE "Create"
5571 punk_joker 62
	?define T_RENAME "Rename"
5620 leency 63
	?define FS_ITEM_ALREADY_EXISTS "'An item with that name already exists' -E"
64
	?define T_DEL_ERROR_1 "Viga. Kataloog ei ole tтДЦhi."
3997 leency 65
	?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
3933 kaitz 66
	?define NOT_CREATE_FOLDER "Kataloogi ei saa luua."
67
	?define NOT_CREATE_FILE "Faili ei saa luua."
5514 leency 68
	?define T_PASTE_WINDOW_TITLE "Kopeerin..."
3933 kaitz 69
	?define T_PASTE_WINDOW_TEXT "Kopeerin faili:"
5514 leency 70
	?define T_PASTE_WINDOW_BUTTON "Abort"
71
	?define INFO_AFTER_COPY "Copy finished"
4022 leency 72
	?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
4049 leency 73
	?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file"
5514 leency 74
	?define DEL_MORE_FILES_1 "selected items("
75
	?define DEL_MORE_FILES_2 " pcs.)?"
3848 punk_joker 76
#else
77
	?define T_FILE "File"
78
	?define T_TYPE "Type"
79
	?define T_SIZE "Size"
80
	?define T_NEW_FOLDER "New folder"
81
	?define T_NEW_FILE "New file"
82
	?define T_DELETE_FILE "Do you really want to delete"
83
	?define T_YES "Yes"
84
	?define T_NO "No"
5556 punk_joker 85
	?define T_CANCEL "Cancel"
86
	?define T_CREATE "Create"
5571 punk_joker 87
	?define T_RENAME "Rename"
5620 leency 88
	?define FS_ITEM_ALREADY_EXISTS "'An item with that name already exists' -E"
3848 punk_joker 89
	?define T_DEL_ERROR_1 "Error. Folder isn't empty."
3997 leency 90
	?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
3848 punk_joker 91
	?define NOT_CREATE_FOLDER "Folder can not be created."
92
	?define NOT_CREATE_FILE "File can not be created."
5514 leency 93
	?define T_PASTE_WINDOW_TITLE "Copying..."
3883 leency 94
	?define T_PASTE_WINDOW_TEXT "Copying file:"
5514 leency 95
	?define T_PASTE_WINDOW_BUTTON "Abort"
96
	?define INFO_AFTER_COPY "Copy finished"
4022 leency 97
	?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
4049 leency 98
	?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file"
5514 leency 99
	?define DEL_MORE_FILES_1 "selected items("
100
	?define DEL_MORE_FILES_2 " pcs.)?"
3848 punk_joker 101
#endif
102
 
3444 leency 103
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
5581 leency 104
enum { CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement
3444 leency 105
 
5694 leency 106
#define TITLE "Eolite File Manager v3.0 beta"
107
#define ABOUT_TITLE "Eolite 3.0 beta"
4076 leency 108
dword col_padding, col_selec, col_lpanel;
3363 leency 109
 
3434 leency 110
int toolbar_buttons_x[7]={9,46,85,134,167,203};
111
struct path_string { char Item[4096]; };
3363 leency 112
 
4136 punk_joker 113
byte active_about=0;
4070 punk_joker 114
word about_window;
5416 punk_joker 115
byte active_settings=0;
116
word settings_window;
5606 pavelyakov 117
dword _not_draw = false;
4136 punk_joker 118
byte menu_call_mouse=0;
119
 
3434 leency 120
llist files;
121
 
5694 leency 122
byte list_full_redraw;
123
 
3434 leency 124
byte
3363 leency 125
	path[4096],
126
	file_path[4096],
3404 leency 127
	file_name[256],
5555 punk_joker 128
	new_element_name[256],
3434 leency 129
	temp[4096];
130
byte
3439 leency 131
	del_active=0,
5555 punk_joker 132
	new_element_active=0,
4399 punk_joker 133
	show_dev_name=1,
4225 punk_joker 134
	real_files_names_case=0,
5532 leency 135
	use_big_fonts=0,
136
	font_type,
5687 leency 137
	font_h,
5459 punk_joker 138
	info_after_copy=0,
3434 leency 139
	sort_num=2,
3441 leency 140
	itdir;
3363 leency 141
 
5441 leency 142
dword eolite_ini_path;
143
 
5608 leency 144
dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak;
145
 
3363 leency 146
proc_info Form;
5694 leency 147
int mouse_dd, sc_slider_h, sorting_arrow_x, kolibrios_drive;
4897 leency 148
dword buf;
3434 leency 149
dword file_mas[6898];
150
int j, i;
4028 leency 151
int action_buf;
4863 leency 152
int rand_n;
5513 punk_joker 153
int selected_count;
5591 pavelyakov 154
byte CMD_REFRESH;
3363 leency 155
 
5549 punk_joker 156
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
157
 
5694 leency 158
 
5557 punk_joker 159
edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xFFFFFF,0,248,#file_name,#mouse_dd,64,6,6};
5581 leency 160
edit_box new_file_ed = {171,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0,248,#new_element_name,#mouse_dd,100000000000010b,6,0};
3434 leency 161
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
3363 leency 162
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
5694 leency 163
byte cmd_free=0;
4042 leency 164
#include "include\copy.h"
5435 leency 165
#include "include\gui.h"
3363 leency 166
#include "include\sorting.h"
4042 leency 167
#include "include\icons.h"
3363 leency 168
#include "include\left_panel.h"
169
#include "include\history.h"
4042 leency 170
#include "include\menu.h"
171
#include "include\about.h"
5416 punk_joker 172
#include "include\settings.h"
5447 punk_joker 173
#include "include\properties.h"
3363 leency 174
 
5576 pavelyakov 175
 
3363 leency 176
void main()
177
{
5694 leency 178
	word key, id;
179
	char can_show, can_select, scroll_used, stats;
4897 leency 180
	dword selected_offset;
5591 pavelyakov 181
	dword IPC_LEN,IPC_ID;
182
	char IPC_BUF[10];
183
	dword tmp;
4863 leency 184
	rand_n = random(40);
5651 pavelyakov 185
 
5626 leency 186
	load_dll(boxlib, #box_lib_init,0);
187
    load_dll(libini, #lib_init,1);
5441 leency 188
	eolite_ini_path = abspath("Eolite.ini");
189
	LoadIniSettings();
190
	GetSystemDiscs();
4076 leency 191
	SetAppColors();
3363 leency 192
	if (param)
193
	{
5591 pavelyakov 194
		tmp = strlen(#path);
5657 pavelyakov 195
		strlcpy(#path, #param, tmp);
5591 pavelyakov 196
		$dec tmp
197
		if (path[tmp]!='/') DSBYTE[#path+tmp] = '/'; //add "/" to the end of the string
3363 leency 198
	}
199
	else
3695 leency 200
	{
5657 pavelyakov 201
		strlcpy(#path, "/rd/1/", 6);
3695 leency 202
	}
3363 leency 203
	Open_Dir(#path,ONLY_OPEN);
5606 pavelyakov 204
	SetEventMask(1100111b);
5591 pavelyakov 205
	loop(){
206
		switch(WaitEvent())
207
		{
208
			case evMouse:
209
				if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break;
210
				if (new_element_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2)
211
				{
212
					edit_box_mouse stdcall(#new_file_ed);
213
					break;
214
				}
5549 punk_joker 215
 
5640 pavelyakov 216
				mouse.get();
5591 pavelyakov 217
 
5640 pavelyakov 218
				if (!mouse.mkm) && (stats>0) stats = 0;
5657 pavelyakov 219
				if (mouse.mkm) && (!stats)
5549 punk_joker 220
				{
5640 pavelyakov 221
					x_old = mouse.x;
222
					y_old = mouse.y;
5591 pavelyakov 223
					stats = 1;
224
				}
5640 pavelyakov 225
				if (mouse.mkm) && (stats==1)
5591 pavelyakov 226
				{
5640 pavelyakov 227
					dif_x = mouse.x-x_old;
228
					dif_y = mouse.y-y_old;
5591 pavelyakov 229
					adif_x = fabs(dif_x);
230
					adif_y = fabs(dif_y);
231
 
232
					if (adif_x>adif_y)
5549 punk_joker 233
					{
5591 pavelyakov 234
						if (dif_x > 150)
235
						{
236
							if (HistoryPath(GO_FORWARD))
237
								{
5694 leency 238
									files.KeyHome();
5591 pavelyakov 239
									Open_Dir(#path,WITH_REDRAW);
240
								}
241
							stats = 0;
242
						}
243
						if (dif_x < -150)
244
						{
245
							GoBack();
246
							stats = 0;
247
						}
5549 punk_joker 248
					}
5591 pavelyakov 249
					else
5549 punk_joker 250
					{
5591 pavelyakov 251
						if (dif_y < -100)
252
						{
253
							Dir_Up();
254
							stats = 0;
255
						}
5549 punk_joker 256
					}
5591 pavelyakov 257
				}
5658 pavelyakov 258
				if (files.MouseOver(mouse.x, mouse.y))&&((mouse.down|mouse.dblclick|mouse.up))
5549 punk_joker 259
				{
5591 pavelyakov 260
					//select/open file {
5640 pavelyakov 261
					if (mouse.key&MOUSE_LEFT)&&((mouse.down)||(mouse.dblclick))
5549 punk_joker 262
					{
5640 pavelyakov 263
						if (mouse.y>=files.y)//&&(mouse.click)
5591 pavelyakov 264
						{
5694 leency 265
							id = mouse.y - files.y / files.line_h + files.first;
266
							if (files.current!=id)
5591 pavelyakov 267
							{
5640 pavelyakov 268
								mouse.clearTime();
5694 leency 269
								if(!mouse.up)&&(id-files.first
270
									files.current = id;
271
									List_ReDraw();
272
								}
5591 pavelyakov 273
							}
5658 pavelyakov 274
							else IF(mouse.dblclick)Open(0);
5591 pavelyakov 275
						}
5549 punk_joker 276
					}
5591 pavelyakov 277
					// } select/open file
278
					else
279
					//file menu {
5640 pavelyakov 280
					if (mouse.key&MOUSE_RIGHT)&&(mouse.up)
5575 pavelyakov 281
					{
5591 pavelyakov 282
						menu_call_mouse = 1;
5694 leency 283
 
284
						if (files.MouseOver(mouse.x, mouse.y))
5575 pavelyakov 285
						{
5694 leency 286
							files.current = mouse.y - files.y / files.line_h + files.first;
5591 pavelyakov 287
							menu_stak = malloc(4096);
5694 leency 288
							CreateThread(#FileMenu,menu_stak+4092);
5575 pavelyakov 289
						}
5591 pavelyakov 290
						break;
5575 pavelyakov 291
					}
5591 pavelyakov 292
					// } file menu
5575 pavelyakov 293
				}
5591 pavelyakov 294
 
5640 pavelyakov 295
				if (mouse.vert)
5575 pavelyakov 296
				{
5640 pavelyakov 297
					if (files.MouseScroll(mouse.vert)) List_ReDraw();
5591 pavelyakov 298
					break;
299
				}
300
 
5640 pavelyakov 301
				if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>40) && (mouse.y
5591 pavelyakov 302
				{
5640 pavelyakov 303
					if (mouse.lkm==1) DrawRectangle3D(Form.cwidth - 17,41,14,14,0xC7C7C7,0xFFFFFF);
304
					WHILE (mouse.lkm==1) && (files.first>0)
5575 pavelyakov 305
					{
5591 pavelyakov 306
						pause(8);
307
						files.first--;
308
						List_ReDraw();
5640 pavelyakov 309
						mouse.get();
5575 pavelyakov 310
					}
5591 pavelyakov 311
					DrawRectangle3D(Form.cwidth - 17,41,14,14,0xFFFFFF,0xC7C7C7);
5575 pavelyakov 312
				}
3363 leency 313
 
5640 pavelyakov 314
				if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>onTop(22,0)+1) && (mouse.y
3363 leency 315
				{
5640 pavelyakov 316
					if (mouse.lkm==1) DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xC7C7C7,0xFFFFFF);
317
					while (mouse.lkm==1) && (files.first
5591 pavelyakov 318
					{
319
						pause(8);
320
						files.first++;
321
						List_ReDraw();
5640 pavelyakov 322
						mouse.get();
5591 pavelyakov 323
					}
324
					DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xFFFFFF,0xC7C7C7);
3363 leency 325
				}
326
 
5591 pavelyakov 327
				//Scrooll
5640 pavelyakov 328
				if (!mouse.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); }
329
				if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>56) && (mouse.y
5591 pavelyakov 330
 
331
				if (scroll_used)
3363 leency 332
				{
5640 pavelyakov 333
					if (sc_slider_h/2+files.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=sc_slider_h/2+files.y; //anee eo?ni? iaa ieiii
5591 pavelyakov 334
					id=files.first;
335
					j= sc_slider_h/2;
5640 pavelyakov 336
					files.first = mouse.y -j -files.y * files.count;
5591 pavelyakov 337
					files.first /= onTop(22,files.y);
338
					if (files.visible+files.first>files.count) files.first=files.count-files.visible;
339
					if (id!=files.first) List_ReDraw();
3363 leency 340
				}
5591 pavelyakov 341
				break;
342
	//Button pressed-----------------------------------------------------------------------------
343
			case evButton:
344
				id=GetButtonID();
345
				if (id==1)
346
				{
347
					KillProcess(about_window);
348
					ExitProcess();
349
				}
350
				if (del_active)
351
				{
352
					if (id==301) || (id==302) Del_File(302-id);
353
					break;
354
				}
355
				if (new_element_active)
356
				{
357
					if (id==301) || (id==302) NewElement(302-id);
358
					break;
359
				}
360
 
361
				switch(id)
362
				{
363
					case 21: //Back
364
							GoBack();
365
							break;
366
					case 22: //Forward
367
							if (HistoryPath(GO_FORWARD))
368
							{
5694 leency 369
								files.KeyHome();
5591 pavelyakov 370
								Open_Dir(#path,WITH_REDRAW);
371
							}
372
							break;
5608 leency 373
					case 23:
3363 leency 374
							Dir_Up();
375
							break;
5608 leency 376
					case 24:
3444 leency 377
							Copy(#file_path, CUT);
378
							break;
5608 leency 379
					case 25:
3444 leency 380
							Copy(#file_path, NOCUT);
3363 leency 381
							break;
5608 leency 382
					case 26:
383
							Paste();
3363 leency 384
							break;
5591 pavelyakov 385
					case 31...33: //sort
386
							if(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10);
387
							if(sort_num==2) DrawFilledBar(sorting_arrow_x,42,6,10);
388
							if(sort_num==3) DrawFilledBar(sorting_arrow_x,42,6,10);
389
							sort_num=id-30;
390
							Open_Dir(#path,WITH_REDRAW);
5512 punk_joker 391
							break;
5591 pavelyakov 392
					case 50...60: //Actions
393
							FnProcess(id-50);
5512 punk_joker 394
							break;
5591 pavelyakov 395
					case 100...120:
396
						DEVICE_MARK:
397
							DrawRectangle(17,id-100*16+74,159,16, 0); //auaaeaiea
398
							strcpy(#path, #disk_list[id-100].Item);
5694 leency 399
							files.KeyHome();
5591 pavelyakov 400
							Open_Dir(#path,WITH_REDRAW);
401
							pause(5);
402
							DrawRectangle(17,id-100*16+74,159,16, 0xFFFFFF);
3363 leency 403
							break;
5591 pavelyakov 404
				}
405
				break;
406
	//Key pressed-----------------------------------------------------------------------------
407
			case evKey:
408
				key = GetKey();
409
				if (Form.status_window>2) break;
410
				if (del_active)
411
				{
412
					if (key==013) Del_File(true);
413
					if (key==027) Del_File(false);
414
					break;
415
				}
416
				if (new_element_active)
417
				{
418
					if (key==027) NewElement(0);
419
					if (key==013) NewElement(1);
420
					EAX=key<<8;
421
					edit_box_key stdcall (#new_file_ed);
422
					break;
423
				}
424
				if (edit2.flags!=64) && (key!=13) && (key!=27)
425
				{
426
					EAX=key<<8;
427
					edit_box_key stdcall (#edit2);
428
					break;
429
				}
5694 leency 430
				if (files.ProcessKey(key))
431
				{
432
					List_ReDraw();
433
					break;
434
				}
5591 pavelyakov 435
				switch (key)
436
				{
437
						case 209...217:
438
								id=key-110;
439
								if (id-100>=disc_num) break;
440
								GOTO DEVICE_MARK;
441
						case ASCII_KEY_BS:
442
								//GoBack();
443
								Dir_Up();
444
								break;
5661 leency 445
						case 004: //Ctrl+D - set as bg
5591 pavelyakov 446
								strncpy(#temp, "\\S__",4);
447
								strcat(#temp, #file_path);
448
								RunProgram("/sys/media/kiv", #temp);
449
								break;
5661 leency 450
						case 014: //Ctrl+N - create new window
5591 pavelyakov 451
								if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD);
452
								RunProgram("/sys/File Managers/Eolite", #path);
453
								break;
454
						case 024: //Ctrl+X
455
								Copy(#file_path, CUT);
456
								break;
457
						case 003: //Ctrl+C
458
								Copy(#file_path, NOCUT);
459
								break;
460
						case 022: //Ctrl+V
5608 leency 461
								Paste();
5591 pavelyakov 462
								break;
5661 leency 463
						case 001: //Ctrl+A - select all files
5591 pavelyakov 464
								for (i=0; i
3363 leency 465
								{
5591 pavelyakov 466
									selected_offset = file_mas[i]*304 + buf+32 + 7;
5661 leency 467
									if (!i) if (!strncmp(selected_offset+33, "..", 2)) continue; //do not selec ".." directory
5591 pavelyakov 468
									ESBYTE[selected_offset] = 1;
469
									selected_count++;
3363 leency 470
								}
5591 pavelyakov 471
								List_ReDraw();
472
								break;
5661 leency 473
						case 021: //Ctrl+U - unselect all files
5591 pavelyakov 474
								for (i=0; i
475
								{
476
									selected_offset = file_mas[i]*304 + buf+32 + 7;
477
									ESBYTE[selected_offset] = 0;
478
								}
479
								selected_count = 0;
480
								List_ReDraw();
481
								break;
482
						case ASCII_KEY_ESC:
483
								break;
484
						case ASCII_KEY_ENTER:
485
								Open(0);
486
								break;
487
						case 074: //menu
488
								menu_call_mouse=0;
489
								//SwitchToAnotherThread();
490
								menu_stak = malloc(4096);
491
								CreateThread(#FileMenu,menu_stak+4092);
492
								break;
493
						case 173: //Ctrl+Enter
494
								if (!itdir) ShowOpenWithDialog();
495
								else Open(1);
496
								break;
497
						case ASCII_KEY_DEL:
498
								Del_Form();
499
								break;
500
						case ASCII_KEY_INS:
5694 leency 501
								selected_offset = file_mas[files.current]*304 + buf+32 + 7;
502
								if (files.current==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory
5591 pavelyakov 503
								if (ESBYTE[selected_offset])
504
								{
505
									ESBYTE[selected_offset]=0;
506
									selected_count--;
507
								}
508
								else
509
								{
510
									ESBYTE[selected_offset] = 1;
511
									selected_count++;
512
								}
5661 leency 513
								_INSERT_END:
5694 leency 514
								if (files.KeyDown()) List_ReDraw();
5591 pavelyakov 515
								break;
516
						case 048...059: //F1-F10
517
								FnProcess(key-49);
518
								break;
519
						default:
5694 leency 520
								for (i=files.current+1; i
5591 pavelyakov 521
								{
522
									strcpy(#temp, file_mas[i]*304+buf+72);
523
									if (temp[0]==key) || (temp[0]==key-32)
524
									{
5694 leency 525
										files.current = i - 1;
526
										files.KeyDown();
527
										List_ReDraw();
5591 pavelyakov 528
										break;
529
									}
530
								}
531
				}
3363 leency 532
			break;
5591 pavelyakov 533
			case evReDraw:
534
				DRAW_WINDOW:
535
				draw_window();
536
				if (action_buf)
537
				{
538
					menu_action(action_buf);
539
					action_buf=0;
540
				}
541
			break;
5606 pavelyakov 542
			case evIPC:
543
				goto DRAW_WINDOW;
544
			break;
5591 pavelyakov 545
		}
546
 
547
		if(cmd_free)
548
		{
5576 pavelyakov 549
			if(cmd_free==1)     free(menu_stak);
550
			else if(cmd_free==2)free(about_stak);
551
			else if(cmd_free==3)free(properties_stak);
552
			else if(cmd_free==4)free(settings_stak);
553
			else if(cmd_free==5)free(copy_stak);
5591 pavelyakov 554
			cmd_free = false;
5576 pavelyakov 555
		}
556
	}
3363 leency 557
}
558
 
4225 punk_joker 559
 
5435 leency 560
inline fastcall signed int _strrchr( ESI,BL)
561
{
562
	int jj=0, last=strlen(ESI);
5591 pavelyakov 563
	do {
5435 leency 564
		jj++;
565
		$lodsb
5591 pavelyakov 566
		if(AL==BL) last=jj;
5435 leency 567
	} while(AL!=0);
568
	return last;
569
}
4225 punk_joker 570
 
5435 leency 571
 
4028 leency 572
void menu_action(dword id)
573
{
574
	if (id==COPY_PASTE_END)
575
	{
576
		FnProcess(5);
5694 leency 577
		SelectFileByName(#copy_to+strrchr(#copy_to,'/'));
4028 leency 578
	}
5443 punk_joker 579
	if (id==100) Open(0);
4225 punk_joker 580
	if (id==201) ShowOpenWithDialog();
4028 leency 581
	if (id==202) FnProcess(3); //F3
582
	if (id==203) FnProcess(4); //F4
583
	if (id==104) Copy(#file_path, NOCUT);
584
	if (id==105) Copy(#file_path, CUT);
5608 leency 585
	if (id==106) Paste();
4034 leency 586
	if (id==207) FnProcess(2);
4028 leency 587
	if (id==108) Del_Form();
588
	if (id==109) FnProcess(5);
5447 punk_joker 589
	if (id==110) FnProcess(8);
5591 pavelyakov 590
	if (id==300)
591
	{
592
		FnProcess(5);
593
		List_ReDraw();
594
	}
4028 leency 595
}
3363 leency 596
 
4028 leency 597
 
3444 leency 598
void draw_window()
599
{
5674 pavelyakov 600
	DefineAndDrawWindow(GetScreenWidth()-550/4+rand_n,rand_n+30,550,500,0x73,system.color.work,TITLE,0);
3444 leency 601
	GetProcessInfo(#Form, SelfInfo);
602
	if (Form.status_window>2) return;
603
	if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h);
604
	if (Form.width<480) MoveSize(OLD,OLD,480,OLD);
605
	GetProcessInfo(#Form, SelfInfo); //if win_size changed
5694 leency 606
	files.SetSizes(192, 57, Form.cwidth - 210, onTop(57,6), disc_num*16+195,files.line_h);
3363 leency 607
	PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
5674 pavelyakov 608
	DrawBar(127, 8, 1, 25, system.color.work_graph);
609
	for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,system.color.work);
610
	for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,system.color.work);
611
	DrawBar(246,0,Form.cwidth - 297,12, system.color.work); //upper editbox
612
	DrawBar(246,29,Form.cwidth - 297,5,system.color.work);  //under editbox
613
	DrawRectangle(246,12,Form.cwidth - 303,16,system.color.work_graph);
5576 pavelyakov 614
	DefineButton(Form.cwidth - 32,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about
3363 leency 615
	PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
3434 leency 616
	//main rectangles
5674 pavelyakov 617
	DrawRectangle(1,40,Form.cwidth-3,onTop(46,0),system.color.work_graph);
3444 leency 618
	DrawRectangle(0,39,Form.cwidth-1,onTop(44,0),col_palette[4]); //bg
3363 leency 619
	for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);
620
	DrawLeftPanel();
3434 leency 621
	//ListBox
5674 pavelyakov 622
	DrawFlatButton(files.x,40,Form.cwidth - files.x - 159,16,31,system.color.work,T_FILE);
623
	DrawFlatButton(Form.cwidth - 159,40,73,16,32,system.color.work,T_TYPE);
624
	DrawFlatButton(Form.cwidth - 86,40,68,16,33,system.color.work,T_SIZE);
625
	DrawBar(files.x+files.w,files.y,1,onTop(22,files.y),system.color.work_graph); //line to the left from the scroll
626
	DrawFlatButton(files.x+files.w,40,16,16,0,system.color.work,"\x18");
627
	DrawFlatButton(files.x+files.w,onTop(22,0),16,16,0,system.color.work,"\x19");
3363 leency 628
	Open_Dir(#path,ONLY_SHOW);
629
	if (del_active) Del_Form();
5581 leency 630
	if (new_element_active) NewElement_Form(new_element_active, #new_element_name);
3363 leency 631
}
632
 
633
 
5694 leency 634
void List_ReDraw()
3363 leency 635
{
5694 leency 636
	int paint_y;
637
	static int old_current, old_first;
3363 leency 638
 
5694 leency 639
	files.CheckDoesValuesOkey(); //prevent some shit
3363 leency 640
 
5694 leency 641
	if (list_full_redraw) || (old_first != files.first)
3363 leency 642
	{
5694 leency 643
		old_current = files.current;
644
		old_first = files.first;
645
		list_full_redraw = false;
646
		goto _ALL_LIST_REDRAW;
3363 leency 647
	}
5694 leency 648
	if (old_current != files.current)
3363 leency 649
	{
5694 leency 650
		Line_ReDraw(0xFFFFFF, old_current-files.first);
651
		Line_ReDraw(col_selec, files.current-files.first);
652
		old_current = files.current;
653
		return;
3363 leency 654
	}
655
 
5694 leency 656
	_ALL_LIST_REDRAW:
3363 leency 657
 
5694 leency 658
	for (j=0; j
3434 leency 659
	//in the bottom
660
	paint_y = j * files.line_h + files.y;
661
	DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF);
5674 pavelyakov 662
	DrawBar(Form.cwidth-159,paint_y,1,onTop(paint_y,6),system.color.work);
663
	DrawBar(Form.cwidth-86,paint_y,1,onTop(paint_y,6),system.color.work);
3434 leency 664
	Scroll();
3363 leency 665
}
666
 
3444 leency 667
 
3363 leency 668
void Line_ReDraw(dword color, filenum){
3467 leency 669
	dword text_col=0,
5487 leency 670
	      ext1, attr,
4897 leency 671
	      file_offet,
672
	      file_name_off,
4042 leency 673
	      y=filenum*files.line_h+files.y;
4897 leency 674
	      BDVK file;
4859 leency 675
	if (filenum==-1) return;
3447 leency 676
	DrawBar(files.x,y,3,files.line_h,color);
677
	DrawBar(files.x+19,y,files.w-19,files.line_h,color);
678
	DrawBar(files.x+3,y+17,16,1,color);
679
	if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,color);
680
	if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,color);
3363 leency 681
 
4897 leency 682
	file_offet = file_mas[filenum+files.first]*304 + buf+32;
5487 leency 683
	attr = ESDWORD[file_offet];
4897 leency 684
	file.selected = ESBYTE[file_offet+7];
685
	file.sizelo   = ESDWORD[file_offet+32];
686
	file_name_off = file_offet+40;
3363 leency 687
 
5487 leency 688
	if (! TestBit(attr, 4) ) //file or folder?
3363 leency 689
	{
4897 leency 690
		Put_icon(file_name_off+_strrchr(file_name_off,'.'), files.x+3, files.line_h/2-7+y, color, 0);
5687 leency 691
		WriteText(7-strlen(ConvertSize(file.sizelo))*6+Form.cwidth - 76, files.line_h - font_h/ 2 + y,font_type,0,ConvertSize(file.sizelo));
3363 leency 692
	}
693
	else
4846 leency 694
	{
5606 pavelyakov 695
		if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1="";
4846 leency 696
		Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0);
697
	}
698
 
5487 leency 699
	if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
3444 leency 700
	if (color!=0xFFFfff)
3363 leency 701
	{
5487 leency 702
		itdir = TestBit(attr, 4);
4897 leency 703
		strcpy(#file_name, file_name_off);
5606 pavelyakov 704
		sprintf(#file_path,"%s%s",#path,file_name_off);
3363 leency 705
		if (text_col==0xA6A6B7) text_col=0xFFFFFF;
706
	}
4897 leency 707
	if (file.selected) text_col=0xFF0000;
3434 leency 708
	if (Form.width>=480)
709
	{
3447 leency 710
		FileShow.start_x = files.x + 23;
3434 leency 711
		FileShow.font_color = text_col;
5687 leency 712
		FileShow.area_size_x = files.w - 164;
4897 leency 713
		FileShow.text_pointer = file_name_off;
5687 leency 714
		FileShow.start_y = files.line_h - font_h/ 2 + y;
3434 leency 715
		PathShow_prepare stdcall(#FileShow);
716
		PathShow_draw stdcall(#FileShow);
717
	}
5674 pavelyakov 718
	DrawBar(Form.cwidth-159,y,1,files.line_h,system.color.work); //gray line 1
719
	DrawBar(Form.cwidth-86,y,1,files.line_h,system.color.work); //gray line 2
3363 leency 720
}
721
 
722
 
3444 leency 723
void Open_Dir(dword dir_path, redraw){
724
	int errornum, maxcount;
3434 leency 725
 
3444 leency 726
	if (redraw!=ONLY_SHOW)
3363 leency 727
	{
3444 leency 728
		if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0';
3363 leency 729
		if (buf) free(buf);
3444 leency 730
		errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
731
		if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/');
732
		if (errornum)
3363 leency 733
		{
734
			HistoryPath(ADD_NEW_PATH);
735
			GoBack();
736
			Write_Error(errornum);
737
			return;
738
		}
3444 leency 739
		maxcount = sizeof(file_mas)/sizeof(dword)-1;
4225 punk_joker 740
		if (files.count>maxcount) files.count = maxcount;
5694 leency 741
		if (files.count>0) && (files.current-files.first==-1) files.current=0;
3363 leency 742
	}
3444 leency 743
	if (files.count!=-1)
3363 leency 744
	{
5694 leency 745
		if(!_not_draw)
746
		{
747
			PathShow.area_size_x = Form.cwidth-306;
748
			DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
749
			PathShow_prepare stdcall(#PathShow);
750
			PathShow_draw stdcall(#PathShow);
751
		}
3363 leency 752
		HistoryPath(ADD_NEW_PATH);
3444 leency 753
		files.visible = files.h / files.line_h;
5591 pavelyakov 754
		if (files.count < files.visible) files.visible = files.count;
755
		if (sort_num==1) sorting_arrow_x = Form.width+60/2;
756
		if (sort_num==2) sorting_arrow_x = Form.width-115;
757
		if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
5674 pavelyakov 758
		WriteText(sorting_arrow_x,45,0x80,system.color.work_graph,"\x19");
5591 pavelyakov 759
		if (redraw!=ONLY_SHOW) Sorting();
5694 leency 760
		list_full_redraw = true;
5606 pavelyakov 761
		if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw();
5633 leency 762
		DrawSystemDiscs();
3363 leency 763
	}
5694 leency 764
	if (files.count==-1) && (redraw!=ONLY_OPEN)
765
	{
766
		files.KeyHome();
767
		if(!_not_draw) { list_full_redraw=true; List_ReDraw(); }
768
	}
3363 leency 769
}
770
 
771
 
772
inline Sorting()
773
{
774
	dword k=0, l=1;
4897 leency 775
	dword file_off;
3363 leency 776
	int i;
5606 pavelyakov 777
	if (!strncmp(#path,"/",2)) //do not sort
3363 leency 778
	{
5591 pavelyakov 779
		for(k=1;k
3363 leency 780
		return;
781
	}
5591 pavelyakov 782
	for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;)  //files | folders
3363 leency 783
	{
4897 leency 784
		if (!real_files_names_case) strttl(file_off+40);
785
		if (TestBit(ESDWORD[file_off],4)) //directory?
3363 leency 786
		{
787
			file_mas[k]=j;
788
			k++;
789
		}
790
		else
791
		{
3434 leency 792
			file_mas[files.count-l]=j;
3363 leency 793
			l++;
794
		}
795
	}
3434 leency 796
	//sorting: files first, then folders
3363 leency 797
	Sort_by_Name(0,k-1);
5591 pavelyakov 798
	if (sort_num==1) Sort_by_Name(k,files.count-1);
799
	if (sort_num==2) Sort_by_Type(k,files.count-1);
800
	if (sort_num==3) Sort_by_Size(k,files.count-1);
5581 leency 801
	//make ".." first item in list
5606 pavelyakov 802
	if (k>0) && (!strncmp(file_mas[0]*304+buf+72,"..",3))
803
		for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",3)) {file_mas[k]>
3363 leency 804
}
805
 
806
 
807
void Del_Form()
808
{
5512 punk_joker 809
	dword selected_offset2;
810
	int cont = 0;
811
	byte f_count[128];
5581 leency 812
	int dform_x = files.w - 220 / 2 + files.x;
5606 pavelyakov 813
	if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return;
4002 leency 814
	if (del_active==2)
3991 leency 815
	{
4002 leency 816
		if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
3991 leency 817
	}
818
	else
819
	{
4002 leency 820
		if (!files.count) return;
5674 pavelyakov 821
		DrawPopup(dform_x,160,220,85,1,system.color.work,system.color.work_graph);
822
		WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE);
5512 punk_joker 823
		for (i=0; i
4002 leency 824
		{
5512 punk_joker 825
			selected_offset2 = file_mas[i]*304 + buf+32 + 7;
826
			if (ESBYTE[selected_offset2]) cont++;
4002 leency 827
		}
5512 punk_joker 828
		if (cont)
829
		{
5576 pavelyakov 830
			sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,cont,DEL_MORE_FILES_2);
5674 pavelyakov 831
			WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count);
5512 punk_joker 832
		}
4002 leency 833
		else
834
		{
5591 pavelyakov 835
			if (strlen(#file_name)<28)
5512 punk_joker 836
			{
5674 pavelyakov 837
				WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,system.color.work_text,"?");
838
				WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,system.color.work_text,#file_name);
5512 punk_joker 839
			}
840
			else
841
			{
842
				WriteText(164+dform_x,190,0x80,0,"...?");
843
				ESI = 24;
844
				WriteText(dform_x+20,190,0,0,#file_name);
845
			}
4002 leency 846
		}
847
		DrawFlatButton(dform_x+27,208,70,20,301,0xFFB6B5,T_YES);
848
		DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO);
849
		del_active=1;
3991 leency 850
	}
3363 leency 851
}
852
 
4022 leency 853
int del_error;
854
int Del_File2(dword way)
3980 punk_joker 855
{
856
	dword dirbuf, fcount, i, filename;
4022 leency 857
	int error;
858
	char del_from[4096];
859
	if (isdir(way))
3997 leency 860
	{
4022 leency 861
		if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error;
3997 leency 862
		for (i=0; i
3980 punk_joker 863
		{
4002 leency 864
			if (CheckEvent()==evReDraw) draw_window();
3997 leency 865
			filename = i*304+dirbuf+72;
5591 pavelyakov 866
			sprintf(#del_from,"%s/%s",way,filename);
3997 leency 867
			if ( TestBit(ESDWORD[filename-40], 4) )
5581 leency 868
			{
3997 leency 869
				Del_File2(#del_from);
5581 leency 870
			}
3997 leency 871
			else
4022 leency 872
			{
873
				if (error = DeleteFile(#del_from)) del_error = error;
874
			}
3980 punk_joker 875
		}
3997 leency 876
	}
4022 leency 877
	if (error = DeleteFile(way)) del_error = error;
3980 punk_joker 878
}
879
 
880
 
3363 leency 881
void Del_File(byte dodel)
4022 leency 882
{
4896 punk_joker 883
	byte del_from[4096];
5214 punk_joker 884
	dword selected_offset2;
885
	int tst, count, i;
4896 punk_joker 886
 
3980 punk_joker 887
	if (dodel==true)
3363 leency 888
	{
4002 leency 889
		del_active=2;
3997 leency 890
		if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
4022 leency 891
		del_error = 0;
5214 punk_joker 892
 
5513 punk_joker 893
		if (selected_count)
5214 punk_joker 894
		{
5513 punk_joker 895
   		   for (i=0; i
896
           {
897
                selected_offset2 = file_mas[i]*304 + buf+32 + 7;
898
                if (ESBYTE[selected_offset2]) {
5591 pavelyakov 899
					sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
5513 punk_joker 900
                    Del_File2(#del_from);
901
                }
902
            }
5214 punk_joker 903
		}
904
		else
905
		{
5513 punk_joker 906
		   Del_File2(#file_path);
5214 punk_joker 907
		}
4022 leency 908
		if (del_error) Write_Error(del_error);
3363 leency 909
 	}
910
	del_active=0;
3997 leency 911
	DeleteButton(301);
912
	DeleteButton(302);
3444 leency 913
	Open_Dir(#path,WITH_REDRAW);
3363 leency 914
}
915
 
916
 
5694 leency 917
void SelectFileByName(dword that_file)
3363 leency 918
{
5694 leency 919
	int ind;
920
	files.KeyHome();
3363 leency 921
   	Open_Dir(#path,ONLY_OPEN);
4225 punk_joker 922
	if (!real_files_names_case) strttl(that_file);
5694 leency 923
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
924
	files.current = ind - 1;
925
	files.KeyDown();
3363 leency 926
	List_ReDraw();
927
}
928
 
929
 
930
void Dir_Up()
931
{
932
	char cur_folder[4096];
933
	i=strlen(#path)-1;
934
	if (i==0) return;
935
	path[i]=0x00;
936
	i = strrchr(#path, '/');
937
	strcpy(#cur_folder, #path+i);
938
	path[i]=0x00;
5694 leency 939
	SelectFileByName(#cur_folder);
3363 leency 940
}
941
 
5444 leency 942
void Open(byte rez)
3434 leency 943
{
5443 punk_joker 944
	byte temp[4096];
5513 punk_joker 945
	selected_count = 0;
5443 punk_joker 946
	if (rez)
947
	{
5606 pavelyakov 948
		if (!strncmp(#file_name,"..",3)) return;
5443 punk_joker 949
		strcpy(#temp, #file_path);
950
		if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end
951
		RunProgram("/sys/File Managers/Eolite", #temp);
952
		return;
953
	}
3444 leency 954
	if (!files.count) return;
3441 leency 955
	if (!itdir)
3434 leency 956
	{
5401 leency 957
		if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
3434 leency 958
	}
959
	else
960
	{
5606 pavelyakov 961
		if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
3434 leency 962
		strcpy(#path, #file_path);
963
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
964
		files.first=files.current=0;
3444 leency 965
		Open_Dir(#path,WITH_REDRAW);
3434 leency 966
	}
967
}
3363 leency 968
 
3434 leency 969
 
970
inline fastcall void GoBack()
3363 leency 971
{
972
	char cur_folder[4096];
973
	strcpy(#cur_folder, GetCurrentFolder());
5694 leency 974
	if (HistoryPath(GO_BACK)) SelectFileByName(#cur_folder);
3363 leency 975
}
976
 
5397 punk_joker 977
void ShowOpenWithDialog()
978
{
979
	byte param[4097];
5591 pavelyakov 980
	sprintf(#param,"~%s",#file_path);
5397 punk_joker 981
	RunProgram("/sys/@open", #param);
982
}
983
 
5555 punk_joker 984
void NewElement(byte newf)
985
{
5557 punk_joker 986
	BDVK element_info;
5581 leency 987
	byte del_rezult, copy_rezult, info_result;
5555 punk_joker 988
	if (newf)
989
	{
5591 pavelyakov 990
		sprintf(#temp,"%s%s",#path,new_file_ed.text);
5581 leency 991
		info_result = GetFileInfo(#temp, #element_info);
5571 punk_joker 992
		switch(new_element_active)
5555 punk_joker 993
		{
5581 leency 994
			case CREATE_FILE:
995
				if (info_result==5)
5557 punk_joker 996
				{
5571 punk_joker 997
					WriteFile(0, 0, #temp);
998
					if (EAX)
999
					{
1000
						Write_Error(EAX);
1001
						ShowMessage(NOT_CREATE_FILE, 150);
1002
					}
5557 punk_joker 1003
				}
5571 punk_joker 1004
				else
5557 punk_joker 1005
				{
5620 leency 1006
					notify(FS_ITEM_ALREADY_EXISTS);
5557 punk_joker 1007
				}
5581 leency 1008
				break;
1009
			case CREATE_FOLDER:
1010
				if (info_result==5)
5571 punk_joker 1011
				{
1012
					CreateDir(#temp);
1013
					if (EAX)
1014
					{
1015
						Write_Error(EAX);
1016
						ShowMessage(NOT_CREATE_FOLDER, 150);
1017
					}
1018
				}
1019
				else
1020
				{
5620 leency 1021
					notify(FS_ITEM_ALREADY_EXISTS);
5571 punk_joker 1022
				}
5581 leency 1023
				break;
1024
			case RENAME_ITEM:
1025
				if (info_result==5)
5571 punk_joker 1026
				{
1027
					if (itdir)
1028
					{
1029
						if (del_rezult = DeleteFile(#file_path))
1030
						{
1031
							Write_Error(del_rezult);
1032
							ShowMessage(T_DEL_ERROR_1, 150);
1033
							return;
1034
						}
1035
						if (CreateDir(#temp)) CreateDir(#file_path);
1036
						Open_Dir(#path,WITH_REDRAW);
5694 leency 1037
						SelectFileByName(new_file_ed.text);
5571 punk_joker 1038
					}
1039
					else
1040
					{
1041
						if (copy_rezult = CopyFile(#file_path,#temp))
1042
						{
1043
							Write_Error(copy_rezult);
1044
						}
1045
						else
1046
						{
1047
							Del_File(true);
5694 leency 1048
							SelectFileByName(new_file_ed.text);
5571 punk_joker 1049
						}
1050
					}
1051
				}
1052
				else
1053
				{
5620 leency 1054
					notify(FS_ITEM_ALREADY_EXISTS);
5571 punk_joker 1055
				}
5555 punk_joker 1056
		}
5557 punk_joker 1057
		new_element_active = 0;
1058
		Open_Dir(#path,WITH_REDRAW);
5694 leency 1059
		SelectFileByName(new_file_ed.text);
5555 punk_joker 1060
	}
1061
	new_element_active = 0;
5557 punk_joker 1062
	Open_Dir(#path,WITH_REDRAW);
5555 punk_joker 1063
}
1064
 
5571 punk_joker 1065
void NewElement_Form(byte crt, dword strng)
5555 punk_joker 1066
{
1067
	int dform_x=files.w-220/2+files.x;
5557 punk_joker 1068
	if (!new_element_active)
5555 punk_joker 1069
	{
5557 punk_joker 1070
		new_element_active = crt;
5571 punk_joker 1071
		strcpy(#new_element_name, strng);
1072
		new_file_ed.size = new_file_ed.pos = strlen(strng);
5555 punk_joker 1073
	}
5674 pavelyakov 1074
	DrawPopup(dform_x,160,220,85,1,system.color.work,system.color.work_graph);
5581 leency 1075
	new_file_ed.left = dform_x+24;
5555 punk_joker 1076
	edit_box_draw  stdcall (#new_file_ed);
5581 leency 1077
	DrawRectangle(new_file_ed.left-1, new_file_ed.top-1, new_file_ed.width+2, 16, 0xFFFfff);
5674 pavelyakov 1078
	DrawRectangle(new_file_ed.left-2, new_file_ed.top-2, new_file_ed.width+4, 18, system.color.work_graph);
5591 pavelyakov 1079
	if (new_element_active==3) DrawFlatButton(dform_x+22,208,85,22,301,0xFFB6B5,T_RENAME);
1080
	else DrawFlatButton(dform_x+27,208,70,22,301,0xFFB6B5,T_CREATE);
5581 leency 1081
	DrawFlatButton(dform_x+120,208,70,22,302,0xC6DFC6,T_CANCEL);
5555 punk_joker 1082
}
1083
 
5576 pavelyakov 1084
void FnProcess(byte N)
3434 leency 1085
{
1086
	switch(N)
1087
	{
1088
		case 1:
4395 punk_joker 1089
			if (!active_about)
1090
			{
5576 pavelyakov 1091
				//SwitchToAnotherThread();
1092
				about_stak = malloc(4096);
1093
				about_window = CreateThread(#about_dialog,about_stak+4092);
4395 punk_joker 1094
				break;
1095
			}
1096
			else
1097
			{
1098
				ActivateWindow(GetProcessSlot(about_window));
1099
			}
3434 leency 1100
			break;
1101
		case 2:
1102
			if (!files.count) break;
5581 leency 1103
			NewElement_Form(RENAME_ITEM, #file_name);
3434 leency 1104
			break;
1105
		case 3:
5591 pavelyakov 1106
			if (!itdir) RunProgram("/sys/tinypad", #file_path);
3434 leency 1107
			break;
1108
		case 4:
5591 pavelyakov 1109
			if (!itdir) RunProgram("/sys/develop/heed", #file_path);
3434 leency 1110
			break;
3440 leency 1111
		case 5: //refresh cur dir & devs
3854 leency 1112
			Tip(56, T_DEVICES, 55, "-");
3440 leency 1113
			Open_Dir(#path,WITH_REDRAW);
1114
			pause(10);
5441 leency 1115
			LoadIniSettings();
1116
			GetSystemDiscs();
3444 leency 1117
			Open_Dir(#path,WITH_REDRAW);
3440 leency 1118
			DrawLeftPanel();
3434 leency 1119
			break;
1120
		case 6:
5581 leency 1121
			NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER);
3434 leency 1122
			break;
1123
		case 7:
5581 leency 1124
			NewElement_Form(CREATE_FILE, T_NEW_FILE);
3434 leency 1125
			break;
5447 punk_joker 1126
		case 8:
5576 pavelyakov 1127
			//SwitchToAnotherThread();
1128
			properties_stak = malloc(8096);
1129
			CreateThread(#properties_dialog, properties_stak+8092);
5447 punk_joker 1130
			break;
3434 leency 1131
		case 10: //F10
5416 punk_joker 1132
			if (!active_settings)
1133
			{
5576 pavelyakov 1134
				//SwitchToAnotherThread();
1135
				settings_stak = malloc(4096);
1136
				settings_window = CreateThread(#settings_dialog, settings_stak+4092);
5416 punk_joker 1137
				break;
1138
			}
1139
			else
1140
			{
1141
				ActivateWindow(GetProcessSlot(settings_window));
1142
			}
3434 leency 1143
			break;
1144
	}
1145
}
1146
 
5435 leency 1147
//need to remove these functiones, they are a very old shit :)
1148
dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;}
3434 leency 1149
 
5435 leency 1150
 
3363 leency 1151
stop: