Subversion Repositories Kolibri OS

Rev

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

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