Subversion Repositories Kolibri OS

Rev

Rev 6300 | Rev 6404 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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