Subversion Repositories Kolibri OS

Rev

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

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