Subversion Repositories Kolibri OS

Rev

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

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