Subversion Repositories Kolibri OS

Rev

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

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