Subversion Repositories Kolibri OS

Rev

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

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