Subversion Repositories Kolibri OS

Rev

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