Subversion Repositories Kolibri OS

Rev

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