Subversion Repositories Kolibri OS

Rev

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

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