Subversion Repositories Kolibri OS

Rev

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

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