From e841dcfa7038210ba6f72d8bd433567454d2d501 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 11 Jun 2009 16:07:18 +0000 Subject: [PATCH] * added: new language: Chinese translation made by: ... git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@159 e52654a7-88a9-db11-a3e9-0013d4bc506e --- CHANGELOG | 10 +++ README | 2 +- help/index.html | 2 +- src/Makefile | 5 +- src/Makefileportable | 6 ++ src/bigtypes.h | 2 + src/compileconfig.h | 6 +- src/languages.cpp | 163 +++++++++++++++++++++++++++++++++++++++ src/languages.h | 3 +- src/mainwindow.cpp | 16 ++++ src/parsermanager.cpp | 14 ++-- src/parsermanager.h | 2 - src/programresources.cpp | 3 + src/resource.h | 1 + src/resource.rc | 4 +- src/threadcontroller.h | 2 +- 16 files changed, 222 insertions(+), 19 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d33ca44..7d5297d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,13 @@ +Version 0.8.5 prerelease (2009.06.11): + * added: new language: Chinese + translation made by: ... + * changed: version of the TTMath library: 0.8.5 (prerelease) now + +Changes from TTMath 0.8.5 relating to TTCalc: + * fixed: Big::Mod(x) didn't correctly return a carry + and the result was sometimes very big (even greater than x) + + Version 0.8.4 (2009.05.08): * added: new language: Danish translation made by: Rune Bisgaard Vammen diff --git a/README b/README index 3b9698a..c77968a 100644 --- a/README +++ b/README @@ -17,7 +17,7 @@ display values with the base (radix) from two to sixteen. Author: Tomasz Sowa Contact: t.sowa@ttmath.org Licence: BSD (open source) -Interface: English, Polish, Spanish, Danish +Interface: English, Polish, Spanish, Danish, Chinese Project page: http://ttcalc.sourceforge.net/ Bignum library: TTMath http://ttmath.org/ Operating systems: Microsoft Windows 9x/Me/NT/2000/XP/Vista diff --git a/help/index.html b/help/index.html index 2fe8e57..f25cb4e 100644 --- a/help/index.html +++ b/help/index.html @@ -43,7 +43,7 @@ display values with the base (radix) from two to sixteen. Author:Tomasz Sowa Contact:t.sowa@ttmath.org Licence:BSD (open source) -Interface:English, Polish, Spanish, Danish +Interface:English, Polish, Spanish, Danish, Chinese Project page:http://ttcalc.sourceforge.net/ Bignum library:TTMath http://ttmath.org/ Operating systems:Microsoft Windows 9x/Me/NT/2000/XP/Vista diff --git a/src/Makefile b/src/Makefile index f6385da..1c86754 100644 --- a/src/Makefile +++ b/src/Makefile @@ -35,7 +35,6 @@ setup: $(setupdep) clean: rm -f *.o - rm -f *.s rm -f $(name) - rm -f $(helpname) - rm -f $(setupname) + rm -f ../help/$(helpname) + rm -f ../setup/$(setupname) diff --git a/src/Makefileportable b/src/Makefileportable index 4d67040..f876c0c 100644 --- a/src/Makefileportable +++ b/src/Makefileportable @@ -13,3 +13,9 @@ ttcalc: $(o) resource.o: resource.rc windres -DTTCALC_PORTABLE resource.rc resource.o + +clean: + rm -f *.o + rm -f $(name) + rm -f ../help/$(helpname) + diff --git a/src/bigtypes.h b/src/bigtypes.h index 6df94ec..6322edb 100644 --- a/src/bigtypes.h +++ b/src/bigtypes.h @@ -39,6 +39,8 @@ #define bigtypesheader #include "compileconfig.h" + +//#define TTMATH_RELEASE #include diff --git a/src/compileconfig.h b/src/compileconfig.h index a9554a5..064758c 100644 --- a/src/compileconfig.h +++ b/src/compileconfig.h @@ -55,8 +55,8 @@ */ #define TTCALC_MAJOR_VER 0 #define TTCALC_MINOR_VER 8 -#define TTCALC_REVISION_VER 4 -#define TTCALC_PRERELEASE_VER 0 +#define TTCALC_REVISION_VER 5 +#define TTCALC_PRERELEASE_VER 1 @@ -68,6 +68,8 @@ #pragma warning (disable : 4800) #endif +#ifndef _WIN32_IE #define _WIN32_IE 0x0501 +#endif #endif diff --git a/src/languages.cpp b/src/languages.cpp index db52c13..fe329d4 100644 --- a/src/languages.cpp +++ b/src/languages.cpp @@ -211,6 +211,36 @@ void Languages::InitErrorMessagesTab() InsertErrorPair(ttmath::err_too_big_factorial,"Et for stort argument for factorial() funktionen"); +/* + Chinese messages relating to ttmath library +*/ + error_messages_tab.push_back( std::map() ); + + InsertErrorPair(ttmath::err_ok,"确定"); + InsertErrorPair(ttmath::err_nothing_has_read,""); + InsertErrorPair(ttmath::err_unknown_character,"未知字符"); + InsertErrorPair(ttmath::err_unexpected_final_bracket,"意外多余的括弧"); // + InsertErrorPair(ttmath::err_stack_not_clear,"未知字符没有清空"); + InsertErrorPair(ttmath::err_unknown_variable,"未知变量"); + InsertErrorPair(ttmath::err_division_by_zero,"除数不能为零"); + InsertErrorPair(ttmath::err_interrupt,"计算被中断"); + InsertErrorPair(ttmath::err_overflow,"数据溢出"); + InsertErrorPair(ttmath::err_unknown_function,"未知函数"); + InsertErrorPair(ttmath::err_unknown_operator,"未知运算符"); + InsertErrorPair(ttmath::err_unexpected_semicolon_operator,"意外的分号运算符"); + InsertErrorPair(ttmath::err_improper_amount_of_arguments,"错误参数数量"); + InsertErrorPair(ttmath::err_improper_argument,"错误参数"); + InsertErrorPair(ttmath::err_unexpected_end,"意外末端"); + InsertErrorPair(ttmath::err_internal_error,"内部错误"); + + InsertErrorPair(ttmath::err_incorrect_name,"错误的变量名或函数名"); + InsertErrorPair(ttmath::err_incorrect_value,"错误的变量值或函数值"); + InsertErrorPair(ttmath::err_variable_exists,"这个变量已经存在"); + InsertErrorPair(ttmath::err_variable_loop,"变量循环"); + InsertErrorPair(ttmath::err_functions_loop,"函数循环"); + InsertErrorPair(ttmath::err_must_be_only_one_value,"变量或函数必须有返回值"); + InsertErrorPair(ttmath::err_still_calculating,"正在计算..."); + InsertErrorPair(ttmath::err_too_big_factorial,"阶乘函数的参数太大"); } @@ -346,6 +376,7 @@ void Languages::InitGuiMessagesTab() InsertGuiPair(menu_view_lang_polish, "&Polish"); InsertGuiPair(menu_view_lang_spanish, "&Spanish"); InsertGuiPair(menu_view_lang_danish, "&Danish"); + InsertGuiPair(menu_view_lang_chinese, "&Chinese"); InsertGuiPair(menu_view_close_program, "&Close"); InsertGuiPair(menu_edit_undo, "&Undo"); InsertGuiPair(menu_edit_paste, "&Paste"); @@ -477,6 +508,7 @@ void Languages::InitGuiMessagesTab() InsertGuiPair(menu_view_lang_polish, "&Polski"); InsertGuiPair(menu_view_lang_spanish, "&Hiszpa駍ki"); InsertGuiPair(menu_view_lang_danish, "&Du駍ki"); + InsertGuiPair(menu_view_lang_chinese, "&Chi駍ki"); InsertGuiPair(menu_view_close_program, "&Zamknij"); InsertGuiPair(menu_edit_undo, "&Cofnij"); InsertGuiPair(menu_edit_paste, "&Wklej"); @@ -612,6 +644,7 @@ void Languages::InitGuiMessagesTab() InsertGuiPair(menu_view_lang_polish, "&Polaco"); InsertGuiPair(menu_view_lang_spanish, "&Espa駉l"); InsertGuiPair(menu_view_lang_danish, "&Dan閟"); // 'Dan閟' is a correct translation for 'Danish'? + InsertGuiPair(menu_view_lang_chinese, "&Chino"); // 'Chino' is a correct translation for 'Chinese'? InsertGuiPair(menu_view_close_program, "&Close"); InsertGuiPair(menu_edit_undo, "&Deshacer"); InsertGuiPair(menu_edit_paste, "&Pegar"); @@ -743,6 +776,7 @@ void Languages::InitGuiMessagesTab() InsertGuiPair(menu_view_lang_polish, "&Polsk"); InsertGuiPair(menu_view_lang_spanish, "&Spansk"); InsertGuiPair(menu_view_lang_danish, "&Dansk"); + InsertGuiPair(menu_view_lang_chinese, "&Kinesisk"); // 'Kinesisk' is a correct translation for 'Chinese'? InsertGuiPair(menu_view_close_program, "&Afslut"); InsertGuiPair(menu_edit_undo, "&Fortryd"); InsertGuiPair(menu_edit_paste, "&S鎡 ind"); @@ -788,6 +822,135 @@ void Languages::InitGuiMessagesTab() InsertGuiPair(cant_open_project_page, "Projekt siden kunne ikke 錬nes"); + +/* + Chinese gui messages +*/ + gui_messages_tab.push_back( std::map() ); + + InsertGuiPair(button_ok,"确定"); + InsertGuiPair(button_cancel,"取消"); + InsertGuiPair(message_box_caption,"TTCalc"); + + InsertGuiPair(dialog_box_add_variable_caption,"添加新变量"); + InsertGuiPair(dialog_box_edit_variable_caption,"编辑变量"); + InsertGuiPair(dialog_box_add_variable_incorrect_name,"错误的变量名"); + InsertGuiPair(dialog_box_add_variable_incorrect_value,"错误的变量值"); + InsertGuiPair(dialog_box_add_variable_variable_exists,"这个变量已经存在"); + InsertGuiPair(dialog_box_edit_variable_unknown_variable,"表格中没有此变量。可能是内部错误!"); + InsertGuiPair(dialog_box_delete_variable_confirm,"你确定要删除这些变量吗?"); + InsertGuiPair(dialog_box_variable_not_all_deleted,"一些变量不能删除。可能是内部错误!"); + InsertGuiPair(dialog_box_add_function_caption,"添加新函数"); + InsertGuiPair(dialog_box_edit_function_caption,"编辑函数"); + InsertGuiPair(dialog_box_add_function_function_exists,"这个函数已经存在"); + InsertGuiPair(dialog_box_edit_function_unknown_function,"表格中没有此函数。可能是内部错误!"); + InsertGuiPair(dialog_box_delete_function_confirm,"你确定要删除这些函数吗?"); + InsertGuiPair(dialog_box_function_not_all_deleted,"一些函数不能删除。可能是内部错误!"); + InsertGuiPair(dialog_box_add_function_incorrect_name,"错误的函数名"); + + InsertGuiPair(list_variables_header_1,"名称"); + InsertGuiPair(list_variables_header_2,"值"); + InsertGuiPair(list_functions_header_1,"名称"); + InsertGuiPair(list_functions_header_2,"编号"); + InsertGuiPair(list_functions_header_3,"值"); + + InsertGuiPair(button_add,"添加"); + InsertGuiPair(button_edit,"编辑"); + InsertGuiPair(button_delete,"删除"); + InsertGuiPair(button_clear,"C"); + InsertGuiPair(tab_standard,"标准"); + InsertGuiPair(tab_variables,"变量"); + InsertGuiPair(tab_functions,"函数"); + InsertGuiPair(tab_precision,"精度"); + InsertGuiPair(tab_display,"显示"); + InsertGuiPair(tab_convert,"转换"); + + InsertGuiPair(radio_precision_1,"小 - 96 bits 尾数, 32 bits 指数"); + InsertGuiPair(radio_precision_2,"中 - 288 bits 尾数, 64 bits 指数"); + InsertGuiPair(radio_precision_3,"大 - 864 bits 尾数, 128 bits for 指数"); + + + InsertGuiPair(precision_1_info,"(+/-)6.9 e+646457021, 26位有效数字(十进制)"); + InsertGuiPair(precision_2_info,"(+/-)3.4e+2776511644261678652, 85位有效数字"); + InsertGuiPair(precision_3_info,"(+/-)6.7e+51217599719369681875006054625051616609, 258位有效数字"); + + InsertGuiPair(overflow_during_printing,"打印时数据溢出"); + + InsertGuiPair(combo_rounding_none,"无"); + InsertGuiPair(combo_rounding_integer,"整数"); + InsertGuiPair(combo_rounding_to_number,"转换"); + InsertGuiPair(combo_rounding_after_comma,"位数"); + InsertGuiPair(check_remove_zeroes,"去掉尾随零"); + + InsertGuiPair(display_input, "输入"); + InsertGuiPair(display_output, "输出"); + InsertGuiPair(display_rounding, "四舍五入"); + InsertGuiPair(display_always_scientific,"一直"); + InsertGuiPair(display_not_always_scientific,"当指数大于:"); + InsertGuiPair(display_group_scientific, "按科学计数法打印结果"); + InsertGuiPair(display_decimal_point, "小数点"); + InsertGuiPair(display_deg_rad_grad, "sin/cos asin/acos"); + InsertGuiPair(convert_type, "类型"); + InsertGuiPair(convert_input, "输入"); + InsertGuiPair(convert_output, "输出"); + InsertGuiPair(convert_dynamic_output, "自动"); + + InsertGuiPair(menu_view, "&查看"); + InsertGuiPair(menu_edit, "&编辑"); + InsertGuiPair(menu_help, "&帮助"); + InsertGuiPair(menu_language, "&语言"); + InsertGuiPair(menu_view_new_window, "&新窗口"); + InsertGuiPair(menu_view_normal_view, "&普通视图"); + InsertGuiPair(menu_view_compact_view, "&迷你视图"); + InsertGuiPair(menu_view_always_on_top, "&总在最前"); + InsertGuiPair(menu_view_lang_english, "&English"); + InsertGuiPair(menu_view_lang_polish, "&Polish"); + InsertGuiPair(menu_view_lang_spanish, "&Spanish"); + InsertGuiPair(menu_view_lang_danish, "&Danish"); + InsertGuiPair(menu_view_lang_chinese, "&Chinese"); + InsertGuiPair(menu_view_close_program, "&关闭"); + InsertGuiPair(menu_edit_undo, "&取消"); + InsertGuiPair(menu_edit_paste, "&粘贴"); + InsertGuiPair(menu_edit_copy_result, "&复制结果"); + InsertGuiPair(menu_help_help, "&帮助"); + InsertGuiPair(menu_help_project_page, "&软件主页"); + InsertGuiPair(menu_help_about, "&关于"); + InsertGuiPair(cant_init_calculations, "不能初始化计算器模型"); + InsertGuiPair(message_box_error_caption,"TTCalc"); + InsertGuiPair(cant_create_thread, "不能创建两个线程来运算"); + InsertGuiPair(cant_create_main_window, "不能创建应用程序主窗口"); + InsertGuiPair(cant_init_common_controls,"不能初始化通用控件(InitCommonControlsEx)"); + InsertGuiPair(about_text, + "Mathematical calculator TTCalc %d.%d.%d%s%s\r\n" + "Author: Tomasz Sowa\r\n" + "Contact: t.sowa@ttmath.org\r\n" + "Licence: BSD (open source)\r\n" + "Project page: http://ttcalc.sourceforge.net\r\n" + "Bignum library: TTMath %d.%d.%d%s\r\n" + "Programming language: C++\r\n" + "Compiler: %s\r\n" + "%s" // for upx + "\r\n" + "TTCalc uses the TTMath bignum library" + " which can be found at http://sourceforge.net/projects/ttmath\r\n" + "\r\n" +#ifdef TTCALC_PORTABLE + "This is the portable version of the program TTCalc. In this version " + "you can calculate only with one kind of precision (96 bits for the " + "mantissa and 32 bits for the exponent) it's about +/-6.9e+646457021.\r\n" + "\r\n" +#endif + "If you have any questions, advices or interesting ideas about" + " this program or if you want to join to this project as" + " a developer or a programmer feel free to contant with the author." + ); + InsertGuiPair(about_text_portable_version, " portable version"); + InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.03\r\n"); + InsertGuiPair(about_box_title, "关于"); + InsertGuiPair(about_box_button_close, "关闭"); + InsertGuiPair(unknown_error, "发生未知错误"); + InsertGuiPair(cant_find_help, "没有找到帮助文件"); + InsertGuiPair(cant_open_project_page, "不能打开软件主页"); } diff --git a/src/languages.h b/src/languages.h index 992b42e..851693b 100644 --- a/src/languages.h +++ b/src/languages.h @@ -119,6 +119,7 @@ public: menu_view_lang_polish, menu_view_lang_spanish, menu_view_lang_danish, + menu_view_lang_chinese, menu_view_close_program, menu_edit_undo, menu_edit_paste, @@ -147,7 +148,7 @@ public: // (after conversion to 'int' we pass it into the std::vector) enum Country { - en = 0, pl, sp, da + en = 0, pl, sp, da, chn }; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c671ed7..678e2d0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -406,6 +406,7 @@ HMENU menu = GetMenu(hWnd); SetMenuLanguageItem(menu, IDM_LANGUAGE_POLISH, Languages::menu_view_lang_polish); SetMenuLanguageItem(menu, IDM_LANGUAGE_SPANISH, Languages::menu_view_lang_spanish); SetMenuLanguageItem(menu, IDM_LANGUAGE_DANISH, Languages::menu_view_lang_danish); + SetMenuLanguageItem(menu, IDM_LANGUAGE_CHINESE, Languages::menu_view_lang_chinese); SetMenuLanguageItem(menu, IDM_CLOSE_PROGRAM, Languages::menu_view_close_program); SetMenuLanguageItem(menu, IDM_EDIT_UNDO, Languages::menu_edit_undo); SetMenuLanguageItem(menu, IDM_EDIT_PASTE, Languages::menu_edit_paste); @@ -768,6 +769,7 @@ void WmInitMenuPopUpView(HMENU menu) CheckMenuItem(menu, IDM_LANGUAGE_POLISH, MF_BYCOMMAND|MF_UNCHECKED); CheckMenuItem(menu, IDM_LANGUAGE_SPANISH, MF_BYCOMMAND|MF_UNCHECKED); CheckMenuItem(menu, IDM_LANGUAGE_DANISH, MF_BYCOMMAND|MF_UNCHECKED); + CheckMenuItem(menu, IDM_LANGUAGE_CHINESE, MF_BYCOMMAND|MF_UNCHECKED); Languages::Country lang = GetPrgRes()->GetLanguages()->GetCurrentLanguage(); @@ -782,6 +784,9 @@ void WmInitMenuPopUpView(HMENU menu) else if( lang == Languages::da ) CheckMenuItem(menu, IDM_LANGUAGE_DANISH, MF_BYCOMMAND|MF_CHECKED); + else + if( lang == Languages::chn ) + CheckMenuItem(menu, IDM_LANGUAGE_CHINESE, MF_BYCOMMAND|MF_CHECKED); } @@ -1055,6 +1060,16 @@ BOOL WmCommand_LanguageDanish(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa return true; } +BOOL WmCommand_LanguageChinese(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + GetPrgRes()->GetLanguages()->SetCurrentLanguage(Languages::chn); + + SetMenuLanguage(hWnd); + SetOutputEditLanguage(hWnd); + TabWindowFunctions::SetLanguage( GetDlgItem(hWnd, IDC_TAB) ); + +return true; +} @@ -1126,6 +1141,7 @@ void CreateCommandMessagesTable(Messages & cmessages) cmessages.Associate(IDM_LANGUAGE_POLISH, WmCommand_LanguagePolish); cmessages.Associate(IDM_LANGUAGE_SPANISH, WmCommand_LanguageSpanish); cmessages.Associate(IDM_LANGUAGE_DANISH, WmCommand_LanguageDanish); + cmessages.Associate(IDM_LANGUAGE_CHINESE, WmCommand_LanguageChinese); cmessages.Associate(IDM_HELP_HELP, WmHelp); cmessages.Associate(IDM_HELP_PROJECT_PAGE, WmProjectPage); } diff --git a/src/parsermanager.cpp b/src/parsermanager.cpp index 7bcae0a..2cb626c 100644 --- a/src/parsermanager.cpp +++ b/src/parsermanager.cpp @@ -57,19 +57,19 @@ ParserManager::ParserManager() : buffer_len(2048) ParserManager::ParserManager(const ParserManager & p) : buffer_len(p.buffer_len) { - buffer = 0; - base_input = p.base_input; - base_output = p.base_output; + buffer = 0; + base_input = p.base_input; + base_output = p.base_output; always_scientific = p.always_scientific; - when_scientific = p.when_scientific; - rounding = p.rounding; - remove_zeroes = p.remove_zeroes; + when_scientific = p.when_scientific; + rounding = p.rounding; + remove_zeroes = p.remove_zeroes; last_variables_id = p.last_variables_id; last_functions_id = p.last_functions_id; } -ParserManager & ParserManager::operator=(const ParserManager & p) +ParserManager & ParserManager::operator=(const ParserManager &) { buffer = 0; diff --git a/src/parsermanager.h b/src/parsermanager.h index f027f36..51e67b1 100644 --- a/src/parsermanager.h +++ b/src/parsermanager.h @@ -44,9 +44,7 @@ */ #include "resource.h" -#include #include "programresources.h" - #include diff --git a/src/programresources.cpp b/src/programresources.cpp index 7acd1f8..f840d53 100644 --- a/src/programresources.cpp +++ b/src/programresources.cpp @@ -803,6 +803,9 @@ std::string ini_value[20]; SetDisplayRounding( atoi(ini_value[11].c_str()) ); SetRemovingZeroes( bool(atoi(ini_value[15].c_str())) ); + if( ini_value[13] == "4" ) + languages.SetCurrentLanguage(Languages::chn); + else if( ini_value[13] == "3" ) languages.SetCurrentLanguage(Languages::da); else diff --git a/src/resource.h b/src/resource.h index d729d7e..ce8dc8a 100644 --- a/src/resource.h +++ b/src/resource.h @@ -196,6 +196,7 @@ #define IDM_LANGUAGE_POLISH 40011 #define IDM_LANGUAGE_SPANISH 40012 #define IDM_LANGUAGE_DANISH 40013 +#define IDM_LANGUAGE_CHINESE 40014 #define IDM_CLOSE_PROGRAM 40020 #define IDM_EDIT_UNDO 40030 #define IDM_EDIT_PASTE 40031 diff --git a/src/resource.rc b/src/resource.rc index 0029665..916e163 100644 --- a/src/resource.rc +++ b/src/resource.rc @@ -1,7 +1,8 @@ #define APSTUDIO_READONLY_SYMBOLS -#include "afxres.h" +//#include "afxres.h" #undef APSTUDIO_READONLY_SYMBOLS +#include "windows.h" LANGUAGE LANG_POLISH, 1 104 ICON "..\\res\\icon02.ico" @@ -29,6 +30,7 @@ BEGIN MENUITEM "&Polish", 40011 MENUITEM "&Spanish", 40012 MENUITEM "&Danish", 40013 + MENUITEM "&Chinese", 40014 END MENUITEM SEPARATOR MENUITEM "&Close", 40020 diff --git a/src/threadcontroller.h b/src/threadcontroller.h index b154493..2025a20 100644 --- a/src/threadcontroller.h +++ b/src/threadcontroller.h @@ -243,7 +243,7 @@ NewStopCalculating stop_calculating; we make the copy-constructor private so that nobody will be able to make a copy of the one object of this class */ - ThreadController(const ThreadController & c) + ThreadController(const ThreadController &) { } };