Subversion Repositories Kolibri OS

Rev

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

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