Subversion Repositories Kolibri OS

Rev

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

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