Subversion Repositories Kolibri OS

Rev

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