Subversion Repositories Kolibri OS

Rev

Rev 4069 | Rev 4072 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3363 leency 1
//Leency & Veliant 2008-2013
2
//GNU GPL licence.
3
 
4022 leency 4
#ifndef AUTOBUILD
5
#include "lang.h--"
6
#endif
7
 
3363 leency 8
//libraries
4049 leency 9
#define MEMSIZE 0xD0000
3363 leency 10
#include "..\lib\kolibri.h"
11
#include "..\lib\strings.h"
12
#include "..\lib\mem.h"
13
#include "..\lib\dll.h"
14
#include "..\lib\lib.obj\box_lib.h"
15
#include "..\lib\file_system.h"
16
#include "..\lib\figures.h"
3412 leency 17
#include "..\lib\encoding.h"
3434 leency 18
#include "..\lib\list_box.h"
19
#include "..\lib\copyf.h"
3363 leency 20
//images
21
#include "imgs\toolbar.txt"
22
#include "imgs\left_p.txt"
23
 
3848 punk_joker 24
#ifdef LANG_RUS
25
	?define T_FILE "Файл"
26
	?define T_TYPE "Тип"
27
	?define T_SIZE "Размер"
28
	?define T_NEW_FOLDER "Новая папка"
29
	?define T_NEW_FILE "Новый файл"
30
	?define T_DELETE_FILE "Вы действительно хотите удалить"
31
	?define T_YES "Да"
32
	?define T_NO "Нет"
33
	?define T_DEL_ERROR_1 "Ошибка. Папка не пустая."
3997 leency 34
	?define WAIT_DELETING_FOLDER "Удаляется папка. Подожите..."
3848 punk_joker 35
	?define NOT_CREATE_FOLDER "Не удалось создать папку."
36
	?define NOT_CREATE_FILE "Не удалось создать файл."
37
	?define ERROR_1 "Ошибка при загрузке библиотеки /rd/1/lib/box_lib.obj"
3883 leency 38
	?define T_PASTE_WINDOW "Копирую..."
39
	?define T_PASTE_WINDOW_TEXT "Копируется файл:"
4022 leency 40
	?define T_CANCEL_PASTE "Копирование прекращено. Папка скопирована не полностью."
4049 leency 41
	?define T_SELECT_APP_TO_OPEN_WITH "Выберите программу для открытия файла"
3933 kaitz 42
#elif LANG_EST
43
	?define T_FILE "Fail"
44
	?define T_TYPE "T№№p"
45
	?define T_SIZE "Suurus"
46
	?define T_NEW_FOLDER "Uus kataloog"
47
	?define T_NEW_FILE "Uus fail"
48
	?define T_DELETE_FILE "Kas sa tahad tїesti kustutada"
49
	?define T_YES "Jah"
50
	?define T_NO "Ei"
51
	?define T_DEL_ERROR_1 "Viga. Kataloog ei ole t№hi."
3997 leency 52
	?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
3933 kaitz 53
	?define NOT_CREATE_FOLDER "Kataloogi 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"
56
	?define T_PASTE_WINDOW "Kopeerin..."
57
	?define T_PASTE_WINDOW_TEXT "Kopeerin faili:"
4022 leency 58
	?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
4049 leency 59
	?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file"
3848 punk_joker 60
#else
61
	?define T_FILE "File"
62
	?define T_TYPE "Type"
63
	?define T_SIZE "Size"
64
	?define T_NEW_FOLDER "New folder"
65
	?define T_NEW_FILE "New file"
66
	?define T_DELETE_FILE "Do you really want to delete"
67
	?define T_YES "Yes"
68
	?define T_NO "No"
69
	?define T_DEL_ERROR_1 "Error. Folder isn't empty."
3997 leency 70
	?define WAIT_DELETING_FOLDER "Deleting folder. Please, wait..."
3848 punk_joker 71
	?define NOT_CREATE_FOLDER "Folder 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"
3883 leency 74
	?define T_PASTE_WINDOW "Copying..."
75
	?define T_PASTE_WINDOW_TEXT "Copying file:"
4022 leency 76
	?define T_CANCEL_PASTE "Copy process terminated. Folder copied incompletely."
4049 leency 77
	?define T_SELECT_APP_TO_OPEN_WITH "Select application to open file"
3848 punk_joker 78
#endif
79
 
3444 leency 80
enum {ONLY_SHOW, WITH_REDRAW, ONLY_OPEN}; //OpenDir
81
 
4070 punk_joker 82
#define TITLE "Eolite File Manager v2.0.1"
83
#define ABOUT_TITLE "Eolite v2.0.1"
3363 leency 84
dword col_work    = 0xE4DFE1;
3444 leency 85
dword col_border  = 0x9098B0; //A0A0B8; //0x819FC5;
3363 leency 86
dword col_padding = 0xC8C9C9;
87
dword col_selec   = 0x94AECE;
88
dword col_lpanel  = 0x00699C;
89
 
3434 leency 90
int toolbar_buttons_x[7]={9,46,85,134,167,203};
91
char tmp_disk_del_param[3]="d0";
92
struct path_string { char Item[4096]; };
3363 leency 93
 
4040 punk_joker 94
int active_about=0;
4070 punk_joker 95
word about_window;
4040 punk_joker 96
 
3434 leency 97
llist files;
98
 
99
byte
3363 leency 100
	path[4096],
101
	file_path[4096],
3404 leency 102
	file_name[256],
3434 leency 103
	temp[4096];
104
byte
3439 leency 105
	rename_active=0,
106
	del_active=0,
3434 leency 107
	show_dev_name=1,
108
	sort_num=2,
3441 leency 109
	itdir;
3363 leency 110
 
111
proc_info Form;
112
mouse m;
4057 leency 113
int mouse_dd, scroll_used, scroll_size, sorting_arrow_x, kolibrios_drive;
3434 leency 114
dword buf, off;
115
dword file_mas[6898];
116
int j, i;
4028 leency 117
int action_buf;
3363 leency 118
 
4028 leency 119
edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6};
3434 leency 120
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
3363 leency 121
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
122
 
4042 leency 123
#include "include\copy.h"
124
#include "include\other.h"
3363 leency 125
#include "include\sorting.h"
4042 leency 126
#include "include\icons.h"
3363 leency 127
#include "include\ini.h"
128
#include "include\left_panel.h"
129
#include "include\history.h"
4042 leency 130
#include "include\menu.h"
131
#include "include\about.h"
132
#include "include\open_with.h"
3363 leency 133
 
134
void main()
135
{
3444 leency 136
	word key, id, can_show, can_select, m_selected;
3363 leency 137
 
3434 leency 138
	files.line_h=18;
3363 leency 139
	mem_Init();
3848 punk_joker 140
	if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1);
3434 leency 141
	SystemDiscsGet();
3432 leency 142
	GetIni(1);
3363 leency 143
	if (param)
144
	{
145
		strcpy(#path, #param);
3434 leency 146
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string
3363 leency 147
	}
148
	else
3695 leency 149
	{
3432 leency 150
		strcpy(#path, "/rd/1/");
3695 leency 151
	}
3363 leency 152
	Open_Dir(#path,ONLY_OPEN);
3432 leency 153
	SetEventMask(0x27);
3434 leency 154
	loop() switch(WaitEvent())
3363 leency 155
	{
156
		case evMouse:
3434 leency 157
			IF (del_active) break;
3363 leency 158
			id=GetProcessSlot(Form.ID);
3444 leency 159
			IF (id!=GetActiveProcess()) || (Form.status_window>2) break;
3434 leency 160
			IF (rename_active) { edit_box_mouse stdcall(#edit2); break; }
3363 leency 161
 
162
			m.get();
163
 
3444 leency 164
			if (m.x > files.x) && (m.x < files.x + files.w) && (m.y > files.y) && (m.y < files.y+files.h) && (!can_select)
3363 leency 165
			{
4042 leency 166
				m_selected = m.y - files.y / files.line_h;
3434 leency 167
				if (m.lkm) can_select = 1;
168
				if (m.pkm)
169
				{
170
					can_show = 1;
4042 leency 171
					if (m.y - files.y / files.line_h != files.current) can_select = 1;
3434 leency 172
				}
173
			}
174
 
175
			//select/open file {
176
			if (!m.lkm) && (!m.pkm) && (can_select)
177
			{
178
				can_select = 0;
4042 leency 179
				if (m.y>=files.y)
3695 leency 180
				{
4042 leency 181
					id = m.y - files.y / files.line_h;
3695 leency 182
					if (id!=m_selected)
183
					{
184
						can_show=0;
185
						break;
186
					}
187
					if (files.current!=id)
3876 leency 188
					{
189
						if (id
190
					}
3695 leency 191
					else
192
						Open();
193
				}
3434 leency 194
			};
195
			// } select/open file
196
 
197
			//file menu {