Subversion Repositories Kolibri OS

Rev

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

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