Subversion Repositories Kolibri OS

Rev

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

Rev 8943 Rev 8944
1
//Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2021
1
//Leency, Veliant, Punk_Joker, PavelYakov & KolibriOS Team 2008-2021
2
//GNU GPL license.
2
//GNU GPL license.
3
 
3
 
4
// 70.5 - get volume info and label
4
// 70.5 - get volume info and label
5
 
5
 
6
#define ABOUT_TITLE "EOLITE 5 RC4"
6
#define ABOUT_TITLE "EOLITE 5 RC4"
7
#define TITLE_EOLITE "Eolite File Manager 5 RC4"
7
#define TITLE_EOLITE "Eolite File Manager 5 RC4"
8
#define TITLE_KFM "Kolibri File Manager 2 RC4";
8
#define TITLE_KFM "Kolibri File Manager 2 RC4";
9
 
9
 
10
#define MEMSIZE 1024 * 250
10
#define MEMSIZE 1024 * 250
11
#include "../lib/clipboard.h"
11
#include "../lib/clipboard.h"
12
#include "../lib/strings.h"
12
#include "../lib/strings.h"
13
#include "../lib/mem.h"
13
#include "../lib/mem.h"
14
#include "../lib/fs.h"
14
#include "../lib/fs.h"
15
#include "../lib/gui.h"
15
#include "../lib/gui.h"
16
#include "../lib/list_box.h"
16
#include "../lib/list_box.h"
17
#include "../lib/random.h"
17
#include "../lib/random.h"
18
#include "../lib/kfont.h"
18
#include "../lib/kfont.h"
19
#include "../lib/collection.h"
19
#include "../lib/collection.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
#include "../lib/obj/libimg.h"
24
#include "../lib/obj/libimg.h"
25
 
25
 
26
#include "../lib/patterns/history.h"
26
#include "../lib/patterns/history.h"
27
#include "../lib/patterns/toolbar_button.h"
27
#include "../lib/patterns/toolbar_button.h"
28
 
28
 
29
#include "imgs/images.h"
29
#include "imgs/images.h"
30
 
30
 
31
//Button IDs
31
//Button IDs
32
enum {
32
enum {
33
	PATH_BTN = 10,
33
	PATH_BTN = 10,
34
	POPUP_BTN1 = 201,
34
	POPUP_BTN1 = 201,
35
	POPUP_BTN2 = 202,
35
	POPUP_BTN2 = 202,
36
	KFM_DEV_DROPDOWN_1 = 205,
36
	KFM_DEV_DROPDOWN_1 = 205,
37
	KFM_DEV_DROPDOWN_2 = 207,
37
	KFM_DEV_DROPDOWN_2 = 207,
38
	BREADCRUMB_ID = 300,
38
	BREADCRUMB_ID = 300,
39
 
39
 
40
	BACK_BTN = 400,
40
	BACK_BTN = 400,
41
	FWRD_BTN,
41
	FWRD_BTN,
42
	GOUP_BTN,
42
	GOUP_BTN,
43
	COPY_BTN,
43
	COPY_BTN,
44
	CUT_BTN,
44
	CUT_BTN,
45
	PASTE_BTN,
45
	PASTE_BTN,
46
	KFM_FUNC_ID = 450
46
	KFM_FUNC_ID = 450
47
};
47
};
48
 
48
 
49
//NewElement options
49
//NewElement options
50
enum {
50
enum {
51
	CREATE_FILE=1, 
51
	CREATE_FILE=1, 
52
	CREATE_FOLDER, 
52
	CREATE_FOLDER, 
53
	RENAME_ITEM
53
	RENAME_ITEM
54
}; 
54
}; 
55
 
55
 
56
//OpenDir options
56
//OpenDir options
57
enum {
57
enum {
58
	WITH_REDRAW, 
58
	WITH_REDRAW, 
59
	ONLY_OPEN
59
	ONLY_OPEN
60
};
60
};
61
 
61
 
62
_history history;
62
_history history;
63
 
63
 
64
struct Eolite_colors
64
struct Eolite_colors
65
{
65
{
66
	bool  def;
66
	bool  def;
67
	dword lpanel;
67
	dword lpanel;
68
	dword list_vert_line; //vertical line between columns in list
68
	dword list_vert_line; //vertical line between columns in list
69
	dword selec;
69
	dword selec;
70
	dword selec_active;
70
	dword selec_active;
71
	dword selec_inactive;
71
	dword selec_inactive;
72
	dword selec_text;
72
	dword selec_text;
73
	dword list_bg;
73
	dword list_bg;
74
	dword list_gb_text;
74
	dword list_gb_text;
75
	dword list_text_hidden;
75
	dword list_text_hidden;
76
	dword work_gradient[24];
76
	dword work_gradient[24];
77
	dword slider_bg_big;
77
	dword slider_bg_big;
78
	dword slider_bg_left;
78
	dword slider_bg_left;
79
	dword odd_line;
79
	dword odd_line;
80
} col;
80
} col;
81
dword waves_pal[256];
81
dword waves_pal[256];
82
 
82
 
83
bool efm = false;
83
bool efm = false;
84
 
84
 
85
int toolbar_buttons_x[7]={9,46,85,134,167,203};
85
int toolbar_buttons_x[7]={9,46,85,134,167,203};
86
 
86
 
87
bool active_about = false;
87
bool active_about = false;
88
bool active_settings = false;
88
bool active_settings = false;
89
bool _not_draw = false;
89
bool _not_draw = false;
90
bool dir_at_fat16 = NULL;
90
bool dir_at_fat16 = NULL;
91
 
91
 
92
bool disk_popin_active_on_panel=0;
92
bool disk_popin_active_on_panel=0;
93
 
93
 
94
dword about_thread_id;
94
dword about_thread_id;
95
dword settings_window;
95
dword settings_window;
96
 
96
 
97
byte del_active=0;
97
byte del_active=0;
98
byte new_element_active=0;
98
byte new_element_active=0;
99
 
99
 
100
llist files, files_active, files_inactive;
100
llist files, files_active, files_inactive;
101
 
101
 
102
byte list_full_redraw;
102
byte list_full_redraw;
103
 
103
 
104
dword buf;
104
dword buf;
105
collection_int items=0;
105
collection_int items=0;
106
int selected_count;
106
int selected_count;
107
int count_dir;
107
int count_dir;
108
 
108
 
109
byte path[4096];
109
byte path[4096];
110
byte file_path[4096];
110
byte file_path[4096];
111
byte file_name[256];
111
byte file_name[256];
112
byte new_element_name[256];
112
byte new_element_name[256];
113
byte temp[4096];
113
byte temp[4096];
114
bool itdir;
114
bool itdir;
115
 
115
 
116
char active_path[4096], inactive_path[4096];
116
char active_path[4096], inactive_path[4096];
117
 
117
 
118
dword eolite_ini_path[4096];
118
dword eolite_ini_path[4096];
119
_ini ini;
119
_ini ini;
120
 
120
 
121
char scroll_used=false;
121
char scroll_used=false;
122
 
122
 
123
dword about_stak=0,properties_stak=0,settings_stak=0;
123
dword about_stak=0,properties_stak=0,settings_stak=0;
124
 
124
 
125
proc_info Form;
125
proc_info Form;
126
int sc_slider_h;
126
int sc_slider_h;
127
int action_buf;
127
int action_buf;
128
int rand_n;
128
int rand_n;
129
 
129
 
130
char sort_type=2;
130
char sort_type=2;
131
bool sort_desc=false;
131
bool sort_desc=false;
132
int active_panel=1;
132
int active_panel=1;
133
 
133
 
134
libimg_image icons16_default;
134
libimg_image icons16_default;
135
libimg_image icons16_selected;
135
libimg_image icons16_selected;
136
 
136
 
137
libimg_image icons32_default;
137
libimg_image icons32_default;
138
libimg_image icons32_selected;
138
libimg_image icons32_selected;
139
 
139
 
140
int status_bar_h;
140
int status_bar_h;
141
 
141
 
142
int icon_size = 18;
142
int icon_size = 18;
143
 
143
 
144
edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000,
144
edit_box new_file_ed = {200,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0x10000000,
145
	248,#new_element_name,0,ed_focus+ed_always_focus,6,0};
145
	248,#new_element_name,0,ed_focus+ed_always_focus,6,0};
146
PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
146
PathShow_data FileShow = {0, 56,215, 8, 100, 1, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
147
byte cmd_free=0;
147
byte cmd_free=0;
148
#include "include\translations.h"
148
#include "include\translations.h"
149
 
149
 
150
#include "include\gui.h"
150
#include "include\gui.h"
151
#include "include\settings.h"
151
#include "include\settings.h"
152
#include "include\progress_dialog.h"
152
#include "include\progress_dialog.h"
153
#include "include\copy_and_delete.h"
153
#include "include\copy_and_delete.h"
154
#include "include\sorting.h"
154
#include "include\sorting.h"
155
#include "include\icons.h"
155
#include "include\icons.h"
156
#include "include\left_panel.h"
156
#include "include\left_panel.h"
157
#include "include\menu.h"
157
#include "include\menu.h"
158
#include "include\about.h"
158
#include "include\about.h"
159
#include "include\properties.h"
159
#include "include\properties.h"
160
#include "include\breadcrumbs.h"
160
#include "include\breadcrumbs.h"
161
 
161
 
162
void load_libraries()
162
void load_libraries()
163
{
163
{
164
	load_dll(boxlib, #box_lib_init,0);
164
	load_dll(boxlib, #box_lib_init,0);
165
	load_dll(libini, #lib_init,1);
165
	load_dll(libini, #lib_init,1);
166
	load_dll(libimg, #libimg_init,1);
166
	load_dll(libimg, #libimg_init,1);
167
}
167
}
168
 
168
 
169
void handle_param()
169
void handle_param()
170
{
170
{
171
	//-p  : just show file/folder properties dialog
171
	//-p  : just show file/folder properties dialog
172
	//-d  : delete file/folder
172
	//-d  : delete file/folder
173
	//-v : paste files/folder from clipboard
173
	//-v : paste files/folder from clipboard
174
	dword p = #param;
174
	dword p = #param;
175
	if (param[0]=='\\') && (param[1]=='E') && (param[2]=='F') && (param[3]=='M') {
175
	if (param[0]=='\\') && (param[1]=='E') && (param[2]=='F') && (param[3]=='M') {
176
		efm = true;
176
		efm = true;
177
		p += 4;
177
		p += 4;
178
		if (param[4]==' ') p++;
178
		if (param[4]==' ') p++;
179
	}
179
	}
180
 
180
 
181
	LoadIniSettings();
181
	LoadIniSettings();
182
 
182
 
183
	if (ESBYTE[p]=='\0') return;
183
	if (ESBYTE[p]=='\0') return;
184
 
184
 
185
	if (ESBYTE[p]=='-') switch (ESBYTE[p+1]) 
185
	if (ESBYTE[p]=='-') switch (ESBYTE[p+1]) 
186
	{
186
	{
187
		case 'p':
187
		case 'p':
188
			strcpy(#file_path, p + 3);
188
			strcpy(#file_path, p + 3);
189
			itdir = dir_exists(#file_path);
189
			itdir = dir_exists(#file_path);
190
			strcpy(#file_name, p + strrchr(p, '/'));
190
			strcpy(#file_name, p + strrchr(p, '/'));
191
			ESBYTE[strrchr(p, '/')+p-1] = '\0';
191
			ESBYTE[strrchr(p, '/')+p-1] = '\0';
192
			strcpy(#path, p + 3);
192
			strcpy(#path, p + 3);
193
			properties_dialog();
193
			properties_dialog();
194
			ExitProcess();
194
			ExitProcess();
195
		case 'd':
195
		case 'd':
196
			strcpy(#path, p + 3);
196
			strcpy(#path, p + 3);
197
			DeleteThread();
197
			DeleteThread();
198
			ExitProcess();
198
			ExitProcess();
199
		case 'v':
199
		case 'v':
200
			cut_active = ESBYTE[p+2] - '0';
200
			cut_active = ESBYTE[p+2] - '0';
201
			strcpy(#path, p + 4);
201
			strcpy(#path, p + 4);
202
			PasteThread();
202
			PasteThread();
203
			ExitProcess();
203
			ExitProcess();
204
	}
204
	}
205
 
205
 
206
	ESBYTE[0] = NULL;
206
	ESBYTE[0] = NULL;
207
 
207
 
208
	if (param[strlen(#param)-1]=='/') ESBYTE[strlen(#param)-1]=NULL; //no "/" at the end
208
	if (param[strlen(#param)-1]=='/') ESBYTE[strlen(#param)-1]=NULL; //no "/" at the end
209
 
209
 
210
	if (dir_exists(p)) {
210
	if (dir_exists(p)) {
211
		strcpy(#path, p);
211
		strcpy(#path, p);
212
	} else {
212
	} else {
213
		if (file_exists(p)) {
213
		if (file_exists(p)) {
214
			ESBYTE[strrchr(p, '/')+p-1] = '\0';
214
			ESBYTE[strrchr(p, '/')+p-1] = '\0';
215
			strcpy(#path, p);
215
			strcpy(#path, p);
216
			SelectFileByName(p+strlen(#path)+1);
216
			SelectFileByName(p+strlen(#path)+1);
217
		} else {
217
		} else {
218
			notify(T_NOTIFY_APP_PARAM_WRONG);
218
			notify(T_NOTIFY_APP_PARAM_WRONG);
219
		}
219
		}
220
	}	
220
	}	
221
}
221
}
222
 
222
 
223
void main() 
223
void main() 
224
{
224
{
225
	dword id;
225
	dword id;
226
	int old_cur_y;
226
	int old_cur_y;
227
 
227
 
228
	load_libraries();
228
	load_libraries();
229
	SetAppColors();
229
	SetAppColors();
230
 
230
 
231
	ESBYTE[0] = NULL;
231
	ESBYTE[0] = NULL;
232
 
232
 
233
	handle_param();
233
	handle_param();
234
	rand_n = random(80);
234
	rand_n = random(80);
235
 
235
 
236
	ESBYTE[0] = NULL;
236
	ESBYTE[0] = NULL;
237
 
237
 
238
	SystemDiscs.Get();
238
	SystemDiscs.Get();
239
	Open_Dir(#path,ONLY_OPEN);
239
	Open_Dir(#path,ONLY_OPEN);
240
	strcpy(#inactive_path, #path);
240
	strcpy(#inactive_path, #path);
241
	llist_copy(#files_inactive, #files);
241
	llist_copy(#files_inactive, #files);
242
	SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
242
	SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
243
	loop() switch(@WaitEventTimeout(80))
243
	loop() switch(@WaitEventTimeout(80))
244
	{
244
	{
245
		case evMouse:
245
		case evMouse:
246
			if (del_active) || (disk_popin_active_on_panel) || (Form.status_window>2) break;
246
			if (del_active) || (disk_popin_active_on_panel) || (Form.status_window>2) break;
247
			if (new_element_active) 
247
			if (new_element_active) 
248
			{
248
			{
249
				edit_box_mouse stdcall(#new_file_ed);
249
				edit_box_mouse stdcall(#new_file_ed);
250
				break;
250
				break;
251
			}				
251
			}				
252
			
252
			
253
			mouse.get();
253
			mouse.get();
254
 
254
 
255
			ProceedMouseGestures();
255
			ProceedMouseGestures();
256
 
256
 
257
			if (mouse.vert)
257
			if (mouse.vert)
258
			{
258
			{
259
				if (files.MouseScroll(mouse.vert)) List_ReDraw();
259
				if (files.MouseScroll(mouse.vert)) List_ReDraw();
260
				break;
260
				break;
261
			}
261
			}
262
 
262
 
263
			if (files.MouseOver(mouse.x, mouse.y))
263
			if (files.MouseOver(mouse.x, mouse.y))
264
			{
264
			{
265
				//select file
265
				//select file
266
				if (mouse.key&MOUSE_LEFT) && (mouse.up)
266
				if (mouse.key&MOUSE_LEFT) && (mouse.up)
267
				{
267
				{
268
					GetKeyModifier();
268
					GetKeyModifier();
269
					old_cur_y = files.cur_y;
269
					old_cur_y = files.cur_y;
270
					if (files.ProcessMouse(mouse.x, mouse.y)) && (!key_modifier) {
270
					if (files.ProcessMouse(mouse.x, mouse.y)) && (!key_modifier) {
271
						List_ReDraw();
271
						List_ReDraw();
272
						break;
272
						break;
273
					}
273
					}
274
					if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) {
274
					if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) {
275
						EventChooseFilesRange(old_cur_y, files.cur_y);
275
						EventChooseFilesRange(old_cur_y, files.cur_y);
276
					} else if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) {
276
					} else if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) {
277
						EventChooseFile(files.cur_y);
277
						EventChooseFile(files.cur_y);
278
						DrawStatusBar();
278
						DrawStatusBar();
279
						List_ReDraw();
279
						List_ReDraw();
280
					} else {
280
					} else {
281
						if (mouse.y - files.y / files.item_h + files.first == files.cur_y) EventOpen(0);
281
						if (mouse.y - files.y / files.item_h + files.first == files.cur_y) EventOpen(0);
282
					}
282
					}
283
				}
283
				}
284
				//file menu
284
				//file menu
285
				if (mouse.key&MOUSE_RIGHT) && (mouse.up)
285
				if (mouse.key&MOUSE_RIGHT) && (mouse.up)
286
				{
286
				{
287
					if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw();
287
					if (files.ProcessMouse(mouse.x, mouse.y)) List_ReDraw();
288
					if (getElementSelectedFlag(files.cur_y) == false) selected_count = 0; //on redraw selection would be flashed, see [L001] 
288
					if (getElementSelectedFlag(files.cur_y) == false) selected_count = 0; //on redraw selection would be flashed, see [L001] 
289
					EventShowListMenu();
289
					EventShowListMenu();
290
				}
290
				}
291
			}
291
			}
292
 
292
 
293
			if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y
293
			if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y-17) && (mouse.y
294
			{
294
			{
295
				if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_dark,sc.work_light);
295
				if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_dark,sc.work_light);
296
				WHILE (mouse.lkm) && (files.first>0)
296
				WHILE (mouse.lkm) && (files.first>0)
297
				{
297
				{
298
					pause(8);
298
					pause(8);
299
					files.first--;
299
					files.first--;
300
					List_ReDraw();
300
					List_ReDraw();
301
					mouse.get();
301
					mouse.get();
302
				}
302
				}
303
				DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_light,sc.work_dark);
303
				DrawRectangle3D(files.x+files.w+1,files.y-16,14,14,sc.work_light,sc.work_dark);
304
			}
304
			}
305
 
305
 
306
			if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y+files.h-16) && (mouse.y
306
			if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+16) && (mouse.y>files.y+files.h-16) && (mouse.y
307
			{
307
			{
308
				if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_dark,sc.work_light);
308
				if (mouse.lkm) DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_dark,sc.work_light);
309
				while (mouse.lkm) && (files.first
309
				while (mouse.lkm) && (files.first
310
				{
310
				{
311
					pause(8);
311
					pause(8);
312
					files.first++;
312
					files.first++;
313
					List_ReDraw();
313
					List_ReDraw();
314
					mouse.get();
314
					mouse.get();
315
				}
315
				}
316
				DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_light,sc.work_dark);
316
				DrawRectangle3D(files.x+files.w+1,files.y+files.h-15,14,14,sc.work_light,sc.work_dark);
317
			}
317
			}
318
 
318
 
319
			//Scrooll
319
			//Scrooll
320
			if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) 
320
			if (mouse.x>=files.x+files.w) && (mouse.x<=files.x+files.w+18) && (mouse.y>files.y) 
321
				&& (mouse.y
321
				&& (mouse.y
322
			if (scroll_used) && (!mouse.key&MOUSE_LEFT) { scroll_used=false; Scroll(); }
322
			if (scroll_used) && (!mouse.key&MOUSE_LEFT) { scroll_used=false; Scroll(); }
323
			
323
			
324
			if (scroll_used)
324
			if (scroll_used)
325
			{
325
			{
326
				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
326
				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
327
				id = files.first;
327
				id = files.first;
328
				files.first = -sc_slider_h / 2 + mouse.y -files.y * files.count;
328
				files.first = -sc_slider_h / 2 + mouse.y -files.y * files.count;
329
				files.first /= files.h - 18;
329
				files.first /= files.h - 18;
330
				if (files.visible+files.first>files.count) files.first=files.count-files.visible;
330
				if (files.visible+files.first>files.count) files.first=files.count-files.visible;
331
				if (files.first<0) files.first=0;
331
				if (files.first<0) files.first=0;
332
				if (id!=files.first) List_ReDraw();
332
				if (id!=files.first) List_ReDraw();
333
				break;
333
				break;
334
			}
334
			}
335
 
335
 
336
			if (efm) && (mouse.y < files.y + files.h) && (mouse.down) {
336
			if (efm) && (mouse.y < files.y + files.h) && (mouse.down) {
337
				if (mouse.x
337
				if (mouse.x
338
					if (active_panel!=1) ChangeActivePanel();
338
					if (active_panel!=1) ChangeActivePanel();
339
				} else {
339
				} else {
340
					if (active_panel!=2) ChangeActivePanel();
340
					if (active_panel!=2) ChangeActivePanel();
341
				}
341
				}
342
			}
342
			}
343
			break;  
343
			break;  
344
//Button pressed-----------------------------------------------------------------------------
344
//Button pressed-----------------------------------------------------------------------------
345
		case evButton:
345
		case evButton:
346
			id = GetButtonID();
346
			id = GetButtonID();
347
 
347
 
348
			if (id==CLOSE_BTN) {
348
			if (id==CLOSE_BTN) {
349
				KillProcess(about_thread_id);
349
				KillProcess(about_thread_id);
350
				SaveIniSettings();
350
				SaveIniSettings();
351
				ExitProcess();
351
				ExitProcess();
352
			}
352
			}
353
 
353
 
354
			if (new_element_active) || (del_active) || (disk_popin_active_on_panel) {
354
			if (new_element_active) || (del_active) || (disk_popin_active_on_panel) {
355
				if (POPUP_BTN1==id) && (del_active) EventDelete();
355
				if (POPUP_BTN1==id) && (del_active) EventDelete();
356
				if (POPUP_BTN1==id) && (new_element_active) NewElement();
356
				if (POPUP_BTN1==id) && (new_element_active) NewElement();
357
				if (POPUP_BTN2==id) EventClosePopinForm();
357
				if (POPUP_BTN2==id) EventClosePopinForm();
358
				if (disk_popin_active_on_panel) {
358
				if (disk_popin_active_on_panel) {
359
					if (id>=100) && (id<=120) EventDriveClick(id);
359
					if (id>=100) && (id<=120) EventDriveClick(id);
360
					else EventClosePopinForm();
360
					else EventClosePopinForm();
361
				}
361
				}
362
				break;					
362
				break;					
363
			}
363
			}
364
 
364
 
365
			switch(id) 
365
			switch(id) 
366
			{
366
			{
367
				case PATH_BTN:
367
				case PATH_BTN:
368
						notify(COPY_PATH_STR);
368
						notify(COPY_PATH_STR);
369
						Clipboard__CopyText(#path);
369
						Clipboard__CopyText(#path);
370
						break;
370
						break;
371
				case KFM_DEV_DROPDOWN_1:
371
				case KFM_DEV_DROPDOWN_1:
372
				case KFM_DEV_DROPDOWN_1+1:
372
				case KFM_DEV_DROPDOWN_1+1:
373
						EventOpenDiskPopin(1);
373
						EventOpenDiskPopin(1);
374
						break;
374
						break;
375
				case KFM_DEV_DROPDOWN_2:
375
				case KFM_DEV_DROPDOWN_2:
376
				case KFM_DEV_DROPDOWN_2+1:
376
				case KFM_DEV_DROPDOWN_2+1:
377
						EventOpenDiskPopin(2);
377
						EventOpenDiskPopin(2);
378
						break;
378
						break;
379
				case BACK_BTN...PASTE_BTN:
379
				case BACK_BTN...PASTE_BTN:
380
						if (active_panel==2) ChangeActivePanel();
380
						if (active_panel==2) ChangeActivePanel();
381
						EventToolbarButtonClick(id);
381
						EventToolbarButtonClick(id);
382
						break;
382
						break;
383
				case BACK_BTN+100...PASTE_BTN+100:
383
				case BACK_BTN+100...PASTE_BTN+100:
384
						if (active_panel==1) ChangeActivePanel();
384
						if (active_panel==1) ChangeActivePanel();
385
						EventToolbarButtonClick(id-100);
385
						EventToolbarButtonClick(id-100);
386
						break;
386
						break;
387
				case 31...33:
387
				case 31...33:
388
						EventSort(id-30);
388
						EventSort(id-30);
389
						break;
389
						break;
390
				case 51:
390
				case 51:
391
						EventShowBurgerMenu();
391
						EventShowBurgerMenu();
392
						break;
392
						break;
393
				case 52...60: //Actions
393
				case 52...60: //Actions
394
						FnProcess(id-50);
394
						FnProcess(id-50);
395
						break;
395
						break;
396
				case 61: // Set path as default
396
				case 61: // Set path as default
397
						SetDefaultPath(#path);
397
						SetDefaultPath(#path);
398
						break;
398
						break;
399
				case 100...120:
399
				case 100...120:
400
					EventDriveClick(id);
400
					EventDriveClick(id);
401
					break;
401
					break;
402
				case BREADCRUMB_ID...360:
402
				case BREADCRUMB_ID...360:
403
					ClickOnBreadCrumb(id-BREADCRUMB_ID);
403
					ClickOnBreadCrumb(id-BREADCRUMB_ID);
404
					break;
404
					break;
405
				case KFM_FUNC_ID...KFM_FUNC_ID+10:
405
				case KFM_FUNC_ID...KFM_FUNC_ID+10:
406
					FnProcess(id-KFM_FUNC_ID);
406
					FnProcess(id-KFM_FUNC_ID);
407
					break;
407
					break;
408
			}
408
			}
409
			break;
409
			break;
410
			
410
			
411
//Key pressed-----------------------------------------------------------------------------
411
//Key pressed-----------------------------------------------------------------------------
412
		case evKey:
412
		case evKey:
413
			GetKeys();
413
			GetKeys();
414
 
414
 
415
			if (Form.status_window>2) break;
415
			if (Form.status_window>2) break;
416
 
416
 
417
			if (new_element_active) || (del_active) || (disk_popin_active_on_panel)
417
			if (new_element_active) || (del_active) || (disk_popin_active_on_panel)
418
			{
418
			{
419
				if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm();
419
				if (key_scancode == SCAN_CODE_ESC) EventClosePopinForm();
420
 
420
 
421
				if (del_active) {
421
				if (del_active) {
422
					if (key_scancode == SCAN_CODE_ENTER) EventDelete();
422
					if (key_scancode == SCAN_CODE_ENTER) EventDelete();
423
				}
423
				}
424
				if (new_element_active) {
424
				if (new_element_active) {
425
					if (key_scancode == SCAN_CODE_ENTER) NewElement();
425
					if (key_scancode == SCAN_CODE_ENTER) NewElement();
426
					EAX = key_editbox;
426
					EAX = key_editbox;
427
					edit_box_key stdcall (#new_file_ed);
427
					edit_box_key stdcall (#new_file_ed);
428
				}
428
				}
429
				break;
429
				break;
430
			}
430
			}
431
 
431
 
432
			if (key_modifier&KEY_LALT) || (key_modifier&KEY_RALT) {
432
			if (key_modifier&KEY_LALT) || (key_modifier&KEY_RALT) {
433
				if (key_scancode == SCAN_CODE_F1) EventOpenDiskPopin(1);
433
				if (key_scancode == SCAN_CODE_F1) EventOpenDiskPopin(1);
434
				if (key_scancode == SCAN_CODE_F2) EventOpenDiskPopin(2);
434
				if (key_scancode == SCAN_CODE_F2) EventOpenDiskPopin(2);
435
				break;
435
				break;
436
			}
436
			}
437
			if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) {
437
			if (key_modifier&KEY_LSHIFT) || (key_modifier&KEY_RSHIFT) {
438
 
438
 
439
				if (key_scancode == SCAN_CODE_ENTER) {
439
				if (key_scancode == SCAN_CODE_ENTER) {
440
					EventOpenSelected(); 
440
					EventOpenSelected(); 
441
					break;
441
					break;
442
				}
442
				}
443
 
443
 
444
				old_cur_y = files.cur_y;
444
				old_cur_y = files.cur_y;
445
				files.ProcessKey(key_scancode);
445
				files.ProcessKey(key_scancode);
446
				EventChooseFilesRange(old_cur_y, files.cur_y);
446
				EventChooseFilesRange(old_cur_y, files.cur_y);
447
				break;
447
				break;
448
			}
448
			}
449
 
449
 
450
			if (files.ProcessKey(key_scancode))
450
			if (files.ProcessKey(key_scancode))
451
			{
451
			{
452
				List_ReDraw();
452
				List_ReDraw();
453
				break;
453
				break;
454
			}
454
			}
455
 
455
 
456
			if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL)
456
			if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL)
457
			{
457
			{
458
				switch(key_scancode)
458
				switch(key_scancode)
459
				{
459
				{
460
					case SCAN_CODE_F1...SCAN_CODE_F3:
460
					case SCAN_CODE_F1...SCAN_CODE_F3:
461
							EventSort(key_scancode - 58);
461
							EventSort(key_scancode - 58);
462
							break;
462
							break;
463
					case SCAN_CODE_1...SCAN_CODE_10:
463
					case SCAN_CODE_1...SCAN_CODE_10:
464
							key_scancode-=2;
464
							key_scancode-=2;
465
							if (key_scancode >= SystemDiscs.list.count) break;
465
							if (key_scancode >= SystemDiscs.list.count) break;
466
							if (!efm) {
466
							if (!efm) {
467
								DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click
467
								DrawRectangle(17,key_scancode*16+74,159,16, 0); //display click
468
								pause(7);										
468
								pause(7);										
469
							}
469
							}
470
							SystemDiscs.Click(key_scancode);
470
							SystemDiscs.Click(key_scancode);
471
							break;
471
							break;
472
					case SCAN_CODE_KEY_X:
472
					case SCAN_CODE_KEY_X:
473
							CopyFilesListToClipboard(CUT);
473
							CopyFilesListToClipboard(CUT);
474
							break;						
474
							break;						
475
					case SCAN_CODE_KEY_C:
475
					case SCAN_CODE_KEY_C:
476
							CopyFilesListToClipboard(COPY);
476
							CopyFilesListToClipboard(COPY);
477
							break;
477
							break;
478
					case SCAN_CODE_KEY_G:
478
					case SCAN_CODE_KEY_G:
479
							EventOpenConsoleHere();
479
							EventOpenConsoleHere();
480
							break;
480
							break;
481
					case SCAN_CODE_KEY_V:
481
					case SCAN_CODE_KEY_V:
482
							EventPaste(#path);
482
							EventPaste(#path);
483
							break;
483
							break;
484
					case SCAN_CODE_KEY_D: //set image as bg
484
					case SCAN_CODE_KEY_D: //set image as bg
485
							strlcpy(#temp, "\\S__",4);
485
							strlcpy(#temp, "\\S__",4);
486
							strcat(#temp, #file_path);
486
							strcat(#temp, #file_path);
487
							RunProgram("/sys/media/kiv", #temp);
487
							RunProgram("/sys/media/kiv", #temp);
488
							break;
488
							break;
489
					case SCAN_CODE_KEY_N:
489
					case SCAN_CODE_KEY_N:
490
							EventOpenNewEolite();
490
							EventOpenNewEolite();
491
							break; 
491
							break; 
492
					case SCAN_CODE_KEY_R:
492
					case SCAN_CODE_KEY_R:
493
							EventRefreshDisksAndFolders();
493
							EventRefreshDisksAndFolders();
494
							break;
494
							break;
495
					case SCAN_CODE_ENTER:
495
					case SCAN_CODE_ENTER:
496
							if (!itdir) ShowOpenWithDialog();
496
							if (!itdir) ShowOpenWithDialog();
497
							else EventOpen(1);
497
							else EventOpen(1);
498
							break;
498
							break;
499
					case SCAN_CODE_KEY_A:
499
					case SCAN_CODE_KEY_A:
500
							EventChooseAllFiles(true);
500
							EventChooseAllFiles(true);
501
							break;
501
							break;
502
					case SCAN_CODE_KEY_U: //unselect all files
502
					case SCAN_CODE_KEY_U: //unselect all files
503
							EventChooseAllFiles(false);
503
							EventChooseAllFiles(false);
504
							break;
504
							break;
505
				}
505
				}
506
				break;
506
				break;
507
			}
507
			}
508
 
508
 
509
			switch (key_scancode)
509
			switch (key_scancode)
510
			{
510
			{
511
					case SCAN_CODE_BS:
511
					case SCAN_CODE_BS:
512
							Dir_Up();
512
							Dir_Up();
513
							break; 
513
							break; 
514
					case SCAN_CODE_ENTER:
514
					case SCAN_CODE_ENTER:
515
							EventOpen(0);
515
							EventOpen(0);
516
							break; 
516
							break; 
517
					case SCAN_CODE_TAB:
517
					case SCAN_CODE_TAB:
518
							if (!efm) break;
518
							if (!efm) break;
519
							ChangeActivePanel();
519
							ChangeActivePanel();
520
							break;
520
							break;
521
					case SCAN_CODE_MENU:
521
					case SCAN_CODE_MENU:
522
							mouse.x = files.x+15;
522
							mouse.x = files.x+15;
523
							mouse.y = files.cur_y - files.first * files.item_h + files.y + 5;
523
							mouse.y = files.cur_y - files.first * files.item_h + files.y + 5;
524
							EventShowListMenu();
524
							EventShowListMenu();
525
							break;
525
							break;
526
					case SCAN_CODE_DEL:
526
					case SCAN_CODE_DEL:
527
							Del_Form();
527
							Del_Form();
528
							break;
528
							break;
529
					case SCAN_CODE_SPACE:
529
					case SCAN_CODE_SPACE:
530
							EventChooseFile(files.cur_y);
530
							EventChooseFile(files.cur_y);
531
							DrawStatusBar();
531
							DrawStatusBar();
532
							Line_ReDraw(col.selec, files.cur_y);
532
							Line_ReDraw(col.selec, files.cur_y);
533
							break;
533
							break;
534
					case SCAN_CODE_INS:
534
					case SCAN_CODE_INS:
535
							EventChooseFile(files.cur_y);
535
							EventChooseFile(files.cur_y);
536
							files.KeyDown();
536
							files.KeyDown();
537
							DrawStatusBar();
537
							DrawStatusBar();
538
							List_ReDraw();
538
							List_ReDraw();
539
							break;
539
							break;
540
					case SCAN_CODE_F1...SCAN_CODE_F10:
540
					case SCAN_CODE_F1...SCAN_CODE_F10:
541
							FnProcess(key_scancode-58);
541
							FnProcess(key_scancode-58);
542
							break; 
542
							break; 
543
					default:
543
					default:
544
							EventSelectFileByKeyPress();
544
							EventSelectFileByKeyPress();
545
			}                         
545
			}                         
546
			break;
546
			break;
547
		case evIPC:
547
		case evIPC:
548
		case evReDraw:
548
		case evReDraw:
549
			draw_window();
549
			draw_window();
550
			if (CheckActiveProcess(Form.ID)) && (GetMenuClick()) break;
550
			if (CheckActiveProcess(Form.ID)) && (GetMenuClick()) break;
551
			if (action_buf==OPERATION_END) {
551
			if (action_buf==OPERATION_END) {
552
				EventRefresh();
552
				EventRefresh();
553
				action_buf=0;
553
				action_buf=0;
554
			}
554
			}
555
			break;
555
			break;
556
		default:
556
		default:
557
			if (Form.status_window<=2) EventRefreshDisksAndFolders();
557
			if (Form.status_window<=2) EventRefreshDisksAndFolders();
558
			//sprintf(#param, "/tmp0/1/%i", random(99999)); //for testing purpose
558
			//sprintf(#param, "/tmp0/1/%i", random(99999)); //for testing purpose
559
			//CreateFile(0, 0, #param);
559
			//CreateFile(0, 0, #param);
560
	}
560
	}
561
	
561
	
562
	if(cmd_free)
562
	if(cmd_free)
563
	{
563
	{
564
		if(cmd_free==2) about_stak=free(about_stak);
564
		if(cmd_free==2) about_stak=free(about_stak);
565
		else if(cmd_free==3) properties_stak=free(properties_stak);
565
		else if(cmd_free==3) properties_stak=free(properties_stak);
566
		else if(cmd_free==4) settings_stak=free(settings_stak);
566
		else if(cmd_free==4) settings_stak=free(settings_stak);
567
		cmd_free = false;
567
		cmd_free = false;
568
	}
568
	}
569
}
569
}
570
 
570
 
571
void draw_window()
571
void draw_window()
572
{
572
{
573
	dword i=0;
573
	dword i=0;
574
	incn x;
574
	incn x;
575
	dword title;
575
	dword title;
576
	if (show_status_bar.checked) {
576
	if (show_status_bar.checked) {
577
		#define STBAR_EOLITE_H 16;
577
		#define STBAR_EOLITE_H 16;
578
		#define STBAR_KFM_H 21+16;
578
		#define STBAR_KFM_H 21+16;
579
		if (efm) status_bar_h = STBAR_KFM_H;
579
		if (efm) status_bar_h = STBAR_KFM_H;
580
		else status_bar_h = STBAR_EOLITE_H;
580
		else status_bar_h = STBAR_EOLITE_H;
581
	} else {
581
	} else {
582
		status_bar_h = 0;
582
		status_bar_h = 0;
583
	}
583
	}
584
	if (efm) title = TITLE_KFM; else title = TITLE_EOLITE;
584
	if (efm) title = TITLE_KFM; else title = TITLE_EOLITE;
585
	DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,title,0);
585
	DefineAndDrawWindow(Form.left+rand_n,Form.top+rand_n,Form.width,Form.height,0x73,NULL,title,0);
586
	GetProcessInfo(#Form, SelfInfo);
586
	GetProcessInfo(#Form, SelfInfo);
587
	if (Form.status_window>2) return;
587
	if (Form.status_window>2) return;
588
	if (Form.height < 356) { MoveSize(OLD,OLD,OLD,356); return; }
588
	if (Form.height < 356) { MoveSize(OLD,OLD,OLD,356); return; }
589
	GetProcessInfo(#Form, SelfInfo);
589
	GetProcessInfo(#Form, SelfInfo);
590
	SetAppColors();
590
	SetAppColors();
591
	if (efm) {
591
	if (efm) {
592
		if (screen.width > 693) && (Form.width < 693) { MoveSize(OLD,OLD,693,OLD); return; }
592
		if (screen.width > 693) && (Form.width < 693) { MoveSize(OLD,OLD,693,OLD); return; }
593
		DrawBar(0, 0, Form.cwidth, 34, sc.work);
593
		DrawBar(0, 0, Form.cwidth, 34, sc.work);
594
		#define PAD 7
594
		#define PAD 7
595
		#define GAP_S 26+5
595
		#define GAP_S 26+5
596
		#define GAP_B 26+14
596
		#define GAP_B 26+14
597
		x.set(Form.cwidth/2-DDW-203/2-GAP_S);
597
		x.set(Form.cwidth/2-DDW-203/2-GAP_S);
598
		while (i<200) {
598
		while (i<200) {
599
			DrawTopPanelButton(i+BACK_BTN, x.inc(GAP_S), PAD, 30, false);
599
			DrawTopPanelButton(i+BACK_BTN, x.inc(GAP_S), PAD, 30, false);
600
			DrawTopPanelButton(i+FWRD_BTN, x.inc(GAP_S), PAD, 31, false);
600
			DrawTopPanelButton(i+FWRD_BTN, x.inc(GAP_S), PAD, 31, false);
601
			DrawTopPanelButton(i+GOUP_BTN, x.inc(GAP_B), PAD, 01, false);
601
			DrawTopPanelButton(i+GOUP_BTN, x.inc(GAP_B), PAD, 01, false);
602
			DrawTopPanelButton(i+COPY_BTN, x.inc(GAP_B), PAD, 55, false);
602
			DrawTopPanelButton(i+COPY_BTN, x.inc(GAP_B), PAD, 55, false);
603
			DrawTopPanelButton(i+CUT_BTN,  x.inc(GAP_S), PAD, 20, false);
603
			DrawTopPanelButton(i+CUT_BTN,  x.inc(GAP_S), PAD, 20, false);
604
			DrawTopPanelButton(i+PASTE_BTN,x.inc(GAP_S), PAD, 56, false);
604
			DrawTopPanelButton(i+PASTE_BTN,x.inc(GAP_S), PAD, 56, false);
605
			x.set(Form.cwidth/2-DDW-203/2-GAP_S+calc(Form.cwidth/2));
605
			x.set(Form.cwidth/2-DDW-203/2-GAP_S+calc(Form.cwidth/2));
606
			i+=100;
606
			i+=100;
607
		}
607
		}
608
		//DrawTopPanelButton(51, Form.cwidth-GAP_S-PAD, PAD, -1, false); //burger menu
608
		//DrawTopPanelButton(51, Form.cwidth-GAP_S-PAD, PAD, -1, false); //burger menu
609
	} else {
609
	} else {
610
		if (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; }
610
		if (Form.width < 480) { MoveSize(OLD,OLD,480,OLD); return; }
611
		ESDWORD[#toolbar_pal] = sc.work;
611
		ESDWORD[#toolbar_pal] = sc.work;
612
		ESDWORD[#toolbar_pal+4] = MixColors(0, sc.work, 35);
612
		ESDWORD[#toolbar_pal+4] = MixColors(0, sc.work, 35);
613
		PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal);		
613
		PutPaletteImage(#toolbar, 246, 34, 0, 0, 8, #toolbar_pal);		
614
		for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,BACK_BTN+i);
614
		for (i=0; i<3; i++) DefineHiddenButton(toolbar_buttons_x[i]+2,7,31-5,29-5,BACK_BTN+i);
615
		for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i],  5,31,  29,  BACK_BTN+i);
615
		for (i=3; i<6; i++) DefineHiddenButton(toolbar_buttons_x[i],  5,31,  29,  BACK_BTN+i);
616
		DrawBar(127, 8, 1, 25, sc.work_graph);
616
		DrawBar(127, 8, 1, 25, sc.work_graph);
617
		DrawBar(246,0, Form.cwidth - 246, 34, sc.work);
617
		DrawBar(246,0, Form.cwidth - 246, 34, sc.work);
618
		DrawDot(Form.cwidth-17,12);
618
		DrawDot(Form.cwidth-17,12);
619
		DrawDot(Form.cwidth-17,12+6);
619
		DrawDot(Form.cwidth-17,12+6);
620
		DrawDot(Form.cwidth-17,12+12);
620
		DrawDot(Form.cwidth-17,12+12);
621
		DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots
621
		DefineHiddenButton(Form.cwidth-24,7,20,25,51+BT_NOFRAME); //dots
622
	}
622
	}
623
	//main rectangles
623
	//main rectangles
624
	DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,sc.work_graph);
624
	DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42-status_bar_h,sc.work_graph);
625
	DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg
625
	DrawRectangle(0,39,Form.cwidth-1,-show_status_bar.checked*status_bar_h + Form.cheight - 40,col.work_gradient[4]); //bg
626
	for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10));
626
	for (i=0; i<6; i++) DrawBar(0, 34+i, Form.cwidth, 1, MixColors(sc.work_dark, sc.work, i*10));
627
	for (i=0; i<6; i++) DrawBar(0, 5-i, Form.cwidth, 1, MixColors(sc.work_light, sc.work, i*10));
627
	for (i=0; i<6; i++) DrawBar(0, 5-i, Form.cwidth, 1, MixColors(sc.work_light, sc.work, i*10));
628
	llist_copy(#files_active, #files);
628
	llist_copy(#files_active, #files);
629
	strcpy(#active_path, #path);
629
	strcpy(#active_path, #path);
630
	DrawStatusBar();
630
	DrawStatusBar();
631
	if (!selected_count) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] 
631
	if (!selected_count) Open_Dir(#path,ONLY_OPEN); //if there are no selected files -> refresh folder [L001] 
632
	DrawFilePanels();
632
	DrawFilePanels();
633
	disk_popin_active_on_panel = 0;
633
	disk_popin_active_on_panel = 0;
634
}
634
}
635
 
635
 
636
void DrawButtonsAroundList() 
636
void DrawButtonsAroundList() 
637
{
637
{
638
	word sorting_arrow_x;
638
	word sorting_arrow_x;
639
	dword sorting_arrow_t = "\x19";
639
	dword sorting_arrow_t = "\x19";
640
	if (sort_desc) sorting_arrow_t = "\x18";
640
	if (sort_desc) sorting_arrow_t = "\x18";
641
	DrawFlatButtonSmall(files.x - efm,           files.y-17,files.w-141+efm,16,31,T_FILE);
641
	DrawFlatButtonSmall(files.x - efm,           files.y-17,files.w-141+efm,16,31,T_FILE);
642
	DrawFlatButtonSmall(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE);
642
	DrawFlatButtonSmall(files.x + files.w - 141, files.y-17,73,16,32,T_TYPE);
643
	DrawFlatButtonSmall(files.x + files.w -  68, files.y-17,68,16,33,T_SIZE);
643
	DrawFlatButtonSmall(files.x + files.w -  68, files.y-17,68,16,33,T_SIZE);
644
	DrawFlatButtonSmall(files.x + files.w,       files.y-17,16,16, 0,"\x18");
644
	DrawFlatButtonSmall(files.x + files.w,       files.y-17,16,16, 0,"\x18");
645
	DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19");
645
	DrawFlatButtonSmall(files.x + files.w,files.y+files.h-16,16,16,0,"\x19");
646
	if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;
646
	if (sort_type==1) sorting_arrow_x = files.w - 141 / 2 + files.x + 18;
647
	if (sort_type==2) sorting_arrow_x = files.x + files.w - 90;
647
	if (sort_type==2) sorting_arrow_x = files.x + files.w - 90;
648
	if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
648
	if (sort_type==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
649
	WriteText(sorting_arrow_x,files.y-12,0x80, sc.work_text, sorting_arrow_t);
649
	WriteText(sorting_arrow_x,files.y-12,0x80, sc.work_text, sorting_arrow_t);
650
	DrawBar(files.x+files.w,files.y,1,files.h,sc.work_graph);
650
	DrawBar(files.x+files.w,files.y,1,files.h,sc.work_graph);
651
	if (efm) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,sc.work_graph);	
651
	if (efm) && (files.x<5) DrawBar(files.x+files.w+16,files.y,1,files.h,sc.work_graph);	
652
}
652
}
653
 
653
 
654
void DrawFuncButtonsInKfm()
654
void DrawFuncButtonsInKfm()
655
{
655
{
656
	int i, x=0, len, min_w=0, padding;
656
	int i, x=0, len, min_w=0, padding;
657
	for (i=0; i<10; i++) min_w += strlen(kfm_func[i])+2*6 + 2;
657
	for (i=0; i<10; i++) min_w += strlen(kfm_func[i])+2*6 + 2;
658
	padding = Form.cwidth - min_w + 4 / 10;
658
	padding = Form.cwidth - min_w + 4 / 10;
659
	for (i=0; i<10; i++) {
659
	for (i=0; i<10; i++) {
660
		len = strlen(kfm_func[i])+2*6 + padding;
660
		len = strlen(kfm_func[i])+2*6 + padding;
661
		if (i==9) len = Form.cwidth - x - 3;
661
		if (i==9) len = Form.cwidth - x - 3;
662
		DrawFuncButton(x+1, Form.cheight - 19, len, i+KFM_FUNC_ID+1, i+1, kfm_func[i]);
662
		DrawFuncButton(x+1, Form.cheight - 19, len, i+KFM_FUNC_ID+1, i+1, kfm_func[i]);
663
		x += len + 2;
663
		x += len + 2;
664
	}
664
	}
665
}
665
}
666
 
666
 
667
void DrawStatusBar()
667
void DrawStatusBar()
668
{
668
{
669
	char status_bar_str[80];
669
	char status_bar_str[80];
670
	int go_up_folder_exists=0;
670
	int go_up_folder_exists=0;
671
 
671
 
672
	if (efm) { 
672
	if (efm) { 
673
		DrawBar(0, Form.cheight - status_bar_h+15, Form.cwidth,  status_bar_h-15, sc.work);
673
		DrawBar(0, Form.cheight - status_bar_h+15, Form.cwidth,  status_bar_h-15, sc.work);
674
		DrawFuncButtonsInKfm();
674
		DrawFuncButtonsInKfm();
675
		DrawPathBar();
675
		DrawPathBar();
676
		return;
676
		return;
677
	}
677
	}
678
 
678
 
679
	if (!show_status_bar.checked) return;
679
	if (!show_status_bar.checked) return;
680
	if (files.count>0) && (streq(items.get(0)*304+buf+72,"..")) go_up_folder_exists=1;
680
	if (files.count>0) && (streq(items.get(0)*304+buf+72,"..")) go_up_folder_exists=1;
681
	DrawBar(0, Form.cheight - status_bar_h, Form.cwidth,  status_bar_h, sc.work);
681
	DrawBar(0, Form.cheight - status_bar_h, Form.cwidth,  status_bar_h, sc.work);
682
	sprintf(#status_bar_str, T_STATUS_EVEMENTS, count_dir-go_up_folder_exists, files.count-count_dir);
682
	sprintf(#status_bar_str, T_STATUS_EVEMENTS, count_dir-go_up_folder_exists, files.count-count_dir);
683
	WriteText(6,Form.cheight - 13,0x80,sc.work_text,#status_bar_str);
683
	WriteText(6,Form.cheight - 13,0x80,sc.work_text,#status_bar_str);
684
	if (selected_count) {
684
	if (selected_count) {
685
		sprintf(#status_bar_str, T_STATUS_SELECTED, selected_count);
685
		sprintf(#status_bar_str, T_STATUS_SELECTED, selected_count);
686
		WriteText(Form.cwidth - calc(strlen(#status_bar_str)*6)-6,Form.cheight - 13,
686
		WriteText(Form.cwidth - calc(strlen(#status_bar_str)*6)-6,Form.cheight - 13,
687
			0x80,sc.work_text,#status_bar_str);
687
			0x80,sc.work_text,#status_bar_str);
688
	}
688
	}
689
}
689
}
690
 
690
 
691
void DrawFilePanels()
691
void DrawFilePanels()
692
{
692
{
693
	int files_y;
693
	int files_y;
694
	int w2 = -Form.cwidth-1/2+Form.cwidth;
694
	int w2 = -Form.cwidth-1/2+Form.cwidth;
695
	int h2;
695
	int h2;
696
	if (!efm)
696
	if (!efm)
697
	{
697
	{
698
		DrawDeviceAndActionsLeftPanel();
698
		DrawDeviceAndActionsLeftPanel();
699
		files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h);
699
		files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59 - status_bar_h, files.item_h);
700
		DrawButtonsAroundList();
700
		DrawButtonsAroundList();
701
		List_ReDraw();
701
		List_ReDraw();
702
	}
702
	}
703
	else
703
	else
704
	{
704
	{
705
		llist_copy(#files, #files_inactive);
705
		llist_copy(#files, #files_inactive);
706
		strcpy(#path, #inactive_path);
706
		strcpy(#path, #inactive_path);
707
		files_y = files.y;
707
		files_y = files.y;
708
		h2 = Form.cheight-files_y-2 - status_bar_h;
708
		h2 = Form.cheight-files_y-2 - status_bar_h;
709
		col.selec = col.selec_inactive;  //this is a bad code: need to use some var to set inactive panel for DrawButtonsAroundList();
709
		col.selec = col.selec_inactive;  //this is a bad code: need to use some var to set inactive panel for DrawButtonsAroundList();
710
 
710
 
711
		if (active_panel==1)
711
		if (active_panel==1)
712
		{
712
		{
713
			files.SetSizes(Form.cwidth/2, files_y, w2-17, h2, files.item_h);
713
			files.SetSizes(Form.cwidth/2, files_y, w2-17, h2, files.item_h);
714
			DrawButtonsAroundList();
714
			DrawButtonsAroundList();
715
			Open_Dir(#path,WITH_REDRAW);
715
			Open_Dir(#path,WITH_REDRAW);
716
			files_inactive.count = files.count;
716
			files_inactive.count = files.count;
717
			llist_copy(#files, #files_active);
717
			llist_copy(#files, #files_active);
718
			strcpy(#path, #active_path);
718
			strcpy(#path, #active_path);
719
			col.selec = col.selec_active;
719
			col.selec = col.selec_active;
720
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h);
720
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h);
721
			DrawButtonsAroundList();
721
			DrawButtonsAroundList();
722
			Open_Dir(#path,WITH_REDRAW);
722
			Open_Dir(#path,WITH_REDRAW);
723
		}
723
		}
724
		if (active_panel==2)
724
		if (active_panel==2)
725
		{
725
		{
726
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h);
726
			files.SetSizes(2, files_y, Form.cwidth/2-2-17, h2, files.item_h);
727
			DrawButtonsAroundList();
727
			DrawButtonsAroundList();
728
			Open_Dir(#path,WITH_REDRAW);
728
			Open_Dir(#path,WITH_REDRAW);
729
			files_inactive.count = files.count;
729
			files_inactive.count = files.count;
730
			llist_copy(#files, #files_active);
730
			llist_copy(#files, #files_active);
731
			strcpy(#path, #active_path);
731
			strcpy(#path, #active_path);
732
			col.selec = col.selec_active;
732
			col.selec = col.selec_active;
733
			files.SetSizes(Form.cwidth/2, files_y, w2 -17, h2, files.item_h);
733
			files.SetSizes(Form.cwidth/2, files_y, w2 -17, h2, files.item_h);
734
			DrawButtonsAroundList();
734
			DrawButtonsAroundList();
735
			Open_Dir(#path,WITH_REDRAW);
735
			Open_Dir(#path,WITH_REDRAW);
736
		}
736
		}
737
	}
737
	}
738
}
738
}
739
 
739
 
740
void List_ReDraw()
740
void List_ReDraw()
741
{
741
{
742
	int all_lines_h;
742
	int all_lines_h;
743
	dword j;
743
	dword j;
744
	static int old_cur_y, old_first;
744
	static int old_cur_y, old_first;
745
	dword separator_color;
745
	dword separator_color;
746
 
746
 
747
	files.CheckDoesValuesOkey(); //prevent some shit
747
	files.CheckDoesValuesOkey(); //prevent some shit
748
	if (files.count < files.visible) files.visible = files.count;
748
	if (files.count < files.visible) files.visible = files.count;
749
 
749
 
750
	if (list_full_redraw) || (old_first != files.first)
750
	if (list_full_redraw) || (old_first != files.first)
751
	{
751
	{
752
		old_cur_y = files.cur_y;
752
		old_cur_y = files.cur_y;
753
		old_first = files.first;
753
		old_first = files.first;
754
		list_full_redraw = false;
754
		list_full_redraw = false;
755
		goto _ALL_LIST_REDRAW;
755
		goto _ALL_LIST_REDRAW;
756
	}
756
	}
757
	if (old_cur_y != files.cur_y)
757
	if (old_cur_y != files.cur_y)
758
	{
758
	{
759
		if (old_cur_y-files.first
759
		if (old_cur_y-files.first
760
		Line_ReDraw(col.selec, files.cur_y-files.first);
760
		Line_ReDraw(col.selec, files.cur_y-files.first);
761
		old_cur_y = files.cur_y;
761
		old_cur_y = files.cur_y;
762
		return;
762
		return;
763
	}
763
	}
764
 
764
 
765
	_ALL_LIST_REDRAW:
765
	_ALL_LIST_REDRAW:
766
 
766
 
767
	for (j=0; j
767
	for (j=0; j
768
		if (files.cur_y-files.first!=j) Line_ReDraw(col.list_bg, j); 
768
		if (files.cur_y-files.first!=j) Line_ReDraw(col.list_bg, j); 
769
		else Line_ReDraw(col.selec, files.cur_y-files.first);		
769
		else Line_ReDraw(col.selec, files.cur_y-files.first);		
770
	}
770
	}
771
	//in the bottom
771
	//in the bottom
772
	all_lines_h = j * files.item_h;
772
	all_lines_h = j * files.item_h;
773
	DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h, col.list_bg);
773
	DrawBar(files.x,all_lines_h + files.y,files.w,files.h - all_lines_h, col.list_bg);
774
	if (colored_lines.checked) separator_color = col.list_bg; else separator_color = col.list_vert_line;
774
	if (colored_lines.checked) separator_color = col.list_bg; else separator_color = col.list_vert_line;
775
	DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h, separator_color);
775
	DrawBar(files.x+files.w-141,all_lines_h + files.y,1,files.h - all_lines_h, separator_color);
776
	DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h, separator_color);
776
	DrawBar(files.x+files.w-68,all_lines_h + files.y,1,files.h - all_lines_h, separator_color);
777
	Scroll();
777
	Scroll();
778
 
778
 
779
	if (del_active) Del_Form();
779
	if (del_active) Del_Form();
780
	if (new_element_active) && (col.selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name);
780
	if (new_element_active) && (col.selec != 0xCCCccc) NewElement_Form(new_element_active, #new_element_name);
781
}
781
}
782
 
782
 
783
bool file_name_is_8_3(dword name)
783
bool file_name_is_8_3(dword name)
784
{
784
{
785
	int name_len = strlen(name);
785
	int name_len = strlen(name);
786
	int dot_pos = strrchr(name, '.');
786
	int dot_pos = strrchr(name, '.');
787
	if (name_len<=12) 
787
	if (name_len<=12) 
788
	{
788
	{
789
		if (dot_pos) {
789
		if (dot_pos) {
790
			if (name_len - dot_pos > 3) return false;
790
			if (name_len - dot_pos > 3) return false;
791
		}
791
		}
792
		else {
792
		else {
793
			if (name_len>8) return false; 
793
			if (name_len>8) return false; 
794
		}
794
		}
795
		return true;
795
		return true;
796
	}
796
	}
797
	return false;
797
	return false;
798
}
798
}
799
 
799
 
800
void Line_ReDraw(dword bgcol, filenum){
800
void Line_ReDraw(dword bgcol, filenum){
801
	dword text_col=col.list_gb_text,
801
	dword text_col=col.list_gb_text,
802
		  ext1, attr,
802
		  ext1, attr,
803
		  file_offet,
803
		  file_offet,
804
		  file_name_off,
804
		  file_name_off,
805
		  file_size=0,
805
		  file_size=0,
806
		  y=filenum*files.item_h+files.y,
806
		  y=filenum*files.item_h+files.y,
807
		  icon_y = files.item_h-icon_size/2+y;
807
		  icon_y = files.item_h-icon_size/2+y;
808
		  BDVK file;
808
		  BDVK file;
809
		  char full_path[4096];
809
		  char full_path[4096];
810
		  dword separator_color;
810
		  dword separator_color;
811
	char label_file_name[4096];
811
	char label_file_name[4096];
812
	if (filenum==-1) return;
812
	if (filenum==-1) return;
813
 
813
 
814
	DrawBar(files.x,y,4,files.item_h,bgcol);
814
	DrawBar(files.x,y,4,files.item_h,bgcol);
815
	DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol);
815
	DrawBar(files.x+4,y,icon_size,icon_y-y,bgcol);
816
	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);
816
	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);
817
	if (colored_lines.checked) {
817
	if (colored_lines.checked) {
818
		if (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line;
818
		if (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line;
819
		separator_color = bgcol;
819
		separator_color = bgcol;
820
	} else {
820
	} else {
821
		separator_color = col.list_vert_line;
821
		separator_color = col.list_vert_line;
822
	}
822
	}
823
	DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol);
823
	DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol);
824
	DrawBar(files.x+files.w-141,y,1,files.item_h, separator_color);
824
	DrawBar(files.x+files.w-141,y,1,files.item_h, separator_color);
825
	DrawBar(files.x+files.w-68,y,1,files.item_h, separator_color);
825
	DrawBar(files.x+files.w-68,y,1,files.item_h, separator_color);
826
 
826
 
827
	file_offet = items.get(filenum+files.first)*304 + buf+32;
827
	file_offet = items.get(filenum+files.first)*304 + buf+32;
828
	attr = ESDWORD[file_offet];
828
	attr = ESDWORD[file_offet];
829
	file.selected = ESBYTE[file_offet+7];
829
	file.selected = ESBYTE[file_offet+7];
830
	file.sizelo   = ESDWORD[file_offet+32];
830
	file.sizelo   = ESDWORD[file_offet+32];
831
	file.sizehi   = ESDWORD[file_offet+36];
831
	file.sizehi   = ESDWORD[file_offet+36];
832
	file_name_off = file_offet+40;
832
	file_name_off = file_offet+40;
833
 
833
 
834
	if (! TestBit(attr, 4) ) //file or folder?
834
	if (! attr & ATR_FOLDER) //file or folder?
835
	{	
835
	{	
836
		ext1 = strrchr(file_name_off,'.') + file_name_off;
836
		ext1 = strrchr(file_name_off,'.') + file_name_off;
837
		if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing
837
		if (ext1==file_name_off) ext1 = NULL; //if no extension then show nothing
838
		file_size = ConvertSize64(file.sizelo, file.sizehi);
838
		file_size = ConvertSize64(file.sizelo, file.sizehi);
839
		if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
839
		if (ext1) && (strlen(ext1)<9) WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
840
	}
840
	}
841
	else
841
	else
842
	{
842
	{
843
		if (!strcmp(file_name_off,"..")) ext1=""; else {
843
		if (!strcmp(file_name_off,"..")) ext1=""; else {
844
			ext1="";
844
			ext1="";
845
			WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
845
			WriteTextCenter(files.x+files.w-140, files.text_y+y+1, 72, col.list_gb_text, ext1);
846
		}
846
		}
847
		if (chrnum(#path, '/')==1) && (streq(#path, "/kolibrios")==false) file_size = GetDeviceSizeLabel(#full_path);
847
		if (chrnum(#path, '/')==1) && (streq(#path, "/kolibrios")==false) file_size = GetDeviceSizeLabel(#full_path);
848
	}
848
	}
849
	if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, 
849
	if (file_size) WriteText(7-strlen(file_size)*6+files.x+files.w-58, 
850
			files.text_y+y+1, files.font_type, col.list_gb_text, file_size);
850
			files.text_y+y+1, files.font_type, col.list_gb_text, file_size);
851
 
851
 
852
	if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=col.list_text_hidden; //system or hiden?
852
	if (attr&2) || (attr&4) text_col=col.list_text_hidden; //system or hiden?
853
	if (bgcol==col.selec)
853
	if (bgcol==col.selec)
854
	{
854
	{
855
		file_name_is_8_3(file_name_off);
855
		file_name_is_8_3(file_name_off);
856
		itdir = TestBit(attr, 4);
856
		itdir = attr & ATR_FOLDER;
857
		strcpy(#file_name, file_name_off);
857
		strcpy(#file_name, file_name_off);
858
		if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off);
858
		if (!strcmp(#path,"/")) sprintf(#file_path,"%s%s",#path,file_name_off);
859
			else sprintf(#file_path,"%s/%s",#path,file_name_off);
859
			else sprintf(#file_path,"%s/%s",#path,file_name_off);
860
		if (text_col==col.list_text_hidden) {
860
		if (text_col==col.list_text_hidden) {
861
			text_col=MixColors(col.selec_text, col.list_text_hidden, 65); 
861
			text_col=MixColors(col.selec_text, col.list_text_hidden, 65); 
862
		} else text_col=col.selec_text;
862
		} else text_col=col.selec_text;
863
	}
863
	}
864
	if (file.selected) text_col=0xFF0000;
864
	if (file.selected) text_col=0xFF0000;
865
	if (kfont.size.pt==9) || (!kfont.font)
865
	if (kfont.size.pt==9) || (!kfont.font)
866
	{
866
	{
867
		if (Form.width>=480)
867
		if (Form.width>=480)
868
		{
868
		{
869
			FileShow.start_x = files.x + icon_size + 7;
869
			FileShow.start_x = files.x + icon_size + 7;
870
			FileShow.font_color = text_col;
870
			FileShow.font_color = text_col;
871
			FileShow.area_size_x = files.w - 164;
871
			FileShow.area_size_x = files.w - 164;
872
			FileShow.text_pointer = file_name_off;
872
			FileShow.text_pointer = file_name_off;
873
			FileShow.start_y = files.text_y + y - 3;
873
			FileShow.start_y = files.text_y + y - 3;
874
			PathShow_prepare stdcall(#FileShow);
874
			PathShow_prepare stdcall(#FileShow);
875
			PathShow_draw stdcall(#FileShow);
875
			PathShow_draw stdcall(#FileShow);
876
		}		
876
		}		
877
	}
877
	}
878
	else
878
	else
879
	{
879
	{
880
		strcpy(#label_file_name, file_name_off);
880
		strcpy(#label_file_name, file_name_off);
881
		if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w)
881
		if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w)
882
		{
882
		{
883
			while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) {
883
			while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) {
884
				ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL;
884
				ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL;
885
			}
885
			}
886
			strcpy(#label_file_name+strlen(#label_file_name)-2, "...");			
886
			strcpy(#label_file_name+strlen(#label_file_name)-2, "...");			
887
		}
887
		}
888
		kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, 
888
		kfont.WriteIntoWindow(files.x + icon_size+7, files.item_h - kfont.height / 2 + y, 
889
			bgcol, text_col, kfont.size.pt, #label_file_name);
889
			bgcol, text_col, kfont.size.pt, #label_file_name);
890
	}
890
	}
891
	if (bgcol == col.selec_inactive) DrawWideRectangle(files.x+2, y, files.w-4, files.item_h, 2, col.selec_active);
891
	if (bgcol == col.selec_inactive) DrawWideRectangle(files.x+2, y, files.w-4, files.item_h, 2, col.selec_active);
892
 
892
 
893
	sprintf(#full_path,"%s/%s",#path,file_name_off);
893
	sprintf(#full_path,"%s/%s",#path,file_name_off);
894
	DrawIconByExtension(#full_path, ext1, files.x+4, icon_y, bgcol);
894
	DrawIconByExtension(#full_path, ext1, files.x+4, icon_y, bgcol);
895
}
895
}
896
 
896
 
897
 
897
 
898
void Open_Dir(dword dir_path, redraw){
898
void Open_Dir(dword dir_path, redraw){
899
	int errornum;
899
	int errornum;
900
 
900
 
901
	selected_count = 0;
901
	selected_count = 0;
902
	if (buf) free(buf);
902
	if (buf) free(buf);
903
	errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
903
	errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
904
	if (errornum)
904
	if (errornum)
905
	{
905
	{
906
		history.add(#path);
906
		history.add(#path);
907
		EventHistoryGoBack();
907
		EventHistoryGoBack();
908
		Write_Error(errornum);
908
		Write_Error(errornum);
909
		return;
909
		return;
910
	}
910
	}
911
	if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
911
	if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0;
912
 
912
 
913
	if (files.count!=-1)
913
	if (files.count!=-1)
914
	{
914
	{
915
		if(!_not_draw) DrawPathBar();
915
		if(!_not_draw) DrawPathBar();
916
		history.add(#path);
916
		history.add(#path);
917
		SystemDiscs.Draw();
917
		SystemDiscs.Draw();
918
		files.visible = files.h / files.item_h;
918
		files.visible = files.h / files.item_h;
919
		if (files.count < files.visible) files.visible = files.count;
919
		if (files.count < files.visible) files.visible = files.count;
920
		if (!strncmp(dir_path, "/rd/1/",5)) || (!strncmp(dir_path, "/sys/",4)) 
920
		if (!strncmp(dir_path, "/rd/1/",5)) || (!strncmp(dir_path, "/sys/",4)) 
921
			dir_at_fat16 = true; else dir_at_fat16 = false; 
921
			dir_at_fat16 = true; else dir_at_fat16 = false; 
922
		Sorting();
922
		Sorting();
923
		list_full_redraw = true;
923
		list_full_redraw = true;
924
		if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();}
924
		if (redraw!=ONLY_OPEN)&&(!_not_draw) {DrawStatusBar(); List_ReDraw();}
925
		SetCurDir(dir_path);
925
		SetCurDir(dir_path);
926
	}
926
	}
927
	if (files.count==-1) && (redraw!=ONLY_OPEN) 
927
	if (files.count==-1) && (redraw!=ONLY_OPEN) 
928
	{
928
	{
929
		files.KeyHome();
929
		files.KeyHome();
930
		if(!_not_draw) { list_full_redraw=true; DrawStatusBar(); List_ReDraw(); }
930
		if(!_not_draw) { list_full_redraw=true; DrawStatusBar(); List_ReDraw(); }
931
	}
931
	}
932
}
932
}
933
 
933
 
934
inline Sorting()
934
inline Sorting()
935
{
935
{
936
	dword d=0, f=1;
936
	dword d=0, f=1;
937
	int j=0;
937
	int j=0;
938
	dword file_off;
938
	dword file_off;
939
 
939
 
940
	items.drop();
940
	items.drop();
941
 
941
 
942
	if (!strcmp(#path,"/")) //do not sort root folder
942
	if (!strcmp(#path,"/")) //do not sort root folder
943
	{
943
	{
944
		for(d=1;d
944
		for(d=1;d
945
		count_dir = d;
945
		count_dir = d;
946
		return;
946
		return;
947
	}
947
	}
948
	for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;)  //files | folders
948
	for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;)  //files | folders
949
	{
949
	{
950
		if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40);
950
		if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40);
951
		if (TestBit(ESDWORD[file_off],4)) //directory?
951
		if (ESDWORD[file_off] & ATR_FOLDER) {
952
		{
-
 
953
			items.set(d, j);
952
			items.set(d, j);
954
			d++;
953
			d++;
955
		}
-
 
956
		else
954
		} else {
957
		{
-
 
958
			items.set(files.count-f, j);
955
			items.set(files.count-f, j);
959
			f++;
956
			f++;
960
		}
957
		}
961
	}
958
	}
962
	count_dir = d;
959
	count_dir = d;
963
	//sorting: files first, then folders
960
	//sorting: files first, then folders
964
	Sort_by_Name(0,d-1);
961
	Sort_by_Name(0,d-1);
965
	if (sort_type==1) Sort_by_Name(d,files.count-1);
962
	if (sort_type==1) Sort_by_Name(d,files.count-1);
966
	else if (sort_type==2) Sort_by_Type(d,files.count-1);
963
	else if (sort_type==2) Sort_by_Type(d,files.count-1);
967
	else if (sort_type==3) Sort_by_Size(d,files.count-1);
964
	else if (sort_type==3) Sort_by_Size(d,files.count-1);
968
	//reversed sorting
965
	//reversed sorting
969
	if (sort_desc) {
966
	if (sort_desc) {
970
		for (j=0; j
967
		for (j=0; j
971
			items.swap(files.count-j-1, d+j);
968
			items.swap(files.count-j-1, d+j);
972
		}
969
		}
973
		//if (sort_type==1) for (j=0; j
970
		//if (sort_type==1) for (j=0; j
974
	}
971
	}
975
	//make ".." first item in list
972
	//make ".." first item in list
976
	if (d>0) && (strncmp(items.get(0)*304+buf+72,"..",2)!=0)
973
	if (d>0) && (strncmp(items.get(0)*304+buf+72,"..",2)!=0)
977
		for(d--; d>0; d--;) if (!strncmp(items.get(d)*304+buf+72,"..",2)) {items.swap(d,0); break;}
974
		for(d--; d>0; d--;) if (!strncmp(items.get(d)*304+buf+72,"..",2)) {items.swap(d,0); break;}
978
}
975
}
979
 
976
 
980
 
977
 
981
void Del_Form()
978
void Del_Form()
982
{
979
{
983
	byte f_count[128];
980
	byte f_count[128];
984
	int dform_x = files.w - 220 / 2 + files.x;
981
	int dform_x = files.w - 220 / 2 + files.x;
985
	if (!selected_count) && (!strncmp(#file_name,"..",2)) return;
982
	if (!selected_count) && (!strncmp(#file_name,"..",2)) return;
986
	else
983
	else
987
	{
984
	{
988
		if (!files.count) return;
985
		if (!files.count) return;
989
		DrawEolitePopup(T_YES, T_NO);
986
		DrawEolitePopup(T_YES, T_NO);
990
		WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,sc.work_text,T_DELETE_FILE);
987
		WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,sc.work_text,T_DELETE_FILE);
991
		if (selected_count)
988
		if (selected_count)
992
		{
989
		{
993
			sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2);
990
			sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,selected_count,DEL_MORE_FILES_2);
994
			WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count);
991
			WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,sc.work_text,#f_count);
995
		}
992
		}
996
		else
993
		else
997
		{
994
		{
998
			if (strlen(#file_name)<28) 
995
			if (strlen(#file_name)<28) 
999
			{
996
			{
1000
				WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?");
997
				WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,sc.work_text,"?");
1001
				WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name);
998
				WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,sc.work_text,#file_name);
1002
			}
999
			}
1003
			else
1000
			else
1004
			{
1001
			{
1005
				WriteText(164+dform_x,190,0x80,0,"...?");
1002
				WriteText(164+dform_x,190,0x80,0,"...?");
1006
				ESI = 24;
1003
				ESI = 24;
1007
				WriteText(dform_x+20,190,0,0,#file_name);
1004
				WriteText(dform_x+20,190,0,0,#file_name);
1008
			}
1005
			}
1009
		}		
1006
		}		
1010
		del_active=1;
1007
		del_active=1;
1011
	}
1008
	}
1012
}
1009
}
1013
 
1010
 
1014
void SelectFileByName(dword that_file)
1011
void SelectFileByName(dword that_file)
1015
{
1012
{
1016
	int ind;
1013
	int ind;
1017
	files.KeyHome();
1014
	files.KeyHome();
1018
	Open_Dir(#path,ONLY_OPEN);
1015
	Open_Dir(#path,ONLY_OPEN);
1019
	if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file);
1016
	if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file);
1020
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmpi(items.get(ind)*304+buf+72,that_file)) break; }
1017
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmpi(items.get(ind)*304+buf+72,that_file)) break; }
1021
	files.cur_y = ind - 1;
1018
	files.cur_y = ind - 1;
1022
	files.KeyDown();
1019
	files.KeyDown();
1023
	DrawStatusBar();
1020
	DrawStatusBar();
1024
	List_ReDraw();
1021
	List_ReDraw();
1025
}
1022
}
1026
 
1023
 
1027
 
1024
 
1028
void Dir_Up()
1025
void Dir_Up()
1029
{
1026
{
1030
	int iii;
1027
	int iii;
1031
	char old_folder_name[4096];
1028
	char old_folder_name[4096];
1032
	iii=strlen(#path)-1;
1029
	iii=strlen(#path)-1;
1033
	if (iii==0) return;
1030
	if (iii==0) return;
1034
	iii = strrchr(#path, '/');
1031
	iii = strrchr(#path, '/');
1035
	strcpy(#old_folder_name, #path+iii);
1032
	strcpy(#old_folder_name, #path+iii);
1036
	if (iii>1) path[iii-1]=NULL; else path[iii]=NULL;
1033
	if (iii>1) path[iii-1]=NULL; else path[iii]=NULL;
1037
	SelectFileByName(#old_folder_name);
1034
	SelectFileByName(#old_folder_name);
1038
}
1035
}
1039
 
1036
 
1040
void EventOpenSelected()
1037
void EventOpenSelected()
1041
{
1038
{
1042
	int i;
1039
	int i;
1043
	for (i=0; i
1040
	for (i=0; i
1044
		EDX = items.get(i)*304 + buf+32;
1041
		EDX = items.get(i)*304 + buf+32;
1045
		if (TestBit(ESDWORD[EDX], 4)) continue; //is foder
1042
		if (ESDWORD[EDX]&ATR_FOLDER) continue; //is foder
1046
		sprintf(#param,"%s/%s",#path, EDX+40);
1043
		sprintf(#param,"%s/%s",#path, EDX+40);
1047
		RunProgram("/sys/@open", #param);
1044
		RunProgram("/sys/@open", #param);
1048
	}
1045
	}
1049
}
1046
}
1050
 
1047
 
1051
void EventOpen(byte _new_window)
1048
void EventOpen(byte _new_window)
1052
{
1049
{
1053
	if (selected_count) && (!itdir) notify(T_USE_SHIFT_ENTER);
1050
	if (selected_count) && (!itdir) notify(T_USE_SHIFT_ENTER);
1054
	if (_new_window)
1051
	if (_new_window)
1055
	{
1052
	{
1056
		if (streq(#file_name,"..")) return;
1053
		if (streq(#file_name,"..")) return;
1057
		RunProgram(I_Path, #file_path);
1054
		RunProgram(I_Path, #file_path);
1058
		return;
1055
		return;
1059
	}
1056
	}
1060
	if (!files.count) return;
1057
	if (!files.count) return;
1061
	if (!itdir)
1058
	if (!itdir)
1062
	{
1059
	{
1063
		if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
1060
		if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
1064
	} 
1061
	} 
1065
	else
1062
	else
1066
	{
1063
	{
1067
		if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
1064
		if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
1068
		strcpy(#path, #file_path);
1065
		strcpy(#path, #file_path);
1069
		files.first=files.cur_y=0;
1066
		files.first=files.cur_y=0;
1070
		Open_Dir(#path,WITH_REDRAW);
1067
		Open_Dir(#path,WITH_REDRAW);
1071
	}
1068
	}
1072
}
1069
}
1073
 
1070
 
1074
inline fastcall void EventHistoryGoBack()
1071
inline fastcall void EventHistoryGoBack()
1075
{
1072
{
1076
	char cur_folder[4096];
1073
	char cur_folder[4096];
1077
	strcpy(#cur_folder, #path);
1074
	strcpy(#cur_folder, #path);
1078
	if (history.back()) {
1075
	if (history.back()) {
1079
		strcpy(#path, history.current());
1076
		strcpy(#path, history.current());
1080
		SelectFileByName(#cur_folder+strrchr(#cur_folder,'/'));
1077
		SelectFileByName(#cur_folder+strrchr(#cur_folder,'/'));
1081
	}
1078
	}
1082
}
1079
}
1083
 
1080
 
1084
void ShowOpenWithDialog()
1081
void ShowOpenWithDialog()
1085
{
1082
{
1086
	byte open_param[4097];
1083
	byte open_param[4097];
1087
	sprintf(#open_param,"~%s",#file_path);
1084
	sprintf(#open_param,"~%s",#file_path);
1088
	RunProgram("/sys/@open", #open_param);
1085
	RunProgram("/sys/@open", #open_param);
1089
}
1086
}
1090
 
1087
 
1091
void NewElement()
1088
void NewElement()
1092
{
1089
{
1093
	BDVK element_info;
1090
	BDVK element_info;
1094
	byte copy_result, info_result;
1091
	byte copy_result, info_result;
1095
 
1092
 
1096
	sprintf(#temp,"%s/%s",#path,new_file_ed.text);
1093
	sprintf(#temp,"%s/%s",#path,new_file_ed.text);
1097
	info_result = GetFileInfo(#temp, #element_info);
1094
	info_result = GetFileInfo(#temp, #element_info);
1098
	switch(new_element_active)
1095
	switch(new_element_active)
1099
	{
1096
	{
1100
		case CREATE_FILE:
1097
		case CREATE_FILE:
1101
			if (info_result!=5) {
1098
			if (info_result!=5) {
1102
				notify(FS_ITEM_ALREADY_EXISTS);
1099
				notify(FS_ITEM_ALREADY_EXISTS);
1103
			} else {
1100
			} else {
1104
				CreateFile(0, 0, #temp);
1101
				CreateFile(0, 0, #temp);
1105
				if (EAX)
1102
				if (EAX)
1106
				{
1103
				{
1107
					if (EAX==5) notify(NOT_CREATE_FILE);
1104
					if (EAX==5) notify(NOT_CREATE_FILE);
1108
					else Write_Error(EAX);
1105
					else Write_Error(EAX);
1109
				}
1106
				}
1110
			}
1107
			}
1111
			break;
1108
			break;
1112
		case CREATE_FOLDER:
1109
		case CREATE_FOLDER:
1113
			if (info_result!=5) {
1110
			if (info_result!=5) {
1114
				notify(FS_ITEM_ALREADY_EXISTS);
1111
				notify(FS_ITEM_ALREADY_EXISTS);
1115
			} else {
1112
			} else {
1116
				CreateDir(#temp);
1113
				CreateDir(#temp);
1117
				if (EAX)
1114
				if (EAX)
1118
				{
1115
				{
1119
					if (EAX==5) notify(NOT_CREATE_FOLDER);
1116
					if (EAX==5) notify(NOT_CREATE_FOLDER);
1120
					else Write_Error(EAX);
1117
					else Write_Error(EAX);
1121
				}
1118
				}
1122
			}
1119
			}
1123
			break;
1120
			break;
1124
		case RENAME_ITEM:
1121
		case RENAME_ITEM:
1125
			if (info_result!=5) {
1122
			if (info_result!=5) {
1126
				notify(FS_ITEM_ALREADY_EXISTS);
1123
				notify(FS_ITEM_ALREADY_EXISTS);
1127
			} else {
1124
			} else {
1128
				if (RenameMove(new_file_ed.text, #file_path))
1125
				if (RenameMove(new_file_ed.text, #file_path))
1129
				{
1126
				{
1130
					if (itdir) {
1127
					if (itdir) {
1131
						notify("'Error renaming folder' -E");
1128
						notify("'Error renaming folder' -E");
1132
						return;
1129
						return;
1133
					} else {
1130
					} else {
1134
						if (copy_result = CopyFile(#file_path,#temp)) {
1131
						if (copy_result = CopyFile(#file_path,#temp)) {
1135
							Write_Error(copy_result);
1132
							Write_Error(copy_result);
1136
						} else {
1133
						} else {
1137
							DeleteFile(#file_path);
1134
							DeleteFile(#file_path);
1138
							SelectFileByName(new_file_ed.text);
1135
							SelectFileByName(new_file_ed.text);
1139
						}
1136
						}
1140
					}
1137
					}
1141
				}
1138
				}
1142
			}
1139
			}
1143
	}
1140
	}
1144
	Open_Dir(#path,WITH_REDRAW);
1141
	Open_Dir(#path,WITH_REDRAW);
1145
	SelectFileByName(new_file_ed.text);
1142
	SelectFileByName(new_file_ed.text);
1146
	EventClosePopinForm();
1143
	EventClosePopinForm();
1147
}
1144
}
1148
 
1145
 
1149
void NewElement_Form(byte crt, dword strng)
1146
void NewElement_Form(byte crt, dword strng)
1150
{
1147
{
1151
	int dform_x=files.w-220/2+files.x;
1148
	int dform_x=files.w-220/2+files.x;
1152
	if (!new_element_active)
1149
	if (!new_element_active)
1153
	{
1150
	{
1154
		new_element_active = crt;
1151
		new_element_active = crt;
1155
		edit_box_set_text stdcall (#new_file_ed, strng);
1152
		edit_box_set_text stdcall (#new_file_ed, strng);
1156
	}
1153
	}
1157
	if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL);
1154
	if (new_element_active==3) DrawEolitePopup(T_RENAME, T_CANCEL);
1158
	else DrawEolitePopup(T_CREATE, T_CANCEL);
1155
	else DrawEolitePopup(T_CREATE, T_CANCEL);
1159
	new_file_ed.left = dform_x+10;
1156
	new_file_ed.left = dform_x+10;
1160
	DrawEditBox(#new_file_ed);
1157
	DrawEditBox(#new_file_ed);
1161
}
1158
}
1162
 
1159
 
1163
void EventShowAbout()
1160
void EventShowAbout()
1164
{
1161
{
1165
	if (!active_about) {
1162
	if (!active_about) {
1166
		about_stak = malloc(4096);
1163
		about_stak = malloc(4096);
1167
		about_thread_id = CreateThread(#about_dialog,about_stak+4092);
1164
		about_thread_id = CreateThread(#about_dialog,about_stak+4092);
1168
	} else {
1165
	} else {
1169
		ActivateWindow(GetProcessSlot(about_thread_id));
1166
		ActivateWindow(GetProcessSlot(about_thread_id));
1170
	}
1167
	}
1171
}
1168
}
1172
 
1169
 
1173
void FnProcess(byte N)
1170
void FnProcess(byte N)
1174
{
1171
{
1175
	switch(N)
1172
	switch(N)
1176
	{
1173
	{
1177
		case 1:
1174
		case 1:
1178
			EventShowProperties();
1175
			EventShowProperties();
1179
			break;
1176
			break;
1180
		case 2:
1177
		case 2:
1181
			if (files.count) NewElement_Form(RENAME_ITEM, #file_name);
1178
			if (files.count) NewElement_Form(RENAME_ITEM, #file_name);
1182
			break;
1179
			break;
1183
		case 3:
1180
		case 3:
1184
			if (files.count) && (!itdir) RunProgram("/sys/quark", #file_path);
1181
			if (files.count) && (!itdir) RunProgram("/sys/quark", #file_path);
1185
			break;
1182
			break;
1186
		case 4:
1183
		case 4:
1187
			if (files.count) && (!itdir) RunProgram("/sys/develop/cedit", #file_path);
1184
			if (files.count) && (!itdir) RunProgram("/sys/develop/cedit", #file_path);
1188
			break;
1185
			break;
1189
		case 5:
1186
		case 5:
1190
			if (efm) {
1187
			if (efm) {
1191
				CopyFilesListToClipboard(COPY);
1188
				CopyFilesListToClipboard(COPY);
1192
				EventPaste(#inactive_path);
1189
				EventPaste(#inactive_path);
1193
			} else {
1190
			} else {
1194
				EventRefreshDisksAndFolders();
1191
				EventRefreshDisksAndFolders();
1195
			}
1192
			}
1196
			break;
1193
			break;
1197
		case 6:
1194
		case 6:
1198
			if (efm) {
1195
			if (efm) {
1199
				CopyFilesListToClipboard(CUT);
1196
				CopyFilesListToClipboard(CUT);
1200
				EventPaste(#inactive_path);
1197
				EventPaste(#inactive_path);
1201
			}
1198
			}
1202
			break;
1199
			break;
1203
		case 7:
1200
		case 7:
1204
			NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER);
1201
			NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER);
1205
			break;
1202
			break;
1206
		case 8:
1203
		case 8:
1207
			Del_Form();
1204
			Del_Form();
1208
			break;
1205
			break;
1209
		case 9:
1206
		case 9:
1210
			NewElement_Form(CREATE_FILE, T_NEW_FILE);
1207
			NewElement_Form(CREATE_FILE, T_NEW_FILE);
1211
			break;
1208
			break;
1212
		case 10: //F10
1209
		case 10: //F10
1213
			if (!active_settings) 
1210
			if (!active_settings) 
1214
			{
1211
			{
1215
				settings_stak = malloc(4096);
1212
				settings_stak = malloc(4096);
1216
				settings_window = CreateThread(#settings_dialog, settings_stak+4092);
1213
				settings_window = CreateThread(#settings_dialog, settings_stak+4092);
1217
				break;
1214
				break;
1218
			}
1215
			}
1219
			else
1216
			else
1220
			{
1217
			{
1221
				ActivateWindow(GetProcessSlot(settings_window));
1218
				ActivateWindow(GetProcessSlot(settings_window));
1222
			}
1219
			}
1223
			break;
1220
			break;
1224
	}
1221
	}
1225
}
1222
}
1226
 
1223
 
1227
void EventRefresh()
1224
void EventRefresh()
1228
{
1225
{
1229
	if (efm)
1226
	if (efm)
1230
	{
1227
	{
1231
		DrawFilePanels();
1228
		DrawFilePanels();
1232
	} else {
1229
	} else {
1233
		Tip(56, T_DEVICES, 55, "-");
1230
		Tip(56, T_DEVICES, 55, "-");
1234
		Open_Dir(#path,WITH_REDRAW);
1231
		Open_Dir(#path,WITH_REDRAW);
1235
		pause(10);
1232
		pause(10);
1236
		DrawDeviceAndActionsLeftPanel();				
1233
		DrawDeviceAndActionsLeftPanel();				
1237
	}
1234
	}
1238
}
1235
}
1239
 
1236
 
1240
void ChangeActivePanel()
1237
void ChangeActivePanel()
1241
{
1238
{
1242
	if (active_panel==1) active_panel=2; else active_panel=1;
1239
	if (active_panel==1) active_panel=2; else active_panel=1;
1243
	llist_copy(#files_active, #files_inactive);
1240
	llist_copy(#files_active, #files_inactive);
1244
	llist_copy(#files_inactive, #files);
1241
	llist_copy(#files_inactive, #files);
1245
	strcpy(#active_path, #inactive_path);
1242
	strcpy(#active_path, #inactive_path);
1246
	strcpy(#inactive_path, #path);
1243
	strcpy(#inactive_path, #path);
1247
	DrawFilePanels();
1244
	DrawFilePanels();
1248
}
1245
}
1249
 
1246
 
1250
void EventSelectFileByKeyPress()
1247
void EventSelectFileByKeyPress()
1251
{
1248
{
1252
	int i;
1249
	int i;
1253
	for (i=files.cur_y+1; i
1250
	for (i=files.cur_y+1; i
1254
	{
1251
	{
1255
		strcpy(#temp, items.get(i)*304+buf+72);
1252
		strcpy(#temp, items.get(i)*304+buf+72);
1256
		if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
1253
		if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
1257
		{
1254
		{
1258
			files.cur_y = i - 1;
1255
			files.cur_y = i - 1;
1259
			files.KeyDown();
1256
			files.KeyDown();
1260
			List_ReDraw();
1257
			List_ReDraw();
1261
			return;
1258
			return;
1262
		}
1259
		}
1263
	}
1260
	}
1264
}
1261
}
1265
 
1262
 
1266
dword GetDeviceSizeLabel(dword path)
1263
dword GetDeviceSizeLabel(dword path)
1267
{
1264
{
1268
	BDVK bdvk;
1265
	BDVK bdvk;
1269
	if (ESBYTE[path+1] == '/') path++;
1266
	if (ESBYTE[path+1] == '/') path++;
1270
	if (ESBYTE[path+1] == 'c') && (ESBYTE[path+2] == 'd')
1267
	if (ESBYTE[path+1] == 'c') && (ESBYTE[path+2] == 'd')
1271
		&& (ESBYTE[path+4] == 0) return 0;
1268
		&& (ESBYTE[path+4] == 0) return 0;
1272
	GetFileInfo(path, #bdvk);
1269
	GetFileInfo(path, #bdvk);
1273
	return ConvertSize64(bdvk.sizelo, bdvk.sizehi);
1270
	return ConvertSize64(bdvk.sizelo, bdvk.sizehi);
1274
}
1271
}
1275
 
1272
 
1276
int GetRealFileCountInFolder(dword folder_path)
1273
int GetRealFileCountInFolder(dword folder_path)
1277
{
1274
{
1278
	int fcount;
1275
	int fcount;
1279
	dword countbuf;
1276
	dword countbuf;
1280
 
1277
 
1281
	GetDir(#countbuf, #fcount, folder_path, DIRS_NOROOT);
1278
	GetDir(#countbuf, #fcount, folder_path, DIRS_NOROOT);
1282
	if (countbuf) free(countbuf);
1279
	if (countbuf) free(countbuf);
1283
 
1280
 
1284
	return fcount;
1281
	return fcount;
1285
}
1282
}
1286
 
1283
 
1287
void EventRefreshDisksAndFolders()
1284
void EventRefreshDisksAndFolders()
1288
{
1285
{
1289
	if(GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) {
1286
	if(GetRealFileCountInFolder("/")+dir_exists("/kolibrios") != SystemDiscs.dev_num) {
1290
		SystemDiscs.Get();
1287
		SystemDiscs.Get();
1291
		EventRefresh();
1288
		EventRefresh();
1292
	} else {
1289
	} else {
1293
		if(GetRealFileCountInFolder(#path) != files.count) EventRefresh();
1290
		if(GetRealFileCountInFolder(#path) != files.count) EventRefresh();
1294
		else if(efm) && (GetRealFileCountInFolder(#inactive_path) != files_inactive.count) {
1291
		else if(efm) && (GetRealFileCountInFolder(#inactive_path) != files_inactive.count) {
1295
			EventRefresh();
1292
			EventRefresh();
1296
		}
1293
		}
1297
	}
1294
	}
1298
}
1295
}
1299
 
1296
 
1300
void EventSort(dword id)
1297
void EventSort(dword id)
1301
{
1298
{
1302
	char selected_filename[256];
1299
	char selected_filename[256];
1303
	if (sort_type == id) sort_desc ^= 1;
1300
	if (sort_type == id) sort_desc ^= 1;
1304
	else sort_type = id;
1301
	else sort_type = id;
1305
	strcpy(#selected_filename, #file_name);
1302
	strcpy(#selected_filename, #file_name);
1306
	DrawButtonsAroundList();
1303
	DrawButtonsAroundList();
1307
	Open_Dir(#path,WITH_REDRAW);
1304
	Open_Dir(#path,WITH_REDRAW);
1308
	SelectFileByName(#selected_filename);
1305
	SelectFileByName(#selected_filename);
1309
}
1306
}
1310
 
1307
 
1311
void EventHistoryGoForward()
1308
void EventHistoryGoForward()
1312
{
1309
{
1313
	if (history.forward()) {
1310
	if (history.forward()) {
1314
		strcpy(#path, history.current());
1311
		strcpy(#path, history.current());
1315
		files.KeyHome();
1312
		files.KeyHome();
1316
		Open_Dir(#path,WITH_REDRAW);
1313
		Open_Dir(#path,WITH_REDRAW);
1317
	}
1314
	}
1318
}
1315
}
1319
 
1316
 
1320
void EventOpenNewEolite()
1317
void EventOpenNewEolite()
1321
{
1318
{
1322
	RunProgram(I_Path, #path);
1319
	RunProgram(I_Path, #path);
1323
}
1320
}
1324
 
1321
 
1325
void EventOpenConsoleHere()
1322
void EventOpenConsoleHere()
1326
{
1323
{
1327
	sprintf(#param, "pwd cd %s", #path);
1324
	sprintf(#param, "pwd cd %s", #path);
1328
	RunProgram("/sys/shell", #param);
1325
	RunProgram("/sys/shell", #param);
1329
}
1326
}
1330
 
1327
 
1331
void ProceedMouseGestures()
1328
void ProceedMouseGestures()
1332
{
1329
{
1333
	char stats;
1330
	char stats;
1334
	signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
1331
	signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
1335
	if (!mouse.mkm) && (stats>0) stats = 0;
1332
	if (!mouse.mkm) && (stats>0) stats = 0;
1336
	if (mouse.mkm) && (!stats)
1333
	if (mouse.mkm) && (!stats)
1337
	{
1334
	{
1338
		x_old = mouse.x;
1335
		x_old = mouse.x;
1339
		y_old = mouse.y;
1336
		y_old = mouse.y;
1340
		stats = 1;
1337
		stats = 1;
1341
	}
1338
	}
1342
	if (mouse.mkm) && (stats==1)
1339
	if (mouse.mkm) && (stats==1)
1343
	{
1340
	{
1344
		dif_x = mouse.x-x_old;
1341
		dif_x = mouse.x-x_old;
1345
		dif_y = mouse.y-y_old;
1342
		dif_y = mouse.y-y_old;
1346
		adif_x = fabs(dif_x);
1343
		adif_x = fabs(dif_x);
1347
		adif_y = fabs(dif_y);
1344
		adif_y = fabs(dif_y);
1348
		
1345
		
1349
		if (adif_x>adif_y) {
1346
		if (adif_x>adif_y) {
1350
			if (dif_x > 150) {
1347
			if (dif_x > 150) {
1351
				EventHistoryGoForward();
1348
				EventHistoryGoForward();
1352
				stats = 0;
1349
				stats = 0;
1353
			}
1350
			}
1354
			if (dif_x < -150) {
1351
			if (dif_x < -150) {
1355
				EventHistoryGoBack();
1352
				EventHistoryGoBack();
1356
				stats = 0;
1353
				stats = 0;
1357
			}
1354
			}
1358
		} else {
1355
		} else {
1359
			if (dif_y < -100) {
1356
			if (dif_y < -100) {
1360
				Dir_Up();
1357
				Dir_Up();
1361
				stats = 0;
1358
				stats = 0;
1362
			}
1359
			}
1363
		}
1360
		}
1364
	}
1361
	}
1365
}
1362
}
1366
 
1363
 
1367
void EventPaste(dword _into_path) {
1364
void EventPaste(dword _into_path) {
1368
	char paste_line[4096+6];
1365
	char paste_line[4096+6];
1369
	sprintf(#paste_line, "-v%i %s", cut_active, _into_path);
1366
	sprintf(#paste_line, "-v%i %s", cut_active, _into_path);
1370
	RunProgram(#program_path, #paste_line);
1367
	RunProgram(#program_path, #paste_line);
1371
	EventClosePopinForm();
1368
	EventClosePopinForm();
1372
}
1369
}
1373
 
1370
 
1374
void EventDelete() 
1371
void EventDelete() 
1375
{
1372
{
1376
	char line_param[4096+5];
1373
	char line_param[4096+5];
1377
	CopyFilesListToClipboard(DELETE);
1374
	CopyFilesListToClipboard(DELETE);
1378
	EventClosePopinForm();
1375
	EventClosePopinForm();
1379
	sprintf(#line_param, "-d %s", #file_path);
1376
	sprintf(#line_param, "-d %s", #file_path);
1380
	RunProgram(#program_path, #line_param);	
1377
	RunProgram(#program_path, #line_param);	
1381
}
1378
}
1382
 
1379
 
1383
void EventClosePopinForm()
1380
void EventClosePopinForm()
1384
{
1381
{
1385
	del_active = 0;
1382
	del_active = 0;
1386
	new_element_active = 0;
1383
	new_element_active = 0;
1387
	disk_popin_active_on_panel = 0;
1384
	disk_popin_active_on_panel = 0;
1388
	draw_window();
1385
	draw_window();
1389
}
1386
}
1390
 
1387
 
1391
void EventShowProperties()
1388
void EventShowProperties()
1392
char line_param[4096+5];
1389
char line_param[4096+5];
1393
{
1390
{
1394
	if (!selected_count) {
1391
	if (!selected_count) {
1395
		sprintf(#line_param, "-p %s", #file_path);
1392
		sprintf(#line_param, "-p %s", #file_path);
1396
		RunProgram(#program_path, #line_param);
1393
		RunProgram(#program_path, #line_param);
1397
	} else {
1394
	} else {
1398
		properties_stak = malloc(8096);
1395
		properties_stak = malloc(8096);
1399
		CreateThread(#properties_dialog, properties_stak+8092);
1396
		CreateThread(#properties_dialog, properties_stak+8092);
1400
	}
1397
	}
1401
}
1398
}
1402
 
1399
 
1403
void EventChooseFile(int _id)
1400
void EventChooseFile(int _id)
1404
{
1401
{
1405
	if (getElementSelectedFlag(_id) == true) {
1402
	if (getElementSelectedFlag(_id) == true) {
1406
		setElementSelectedFlag(_id, false);
1403
		setElementSelectedFlag(_id, false);
1407
	} else {
1404
	} else {
1408
		setElementSelectedFlag(_id, true);
1405
		setElementSelectedFlag(_id, true);
1409
	}
1406
	}
1410
}
1407
}
1411
 
1408
 
1412
void EventChooseFilesRange(int _start, _end)
1409
void EventChooseFilesRange(int _start, _end)
1413
{
1410
{
1414
	if (_start > _end) _start >< _end;
1411
	if (_start > _end) _start >< _end;
1415
	if (_end - _start > 1) list_full_redraw = true;
1412
	if (_end - _start > 1) list_full_redraw = true;
1416
	while (_start < _end) {
1413
	while (_start < _end) {
1417
		EventChooseFile(_start); 
1414
		EventChooseFile(_start); 
1418
		_start++;
1415
		_start++;
1419
	}
1416
	}
1420
	DrawStatusBar();
1417
	DrawStatusBar();
1421
	List_ReDraw();
1418
	List_ReDraw();
1422
}
1419
}
1423
 
1420
 
1424
void EventChooseAllFiles(dword state)
1421
void EventChooseAllFiles(dword state)
1425
{
1422
{
1426
	int i;
1423
	int i;
1427
	for (i=0; i
1424
	for (i=0; i
1428
	List_ReDraw();
1425
	List_ReDraw();
1429
	DrawStatusBar();
1426
	DrawStatusBar();
1430
}
1427
}
1431
 
1428
 
1432
void EventToolbarButtonClick(int _btid)
1429
void EventToolbarButtonClick(int _btid)
1433
{
1430
{
1434
	switch(_btid) {
1431
	switch(_btid) {
1435
		case BACK_BTN: EventHistoryGoBack(); break;
1432
		case BACK_BTN: EventHistoryGoBack(); break;
1436
		case FWRD_BTN: EventHistoryGoForward(); break;
1433
		case FWRD_BTN: EventHistoryGoForward(); break;
1437
		case GOUP_BTN: Dir_Up(); break;
1434
		case GOUP_BTN: Dir_Up(); break;
1438
		case COPY_BTN: CopyFilesListToClipboard(CUT); break;
1435
		case COPY_BTN: CopyFilesListToClipboard(CUT); break;
1439
		case CUT_BTN:  CopyFilesListToClipboard(COPY); break;
1436
		case CUT_BTN:  CopyFilesListToClipboard(COPY); break;
1440
		case PASTE_BTN:EventPaste(#path); break;		
1437
		case PASTE_BTN:EventPaste(#path); break;		
1441
	}
1438
	}
1442
}
1439
}
1443
 
1440
 
1444
void EventDriveClick(int __id)
1441
void EventDriveClick(int __id)
1445
{
1442
{
1446
	if (disk_popin_active_on_panel != active_panel) {
1443
	if (disk_popin_active_on_panel != active_panel) {
1447
		ChangeActivePanel();
1444
		ChangeActivePanel();
1448
	}
1445
	}
1449
 
1446
 
1450
	SystemDiscs.Click(__id-100);
1447
	SystemDiscs.Click(__id-100);
1451
	if (efm) {
1448
	if (efm) {
1452
		draw_window();
1449
		draw_window();
1453
	}
1450
	}
1454
}
1451
}
1455
 
1452
 
1456
void EventOpenDiskPopin(int panel_n)
1453
void EventOpenDiskPopin(int panel_n)
1457
{
1454
{
1458
	DefineHiddenButton(0,0,5000,3000,9999+BT_NOFRAME);
1455
	DefineHiddenButton(0,0,5000,3000,9999+BT_NOFRAME);
1459
	disk_popin_active_on_panel = panel_n;
1456
	disk_popin_active_on_panel = panel_n;
1460
	if (disk_popin_active_on_panel==1) {
1457
	if (disk_popin_active_on_panel==1) {
1461
		SystemDiscs.DrawOptions(Form.cwidth/2-DDW, 8+DEV_H_HOR+3);
1458
		SystemDiscs.DrawOptions(Form.cwidth/2-DDW, 8+DEV_H_HOR+3);
1462
	} else {
1459
	} else {
1463
		SystemDiscs.DrawOptions(Form.cwidth-DDW-2, 8+DEV_H_HOR+3);
1460
		SystemDiscs.DrawOptions(Form.cwidth-DDW-2, 8+DEV_H_HOR+3);
1464
	}
1461
	}
1465
}
1462
}
1466
 
1463
 
1467
stop:
1464
stop:
1468
>
1465
>
1469
>
1466
>
1470
>
1467
>
1471
>
1468
>