Subversion Repositories Kolibri OS

Rev

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

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