Subversion Repositories Kolibri OS

Rev

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

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