Subversion Repositories Kolibri OS

Rev

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

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