Subversion Repositories Kolibri OS

Rev

Rev 4072 | Rev 4078 | 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
 
4076 leency 82
#define TITLE "Eolite File Manager v2.0.3"
83
#define ABOUT_TITLE "Eolite v2.0.3"
84
dword col_padding, col_selec, col_lpanel;
3363 leency 85
 
3434 leency 86
int toolbar_buttons_x[7]={9,46,85,134,167,203};
87
char tmp_disk_del_param[3]="d0";
88
struct path_string { char Item[4096]; };
3363 leency 89
 
4040 punk_joker 90
int active_about=0;
4070 punk_joker 91
word about_window;
4040 punk_joker 92
 
3434 leency 93
llist files;
94
 
95
byte
3363 leency 96
	path[4096],
97
	file_path[4096],
3404 leency 98
	file_name[256],
3434 leency 99
	temp[4096];
100
byte
3439 leency 101
	rename_active=0,
102
	del_active=0,
3434 leency 103
	show_dev_name=1,
104
	sort_num=2,
3441 leency 105
	itdir;
3363 leency 106
 
107
proc_info Form;
4076 leency 108
system_colors sc;
3363 leency 109
mouse m;
4057 leency 110
int mouse_dd, scroll_used, scroll_size, sorting_arrow_x, kolibrios_drive;
3434 leency 111
dword buf, off;
112
dword file_mas[6898];
113
int j, i;
4028 leency 114
int action_buf;
3363 leency 115
 
4028 leency 116
edit_box edit2 = {250,213,80,0xFFFFCC,0x94AECE,0xFFFFCC,0xffffff,0,248,#file_name,#mouse_dd,64,6,6};
3434 leency 117
PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x0, 0xFFFfff, #path, #temp, 0};
3363 leency 118
PathShow_data FileShow = {0, 56,215, 6, 100, 0, 0, 0x0, 0xFFFfff, #file_name, #temp, 0};
119
 
4042 leency 120
#include "include\copy.h"
121
#include "include\other.h"
3363 leency 122
#include "include\sorting.h"
4042 leency 123
#include "include\icons.h"
3363 leency 124
#include "include\ini.h"
125
#include "include\left_panel.h"
126
#include "include\history.h"
4042 leency 127
#include "include\menu.h"
128
#include "include\about.h"
129
#include "include\open_with.h"
3363 leency 130
 
4076 leency 131
void SetAppColors()
132
{
133
	sc.work = 0xE4DFE1;
134
	sc.work_text = 0;
135
	sc.work_graph  = 0x9098B0; //A0A0B8; //0x819FC5;
136
	sc.work_button_text = 0x000000;
137
	col_padding = 0xC8C9C9;
138
	col_selec   = 0x94AECE;
139
	col_lpanel  = 0x00699C;
140
	/*
141
	sc.get();
142
	for (i=0; i<=14; i++) col_palette[i] = sc.work;
143
	toolbar_pal[0]= goto_about_pal[0] = sc.work = sc.work;
144
	col_lpanel = sc.work_graph;
145
	for (i=0; i<=99; i++) blue_hl_pal[i] = sc.work_graph;
146
	*/
147
}
148
 
3363 leency 149
void main()
150
{
3444 leency 151
	word key, id, can_show, can_select, m_selected;
3363 leency 152
 
3434 leency 153
	files.line_h=18;
3363 leency 154
	mem_Init();
3848 punk_joker 155
	if (load_dll2(boxlib, #box_lib_init,0)!=0) notify(ERROR_1);
3434 leency 156
	SystemDiscsGet();
4076 leency 157
	GetIni(1);
158
	SetAppColors();
3363 leency 159
	if (param)
160
	{
161
		strcpy(#path, #param);
3434 leency 162
		if (path[strlen(#path)-1]!='/') chrcat(#path, '/'); //add "/" to the end of the string
3363 leency 163
	}
164
	else
3695 leency 165
	{
3432 leency 166
		strcpy(#path, "/rd/1/");
3695 leency 167
	}
3363 leency 168
	Open_Dir(#path,ONLY_OPEN);
3432 leency 169
	SetEventMask(0x27);
3434 leency 170
	loop() switch(WaitEvent())
3363 leency 171
	{
172
		case evMouse:
3434 leency 173
			IF (del_active) break;
3363 leency 174
			id=GetProcessSlot(Form.ID);
3444 leency 175
			IF (id!=GetActiveProcess()) || (Form.status_window>2) break;
3434 leency 176
			IF (rename_active) { edit_box_mouse stdcall(#edit2); break; }
3363 leency 177
 
178
			m.get();
179
 
3444 leency 180
			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 181
			{
4042 leency 182
				m_selected = m.y - files.y / files.line_h;
3434 leency 183
				if (m.lkm) can_select = 1;
184
				if (m.pkm)
185
				{
186
					can_show = 1;
4042 leency 187
					if (m.y - files.y / files.line_h != files.current) can_select = 1;
3434 leency 188
				}
189
			}
190
 
191
			//select/open file {
192
			if (!m.lkm) && (!m.pkm) && (can_select)
193
			{
194
				can_select = 0;
4042 leency 195
				if (m.y>=files.y)
3695 leency 196
				{
4042 leency 197
					id = m.y - files.y / files.line_h;
3695 leency 198