Subversion Repositories Kolibri OS

Rev

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

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