Subversion Repositories Kolibri OS

Rev

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

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