Subversion Repositories Kolibri OS

Rev

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

Rev 5697 Rev 5698
1
//Leency, Veliant, Punk_Joker & KolibriOS Team 2008-2015
1
//Leency, Veliant, Punk_Joker & KolibriOS Team 2008-2015
2
//GNU GPL licence.
2
//GNU GPL licence.
3
 
3
 
4
#ifndef AUTOBUILD
4
#ifndef AUTOBUILD
5
#include "lang.h--"
5
#include "lang.h--"
6
#endif
6
#endif
7
 
7
 
8
//libraries
8
//libraries
9
#define MEMSIZE 500000
9
#define MEMSIZE 500000
10
#include "..\lib\clipboard.h"
10
#include "..\lib\clipboard.h"
11
#include "..\lib\strings.h"
11
#include "..\lib\strings.h"
12
#include "..\lib\mem.h"
12
#include "..\lib\mem.h"
13
#include "..\lib\file_system.h"
13
#include "..\lib\file_system.h"
14
#include "..\lib\gui.h"
14
#include "..\lib\gui.h"
15
#include "..\lib\list_box.h"
15
#include "..\lib\list_box.h"
16
#include "..\lib\copyf.h"
16
#include "..\lib\copyf.h"
17
#include "..\lib\random.h"
17
#include "..\lib\random.h"
18
//obj
18
//obj
19
#include "..\lib\obj\libini.h"
19
#include "..\lib\obj\libini.h"
20
#include "..\lib\obj\box_lib.h"
20
#include "..\lib\obj\box_lib.h"
21
//images
21
//images
22
#include "imgs\toolbar.txt"
22
#include "imgs\toolbar.txt"
23
#include "imgs\left_p.txt"
23
#include "imgs\left_p.txt"
24
#include "imgs\icons.txt"
24
#include "imgs\icons.txt"
25
 
-
 
26
#ifdef LANG_RUS
-
 
27
	?define T_FILE "” ©«"
-
 
28
	?define T_TYPE "’¨¯"
-
 
29
	?define T_SIZE " §¬¥à"
-
 
30
	?define T_NEW_FOLDER "®¢ ï ¯ ¯ª "
-
 
31
	?define T_NEW_FILE "®¢ë© ä ©«"
-
 
32
	?define T_DELETE_FILE "‚ë ¤¥©á⢨⥫쭮 å®â¨â¥ 㤠«¨âì"
-
 
33
	?define T_YES "„ "
-
 
34
	?define T_NO "¥â"
-
 
35
	?define T_CANCEL "Žâ¬¥­ "
-
 
36
	?define T_CREATE "‘®§¤ âì"
-
 
37
	?define T_RENAME "¥à¥¨¬¥­®¢ âì"
-
 
38
	?define FS_ITEM_ALREADY_EXISTS "'«¥¬¥­â á â ª¨¬ ¨¬¥­¥¬ 㦥 áãé¥áâ¢ã¥â' -E"
-
 
39
	?define T_DEL_ERROR_1 "Žè¨¡ª .  ¯ª  ­¥ ¯ãáâ ï."
-
 
40
	?define WAIT_DELETING_FOLDER "“¤ «ï¥âáï ¯ ¯ª . ®¤®¦¨â¥..."
-
 
41
	?define NOT_CREATE_FOLDER "¥ 㤠«®áì ᮧ¤ âì ¯ ¯ªã."
-
 
42
	?define NOT_CREATE_FILE "¥ 㤠«®áì ᮧ¤ âì ä ©«."
-
 
43
	?define T_PASTE_WINDOW_TITLE "Š®¯¨àãî..."
-
 
44
	?define T_PASTE_WINDOW_TEXT "Š®¯¨àã¥âáï ä ©«:"
-
 
45
	?define T_PASTE_WINDOW_BUTTON "à¥à¢ âì"	
-
 
46
	?define INFO_AFTER_COPY "Š®¯¨à®¢ ­¨¥ § ¢¥à襭®"
-
 
47
	?define T_CANCEL_PASTE "Š®¯¨à®¢ ­¨¥ ¯à¥ªà é¥­®.  ¯ª  ᪮¯¨à®¢ ­  ­¥ ¯®«­®áâìî."
-
 
48
	?define T_SELECT_APP_TO_OPEN_WITH "‚ë¡¥à¨â¥ ¯à®£à ¬¬ã ¤«ï ®âªàëâ¨ï ä ©« "
-
 
49
	?define DEL_MORE_FILES_1 "¢ë¡à ­­ë¥ í«¥¬¥­âë ("
-
 
50
	?define DEL_MORE_FILES_2 " èâ.)?"
-
 
51
#elif LANG_EST
-
 
52
	?define T_FILE "Fail"
-
 
53
	?define T_TYPE "T№№p"
-
 
54
	?define T_SIZE "Suurus"
-
 
55
	?define T_NEW_FOLDER "Uus kataloog"
-
 
56
	?define T_NEW_FILE "Uus fail"
-
 
57
	?define T_DELETE_FILE "Kas sa tahad tїesti kustutada"
-
 
58
	?define T_YES "Jah"
-
 
59
	?define T_NO "Ei"
-
 
60
	?define T_CANCEL "Cancel"
-
 
61
	?define T_CREATE "Create"
-
 
62
	?define T_RENAME "Rename"
-
 
63
	?define FS_ITEM_ALREADY_EXISTS "'An item with that name already exists' -E"
-
 
64
	?define T_DEL_ERROR_1 "Viga. Kataloog ei ole t№hi."
-
 
65
	?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
-
 
66
	?define NOT_CREATE_FOLDER "Kataloogi ei saa luua."
-
 
67
	?define NOT_CREATE_FILE "Faili ei saa luua."
-
 
68
	?define T_PASTE_WINDOW_TITLE "Kopeerin..."
-
 
69
	?define T_PASTE_WINDOW_TEXT "Kopeerin faili:"
-
 
70
	?define T_PASTE_WINDOW_BUTTON "Abort"
-
 
71
	?define INFO_AFTER_COPY "Copy finished"
-
 
72
	?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
-
 
73
	?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file"
-
 
74
	?define DEL_MORE_FILES_1 "selected items("
-
 
75
	?define DEL_MORE_FILES_2 " pcs.)?"
-
 
76
#else
-
 
77
	?define T_FILE "File"
-
 
78
	?define T_TYPE "Type"
-
 
79
	?define T_SIZE "Size"
-
 
80
	?define T_NEW_FOLDER "New folder"
-
 
81
	?define T_NEW_FILE "New file"
-
 
82
	?define T_DELETE_FILE "Do you really want to delete"
-
 
83
	?define T_YES "Yes"
-
 
84
	?define T_NO "No"
-
 
85
	?define T_CANCEL "Cancel"
-
 
86
	?define T_CREATE "Create"
-
 
87
	?define T_RENAME "Rename"
-
 
88
	?define FS_ITEM_ALREADY_EXISTS "'An item with that name already exists' -E"
-
 
89
	?define T_DEL_ERROR_1 "Error. Folder isn't empty."
-
 
90
	?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
-
 
91
	?define NOT_CREATE_FOLDER "Folder can not be created."
-
 
92
	?define NOT_CREATE_FILE "File can not be created."
-
 
93
	?define T_PASTE_WINDOW_TITLE "Copying..."
-
 
94
	?define T_PASTE_WINDOW_TEXT "Copying file:"
-
 
95
	?define T_PASTE_WINDOW_BUTTON "Abort"
-
 
96
	?define INFO_AFTER_COPY "Copy finished"
-
 
97
	?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
-
 
98
	?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file"
-
 
99
	?define DEL_MORE_FILES_1 "selected items("
-
 
100
	?define DEL_MORE_FILES_2 " pcs.)?"
-
 
101
#endif
-
 
102
 
25
 
103
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
26
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
104
enum { CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement
27
enum {CREATE_FILE=1, CREATE_FOLDER, RENAME_ITEM }; //NewElement
105
 
-
 
106
#define TITLE "Eolite File Manager v3.01 beta"
-
 
107
#define ABOUT_TITLE "Eolite 3.01 beta"
28
 
108
dword col_padding, col_selec, col_lpanel;
29
dword col_padding, col_selec, col_lpanel;
109
 
30
 
110
int toolbar_buttons_x[7]={9,46,85,134,167,203};
31
int toolbar_buttons_x[7]={9,46,85,134,167,203};
111
struct path_string { char Item[4096]; };
32
struct path_string { char Item[4096]; };
112
 
33
 
113
byte active_about=0;
34
byte active_about=0;
114
word about_window;
35
word about_window;
115
byte active_settings=0;
36
byte active_settings=0;
116
word settings_window;
37
word settings_window;
117
dword _not_draw = false;
38
dword _not_draw = false;
118
byte menu_call_mouse=0;
39
byte menu_call_mouse=0;
-
 
40
 
-
 
41
byte del_active=0,
-
 
42
	new_element_active=0;
119
 
43
 
120
llist files;
44
llist files;
121
 
45
 
122
byte list_full_redraw;
46
byte list_full_redraw;
-
 
47
 
-
 
48
dword buf;
-
 
49
dword file_mas[6898];
-
 
50
int selected_count;
-
 
51
 
123
 
52
 
124
byte
53
byte
125
	path[4096],
54
	path[4096],
126
	file_path[4096],
55
	file_path[4096],
127
	file_name[256],
56
	file_name[256],
128
	new_element_name[256],
57
	new_element_name[256],
129
	temp[4096];	 
58
	temp[4096],
130
byte
-
 
131
	del_active=0,
-
 
132
	new_element_active=0,
-
 
133
	show_dev_name=1,
-
 
134
	real_files_names_case=0,
-
 
135
	use_big_fonts=0,
-
 
136
	font_type,
-
 
137
	font_h,
-
 
138
	info_after_copy=0,
-
 
139
	sort_num=2,
-
 
140
	itdir;
59
	itdir;
-
 
60
 
-
 
61
//struct t_settings {
-
 
62
byte use_big_fonts=false,
-
 
63
	font_type=0x80,
-
 
64
	font_h=9,
-
 
65
	sort_num=2,
-
 
66
	show_dev_name=true,
-
 
67
	real_files_names_case=false,
-
 
68
	info_after_copy=false,
-
 
69
	two_panels=false;
-
 
70
//} settings;
-
 
71
 
141
 
72
 
142
dword eolite_ini_path;
73
dword eolite_ini_path;
143
 
74
 
144
char scroll_used=0;
75
char scroll_used=false;
145
 
76
 
146
dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak;
77
dword menu_stak,about_stak,properties_stak,settings_stak,copy_stak;
147
 
78
 
148
proc_info Form;
79
proc_info Form;
149
int mouse_dd, sc_slider_h, sorting_arrow_x, kolibrios_drive;
80
int mouse_dd, sc_slider_h, sorting_arrow_x, kolibrios_drive;
150
dword buf;
-
 
151
dword file_mas[6898];
-
 
152
int j, i;
81
int j, i;
153
int action_buf;
82
int action_buf;
154
int rand_n;
83
int rand_n;
155
int selected_count;
-
 
156
byte CMD_REFRESH;
84
byte CMD_REFRESH;
157
 
85
 
158
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
86
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
159
 
87
 
160
 
-
 
161
edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xFFFFFF,0,248,#file_name,#mouse_dd,64,6,6};
88
 
162
edit_box new_file_ed = {171,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0,248,#new_element_name,#mouse_dd,100000000000010b,6,0};
89
edit_box new_file_ed = {171,213,180,0xFFFFFF,0x94AECE,0xFFFFFF,0xFFFFFF,0,248,#new_element_name,#mouse_dd,100000000000010b,6,0};
163
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
90
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
164
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
91
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
165
byte cmd_free=0;
92
byte cmd_free=0;
-
 
93
#include "include\translations.h"
166
#include "include\copy.h"
94
#include "include\copy.h"
167
#include "include\gui.h"
95
#include "include\gui.h"
168
#include "include\sorting.h"
96
#include "include\sorting.h"
169
#include "include\icons.h"
97
#include "include\icons.h"
170
#include "include\left_panel.h"
98
#include "include\left_panel.h"
171
#include "include\history.h"
99
#include "include\history.h"
172
#include "include\menu.h"
100
#include "include\menu.h"
173
#include "include\about.h"
101
#include "include\about.h"
174
#include "include\settings.h"
102
#include "include\settings.h"
175
#include "include\properties.h"
103
#include "include\properties.h"
176
 
104
 
177
 
105
 
178
void main() 
106
void main() 
179
{
107
{
180
	word key,key2, id;
108
	word key, key2, id;
181
	dword status_key;
109
	dword status_key;
182
	char can_show, can_select, stats;
110
	char can_show, can_select, stats;
183
	dword selected_offset;
111
	dword selected_offset;
184
	dword IPC_LEN,IPC_ID;
112
	dword IPC_LEN,IPC_ID;
185
	char IPC_BUF[10];
113
	char IPC_BUF[10];
186
	dword tmp;
114
	dword tmp;
187
	rand_n = random(40);
115
	rand_n = random(40);
188
 
116
 
189
	load_dll(boxlib, #box_lib_init,0);
117
	load_dll(boxlib, #box_lib_init,0);
190
    load_dll(libini, #lib_init,1);
118
    load_dll(libini, #lib_init,1);
191
	eolite_ini_path = abspath("Eolite.ini"); 
119
	eolite_ini_path = abspath("Eolite.ini"); 
192
	LoadIniSettings();
120
	LoadIniSettings();
193
	GetSystemDiscs();
121
	GetSystemDiscs();
194
	SetAppColors();
122
	SetAppColors();
195
	if (param)
123
	if (param)
196
	{
124
	{
197
		tmp = strlen(#path);
125
		tmp = strlen(#path);
198
		strlcpy(#path, #param, tmp);
126
		strlcpy(#path, #param, tmp);
199
		$dec tmp
127
		$dec tmp
200
		if (path[tmp]!='/') DSBYTE[#path+tmp] = '/'; //add "/" to the end of the string
128
		if (path[tmp]!='/') DSBYTE[#path+tmp] = '/'; //add "/" to the end of the string
201
	}
129
	}
202
	else
130
	else
203
	{
131
	{
204
		strlcpy(#path, "/rd/1/", 6);		
132
		strlcpy(#path, "/rd/1/", 6);		
205
	}
133
	}
206
	Open_Dir(#path,ONLY_OPEN);
134
	Open_Dir(#path,ONLY_OPEN);
207
	SetEventMask(1100111b);
135
	SetEventMask(1100111b);
208
	loop(){
136
	loop(){
209
		switch(WaitEvent())
137
		switch(WaitEvent())
210
		{
138
		{
211
			case evMouse:
139
			case evMouse:
212
				if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break;
140
				if (del_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2) break;
213
				if (new_element_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2)
141
				if (new_element_active) || (!CheckActiveProcess(Form.ID)) || (Form.status_window>2)
214
				{
142
				{
215
					edit_box_mouse stdcall(#new_file_ed);
143
					edit_box_mouse stdcall(#new_file_ed);
216
					break;
144
					break;
217
				}				
145
				}				
218
				
146
				
219
				mouse.get();
147
				mouse.get();
220
				
148
				
221
				if (!mouse.mkm) && (stats>0) stats = 0;
149
				if (!mouse.mkm) && (stats>0) stats = 0;
222
				if (mouse.mkm) && (!stats)
150
				if (mouse.mkm) && (!stats)
223
				{
151
				{
224
					x_old = mouse.x;
152
					x_old = mouse.x;
225
					y_old = mouse.y;
153
					y_old = mouse.y;
226
					stats = 1;
154
					stats = 1;
227
				}
155
				}
228
				if (mouse.mkm) && (stats==1)
156
				if (mouse.mkm) && (stats==1)
229
				{
157
				{
230
					dif_x = mouse.x-x_old;
158
					dif_x = mouse.x-x_old;
231
					dif_y = mouse.y-y_old;
159
					dif_y = mouse.y-y_old;
232
					adif_x = fabs(dif_x);
160
					adif_x = fabs(dif_x);
233
					adif_y = fabs(dif_y);
161
					adif_y = fabs(dif_y);
234
					
162
					
235
					if (adif_x>adif_y)
163
					if (adif_x>adif_y)
236
					{
164
					{
237
						if (dif_x > 150)
165
						if (dif_x > 150)
238
						{
166
						{
239
							if (HistoryPath(GO_FORWARD))
167
							if (HistoryPath(GO_FORWARD))
240
								{
168
								{
241
									files.KeyHome();
169
									files.KeyHome();
242
									Open_Dir(#path,WITH_REDRAW);
170
									Open_Dir(#path,WITH_REDRAW);
243
								}
171
								}
244
							stats = 0;
172
							stats = 0;
245
						}
173
						}
246
						if (dif_x < -150)
174
						if (dif_x < -150)
247
						{
175
						{
248
							GoBack();
176
							GoBack();
249
							stats = 0;
177
							stats = 0;
250
						}
178
						}
251
					}
179
					}
252
					else
180
					else
253
					{
181
					{
254
						if (dif_y < -100)
182
						if (dif_y < -100)
255
						{
183
						{
256
							Dir_Up();
184
							Dir_Up();
257
							stats = 0;
185
							stats = 0;
258
						}
186
						}
259
					}
187
					}
260
				}	
188
				}	
261
				if (files.MouseOver(mouse.x, mouse.y))&&((mouse.down|mouse.dblclick|mouse.up))
189
				if (files.MouseOver(mouse.x, mouse.y))&&((mouse.down|mouse.dblclick|mouse.up))
262
				{
190
				{
263
					//select/open file {
191
					//select/open file {
264
					if (mouse.key&MOUSE_LEFT)&&((mouse.down)||(mouse.dblclick))
192
					if (mouse.key&MOUSE_LEFT)&&((mouse.down)||(mouse.dblclick))
265
					{
193
					{
266
						if (mouse.y>=files.y)//&&(mouse.click)
194
						if (mouse.y>=files.y)//&&(mouse.click)
267
						{
195
						{
268
							id = mouse.y - files.y / files.line_h + files.first;
196
							id = mouse.y - files.y / files.line_h + files.first;
269
							if (files.current!=id)
197
							if (files.current!=id)
270
							{
198
							{
271
								mouse.clearTime();
199
								mouse.clearTime();
272
								if(!mouse.up)&&(id-files.first
200
								if(!mouse.up)&&(id-files.first
273
									files.current = id;
201
									files.current = id;
274
									List_ReDraw();
202
									List_ReDraw();
275
								}
203
								}
276
							}
204
							}
277
							else IF(mouse.dblclick)Open(0);
205
							else IF(mouse.dblclick)Open(0);
278
						}
206
						}
279
					}
207
					}
280
					// } select/open file
208
					// } select/open file
281
					else
209
					else
282
					//file menu {
210
					//file menu {
283
					if (mouse.key&MOUSE_RIGHT)&&(mouse.up)
211
					if (mouse.key&MOUSE_RIGHT)&&(mouse.up)
284
					{
212
					{
285
						menu_call_mouse = 1;
213
						menu_call_mouse = 1;
286
						
214
						
287
						if (files.MouseOver(mouse.x, mouse.y))
215
						if (files.MouseOver(mouse.x, mouse.y))
288
						{
216
						{
289
							files.current = mouse.y - files.y / files.line_h + files.first;
217
							files.current = mouse.y - files.y / files.line_h + files.first;
290
							menu_stak = malloc(4096);
218
							menu_stak = malloc(4096);
291
							CreateThread(#FileMenu,menu_stak+4092);	
219
							CreateThread(#FileMenu,menu_stak+4092);	
292
						}
220
						}
293
						break;
221
						break;
294
					}
222
					}
295
					// } file menu
223
					// } file menu
296
				}
224
				}
297
 
225
 
298
				if (mouse.vert)
226
				if (mouse.vert)
299
				{
227
				{
300
					if (files.MouseScroll(mouse.vert)) List_ReDraw();
228
					if (files.MouseScroll(mouse.vert)) List_ReDraw();
301
					break;
229
					break;
302
				}
230
				}
303
 
231
 
304
				if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>40) && (mouse.y
232
				if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>40) && (mouse.y
305
				{
233
				{
306
					if (mouse.lkm==1) DrawRectangle3D(Form.cwidth - 17,41,14,14,0xC7C7C7,0xFFFFFF);
234
					if (mouse.lkm==1) DrawRectangle3D(Form.cwidth - 17,41,14,14,0xC7C7C7,0xFFFFFF);
307
					WHILE (mouse.lkm==1) && (files.first>0)
235
					WHILE (mouse.lkm==1) && (files.first>0)
308
					{
236
					{
309
						pause(8);
237
						pause(8);
310
						files.first--;
238
						files.first--;
311
						List_ReDraw();
239
						List_ReDraw();
312
						mouse.get();
240
						mouse.get();
313
					}
241
					}
314
					DrawRectangle3D(Form.cwidth - 17,41,14,14,0xFFFFFF,0xC7C7C7);
242
					DrawRectangle3D(Form.cwidth - 17,41,14,14,0xFFFFFF,0xC7C7C7);
315
				}
243
				}
316
 
244
 
317
				if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>onTop(22,0)+1) && (mouse.y
245
				if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>onTop(22,0)+1) && (mouse.y
318
				{
246
				{
319
					if (mouse.lkm==1) DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xC7C7C7,0xFFFFFF);
247
					if (mouse.lkm==1) DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xC7C7C7,0xFFFFFF);
320
					while (mouse.lkm==1) && (files.first
248
					while (mouse.lkm==1) && (files.first
321
					{
249
					{
322
						pause(8);
250
						pause(8);
323
						files.first++;
251
						files.first++;
324
						List_ReDraw();
252
						List_ReDraw();
325
						mouse.get();
253
						mouse.get();
326
					}
254
					}
327
					DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xFFFFFF,0xC7C7C7);
255
					DrawRectangle3D(Form.cwidth - 17,onTop(21,0),14,14,0xFFFFFF,0xC7C7C7);
328
				}
256
				}
329
 
257
 
330
				//Scrooll
258
				//Scrooll
331
				if (!mouse.lkm) && (scroll_used) { scroll_used=false; Scroll(); }
259
				if (!mouse.lkm) && (scroll_used) { scroll_used=false; Scroll(); }
332
				if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>56) && (mouse.y
260
				if (mouse.x>=Form.width-26) && (mouse.x<=Form.width-6) && (mouse.y>56) && (mouse.y
333
				
261
				
334
				if (scroll_used)
262
				if (scroll_used)
335
				{
263
				{
336
					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
264
					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
337
					id=files.first;
265
					id=files.first;
338
					j= sc_slider_h/2;
266
					j= sc_slider_h/2;
339
					files.first = mouse.y -j -files.y * files.count;
267
					files.first = mouse.y -j -files.y * files.count;
340
					files.first /= onTop(22,files.y);
268
					files.first /= onTop(22,files.y);
341
					if (files.visible+files.first>files.count) files.first=files.count-files.visible;
269
					if (files.visible+files.first>files.count) files.first=files.count-files.visible;
342
					if (id!=files.first) List_ReDraw();
270
					if (id!=files.first) List_ReDraw();
343
				}
271
				}
344
				break;  
272
				break;  
345
	//Button pressed-----------------------------------------------------------------------------
273
	//Button pressed-----------------------------------------------------------------------------
346
			case evButton:
274
			case evButton:
347
				id=GetButtonID();
275
				id=GetButtonID();
348
				if (id==1)
276
				if (id==1)
349
				{
277
				{
350
					KillProcess(about_window);
278
					KillProcess(about_window);
351
					ExitProcess();
279
					ExitProcess();
352
				}
280
				}
353
				if (del_active)
281
				if (del_active)
354
				{
282
				{
355
					if (id==301) || (id==302) Del_File(302-id);
283
					if (id==301) || (id==302) Del_File(302-id);
356
					break;
284
					break;
357
				}
285
				}
358
				if (new_element_active)
286
				if (new_element_active)
359
				{
287
				{
360
					if (id==301) || (id==302) NewElement(302-id);
288
					if (id==301) || (id==302) NewElement(302-id);
361
					break;
289
					break;
362
				}
290
				}
363
				
291
				
364
				switch(id) 
292
				switch(id) 
365
				{
293
				{
366
					case 21: //Back
294
					case 21: //Back
367
							GoBack();
295
							GoBack();
368
							break;
296
							break;
369
					case 22: //Forward
297
					case 22: //Forward
370
							if (HistoryPath(GO_FORWARD))
298
							if (HistoryPath(GO_FORWARD))
371
							{
299
							{
372
								files.KeyHome();
300
								files.KeyHome();
373
								Open_Dir(#path,WITH_REDRAW);
301
								Open_Dir(#path,WITH_REDRAW);
374
							}
302
							}
375
							break;
303
							break;
376
					case 23:
304
					case 23:
377
							Dir_Up();
305
							Dir_Up();
378
							break;
306
							break;
379
					case 24:
307
					case 24:
380
							Copy(#file_path, CUT);
308
							Copy(#file_path, CUT);
381
							break;
309
							break;
382
					case 25:
310
					case 25:
383
							Copy(#file_path, NOCUT);
311
							Copy(#file_path, NOCUT);
384
							break;
312
							break;
385
					case 26:
313
					case 26:
386
							Paste();
314
							Paste();
387
							break;
315
							break;
388
					case 31...33: //sort
316
					case 31...33: //sort
389
							if(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10);
317
							if(sort_num==1) DrawFilledBar(sorting_arrow_x,42,6,10);
390
							if(sort_num==2) DrawFilledBar(sorting_arrow_x,42,6,10);
318
							if(sort_num==2) DrawFilledBar(sorting_arrow_x,42,6,10);
391
							if(sort_num==3) DrawFilledBar(sorting_arrow_x,42,6,10);
319
							if(sort_num==3) DrawFilledBar(sorting_arrow_x,42,6,10);
392
							sort_num=id-30;
320
							sort_num=id-30;
393
							Open_Dir(#path,WITH_REDRAW);
321
							Open_Dir(#path,WITH_REDRAW);
394
							break;
322
							break;
395
					case 50...60: //Actions
323
					case 50...60: //Actions
396
							FnProcess(id-50);
324
							FnProcess(id-50);
397
							break;
325
							break;
398
					case 100...120:
326
					case 100...120:
399
						DEVICE_MARK:
-
 
400
							DrawRectangle(17,id-100*16+74,159,16, 0); //auaaeaiea
-
 
401
							strcpy(#path, #disk_list[id-100].Item);
-
 
402
							files.KeyHome();
327
						ClickOnDisk(id-100);
403
							Open_Dir(#path,WITH_REDRAW);
-
 
404
							pause(5);
-
 
405
							DrawRectangle(17,id-100*16+74,159,16, 0xFFFFFF);
-
 
406
							break;
328
						break;
407
				}
329
				}
408
				break;
330
				break;
409
	//Key pressed-----------------------------------------------------------------------------
331
	//Key pressed-----------------------------------------------------------------------------
410
			case evKey:
332
			case evKey:
411
				GetFullKey();
333
				GetFullKey();
412
				key = AH;
334
				key = AH;
413
				$shr  eax,16
335
				$shr  eax,16
414
				key2 = AL;
336
				key2 = AL;
415
				status_key = GetStatusKey();
337
				status_key = GetStatusKey();
416
				
338
 
417
				if (Form.status_window>2) break;
339
				if (Form.status_window>2) break;
418
				if (del_active)
340
				if (del_active)
419
				{
341
				{
420
					if (key==013) Del_File(true);
342
					if (key == ASCII_KEY_ENTER) Del_File(true);
421
					if (key==027) Del_File(false);
343
					if (key == ASCII_KEY_ESC) Del_File(false);
422
					break;
344
					break;
423
				}
345
				}
424
				if (new_element_active)
346
				if (new_element_active)
425
				{
347
				{
426
					if (key==027) NewElement(0);
348
					if (key == ASCII_KEY_ESC) NewElement(0);
427
					if (key==013) NewElement(1);
349
					if (key == ASCII_KEY_ENTER) NewElement(1);
428
					EAX=key<<8;
350
					EAX=key<<8;
429
					edit_box_key stdcall (#new_file_ed);
351
					edit_box_key stdcall (#new_file_ed);
430
					break;
352
					break;
431
				}
353
				}
432
				if (edit2.flags!=64) && (key!=13) && (key!=27)
-
 
433
				{
-
 
434
					EAX=key<<8;
-
 
435
					edit_box_key stdcall (#edit2);
-
 
436
					break;
-
 
437
				}
-
 
438
				if (files.ProcessKey(key))
354
				if (files.ProcessKey(key))
439
				{
355
				{
440
					List_ReDraw();
356
					List_ReDraw();
441
					break;
357
					break;
442
				}
358
				}
443
				
359
 
444
				if (TestBit(status_key, 2))
360
				if (TestBit(status_key, 2))
445
				{
361
				{
446
					switch(key2)
362
					switch(key2)
447
					{
363
					{
448
						case 45:  //Ctrl+X
364
						case 45:  //Ctrl+X
449
								Copy(#file_path, CUT);
365
								Copy(#file_path, CUT);
450
								break;						
366
								break;						
451
						case 46:  //Ctrl+C
367
						case 46:  //Ctrl+C
452
								Copy(#file_path, NOCUT);
368
								Copy(#file_path, NOCUT);
453
								break;
369
								break;
454
						case 47:  //Ctrl+V
370
						case 47:  //Ctrl+V
455
								Paste();
371
								Paste();
456
								break;
372
								break;
457
						case 032: //Ctrl+D - set as bg
373
						case 032: //Ctrl+D - set as bg
458
								strncpy(#temp, "\\S__",4);
374
								strncpy(#temp, "\\S__",4);
459
								strcat(#temp, #file_path);
375
								strcat(#temp, #file_path);
460
								RunProgram("/sys/media/kiv", #temp);
376
								RunProgram("/sys/media/kiv", #temp);
461
								break;
377
								break;
462
						case 049: //Ctrl+N - create new window
378
						case 049: //Ctrl+N - create new window
463
								if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD);
379
								if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD);
464
								RunProgram("/sys/File Managers/Eolite", #path);
380
								RunProgram("/sys/File Managers/Eolite", #path);
465
								break; 
381
								break; 
466
						case 030: //Ctrl+A - select all files
382
						case 030: //Ctrl+A - select all files
467
								for (i=0; i
383
								for (i=0; i
468
								{
384
								{
469
									selected_offset = file_mas[i]*304 + buf+32 + 7;
385
									selected_offset = file_mas[i]*304 + buf+32 + 7;
470
									if (!i) if (!strncmp(selected_offset+33, "..", 2)) continue; //do not selec ".." directory
386
									if (!i) if (!strncmp(selected_offset+33, "..", 2)) continue; //do not selec ".." directory
471
									ESBYTE[selected_offset] = 1;
387
									ESBYTE[selected_offset] = 1;
472
									selected_count++;
388
									selected_count++;
473
								}
389
								}
474
								List_ReDraw();
390
								List_ReDraw();
475
								break;
391
								break;
476
						case 022: //Ctrl+U - unselect all files
392
						case 022: //Ctrl+U - unselect all files
477
								for (i=0; i
393
								for (i=0; i
478
								{
394
								{
479
									selected_offset = file_mas[i]*304 + buf+32 + 7;
395
									selected_offset = file_mas[i]*304 + buf+32 + 7;
480
									ESBYTE[selected_offset] = 0;
396
									ESBYTE[selected_offset] = 0;
481
								}
397
								}
482
								selected_count = 0;
398
								selected_count = 0;
483
								List_ReDraw();
399
								List_ReDraw();
484
								break;
400
								break;
485
					}
401
					}
486
					break;
402
					break;
487
				}
403
				}
488
				
404
 
489
				switch (key)
405
				switch (key)
490
				{
406
				{
-
 
407
						case 096:
-
 
408
								two_panels ^= 1;
-
 
409
								draw_window();
-
 
410
								break;
491
						case 209...217:
411
						case 209...217:
492
								id=key-110;
412
								key -= 210;
493
								if (id-100>=disc_num) break;
413
								if (key
-
 
414
								{
-
 
415
									DrawRectangle(17,key*16+74,159,16, 0); //display click
-
 
416
									pause(7);
494
								GOTO DEVICE_MARK;
417
									ClickOnDisk(key);
-
 
418
								}
-
 
419
								break;
495
						case ASCII_KEY_BS:
420
						case ASCII_KEY_BS:
496
								//GoBack();
421
								//GoBack();
497
								Dir_Up();
422
								Dir_Up();
498
								break; 
423
								break; 
499
						case ASCII_KEY_ESC:
-
 
500
								break;
-
 
501
						case ASCII_KEY_ENTER:
424
						case ASCII_KEY_ENTER:
502
								Open(0);
425
								Open(0);
503
								break; 
426
								break; 
504
						case 074: //menu
427
						case 074: //menu
505
								menu_call_mouse=0;
428
								menu_call_mouse=0;
506
								//SwitchToAnotherThread();
-
 
507
								menu_stak = malloc(4096);
429
								menu_stak = malloc(4096);
508
								CreateThread(#FileMenu,menu_stak+4092);
430
								CreateThread(#FileMenu,menu_stak+4092);
509
								break;
431
								break;
510
						case 173: //Ctrl+Enter
432
						case 173: //Ctrl+Enter
511
								if (!itdir) ShowOpenWithDialog();
433
								if (!itdir) ShowOpenWithDialog();
512
								else Open(1);
434
								else Open(1);
513
								break;
435
								break;
514
						case ASCII_KEY_DEL:
436
						case ASCII_KEY_DEL:
515
								Del_Form();
437
								Del_Form();
516
								break;
438
								break;
517
						case ASCII_KEY_INS:
439
						case ASCII_KEY_INS:
518
								selected_offset = file_mas[files.current]*304 + buf+32 + 7;
440
								selected_offset = file_mas[files.current]*304 + buf+32 + 7;
519
								if (files.current==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory
441
								if (files.current==0) && (!strncmp(selected_offset+33, "..", 2)) goto _INSERT_END; //do not selec ".." directory
520
								if (ESBYTE[selected_offset])
442
								if (ESBYTE[selected_offset])
521
								{
443
								{
522
									ESBYTE[selected_offset]=0;
444
									ESBYTE[selected_offset]=0;
523
									selected_count--;
445
									selected_count--;
524
								}
446
								}
525
								else
447
								else
526
								{
448
								{
527
									ESBYTE[selected_offset] = 1;
449
									ESBYTE[selected_offset] = 1;
528
									selected_count++;
450
									selected_count++;
529
								}
451
								}
530
								_INSERT_END:
452
								_INSERT_END:
531
								if (files.KeyDown()) List_ReDraw();
453
								if (files.KeyDown()) List_ReDraw();
532
								break;
454
								break;
533
						case 048...059: //F1-F10
455
						case 049...059: //F1-F10
534
								FnProcess(key-49);
456
								FnProcess(key-49);
535
								break; 
457
								break; 
536
						default:    
458
						default:    
537
								for (i=files.current+1; i
459
								for (i=files.current+1; i
538
								{
460
								{
539
									strcpy(#temp, file_mas[i]*304+buf+72);
461
									strcpy(#temp, file_mas[i]*304+buf+72);
540
									if (temp[0]==key) || (temp[0]==key-32)
462
									if (temp[0]==key) || (temp[0]==key-32)
541
									{
463
									{
542
										files.current = i - 1;
464
										files.current = i - 1;
543
										files.KeyDown();
465
										files.KeyDown();
544
										List_ReDraw();
466
										List_ReDraw();
545
										break;
467
										break;
546
									}
468
									}
547
								}
469
								}
548
				}                         
470
				}                         
549
			break;
471
			break;
-
 
472
			case evIPC:
550
			case evReDraw:
473
			case evReDraw:
551
				DRAW_WINDOW:
-
 
552
				draw_window();
474
				draw_window();
553
				if (action_buf) 
475
				if (action_buf) 
554
				{
476
				{
-
 
477
					if (action_buf==COPY_PASTE_END)
-
 
478
					{
-
 
479
						FnProcess(5);
-
 
480
						SelectFileByName(#copy_to+strrchr(#copy_to,'/'));
-
 
481
					}
555
					menu_action(action_buf); 
482
					if (action_buf==100) Open(0);
-
 
483
					if (action_buf==201) ShowOpenWithDialog();
-
 
484
					if (action_buf==202) FnProcess(3); //F3
-
 
485
					if (action_buf==203) FnProcess(4); //F4
-
 
486
					if (action_buf==104) Copy(#file_path, NOCUT);
-
 
487
					if (action_buf==105) Copy(#file_path, CUT);
-
 
488
					if (action_buf==106) Paste();
-
 
489
					if (action_buf==207) FnProcess(2);
-
 
490
					if (action_buf==108) Del_Form();
-
 
491
					if (action_buf==109) FnProcess(5);
-
 
492
					if (action_buf==110) FnProcess(8);
-
 
493
					if (action_buf==300) { FnProcess(5); List_ReDraw(); }
556
					action_buf=0;
494
					action_buf=0;
557
				}
495
				}
558
			break;
-
 
559
			case evIPC:
-
 
560
				goto DRAW_WINDOW;
-
 
561
			break;
-
 
562
		}
496
		}
563
		
497
		
564
		if(cmd_free)
498
		if(cmd_free)
565
		{
499
		{
566
			if(cmd_free==1)     free(menu_stak);
500
			if(cmd_free==1)     free(menu_stak);
567
			else if(cmd_free==2)free(about_stak);
501
			else if(cmd_free==2)free(about_stak);
568
			else if(cmd_free==3)free(properties_stak);
502
			else if(cmd_free==3)free(properties_stak);
569
			else if(cmd_free==4)free(settings_stak);
503
			else if(cmd_free==4)free(settings_stak);
570
			else if(cmd_free==5)free(copy_stak);
504
			else if(cmd_free==5)free(copy_stak);
571
			cmd_free = false;
505
			cmd_free = false;
572
		}
506
		}
573
	}
507
	}
574
}
508
}
575
 
509
 
576
 
-
 
577
inline fastcall signed int _strrchr( ESI,BL)
-
 
578
{
-
 
579
	int jj=0, last=strlen(ESI);
-
 
580
	do {
-
 
581
		jj++;
-
 
582
		$lodsb
-
 
583
		if(AL==BL) last=jj;
-
 
584
	} while(AL!=0);
-
 
585
	return last;
-
 
586
}
-
 
587
 
-
 
588
 
-
 
589
void menu_action(dword id)
-
 
590
{
-
 
591
	if (id==COPY_PASTE_END)
-
 
592
	{
-
 
593
		FnProcess(5);
-
 
594
		SelectFileByName(#copy_to+strrchr(#copy_to,'/'));
-
 
595
	}
-
 
596
	if (id==100) Open(0);
-
 
597
	if (id==201) ShowOpenWithDialog();
-
 
598
	if (id==202) FnProcess(3); //F3
-
 
599
	if (id==203) FnProcess(4); //F4
-
 
600
	if (id==104) Copy(#file_path, NOCUT);
-
 
601
	if (id==105) Copy(#file_path, CUT);
-
 
602
	if (id==106) Paste();
-
 
603
	if (id==207) FnProcess(2);
-
 
604
	if (id==108) Del_Form();
-
 
605
	if (id==109) FnProcess(5);
-
 
606
	if (id==110) FnProcess(8);
-
 
607
	if (id==300)
-
 
608
	{ 
-
 
609
		FnProcess(5); 
-
 
610
		List_ReDraw(); 
-
 
611
	}
-
 
612
}
-
 
613
 
-
 
614
 
510
 
615
void draw_window()
511
void draw_window()
616
{
512
{
617
	DefineAndDrawWindow(GetScreenWidth()-550/4+rand_n,rand_n+30,550,500,0x73,system.color.work,TITLE,0);
513
	DefineAndDrawWindow(GetScreenWidth()-550/4+rand_n,rand_n+30,550,500,0x73,system.color.work,TITLE,0);
618
	GetProcessInfo(#Form, SelfInfo);
514
	GetProcessInfo(#Form, SelfInfo);
619
	if (Form.status_window>2) return;
515
	if (Form.status_window>2) return;
620
	if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h);
516
	if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h);
621
	if (Form.width<480) MoveSize(OLD,OLD,480,OLD);
517
	if (Form.width<480) MoveSize(OLD,OLD,480,OLD);
622
	GetProcessInfo(#Form, SelfInfo); //if win_size changed
518
	GetProcessInfo(#Form, SelfInfo); //if win_size changed
623
	files.SetSizes(192, 57, Form.cwidth - 210, onTop(57,6), disc_num*16+195,files.line_h);
-
 
624
	PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
519
	PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
625
	DrawBar(127, 8, 1, 25, system.color.work_graph);
520
	DrawBar(127, 8, 1, 25, system.color.work_graph);
626
	for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,system.color.work);
521
	for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,system.color.work);
627
	for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,system.color.work);
522
	for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,system.color.work);
628
	DrawBar(246,0,Form.cwidth - 297,12, system.color.work); //upper editbox
523
	DrawBar(246,0,Form.cwidth - 297,12, system.color.work); //upper editbox
629
	DrawBar(246,29,Form.cwidth - 297,5,system.color.work);  //under editbox
524
	DrawBar(246,29,Form.cwidth - 297,5,system.color.work);  //under editbox
630
	DrawRectangle(246,12,Form.cwidth - 303,16,system.color.work_graph);
525
	DrawRectangle(246,12,Form.cwidth - 303,16,system.color.work_graph);
631
	DefineButton(Form.cwidth - 32,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about
526
	DefineButton(Form.cwidth - 32,6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about
632
	PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
527
	PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
633
	//main rectangles
528
	//main rectangles
634
	DrawRectangle(1,40,Form.cwidth-3,onTop(46,0),system.color.work_graph);
529
	DrawRectangle(1,40,Form.cwidth-3,Form.cheight - 42,system.color.work_graph);
635
	DrawRectangle(0,39,Form.cwidth-1,onTop(44,0),col_palette[4]); //bg
530
	DrawRectangle(0,39,Form.cwidth-1,Form.cheight - 40,col_palette[4]); //bg
636
	for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);	
531
	for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);	
-
 
532
	if (!two_panels)
-
 
533
	{
637
	DrawLeftPanel();
534
		DrawLeftPanel();
638
	//ListBox
-
 
639
	DrawFlatButton(files.x,40,Form.cwidth - files.x - 159,16,31,system.color.work,T_FILE);
535
		files.SetSizes(192, 57, Form.cwidth - 210, Form.cheight - 59, disc_num*16+3,files.line_h);	
640
	DrawFlatButton(Form.cwidth - 159,40,73,16,32,system.color.work,T_TYPE);
-
 
641
	DrawFlatButton(Form.cwidth - 86,40,68,16,33,system.color.work,T_SIZE);
-
 
642
	DrawBar(files.x+files.w,files.y,1,onTop(22,files.y),system.color.work_graph); //line to the left from the scroll
-
 
643
	DrawFlatButton(files.x+files.w,40,16,16,0,system.color.work,"\x18");
536
		DrawListColumns();
644
	DrawFlatButton(files.x+files.w,onTop(22,0),16,16,0,system.color.work,"\x19");
-
 
645
	Open_Dir(#path,ONLY_SHOW);
537
		Open_Dir(#path,ONLY_SHOW);
-
 
538
	}
-
 
539
	else
-
 
540
	{
-
 
541
		files.SetSizes(2, 57+18, Form.cwidth/2-2-17, Form.cheight-59-18, disc_num*16+3,files.line_h);
-
 
542
		DrawListColumns();
-
 
543
		Open_Dir(#path,ONLY_SHOW);		
-
 
544
		files.SetSizes(Form.cwidth/2, 57+18, Form.cwidth/2-17, Form.cheight-59-18, disc_num*16+3,files.line_h);
-
 
545
		DrawListColumns();
-
 
546
		Open_Dir(#path,ONLY_SHOW);
-
 
547
	}
646
	if (del_active) Del_Form();
548
	if (del_active) Del_Form();
647
	if (new_element_active) NewElement_Form(new_element_active, #new_element_name);
549
	if (new_element_active) NewElement_Form(new_element_active, #new_element_name);
648
}
550
}
-
 
551
 
-
 
552
void DrawListColumns() 
-
 
553
{
-
 
554
	DrawFlatButton(files.x,files.y -  17,  files.w - 141,16,31,system.color.work,T_FILE);
-
 
555
	DrawFlatButton(files.x + files.w - 141,  files.y-17,73,16,32,system.color.work,T_TYPE);
-
 
556
	DrawFlatButton(files.x + files.w -  68,  files.y-17,68,16,33,system.color.work,T_SIZE);
-
 
557
	DrawFlatButton(files.x + files.w,        files.y-17,16,16, 0,system.color.work,"\x18");
-
 
558
	DrawFlatButton(files.x + files.w,files.y+files.h-16,16,16, 0,system.color.work,"\x19");
-
 
559
	DrawBar(files.x+files.w,files.y,1,files.h,system.color.work_graph);
-
 
560
}
649
 
561
 
650
 
562
 
651
void List_ReDraw()
563
void List_ReDraw()
652
{
564
{
653
	int paint_y;
565
	int paint_y;
654
	static int old_current, old_first;
566
	static int old_current, old_first;
655
 
567
 
656
	files.CheckDoesValuesOkey(); //prevent some shit
568
	files.CheckDoesValuesOkey(); //prevent some shit
657
 
569
 
658
	if (list_full_redraw) || (old_first != files.first)
570
	if (list_full_redraw) || (old_first != files.first)
659
	{
571
	{
660
		old_current = files.current;
572
		old_current = files.current;
661
		old_first = files.first;
573
		old_first = files.first;
662
		list_full_redraw = false;
574
		list_full_redraw = false;
663
		goto _ALL_LIST_REDRAW;
575
		goto _ALL_LIST_REDRAW;
664
	}
576
	}
665
	if (old_current != files.current)
577
	if (old_current != files.current)
666
	{
578
	{
667
		Line_ReDraw(0xFFFFFF, old_current-files.first);
579
		if (old_current-files.first
668
		Line_ReDraw(col_selec, files.current-files.first);
580
		Line_ReDraw(col_selec, files.current-files.first);
669
		old_current = files.current;
581
		old_current = files.current;
670
		return;
582
		return;
671
	}
583
	}
672
 
584
 
673
	_ALL_LIST_REDRAW:
585
	_ALL_LIST_REDRAW:
674
 
586
 
675
	for (j=0; j
587
	for (j=0; j
676
	//in the bottom
588
	//in the bottom
677
	paint_y = j * files.line_h + files.y;
589
	paint_y = j * files.line_h + files.y;
678
	DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF);
590
	DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF);
679
	DrawBar(Form.cwidth-159,paint_y,1,onTop(paint_y,6),system.color.work);
591
	DrawBar(Form.cwidth-159,paint_y,1,onTop(paint_y,6),system.color.work);
680
	DrawBar(Form.cwidth-86,paint_y,1,onTop(paint_y,6),system.color.work);
592
	DrawBar(Form.cwidth-86,paint_y,1,onTop(paint_y,6),system.color.work);
681
	Scroll();
593
	Scroll();
682
}
594
}
683
 
595
 
684
 
596
 
685
void Line_ReDraw(dword color, filenum){
597
void Line_ReDraw(dword color, filenum){
686
	dword text_col=0,
598
	dword text_col=0,
687
	      ext1, attr,
599
	      ext1, attr,
688
	      file_offet,
600
	      file_offet,
689
	      file_name_off,
601
	      file_name_off,
690
	      y=filenum*files.line_h+files.y;
602
	      y=filenum*files.line_h+files.y;
691
	      BDVK file;
603
	      BDVK file;
692
	if (filenum==-1) return;
604
	if (filenum==-1) return;
693
	DrawBar(files.x,y,3,files.line_h,color); 
605
	DrawBar(files.x,y,3,files.line_h,color); 
694
	DrawBar(files.x+19,y,files.w-19,files.line_h,color);
606
	DrawBar(files.x+19,y,files.w-19,files.line_h,color);
695
	DrawBar(files.x+3,y+17,16,1,color);
607
	DrawBar(files.x+3,y+17,16,1,color);
696
	if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,color);
608
	if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,color);
697
	if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,color); 
609
	if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,color); 
698
 
610
 
699
	file_offet = file_mas[filenum+files.first]*304 + buf+32;
611
	file_offet = file_mas[filenum+files.first]*304 + buf+32;
700
	attr = ESDWORD[file_offet];
612
	attr = ESDWORD[file_offet];
701
	file.selected = ESBYTE[file_offet+7];
613
	file.selected = ESBYTE[file_offet+7];
702
	file.sizelo   = ESDWORD[file_offet+32];
614
	file.sizelo   = ESDWORD[file_offet+32];
703
	file_name_off = file_offet+40;
615
	file_name_off = file_offet+40;
704
 
616
 
705
	if (! TestBit(attr, 4) ) //file or folder?
617
	if (! TestBit(attr, 4) ) //file or folder?
706
	{	
618
	{	
-
 
619
		ext1 = strrchr(file_name_off,'.') + file_name_off;
-
 
620
		if (ext1==file_name_off) ext1 = " \0"; //if no extension then show nothing 
707
		Put_icon(file_name_off+_strrchr(file_name_off,'.'), files.x+3, files.line_h/2-7+y, color, 0);
621
		Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0);
708
		WriteText(7-strlen(ConvertSize(file.sizelo))*6+Form.cwidth - 76, files.line_h - font_h/ 2 + y,font_type,0,ConvertSize(file.sizelo));
622
		WriteText(7-strlen(ConvertSize(file.sizelo))*6+Form.cwidth - 76, files.line_h - font_h/ 2 + y,font_type,0,ConvertSize(file.sizelo));
709
	}
623
	}
710
	else
624
	else
711
	{
625
	{
712
		if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1="";
626
		if (!strncmp(file_name_off,"..",3)) ext1=".."; else ext1="";
713
		Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0);		
627
		Put_icon(ext1, files.x+3, files.line_h/2-7+y, color, 0);		
714
	}
628
	}
715
 
629
 
716
	if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
630
	if (TestBit(attr, 1)) || (TestBit(attr, 2)) text_col=0xA6A6B7; //system or hiden?
717
	if (color!=0xFFFfff)
631
	if (color!=0xFFFfff)
718
	{
632
	{
719
		itdir = TestBit(attr, 4);
633
		itdir = TestBit(attr, 4);
720
		strcpy(#file_name, file_name_off);
634
		strcpy(#file_name, file_name_off);
721
		sprintf(#file_path,"%s%s",#path,file_name_off);
635
		sprintf(#file_path,"%s%s",#path,file_name_off);
722
		if (text_col==0xA6A6B7) text_col=0xFFFFFF;
636
		if (text_col==0xA6A6B7) text_col=0xFFFFFF;
723
	}
637
	}
724
	if (file.selected) text_col=0xFF0000;
638
	if (file.selected) text_col=0xFF0000;
725
	if (Form.width>=480)
639
	if (Form.width>=480)
726
	{
640
	{
727
		FileShow.start_x = files.x + 23;
641
		FileShow.start_x = files.x + 23;
728
		FileShow.font_color = text_col;
642
		FileShow.font_color = text_col;
729
		FileShow.area_size_x = files.w - 164;
643
		FileShow.area_size_x = files.w - 164;
730
		FileShow.text_pointer = file_name_off;
644
		FileShow.text_pointer = file_name_off;
731
		FileShow.start_y = files.line_h - font_h/ 2 + y;
645
		FileShow.start_y = files.line_h - font_h/ 2 + y;
732
		PathShow_prepare stdcall(#FileShow);
646
		PathShow_prepare stdcall(#FileShow);
733
		PathShow_draw stdcall(#FileShow);
647
		PathShow_draw stdcall(#FileShow);
734
	}
648
	}
735
	DrawBar(Form.cwidth-159,y,1,files.line_h,system.color.work); //gray line 1
649
	DrawBar(Form.cwidth-159,y,1,files.line_h,system.color.work); //gray line 1
736
	DrawBar(Form.cwidth-86,y,1,files.line_h,system.color.work); //gray line 2
650
	DrawBar(Form.cwidth-86,y,1,files.line_h,system.color.work); //gray line 2
737
}
651
}
738
 
652
 
739
 
653
 
740
void Open_Dir(dword dir_path, redraw){
654
void Open_Dir(dword dir_path, redraw){
741
	int errornum, maxcount;
655
	int errornum, maxcount;
742
 
656
 
743
	if (redraw!=ONLY_SHOW)
657
	if (redraw!=ONLY_SHOW)
744
	{
658
	{
745
		if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0';
659
		if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0';
746
		if (buf) free(buf);
660
		if (buf) free(buf);
747
		errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
661
		errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
748
		if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/');
662
		if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/');
749
		if (errornum)
663
		if (errornum)
750
		{
664
		{
751
			HistoryPath(ADD_NEW_PATH);
665
			HistoryPath(ADD_NEW_PATH);
752
			GoBack();
666
			GoBack();
753
			Write_Error(errornum);
667
			Write_Error(errornum);
754
			return;
668
			return;
755
		}
669
		}
756
		maxcount = sizeof(file_mas)/sizeof(dword)-1;
670
		maxcount = sizeof(file_mas)/sizeof(dword)-1;
757
		if (files.count>maxcount) files.count = maxcount;
671
		if (files.count>maxcount) files.count = maxcount;
758
		if (files.count>0) && (files.current-files.first==-1) files.current=0;
672
		if (files.count>0) && (files.current-files.first==-1) files.current=0;
759
	}
673
	}
760
	if (files.count!=-1)
674
	if (files.count!=-1)
761
	{
675
	{
762
		if(!_not_draw)
676
		if(!_not_draw)
763
		{
677
		{
764
			PathShow.area_size_x = Form.cwidth-306;
678
			PathShow.area_size_x = Form.cwidth-306;
765
			DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
679
			DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
766
			PathShow_prepare stdcall(#PathShow);
680
			PathShow_prepare stdcall(#PathShow);
767
			PathShow_draw stdcall(#PathShow);
681
			PathShow_draw stdcall(#PathShow);
768
		}
682
		}
769
		HistoryPath(ADD_NEW_PATH);
683
		HistoryPath(ADD_NEW_PATH);
770
		files.visible = files.h / files.line_h;
684
		files.visible = files.h / files.line_h;
771
		if (files.count < files.visible) files.visible = files.count;
685
		if (files.count < files.visible) files.visible = files.count;
772
		if (sort_num==1) sorting_arrow_x = Form.width+60/2;
686
		if (sort_num==1) sorting_arrow_x = Form.width+60/2;
773
		if (sort_num==2) sorting_arrow_x = Form.width-115;
687
		if (sort_num==2) sorting_arrow_x = Form.width-115;
774
		if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
688
		if (sort_num==3) sorting_arrow_x = strlen(T_SIZE)*3-30+files.x+files.w;
775
		WriteText(sorting_arrow_x,45,0x80,system.color.work_graph,"\x19");
689
		WriteText(sorting_arrow_x,45,0x80,system.color.work_graph,"\x19");
776
		if (redraw!=ONLY_SHOW) Sorting();
690
		if (redraw!=ONLY_SHOW) Sorting();
777
		list_full_redraw = true;
691
		list_full_redraw = true;
778
		if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw();
692
		if (redraw!=ONLY_OPEN)&&(!_not_draw) List_ReDraw();
779
		DrawSystemDiscs();
693
		DrawSystemDiscs();
780
	}
694
	}
781
	if (files.count==-1) && (redraw!=ONLY_OPEN) 
695
	if (files.count==-1) && (redraw!=ONLY_OPEN) 
782
	{
696
	{
783
		files.KeyHome();
697
		files.KeyHome();
784
		if(!_not_draw) { list_full_redraw=true; List_ReDraw(); }
698
		if(!_not_draw) { list_full_redraw=true; List_ReDraw(); }
785
	}
699
	}
786
}
700
}
787
 
701
 
788
 
702
 
789
inline Sorting()
703
inline Sorting()
790
{
704
{
791
	dword k=0, l=1;
705
	dword k=0, l=1;
792
	dword file_off;
706
	dword file_off;
793
	int i;
707
	int i;
794
	if (!strncmp(#path,"/",2)) //do not sort
708
	if (!strncmp(#path,"/",2)) //do not sort
795
	{
709
	{
796
		for(k=1;k
710
		for(k=1;k
797
		return;
711
		return;
798
	}
712
	}
799
	for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;)  //files | folders
713
	for (j=files.count-1, file_off=files.count-1*304+buf+32; j>=0; j--, file_off-=304;)  //files | folders
800
	{
714
	{
801
		if (!real_files_names_case) strttl(file_off+40);
715
		if (!real_files_names_case) strttl(file_off+40);
802
		if (TestBit(ESDWORD[file_off],4)) //directory?
716
		if (TestBit(ESDWORD[file_off],4)) //directory?
803
		{
717
		{
804
			file_mas[k]=j;
718
			file_mas[k]=j;
805
			k++;
719
			k++;
806
		}
720
		}
807
		else
721
		else
808
		{
722
		{
809
			file_mas[files.count-l]=j;
723
			file_mas[files.count-l]=j;
810
			l++;
724
			l++;
811
		}
725
		}
812
	}
726
	}
813
	//sorting: files first, then folders
727
	//sorting: files first, then folders
814
	Sort_by_Name(0,k-1);
728
	Sort_by_Name(0,k-1);
815
	if (sort_num==1) Sort_by_Name(k,files.count-1);
729
	if (sort_num==1) Sort_by_Name(k,files.count-1);
816
	if (sort_num==2) Sort_by_Type(k,files.count-1);
730
	if (sort_num==2) Sort_by_Type(k,files.count-1);
817
	if (sort_num==3) Sort_by_Size(k,files.count-1);
731
	if (sort_num==3) Sort_by_Size(k,files.count-1);
818
	//make ".." first item in list
732
	//make ".." first item in list
819
	if (k>0) && (!strncmp(file_mas[0]*304+buf+72,"..",3))
733
	if (k>0) && (!strncmp(file_mas[0]*304+buf+72,"..",3))
820
		for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",3)) {file_mas[k]>
734
		for(k--; k>0; k--;) if (!strncmp(file_mas[k]*304+buf+72,"..",3)) {file_mas[k]>
821
}
735
}
822
 
736
 
823
 
737
 
824
void Del_Form()
738
void Del_Form()
825
{
739
{
826
	dword selected_offset2;
740
	dword selected_offset2;
827
	int cont = 0;
741
	int cont = 0;
828
	byte f_count[128];
742
	byte f_count[128];
829
	int dform_x = files.w - 220 / 2 + files.x;
743
	int dform_x = files.w - 220 / 2 + files.x;
830
	if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return;
744
	if (!strncmp(#file_name,".",2)) || (!strncmp(#file_name,"..",2)) return;
831
	if (del_active==2)
745
	if (del_active==2)
832
	{
746
	{
833
		if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
747
		if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
834
	}
748
	}
835
	else
749
	else
836
	{
750
	{
837
		if (!files.count) return;
751
		if (!files.count) return;
838
		DrawPopup(dform_x,160,220,85,1,system.color.work,system.color.work_graph);
752
		DrawPopup(dform_x,160,220,85,1,system.color.work,system.color.work_graph);
839
		WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE);
753
		WriteText(-strlen(T_DELETE_FILE)*3+110+dform_x,175,0x80,system.color.work_text,T_DELETE_FILE);
840
		for (i=0; i
754
		for (i=0; i
841
		{
755
		{
842
			selected_offset2 = file_mas[i]*304 + buf+32 + 7;
756
			selected_offset2 = file_mas[i]*304 + buf+32 + 7;
843
			if (ESBYTE[selected_offset2]) cont++;
757
			if (ESBYTE[selected_offset2]) cont++;
844
		}
758
		}
845
		if (cont)
759
		if (cont)
846
		{
760
		{
847
			sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,cont,DEL_MORE_FILES_2);
761
			sprintf(#f_count,"%s%d%s",DEL_MORE_FILES_1,cont,DEL_MORE_FILES_2);
848
			WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count);
762
			WriteText(-strlen(#f_count)*3+110+dform_x,190,0x80,system.color.work_text,#f_count);
849
		}
763
		}
850
		else
764
		else
851
		{
765
		{
852
			if (strlen(#file_name)<28) 
766
			if (strlen(#file_name)<28) 
853
			{
767
			{
854
				WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,system.color.work_text,"?");
768
				WriteText(strlen(#file_name)*3+110+dform_x+2,190,0x80,system.color.work_text,"?");
855
				WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,system.color.work_text,#file_name);
769
				WriteText(-strlen(#file_name)*3+110+dform_x,190,0x80,system.color.work_text,#file_name);
856
			}
770
			}
857
			else
771
			else
858
			{
772
			{
859
				WriteText(164+dform_x,190,0x80,0,"...?");
773
				WriteText(164+dform_x,190,0x80,0,"...?");
860
				ESI = 24;
774
				ESI = 24;
861
				WriteText(dform_x+20,190,0,0,#file_name);
775
				WriteText(dform_x+20,190,0,0,#file_name);
862
			}
776
			}
863
		}
777
		}
864
		DrawFlatButton(dform_x+27,208,70,20,301,0xFFB6B5,T_YES);
778
		DrawFlatButton(dform_x+27,208,70,20,301,0xFFB6B5,T_YES);
865
		DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO);		
779
		DrawFlatButton(dform_x+120,208,70,20,302,0xC6DFC6,T_NO);		
866
		del_active=1;
780
		del_active=1;
867
	}
781
	}
868
}
782
}
869
 
783
 
870
int del_error;
784
int del_error;
871
int Del_File2(dword way)
785
int Del_File2(dword way)
872
{    
786
{    
873
	dword dirbuf, fcount, i, filename;
787
	dword dirbuf, fcount, i, filename;
874
	int error;
788
	int error;
875
	char del_from[4096];
789
	char del_from[4096];
876
	if (isdir(way))
790
	if (isdir(way))
877
	{
791
	{
878
		if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error;
792
		if (error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL)) del_error = error;
879
		for (i=0; i
793
		for (i=0; i
880
		{
794
		{
881
			if (CheckEvent()==evReDraw) draw_window();
795
			if (CheckEvent()==evReDraw) draw_window();
882
			filename = i*304+dirbuf+72;
796
			filename = i*304+dirbuf+72;
883
			sprintf(#del_from,"%s/%s",way,filename);
797
			sprintf(#del_from,"%s/%s",way,filename);
884
			if ( TestBit(ESDWORD[filename-40], 4) )
798
			if ( TestBit(ESDWORD[filename-40], 4) )
885
			{
799
			{
886
				Del_File2(#del_from);
800
				Del_File2(#del_from);
887
			}
801
			}
888
			else
802
			else
889
			{
803
			{
890
				if (error = DeleteFile(#del_from)) del_error = error;
804
				if (error = DeleteFile(#del_from)) del_error = error;
891
			}
805
			}
892
		}
806
		}
893
	}
807
	}
894
	if (error = DeleteFile(way)) del_error = error;
808
	if (error = DeleteFile(way)) del_error = error;
895
}
809
}
896
 
810
 
897
 
811
 
898
void Del_File(byte dodel)
812
void Del_File(byte dodel)
899
{   
813
{   
900
	byte del_from[4096];
814
	byte del_from[4096];
901
	dword selected_offset2;
815
	dword selected_offset2;
902
	int tst, count, i;
816
	int tst, count, i;
903
	
817
	
904
	if (dodel==true)
818
	if (dodel==true)
905
	{
819
	{
906
		del_active=2;
820
		del_active=2;
907
		if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
821
		if (itdir) ShowMessage(WAIT_DELETING_FOLDER, 0);
908
		del_error = 0;
822
		del_error = 0;
909
		
823
		
910
		if (selected_count)
824
		if (selected_count)
911
		{
825
		{
912
   		   for (i=0; i
826
   		   for (i=0; i
913
           {
827
           {
914
                selected_offset2 = file_mas[i]*304 + buf+32 + 7;
828
                selected_offset2 = file_mas[i]*304 + buf+32 + 7;
915
                if (ESBYTE[selected_offset2]) {
829
                if (ESBYTE[selected_offset2]) {
916
					sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
830
					sprintf(#del_from,"%s%s",#path,file_mas[i]*304+buf+72);
917
                    Del_File2(#del_from);
831
                    Del_File2(#del_from);
918
                }
832
                }
919
            }
833
            }
920
		}
834
		}
921
		else
835
		else
922
		{
836
		{
923
		   Del_File2(#file_path);			
837
		   Del_File2(#file_path);			
924
		}
838
		}
925
		if (del_error) Write_Error(del_error);
839
		if (del_error) Write_Error(del_error);
926
 	}
840
 	}
927
	del_active=0;
841
	del_active=0;
928
	DeleteButton(301);
842
	DeleteButton(301);
929
	DeleteButton(302);
843
	DeleteButton(302);
930
	Open_Dir(#path,WITH_REDRAW);
844
	Open_Dir(#path,WITH_REDRAW);
931
}
845
}
932
 
846
 
933
 
847
 
934
void SelectFileByName(dword that_file)
848
void SelectFileByName(dword that_file)
935
{
849
{
936
	int ind;
850
	int ind;
937
	files.KeyHome();
851
	files.KeyHome();
938
   	Open_Dir(#path,ONLY_OPEN);
852
   	Open_Dir(#path,ONLY_OPEN);
939
	if (!real_files_names_case) strttl(that_file);
853
	if (!real_files_names_case) strttl(that_file);
940
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
854
	for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; }
941
	files.current = ind - 1;
855
	files.current = ind - 1;
942
	files.KeyDown();
856
	files.KeyDown();
943
	List_ReDraw();
857
	List_ReDraw();
944
}
858
}
945
 
859
 
946
 
860
 
947
void Dir_Up()
861
void Dir_Up()
948
{
862
{
949
	char cur_folder[4096];
863
	char cur_folder[4096];
950
	i=strlen(#path)-1;
864
	i=strlen(#path)-1;
951
	if (i==0) return;
865
	if (i==0) return;
952
	path[i]=0x00;
866
	path[i]=0x00;
953
	i = strrchr(#path, '/');
867
	i = strrchr(#path, '/');
954
	strcpy(#cur_folder, #path+i);
868
	strcpy(#cur_folder, #path+i);
955
	path[i]=0x00;
869
	path[i]=0x00;
956
	SelectFileByName(#cur_folder);
870
	SelectFileByName(#cur_folder);
957
}
871
}
958
 
872
 
959
void Open(byte rez)
873
void Open(byte rez)
960
{
874
{
961
	byte temp[4096];
875
	byte temp[4096];
962
	selected_count = 0;
876
	selected_count = 0;
963
	if (rez)
877
	if (rez)
964
	{
878
	{
965
		if (!strncmp(#file_name,"..",3)) return;
879
		if (!strncmp(#file_name,"..",3)) return;
966
		strcpy(#temp, #file_path);
880
		strcpy(#temp, #file_path);
967
		if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end
881
		if (path[strlen(#temp)-1]!='/') chrcat(#temp, '/'); //need "/" in the end
968
		RunProgram("/sys/File Managers/Eolite", #temp);
882
		RunProgram("/sys/File Managers/Eolite", #temp);
969
		return;
883
		return;
970
	}
884
	}
971
	if (!files.count) return;
885
	if (!files.count) return;
972
	if (!itdir)
886
	if (!itdir)
973
	{
887
	{
974
		if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
888
		if (strrchr(#file_name, '.')==0) RunProgram(#file_path, ""); else RunProgram("/sys/@open", #file_path);
975
	} 
889
	} 
976
	else
890
	else
977
	{
891
	{
978
		if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
892
		if (!strncmp(#file_name,"..",3)) { Dir_Up(); return; }
979
		strcpy(#path, #file_path);
893
		strcpy(#path, #file_path);
980
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
894
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
981
		files.first=files.current=0;
895
		files.first=files.current=0;
982
		Open_Dir(#path,WITH_REDRAW);
896
		Open_Dir(#path,WITH_REDRAW);
983
	}
897
	}
984
}
898
}
985
 
899
 
986
 
900
 
987
inline fastcall void GoBack()
901
inline fastcall void GoBack()
988
{
902
{
989
	char cur_folder[4096];
903
	char cur_folder[4096];
990
	strcpy(#cur_folder, GetCurrentFolder());
904
	strcpy(#cur_folder, GetCurrentFolder());
991
	if (HistoryPath(GO_BACK)) SelectFileByName(#cur_folder);
905
	if (HistoryPath(GO_BACK)) SelectFileByName(#cur_folder);
992
}
906
}
993
 
907
 
994
void ShowOpenWithDialog()
908
void ShowOpenWithDialog()
995
{
909
{
996
	byte param[4097];
910
	byte param[4097];
997
	sprintf(#param,"~%s",#file_path);
911
	sprintf(#param,"~%s",#file_path);
998
	RunProgram("/sys/@open", #param);
912
	RunProgram("/sys/@open", #param);
999
}
913
}
1000
 
914
 
1001
void NewElement(byte newf)
915
void NewElement(byte newf)
1002
{
916
{
1003
	BDVK element_info;
917
	BDVK element_info;
1004
	byte del_rezult, copy_rezult, info_result;
918
	byte del_rezult, copy_rezult, info_result;
1005
	if (newf)
919
	if (newf)
1006
	{
920
	{
1007
		sprintf(#temp,"%s%s",#path,new_file_ed.text);
921
		sprintf(#temp,"%s%s",#path,new_file_ed.text);
1008
		info_result = GetFileInfo(#temp, #element_info);
922
		info_result = GetFileInfo(#temp, #element_info);
1009
		switch(new_element_active)
923
		switch(new_element_active)
1010
		{
924
		{
1011
			case CREATE_FILE:
925
			case CREATE_FILE:
1012
				if (info_result==5)
926
				if (info_result==5)
1013
				{
927
				{
1014
					WriteFile(0, 0, #temp);
928
					WriteFile(0, 0, #temp);
1015
					if (EAX)
929
					if (EAX)
1016
					{
930
					{
1017
						Write_Error(EAX);
931
						Write_Error(EAX);
1018
						ShowMessage(NOT_CREATE_FILE, 150);
932
						ShowMessage(NOT_CREATE_FILE, 150);
1019
					}
933
					}
1020
				}
934
				}
1021
				else
935
				else
1022
				{
936
				{
1023
					notify(FS_ITEM_ALREADY_EXISTS);
937
					notify(FS_ITEM_ALREADY_EXISTS);
1024
				}
938
				}
1025
				break;
939
				break;
1026
			case CREATE_FOLDER:
940
			case CREATE_FOLDER:
1027
				if (info_result==5)
941
				if (info_result==5)
1028
				{
942
				{
1029
					CreateDir(#temp);
943
					CreateDir(#temp);
1030
					if (EAX)
944
					if (EAX)
1031
					{
945
					{
1032
						Write_Error(EAX);
946
						Write_Error(EAX);
1033
						ShowMessage(NOT_CREATE_FOLDER, 150);
947
						ShowMessage(NOT_CREATE_FOLDER, 150);
1034
					}
948
					}
1035
				}
949
				}
1036
				else
950
				else
1037
				{
951
				{
1038
					notify(FS_ITEM_ALREADY_EXISTS);
952
					notify(FS_ITEM_ALREADY_EXISTS);
1039
				}
953
				}
1040
				break;
954
				break;
1041
			case RENAME_ITEM:
955
			case RENAME_ITEM:
1042
				if (info_result==5)
956
				if (info_result==5)
1043
				{
957
				{
1044
					if (itdir)
958
					if (itdir)
1045
					{
959
					{
1046
						if (del_rezult = DeleteFile(#file_path))
960
						if (del_rezult = DeleteFile(#file_path))
1047
						{
961
						{
1048
							Write_Error(del_rezult);
962
							Write_Error(del_rezult);
1049
							ShowMessage(T_DEL_ERROR_1, 150);
963
							ShowMessage(T_DEL_ERROR_1, 150);
1050
							return;
964
							return;
1051
						}
965
						}
1052
						if (CreateDir(#temp)) CreateDir(#file_path);
966
						if (CreateDir(#temp)) CreateDir(#file_path);
1053
						Open_Dir(#path,WITH_REDRAW);
967
						Open_Dir(#path,WITH_REDRAW);
1054
						SelectFileByName(new_file_ed.text);
968
						SelectFileByName(new_file_ed.text);
1055
					}
969
					}
1056
					else
970
					else
1057
					{
971
					{
1058
						if (copy_rezult = CopyFile(#file_path,#temp))
972
						if (copy_rezult = CopyFile(#file_path,#temp))
1059
						{
973
						{
1060
							Write_Error(copy_rezult);
974
							Write_Error(copy_rezult);
1061
						}
975
						}
1062
						else
976
						else
1063
						{
977
						{
1064
							Del_File(true);
978
							Del_File(true);
1065
							SelectFileByName(new_file_ed.text);
979
							SelectFileByName(new_file_ed.text);
1066
						}
980
						}
1067
					}
981
					}
1068
				}
982
				}
1069
				else
983
				else
1070
				{
984
				{
1071
					notify(FS_ITEM_ALREADY_EXISTS);
985
					notify(FS_ITEM_ALREADY_EXISTS);
1072
				}
986
				}
1073
		}
987
		}
1074
		new_element_active = 0;
988
		new_element_active = 0;
1075
		Open_Dir(#path,WITH_REDRAW);
989
		Open_Dir(#path,WITH_REDRAW);
1076
		SelectFileByName(new_file_ed.text);
990
		SelectFileByName(new_file_ed.text);
1077
	}
991
	}
1078
	new_element_active = 0;
992
	new_element_active = 0;
1079
	Open_Dir(#path,WITH_REDRAW);
993
	Open_Dir(#path,WITH_REDRAW);
1080
}
994
}
1081
 
995
 
1082
void NewElement_Form(byte crt, dword strng)
996
void NewElement_Form(byte crt, dword strng)
1083
{
997
{
1084
	int dform_x=files.w-220/2+files.x;
998
	int dform_x=files.w-220/2+files.x;
1085
	if (!new_element_active)
999
	if (!new_element_active)
1086
	{
1000
	{
1087
		new_element_active = crt;
1001
		new_element_active = crt;
1088
		strcpy(#new_element_name, strng);
1002
		strcpy(#new_element_name, strng);
1089
		new_file_ed.size = new_file_ed.pos = strlen(strng);
1003
		new_file_ed.size = new_file_ed.pos = strlen(strng);
1090
	}
1004
	}
1091
	DrawPopup(dform_x,160,220,85,1,system.color.work,system.color.work_graph);
1005
	DrawPopup(dform_x,160,220,85,1,system.color.work,system.color.work_graph);
1092
	new_file_ed.left = dform_x+24;
1006
	new_file_ed.left = dform_x+24;
1093
	edit_box_draw  stdcall (#new_file_ed);
1007
	edit_box_draw  stdcall (#new_file_ed);
1094
	DrawRectangle(new_file_ed.left-1, new_file_ed.top-1, new_file_ed.width+2, 16, 0xFFFfff);
1008
	DrawRectangle(new_file_ed.left-1, new_file_ed.top-1, new_file_ed.width+2, 16, 0xFFFfff);
1095
	DrawRectangle(new_file_ed.left-2, new_file_ed.top-2, new_file_ed.width+4, 18, system.color.work_graph);
1009
	DrawRectangle(new_file_ed.left-2, new_file_ed.top-2, new_file_ed.width+4, 18, system.color.work_graph);
1096
	if (new_element_active==3) DrawFlatButton(dform_x+22,208,85,22,301,0xFFB6B5,T_RENAME);
1010
	if (new_element_active==3) DrawFlatButton(dform_x+22,208,85,22,301,0xFFB6B5,T_RENAME);
1097
	else DrawFlatButton(dform_x+27,208,70,22,301,0xFFB6B5,T_CREATE);
1011
	else DrawFlatButton(dform_x+27,208,70,22,301,0xFFB6B5,T_CREATE);
1098
	DrawFlatButton(dform_x+120,208,70,22,302,0xC6DFC6,T_CANCEL);
1012
	DrawFlatButton(dform_x+120,208,70,22,302,0xC6DFC6,T_CANCEL);
1099
}
1013
}
1100
 
1014
 
1101
void FnProcess(byte N)
1015
void FnProcess(byte N)
1102
{
1016
{
1103
	switch(N)
1017
	switch(N)
1104
	{
1018
	{
1105
		case 1:
1019
		case 1:
1106
			if (!active_about) 
1020
			if (!active_about) 
1107
			{
1021
			{
1108
				//SwitchToAnotherThread();
-
 
1109
				about_stak = malloc(4096);
1022
				about_stak = malloc(4096);
1110
				about_window = CreateThread(#about_dialog,about_stak+4092);
1023
				about_window = CreateThread(#about_dialog,about_stak+4092);
1111
				break;
1024
				break;
1112
			}
1025
			}
1113
			else
1026
			else
1114
			{
1027
			{
1115
				ActivateWindow(GetProcessSlot(about_window));
1028
				ActivateWindow(GetProcessSlot(about_window));
1116
			}
1029
			}
1117
			break;
1030
			break;
1118
		case 2:
1031
		case 2:
1119
			if (!files.count) break;
1032
			if (!files.count) break;
1120
			NewElement_Form(RENAME_ITEM, #file_name);
1033
			NewElement_Form(RENAME_ITEM, #file_name);
1121
			break;
1034
			break;
1122
		case 3:
1035
		case 3:
1123
			if (!itdir) RunProgram("/sys/tinypad", #file_path);
1036
			if (!itdir) RunProgram("/sys/tinypad", #file_path);
1124
			break;
1037
			break;
1125
		case 4:
1038
		case 4:
1126
			if (!itdir) RunProgram("/sys/develop/heed", #file_path);
1039
			if (!itdir) RunProgram("/sys/develop/heed", #file_path);
1127
			break;
1040
			break;
1128
		case 5: //refresh cur dir & devs
1041
		case 5: //refresh cur dir & devs
1129
			Tip(56, T_DEVICES, 55, "-");
1042
			Tip(56, T_DEVICES, 55, "-");
1130
			Open_Dir(#path,WITH_REDRAW);
1043
			Open_Dir(#path,WITH_REDRAW);
1131
			pause(10);
1044
			pause(10);
1132
			LoadIniSettings();
1045
			LoadIniSettings();
1133
			GetSystemDiscs();
1046
			GetSystemDiscs();
1134
			Open_Dir(#path,WITH_REDRAW);
1047
			Open_Dir(#path,WITH_REDRAW);
1135
			DrawLeftPanel();
1048
			DrawLeftPanel();
1136
			break;
1049
			break;
1137
		case 6:
1050
		case 6:
1138
			NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER);
1051
			NewElement_Form(CREATE_FOLDER, T_NEW_FOLDER);
1139
			break;
1052
			break;
1140
		case 7:
1053
		case 7:
1141
			NewElement_Form(CREATE_FILE, T_NEW_FILE);
1054
			NewElement_Form(CREATE_FILE, T_NEW_FILE);
1142
			break;
1055
			break;
1143
		case 8:
1056
		case 8:
1144
			//SwitchToAnotherThread();
-
 
1145
			properties_stak = malloc(8096);
1057
			properties_stak = malloc(8096);
1146
			CreateThread(#properties_dialog, properties_stak+8092);
1058
			CreateThread(#properties_dialog, properties_stak+8092);
1147
			break;
1059
			break;
1148
		case 10: //F10
1060
		case 10: //F10
1149
			if (!active_settings) 
1061
			if (!active_settings) 
1150
			{
1062
			{
1151
				//SwitchToAnotherThread();
-
 
1152
				settings_stak = malloc(4096);
1063
				settings_stak = malloc(4096);
1153
				settings_window = CreateThread(#settings_dialog, settings_stak+4092);
1064
				settings_window = CreateThread(#settings_dialog, settings_stak+4092);
1154
				break;
1065
				break;
1155
			}
1066
			}
1156
			else
1067
			else
1157
			{
1068
			{
1158
				ActivateWindow(GetProcessSlot(settings_window));
1069
				ActivateWindow(GetProcessSlot(settings_window));
1159
			}
1070
			}
1160
			break;
1071
			break;
1161
	}
1072
	}
1162
}
1073
}
1163
 
1074
 
1164
//need to remove these functiones, they are a very old shit :)
1075
//need to remove these functiones, they are a very old shit :)
1165
dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;}
1076
dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;}
1166
 
1077
 
1167
 
1078
 
1168
stop:
1079
stop:
1169
>
1080
>
1170
>
1081
>
1171
>
1082
>
1172
>
1083
>
1173
>
1084
>
1174
>
1085
>
1175
>
-