Subversion Repositories Kolibri OS

Rev

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

Rev 4029 Rev 4034
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 0xA0000
9
#define MEMSIZE 0xA0000
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
#elif LANG_EST
41
#elif LANG_EST
42
	?define T_FILE "Fail"
42
	?define T_FILE "Fail"
43
	?define T_TYPE "Tüüp"
43
	?define T_TYPE "Tüüp"
44
	?define T_SIZE "Suurus"
44
	?define T_SIZE "Suurus"
45
	?define T_NEW_FOLDER "Uus kataloog"
45
	?define T_NEW_FOLDER "Uus kataloog"
46
	?define T_NEW_FILE "Uus fail"
46
	?define T_NEW_FILE "Uus fail"
47
	?define T_DELETE_FILE "Kas sa tahad tõesti kustutada"
47
	?define T_DELETE_FILE "Kas sa tahad tõesti kustutada"
48
	?define T_YES "Jah"
48
	?define T_YES "Jah"
49
	?define T_NO "Ei"
49
	?define T_NO "Ei"
50
	?define T_DEL_ERROR_1 "Viga. Kataloog ei ole tühi."
50
	?define T_DEL_ERROR_1 "Viga. Kataloog ei ole tühi."
51
	?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
51
	?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
52
	?define NOT_CREATE_FOLDER "Kataloogi ei saa luua."
52
	?define NOT_CREATE_FOLDER "Kataloogi ei saa luua."
53
	?define NOT_CREATE_FILE "Faili ei saa luua."
53
	?define NOT_CREATE_FILE "Faili ei saa luua."
54
	?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj"
54
	?define ERROR_1 "Viga teegi laadimisel /rd/1/lib/box_lib.obj"
55
	?define T_PASTE_WINDOW "Kopeerin..."
55
	?define T_PASTE_WINDOW "Kopeerin..."
56
	?define T_PASTE_WINDOW_TEXT "Kopeerin faili:"
56
	?define T_PASTE_WINDOW_TEXT "Kopeerin faili:"
57
	?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
57
	?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
58
#else
58
#else
59
	?define T_FILE "File"
59
	?define T_FILE "File"
60
	?define T_TYPE "Type"
60
	?define T_TYPE "Type"
61
	?define T_SIZE "Size"
61
	?define T_SIZE "Size"
62
	?define T_NEW_FOLDER "New folder"
62
	?define T_NEW_FOLDER "New folder"
63
	?define T_NEW_FILE "New file"
63
	?define T_NEW_FILE "New file"
64
	?define T_DELETE_FILE "Do you really want to delete"
64
	?define T_DELETE_FILE "Do you really want to delete"
65
	?define T_YES "Yes"
65
	?define T_YES "Yes"
66
	?define T_NO "No"
66
	?define T_NO "No"
67
	?define T_DEL_ERROR_1 "Error. Folder isn't empty."
67
	?define T_DEL_ERROR_1 "Error. Folder isn't empty."
68
	?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
68
	?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
69
	?define NOT_CREATE_FOLDER "Folder can not be created."
69
	?define NOT_CREATE_FOLDER "Folder can not be created."
70
	?define NOT_CREATE_FILE "File can not be created."
70
	?define NOT_CREATE_FILE "File can not be created."
71
	?define ERROR_1 "Error while loading library /rd/1/lib/box_lib.obj"
71
	?define ERROR_1 "Error while loading library /rd/1/lib/box_lib.obj"
72
	?define T_PASTE_WINDOW "Copying..."
72
	?define T_PASTE_WINDOW "Copying..."
73
	?define T_PASTE_WINDOW_TEXT "Copying file:"
73
	?define T_PASTE_WINDOW_TEXT "Copying file:"
74
	?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
74
	?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
75
#endif
75
#endif
76
 
76
 
77
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
77
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
78
 
78
 
79
#define TITLE "Eolite File Manager v1.98.5"
79
#define TITLE "Eolite File Manager v1.98.5"
80
#define ABOUT_TITLE "Eolite v1.98.5"
80
#define ABOUT_TITLE "Eolite v1.98.5"
81
dword col_work    = 0xE4DFE1;
81
dword col_work    = 0xE4DFE1;
82
dword col_border  = 0x9098B0; //A0A0B8; //0x819FC5;
82
dword col_border  = 0x9098B0; //A0A0B8; //0x819FC5;
83
dword col_padding = 0xC8C9C9;
83
dword col_padding = 0xC8C9C9;
84
dword col_selec   = 0x94AECE;
84
dword col_selec   = 0x94AECE;
85
dword col_lpanel  = 0x00699C;
85
dword col_lpanel  = 0x00699C;
86
 
86
 
87
int toolbar_buttons_x[7]={9,46,85,134,167,203};
87
int toolbar_buttons_x[7]={9,46,85,134,167,203};
88
char tmp_disk_del_param[3]="d0";
88
char tmp_disk_del_param[3]="d0";
89
struct path_string { char Item[4096]; };
89
struct path_string { char Item[4096]; };
90
 
90
 
91
llist files;
91
llist files;
92
 
92
 
93
byte
93
byte
94
	path[4096],
94
	path[4096],
95
	file_path[4096],
95
	file_path[4096],
96
	file_name[256],
96
	file_name[256],
97
	temp[4096];	 
97
	temp[4096];	 
98
byte
98
byte
99
	rename_active=0,
99
	rename_active=0,
100
	del_active=0,
100
	del_active=0,
101
	show_dev_name=1,
101
	show_dev_name=1,
102
	sort_num=2,
102
	sort_num=2,
103
	itdir;
103
	itdir;
104
 
104
 
105
proc_info Form;
105
proc_info Form;
106
mouse m;
106
mouse m;
107
int mouse_dd, scroll_used, scroll_size, sorting_arrow_x;
107
int mouse_dd, scroll_used, scroll_size, sorting_arrow_x;
108
dword buf, off;
108
dword buf, off;
109
dword file_mas[6898];
109
dword file_mas[6898];
110
int j, i;
110
int j, i;
111
int action_buf;
111
int action_buf;
112
 
112
 
113
edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6};
113
edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6};
114
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
114
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
115
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
115
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
116
 
116
 
117
#include "include\copypaste.h"
117
#include "include\copypaste.h"
118
#include "include\some_code.h"
118
#include "include\some_code.h"
119
#include "include\sorting.h"
119
#include "include\sorting.h"
120
#include "include\icons_f.h"
120
#include "include\icons_f.h"
121
#include "include\ini.h"
121
#include "include\ini.h"
122
#include "include\left_panel.h"
122
#include "include\left_panel.h"
123
#include "include\history.h"
123
#include "include\history.h"
124
#include "include\file_menu.h"
124
#include "include\file_menu.h"
125
#include "include\about_dialog.h"
125
#include "include\about_dialog.h"
126
 
126
 
127
void main() 
127
void main() 
128
{
128
{
129
	word key, id, can_show, can_select, m_selected;
129
	word key, id, can_show, can_select, m_selected;
130
 
130
 
131
	files.line_h=18;
131
	files.line_h=18;
132
	mem_Init();
132
	mem_Init();
133
	if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1);
133
	if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1);
134
	SystemDiscsGet();
134
	SystemDiscsGet();
135
	GetIni(1);	
135
	GetIni(1);	
136
	if (param)
136
	if (param)
137
	{
137
	{
138
		strcpy(#path, #param);
138
		strcpy(#path, #param);
139
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string
139
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string
140
	}
140
	}
141
	else
141
	else
142
	{
142
	{
143
		strcpy(#path, "/rd/1/");		
143
		strcpy(#path, "/rd/1/");		
144
	}
144
	}
145
	Open_Dir(#path,ONLY_OPEN);
145
	Open_Dir(#path,ONLY_OPEN);
146
	SetEventMask(0x27);
146
	SetEventMask(0x27);
147
	loop() switch(WaitEvent())
147
	loop() switch(WaitEvent())
148
	{
148
	{
149
		case evMouse:
149
		case evMouse:
150
			IF (del_active) break;		
150
			IF (del_active) break;		
151
			id=GetProcessSlot(Form.ID); 
151
			id=GetProcessSlot(Form.ID); 
152
			IF (id!=GetActiveProcess()) || (Form.status_window>2) break;
152
			IF (id!=GetActiveProcess()) || (Form.status_window>2) break;
153
			IF (rename_active) { edit_box_mouse stdcall(#edit2); break; }
153
			IF (rename_active) { edit_box_mouse stdcall(#edit2); break; }
154
			
154
			
155
			m.get();
155
			m.get();
156
 
156
 
157
			if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h) && (!can_select)
157
			if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h) && (!can_select)
158
			{
158
			{
159
				m_selected = m.y - 57 / files.line_h;
159
				m_selected = m.y - 57 / files.line_h;
160
				if (m.lkm) can_select = 1;
160
				if (m.lkm) can_select = 1;
161
				if (m.pkm)
161
				if (m.pkm)
162
				{
162
				{
163
					can_show = 1;
163
					can_show = 1;
164
					if (m.y - 57 / files.line_h != files.current) can_select = 1;
164
					if (m.y - 57 / files.line_h != files.current) can_select = 1;
165
				}
165
				}
166
			}
166
			}
167
 
167
 
168
			//select/open file {
168
			//select/open file {
169
			if (!m.lkm) && (!m.pkm) && (can_select)
169
			if (!m.lkm) && (!m.pkm) && (can_select)
170
			{
170
			{
171
				can_select = 0;
171
				can_select = 0;
172
				if (m.y>=57)
172
				if (m.y>=57)
173
				{
173
				{
174
					id = m.y - 57 / files.line_h;
174
					id = m.y - 57 / files.line_h;
175
					if (id!=m_selected)
175
					if (id!=m_selected)
176
					{
176
					{
177
						can_show=0;
177
						can_show=0;
178
						break;
178
						break;
179
					}
179
					}
180
					if (files.current!=id)
180
					if (files.current!=id)
181
					{
181
					{
182
						if (id
182
						if (id
183
					}
183
					}
184
					else
184
					else
185
						Open();
185
						Open();
186
				}
186
				}
187
			};
187
			};
188
			// } select/open file
188
			// } select/open file
189
 
189
 
190
			//file menu {
190
			//file menu {
191
			if (!m.pkm) && (!m.lkm) && (can_show)
191
			if (!m.pkm) && (!m.lkm) && (can_show)
192
			{
192
			{
193
				can_show = 0;
193
				can_show = 0;
194
				if (m.y>=57)
194
				if (m.y>=57)
195
				{
195
				{
196
					SwitchToAnotherThread();
196
					SwitchToAnotherThread();
197
					CreateThread(#FileMenu,#menu_stak);
197
					CreateThread(#FileMenu,#menu_stak);
198
				}
198
				}
199
				break;
199
				break;
200
			}
200
			}
201
			// } file menu
201
			// } file menu
202
 
202
 
203
			if (m.vert)
203
			if (m.vert)
204
			{
204
			{
205
				files.MouseScroll(m.vert);
205
				files.MouseScroll(m.vert);
206
				List_ReDraw();
206
				List_ReDraw();
207
				break;
207
				break;
208
			}
208
			}
209
 
209
 
210
			if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<57)
210
			if (m.x>=Form.width-26) && (m.x<=Form.width-6) && (m.y>40) && (m.y<57)