Subversion Repositories Kolibri OS

Rev

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

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