Subversion Repositories Kolibri OS

Rev

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

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