Subversion Repositories Kolibri OS

Rev

Rev 3991 | Rev 5499 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3991 Rev 5423
Line 7... Line 7...
7
#include "..\lib\dll.h"
7
#include "..\lib\dll.h"
8
#include "..\lib\lib.obj\box_lib.h"
8
#include "..\lib\lib.obj\box_lib.h"
Line 9... Line 9...
9
 
9
 
10
 
10
 
11
unsigned char speaker[23*40*3]= FROM "speaker.raw";
11
unsigned char speaker[23*40*3]= FROM "speaker.raw";
12
char title[]= "Dictionary v1.31";
12
char title[]= "Dictionary v1.32";
13
char direction[] = "Translate direction:";
13
char direction[] = "Translate direction:";
14
char translate_caption[] = "Translate";
14
char translate_caption[] = "Translate";
15
char dict_not_found[] = "Dictionary not found";
15
char dict_not_found[] = "Dictionary not found";
Line 16... Line 16...
16
char dict_opened[] = "Dictionary loaded";
16
char dict_opened[] = "Dictionary loaded";
17
char empty_word[] = "Type a word to translate";
17
char empty_word[] = "Type a word to translate";
Line 18... Line 18...
18
 
18
 
-
 
19
 
19
 
20
system_colors sc;
20
system_colors sc;
21
proc_info Form;
21
proc_info Form;
22
 
22
 
23
char edword[256], search_word[256], translate_result[4096], cur_dict[256];
Line 34... Line 35...
34
{   
35
{   
35
	int id, key;
36
	int id, key;
36
   	mem_Init();
37
   	mem_Init();
37
	if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Error while loading GUI library /sys/lib/boxlib.obj");
38
	if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Error while loading GUI library /sys/lib/boxlib.obj");
Line 38... Line -...
38
	
-
 
39
	program_path[strrchr(#program_path, '/')] = 0;
-
 
40
	strcpy(#dict_folder, #program_path);
39
 
41
	strcat(#dict_folder, DICT_DIRECROTY);
-
 
42
	SetCurDir(#dict_folder);
40
	dict_folder = abspath(DICT_DIRECROTY);
Line 43... Line 41...
43
	OpenDictionary(0);
41
	OpenDictionary(0);
44
	
42
	
45
	if (param)
43
	if (param)
Line 93... Line 91...
93
			}
91
			}
Line 94... Line 92...
94
			
92
			
95
			EAX=key<<8;
93
			EAX=key<<8;
Line 96... Line 94...
96
			edit_box_key stdcall(#edit1);
94
			edit_box_key stdcall(#edit1);
-
 
95
			
97
			
96
			// Translate();
Line 98... Line 97...
98
			//LiveSearch();
97
			// DrawTranslation();
99
			break;
98
			break;
100
			
99
			
Line 198... Line 197...
198
}
197
}
Line 199... Line 198...
199
 
198
 
200
 
199
 
-
 
200
void OpenDictionary(dword fileid)
201
void OpenDictionary(dword fileid)
201
{
202
{
202
	char open_file_path[4096];
203
	KillProcess(speaker_id);
203
	KillProcess(speaker_id);
204
	if (!dir_buf) ShowDictList();
204
	if (!dir_buf) ShowDictList();
205
	if (!dir_buf) strcpy(#cur_dict, "none");
205
	if (!dir_buf) strcpy(#cur_dict, "none");
Line 206... Line 206...
206
	else strcpy(#cur_dict, fileid*304+dir_buf+72);
206
	else strcpy(#cur_dict, fileid*304+dir_buf+72);
207
	fsize = ESDWORD[fileid*304 + dir_buf+64];
207
	fsize = ESDWORD[fileid*304 + dir_buf+64];
-
 
208
 
-
 
209
	free(file_buf);
-
 
210
	file_buf = malloc(fsize);
208
 
211
	strcpy(#open_file_path, dict_folder);
209
	free(file_buf);
212
	strcat(#open_file_path, "/");
210
	file_buf = malloc(fsize);
213
	strcat(#open_file_path, #cur_dict);
211
	ReadFile(0, fsize, file_buf, #cur_dict);
214
	ReadFile(0, fsize, file_buf, #open_file_path);
212
	IF (EAX<>0)
215
	IF (EAX<>0)
213
	{
216
	{
214
		fsize = 0;
217
		fsize = 0;
215
		strcpy(#search_word, "Error #");
-
 
216
		strcat(#search_word, itoa(EAX));
-
 
217
		strcpy(#translate_result, #dict_not_found);
218
		strcpy(#search_word, "Error #");
-
 
219
		strcat(#search_word, itoa(EAX));
-
 
220
		strcpy(#translate_result, #dict_not_found);
218
		DrawWindowContent();
221
	}
219
		return;
222
	else
-
 
223
	{
220
	}	
224
		strcpy(#search_word, #cur_dict);
221
	strcpy(#search_word, #cur_dict);
225
		strcpy(#translate_result, #dict_opened);
Line 222... Line 226...
222
	strcpy(#translate_result, #dict_opened);
226
	}
223
	DrawWindowContent();
227
	DrawWindowContent();	
224
}
228
}
Line 225... Line 229...
225
 
229
 
226
 
230
 
227
void ShowDictList()
231
void ShowDictList()
228
{
232
{
229
	int j, fcount, error;
233
	int j, fcount, error;
230
	
234
	
231
	free(dir_buf);
235
	free(dir_buf);