Subversion Repositories Kolibri OS

Rev

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