Subversion Repositories Kolibri OS

Rev

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

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