Subversion Repositories Kolibri OS

Rev

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

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