Subversion Repositories Kolibri OS

Rev

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