revert prior commit, update dicty

git-svn-id: svn://kolibrios.org@6771 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-11-30 16:41:21 +00:00
parent 3a71cb8c97
commit 6e8cb45a14
6 changed files with 229529 additions and 36 deletions

View File

@ -2,40 +2,43 @@
#include "lang.h--" #include "lang.h--"
#endif #endif
#define MEMSIZE 0x8000 #define MEMSIZE 4096 * 1024 * 2
#include "..\lib\strings.h" #include <strings.h>
#include "..\lib\io.h" #include <gui.h>
#include "..\lib\gui.h" #include <obj\box_lib.h>
#include "..\lib\obj\box_lib.h"
#ifdef LANG_RUS #ifdef LANG_RUS
#define WINDOW_TITLE "‘«®¢ à¨ª 2.2" #define WINDOW_TITLE "‘«®¢ à¨ª 2.3"
#define DICTIONARY_NOT_FOUND "‘«®¢ àì ­¥ ­ ©¤¥­"
#define DICTIONARY_LOADED "‘«®¢ àì § £à㦥­" #define DICTIONARY_LOADED "‘«®¢ àì § £à㦥­"
#define WORD_NOT_FOUND "‘«®¢® ­¥ ­ ©¤¥­® ¢ á«®¢ à¥" #define WORD_NOT_FOUND "‘«®¢® ­¥ ­ ©¤¥­® ¢ á«®¢ à¥"
#define ERROR "Žè¨¡ª  #%d" #define ERROR "Žè¨¡ª  #%d"
#else #else
#define WINDOW_TITLE "Dictionary v2.2" #define WINDOW_TITLE "Dictionary v2.3"
#define DICTIONARY_NOT_FOUND "Dictionary not found"
#define DICTIONARY_LOADED "Dictionary loaded" #define DICTIONARY_LOADED "Dictionary loaded"
#define WORD_NOT_FOUND "Word isn't found in the dictionary" #define WORD_NOT_FOUND "Word isn't found in the dictionary"
#define ERROR "Error #%d" #define ERROR "Error #%d"
#endif #endif
proc_info Form; proc_info Form;
char edword[256], search_word[256], translate_result[4096]; char edit_text[256], search_word[256], translate_result[4096];
#define TOPH 45 #define TOPH 45
unsigned char eng_rus[] = FROM "eng_rus.dict""\0";
unsigned char rus_eng[] = FROM "rus_eng.dict""\0";
dword io_buffer_data;
#define TEXT_ENG_RUS "ENG\26RUS" #define TEXT_ENG_RUS "ENG\26RUS"
#define TEXT_RUS_ENG "RUS\26ENG" #define TEXT_RUS_ENG "RUS\26ENG"
#define TEXT_VOCABULARIES "ENG RUS" #define TEXT_VOC_R_E "ENG RUS"
#define TEXT_VOC_E_R "RUS ENG"
#define ENG_RUS 0 #define ENG_RUS 0
#define RUS_ENG 1 #define RUS_ENG 1
#define BUTTON_CHANGE_LANGUAGE 10 #define BUTTON_CHANGE_LANGUAGE 10
int active_dict=2; int active_dict=2;
int mouse_dd; int mouse_dd;
edit_box edit1= {200,13,13,0xffffff,0x94AECE,0xffffff,0x94AECE,0x10000000,248,#edword,#mouse_dd,100000000000010b}; edit_box edit1= {200,13,13,0xffffff,0x94AECE,0xffffff,0x94AECE,0x10000000,248,#edit_text,#mouse_dd,100000000000010b};
void main() void main()
@ -45,8 +48,8 @@ void main()
OpenDictionary(ENG_RUS); OpenDictionary(ENG_RUS);
if (param) if (param)
{ {
strcpy(#edword, #param); strcpy(#edit_text, #param);
edit1.size=edit1.pos=strlen(#edword); edit1.size=edit1.pos=strlen(#edit_text);
Translate(); Translate();
} }
SetEventMask(0x27); SetEventMask(0x27);
@ -86,7 +89,6 @@ void main()
edit_box_draw stdcall(#edit1); edit_box_draw stdcall(#edit1);
DrawWideRectangle(edit1.left-2, edit1.top-2, edit1.width+3, 25, 2, 0xffffff); DrawWideRectangle(edit1.left-2, edit1.top-2, edit1.width+3, 25, 2, 0xffffff);
DrawRectangle(edit1.left-3, edit1.top-3, edit1.width+4, 26, system.color.work_graph); DrawRectangle(edit1.left-3, edit1.top-3, edit1.width+4, 26, system.color.work_graph);
WriteText(Form.width-120, edit1.top+3, 0x90, system.color.work_text, TEXT_VOCABULARIES);
DrawTranslation(); DrawTranslation();
DrawLangButtons(); DrawLangButtons();
} }
@ -97,21 +99,23 @@ void main()
void DrawLangButtons() void DrawLangButtons()
{ {
dword direction; dword direction;
DrawBar(Form.width-120, edit1.top+3, 100, 25, system.color.work);
DefineButton(Form.width-88, edit1.top-4+3, 20, 20, BUTTON_CHANGE_LANGUAGE, system.color.work_button); DefineButton(Form.width-88, edit1.top-4+3, 20, 20, BUTTON_CHANGE_LANGUAGE, system.color.work_button);
if (active_dict == ENG_RUS) direction = "\26"; else direction = "\27"; WriteText(Form.width-82, edit1.top-1+3, 10000001b, system.color.work_button_text, "\26");
WriteText(Form.width-82, edit1.top-1+3, 10000001b, system.color.work_button_text, direction); if (active_dict == ENG_RUS) direction = TEXT_VOC_R_E; else direction = TEXT_VOC_E_R;
WriteText(Form.width-120, edit1.top+3, 0x90, system.color.work_text, direction);
} }
void Translate() void Translate()
{ {
dword translation_start, translation_end; dword translation_start, translation_end;
sprintf(#search_word, "\10%s\13", #edword); sprintf(#search_word, "\10%s\13", #edit_text);
strupr(#search_word); strupr(#search_word);
if (!io.FILES_SIZE) || (!edword) goto _TR_END; if (!edit_text) goto _TR_END;
translation_start = strstr(io.buffer_data, #search_word); translation_start = strstr(io_buffer_data, #search_word);
if (!translation_start) if (!translation_start)
{ {
strcpy(#translate_result, WORD_NOT_FOUND); strcpy(#translate_result, WORD_NOT_FOUND);
@ -130,23 +134,19 @@ void Translate()
void OpenDictionary(dword dict_id) void OpenDictionary(dword dict_id)
{ {
dword res;
if (dict_id==active_dict) return; if (dict_id==active_dict) return;
active_dict = dict_id; active_dict = dict_id;
if (io.buffer_data) free(io.buffer_data); if (active_dict==ENG_RUS)
if (active_dict==ENG_RUS) res=io.read("dictionaries/eng - rus.dict");
if (active_dict==RUS_ENG) res=io.read("dictionaries/rus - eng.dict");
if (!io.buffer_data)
{ {
sprintf(#search_word, ERROR, res); io_buffer_data=#eng_rus;
strcpy(#translate_result, DICTIONARY_NOT_FOUND); strcpy(#search_word, TEXT_ENG_RUS);
} }
else if (active_dict==RUS_ENG)
{ {
if (active_dict==ENG_RUS) strcpy(#search_word, TEXT_ENG_RUS); io_buffer_data=#rus_eng;
if (active_dict==RUS_ENG) strcpy(#search_word, TEXT_RUS_ENG); strcpy(#search_word, TEXT_RUS_ENG);
}
strcpy(#translate_result, DICTIONARY_LOADED); strcpy(#translate_result, DICTIONARY_LOADED);
}
DrawTranslation(); DrawTranslation();
} }

117726
programs/cmm/dicty/eng_rus.dict Normal file

File diff suppressed because it is too large Load Diff

111767
programs/cmm/dicty/rus_eng.dict Normal file

File diff suppressed because it is too large Load Diff

View File

@ -616,8 +616,8 @@ void ______INIT______()
__path_name__(#__BUF_DIR__,I_Path); __path_name__(#__BUF_DIR__,I_Path);
skin_height = GetSkinHeight(); skin_height = GetSkinHeight();
screen.width = GetScreenWidth(); screen.width = GetScreenWidth()+1;
screen.height = GetScreenHeight(); screen.height = GetScreenHeight()+1;
DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay(); DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay();
__generator = GetStartTime(); __generator = GetStartTime();

View File

@ -873,7 +873,7 @@ inline cdecl int sprintf(dword buf, format,...)
} }
END_FUNC_SPRINTF: END_FUNC_SPRINTF:
DSBYTE[buf] = 0; DSBYTE[buf] = 0;
return buf-ret; return ret;
} }
inline signed strcoll(dword text1,text2) inline signed strcoll(dword text1,text2)

View File

@ -4,8 +4,8 @@
#define MEMSIZE 4096*10 #define MEMSIZE 4096*10
#include <io.h> #include "../lib/io.h"
#include <gui.h> #include "../lib/gui.h"
proc_info Form; proc_info Form;