2 Commits
0.9.1 ... 0.8.7

Author SHA1 Message Date
dc56087444 merged from trunk: Swedish language, support for TTMath 0.9.0
changed version: 0.8.7 now


git-svn-id: svn://ttmath.org/publicrep/ttcalc/branches/0.8.x@197 e52654a7-88a9-db11-a3e9-0013d4bc506e
2009-09-16 17:51:26 +00:00
eda79cdbe6 creating 0.8.x branch (from trunk)
git-svn-id: svn://ttmath.org/publicrep/ttcalc/branches/0.8.x@180 e52654a7-88a9-db11-a3e9-0013d4bc506e
2009-07-16 18:07:39 +00:00
16 changed files with 390 additions and 174 deletions

View File

@@ -1,3 +1,13 @@
Version 0.8.7 (2009.09.16):
* added: new language: Swedish
translation made by: Lars 'B<>fvert' G<>fvert <lars.gafvert at gmail dot com>
* changed: version of the TTMath library: 0.9.0 prerelease now
Changes from TTMath 0.9.0 prerelease relating to TTCalc:
* added: gamma() function
* changed: factorial() function is very fast now
Version 0.8.6 (2009.06.30): Version 0.8.6 (2009.06.30):
* added: new language: Russian * added: new language: Russian
translation made by: Vladimir Gladilovich <vdgladilovich at gmail dot com> translation made by: Vladimir Gladilovich <vdgladilovich at gmail dot com>

2
README
View File

@@ -17,7 +17,7 @@ display values with the base (radix) from two to sixteen.
Author: Tomasz Sowa Author: Tomasz Sowa
Contact: t.sowa@ttmath.org Contact: t.sowa@ttmath.org
Licence: BSD (open source) Licence: BSD (open source)
Interface: English, Polish, Spanish, Danish, Chinese, Russian Interface: English, Polish, Spanish, Danish, Chinese, Russian, Swedish
Project page: http://ttcalc.sourceforge.net/ Project page: http://ttcalc.sourceforge.net/
Bignum library: TTMath http://www.ttmath.org/ Bignum library: TTMath http://www.ttmath.org/
Operating systems: Microsoft Windows 9x/Me/NT/2000/XP/Vista Operating systems: Microsoft Windows 9x/Me/NT/2000/XP/Vista

View File

@@ -44,7 +44,7 @@ display values with the base (radix) from two to sixteen.
<tr><td>Author:</td><td>Tomasz Sowa</td></tr> <tr><td>Author:</td><td>Tomasz Sowa</td></tr>
<tr><td>Contact:</td><td>t.sowa@ttmath.org</td></tr> <tr><td>Contact:</td><td>t.sowa@ttmath.org</td></tr>
<tr><td>Licence:</td><td>BSD (open source)</td></tr> <tr><td>Licence:</td><td>BSD (open source)</td></tr>
<tr><td>Interface:</td><td>English, Polish, Spanish, Danish, Chinese, Russian</td></tr> <tr><td>Interface:</td><td>English, Polish, Spanish, Danish, Chinese, Russian, Swedish</td></tr>
<tr><td>Project page:</td><td><a href="http://ttcalc.sourceforge.net/">http://ttcalc.sourceforge.net/</a></td></tr> <tr><td>Project page:</td><td><a href="http://ttcalc.sourceforge.net/">http://ttcalc.sourceforge.net/</a></td></tr>
<tr><td>Bignum library:</td><td>TTMath <a href="http://ttmath.org/">http://www.ttmath.org/</a></td></tr> <tr><td>Bignum library:</td><td>TTMath <a href="http://ttmath.org/">http://www.ttmath.org/</a></td></tr>
<tr><td>Operating systems:</td><td>Microsoft Windows 9x/Me/NT/2000/XP/Vista</td></tr> <tr><td>Operating systems:</td><td>Microsoft Windows 9x/Me/NT/2000/XP/Vista</td></tr>

View File

@@ -9,6 +9,7 @@
<param name="Keyword" value="sqrt"> <param name="Keyword" value="sqrt">
<param name="Keyword" value="root"> <param name="Keyword" value="root">
<param name="Keyword" value="factorial"> <param name="Keyword" value="factorial">
<param name="Keyword" value="gamma">
<param name="Keyword" value="abs"> <param name="Keyword" value="abs">
<param name="Keyword" value="sgn"> <param name="Keyword" value="sgn">
<param name="Keyword" value="mod"> <param name="Keyword" value="mod">
@@ -40,9 +41,12 @@ root(8;3)=2<br>
root(-8;3)=-2 root(-8;3)=-2
</dd> </dd>
<dt>factorial(x)</dt> <dt>factorial(n)</dt>
<dd>The factorial function<br>factorial(6)=1*2*3*4*5*6=720</dd> <dd>The factorial function<br>factorial(6)=1*2*3*4*5*6=720</dd>
<dt>gamma(x)</dt>
<dd>The gamma function<br>gamma(45.89)=7,861174...e+55</dd>
<dt>abs(x)</dt> <dt>abs(x)</dt>
<dd>The absolute value of x<br>abs(-10)=10</dd> <dd>The absolute value of x<br>abs(-10)=10</dd>

View File

@@ -3,8 +3,8 @@
[Setup] [Setup]
AppName=TTCalc AppName=TTCalc
AppVerName=TTCalc 0.8.6 AppVerName=TTCalc 0.8.7
AppVersion=0.8.6 AppVersion=0.8.7
AppPublisher=Tomasz Sowa AppPublisher=Tomasz Sowa
AppPublisherURL=http://ttcalc.sourceforge.net AppPublisherURL=http://ttcalc.sourceforge.net
AppSupportURL=http://ttcalc.sourceforge.net AppSupportURL=http://ttcalc.sourceforge.net
@@ -28,6 +28,7 @@ Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl" Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
Name: "chinese"; MessagesFile: "compiler:Languages\ChineseSimp-12-5.1.11.isl" Name: "chinese"; MessagesFile: "compiler:Languages\ChineseSimp-12-5.1.11.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl" Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "swedish"; MessagesFile: "compiler:Languages\Swedish.isl"
[InstallDelete] [InstallDelete]
; prior to 0.8.3 we were using mingwm10.dll (now it is not needed and will be deleted if exists) ; prior to 0.8.3 we were using mingwm10.dll (now it is not needed and will be deleted if exists)

View File

@@ -58,7 +58,6 @@
typedef ttmath::Big<4,27> TTMathBig3; typedef ttmath::Big<4,27> TTMathBig3;
typedef TTMathBig3 TTMathBigMax; typedef TTMathBig3 TTMathBigMax;
#else #else
/* portable */ /* portable */

View File

@@ -55,7 +55,7 @@
*/ */
#define TTCALC_MAJOR_VER 0 #define TTCALC_MAJOR_VER 0
#define TTCALC_MINOR_VER 8 #define TTCALC_MINOR_VER 8
#define TTCALC_REVISION_VER 6 #define TTCALC_REVISION_VER 7
#define TTCALC_PRERELEASE_VER 0 #define TTCALC_PRERELEASE_VER 0

View File

@@ -109,7 +109,7 @@ void Languages::InitErrorMessagesTab()
InsertErrorPair(ttmath::err_functions_loop,"There's a recurrence between functions"); InsertErrorPair(ttmath::err_functions_loop,"There's a recurrence between functions");
InsertErrorPair(ttmath::err_must_be_only_one_value,"Variables or functions must return only one value"); InsertErrorPair(ttmath::err_must_be_only_one_value,"Variables or functions must return only one value");
InsertErrorPair(ttmath::err_still_calculating,"Calculating..."); InsertErrorPair(ttmath::err_still_calculating,"Calculating...");
InsertErrorPair(ttmath::err_too_big_factorial,"A too big argument for the factorial() function"); //InsertErrorPair(ttmath::err_too_big_factorial,"A too big argument for the factorial() function");
@@ -143,7 +143,7 @@ void Languages::InitErrorMessagesTab()
InsertErrorPair(ttmath::err_functions_loop,"Pomi<EFBFBD>dzy funkcjami zachodzi wywo<77>anie rekurencyjne"); InsertErrorPair(ttmath::err_functions_loop,"Pomi<EFBFBD>dzy funkcjami zachodzi wywo<77>anie rekurencyjne");
InsertErrorPair(ttmath::err_must_be_only_one_value,"Zmienne albo funkcje mog<6F> posiada<64> (zwraca<63>) tylko jedn<64> warto<74><6F>"); InsertErrorPair(ttmath::err_must_be_only_one_value,"Zmienne albo funkcje mog<6F> posiada<64> (zwraca<63>) tylko jedn<64> warto<74><6F>");
InsertErrorPair(ttmath::err_still_calculating,"Obliczanie..."); InsertErrorPair(ttmath::err_still_calculating,"Obliczanie...");
InsertErrorPair(ttmath::err_too_big_factorial,"Zbyt du<64>y argument dla funkcji factorial()"); //InsertErrorPair(ttmath::err_too_big_factorial,"Zbyt du<64>y argument dla funkcji factorial()");
/* /*
@@ -176,7 +176,7 @@ void Languages::InitErrorMessagesTab()
InsertErrorPair(ttmath::err_functions_loop,"Recurrencia entre funciones"); InsertErrorPair(ttmath::err_functions_loop,"Recurrencia entre funciones");
InsertErrorPair(ttmath::err_must_be_only_one_value,"Variables o funciones solo pueden retornar un valor"); InsertErrorPair(ttmath::err_must_be_only_one_value,"Variables o funciones solo pueden retornar un valor");
InsertErrorPair(ttmath::err_still_calculating,"Calculando ..."); InsertErrorPair(ttmath::err_still_calculating,"Calculando ...");
InsertErrorPair(ttmath::err_too_big_factorial,"Argumento muy grande para la funcion factorial()"); //InsertErrorPair(ttmath::err_too_big_factorial,"Argumento muy grande para la funcion factorial()");
/* /*
@@ -208,7 +208,7 @@ void Languages::InitErrorMessagesTab()
InsertErrorPair(ttmath::err_functions_loop,"Der er en gentagelse mellem funktioner"); InsertErrorPair(ttmath::err_functions_loop,"Der er en gentagelse mellem funktioner");
InsertErrorPair(ttmath::err_must_be_only_one_value,"Variabler eller funktioner skal kun returnere <20>n v<>rdi"); InsertErrorPair(ttmath::err_must_be_only_one_value,"Variabler eller funktioner skal kun returnere <20>n v<>rdi");
InsertErrorPair(ttmath::err_still_calculating,"Regner..."); InsertErrorPair(ttmath::err_still_calculating,"Regner...");
InsertErrorPair(ttmath::err_too_big_factorial,"Et for stort argument for factorial() funktionen"); //InsertErrorPair(ttmath::err_too_big_factorial,"Et for stort argument for factorial() funktionen");
/* /*
@@ -240,7 +240,7 @@ void Languages::InitErrorMessagesTab()
InsertErrorPair(ttmath::err_functions_loop,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD>"); InsertErrorPair(ttmath::err_functions_loop,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD>");
InsertErrorPair(ttmath::err_must_be_only_one_value,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD>ֵ"); InsertErrorPair(ttmath::err_must_be_only_one_value,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><EFBFBD><EFBFBD>ֵ");
InsertErrorPair(ttmath::err_still_calculating,"<EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><EFBFBD><EFBFBD>..."); InsertErrorPair(ttmath::err_still_calculating,"<EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><EFBFBD><EFBFBD>...");
InsertErrorPair(ttmath::err_too_big_factorial,"<EFBFBD>׳˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>̫<EFBFBD><EFBFBD>"); //InsertErrorPair(ttmath::err_too_big_factorial,"<EFBFBD>׳˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD>̫<EFBFBD><EFBFBD>");
/* /*
@@ -272,12 +272,50 @@ void Languages::InitErrorMessagesTab()
InsertErrorPair(ttmath::err_functions_loop,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); InsertErrorPair(ttmath::err_functions_loop,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
InsertErrorPair(ttmath::err_must_be_only_one_value,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); InsertErrorPair(ttmath::err_must_be_only_one_value,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
InsertErrorPair(ttmath::err_still_calculating,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..."); InsertErrorPair(ttmath::err_still_calculating,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...");
InsertErrorPair(ttmath::err_too_big_factorial,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> factorial()"); //InsertErrorPair(ttmath::err_too_big_factorial,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> factorial()");
/*
swedish messages relating to ttmath library
*/
error_messages_tab.push_back( std::map<ttmath::ErrorCode, std::string>() );
InsertErrorPair(ttmath::err_ok,"ok");
InsertErrorPair(ttmath::err_nothing_has_read,"");
InsertErrorPair(ttmath::err_unknown_character,"Ett ok<6F>nt tecken");
InsertErrorPair(ttmath::err_unexpected_final_bracket,"En of<6F>rv<72>ntat slutlig klass");
InsertErrorPair(ttmath::err_stack_not_clear,"Ett ok<6F>nt tecken saknas");
InsertErrorPair(ttmath::err_unknown_variable,"En ok<6F>nd variabel");
InsertErrorPair(ttmath::err_division_by_zero,"Division med noll");
InsertErrorPair(ttmath::err_interrupt,"Ber<EFBFBD>kningen har avbrutits");
InsertErrorPair(ttmath::err_overflow,"Overflow fel");
InsertErrorPair(ttmath::err_unknown_function,"En ok<6F>nd funktion");
InsertErrorPair(ttmath::err_unknown_operator,"En ok<6F>nd operator");
InsertErrorPair(ttmath::err_unexpected_semicolon_operator,"En ok<6F>nd semikolonoperator");
InsertErrorPair(ttmath::err_improper_amount_of_arguments,"Felaktig m<>ngd argument");
InsertErrorPair(ttmath::err_improper_argument,"Ogiltig argumentation");
InsertErrorPair(ttmath::err_unexpected_end,"Of<EFBFBD>rv<EFBFBD>ntat fel");
InsertErrorPair(ttmath::err_internal_error,"Ett internt fel");
InsertErrorPair(ttmath::err_incorrect_name,"Ogiltigt namn f<>r en variabel eller funktion");
InsertErrorPair(ttmath::err_incorrect_value,"Ogiltigt v<>rde f<>r en variabel eller funktion");
InsertErrorPair(ttmath::err_variable_exists,"Denna variabel existerar redan");
InsertErrorPair(ttmath::err_variable_loop,"Det <20>r en upprepepning mellan variabler");
InsertErrorPair(ttmath::err_functions_loop,"Det <20>r en upprepning mellan funktioner");
InsertErrorPair(ttmath::err_must_be_only_one_value,"Variabler eller funktioner skall kunna avge ett v<>rde");
InsertErrorPair(ttmath::err_still_calculating,"R<EFBFBD>knar b<>vrar...");
//InsertErrorPair(ttmath::err_too_big_factorial,"Ett f<>r stort argument f<>r factorial() funktionen");
} }
// for gui messages // for gui messages
@@ -411,6 +449,7 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(menu_view_lang_danish, "&Danish"); InsertGuiPair(menu_view_lang_danish, "&Danish");
InsertGuiPair(menu_view_lang_chinese, "&Chinese"); InsertGuiPair(menu_view_lang_chinese, "&Chinese");
InsertGuiPair(menu_view_lang_russian, "&Russian"); InsertGuiPair(menu_view_lang_russian, "&Russian");
InsertGuiPair(menu_view_lang_swedish, "&Swedish");
InsertGuiPair(menu_view_close_program, "&Close"); InsertGuiPair(menu_view_close_program, "&Close");
InsertGuiPair(menu_edit_undo, "&Undo"); InsertGuiPair(menu_edit_undo, "&Undo");
InsertGuiPair(menu_edit_paste, "&Paste"); InsertGuiPair(menu_edit_paste, "&Paste");
@@ -544,6 +583,7 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(menu_view_lang_danish, "&Du<44>ski"); InsertGuiPair(menu_view_lang_danish, "&Du<44>ski");
InsertGuiPair(menu_view_lang_chinese, "&Chi<68>ski"); InsertGuiPair(menu_view_lang_chinese, "&Chi<68>ski");
InsertGuiPair(menu_view_lang_russian, "&Russian"); InsertGuiPair(menu_view_lang_russian, "&Russian");
InsertGuiPair(menu_view_lang_swedish, "&Szwedzki");
InsertGuiPair(menu_view_close_program, "&Zamknij"); InsertGuiPair(menu_view_close_program, "&Zamknij");
InsertGuiPair(menu_edit_undo, "&Cofnij"); InsertGuiPair(menu_edit_undo, "&Cofnij");
InsertGuiPair(menu_edit_paste, "&Wklej"); InsertGuiPair(menu_edit_paste, "&Wklej");
@@ -681,6 +721,7 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(menu_view_lang_danish, "&Dan<61>s"); // 'Dan<61>s' is a correct translation for 'Danish'? InsertGuiPair(menu_view_lang_danish, "&Dan<61>s"); // 'Dan<61>s' is a correct translation for 'Danish'?
InsertGuiPair(menu_view_lang_chinese, "&Chino"); // 'Chino' is a correct translation for 'Chinese'? InsertGuiPair(menu_view_lang_chinese, "&Chino"); // 'Chino' is a correct translation for 'Chinese'?
InsertGuiPair(menu_view_lang_russian, "&Russian"); InsertGuiPair(menu_view_lang_russian, "&Russian");
InsertGuiPair(menu_view_lang_swedish, "&Swedish");
InsertGuiPair(menu_view_close_program, "&Close"); InsertGuiPair(menu_view_close_program, "&Close");
InsertGuiPair(menu_edit_undo, "&Deshacer"); InsertGuiPair(menu_edit_undo, "&Deshacer");
InsertGuiPair(menu_edit_paste, "&Pegar"); InsertGuiPair(menu_edit_paste, "&Pegar");
@@ -814,6 +855,7 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(menu_view_lang_danish, "&Dansk"); InsertGuiPair(menu_view_lang_danish, "&Dansk");
InsertGuiPair(menu_view_lang_chinese, "&Kinesisk"); // 'Kinesisk' is a correct translation for 'Chinese'? InsertGuiPair(menu_view_lang_chinese, "&Kinesisk"); // 'Kinesisk' is a correct translation for 'Chinese'?
InsertGuiPair(menu_view_lang_russian, "&Russian"); InsertGuiPair(menu_view_lang_russian, "&Russian");
InsertGuiPair(menu_view_lang_swedish, "S&wedish");
InsertGuiPair(menu_view_close_program, "&Afslut"); InsertGuiPair(menu_view_close_program, "&Afslut");
InsertGuiPair(menu_edit_undo, "&Fortryd"); InsertGuiPair(menu_edit_undo, "&Fortryd");
InsertGuiPair(menu_edit_paste, "&S<>t ind"); InsertGuiPair(menu_edit_paste, "&S<>t ind");
@@ -946,6 +988,7 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(menu_view_lang_danish, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); InsertGuiPair(menu_view_lang_danish, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
InsertGuiPair(menu_view_lang_chinese, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); InsertGuiPair(menu_view_lang_chinese, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
InsertGuiPair(menu_view_lang_russian, "&Russian"); InsertGuiPair(menu_view_lang_russian, "&Russian");
InsertGuiPair(menu_view_lang_swedish, "&Swedish");
InsertGuiPair(menu_view_close_program, "&<26>ر<EFBFBD>"); InsertGuiPair(menu_view_close_program, "&<26>ر<EFBFBD>");
InsertGuiPair(menu_edit_undo, "<><C8A1>"); InsertGuiPair(menu_edit_undo, "<><C8A1>");
InsertGuiPair(menu_edit_paste, "<><D5B3>"); InsertGuiPair(menu_edit_paste, "<><D5B3>");
@@ -1076,6 +1119,7 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(menu_view_lang_danish, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); InsertGuiPair(menu_view_lang_danish, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
InsertGuiPair(menu_view_lang_chinese, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); InsertGuiPair(menu_view_lang_chinese, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
InsertGuiPair(menu_view_lang_russian, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); InsertGuiPair(menu_view_lang_russian, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
InsertGuiPair(menu_view_lang_swedish, "&Swedish");
InsertGuiPair(menu_view_close_program, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); InsertGuiPair(menu_view_close_program, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
InsertGuiPair(menu_edit_undo, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); InsertGuiPair(menu_edit_undo, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
InsertGuiPair(menu_edit_paste, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); InsertGuiPair(menu_edit_paste, "&<26><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
@@ -1120,6 +1164,140 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(cant_find_help, "<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); InsertGuiPair(cant_find_help, "<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
InsertGuiPair(cant_open_project_page, "<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); InsertGuiPair(cant_open_project_page, "<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
/*
swedish gui messages
*/
gui_messages_tab.push_back( std::map<GuiMsg, std::string>() );
InsertGuiPair(button_ok,"Ok");
InsertGuiPair(button_cancel,"Avbryt");
InsertGuiPair(message_box_caption,"TTCalc");
InsertGuiPair(dialog_box_add_variable_caption,"L<EFBFBD>gg till en ny variabel");
InsertGuiPair(dialog_box_edit_variable_caption,"Redigera en variabel");
InsertGuiPair(dialog_box_add_variable_incorrect_name,"Ogiltigt namn f<>r variabel");
InsertGuiPair(dialog_box_add_variable_incorrect_value,"Ogiltigt v<>rde f<>r variabel");
InsertGuiPair(dialog_box_add_variable_variable_exists,"Denna variabel finns redan");
InsertGuiPair(dialog_box_edit_variable_unknown_variable,"Denna variabel saknas i tabellen. F<>rmodligen ett internt fel!");
InsertGuiPair(dialog_box_delete_variable_confirm,"Vill du f<>rg<72>ra dessa variabler?");
InsertGuiPair(dialog_box_variable_not_all_deleted,"N<EFBFBD>gra variabler gick ej att ta k<>l p<>. Det m<>ste vara ett internt fel!");
InsertGuiPair(dialog_box_add_function_caption,"L<EFBFBD>gg till en ny funktion");
InsertGuiPair(dialog_box_edit_function_caption,"Redigera en funktion");
InsertGuiPair(dialog_box_add_function_function_exists,"Denna funktion finns redan");
InsertGuiPair(dialog_box_edit_function_unknown_function,"Denna funktion saknas i tabellen. F<>rmodligen ett internt fel!");
InsertGuiPair(dialog_box_delete_function_confirm,"Vill du f<>rg<72>ra dessa funktioner?");
InsertGuiPair(dialog_box_function_not_all_deleted,"N<EFBFBD>gra funktioner gick inte att f<>rg<72>ra. Jag tror vi har att g<>ra med ett internt fel!");
InsertGuiPair(dialog_box_add_function_incorrect_name,"Ogiltigt namn f<>r funktionen");
InsertGuiPair(list_variables_header_1,"Namn");
InsertGuiPair(list_variables_header_2,"V<EFBFBD>rde");
InsertGuiPair(list_functions_header_1,"Namn");
InsertGuiPair(list_functions_header_2,"Param.");
InsertGuiPair(list_functions_header_3,"V<EFBFBD>rde");
InsertGuiPair(button_add,"L<EFBFBD>gga till");
InsertGuiPair(button_edit,"Redigera");
InsertGuiPair(button_delete,"F<EFBFBD>rg<EFBFBD>ra");
InsertGuiPair(button_clear,"C");
InsertGuiPair(tab_standard,"Standard");
InsertGuiPair(tab_variables,"Variabler");
InsertGuiPair(tab_functions,"Funktioner");
InsertGuiPair(tab_precision,"Precision");
InsertGuiPair(tab_display,"Visning");
InsertGuiPair(tab_convert,"Konvertera");
InsertGuiPair(radio_precision_1,"Liten - 96 bitar f<>r mantissan, 32 bitar f<>r exponenten");
InsertGuiPair(radio_precision_2,"Mellan - 288 bitar f<>r mantissan, 64 bitar f<>r exponenten");
InsertGuiPair(radio_precision_3,"Stor - 864 bitar f<>r mantissan, 128 bitar f<>r exponenten");
InsertGuiPair(precision_1_info,"(+/-)6.9 e+646457021, 26 giltiga siffror (decimaler)");
InsertGuiPair(precision_2_info,"(+/-)3.4e+2776511644261678652, 85 giltiga siffror");
InsertGuiPair(precision_3_info,"(+/-)6.7e+51217599719369681875006054625051616609, 258 siffror");
InsertGuiPair(overflow_during_printing,"Overflow under printning");
InsertGuiPair(combo_rounding_none,"Ingen");
InsertGuiPair(combo_rounding_integer,"till heltal");
InsertGuiPair(combo_rounding_to_number,"till");
InsertGuiPair(combo_rounding_after_comma,"siffror(cifre)");
InsertGuiPair(check_remove_zeroes,"Radera sista <20>verfl<66>diga nollor");
InsertGuiPair(display_input, "Input");
InsertGuiPair(display_output, "Output");
InsertGuiPair(display_rounding, "Avrundning");
InsertGuiPair(display_always_scientific,"Alltid");
InsertGuiPair(display_not_always_scientific,"N<EFBFBD>r exponenten <20>r st<73>rre <20>n:");
InsertGuiPair(display_group_scientific, "Visa resultatet som vetenskapligt v<>rde");
InsertGuiPair(display_decimal_point, "Decimalpunkt");
InsertGuiPair(display_deg_rad_grad, "sin/cos asin/acos");
InsertGuiPair(convert_type, "Type");
InsertGuiPair(convert_input, "Input");
InsertGuiPair(convert_output, "Output");
InsertGuiPair(convert_dynamic_output, "Auto prefix");
InsertGuiPair(menu_view, "&Visa");
InsertGuiPair(menu_edit, "&Redigera");
InsertGuiPair(menu_help, "&Hj<48>lp");
InsertGuiPair(menu_language, "&Spr<70>g");
InsertGuiPair(menu_view_new_window, "&Nytt f<>nster");
InsertGuiPair(menu_view_normal_view, "No&rmal visning");
InsertGuiPair(menu_view_compact_view, "K&ompakt visning");
InsertGuiPair(menu_view_always_on_top, "&Alltid <20>verst");
InsertGuiPair(menu_view_lang_english, "&Engelska");
InsertGuiPair(menu_view_lang_polish, "&Polska");
InsertGuiPair(menu_view_lang_spanish, "&Spanska");
InsertGuiPair(menu_view_lang_danish, "&Danska");
InsertGuiPair(menu_view_lang_chinese, "&Kinesiska");
InsertGuiPair(menu_view_lang_russian, "&Ryska");
InsertGuiPair(menu_view_lang_swedish, "S&venska");
InsertGuiPair(menu_view_close_program, "&Avsluta");
InsertGuiPair(menu_edit_undo, "&<26>ngra");
InsertGuiPair(menu_edit_paste, "&Klistra in");
InsertGuiPair(menu_edit_copy_result, "&Kopiera result");
InsertGuiPair(menu_help_help, "&Hj<48>lp");
InsertGuiPair(menu_help_project_page, "&Projektsida");
InsertGuiPair(menu_help_about, "&Om");
InsertGuiPair(cant_init_calculations, "Ber<EFBFBD>kningen kunde inte initieras!");
InsertGuiPair(message_box_error_caption,"TTCalc");
InsertGuiPair(cant_create_thread, "Den andra tr<74>den f<>r utr<74>kning kunde inte skapas");
InsertGuiPair(cant_create_main_window, "Applikationens huvudf<64>nster kunde inte skapas");
InsertGuiPair(cant_init_common_controls,"Inst<EFBFBD>llningarna kunde inte initieras (InitCommonControlsEx)");
InsertGuiPair(about_text,
"Matematisk kalkylator TTCalc %d.%d.%d%s%s\r\n"
"Upphovsman: Tomasz Sowa\r\n"
"Kontakt: t.sowa@ttmath.org\r\n"
"Licens: BSD (open source)\r\n"
"Projektsida: http://ttcalc.sourceforge.net\r\n"
"Bignumbiblotek: TTMath %d.%d.%d%s\r\n"
"Programmeringsspr<EFBFBD>k: C++\r\n"
"Kompilator: %s\r\n"
"%s" // for upx
"\r\n"
"TTCalc anv<6E>nder sig av TTMath bignum bibloteket"
" som kan hittas h<>r: http://sourceforge.net/projects/ttmath\r\n"
"\r\n"
#ifdef TTCALC_PORTABLE
"Detta <20>r den portabla versionen av TTCalc. I denna version "
"kan du r<>kna med begr<67>nsad precision, dvs (96 bitar f<>r "
"mantissan och 32 bitar f<>r exponenten) det <20>r omkring +/-6.9e+646457021.\r\n"
"\r\n"
#endif
"Har du fr<66>gor, goda r<>d eller interessanta id<69>er betr<74>ffande"
" detta program eller vill du rentav bidra med din kompetens som"
" utvecklare eller programmerare <20>r du v<>lkommen att kontakta upphovsmannen."
);
InsertGuiPair(about_text_portable_version, " transportabel version");
InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.03\r\n");
InsertGuiPair(about_box_title, "Om");
InsertGuiPair(about_box_button_close, "B<EFBFBD>ver");
InsertGuiPair(unknown_error, "Det har intr<74>ffat ett ok<6F>nt fel");
InsertGuiPair(cant_find_help, "Kunde inte hitta n<>gra hj<68>lpfiler");
InsertGuiPair(cant_open_project_page, "Projektsidan kunde inte <20>ppnas");
} }

View File

@@ -121,6 +121,7 @@ public:
menu_view_lang_danish, menu_view_lang_danish,
menu_view_lang_chinese, menu_view_lang_chinese,
menu_view_lang_russian, menu_view_lang_russian,
menu_view_lang_swedish,
menu_view_close_program, menu_view_close_program,
menu_edit_undo, menu_edit_undo,
menu_edit_paste, menu_edit_paste,
@@ -149,7 +150,7 @@ public:
// (after conversion to 'int' we pass it into the std::vector) // (after conversion to 'int' we pass it into the std::vector)
enum Country enum Country
{ {
en = 0, pl, sp, da, chn, ru en = 0, pl, sp, da, chn, ru, swe
}; };

View File

@@ -408,6 +408,7 @@ HMENU menu = GetMenu(hWnd);
SetMenuLanguageItem(menu, IDM_LANGUAGE_DANISH, Languages::menu_view_lang_danish); SetMenuLanguageItem(menu, IDM_LANGUAGE_DANISH, Languages::menu_view_lang_danish);
SetMenuLanguageItem(menu, IDM_LANGUAGE_CHINESE, Languages::menu_view_lang_chinese); SetMenuLanguageItem(menu, IDM_LANGUAGE_CHINESE, Languages::menu_view_lang_chinese);
SetMenuLanguageItem(menu, IDM_LANGUAGE_RUSSIAN, Languages::menu_view_lang_russian); SetMenuLanguageItem(menu, IDM_LANGUAGE_RUSSIAN, Languages::menu_view_lang_russian);
SetMenuLanguageItem(menu, IDM_LANGUAGE_SWEDISH, Languages::menu_view_lang_swedish);
SetMenuLanguageItem(menu, IDM_CLOSE_PROGRAM, Languages::menu_view_close_program); SetMenuLanguageItem(menu, IDM_CLOSE_PROGRAM, Languages::menu_view_close_program);
SetMenuLanguageItem(menu, IDM_EDIT_UNDO, Languages::menu_edit_undo); SetMenuLanguageItem(menu, IDM_EDIT_UNDO, Languages::menu_edit_undo);
SetMenuLanguageItem(menu, IDM_EDIT_PASTE, Languages::menu_edit_paste); SetMenuLanguageItem(menu, IDM_EDIT_PASTE, Languages::menu_edit_paste);
@@ -772,6 +773,7 @@ void WmInitMenuPopUpView(HMENU menu)
CheckMenuItem(menu, IDM_LANGUAGE_DANISH, MF_BYCOMMAND|MF_UNCHECKED); CheckMenuItem(menu, IDM_LANGUAGE_DANISH, MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(menu, IDM_LANGUAGE_CHINESE, MF_BYCOMMAND|MF_UNCHECKED); CheckMenuItem(menu, IDM_LANGUAGE_CHINESE, MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(menu, IDM_LANGUAGE_RUSSIAN, MF_BYCOMMAND|MF_UNCHECKED); CheckMenuItem(menu, IDM_LANGUAGE_RUSSIAN, MF_BYCOMMAND|MF_UNCHECKED);
CheckMenuItem(menu, IDM_LANGUAGE_SWEDISH, MF_BYCOMMAND|MF_UNCHECKED);
Languages::Country lang = GetPrgRes()->GetLanguages()->GetCurrentLanguage(); Languages::Country lang = GetPrgRes()->GetLanguages()->GetCurrentLanguage();
@@ -792,6 +794,9 @@ void WmInitMenuPopUpView(HMENU menu)
else else
if( lang == Languages::ru ) if( lang == Languages::ru )
CheckMenuItem(menu, IDM_LANGUAGE_RUSSIAN, MF_BYCOMMAND|MF_CHECKED); CheckMenuItem(menu, IDM_LANGUAGE_RUSSIAN, MF_BYCOMMAND|MF_CHECKED);
else
if( lang == Languages::swe )
CheckMenuItem(menu, IDM_LANGUAGE_SWEDISH, MF_BYCOMMAND|MF_CHECKED);
} }
@@ -1087,6 +1092,16 @@ BOOL WmCommand_LanguageRussian(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
return true; return true;
} }
BOOL WmCommand_LanguageSwedish(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
GetPrgRes()->GetLanguages()->SetCurrentLanguage(Languages::swe);
SetMenuLanguage(hWnd);
SetOutputEditLanguage(hWnd);
TabWindowFunctions::SetLanguage( GetDlgItem(hWnd, IDC_TAB) );
return true;
}
BOOL WmHelp(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) BOOL WmHelp(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
@@ -1159,6 +1174,7 @@ void CreateCommandMessagesTable(Messages & cmessages)
cmessages.Associate(IDM_LANGUAGE_DANISH, WmCommand_LanguageDanish); cmessages.Associate(IDM_LANGUAGE_DANISH, WmCommand_LanguageDanish);
cmessages.Associate(IDM_LANGUAGE_CHINESE, WmCommand_LanguageChinese); cmessages.Associate(IDM_LANGUAGE_CHINESE, WmCommand_LanguageChinese);
cmessages.Associate(IDM_LANGUAGE_RUSSIAN, WmCommand_LanguageRussian); cmessages.Associate(IDM_LANGUAGE_RUSSIAN, WmCommand_LanguageRussian);
cmessages.Associate(IDM_LANGUAGE_SWEDISH, WmCommand_LanguageSwedish);
cmessages.Associate(IDM_HELP_HELP, WmHelp); cmessages.Associate(IDM_HELP_HELP, WmHelp);
cmessages.Associate(IDM_HELP_PROJECT_PAGE, WmProjectPage); cmessages.Associate(IDM_HELP_PROJECT_PAGE, WmProjectPage);
} }

View File

@@ -110,7 +110,6 @@ public:
private: private:
#ifndef TTCALC_PORTABLE #ifndef TTCALC_PORTABLE
ttmath::Parser<TTMathBig1> parser1; ttmath::Parser<TTMathBig1> parser1;
ttmath::Parser<TTMathBig2> parser2; ttmath::Parser<TTMathBig2> parser2;
ttmath::Parser<TTMathBig3> parser3; ttmath::Parser<TTMathBig3> parser3;

View File

@@ -803,6 +803,9 @@ std::string ini_value[20];
SetDisplayRounding( atoi(ini_value[11].c_str()) ); SetDisplayRounding( atoi(ini_value[11].c_str()) );
SetRemovingZeroes( bool(atoi(ini_value[15].c_str())) ); SetRemovingZeroes( bool(atoi(ini_value[15].c_str())) );
if( ini_value[13] == "6" )
languages.SetCurrentLanguage(Languages::swe);
else
if( ini_value[13] == "5" ) if( ini_value[13] == "5" )
languages.SetCurrentLanguage(Languages::ru); languages.SetCurrentLanguage(Languages::ru);
else else

View File

@@ -198,6 +198,7 @@
#define IDM_LANGUAGE_DANISH 40013 #define IDM_LANGUAGE_DANISH 40013
#define IDM_LANGUAGE_CHINESE 40014 #define IDM_LANGUAGE_CHINESE 40014
#define IDM_LANGUAGE_RUSSIAN 40015 #define IDM_LANGUAGE_RUSSIAN 40015
#define IDM_LANGUAGE_SWEDISH 40016
#define IDM_CLOSE_PROGRAM 40020 #define IDM_CLOSE_PROGRAM 40020
#define IDM_EDIT_UNDO 40030 #define IDM_EDIT_UNDO 40030
#define IDM_EDIT_PASTE 40031 #define IDM_EDIT_PASTE 40031

View File

@@ -32,6 +32,7 @@ BEGIN
MENUITEM "&Danish", 40013 MENUITEM "&Danish", 40013
MENUITEM "&Chinese", 40014 MENUITEM "&Chinese", 40014
MENUITEM "&Russian", 40015 MENUITEM "&Russian", 40015
MENUITEM "&Swedish", 40016
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Close", 40020 MENUITEM "&Close", 40020

View File

@@ -1,159 +1,159 @@
/* /*
* This file is a part of TTCalc - a mathematical calculator * This file is a part of TTCalc - a mathematical calculator
* and is distributed under the (new) BSD licence. * and is distributed under the (new) BSD licence.
* Author: Tomasz Sowa <t.sowa@slimaczek.pl> * Author: Tomasz Sowa <t.sowa@slimaczek.pl>
*/ */
/* /*
* Copyright (c) 2006-2008, Tomasz Sowa * Copyright (c) 2006-2008, Tomasz Sowa
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* *
* * Redistributions of source code must retain the above copyright notice, * * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
* *
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* *
* * Neither the name Tomasz Sowa nor the names of contributors to this * * Neither the name Tomasz Sowa nor the names of contributors to this
* project may be used to endorse or promote products derived * project may be used to endorse or promote products derived
* from this software without specific prior written permission. * from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE. * THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef headerfilestopcalculating #ifndef headerfilestopcalculating
#define headerfilestopcalculating #define headerfilestopcalculating
/*! /*!
\file stopcalculating.h \file stopcalculating.h
\brief it tells us whether there was a stop signal or not \brief it tells us whether there was a stop signal or not
*/ */
#include <ttmath/ttmathtypes.h> #include <ttmath/ttmathtypes.h>
#include <windows.h> #include <windows.h>
/*! /*!
\brief it tells us whether there was a stop signal or not \brief it tells us whether there was a stop signal or not
we can pass a pointer to the object of this class to the certain we can pass a pointer to the object of this class to the certain
calculating methods especially for the method which calculates the calculating methods especially for the method which calculates the
Factorial (1*2*3*4....), such methods as the Factorial takes a lot of time Factorial (1*2*3*4....), such methods as the Factorial takes a lot of time
and sometimes we want to break the calculations for example when we've got and sometimes we want to break the calculations for example when we've got
a new input string a new input string
those methods which take a lot of time check the object of type NewStopCalculating those methods which take a lot of time check the object of type NewStopCalculating
and if there was a stop signal they stop and return immediately without returning and if there was a stop signal they stop and return immediately without returning
a correct result a correct result
the stop signal can be caused by another thread in our case by the first (gui) thread the stop signal can be caused by another thread in our case by the first (gui) thread
there'll be only one object of this class there'll be only one object of this class
(it'll be as an variable of ThreadController class) (it'll be as an variable of ThreadController class)
*/ */
class NewStopCalculating : public ttmath::StopCalculating class NewStopCalculating : public ttmath::StopCalculating
{ {
public: public:
/*! /*!
the constructor the constructor
*/ */
NewStopCalculating() NewStopCalculating()
{ {
stop = 0; stop = 0;
} }
/*! /*!
the destructor the destructor
*/ */
~NewStopCalculating() ~NewStopCalculating()
{ {
if(stop) CloseHandle(stop); if(stop) CloseHandle(stop);
} }
/*! /*!
it initializes an object of this class it initializes an object of this class
this method will be called from Init() of the ThreadController object this method will be called from Init() of the ThreadController object
*/ */
bool Init() volatile bool Init() volatile
{ {
char buffer[80]; char buffer[80];
// with 'GetTickCount()' we're generating an unique identifier of our event // with 'GetTickCount()' we're generating an unique identifier of our event
// (there can be another window of ttcalc) // (there can be another window of ttcalc)
sprintf(buffer,"TTCalcStopEventForStoppingCalculations7756%u", sprintf(buffer,"TTCalcStopEventForStoppingCalculations7756%u",
(unsigned int)GetTickCount()); (unsigned int)GetTickCount());
// 'stop' will be manual-reseted and initialized as non-signaled // 'stop' will be manual-reseted and initialized as non-signaled
if( (stop = CreateEvent(0,true,false,buffer))==NULL) if( (stop = CreateEvent(0,true,false,buffer))==NULL)
return false; return false;
return true; return true;
} }
/*! /*!
when we want to stop the calculations for example when the user changed somewhat when we want to stop the calculations for example when the user changed somewhat
we call the Stop() method from the first (gui) thread we call the Stop() method from the first (gui) thread
*/ */
void Stop() volatile void Stop() volatile
{ {
SetEvent(stop); SetEvent(stop);
} }
/*! /*!
when we start the calculations we call this method when we start the calculations we call this method
(we call it from WaitForCalculatingAndBlockForStop() method of (we call it from WaitForCalculatingAndBlockForStop() method of
ThreadController class) ThreadController class)
*/ */
void Start() volatile void Start() volatile
{ {
ResetEvent(stop); ResetEvent(stop);
} }
/*! /*!
it returns 'true' if there was a stop signal it returns 'true' if there was a stop signal
it's useful for the second thread and functions which take plenty of time it's useful for the second thread and functions which take plenty of time
for calculating, when this method returns 'true' those methods break the for calculating, when this method returns 'true' those methods break the
calculations and return without returning a correct value calculations and return without returning a correct value
*/ */
virtual bool WasStopSignal() const volatile virtual bool WasStopSignal() const volatile
{ {
if( WaitForSingleObject(stop,0) == WAIT_OBJECT_0 ) if( WaitForSingleObject(stop,0) == WAIT_OBJECT_0 )
return true; return true;
return false; return false;
} }
private: private:
// manual-reset, initialized as non-signaled // manual-reset, initialized as non-signaled
HANDLE stop; HANDLE stop;
}; };
#endif #endif

View File

@@ -44,6 +44,7 @@
*/ */
#include <string> #include <string>
#include <ttmath/ttmath.h>
/*! /*!
@@ -194,3 +195,5 @@ static Messages messages;
// so that we have the logarythmic time to find the special function to call // so that we have the logarythmic time to find the special function to call
return messages.Call(message, hWnd, message, wParam, lParam); return messages.Call(message, hWnd, message, wParam, lParam);
} }