Subversion Repositories Kolibri OS

Rev

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

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