Subversion Repositories Kolibri OS

Rev

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

Rev 6049 Rev 6050
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 028: //Ctrl+Enter
416
						case 028: //Ctrl+Enter
417
								if (!itdir) ShowOpenWithDialog();
417
								if (!itdir) ShowOpenWithDialog();
418
								else Open(1);
418
								else Open(1);
419
								break;
419
								break;
420
						case 030: //Ctrl+A - select all files
420
						case 030: //Ctrl+A - select all files
421
								for (i=0; i
421
								for (i=0; i
422
								{
422
								{
423
									selected_offset = file_mas[i]*304 + buf+32 + 7;
423
									selected_offset = file_mas[i]*304 + buf+32 + 7;
424
									if (!i) if (!strncmp(selected_offset+33, "..", 2)) continue; //do not selec ".." directory
424
									if (!i) if (!strncmp(selected_offset+33, "..", 2)) continue; //do not selec ".." directory
425
									ESBYTE[selected_offset] = 1;
425
									ESBYTE[selected_offset] = 1;
426
									selected_count++;
426
									selected_count++;
427
								}
427
								}
428
								List_ReDraw();
428
								List_ReDraw();
429
								break;
429
								break;
430
						case 022: //Ctrl+U - unselect all files
430
						case 022: //Ctrl+U - unselect all files
431
								for (i=0; i
431
								for (i=0; i
432
								{
432
								{
433
									selected_offset = file_mas[i]*304 + buf+32 + 7;
433
									selected_offset = file_mas[i]*304 + buf+32 + 7;
434
									ESBYTE[selected_offset] = 0;
434
									ESBYTE[selected_offset] = 0;
435
								}
435
								}
436
								selected_count = 0;
436
								selected_count = 0;
437
								List_ReDraw();
437
								List_ReDraw();
438
								break;
438
								break;
439
					}
439
					}
440
					break;
440
					break;
441
				}
441
				}
442
 
442
 
443
				switch (key_scancode)
443
				switch (key_scancode)
444
				{
444
				{
445
						case SCAN_CODE_BS:
445
						case SCAN_CODE_BS:
446
								//GoBack();
446
								//GoBack();
447
								Dir_Up();
447
								Dir_Up();
448
								break; 
448
								break; 
449
						case SCAN_CODE_ENTER:
449
						case SCAN_CODE_ENTER:
450
								Open(0);
450
								Open(0);
451
								break; 
451
								break; 
452
						case SCAN_CODE_TAB:
452
						case SCAN_CODE_TAB:
453
								if (!two_panels) break;
453
								if (!two_panels) break;
454
								if (active_panel==1) active_panel=2; else active_panel=1;
454
								if (active_panel==1) active_panel=2; else active_panel=1;
455
								ChangeActivePanel();
455
								ChangeActivePanel();
456
								break;
456
								break;
457
						case 093: //menu
457
						case 093: //menu
458
								menu_call_mouse=0;
458
								menu_call_mouse=0;
459
								menu_stak = malloc(4096);
459
								menu_stak = malloc(4096);
460
								CreateThread(#FileMenu,menu_stak+4092);
460
								CreateThread(#FileMenu,menu_stak+4092);
461
								break;
461
								break;
462
						case SCAN_CODE_DEL:
462
						case SCAN_CODE_DEL:
463
								Del_Form();
463
								Del_Form();
464
								break;
464
								break;
465
						case SCAN_CODE_INS:
465
						case SCAN_CODE_INS:
466
								selected_offset = file_mas[files.cur_y]*304 + buf+32 + 7;
466
								selected_offset = file_mas[files.cur_y]*304 + buf+32 + 7;
467
								if (files.cur_y==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory
467
								if (files.cur_y==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory
468
								if (ESBYTE[selected_offset])
468
								if (ESBYTE[selected_offset])
469
								{
469
								{
470
									ESBYTE[selected_offset]=0;
470
									ESBYTE[selected_offset]=0;
471
									selected_count--;
471
									selected_count--;
472
								}
472
								}
473
								else
473
								else
474
								{
474
								{
475
									ESBYTE[selected_offset] = 1;
475
									ESBYTE[selected_offset] = 1;
476
									selected_count++;
476
									selected_count++;
477
								}
477
								}
478
								_INSERT_END:
478
								_INSERT_END:
479
								files.KeyDown();
479
								files.KeyDown();
480
								List_ReDraw();
480
								List_ReDraw();
481
								break;
481
								break;
482
						case 059...068: //F1-F10
482
						case 059...068: //F1-F10
483
								FnProcess(key_scancode-58);
483
								FnProcess(key_scancode-58);
484
								break; 
484
								break; 
485
						default:
485
						default:
486
								for (i=files.cur_y+1; i
486
								for (i=files.cur_y+1; i
487
								{
487
								{
488
									strcpy(#temp, file_mas[i]*304+buf+72);
488
									strcpy(#temp, file_mas[i]*304+buf+72);
489
									if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
489
									if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
490
									{
490
									{
491
										files.cur_y = i - 1;
491
										files.cur_y = i - 1;
492
										files.KeyDown();
492
										files.KeyDown();
493
										List_ReDraw();
493
										List_ReDraw();
494
										break;
494
										break;
495
									}
495
									}
496
								}
496
								}
497
				}                         
497
				}                         
498
			break;
498
			break;
499
			case evIPC:
499
			case evIPC:
500
			case evReDraw:
500
			case evReDraw:
501
				draw_window();
501
				draw_window();
502
				if (action_buf) 
502
				if (action_buf) 
503
				{
503
				{
504
					if (action_buf==OPERATION_END)
504
					if (action_buf==OPERATION_END)
505
					{
505
					{
506
						FnProcess(5);
506
						FnProcess(5);
507
						if (copy_stak) SelectFileByName(#copy_to+strrchr(#copy_to,'/'));
507
						if (copy_stak) SelectFileByName(#copy_to+strrchr(#copy_to,'/'));
508
					}
508
					}
509
					if (action_buf==100) Open(0);
509
					if (action_buf==100) Open(0);
510
					if (action_buf==201) ShowOpenWithDialog();
510
					if (action_buf==201) ShowOpenWithDialog();
511
					if (action_buf==202) FnProcess(3); //F3
511
					if (action_buf==202) FnProcess(3); //F3
512
					if (action_buf==203) FnProcess(4); //F4
512
					if (action_buf==203) FnProcess(4); //F4
513
					if (action_buf==104) Copy(#file_path, NOCUT);
513
					if (action_buf==104) Copy(#file_path, NOCUT);
514
					if (action_buf==105) Copy(#file_path, CUT);
514
					if (action_buf==105) Copy(#file_path, CUT);
515
					if (action_buf==106) Paste();
515
					if (action_buf==106) Paste();
516
					if (action_buf==207) FnProcess(2);
516
					if (action_buf==207) FnProcess(2);
517
					if (action_buf==108) Del_Form();
517
					if (action_buf==108) Del_Form();
518
					if (action_buf==109) FnProcess(5);
518
					if (action_buf==109) FnProcess(5);
519
					if (action_buf==110) FnProcess(8);
519
					if (action_buf==110) FnProcess(8);
520
					action_buf=0;
520
					action_buf=0;
521
				}
521
				}
522
		}
522
		}
523
		if(cmd_free)
523
		if(cmd_free)
524
		{
524
		{
525
			if(cmd_free==1)      menu_stak=free(menu_stak);
525
			if(cmd_free==1)      menu_stak=free(menu_stak);
526
			else if(cmd_free==2) about_stak=free(about_stak);
526
			else if(cmd_free==2) about_stak=free(about_stak);
527
			else if(cmd_free==3) properties_stak=free(properties_stak);
527
			else if(cmd_free==3) properties_stak=free(properties_stak);
528
			else if(cmd_free==4) settings_stak=free(settings_stak);
528
			else if(cmd_free==4) settings_stak=free(settings_stak);
529
			else if(cmd_free==5) copy_stak=free(copy_stak);
529
			else if(cmd_free==5) copy_stak=free(copy_stak);
530
			else if(cmd_free==6) delete_stak=free(delete_stak);
530
			else if(cmd_free==6) delete_stak=free(delete_stak);
531
			cmd_free = false;
531
			cmd_free = false;
532
		}
532
		}
533
	}
533
	}
534
}
534
}
535
 
535
 
536
void draw_window()
536
void draw_window()
537
{
537
{
538
	DefineAndDrawWindow(WinX+rand_n,WinY+rand_n,WinW,WinH,0x73,system.color.work,TITLE,0);
538
	DefineAndDrawWindow(WinX+rand_n,WinY+rand_n,WinW,WinH,0x73,system.color.work,TITLE,0);
539
	GetProcessInfo(#Form, SelfInfo);
539
	GetProcessInfo(#Form, SelfInfo);
540
	if (Form.status_window>2) return;
540
	if (Form.status_window>2) return;
541
	if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; }
541
	if (Form.height < 350) { MoveSize(OLD,OLD,OLD,350); return; }
542
	if (Form.width  < 480) { MoveSize(OLD,OLD,480,OLD); return; }
542
	if (Form.width  < 480) { MoveSize(OLD,OLD,480,OLD); return; }
543
	GetProcessInfo(#Form, SelfInfo); //if win_size changed
543
	GetProcessInfo(#Form, SelfInfo); //if win_size changed
544
	PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
544
	PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
545
	DrawBar(127, 8, 1, 25, system.color.work_graph);
545
	DrawBar(127, 8, 1, 25, system.color.work_graph);
546
	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);
546
	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);
547
	for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,system.color.work);
547
	for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,system.color.work);
548
	DrawBar(246,0,Form.cwidth - 297,12, system.color.work); //upper editbox
548
	DrawBar(246,0,Form.cwidth - 297,12, system.color.work); //upper editbox
549
	DrawBar(246,29,Form.cwidth - 297,5,system.color.work);  //under editbox
549
	DrawBar(246,29,Form.cwidth - 297,5,system.color.work);  //under editbox
550
	DrawRectangle(246,12,Form.cwidth - 303,16,system.color.work_graph);
550
	DrawRectangle(246,12,Form.cwidth - 303,16,system.color.work_graph);
551
	DefineButton(Form.cwidth - 32,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about
551
	DefineButton(Form.cwidth - 32,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about
552
	PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
552
	PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
553
	//main rectangles
553
	//main rectangles
554
	DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42,system.color.work_graph);
554
	DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42,system.color.work_graph);
555
	DrawRectangle(0,39,Form.cwidth-1,Form.cheight - 40,col_palette[4]); //bg
555
	DrawRectangle(0,39,Form.cwidth-1,Form.cheight - 40,col_palette[4]); //bg
556
	for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);
556
	for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);
557
	llist_copy(#files_active, #files);
557
	llist_copy(#files_active, #files);
558
	strcpy(#active_path, #path);
558
	strcpy(#active_path, #path);
559
	DrawFilePanels();
559
	DrawFilePanels();
560
	if (del_active) Del_Form();
560
	if (del_active) Del_Form();
561
	if (new_element_active) NewElement_Form(new_element_active, #new_element_name);
561
	if (new_element_active) NewElement_Form(new_element_active, #new_element_name);
562
}
562
}
563
 
563
 
564
void DrawList() 
564
void DrawList() 
565
{
565
{
566
	word sorting_arrow_x;
566
	word sorting_arrow_x;
567
	DrawFlatButton(files.x, files.y-17, files.w - 141,16,31,system.color.work,T_FILE);
567
	DrawFlatButton(files.x, files.y-17,     files.w - 141,16,31,T_FILE);
568
	DrawFlatButton(files.x + files.w - 141, files.y-17,73,16,32,system.color.work,T_TYPE);
568
	DrawFlatButton(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE);
569
	DrawFlatButton(files.x + files.w -  68, files.y-17,68,16,33,system.color.work,T_SIZE);
569
	DrawFlatButton(files.x + files.w -  68, files.y-17,68,16,33,T_SIZE);
570
	DrawFlatButton(files.x + files.w,       files.y-17,16,16, 0,system.color.work,"\x18");
570
	DrawFlatButton(files.x + files.w,       files.y-17,16,16, 0,"\x18");
571
	DrawFlatButton(files.x + files.w,files.y+files.h-16,16,16,0,system.color.work,"\x19");
571
	DrawFlatButton(files.x + files.w,files.y+files.h-16,16,16,0,"\x19");
572
	if (sort_num==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;
572
	if (sort_num==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;
573
	if (sort_num==2) sorting_arrow_x = files.x + files.w - 90;
573
	if (sort_num==2) sorting_arrow_x = files.x + files.w - 90;
574
	if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
574
	if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
575
	WriteText(sorting_arrow_x,files.y-12,0x80,system.color.work_graph,"\x19");
575
	WriteText(sorting_arrow_x,files.y-12,0x80,system.color.work_graph,"\x19");
576
	DrawBar(files.x+files.w,files.y,1,files.h,system.color.work_graph);
576
	DrawBar(files.x+files.w,files.y,1,files.h,system.color.work_graph);
577
	if (two_panels) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,system.color.work_graph);	
577
	if (two_panels) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,system.color.work_graph);	
578
}
578
}
579
 
579
 
580
void DrawFilePanels()
580
void DrawFilePanels()
581
{
581
{
582
	int files_y;
582
	int files_y;
583
	if (!two_panels)
583
	if (!two_panels)
584
	{
584
	{
585
		DrawDeviceAndActionsLeftPanel();
585
		DrawDeviceAndActionsLeftPanel();
586
		files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59, files.item_h);
586
		files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59, files.item_h);
587
		DrawList();
587
		DrawList();
588
		Open_Dir(#path,ONLY_SHOW);
588
		Open_Dir(#path,ONLY_SHOW);
589
	}
589
	}
590
	else
590
	else
591
	{
591
	{
592
		llist_copy(#files, #files_inactive);
592
		llist_copy(#files, #files_inactive);
593
		strcpy(#path, #inactive_path);
593
		strcpy(#path, #inactive_path);
594
		col_selec = 0xCCCccc;
594
		col_selec = 0xCCCccc;
595
		SystemDiscs.Draw();
595
		SystemDiscs.Draw();
596
		files_y = files.y;
596
		files_y = files.y;
597
 
597
 
598
		if (active_panel==1)
598
		if (active_panel==1)
599
		{
599
		{
600
			llist_copy(#files, #files_inactive);
600
			llist_copy(#files, #files_inactive);
601
			strcpy(#path, #inactive_path);
601
			strcpy(#path, #inactive_path);
602
			col_selec = 0xCCCccc;
602
			col_selec = 0xCCCccc;
603
			files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2, files.item_h);
603
			files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2, files.item_h);
604
			DrawList();
604
			DrawList();
605
			Open_Dir(#path,WITH_REDRAW);
605
			Open_Dir(#path,WITH_REDRAW);
606
			llist_copy(#files, #files_active);
606
			llist_copy(#files, #files_active);
607
			strcpy(#path, #active_path);
607
			strcpy(#path, #active_path);
608
			col_selec = 0x94AECE;
608
			col_selec = 0x94AECE;
609
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2, files.item_h);
609
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2, files.item_h);
610
			DrawList();
610
			DrawList();
611
			Open_Dir(#path,WITH_REDRAW);
611
			Open_Dir(#path,WITH_REDRAW);
612
		}
612
		}
613
		if (active_panel==2)
613
		if (active_panel==2)
614
		{
614
		{
615
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2, files.item_h);
615
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, Form.cheight-files_y-2, files.item_h);
616
			DrawList();
616
			DrawList();
617
			Open_Dir(#path,WITH_REDRAW);
617
			Open_Dir(#path,WITH_REDRAW);
618
			llist_copy(#files, #files_active);
618
			llist_copy(#files, #files_active);
619
			strcpy(#path, #active_path);
619
			strcpy(#path, #active_path);
620
			col_selec = 0x94AECE;
620
			col_selec = 0x94AECE;
621
			files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2, files.item_h);
621
			files.SetSizes(Form.cwidth/2, files_y, Form.cwidth/2 -17, Form.cheight-files_y-2, files.item_h);
622
			DrawList();
622
			DrawList();
623
			Open_Dir(#path,WITH_REDRAW);
623
			Open_Dir(#path,WITH_REDRAW);
624
		}
624
		}
625
	}
625
	}
626
}
626
}
627
 
627
 
628
 
628
 
629
void List_ReDraw()
629
void List_ReDraw()
630
{
630
{
631
	int all_lines_h;
631
	int all_lines_h;
632
	static int old_cur_y, old_first;
632
	static int old_cur_y, old_first;
633
 
633
 
634
	files.CheckDoesValuesOkey(); //prevent some shit
634
	files.CheckDoesValuesOkey(); //prevent some shit
635
 
635
 
636
	if (list_full_redraw) || (old_first != files.first)
636
	if (list_full_redraw) || (old_first != files.first)
637
	{
637
	{
638
		old_cur_y = files.cur_y;
638
		old_cur_y = files.cur_y;
639
		old_first = files.first;
639
		old_first = files.first;
640
		list_full_redraw = false;
640
		list_full_redraw = false;
641
		goto _ALL_LIST_REDRAW;
641
		goto _ALL_LIST_REDRAW;
642
	}
642
	}
643
	if (old_cur_y != files.cur_y)
643
	if (old_cur_y != files.cur_y)
644
	{
644
	{
645
		if (old_cur_y-files.first
645
		if (old_cur_y-files.first
646
		Line_ReDraw(col_selec, files.cur_y-files.first);
646
		Line_ReDraw(col_selec, files.cur_y-files.first);
647
		old_cur_y = files.cur_y;
647
		old_cur_y = files.cur_y;
648
		return;
648
		return;
649
	}
649
	}
650
 
650
 
651
	_ALL_LIST_REDRAW:
651
	_ALL_LIST_REDRAW:
652
 
652
 
653
	for (j=0; j
653
	for (j=0; j
654
	//in the bottom
654
	//in the bottom
655
	all_lines_h = j * files.item_h;
655
	all_lines_h = j * files.item_h;
656
	DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h,0xFFFFFF);
656
	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);
657
	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);
658
	DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h,system.color.work);
659
	Scroll();
659
	Scroll();
660
}
660
}
661
 
661
 
662
 
662
 
663
void Line_ReDraw(dword bgcol, filenum){
663
void Line_ReDraw(dword bgcol, filenum){
664
	dword text_col=0,
664
	dword text_col=0,
665
		  ext1, attr,
665
		  ext1, attr,
666
		  file_offet,
666
		  file_offet,
667
		  file_name_off,
667
		  file_name_off,
668
		  y=filenum*files.item_h+files.y;
668
		  y=filenum*files.item_h+files.y;
669
		  BDVK file;
669
		  BDVK file;
670
	char label_file_name[4096];
670
	char label_file_name[4096];
671
	if (filenum==-1) return;
671
	if (filenum==-1) return;
672
	DrawBar(files.x,y,3,files.item_h,bgcol); 
672
	DrawBar(files.x,y,3,files.item_h,bgcol); 
673
	DrawBar(files.x+19,y,files.w-19,files.item_h,bgcol);
673
	DrawBar(files.x+19,y,files.w-19,files.item_h,bgcol);
674
	DrawBar(files.x+3,y+17,16,1,bgcol);
674
	DrawBar(files.x+3,y+17,16,1,bgcol);
675
	if (files.item_h>18) DrawBar(files.x+3,y+18,16,files.item_h-18,bgcol);
675
	if (files.item_h>18) DrawBar(files.x+3,y+18,16,files.item_h-18,bgcol);
676
	if (files.item_h>15) DrawBar(files.x+3,y,16,files.item_h-15,bgcol); 
676
	if (files.item_h>15) DrawBar(files.x+3,y,16,files.item_h-15,bgcol); 
677
 
677
 
678
	file_offet = file_mas[filenum+files.first]*304 + buf+32;
678
	file_offet = file_mas[filenum+files.first]*304 + buf+32;
679
	attr = ESDWORD[file_offet];
679
	attr = ESDWORD[file_offet];
680
	file.selected = ESBYTE[file_offet+7];
680
	file.selected = ESBYTE[file_offet+7];
681
	file.sizelo   = ESDWORD[file_offet+32];
681
	file.sizelo   = ESDWORD[file_offet+32];
682
	file_name_off = file_offet+40;
682
	file_name_off = file_offet+40;
683
 
683
 
684
	if (! TestBit(attr, 4) ) //file or folder?
684
	if (! TestBit(attr, 4) ) //file or folder?
685
	{	
685
	{	
686
		ext1 = strrchr(file_name_off,'.') + file_name_off;
686
		ext1 = strrchr(file_name_off,'.') + file_name_off;
687
		if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing 
687
		if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing 
688
		Put_icon(ext1, files.x+3, files.item_h/2-7+y, bgcol, 0);
688
		Put_icon(ext1, files.x+3, files.item_h/2-7+y, bgcol, 0);
689
		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
		WriteText(7-strlen(ConvertSize(file.sizelo))*6+files.x+files.w - 58, files.text_y + y +1,files.font_type,0,ConvertSize(file.sizelo));
690
	}
690
	}
691
	else
691
	else
692
	{
692
	{
693
		if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1="";
693
		if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1="";
694
		Put_icon(ext1, files.x+3, files.item_h/2-7+y, bgcol, 0);		
694
		Put_icon(ext1, files.x+3, files.item_h/2-7+y, bgcol, 0);		
695
	}
695
	}
696
 
696
 
697
	if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
697
	if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
698
	if (bgcol!=0xFFFfff)
698
	if (bgcol!=0xFFFfff)
699
	{
699
	{
700
		itdir = TestBit(attr, 4);
700
		itdir = TestBit(attr, 4);
701
		strcpy(#file_name, file_name_off);
701
		strcpy(#file_name, file_name_off);
702
		sprintf(#file_path,"%s%s",#path,file_name_off);
702
		sprintf(#file_path,"%s%s",#path,file_name_off);
703
		if (text_col==0xA6A6B7) text_col=0xFFFFFF;
703
		if (text_col==0xA6A6B7) text_col=0xFFFFFF;
704
	}
704
	}
705
	if (file.selected) text_col=0xFF0000;
705
	if (file.selected) text_col=0xFF0000;
706
	if (label.size.pt==9) || (!label.font)
706
	if (label.size.pt==9) || (!label.font)
707
	{
707
	{
708
		if (Form.width>=480)
708
		if (Form.width>=480)
709
		{
709
		{
710
			FileShow.start_x = files.x + 23;
710
			FileShow.start_x = files.x + 23;
711
			FileShow.font_color = text_col;
711
			FileShow.font_color = text_col;
712
			FileShow.area_size_x = files.w - 164;
712
			FileShow.area_size_x = files.w - 164;
713
			FileShow.text_pointer = file_name_off;
713
			FileShow.text_pointer = file_name_off;
714
			FileShow.start_y = files.text_y + y + 1;
714
			FileShow.start_y = files.text_y + y + 1;
715
			PathShow_prepare stdcall(#FileShow);
715
			PathShow_prepare stdcall(#FileShow);
716
			PathShow_draw stdcall(#FileShow);
716
			PathShow_draw stdcall(#FileShow);
717
		}		
717
		}		
718
	}
718
	}
719
	else
719
	else
720
	{
720
	{
721
		strcpy(#label_file_name, file_name_off);
721
		strcpy(#label_file_name, file_name_off);
722
		if (label.getsize(#label_file_name) + 141 + 26 > files.w)
722
		if (label.getsize(#label_file_name) + 141 + 26 > files.w)
723
		{
723
		{
724
			while (label.getsize(#label_file_name) + 141 + 26 > files.w) {
724
			while (label.getsize(#label_file_name) + 141 + 26 > files.w) {
725
				ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL;
725
				ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL;
726
			}
726
			}
727
			strcpy(#label_file_name+strlen(#label_file_name)-2, "...");			
727
			strcpy(#label_file_name+strlen(#label_file_name)-2, "...");			
728
		}
728
		}
729
		label.write(files.x + 23, files.item_h - label.height / 2 + y, bgcol, text_col, label.size.pt, #label_file_name);
729
		label.write(files.x + 23, files.item_h - label.height / 2 + y, bgcol, text_col, label.size.pt, #label_file_name);
730
	}
730
	}
731
	DrawBar(files.x+files.w-141,y,1,files.item_h,system.color.work); //gray line 1
731
	DrawBar(files.x+files.w-141,y,1,files.item_h,system.color.work); //gray line 1
732
	DrawBar(files.x+files.w-68,y,1,files.item_h,system.color.work); //gray line 2
732
	DrawBar(files.x+files.w-68,y,1,files.item_h,system.color.work); //gray line 2
733
}
733
}
734
 
734
 
735
 
735
 
736
void Open_Dir(dword dir_path, redraw){
736
void Open_Dir(dword dir_path, redraw){
737
	int errornum, maxcount;
737
	int errornum, maxcount;
738
 
738
 
739
	if (redraw!=ONLY_SHOW)
739
	if (redraw!=ONLY_SHOW)
740
	{
740
	{
741
		if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0';
741
		if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0';
742
		if (buf) free(buf);
742
		if (buf) free(buf);
743
		errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
743
		errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
744
		if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/');
744
		if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/');
745
		if (errornum)
745
		if (errornum)
746
		{
746
		{
747
			history.add(#path);
747
			history.add(#path);
748
			GoBack();
748
			GoBack();
749
			Write_Error(errornum);
749
			Write_Error(errornum);
750
			return;
750
			return;
751
		}
751
		}
752
		maxcount = sizeof(file_mas)/sizeof(dword)-1;
752
		maxcount = sizeof(file_mas)/sizeof(dword)-1;
753
		if (files.count>maxcount) files.count = maxcount;
753
		if (files.count>maxcount) files.count = maxcount;
754
		if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
754
		if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
755
	}
755
	}
756
	if (files.count!=-1)
756
	if (files.count!=-1)
757
	{
757
	{
758
		if(!_not_draw)
758
		if(!_not_draw)
759
		{
759
		{
760
			PathShow.area_size_x = Form.cwidth-306;
760
			PathShow.area_size_x = Form.cwidth-306;
761
			DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
761
			DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
762
			PathShow_prepare stdcall(#PathShow);
762
			PathShow_prepare stdcall(#PathShow);
763
			PathShow_draw stdcall(#PathShow);
763
			PathShow_draw stdcall(#PathShow);
764
		}
764
		}
765
		history.add(#path);
765
		history.add(#path);
766
		SystemDiscs.Draw();
766
		SystemDiscs.Draw();
767
		files.visible = files.h / files.item_h;
767
		files.visible = files.h / files.item_h;
768
		if (files.count < files.visible) files.visible = files.count;
768
		if (files.count < files.visible) files.visible = files.count;
769
		if (redraw!=ONLY_SHOW) Sorting();
769
		if (redraw!=ONLY_SHOW) Sorting();
770
		list_full_redraw = true;
770
		list_full_redraw = true;
771
		if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw();
771
		if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw();
772
	}
772
	}
773
	if (files.count==-1) && (redraw!=ONLY_OPEN) 
773
	if (files.count==-1) && (redraw!=ONLY_OPEN) 
774
	{
774
	{
775
		files.KeyHome();
775
		files.KeyHome();
776
		if(!_not_draw) { list_full_redraw=true; List_ReDraw(); }
776
		if(!_not_draw) { list_full_redraw=true; List_ReDraw(); }
777
	}
777
	}
778
}
778
}
779
 
779
 
780
 
780
 
781
inline Sorting()
781
inline Sorting()
782
{
782
{
783
	dword k=0, l=1;
783
	dword k=0, l=1;
784
	dword file_off;
784
	dword file_off;
785
	if (!strncmp(#path,"/",2)) //do not sort
785
	if (!strncmp(#path,"/",2)) //do not sort
786
	{
786
	{
787
		for(k=1;k
787
		for(k=1;k
788
		return;
788
		return;
789
	}
789
	}
790
	for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;)  //files | folders
790
	for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;)  //files | folders
791
	{
791
	{
792
		if (!real_files_names_case) strttl(file_off+40);
792
		if (!real_files_names_case) strttl(file_off+40);
793
		if (TestBit(ESDWORD[file_off],4)) //directory?
793
		if (TestBit(ESDWORD[file_off],4)) //directory?
794
		{
794
		{
795
			file_mas[k]=j;
795
			file_mas[k]=j;
796
			k++;
796
			k++;
797
		}
797
		}
798
		else
798
		else
799
		{
799
		{
800
			file_mas[files.count-l]=j;
800
			file_mas[files.count-l]=j;
801
			l++;
801
			l++;
802
		}
802
		}
803
	}
803
	}
804
	//sorting: files first, then folders
804
	//sorting: files first, then folders
805
	Sort_by_Name(0,k-1);
805
	Sort_by_Name(0,k-1);
806
	if (sort_num==1) Sort_by_Name(k,files.count-1);
806
	if (sort_num==1) Sort_by_Name(k,files.count-1);
807
	if (sort_num==2) Sort_by_Type(k,files.count-1);
807
	if (sort_num==2) Sort_by_Type(k,files.count-1);
808
	if (sort_num==3) Sort_by_Size(k,files.count-1);
808
	if (sort_num==3) Sort_by_Size(k,files.count-1);
809
	//make ".." first item in list
809
	//make ".." first item in list
810
	if (k>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0)
810
	if (k>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0)
811
		for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",2)) {file_mas[k]>
811
		for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",2)) {file_mas[k]>
812
}
812
}
813
 
813
 
814
 
814
 
815
void Del_Form()
815
void Del_Form()
816
{
816
{
817
	dword selected_offset2;
817
	dword selected_offset2;
818
	int cont = 0;
818
	int cont = 0;
819
	byte f_count[128];
819
	byte f_count[128];
820
	int dform_x = files.w - 220 / 2 + files.x;
820
	int dform_x = files.w - 220 / 2 + files.x;
821
	if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return;
821
	if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return;
822
	else
822
	else
823
	{
823
	{
824
		if (!files.count) return;
824
		if (!files.count) return;
825
		DrawEolitePopup(T_YES, T_NO);
825
		DrawEolitePopup(T_YES, T_NO);
826
		WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE);
826
		WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE);
827
		for (i=0; i
827
		for (i=0; i
828
		{
828
		{
829
			selected_offset2 = file_mas[i]*304 + buf+32 + 7;
829
			selected_offset2 = file_mas[i]*304 + buf+32 + 7;
830
			if (ESBYTE[selected_offset2]) cont++;
830
			if (ESBYTE[selected_offset2]) cont++;
831
		}
831
		}
832
		if (cont)
832
		if (cont)
833
		{
833
		{
834
			sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,cont,DEL_MORE_FILES_2);
834
			sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,cont,DEL_MORE_FILES_2);
835
			WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count);
835
			WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count);
836
		}
836
		}
837
		else
837
		else
838
		{
838
		{
839
			if (strlen(#file_name)<28) 
839
			if (strlen(#file_name)<28) 
840
			{
840
			{
841
				WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,system.color.work_text,"?");
841
				WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,system.color.work_text,"?");
842
				WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,system.color.work_text,#file_name);
842
				WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,system.color.work_text,#file_name);
843
			}
843
			}
844
			else
844
			else
845
			{
845
			{
846
				WriteText(164+dform_x,190,0x80,0,"...?");
846
				WriteText(164+dform_x,190,0x80,0,"...?");
847
				ESI = 24;
847
				ESI = 24;
848
				WriteText(dform_x+20,190,0,0,#file_name);
848
				WriteText(dform_x+20,190,0,0,#file_name);
849
			}
849
			}
850
		}		
850
		}		
851
		del_active=1;
851
		del_active=1;
852
	}
852
	}
853
}
853
}
854
 
854
 
855
int del_error;
855
int del_error;
856
int Del_File2(dword way, sh_progr)
856
int Del_File2(dword way, sh_progr)
857
{    
857
{    
858
	dword dirbuf, fcount, i, filename;
858
	dword dirbuf, fcount, i, filename;
859
	int error;
859
	int error;
860
	char del_from[4096];
860
	char del_from[4096];
861
	if (isdir(way))
861
	if (isdir(way))
862
	{
862
	{
863
		if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error;
863
		if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error;
864
		for (i=0; i
864
		for (i=0; i
865
		{
865
		{
866
			if (CheckEvent()==evReDraw) draw_window();
866
			if (CheckEvent()==evReDraw) draw_window();
867
			filename = i*304+dirbuf+72;
867
			filename = i*304+dirbuf+72;
868
			sprintf(#del_from,"%s/%s",way,filename);
868
			sprintf(#del_from,"%s/%s",way,filename);
869
			if ( TestBit(ESDWORD[filename-40], 4) )
869
			if ( TestBit(ESDWORD[filename-40], 4) )
870
			{
870
			{
871
				Del_File2(#del_from, 1);
871
				Del_File2(#del_from, 1);
872
			}
872
			}
873
			else
873
			else
874
			{
874
			{
875
				if (sh_progr) Operation_Draw_Progress(#del_from);
875
				if (sh_progr) Operation_Draw_Progress(#del_from);
876
				if (error = DeleteFile(#del_from)) del_error = error;
876
				if (error = DeleteFile(#del_from)) del_error = error;
877
			}
877
			}
878
		}
878
		}
879
	}
879
	}
880
	if (error = DeleteFile(way)) del_error = error;
880
	if (error = DeleteFile(way)) del_error = error;
881
}
881
}
882
 
882
 
883
void Del_File_Thread()
883
void Del_File_Thread()
884
{   
884
{   
885
	byte del_from[4096];
885
	byte del_from[4096];
886
	dword selected_offset2;
886
	dword selected_offset2;
887
	int tst, count, i;
887
	int tst, count, i;
888
	
888
	
889
	file_count_copy = 0;
889
	file_count_copy = 0;
890
	copy_bar.value = 0; 
890
	copy_bar.value = 0; 
891
	operation_flag = DELETE_FLAG;
891
	operation_flag = DELETE_FLAG;
892
	
892
	
893
	if (selected_count)
893
	if (selected_count)
894
	{
894
	{
895
	   for (i=0; i
895
	   for (i=0; i
896
		  {
896
		  {
897
			   selected_offset2 = file_mas[i]*304 + buf+32 + 7;
897
			   selected_offset2 = file_mas[i]*304 + buf+32 + 7;
898
				if (ESBYTE[selected_offset2]) {
898
				if (ESBYTE[selected_offset2]) {
899
					sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
899
					sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
900
					GetFileInfo(#del_from, #file_info_count);
900
					GetFileInfo(#del_from, #file_info_count);
901
					if ( file_info_count.isfolder ) DirFileCount(#del_from);
901
					if ( file_info_count.isfolder ) DirFileCount(#del_from);
902
					else file_count_copy++;
902
					else file_count_copy++;
903
				}
903
				}
904
		   }
904
		   }
905
	}
905
	}
906
	else
906
	else
907
	{
907
	{
908
		if (itdir) DirFileCount(#file_path);
908
		if (itdir) DirFileCount(#file_path);
909
		else file_count_copy++;
909
		else file_count_copy++;
910
	}
910
	}
911
	
911
	
912
	copy_bar.max = file_count_copy;
912
	copy_bar.max = file_count_copy;
913
	
913
	
914
	del_error = 0;
914
	del_error = 0;
915
	DisplayOperationForm();
915
	DisplayOperationForm();
916
	if (selected_count)
916
	if (selected_count)
917
	{
917
	{
918
		for (i=0; i
918
		for (i=0; i
919
		{
919
		{
920
			selected_offset2 = file_mas[i]*304 + buf+32 + 7;
920
			selected_offset2 = file_mas[i]*304 + buf+32 + 7;
921
			if (ESBYTE[selected_offset2]) {
921
			if (ESBYTE[selected_offset2]) {
922
				sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
922
				sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
923
				Del_File2(#del_from, 1);
923
				Del_File2(#del_from, 1);
924
			}
924
			}
925
		}
925
		}
926
	}
926
	}
927
	else
927
	else
928
	{
928
	{
929
		Del_File2(#file_path, 1);			
929
		Del_File2(#file_path, 1);			
930
	}
930
	}
931
	if (del_error) Write_Error(del_error);
931
	if (del_error) Write_Error(del_error);
932
	cmd_free = 6;
932
	cmd_free = 6;
933
	DialogExit();
933
	DialogExit();
934
}
934
}
935
 
935
 
936
void Del_File(byte dodel) {
936
void Del_File(byte dodel) {
937
	del_active=0;
937
	del_active=0;
938
	if (dodel)
938
	if (dodel)
939
	{
939
	{
940
		delete_stak = malloc(40000);
940
		delete_stak = malloc(40000);
941
		CreateThread(#Del_File_Thread,delete_stak+40000-4);
941
		CreateThread(#Del_File_Thread,delete_stak+40000-4);
942
	}
942
	}
943
	else draw_window();
943
	else draw_window();
944
}
944
}
945
 
945
 
946
void SelectFileByName(dword that_file)
946
void SelectFileByName(dword that_file)
947
{
947
{
948
	int ind;
948
	int ind;
949
	files.KeyHome();
949
	files.KeyHome();
950
	Open_Dir(#path,ONLY_OPEN);
950
	Open_Dir(#path,ONLY_OPEN);
951
	if (!real_files_names_case) strttl(that_file);
951
	if (!real_files_names_case) strttl(that_file);
952
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
952
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
953
	files.cur_y = ind - 1;
953
	files.cur_y = ind - 1;
954
	files.KeyDown();
954
	files.KeyDown();
955
	List_ReDraw();
955
	List_ReDraw();
956
}
956
}
957
 
957
 
958
 
958
 
959
void Dir_Up()
959
void Dir_Up()
960
{
960
{
961
	char cur_folder[4096];
961
	char cur_folder[4096];
962
	i=strlen(#path)-1;
962
	i=strlen(#path)-1;
963
	if (i==0) return;
963
	if (i==0) return;
964
	path[i]=0x00;
964
	path[i]=0x00;
965
	i = strrchr(#path, '/');
965
	i = strrchr(#path, '/');
966
	strcpy(#cur_folder, #path+i);
966
	strcpy(#cur_folder, #path+i);
967
	path[i]=0x00;
967
	path[i]=0x00;
968
	SelectFileByName(#cur_folder);
968
	SelectFileByName(#cur_folder);
969
}
969
}
970
 
970
 
971
void Open(byte rez)
971
void Open(byte rez)
972
{
972
{
973
	byte temp[4096];
973
	byte temp[4096];
974
	selected_count = 0;
974
	selected_count = 0;
975
	if (rez)
975
	if (rez)
976
	{
976
	{
977
		if (!strncmp(#file_name,"..",3)) return;
977
		if (!strncmp(#file_name,"..",3)) return;
978
		strcpy(#temp, #file_path);
978
		strcpy(#temp, #file_path);
979
		if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end
979
		if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end
980
		RunProgram("/sys/File Managers/Eolite", #temp);
980
		RunProgram("/sys/File Managers/Eolite", #temp);
981
		return;
981
		return;
982
	}
982
	}
983
	if (!files.count) return;
983
	if (!files.count) return;
984
	if (!itdir)
984
	if (!itdir)
985
	{
985
	{
986
		if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
986
		if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
987
	} 
987
	} 
988
	else
988
	else
989
	{
989
	{
990
		if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
990
		if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
991
		strcpy(#path, #file_path);
991
		strcpy(#path, #file_path);
992
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
992
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
993
		files.first=files.cur_y=0;
993
		files.first=files.cur_y=0;
994
		Open_Dir(#path,WITH_REDRAW);
994
		Open_Dir(#path,WITH_REDRAW);
995
	}
995
	}
996
}
996
}
997
 
997
 
998
inline fastcall void GoBack()
998
inline fastcall void GoBack()
999
{
999
{
1000
	char cur_folder[4096];
1000
	char cur_folder[4096];
1001
	strcpy(#cur_folder, #path);
1001
	strcpy(#cur_folder, #path);
1002
	cur_folder[strlen(#cur_folder)-1]=0x00; //delete last '/'
1002
	cur_folder[strlen(#cur_folder)-1]=0x00; //delete last '/'
1003
	if (history.back()) {
1003
	if (history.back()) {
1004
		strcpy(#path, history.current());
1004
		strcpy(#path, history.current());
1005
		SelectFileByName(#cur_folder+strrchr(#cur_folder,'/'));
1005
		SelectFileByName(#cur_folder+strrchr(#cur_folder,'/'));
1006
	}
1006
	}
1007
}
1007
}
1008
 
1008
 
1009
void ShowOpenWithDialog()
1009
void ShowOpenWithDialog()
1010
{
1010
{
1011
	byte param[4097];
1011
	byte param[4097];
1012
	sprintf(#param,"~%s",#file_path);
1012
	sprintf(#param,"~%s",#file_path);
1013
	RunProgram("/sys/@open", #param);
1013
	RunProgram("/sys/@open", #param);
1014
}
1014
}
1015
 
1015
 
1016
void NewElement(byte newf)
1016
void NewElement(byte newf)
1017
{
1017
{
1018
	BDVK element_info;
1018
	BDVK element_info;
1019
	byte del_rezult, copy_rezult, info_result;
1019
	byte del_rezult, copy_rezult, info_result;
1020
	if (newf)
1020
	if (newf)
1021
	{
1021
	{
1022
		sprintf(#temp,"%s%s",#path,new_file_ed.text);
1022
		sprintf(#temp,"%s%s",#path,new_file_ed.text);
1023
		info_result = GetFileInfo(#temp, #element_info);
1023
		info_result = GetFileInfo(#temp, #element_info);
1024
		switch(new_element_active)
1024
		switch(new_element_active)
1025
		{
1025
		{
1026
			case CREATE_FILE:
1026
			case CREATE_FILE:
1027
				if (info_result==5)
1027
				if (info_result==5)
1028
				{
1028
				{
1029
					WriteFile(0, 0, #temp);
1029
					WriteFile(0, 0, #temp);
1030
					if (EAX)
1030
					if (EAX)
1031
					{
1031
					{
1032
						if (EAX==5) notify(NOT_CREATE_FILE);
1032
						if (EAX==5) notify(NOT_CREATE_FILE);
1033
						else Write_Error(EAX);
1033
						else Write_Error(EAX);
1034
					}
1034
					}
1035
				}
1035
				}
1036
				else
1036
				else
1037
				{
1037
				{
1038
					notify(FS_ITEM_ALREADY_EXISTS);
1038
					notify(FS_ITEM_ALREADY_EXISTS);
1039
				}
1039
				}
1040
				break;
1040
				break;
1041
			case CREATE_FOLDER:
1041
			case CREATE_FOLDER:
1042
				if (info_result==5)
1042
				if (info_result==5)
1043
				{
1043
				{
1044
					CreateDir(#temp);
1044
					CreateDir(#temp);
1045
					if (EAX)
1045
					if (EAX)
1046
					{
1046
					{
1047
						if (EAX==5) notify(NOT_CREATE_FOLDER);
1047
						if (EAX==5) notify(NOT_CREATE_FOLDER);
1048
						else Write_Error(EAX);
1048
						else Write_Error(EAX);
1049
					}
1049
					}
1050
				}
1050
				}
1051
				else
1051
				else
1052
				{
1052
				{
1053
					notify(FS_ITEM_ALREADY_EXISTS);
1053
					notify(FS_ITEM_ALREADY_EXISTS);
1054
				}
1054
				}
1055
				break;
1055
				break;
1056
			case RENAME_ITEM:
1056
			case RENAME_ITEM:
1057
				if (info_result==5)
1057
				if (info_result==5)
1058
				{
1058
				{
1059
					if (itdir)
1059
					if (itdir)
1060
					{
1060
					{
1061
						//rename only empty folders
1061
						//rename only empty folders
1062
						if (del_rezult = DeleteFile(#file_path))
1062
						if (del_rezult = DeleteFile(#file_path))
1063
						{
1063
						{
1064
							Write_Error(del_rezult);
1064
							Write_Error(del_rezult);
1065
							return;
1065
							return;
1066
						}
1066
						}
1067
						if (CreateDir(#temp)) CreateDir(#file_path);
1067
						if (CreateDir(#temp)) CreateDir(#file_path);
1068
						Open_Dir(#path,WITH_REDRAW);
1068
						Open_Dir(#path,WITH_REDRAW);
1069
						SelectFileByName(new_file_ed.text);
1069
						SelectFileByName(new_file_ed.text);
1070
					}
1070
					}
1071
					else
1071
					else
1072
					{
1072
					{
1073
						if (copy_rezult = CopyFile(#file_path,#temp))
1073
						if (copy_rezult = CopyFile(#file_path,#temp))
1074
						{
1074
						{
1075
							Write_Error(copy_rezult);
1075
							Write_Error(copy_rezult);
1076
						}
1076
						}
1077
						else
1077
						else
1078
						{
1078
						{
1079
							DeleteFile(#file_path);
1079
							DeleteFile(#file_path);
1080
							SelectFileByName(new_file_ed.text);
1080
							SelectFileByName(new_file_ed.text);
1081
						}
1081
						}
1082
					}
1082
					}
1083
				}
1083
				}
1084
				else
1084
				else
1085
				{
1085
				{
1086
					notify(FS_ITEM_ALREADY_EXISTS);
1086
					notify(FS_ITEM_ALREADY_EXISTS);
1087
				}
1087
				}
1088
		}
1088
		}
1089
		new_element_active = 0;
1089
		new_element_active = 0;
1090
		Open_Dir(#path,WITH_REDRAW);
1090
		Open_Dir(#path,WITH_REDRAW);
1091
		SelectFileByName(new_file_ed.text);
1091
		SelectFileByName(new_file_ed.text);
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
}
1095
}
1096
 
1096
 
1097
void NewElement_Form(byte crt, dword strng)
1097
void NewElement_Form(byte crt, dword strng)
1098
{
1098
{
1099
	int dform_x=files.w-220/2+files.x;
1099
	int dform_x=files.w-220/2+files.x;
1100
	if (!new_element_active)
1100
	if (!new_element_active)
1101
	{
1101
	{
1102
		new_element_active = crt;
1102
		new_element_active = crt;
1103
		strcpy(#new_element_name, strng);
1103
		strcpy(#new_element_name, strng);
1104
		new_file_ed.size = new_file_ed.pos = strlen(strng);
1104
		new_file_ed.size = new_file_ed.pos = strlen(strng);
1105
	}
1105
	}
1106
	if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL);
1106
	if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL);
1107
	else DrawEolitePopup(T_CREATE, T_CANCEL);
1107
	else DrawEolitePopup(T_CREATE, T_CANCEL);
1108
	new_file_ed.left = dform_x+24;
1108
	new_file_ed.left = dform_x+24;
1109
	edit_box_draw  stdcall (#new_file_ed);
1109
	edit_box_draw  stdcall (#new_file_ed);
1110
	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);
1111
	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);
1112
}
1112
}
1113
 
1113
 
1114
void FnProcess(byte N)
1114
void FnProcess(byte N)
1115
{
1115
{
1116
	switch(N)
1116
	switch(N)
1117
	{
1117
	{
1118
		case 1:
1118
		case 1:
1119
			if (!active_about) 
1119
			if (!active_about) 
1120
			{
1120
			{
1121
				about_stak = malloc(4096);
1121
				about_stak = malloc(4096);
1122
				about_window = CreateThread(#about_dialog,about_stak+4092);
1122
				about_window = CreateThread(#about_dialog,about_stak+4092);
1123
				break;
1123
				break;
1124
			}
1124
			}
1125
			else
1125
			else
1126
			{
1126
			{
1127
				ActivateWindow(GetProcessSlot(about_window));
1127
				ActivateWindow(GetProcessSlot(about_window));
1128
			}
1128
			}
1129
			break;
1129
			break;
1130
		case 2:
1130
		case 2:
1131
			if (!files.count) break;
1131
			if (!files.count) break;
1132
			NewElement_Form(RENAME_ITEM, #file_name);
1132
			NewElement_Form(RENAME_ITEM, #file_name);
1133
			break;
1133
			break;
1134
		case 3:
1134
		case 3:
1135
			if (!itdir) RunProgram("/sys/tinypad", #file_path);
1135
			if (!itdir) RunProgram("/sys/tinypad", #file_path);
1136
			break;
1136
			break;
1137
		case 4:
1137
		case 4:
1138
			if (!itdir) RunProgram("/sys/develop/heed", #file_path);
1138
			if (!itdir) RunProgram("/sys/develop/heed", #file_path);
1139
			break;
1139
			break;
1140
		case 5: //refresh cur dir & devs
1140
		case 5: //refresh cur dir & devs
1141
			if (two_panels)
1141
			if (two_panels)
1142
			{
1142
			{
1143
				DrawFilePanels();
1143
				DrawFilePanels();
1144
			}
1144
			}
1145
			else 
1145
			else 
1146
			{
1146
			{
1147
				Tip(56, T_DEVICES, 55, "-");
1147
				Tip(56, T_DEVICES, 55, "-");
1148
				Open_Dir(#path,WITH_REDRAW);
1148
				Open_Dir(#path,WITH_REDRAW);
1149
				pause(10);
1149
				pause(10);
1150
				SystemDiscs.Get();
1150
				SystemDiscs.Get();
1151
				Open_Dir(#path,WITH_REDRAW);
1151
				Open_Dir(#path,WITH_REDRAW);
1152
				DrawDeviceAndActionsLeftPanel();				
1152
				DrawDeviceAndActionsLeftPanel();				
1153
			}
1153
			}
1154
			break;
1154
			break;
1155
		case 6:
1155
		case 6:
1156
			NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER);
1156
			NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER);
1157
			break;
1157
			break;
1158
		case 7:
1158
		case 7:
1159
			NewElement_Form(CREATE_FILE, T_NEW_FILE);
1159
			NewElement_Form(CREATE_FILE, T_NEW_FILE);
1160
			break;
1160
			break;
1161
		case 8:
1161
		case 8:
1162
			properties_stak = malloc(8096);
1162
			properties_stak = malloc(8096);
1163
			CreateThread(#properties_dialog, properties_stak+8092);
1163
			CreateThread(#properties_dialog, properties_stak+8092);
1164
			break;
1164
			break;
1165
		case 10: //F10
1165
		case 10: //F10
1166
			if (!active_settings) 
1166
			if (!active_settings) 
1167
			{
1167
			{
1168
				settings_stak = malloc(4096);
1168
				settings_stak = malloc(4096);
1169
				settings_window = CreateThread(#settings_dialog, settings_stak+4092);
1169
				settings_window = CreateThread(#settings_dialog, settings_stak+4092);
1170
				break;
1170
				break;
1171
			}
1171
			}
1172
			else
1172
			else
1173
			{
1173
			{
1174
				ActivateWindow(GetProcessSlot(settings_window));
1174
				ActivateWindow(GetProcessSlot(settings_window));
1175
			}
1175
			}
1176
			break;
1176
			break;
1177
	}
1177
	}
1178
}
1178
}
1179
 
1179
 
1180
void ChangeActivePanel()
1180
void ChangeActivePanel()
1181
{
1181
{
1182
	llist_copy(#files_active, #files_inactive);
1182
	llist_copy(#files_active, #files_inactive);
1183
	llist_copy(#files_inactive, #files);
1183
	llist_copy(#files_inactive, #files);
1184
	strcpy(#active_path, #inactive_path);
1184
	strcpy(#active_path, #inactive_path);
1185
	strcpy(#inactive_path, #path);
1185
	strcpy(#inactive_path, #path);
1186
	DrawFilePanels();
1186
	DrawFilePanels();
1187
}
1187
}
1188
 
1188
 
1189
 
1189
 
1190
stop:
1190
stop:
1191
>
1191
>
1192
>
1192
>
1193
>
1193
>
1194
>
1194
>