Subversion Repositories Kolibri OS

Rev

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

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