Subversion Repositories Kolibri OS

Rev

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

Rev 3980 Rev 3991
1
//Leency & Veliant 2008-2013
1
//Leency & Veliant 2008-2013
2
//GNU GPL licence.
2
//GNU GPL licence.
3
 
3
 
4
//libraries
4
//libraries
5
#define MEMSIZE 0xA0000
5
#define MEMSIZE 0xA0000
6
#include "..\lib\kolibri.h"
6
#include "..\lib\kolibri.h"
7
#include "..\lib\strings.h"
7
#include "..\lib\strings.h"
8
#include "..\lib\mem.h"
8
#include "..\lib\mem.h"
9
#include "..\lib\dll.h"
9
#include "..\lib\dll.h"
10
#include "..\lib\lib.obj\box_lib.h"
10
#include "..\lib\lib.obj\box_lib.h"
11
#include "..\lib\file_system.h"
11
#include "..\lib\file_system.h"
12
#include "..\lib\figures.h"
12
#include "..\lib\figures.h"
13
#include "..\lib\encoding.h"
13
#include "..\lib\encoding.h"
14
#include "..\lib\list_box.h"
14
#include "..\lib\list_box.h"
15
#include "..\lib\copyf.h"
15
#include "..\lib\copyf.h"
16
//images
16
//images
17
#include "imgs\toolbar.txt"
17
#include "imgs\toolbar.txt"
18
#include "imgs\left_p.txt"
18
#include "imgs\left_p.txt"
19
 
19
 
20
#ifndef AUTOBUILD
20
#ifndef AUTOBUILD
21
#include "lang.h--"
21
#include "lang.h--"
22
#endif
22
#endif
23
 
23
 
24
#ifdef LANG_RUS
24
#ifdef LANG_RUS
25
	?define T_FILE "” ©«"
25
	?define T_FILE "” ©«"
26
	?define T_TYPE "’¨¯"
26
	?define T_TYPE "’¨¯"
27
	?define T_SIZE " §¬¥à"
27
	?define T_SIZE " §¬¥à"
28
	?define T_NEW_FOLDER "®¢ ï ¯ ¯ª "
28
	?define T_NEW_FOLDER "®¢ ï ¯ ¯ª "
29
	?define T_NEW_FILE "®¢ë© ä ©«"
29
	?define T_NEW_FILE "®¢ë© ä ©«"
30
	?define T_DELETE_FILE "‚ë ¤¥©á⢨⥫쭮 å®â¨â¥ 㤠«¨âì"
30
	?define T_DELETE_FILE "‚ë ¤¥©á⢨⥫쭮 å®â¨â¥ 㤠«¨âì"
31
	?define T_YES "„ "
31
	?define T_YES "„ "
32
	?define T_NO "¥â"
32
	?define T_NO "¥â"
33
	?define T_DEL_ERROR_1 "Žè¨¡ª .  ¯ª  ­¥ ¯ãáâ ï."
33
	?define T_DEL_ERROR_1 "Žè¨¡ª .  ¯ª  ­¥ ¯ãáâ ï."
34
	?define T_DEL_ERROR_2 "Žè¨¡ª . ” ©«®¢ ï á¨á⥬  ⮫쪮 ¤«ï ç⥭¨ï."
34
	?define T_DEL_ERROR_2 "Žè¨¡ª . ” ©«®¢ ï á¨á⥬  ⮫쪮 ¤«ï ç⥭¨ï."
35
	?define NOT_CREATE_FOLDER "¥ 㤠«®áì ᮧ¤ âì ¯ ¯ªã."
35
	?define NOT_CREATE_FOLDER "¥ 㤠«®áì ᮧ¤ âì ¯ ¯ªã."
36
	?define NOT_CREATE_FILE "¥ 㤠«®áì ᮧ¤ âì ä ©«."
36
	?define NOT_CREATE_FILE "¥ 㤠«®áì ᮧ¤ âì ä ©«."
37
	?define ERROR_1 "Žè¨¡ª  ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ /rd/1/lib/box_lib.obj"
37
	?define ERROR_1 "Žè¨¡ª  ¯à¨ § £à㧪¥ ¡¨¡«¨®â¥ª¨ /rd/1/lib/box_lib.obj"
38
	?define T_PASTE_WINDOW "Š®¯¨àãî..."
38
	?define T_PASTE_WINDOW "Š®¯¨àãî..."
39
	?define T_PASTE_WINDOW_TEXT "Š®¯¨àã¥âáï ä ©«:"
39
	?define T_PASTE_WINDOW_TEXT "Š®¯¨àã¥âáï ä ©«:"
40
#elif LANG_EST
40
#elif LANG_EST
41
	?define T_FILE "Fail"
41
	?define T_FILE "Fail"
42
	?define T_TYPE "Tüüp"
42
	?define T_TYPE "Tüüp"
43
	?define T_SIZE "Suurus"
43
	?define T_SIZE "Suurus"
44
	?define T_NEW_FOLDER "Uus kataloog"
44
	?define T_NEW_FOLDER "Uus kataloog"
45
	?define T_NEW_FILE "Uus fail"
45
	?define T_NEW_FILE "Uus fail"
46
	?define T_DELETE_FILE "Kas sa tahad tõesti kustutada"
46
	?define T_DELETE_FILE "Kas sa tahad tõesti kustutada"
47
	?define T_YES "Jah"
47
	?define T_YES "Jah"
48
	?define T_NO "Ei"
48
	?define T_NO "Ei"
49
	?define T_DEL_ERROR_1 "Viga. Kataloog ei ole tühi."
49
	?define T_DEL_ERROR_1 "Viga. Kataloog ei ole tühi."
50
	?define T_DEL_ERROR_2 "Viga. Failisüsteem ainult loetav."
50
	?define T_DEL_ERROR_2 "Viga. Failisüsteem ainult loetav."
51
	?define NOT_CREATE_FOLDER "Kataloogi ei saa luua."
51
	?define NOT_CREATE_FOLDER "Kataloogi ei saa luua."
52
	?define NOT_CREATE_FILE "Faili ei saa luua."
52
	?define NOT_CREATE_FILE "Faili ei saa luua."
53
	?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj"
53
	?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj"
54
	?define T_PASTE_WINDOW "Kopeerin..."
54
	?define T_PASTE_WINDOW "Kopeerin..."
55
	?define T_PASTE_WINDOW_TEXT "Kopeerin faili:"
55
	?define T_PASTE_WINDOW_TEXT "Kopeerin faili:"
56
#else
56
#else
57
	?define T_FILE "File"
57
	?define T_FILE "File"
58
	?define T_TYPE "Type"
58
	?define T_TYPE "Type"
59
	?define T_SIZE "Size"
59
	?define T_SIZE "Size"
60
	?define T_NEW_FOLDER "New folder"
60
	?define T_NEW_FOLDER "New folder"
61
	?define T_NEW_FILE "New file"
61
	?define T_NEW_FILE "New file"
62
	?define T_DELETE_FILE "Do you really want to delete"
62
	?define T_DELETE_FILE "Do you really want to delete"
63
	?define T_YES "Yes"
63
	?define T_YES "Yes"
64
	?define T_NO "No"
64
	?define T_NO "No"
65
	?define T_DEL_ERROR_1 "Error. Folder isn't empty."
65
	?define T_DEL_ERROR_1 "Error. Folder isn't empty."
66
	?define T_DEL_ERROR_2 "Error. Filesystem read-only."
66
	?define T_DEL_ERROR_2 "Error. Filesystem read-only."
67
	?define NOT_CREATE_FOLDER "Folder can not be created."
67
	?define NOT_CREATE_FOLDER "Folder can not be created."
68
	?define NOT_CREATE_FILE "File can not be created."
68
	?define NOT_CREATE_FILE "File can not be created."
69
	?define ERROR_1 "Error while loading library /rd/1/lib/box_lib.obj"
69
	?define ERROR_1 "Error while loading library /rd/1/lib/box_lib.obj"
70
	?define T_PASTE_WINDOW "Copying..."
70
	?define T_PASTE_WINDOW "Copying..."
71
	?define T_PASTE_WINDOW_TEXT "Copying file:"
71
	?define T_PASTE_WINDOW_TEXT "Copying file:"
72
#endif
72
#endif
73
 
73
 
74
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
74
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
75
 
75
 
76
#define TITLE "Eolite File Manager v1.97"
76
#define TITLE "Eolite File Manager v1.97.2"
77
#define ABOUT_TITLE "Eolite v1.97"
77
#define ABOUT_TITLE "Eolite v1.97.2"
78
dword col_work    = 0xE4DFE1;
78
dword col_work    = 0xE4DFE1;
79
dword col_border  = 0x9098B0; //A0A0B8; //0x819FC5;
79
dword col_border  = 0x9098B0; //A0A0B8; //0x819FC5;
80
dword col_padding = 0xC8C9C9;
80
dword col_padding = 0xC8C9C9;
81
dword col_selec   = 0x94AECE;
81
dword col_selec   = 0x94AECE;
82
dword col_lpanel  = 0x00699C;
82
dword col_lpanel  = 0x00699C;
83
 
83
 
84
int toolbar_buttons_x[7]={9,46,85,134,167,203};
84
int toolbar_buttons_x[7]={9,46,85,134,167,203};
85
char tmp_disk_del_param[3]="d0";
85
char tmp_disk_del_param[3]="d0";
86
struct path_string { char Item[4096]; };
86
struct path_string { char Item[4096]; };
87
 
87
 
88
llist files;
88
llist files;
89
 
89
 
90
byte
90
byte
91
	path[4096],
91
	path[4096],
92
	file_path[4096],
92
	file_path[4096],
93
	file_name[256],
93
	file_name[256],
94
	temp[4096];	 
94
	temp[4096];	 
95
byte
95
byte
96
	rename_active=0,
96
	rename_active=0,
97
	del_active=0,
97
	del_active=0,
98
	show_dev_name=1,
98
	show_dev_name=1,
99
	sort_num=2,
99
	sort_num=2,
100
	itdir;
100
	itdir;
101
 
101
 
102
proc_info Form;
102
proc_info Form;
103
mouse m;
103
mouse m;
104
int mouse_dd, scroll_used, scroll_size;
104
int mouse_dd, scroll_used, scroll_size;
105
dword buf, off;
105
dword buf, off;
106
dword file_mas[6898];
106
dword file_mas[6898];
107
int j, i;
107
int j, i;
108
 
108
 
109
edit_box edit2= {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6};
109
edit_box edit2= {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6};
110
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
110
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
111
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
111
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
112
 
112
 
113
#include "include\copypaste.h"
113
#include "include\copypaste.h"
114
#include "include\some_code.h"
114
#include "include\some_code.h"
115
#include "include\sorting.h"
115
#include "include\sorting.h"
116
#include "include\icons_f.h"
116
#include "include\icons_f.h"
117
#include "include\ini.h"
117
#include "include\ini.h"
118
#include "include\left_panel.h"
118
#include "include\left_panel.h"
119
#include "include\history.h"
119
#include "include\history.h"
120
#include "include\file_menu.h"
120
#include "include\file_menu.h"
121
#include "include\about_dialog.h"
121
#include "include\about_dialog.h"
122
 
122
 
123
void main() 
123
void main() 
124
{
124
{
125
	word key, id, can_show, can_select, m_selected;
125
	word key, id, can_show, can_select, m_selected;
126
 
126
 
127
	files.line_h=18;
127
	files.line_h=18;
128
	mem_Init();
128
	mem_Init();
129
	if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1);
129
	if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1);
130
	SystemDiscsGet();
130
	SystemDiscsGet();
131
	GetIni(1);	
131
	GetIni(1);	
132
	if (param)
132
	if (param)
133
	{
133
	{
134
		strcpy(#path, #param);
134
		strcpy(#path, #param);
135
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string
135
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string
136
	}
136
	}
137
	else
137
	else
138
	{
138
	{
139
		strcpy(#path, "/rd/1/");		
139
		strcpy(#path, "/rd/1/");		
140
	}
140
	}
141
	Open_Dir(#path,ONLY_OPEN);
141
	Open_Dir(#path,ONLY_OPEN);
142
	SetEventMask(0x27);
142
	SetEventMask(0x27);
143
	loop() switch(WaitEvent())
143
	loop() switch(WaitEvent())
144
	{
144
	{
145
		case evMouse:
145
		case evMouse:
146
			IF (del_active) break;		
146
			IF (del_active) break;		
147
			id=GetProcessSlot(Form.ID); 
147
			id=GetProcessSlot(Form.ID); 
148
			IF (id!=GetActiveProcess()) || (Form.status_window>2) break;
148
			IF (id!=GetActiveProcess()) || (Form.status_window>2) break;
149
			IF (rename_active) { edit_box_mouse stdcall(#edit2); break; }
149
			IF (rename_active) { edit_box_mouse stdcall(#edit2); break; }
150
			
150
			
151
			m.get();
151
			m.get();
152
 
152
 
153
			if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h) && (!can_select)
153
			if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h) && (!can_select)
154
			{
154
			{
155
				m_selected = m.y - 57 / files.line_h;
155
				m_selected = m.y - 57 / files.line_h;
156
				if (m.lkm) can_select = 1;
156
				if (m.lkm) can_select = 1;
157
				if (m.pkm)
157
				if (m.pkm)
158
				{
158
				{
159
					can_show = 1;
159
					can_show = 1;
160
					if (m.y - 57 / files.line_h != files.current) can_select = 1;
160
					if (m.y - 57 / files.line_h != files.current) can_select = 1;
161
				}
161
				}
162
			}
162
			}
163
 
163
 
164
			//select/open file {
164
			//select/open file {
165
			if (!m.lkm) && (!m.pkm) && (can_select)
165
			if (!m.lkm) && (!m.pkm) && (can_select)
166
			{
166
			{
167
				can_select = 0;
167
				can_select = 0;
168
				if (m.y>=57)
168
				if (m.y>=57)
169
				{
169
				{
170
					id = m.y - 57 / files.line_h;
170
					id = m.y - 57 / files.line_h;
171
					if (id!=m_selected)
171
					if (id!=m_selected)
172
					{
172
					{
173
						can_show=0;
173
						can_show=0;
174
						break;
174
						break;
175
					}
175
					}
176
					if (files.current!=id)
176
					if (files.current!=id)
177
					{
177
					{
178
						if (id
178
						if (id
179
					}
179
					}
180
					else
180
					else
181
						Open();
181
						Open();
182
				}
182
				}
183
			};
183
			};
184
			// } select/open file
184
			// } select/open file
185
 
185
 
186
			//file menu {
186
			//file menu {
187
			if (!m.pkm) && (!m.lkm) && (can_show)
187
			if (!m.pkm) && (!m.lkm) && (can_show)
188
			{
188
			{
189
				can_show = 0;
189
				can_show = 0;
190
				if (m.y>=57)
190
				if (m.y>=57)
191
				{
191
				{
192
					SwitchToAnotherThread();
192
					SwitchToAnotherThread();
193
					CreateThread(#FileMenu,#menu_stak);
193
					CreateThread(#FileMenu,#menu_stak);
194
				}
194
				}
195
				break;
195
				break;
196
			}
196
			}
197
			// } file menu
197
			// } file menu
198
 
198
 
199
			if (m.vert)
199
			if (m.vert)
200
			{
200
			{
201
				files.MouseScroll(m.vert);
201
				files.MouseScroll(m.vert);
202
				List_ReDraw();
202
				List_ReDraw();
203
				break;
203
				break;
204
			}
204
			}
205
 
205
 
206
			if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<57)
206
			if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<57)
207
			{
207
			{
208
				IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),41,14,14,0xC7C7C7,0xFFFFFF);
208
				IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),41,14,14,0xC7C7C7,0xFFFFFF);
209
				WHILE (m.lkm==1) && (files.first>0)
209
				WHILE (m.lkm==1) && (files.first>0)
210
				{
210
				{
211
					pause(8);
211
					pause(8);
212
					files.first--;
212
					files.first--;
213
					List_ReDraw();
213
					List_ReDraw();
214
					m.get();
214
					m.get();
215
				}
215
				}
216
				DrawRectangle3D(onLeft(26,0),41,14,14,0xFFFFFF,0xC7C7C7);
216
				DrawRectangle3D(onLeft(26,0),41,14,14,0xFFFFFF,0xC7C7C7);
217
			}
217
			}
218
 
218
 
219
			if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y
219
			if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>onTop(22,0)+1) && (m.y
220
			{
220
			{
221
				IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),onTop(21,0),14,14,0xC7C7C7,0xFFFFFF);
221
				IF (m.lkm==1) DrawRectangle3D(onLeft(26,0),onTop(21,0),14,14,0xC7C7C7,0xFFFFFF);
222
				while (m.lkm==1) && (files.first
222
				while (m.lkm==1) && (files.first
223
				{
223
				{
224
					pause(8);
224
					pause(8);
225
					files.first++;
225
					files.first++;
226
					List_ReDraw();
226
					List_ReDraw();
227
					m.get();
227
					m.get();
228
				}
228
				}
229
				DrawRectangle3D(onLeft(26,0),onTop(21,0),14,14,0xFFFFFF,0xC7C7C7);
229
				DrawRectangle3D(onLeft(26,0),onTop(21,0),14,14,0xFFFFFF,0xC7C7C7);
230
			}
230
			}
231
 
231
 
232
			//Scrooll
232
			//Scrooll
233
			if (!m.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); }
233
			if (!m.lkm) && (scroll_used) { scroll_used=NULL; Scroll(); }
234
			if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y
234
			if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>56) && (m.y
235
			
235
			
236
			if (scroll_used)
236
			if (scroll_used)
237
			{
237
			{
238
				IF (scroll_size/2+57>m.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+57; //anee eo?ni? iaa ieiii
238
				IF (scroll_size/2+57>m.y) || (m.y<0) || (m.y>4000) m.y=scroll_size/2+57; //anee eo?ni? iaa ieiii
239
				id=files.first;
239
				id=files.first;
240
				j= scroll_size/2;
240
				j= scroll_size/2;
241
				files.first = m.y -j -57 * files.count;
241
				files.first = m.y -j -57 * files.count;
242
				files.first /= onTop(22,57);
242
				files.first /= onTop(22,57);
243
				IF (files.visible+files.first>files.count) files.first=files.count-files.visible;
243
				IF (files.visible+files.first>files.count) files.first=files.count-files.visible;
244
				IF (id!=files.first) List_ReDraw();
244
				IF (id!=files.first) List_ReDraw();
245
			}
245
			}
246
			break;  
246
			break;  
247
//Button pressed-----------------------------------------------------------------------------
247
//Button pressed-----------------------------------------------------------------------------
248
		case evButton:
248
		case evButton:
249
			id=GetButtonID();
249
			id=GetButtonID();
250
			if (id==1) ExitProcess();
250
			if (id==1) ExitProcess();
251
			if (rename_active) break;
251
			if (rename_active) break;
252
			if (del_active)
252
			if (del_active)
253
			{
253
			{
254
				IF (id==301) || (id==302) Del_File(302-id);
254
				IF (id==301) || (id==302) Del_File(302-id);
255
				break;
255
				break;
256
			}
256
			}
257
			
257
			
258
			switch(id) 
258
			switch(id) 
259
			{
259
			{
260
				case 21: //Back
260
				case 21: //Back
261
						GoBack();
261
						GoBack();
262
						break;
262
						break;
263
				case 22: //Forward
263
				case 22: //Forward
264
						if (HistoryPath(GO_FORWARD))
264
						if (HistoryPath(GO_FORWARD))
265
						{
265
						{
266
							files.first=files.current=NULL; //aaa?o nienea
266
							files.first=files.current=NULL; //aaa?o nienea
267
							Open_Dir(#path,WITH_REDRAW);
267
							Open_Dir(#path,WITH_REDRAW);
268
						}
268
						}
269
						break;
269
						break;
270
				case 23: //up!
270
				case 23: //up!
271
						Dir_Up();
271
						Dir_Up();
272
						break;
272
						break;
273
				case 24: //cut
273
				case 24: //cut
274
						Copy(#file_path, CUT);
274
						Copy(#file_path, CUT);
275
						break;
275
						break;
276
				case 25: //copy
276
				case 25: //copy
277
						Copy(#file_path, NOCUT);
277
						Copy(#file_path, NOCUT);
278
						break;
278
						break;
279
				case 26: //paste
279
				case 26: //paste
280
						CreateThread(#Paste,#copy_stak);
280
						CreateThread(#Paste,#copy_stak);
281
						break;
281
						break;
282
				case 31...33: //sort
282
				case 31...33: //sort
283
						IF(sort_num==1) DrawFilledBar(onLeft(192,168)/2+210,42,6,10);
283
						IF(sort_num==1) DrawFilledBar(onLeft(192,168)/2+210,42,6,10);
284
						IF(sort_num==2) DrawFilledBar(onLeft(115,0),42,6,10);
284
						IF(sort_num==2) DrawFilledBar(onLeft(115,0),42,6,10);
285
						IF(sort_num==3) DrawFilledBar(onLeft(44,0),42,6,10);
285
						IF(sort_num==3) DrawFilledBar(onLeft(44,0),42,6,10);
286
						sort_num=id-30;
286
						sort_num=id-30;
287
						Open_Dir(#path,WITH_REDRAW);
287
						Open_Dir(#path,WITH_REDRAW);
288
						break;
288
						break;
289
				case 50...60: //Actions
289
				case 50...60: //Actions
290
						FnProcess(id-50);
290
						FnProcess(id-50);
291
						break;
291
						break;
292
				case 100...120:
292
				case 100...120:
293
					DEVICE_MARK:
293
					DEVICE_MARK:
294
						DrawRectangle(17,id-100*16+74,159,16, 0); //auaaeaiea
294
						DrawRectangle(17,id-100*16+74,159,16, 0); //auaaeaiea
295
						strcpy(#path, #disk_list[id-100].Item);
295
						strcpy(#path, #disk_list[id-100].Item);
296
						files.first=files.current=0;
296
						files.first=files.current=0;
297
						Open_Dir(#path,WITH_REDRAW);
297
						Open_Dir(#path,WITH_REDRAW);
298
						pause(5);
298
						pause(5);
299
						DrawRectangle(17,id-100*16+74,159,16, 0xFFFFFF);
299
						DrawRectangle(17,id-100*16+74,159,16, 0xFFFFFF);
300
						break;
300
						break;
301
				case 130...160:
301
				case 130...160:
302
						tmp_disk_del_param[1]=disk_list[id-130].Item[4];
302
						tmp_disk_del_param[1]=disk_list[id-130].Item[4];
303
						RunProgram("/sys/tmpdisk", #tmp_disk_del_param);
303
						RunProgram("/sys/tmpdisk", #tmp_disk_del_param);
304
						pause(10);
304
						pause(10);
305
						SystemDiscsGet();
305
						SystemDiscsGet();
306
						Open_Dir(#path,WITH_REDRAW);
306
						Open_Dir(#path,WITH_REDRAW);
307
						DrawLeftPanel();
307
						DrawLeftPanel();
308
						break;
308
						break;
309
			}
309
			}
310
			break;
310
			break;
311
//Key pressed-----------------------------------------------------------------------------
311
//Key pressed-----------------------------------------------------------------------------
312
		case evKey:
312
		case evKey:
313
			key = GetKey();
313
			key = GetKey();
314
			if (Form.status_window>2) break;
314
			if (Form.status_window>2) break;
315
			IF (del_active)
315
			IF (del_active)
316
			{
316
			{
317
				IF (key==013) Del_File(true);
317
				IF (key==013) Del_File(true);
318
				IF (key==027) Del_File(false);
318
				IF (key==027) Del_File(false);
319
				break;
319
				break;
320
			}
320
			}
321
			IF (edit2.flags!=64) && (key!=13) && (key!=27)
321
			IF (edit2.flags!=64) && (key!=13) && (key!=27)
322
			{
322
			{
323
				EAX=key<<8;
323
				EAX=key<<8;
324
				edit_box_key stdcall (#edit2);
324
				edit_box_key stdcall (#edit2);
325
				break;
325
				break;
326
			}
326
			}
327
			switch (key)
327
			switch (key)
328
			{
328
			{
329
					case 209...217:
329
					case 209...217:
330
							id=key-110;
330
							id=key-110;
331
							IF (id-100>=disc_num) break;
331
							IF (id-100>=disc_num) break;
332
							GOTO DEVICE_MARK;
332
							GOTO DEVICE_MARK;
333
					case 008:
333
					case 008:
334
							//GoBack();
334
							//GoBack();
335
							Dir_Up();
335
							Dir_Up();
336
							break; 
336
							break; 
337
					case 004: //Ctrl+D set as bg
337
					case 004: //Ctrl+D set as bg
338
							strcpy(#temp, "\\S__");
338
							strcpy(#temp, "\\S__");
339
							strcat(#temp, #file_path);
339
							strcat(#temp, #file_path);
340
							RunProgram("/sys/media/kiv", #temp);
340
							RunProgram("/sys/media/kiv", #temp);
341
							break;
341
							break;
342
					case 014: //Ctrl+N new window
342
					case 014: //Ctrl+N new window
343
							IF (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD);
343
							IF (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD);
344
							RunProgram("/sys/File Managers/Eolite", #path);
344
							RunProgram("/sys/File Managers/Eolite", #path);
345
							break; 
345
							break; 
346
					case 024: //Ctrl+X
346
					case 024: //Ctrl+X
347
							Copy(#file_path, CUT);
347
							Copy(#file_path, CUT);
348
							break;
348
							break;
349
					case 003: //Ctrl+C
349
					case 003: //Ctrl+C
350
							Copy(#file_path, NOCUT);
350
							Copy(#file_path, NOCUT);
351
							break;
351
							break;
352
					case 022: //Ctrl+V
352
					case 022: //Ctrl+V
353
							CreateThread(#Paste,#copy_stak);
353
							CreateThread(#Paste,#copy_stak);
354
							break;
354
							break;
355
					case 027: //Esc
355
					case 027: //Esc
356
							IF (rename_active==1) ReName(false);
356
							IF (rename_active==1) ReName(false);
357
							break;
357
							break;
358
					case 013: //Enter
358
					case 013: //Enter
359
							IF (rename_active==1) {ReName(true); break;}
359
							IF (rename_active==1) {ReName(true); break;}
360
							Open();
360
							Open();
361
							break; 
361
							break; 
362
					case 178: //up
362
					case 178: //up
363
							List_Current(-1);
363
							List_Current(-1);
364
							break;
364
							break;
365
					case 177: //down
365
					case 177: //down
366
							List_Current(1);
366
							List_Current(1);
367
							break;
367
							break;
368
					case 180: //home
368
					case 180: //home
369
							files.first=0;
369
							files.first=0;
370
							files.current=0;
370
							files.current=0;
371
							List_ReDraw();
371
							List_ReDraw();
372
							break;
372
							break;
373
					case 181: //end
373
					case 181: //end
374
							files.first = files.count - files.visible;
374
							files.first = files.count - files.visible;
375
							files.current = files.visible - 1;
375
							files.current = files.visible - 1;
376
							List_ReDraw();
376
							List_ReDraw();
377
							break;
377
							break;
378
					case 183: //Page Down
378
					case 183: //Page Down
379
							List_Current(files.visible-1);
379
							List_Current(files.visible-1);
380
							break;
380
							break;
381
					case 184: //Page Up
381
					case 184: //Page Up
382
							List_Current(-files.visible+1);
382
							List_Current(-files.visible+1);
383
							break;
383
							break;
384
					case 182: //del
384
					case 182: //del
385
							Del_Form();
385
							Del_Form();
386
							break;
386
							break;
387
					case 050...059: //F1-F10
387
					case 050...059: //F1-F10
388
							FnProcess(key-49);
388
							FnProcess(key-49);
389
							break; 
389
							break; 
390
					default:    
390
					default:    
391
							for (i=files.current+files.first+1; i
391
							for (i=files.current+files.first+1; i
392
							{
392
							{
393
								strcpy(#temp, file_mas[i]*304+buf+72);
393
								strcpy(#temp, file_mas[i]*304+buf+72);
394
								IF (temp[0]==key) || (temp[0]==key-32)
394
								IF (temp[0]==key) || (temp[0]==key-32)
395
								{
395
								{
396
									List_Current(i-files.current-files.first);
396
									List_Current(i-files.current-files.first);
397
									break;
397
									break;
398
								}
398
								}
399
							}
399
							}
400
			}                         
400
			}                         
401
			break;
401
			break;
402
		case evReDraw:
402
		case evReDraw:
403
			draw_window();
403
			draw_window();
404
	}
404
	}
405
}
405
}
406
 
406
 
407
 
407
 
408
void draw_window()
408
void draw_window()
409
{
409
{
410
	DefineAndDrawWindow(40,20,550,500,0x73,col_work,TITLE);
410
	DefineAndDrawWindow(40,20,550,500,0x73,col_work,TITLE);
411
	GetProcessInfo(#Form, SelfInfo);
411
	GetProcessInfo(#Form, SelfInfo);
412
	if (Form.status_window>2) return;
412
	if (Form.status_window>2) return;
413
	files.SetSizes(192, 57, onLeft(192,27), onTop(57,6), disc_num*16+195,files.line_h);
413
	files.SetSizes(192, 57, onLeft(192,27), onTop(57,6), disc_num*16+195,files.line_h);
414
	if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h);
414
	if (Form.height < files.min_h) MoveSize(OLD,OLD,OLD,files.min_h);
415
	if (Form.width<480) MoveSize(OLD,OLD,480,OLD);
415
	if (Form.width<480) MoveSize(OLD,OLD,480,OLD);
416
	GetProcessInfo(#Form, SelfInfo); //if win_size changed
416
	GetProcessInfo(#Form, SelfInfo); //if win_size changed
417
 
417
 
418
	PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
418
	PutPaletteImage(#toolbar,246,34,0,0,8,#toolbar_pal);
419
	DrawBar(127, 8, 1, 25, col_border);
419
	DrawBar(127, 8, 1, 25, col_border);
420
	for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,col_work);
420
	for (j=0; j<3; j++) DefineButton(toolbar_buttons_x[j]+2,5+2,31-5,29-5,21+j+BT_HIDE,col_work);
421
	for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,col_work);
421
	for (j=3; j<6; j++) DefineButton(toolbar_buttons_x[j],5,31,29,21+j+BT_HIDE,col_work);
422
	DrawBar(246,0,onLeft(246,60),12, col_work); //upper editbox
422
	DrawBar(246,0,onLeft(246,60),12, col_work); //upper editbox
423
	DrawBar(246,29,onLeft(246,60),5,col_work);  //under editbox
423
	DrawBar(246,29,onLeft(246,60),5,col_work);  //under editbox
424
	DrawRectangle(246,12,onLeft(66,246),16,col_border);
424
	DrawRectangle(246,12,onLeft(66,246),16,col_border);
425
	DefineButton(onLeft(34,0),6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about
425
	DefineButton(onLeft(34,0),6,27,28,51+BT_HIDE+BT_NOFRAME,0); //about
426
	PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
426
	PutPaletteImage(#goto_about,56,34,Form.width-65,0,8,#goto_about_pal);
427
	//main rectangles
427
	//main rectangles
428
	DrawRectangle(1,40,Form.cwidth-3,onTop(46,0),col_border);
428
	DrawRectangle(1,40,Form.cwidth-3,onTop(46,0),col_border);
429
	DrawRectangle(0,39,Form.cwidth-1,onTop(44,0),col_palette[4]); //bg
429
	DrawRectangle(0,39,Form.cwidth-1,onTop(44,0),col_palette[4]); //bg
430
	for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);	
430
	for (i=0; i<5; i++) DrawBar(0, 34+i, Form.cwidth, 1, col_palette[8-i]);	
431
	DrawLeftPanel();
431
	DrawLeftPanel();
432
	//ListBox
432
	//ListBox
433
	DrawFlatButton(files.x,40,onLeft(files.x,168),16,31,col_work,T_FILE);
433
	DrawFlatButton(files.x,40,onLeft(files.x,168),16,31,col_work,T_FILE);
434
	DrawFlatButton(onLeft(168,0),40,73,16,32,col_work,T_TYPE);
434
	DrawFlatButton(onLeft(168,0),40,73,16,32,col_work,T_TYPE);
435
	DrawFlatButton(onLeft(95,0),40,68,16,33,col_work,T_SIZE);
435
	DrawFlatButton(onLeft(95,0),40,68,16,33,col_work,T_SIZE);
436
	DrawBar(onLeft(27,0),57,1,onTop(22,57),col_border); //line to the left from the scroll
436
	DrawBar(onLeft(27,0),57,1,onTop(22,57),col_border); //line to the left from the scroll
437
	DrawFlatButton(onLeft(27,0),40,16,16,0,col_work,"\x18");
437
	DrawFlatButton(onLeft(27,0),40,16,16,0,col_work,"\x18");
438
	DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,col_work,"\x19");
438
	DrawFlatButton(onLeft(27,0),onTop(22,0),16,16,0,col_work,"\x19");
439
	Open_Dir(#path,ONLY_SHOW);
439
	Open_Dir(#path,ONLY_SHOW);
440
	if (del_active) Del_Form();
440
	if (del_active) Del_Form();
441
	if (rename_active) FnProcess(2);
441
	if (rename_active) FnProcess(2);
442
}
442
}
443
 
443
 
444
 
444
 
445
void KEdit()
445
void KEdit()
446
{
446
{
447
	if (Form.width<480) return;
447
	if (Form.width<480) return;
448
	PathShow.area_size_x = Form.cwidth-306;
448
	PathShow.area_size_x = Form.cwidth-306;
449
	DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
449
	DrawBar(PathShow.start_x-3, PathShow.start_y-4, PathShow.area_size_x+2, 15, 0xFFFfff);
450
	PathShow_prepare stdcall(#PathShow);
450
	PathShow_prepare stdcall(#PathShow);
451
	PathShow_draw stdcall(#PathShow);
451
	PathShow_draw stdcall(#PathShow);
452
}
452
}
453
 
453
 
454
 
454
 
455
void List_Current(int cur)
455
void List_Current(int cur)
456
{
456
{
457
	if (cur<=0) //up
457
	if (cur<=0) //up
458
	{
458
	{
459
		IF (files.first==0) && (files.current<=0) return;
459
		IF (files.first==0) && (files.current<=0) return;
460
		IF (-cur-1
460
		IF (-cur-1
461
		{
461
		{
462
			Line_ReDraw(0xFFFFFF, files.current);
462
			Line_ReDraw(0xFFFFFF, files.current);
463
			files.current+=cur;
463
			files.current+=cur;
464
			Line_ReDraw(col_selec, files.current);
464
			Line_ReDraw(col_selec, files.current);
465
			return;
465
			return;
466
		}
466
		}
467
		ELSE
467
		ELSE
468
		{
468
		{
469
			IF (-cur
469
			IF (-cur
470
			files.current=0;
470
			files.current=0;
471
			List_ReDraw();
471
			List_ReDraw();
472
			return;
472
			return;
473
		}
473
		}
474
	}
474
	}
475
	else  //down
475
	else  //down
476
	{
476
	{
477
		IF (files.first==files.count-files.visible) && (files.current==files.visible-1) return;
477
		IF (files.first==files.count-files.visible) && (files.current==files.visible-1) return;
478
		IF (files.visible-files.current>cur)
478
		IF (files.visible-files.current>cur)
479
		{
479
		{
480
			Line_ReDraw(0xFFFFFF, files.current);
480
			Line_ReDraw(0xFFFFFF, files.current);
481
			files.current+=cur;
481
			files.current+=cur;
482
			Line_ReDraw(col_selec, files.current);
482
			Line_ReDraw(col_selec, files.current);
483
			return;
483
			return;
484
		}
484
		}
485
		else
485
		else
486
		{
486
		{
487
			IF(files.first+files.current+cur>=files.count)
487
			IF(files.first+files.current+cur>=files.count)
488
			{
488
			{
489
				files.first=files.count-files.visible;
489
				files.first=files.count-files.visible;
490
				files.current=cur-files.first+files.current;
490
				files.current=cur-files.first+files.current;
491
				}
491
				}
492
			ELSE
492
			ELSE
493
			{
493
			{
494
				files.first+=cur+files.current-files.visible+1;
494
				files.first+=cur+files.current-files.visible+1;
495
				files.current=files.visible-1;
495
				files.current=files.visible-1;
496
			}
496
			}
497
			
497
			
498
			IF (files.current<0) || (files.current>files.visible)
498
			IF (files.current<0) || (files.current>files.visible)
499
			{
499
			{
500
				files.current=files.visible-1;
500
				files.current=files.visible-1;
501
			}
501
			}
502
			List_ReDraw();
502
			List_ReDraw();
503
		}
503
		}
504
	}
504
	}
505
}
505
}
506
 
506
 
507
 
507
 
508
void List_ReDraw()
508
void List_ReDraw()
509
{
509
{
510
	int paint_y;
510
	int paint_y;
511
	//we are in the end of the list => maximize window => there will be white lines after the last element
511
	//we are in the end of the list => maximize window => there will be white lines after the last element
512
	if (files.count-files.firstfiles.visible-1)
512
	if (files.count-files.firstfiles.visible-1)
513
	{ files.first=files.count-files.visible; files.current=files.visible-1; }
513
	{ files.first=files.count-files.visible; files.current=files.visible-1; }
514
	for (j=0; j
514
	for (j=0; j
515
	//in the bottom
515
	//in the bottom
516
	paint_y = j * files.line_h + files.y;
516
	paint_y = j * files.line_h + files.y;
517
	DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF);
517
	DrawBar(files.x,paint_y,files.w,onTop(paint_y,6),0xFFFFFF);
518
	DrawBar(Form.cwidth-159,paint_y,1,onTop(paint_y,6),col_work);
518
	DrawBar(Form.cwidth-159,paint_y,1,onTop(paint_y,6),col_work);
519
	DrawBar(Form.cwidth-86,paint_y,1,onTop(paint_y,6),col_work);
519
	DrawBar(Form.cwidth-86,paint_y,1,onTop(paint_y,6),col_work);
520
	Scroll();
520
	Scroll();
521
}
521
}
522
 
522
 
523
 
523
 
524
void Line_ReDraw(dword color, filenum){
524
void Line_ReDraw(dword color, filenum){
525
	dword text_col=0,
525
	dword text_col=0,
526
	      name_len=0,
526
	      name_len=0,
527
	      attr,
527
	      attr,
528
	      y=filenum*files.line_h+57;
528
	      y=filenum*files.line_h+57;
529
	DrawBar(files.x,y,3,files.line_h,color); 
529
	DrawBar(files.x,y,3,files.line_h,color); 
530
	DrawBar(files.x+19,y,files.w-19,files.line_h,color);
530
	DrawBar(files.x+19,y,files.w-19,files.line_h,color);
531
	DrawBar(files.x+3,y+17,16,1,color);
531
	DrawBar(files.x+3,y+17,16,1,color);
532
	if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,color);
532
	if (files.line_h>18) DrawBar(files.x+3,y+18,16,files.line_h-18,color);
533
	if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,color); 
533
	if (files.line_h>15) DrawBar(files.x+3,y,16,files.line_h-15,color); 
534
 
534
 
535
	off=file_mas[filenum+files.first]*304 + buf+72;
535
	off=file_mas[filenum+files.first]*304 + buf+72;
536
	attr = ESDWORD[off - 40];
536
	attr = ESDWORD[off - 40];
537
 
537
 
538
	if (! TestBit(attr, 4) ) //file or folder?
538
	if (! TestBit(attr, 4) ) //file or folder?
539
	{	
539
	{	
540
		Put_icon(off+_strrchr(off,'.'), files.line_h/2-7+y, color);
540
		Put_icon(off+_strrchr(off,'.'), files.line_h/2-7+y, color);
541
		WriteText(7-strlen(ConvertMemSize(ESDWORD[off-8]))*6+onLeft(75,0),files.line_h-6/2+y,0x80,0,ConvertMemSize(ESDWORD[off-8])); //size
541
		WriteText(7-strlen(ConvertMemSize(ESDWORD[off-8]))*6+onLeft(75,0),files.line_h-6/2+y,0x80,0,ConvertMemSize(ESDWORD[off-8])); //size
542
	}
542
	}
543
	else
543
	else
544
		if (!strcmp("..",off))
544
		if (!strcmp("..",off))
545
			Put_icon("..", files.line_h/2-7+y, color);
545
			Put_icon("..", files.line_h/2-7+y, color);
546
		else
546
		else
547
			Put_icon("", files.line_h/2-7+y, color);
547
			Put_icon("", files.line_h/2-7+y, color);
548
	if ( TestBit(attr, 1) ) || ( TestBit(attr, 2) ) text_col=0xA6A6B7; //system or hiden?
548
	if ( TestBit(attr, 1) ) || ( TestBit(attr, 2) ) text_col=0xA6A6B7; //system or hiden?
549
	if (color!=0xFFFfff)
549
	if (color!=0xFFFfff)
550
	{
550
	{
551
		itdir = TestBit(attr, 4);
551
		itdir = TestBit(attr, 4);
552
		strcpy(#file_name, off);
552
		strcpy(#file_name, off);
553
		strcpy(#file_path, #path);
553
		strcpy(#file_path, #path);
554
		strcat(#file_path, #file_name);
554
		strcat(#file_path, #file_name);
555
		if (text_col==0xA6A6B7) text_col=0xFFFFFF;
555
		if (text_col==0xA6A6B7) text_col=0xFFFFFF;
556
	}
556
	}
557
	if (Form.width>=480)
557
	if (Form.width>=480)
558
	{
558
	{
559
		FileShow.start_x = files.x + 23;
559
		FileShow.start_x = files.x + 23;
560
		FileShow.font_color = text_col;
560
		FileShow.font_color = text_col;
561
		FileShow.area_size_x = Form.width - 380;
561
		FileShow.area_size_x = Form.width - 380;
562
		FileShow.text_pointer = off;
562
		FileShow.text_pointer = off;
563
		FileShow.start_y = files.line_h/2-3+y;
563
		FileShow.start_y = files.line_h/2-3+y;
564
		PathShow_prepare stdcall(#FileShow);
564
		PathShow_prepare stdcall(#FileShow);
565
		PathShow_draw stdcall(#FileShow);
565
		PathShow_draw stdcall(#FileShow);
566
	}
566
	}
567
	DrawBar(Form.cwidth-159,y,1,files.line_h,col_work); //gray line 1
567
	DrawBar(Form.cwidth-159,y,1,files.line_h,col_work); //gray line 1
568
	DrawBar(Form.cwidth-86,y,1,files.line_h,col_work); //gray line 2
568
	DrawBar(Form.cwidth-86,y,1,files.line_h,col_work); //gray line 2
569
}
569
}
570
 
570
 
571
 
571
 
572
void Open_Dir(dword dir_path, redraw){
572
void Open_Dir(dword dir_path, redraw){
573
	int errornum, maxcount;
573
	int errornum, maxcount;
574
 
574
 
575
	if (redraw!=ONLY_SHOW)
575
	if (redraw!=ONLY_SHOW)
576
	{
576
	{
577
		if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0';
577
		if (ESBYTE[dir_path+1]!='\0') ESBYTE[dir_path+strlen(dir_path)-1] = '\0';
578
		if (buf) free(buf);
578
		if (buf) free(buf);
579
		errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
579
		errornum = GetDir(#buf, #files.count, dir_path, DIRS_NOROOT);
580
		if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/');
580
		if (ESBYTE[dir_path+1]!='\0') chrcat(dir_path, '/');
581
		if (errornum)
581
		if (errornum)
582
		{
582
		{
583
			HistoryPath(ADD_NEW_PATH);
583
			HistoryPath(ADD_NEW_PATH);
584
			GoBack();
584
			GoBack();
585
			Write_Error(errornum);
585
			Write_Error(errornum);
586
			return;
586
			return;
587
		}
587
		}
588
		maxcount = sizeof(file_mas)/sizeof(dword)-1;
588
		maxcount = sizeof(file_mas)/sizeof(dword)-1;
589
		if (files.count>maxcount) files.count = maxcount;		
589
		if (files.count>maxcount) files.count = maxcount;		
590
	}
590
	}
591
	if (files.count!=-1)
591
	if (files.count!=-1)
592
	{
592
	{
593
		KEdit();
593
		KEdit();
594
		HistoryPath(ADD_NEW_PATH);
594
		HistoryPath(ADD_NEW_PATH);
595
		files.visible = files.h / files.line_h;
595
		files.visible = files.h / files.line_h;
596
		IF (files.count < files.visible) files.visible = files.count;
596
		IF (files.count < files.visible) files.visible = files.count;
597
		IF (sort_num==1) WriteText(Form.width+60/2,45,0x80,col_border,"\x19");
597
		IF (sort_num==1) WriteText(Form.width+60/2,45,0x80,col_border,"\x19");
598
		IF (sort_num==2) WriteText(Form.width-115,45,0x80,col_border,"\x19");
598
		IF (sort_num==2) WriteText(Form.width-115,45,0x80,col_border,"\x19");
599
		IF (sort_num==3) WriteText(Form.width-44,45,0x80,col_border,"\x19");
599
		IF (sort_num==3) WriteText(Form.width-44,45,0x80,col_border,"\x19");
600
		IF (redraw!=ONLY_SHOW) Sorting();
600
		IF (redraw!=ONLY_SHOW) Sorting();
601
		IF (redraw!=ONLY_OPEN) List_ReDraw();
601
		IF (redraw!=ONLY_OPEN) List_ReDraw();
602
	}
602
	}
603
	IF (files.count==-1) && (redraw!=ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();}
603
	IF (files.count==-1) && (redraw!=ONLY_OPEN) {files.visible=files.count=0; List_ReDraw();}
604
}
604
}
605
 
605
 
606
 
606
 
607
inline Sorting()
607
inline Sorting()
608
{
608
{
609
	dword k=0, l=1;
609
	dword k=0, l=1;
610
	int i;
610
	int i;
611
	if (!strcmp(#path,"/")) //do not sort
611
	if (!strcmp(#path,"/")) //do not sort
612
	{
612
	{
613
		FOR(k=1;k
613
		FOR(k=1;k
614
		return;
614
		return;
615
	}
615
	}
616
	FOR (j=files.count-1, off=files.count-1*304+buf+32; j>=0; j--, off-=304;)  //files | folders
616
	FOR (j=files.count-1, off=files.count-1*304+buf+32; j>=0; j--, off-=304;)  //files | folders
617
	{
617
	{
618
		strttl(off+40);
618
		strttl(off+40);
619
		if (TestBit(ESDWORD[off],4)) //directory?
619
		if (TestBit(ESDWORD[off],4)) //directory?
620
		{
620
		{
621
			file_mas[k]=j;
621
			file_mas[k]=j;
622
			k++;
622
			k++;
623
		}
623
		}
624
		else
624
		else
625
		{
625
		{
626
			file_mas[files.count-l]=j;
626
			file_mas[files.count-l]=j;
627
			l++;
627
			l++;
628
		}
628
		}
629
	}
629
	}
630
	//sorting: files first, then folders
630
	//sorting: files first, then folders
631
	Sort_by_Name(0,k-1);
631
	Sort_by_Name(0,k-1);
632
	IF (sort_num==1) Sort_by_Name(k,files.count-1);
632
	IF (sort_num==1) Sort_by_Name(k,files.count-1);
633
	IF (sort_num==2) Sort_by_Type(k,files.count-1);
633
	IF (sort_num==2) Sort_by_Type(k,files.count-1);
634
	IF (sort_num==3) Sort_by_Size(k,files.count-1);
634
	IF (sort_num==3) Sort_by_Size(k,files.count-1);
635
	//".." should be first
635
	//".." should be first
636
	IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")!=0)
636
	IF (k>0) && (strcmp(file_mas[0]*304+buf+72,"..")!=0)
637
		FOR(k--; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) {file_mas[k]>
637
		FOR(k--; k>0; k--;) IF (!strcmp(file_mas[k]*304+buf+72,"..")) {file_mas[k]>
638
}
638
}
639
 
639
 
640
 
640
 
641
void Del_Form()
641
void Del_Form()
642
{
642
{
643
	int dform_x = files.w - 200 / 2 + files.x;
643
	int dform_x = files.w - 200 / 2 + files.x-3;
644
	//oeia ieii
-
 
645
	if (!files.count) return;
644
	if (!files.count) return;
646
	#ifdef LANG_RUS
-
 
647
	DrawFlatButton(dform_x,160,215,80,0,col_work, ""); //oi?ia
645
	DrawPopup(dform_x,160,213,80,1,col_work,col_border);
648
	#else
-
 
649
	DrawFlatButton(dform_x,160,200,80,0,col_work, ""); //oi?ia
-
 
650
	#endif
-
 
651
	WriteText(dform_x+19,175,0x80,0,T_DELETE_FILE);
646
	WriteText(-strlen(T_DELETE_FILE)*3+107+dform_x,175,0x80,0,T_DELETE_FILE);
652
	IF (strlen(#file_name)<28) 
647
	IF (strlen(#file_name)<28) 
653
		{
648
	{
654
			WriteText(strlen(#file_name)*6+dform_x+20,190,0x80,0,"?");
649
		WriteText(strlen(#file_name)*3+107+dform_x+2,190,0x80,0,"?");
655
			WriteText(dform_x+20,190,0x80,0,#file_name); //ieoai eiy
650
		WriteText(-strlen(#file_name)*3+107+dform_x,190,0x80,0,#file_name);
656
		}
651
	}
657
	ELSE
652
	else
658
		{
653
	{
659
			WriteText(164+dform_x,190,0x80,0,"...?");
654
		WriteText(164+dform_x,190,0x80,0,"...?");
660
			ESI = 24;
655
		ESI = 24;
661
			WriteText(dform_x+20,190,0,0,#file_name); //ieoai eiy
656
		WriteText(dform_x+20,190,0,0,#file_name);
662
		}
657
	}
663
	DrawFlatButton(dform_x+20,208,70,20,301,0xFFB6B5,T_YES);
658
	DrawFlatButton(dform_x+26,208,70,20,301,0xFFB6B5,T_YES);
664
	DrawFlatButton(dform_x+111,208,70,20,302,0xC6DFC6,T_NO);
659
	DrawFlatButton(dform_x+119,208,70,20,302,0xC6DFC6,T_NO);
665
	del_active=1;
660
	del_active=1;
666
}
661
}
667
 
662
 
668
	
663
	
669
void Del_File2(dword way)
664
void Del_File2(dword way)
670
{    
665
{    
671
	int del_rezult;
666
	int del_rezult;
672
	dword dirbuf, fcount, i, filename;
667
	dword dirbuf, fcount, i, filename;
673
	char del_from[4096], error;
668
	char del_from[4096], error;
674
	del_rezult = DeleteFile(way);
669
	del_rezult = DeleteFile(way);
675
		if (del_rezult)
670
		if (del_rezult)
676
		{
671
		{
677
			error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL);
672
			error = GetDir(#dirbuf, #fcount, way, DIRS_ONLYREAL);
678
			for (i=0; i
673
			for (i=0; i
679
			{
674
			{
680
				filename = i*304+dirbuf+72;
675
				filename = i*304+dirbuf+72;
681
				strcpy(#del_from, way);
676
				strcpy(#del_from, way);
682
				chrcat(#del_from, '/');
677
				chrcat(#del_from, '/');
683
				strcat(#del_from, filename);
678
				strcat(#del_from, filename);
684
				if ( TestBit(ESDWORD[filename-40], 4) )
679
				if ( TestBit(ESDWORD[filename-40], 4) )
685
					Del_File2(#del_from);
680
					Del_File2(#del_from);
686
				else
681
				else
687
					DeleteFile(#del_from);
682
					DeleteFile(#del_from);
688
			}
683
			}
689
			DeleteFile(way);
684
			DeleteFile(way);
690
		}
685
		}
691
}
686
}
692
 
687
 
693
 
688
 
694
void Del_File(byte dodel)
689
void Del_File(byte dodel)
695
{    
690
{    
696
	int del_rezult;
691
	int del_rezult;
697
	if (dodel==true)
692
	if (dodel==true)
698
	{
693
	{
699
		Del_File2(#file_path);
694
		Del_File2(#file_path);
700
 	}
695
 	}
701
	del_active=0;
696
	del_active=0;
702
	DeleteButton(301); DeleteButton(302);
697
	DeleteButton(301); DeleteButton(302);
703
	Open_Dir(#path,WITH_REDRAW);
698
	Open_Dir(#path,WITH_REDRAW);
704
}
699
}
705
 
700
 
706
 
701
 
707
void ReName(byte rename)
702
void ReName(byte rename)
708
{
703
{
709
	int del_rezult, copy_rezult;
704
	int del_rezult, copy_rezult;
710
	char edit_name[256];
705
	char edit_name[256];
711
	rename_active=0;
706
	rename_active=0;
712
	edit2.flags=64;
707
	edit2.flags=64;
713
	if (rename==true)
708
	if (rename==true)
714
	{
709
	{
715
		strcpy(#temp, #path);
710
		strcpy(#temp, #path);
716
		strcpy(#edit_name, #file_name); //save edit name to select it later
711
		strcpy(#edit_name, #file_name); //save edit name to select it later
717
		strcat(#temp, #file_name);
712
		strcat(#temp, #file_name);
718
		if (strcmp(#file_path,#temp)!=0) && (file_name)
713
		if (strcmp(#file_path,#temp)!=0) && (file_name)
719
		if (itdir)
714
		if (itdir)
720
		{
715
		{
721
			del_rezult = DeleteFile(#file_path);
716
			del_rezult = DeleteFile(#file_path);
722
			if (del_rezult!=0)
717
			if (del_rezult!=0)
723
			{
718
			{
724
				Write_Error(del_rezult);
719
				Write_Error(del_rezult);
725
				ShowMessage(T_DEL_ERROR_1);
720
				ShowMessage(T_DEL_ERROR_1);
726
				return;
721
				return;
727
			}
722
			}
728
			ELSE CreateDir(#temp);
723
			ELSE CreateDir(#temp);
729
			Open_Dir(#path,WITH_REDRAW);
724
			Open_Dir(#path,WITH_REDRAW);
730
		}
725
		}
731
		else
726
		else
732
		{
727
		{
733
			copy_rezult = CopyFile(#file_path,#temp);
728
			copy_rezult = CopyFile(#file_path,#temp);
734
			if (copy_rezult!=0) Write_Error(copy_rezult); else Del_File(true);
729
			if (copy_rezult!=0) Write_Error(copy_rezult); else Del_File(true);
735
		}
730
		}
736
		SelectFile(#edit_name);
731
		SelectFile(#edit_name);
737
	}
732
	}
738
	Line_ReDraw(col_selec,files.current);
733
	Line_ReDraw(col_selec,files.current);
739
}
734
}
740
 
735
 
741
 
736
 
742
void SelectFile(dword that_file)
737
void SelectFile(dword that_file)
743
{
738
{
744
	files.first=files.current=0;
739
	files.first=files.current=0;
745
   	Open_Dir(#path,ONLY_OPEN);
740
   	Open_Dir(#path,ONLY_OPEN);
746
	strttl(that_file);
741
	strttl(that_file);
747
	for (i=files.count-1; i>=0; i--;)
742
	for (i=files.count-1; i>=0; i--;)
748
		if (!strcmp(file_mas[i]*304+buf+72,that_file)) break;
743
		if (!strcmp(file_mas[i]*304+buf+72,that_file)) break;
749
	List_Current(i);
744
	List_Current(i);
750
	List_ReDraw();
745
	List_ReDraw();
751
}
746
}
752
 
747
 
753
 
748
 
754
void Dir_Up()
749
void Dir_Up()
755
{
750
{
756
	char cur_folder[4096];
751
	char cur_folder[4096];
757
	i=strlen(#path)-1;
752
	i=strlen(#path)-1;
758
	if (i==0) return;
753
	if (i==0) return;
759
	path[i]=0x00;
754
	path[i]=0x00;
760
	i = strrchr(#path, '/');
755
	i = strrchr(#path, '/');
761
	strcpy(#cur_folder, #path+i);
756
	strcpy(#cur_folder, #path+i);
762
	path[i]=0x00;
757
	path[i]=0x00;
763
	SelectFile(#cur_folder);
758
	SelectFile(#cur_folder);
764
}
759
}
765
 
760
 
766
void Open()
761
void Open()
767
{
762
{
768
	if (!files.count) return;
763
	if (!files.count) return;
769
	if (!itdir)
764
	if (!itdir)
770
	{
765
	{
771
		GetIni(0);
766
		GetIni(0);
772
	} 
767
	} 
773
	else
768
	else
774
	{
769
	{
775
		if (!strcmp(#file_name,"..")) { Dir_Up(); return; }
770
		if (!strcmp(#file_name,"..")) { Dir_Up(); return; }
776
		strcpy(#path, #file_path);
771
		strcpy(#path, #file_path);
777
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
772
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //need "/" in the end
778
		files.first=files.current=0;
773
		files.first=files.current=0;
779
		Open_Dir(#path,WITH_REDRAW);
774
		Open_Dir(#path,WITH_REDRAW);
780
	}
775
	}
781
}
776
}
782
 
777
 
783
 
778
 
784
inline fastcall void GoBack()
779
inline fastcall void GoBack()
785
{
780
{
786
	char cur_folder[4096];
781
	char cur_folder[4096];
787
	strcpy(#cur_folder, GetCurrentFolder());
782
	strcpy(#cur_folder, GetCurrentFolder());
788
	if (HistoryPath(GO_BACK)) SelectFile(#cur_folder);
783
	if (HistoryPath(GO_BACK)) SelectFile(#cur_folder);
789
}
784
}
790
 
785
 
791
void FnProcess(char N)
786
void FnProcess(char N)
792
{
787
{
793
	switch(N)
788
	switch(N)
794
	{
789
	{
795
		case 1:
790
		case 1:
796
			SwitchToAnotherThread();
791
			SwitchToAnotherThread();
797
			CreateThread(#about_dialog,#about_stak);
792
			CreateThread(#about_dialog,#about_stak);
798
			break;
793
			break;
799
		case 2:
794
		case 2:
800
			if (!files.count) break;
795
			if (!files.count) break;
801
			edit2.flags = 100000000000010b; //set active
796
			edit2.flags = 100000000000010b; //set active
802
			edit2.left = files.x + 21;
797
			edit2.left = files.x + 21;
803
			edit2.width = files.w - 26;
798
			edit2.width = files.w - 26;
804
			edit2.top=files.current*files.line_h+59;
799
			edit2.top=files.current*files.line_h+59;
805
			edit2.size=edit2.pos=strlen(#file_name);
800
			edit2.size=edit2.pos=strlen(#file_name);
806
			edit_box_draw  stdcall (#edit2);
801
			edit_box_draw  stdcall (#edit2);
807
			DrawBar(edit2.left,files.current*files.line_h+58,edit2.width+1,1,0xFFFFCC); //bg
802
			DrawBar(edit2.left,files.current*files.line_h+58,edit2.width+1,1,0xFFFFCC); //bg
808
			rename_active=1;
803
			rename_active=1;
809
			break;
804
			break;
810
		case 3:
805
		case 3:
811
			IF (!itdir) RunProgram("/sys/tinypad", #file_path);
806
			IF (!itdir) RunProgram("/sys/tinypad", #file_path);
812
			break;
807
			break;
813
		case 4:
808
		case 4:
814
			IF (!itdir) RunProgram("/sys/develop/heed", #file_path);
809
			IF (!itdir) RunProgram("/sys/develop/heed", #file_path);
815
			break;
810
			break;
816
		case 5: //refresh cur dir & devs
811
		case 5: //refresh cur dir & devs
817
			Tip(56, T_DEVICES, 55, "-");
812
			Tip(56, T_DEVICES, 55, "-");
818
			Open_Dir(#path,WITH_REDRAW);
813
			Open_Dir(#path,WITH_REDRAW);
819
			pause(10);
814
			pause(10);
820
			GetIni(1);
815
			GetIni(1);
821
			SystemDiscsGet();
816
			SystemDiscsGet();
822
			Open_Dir(#path,WITH_REDRAW);
817
			Open_Dir(#path,WITH_REDRAW);
823
			DrawLeftPanel();
818
			DrawLeftPanel();
824
			break;
819
			break;
825
		case 6:
820
		case 6:
826
			strcpy(#temp, #path);
821
			strcpy(#temp, #path);
827
			strcat(#temp, T_NEW_FOLDER);
822
			strcat(#temp, T_NEW_FOLDER);
828
			CreateDir(#temp);
823
			CreateDir(#temp);
829
			if (!EAX){
824
			if (!EAX){
830
				SelectFile(T_NEW_FOLDER);
825
				SelectFile(T_NEW_FOLDER);
831
				FnProcess(2);
826
				FnProcess(2);
832
			}
827
			}
833
			else
828
			else
834
			{
829
			{
835
				Write_Error(EAX);
830
				Write_Error(EAX);
836
				ShowMessage(NOT_CREATE_FOLDER);
831
				ShowMessage(NOT_CREATE_FOLDER);
837
			}
832
			}
838
			break;
833
			break;
839
		case 7:
834
		case 7:
840
			strcpy(#temp, #path);
835
			strcpy(#temp, #path);
841
			strcat(#temp, T_NEW_FILE);
836
			strcat(#temp, T_NEW_FILE);
842
			WriteFile(0, 0, #temp);
837
			WriteFile(0, 0, #temp);
843
			if (!EAX){
838
			if (!EAX){
844
				SelectFile(T_NEW_FILE);
839
				SelectFile(T_NEW_FILE);
845
				FnProcess(2);
840
				FnProcess(2);
846
			}
841
			}
847
			else
842
			else
848
			{
843
			{
849
				Write_Error(EAX);
844
				Write_Error(EAX);
850
				ShowMessage(NOT_CREATE_FILE);
845
				ShowMessage(NOT_CREATE_FILE);
851
			}
846
			}
852
			break;
847
			break;
853
		case 10: //F10
848
		case 10: //F10
854
			RunProgram(EDITOR_PATH, abspath("Eolite.ini"));
849
			RunProgram(EDITOR_PATH, abspath("Eolite.ini"));
855
			break;
850
			break;
856
	}
851
	}
857
}
852
}
858
 
853
 
859
 
854
 
860
stop:
855
stop:
861
 
856
 
862
char about_stak[512];
857
char about_stak[512];
863
char menu_stak[512];
858
char menu_stak[512];
864
char copy_stak[4096];
859
char copy_stak[4096];
865
>
860
>
866
>
861
>
867
>
862
>
868
>
863
>
869
>
864
>
870
>
865
>