Subversion Repositories Kolibri OS

Rev

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