Subversion Repositories Kolibri OS

Rev

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

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