Subversion Repositories Kolibri OS

Rev

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

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