Subversion Repositories Kolibri OS

Rev

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

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