Subversion Repositories Kolibri OS

Rev

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