Subversion Repositories Kolibri OS

Rev

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