Subversion Repositories Kolibri OS

Rev

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

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