Subversion Repositories Kolibri OS

Rev

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

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