Subversion Repositories Kolibri OS

Rev

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