Subversion Repositories Kolibri OS

Rev

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

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