diff --git a/help/bitwise_functions.html b/help/bitwise_functions.html new file mode 100644 index 0000000..f656f45 --- /dev/null +++ b/help/bitwise_functions.html @@ -0,0 +1,49 @@ + + + + + + TTCalc - bitwise functions + + + + + + + + + + + + + + +

Bitwise functions

+ +

+There are bitwise functions in the program but they can operate only on non-negative values. +We don't define the BitNot() function too. +

+ + +
+ +
BitAnd(x ; y) or band(x ; y)
+
Bitwise AND. For example:
+bitand(6; 2) = bitand(&110 ; &10) = &10 = 2
+bitand(6.5; 2.5) = bitand(&110.1 ; &10.1) = &10.1 = 2.5
+ +
BitOr(x ; y) or bor(x ; y)
+
Bitwise OR. For example:
+bitor(6; 1) = bitor(&110 ; &1) = &111 = 7
+bitor(6.5; 1.5) = bitor(&110.1 ; &1.1) = &111.1 = 7.5
+ +
BitXor(x ; y) or bxor(x ; y)
+
Bitwise XOR. For example:
+bitxor(6; 3) = bitxor(&110 ; &11) = &101 = 5
+bitxor(6.5; 3.5) = bitxor(&110.1 ; &11.1) = &101.0 = 5
+ +
+ + + diff --git a/src/Makefile b/src/Makefile index 2cd7e70..a3c883a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,39 +1,18 @@ CC = g++ -o = resource.o calculation.o functions.o iniparser.o languages.o mainwindow.o parsermanager.o programresources.o tabs.o variables.o winmain.o CFLAGS = -Wall -pedantic -s -O2 -mwindows -mthreads -I../../../ttmath name = ttcalc.exe dir_output = ../../output - - -.SUFFIXES: .cpp .o - -.cpp.o: - $(CC) -c $(CFLAGS) $< - - all: ttcalc +include Makefile.dep ttcalc: $(o) $(CC) -o $(dir_output)/$(name) $(CFLAGS) $(o) -lcomctl32 - resource.o: resource.rc windres resource.rc resource.o -calculation.o: calculation.cpp compileconfig.h parsermanager.h resource.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h tabs.h messages.h -functions.o: functions.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h -iniparser.o: iniparser.cpp compileconfig.h iniparser.h -languages.o: languages.cpp compileconfig.h languages.h -mainwindow.o: mainwindow.cpp compileconfig.h winmain.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h resource.h messages.h tabs.h -parsermanager.o: parsermanager.cpp compileconfig.h parsermanager.h resource.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h -programresources.o: programresources.cpp compileconfig.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h -tabs.o: tabs.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h -variables.o: variables.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h -winmain.o: winmain.cpp compileconfig.h winmain.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h resource.h messages.h tabs.h - - clean: rm -f *.o rm -f *.s diff --git a/src/Makefile.dep b/src/Makefile.dep new file mode 100644 index 0000000..b88d5bf --- /dev/null +++ b/src/Makefile.dep @@ -0,0 +1,17 @@ +o = resource.o calculation.o functions.o iniparser.o languages.o mainwindow.o parsermanager.o programresources.o tabs.o variables.o winmain.o + +calculation.o: calculation.cpp compileconfig.h parsermanager.h resource.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h tabs.h messages.h +functions.o: functions.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h +iniparser.o: iniparser.cpp compileconfig.h iniparser.h +languages.o: languages.cpp compileconfig.h languages.h +mainwindow.o: mainwindow.cpp compileconfig.h winmain.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h resource.h messages.h tabs.h +parsermanager.o: parsermanager.cpp compileconfig.h parsermanager.h resource.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h +programresources.o: programresources.cpp compileconfig.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h +tabs.o: tabs.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h +variables.o: variables.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h +winmain.o: winmain.cpp compileconfig.h winmain.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h resource.h messages.h tabs.h + +.SUFFIXES: .cpp .o + +.cpp.o: + $(CC) -c $(CFLAGS) $< diff --git a/src/Makefileportable b/src/Makefileportable new file mode 100644 index 0000000..3ed8688 --- /dev/null +++ b/src/Makefileportable @@ -0,0 +1,21 @@ +CC = g++ +CFLAGS = -Wall -pedantic -s -Os -fno-default-inline -mwindows -mthreads -I../../../ttmath -DTTCALC_PORTABLE +name = ttcalcp.exe +dir_output = ../../output +compressor = upx + +all: ttcalc + +include Makefile.dep + +ttcalc: $(o) + $(CC) -o $(dir_output)/$(name) $(CFLAGS) $(o) -lcomctl32 + $(compressor) -7 $(dir_output)/$(name) + +resource.o: resource.rc + windres -DTTCALC_PORTABLE resource.rc resource.o + +clean: + rm -f *.o + rm -f *.s + rm -f $(dir_output)/$(name) diff --git a/src/compileconfig.h b/src/compileconfig.h index 7f4b384..9458f31 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 1 -#define TTCALC_PRERELEASE_VER 0 +#define TTCALC_REVISION_VER 2 +#define TTCALC_PRERELEASE_VER 1 diff --git a/src/iniparser.h b/src/iniparser.h index 8c835d8..d975d72 100644 --- a/src/iniparser.h +++ b/src/iniparser.h @@ -40,7 +40,7 @@ /*! \file iniparser.h - \brief A Parser witch we use for parsing 'ini' files + \brief A Parser which we use for parsing 'ini' files */ #include diff --git a/src/languages.cpp b/src/languages.cpp index 1912130..e2cdb09 100644 --- a/src/languages.cpp +++ b/src/languages.cpp @@ -273,7 +273,7 @@ void Languages::InitGuiMessagesTab() InsertGuiPair(cant_create_main_window, "I could not create the main window of the application"); InsertGuiPair(cant_init_common_controls,"I could not initialize the common controls (InitCommonControlsEx)"); InsertGuiPair(about_text, - "Mathematical calculator TTCalc %d.%d.%d%s\r\n" + "Mathematical calculator TTCalc %d.%d.%d%s%s\r\n" "Author: Tomasz Sowa\r\n" "Contact: t.sowa@slimaczek.pl\r\n" "Licence: (New) BSD licence\r\n" @@ -281,6 +281,7 @@ void Languages::InitGuiMessagesTab() "Bignum library: TTMath %d.%d.%d%s\r\n" "Programming language: C++\r\n" "Compiler: %s\r\n" + "%s" // for upx "\r\n" "This program uses the TTMath bignum library" " which can be found at http://sourceforge.net/projects/ttmath\r\n" @@ -289,6 +290,8 @@ void Languages::InitGuiMessagesTab() " this program or if you want to join to this project as" " a developer or programmer feel free to contant with the author." ); + InsertGuiPair(about_text_portable_version, " portable version"); + InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.00\r\n"); InsertGuiPair(about_box_title, "About"); InsertGuiPair(about_box_button_close, "Close"); InsertGuiPair(unknown_error, "An unknown error has occurred"); @@ -381,7 +384,7 @@ void Languages::InitGuiMessagesTab() InsertGuiPair(cant_create_main_window, "Nie udało się utworzyć głównego okna aplikacji"); InsertGuiPair(cant_init_common_controls,"Nie udało się zainicjalizować obsługi Common Controls (InitCommonControlsEx)"); InsertGuiPair(about_text, - "Kalkulator matematyczny TTCalc %d.%d.%d%s\r\n" + "Kalkulator matematyczny TTCalc %d.%d.%d%s%s\r\n" "Autor: Tomasz Sowa\r\n" "Kontakt: t.sowa@slimaczek.pl\r\n" "Licencja: (New) BSD\r\n" @@ -389,6 +392,7 @@ void Languages::InitGuiMessagesTab() "Biblioteka dużych liczb: TTMath %d.%d.%d%s\r\n" "Język programowania: C++\r\n" "Kompilator: %s\r\n" + "%s" // for upx "\r\n" "Ten program używa biblioteki dużych liczb TTMath" " która jest dostępna na http://sourceforge.net/projects/ttmath\r\n" @@ -397,6 +401,8 @@ void Languages::InitGuiMessagesTab() " tego programu lub chciałbyś dołączyć jako projektant/programista" " poprostu skontaktuj się z autorem." ); + InsertGuiPair(about_text_portable_version, " wersja portable"); + InsertGuiPair(about_text_exe_packer, "Paker exe: UPX 3.00\r\n"); InsertGuiPair(about_box_title, "O programie"); InsertGuiPair(about_box_button_close, "Zamknij"); InsertGuiPair(unknown_error, "Nieznany kod błędu"); diff --git a/src/languages.h b/src/languages.h index 866756d..5ea5243 100644 --- a/src/languages.h +++ b/src/languages.h @@ -125,6 +125,8 @@ public: cant_find_help, cant_open_project_page, about_text, + about_text_portable_version, + about_text_exe_packer, about_box_title, about_box_button_close, display_group_scientific, diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 807eddc..4f0a3ae 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -386,28 +386,47 @@ TCITEM tab_item; tab_standard = 0; tab_variables = 1; tab_functions = 2; + + #ifndef TTCALC_PORTABLE tab_precision = 3; tab_display = 4; + #else + tab_precision = -1; // this one will not be used + tab_display = 3; + #endif + // this insertion must be in the ascending order // (the second parameter of 'TabCtrl_InsertItem') TabCtrl_InsertItem(hTab, tab_standard, &tab_item); TabCtrl_InsertItem(hTab, tab_variables, &tab_item); TabCtrl_InsertItem(hTab, tab_functions, &tab_item); + + #ifndef TTCALC_PORTABLE TabCtrl_InsertItem(hTab, tab_precision, &tab_item); + #endif + TabCtrl_InsertItem(hTab, tab_display, &tab_item); WmInitDialogCreateTab(hTab, tab_standard, IDD_DIALOG_STANDARD, TabWindowProc); WmInitDialogCreateTab(hTab, tab_variables, IDD_DIALOG_VARIABLES, TabWindowProc); WmInitDialogCreateTab(hTab, tab_functions, IDD_DIALOG_FUNCTIONS, TabWindowProc); + + #ifndef TTCALC_PORTABLE WmInitDialogCreateTab(hTab, tab_precision, IDD_DIALOG_PRECISION, TabWindowProc); + #endif + WmInitDialogCreateTab(hTab, tab_display, IDD_DIALOG_DISPLAY, TabWindowProc); SetSizeOfDialogs(); SendMessage(GetPrgRes()->GetTabWindow(tab_variables), WM_INIT_TAB_VARIABLES, 0,0); SendMessage(GetPrgRes()->GetTabWindow(tab_functions), WM_INIT_TAB_FUNCTIONS, 0,0); + + #ifndef TTCALC_PORTABLE SendMessage(GetPrgRes()->GetTabWindow(tab_precision), WM_INIT_TAB_PRECISION, 0,0); + #endif + SendMessage(GetPrgRes()->GetTabWindow(tab_display), WM_INIT_TAB_DISPLAY, 0,0); TabWindowFunctions::SetLanguage(hTab); @@ -733,7 +752,7 @@ PROCESS_INFORMATION pi; memset(&si,0,sizeof(si)); si.cb = sizeof(si); - CreateProcess(buffer,"",0,0,false,NORMAL_PRIORITY_CLASS,0,0,&si,&pi); + CreateProcess(buffer,const_cast(""),0,0,false,NORMAL_PRIORITY_CLASS,0,0,&si,&pi); delete [] buffer; @@ -877,20 +896,20 @@ SHELLEXECUTEINFO exec; exec.cbSize = sizeof(exec); exec.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS; - exec.hwnd = 0; - exec.lpVerb = "open"; - exec.lpFile = "ttcalc.chm"; - exec.lpParameters = 0; - exec.lpDirectory = ""; - exec.nShow = SW_SHOWNORMAL; + exec.hwnd = 0; + exec.lpVerb = "open"; + exec.lpFile = "ttcalc.chm"; + exec.lpParameters = 0; + exec.lpDirectory = ""; + exec.nShow = SW_SHOWNORMAL; - if( !ShellExecuteEx(&exec) ) - { - MessageBox(hWnd, - GetPrgRes()->GetLanguages()->GuiMessage(Languages::cant_find_help), - GetPrgRes()->GetLanguages()->GuiMessage(Languages::message_box_caption), - MB_ICONERROR); - } + if( !ShellExecuteEx(&exec) ) + { + MessageBox(hWnd, + GetPrgRes()->GetLanguages()->GuiMessage(Languages::cant_find_help), + GetPrgRes()->GetLanguages()->GuiMessage(Languages::message_box_caption), + MB_ICONERROR); + } return true; } @@ -902,20 +921,20 @@ SHELLEXECUTEINFO exec; exec.cbSize = sizeof(exec); exec.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS; - exec.hwnd = 0; - exec.lpVerb = "open"; - exec.lpFile = "http://sourceforge.net/projects/ttcalc"; - exec.lpParameters = 0; - exec.lpDirectory = ""; - exec.nShow = SW_SHOWNORMAL; + exec.hwnd = 0; + exec.lpVerb = "open"; + exec.lpFile = "http://sourceforge.net/projects/ttcalc"; + exec.lpParameters = 0; + exec.lpDirectory = ""; + exec.nShow = SW_SHOWNORMAL; - if( !ShellExecuteEx(&exec) ) - { - MessageBox(hWnd, - GetPrgRes()->GetLanguages()->GuiMessage(Languages::cant_open_project_page), - GetPrgRes()->GetLanguages()->GuiMessage(Languages::message_box_caption), - MB_ICONERROR); - } + if( !ShellExecuteEx(&exec) ) + { + MessageBox(hWnd, + GetPrgRes()->GetLanguages()->GuiMessage(Languages::cant_open_project_page), + GetPrgRes()->GetLanguages()->GuiMessage(Languages::message_box_caption), + MB_ICONERROR); + } return true; } @@ -978,7 +997,7 @@ void CreateMainMessagesTable(Messages & messages) */ void CreateAboutText(char * buffer) { -char compiler[30]; +char compiler[50]; #ifdef __GNUC__ @@ -1032,10 +1051,21 @@ char compiler[30]; buffer, GetPrgRes()->GetLanguages()->GuiMessage(Languages::about_text), TTCALC_MAJOR_VER, TTCALC_MINOR_VER, TTCALC_REVISION_VER, +#ifndef TTCALC_PORTABLE + "", +#else + GetPrgRes()->GetLanguages()->GuiMessage(Languages::about_text_portable_version), +#endif (TTCALC_PRERELEASE_VER!=0)? " (prerelease)" : "", TTMATH_MAJOR_VER, TTMATH_MINOR_VER, TTMATH_REVISION_VER, (TTMATH_PRERELEASE_VER!=0)? " (prerelease)" : "", - compiler); + compiler, +#ifndef TTCALC_PORTABLE + "" +#else + GetPrgRes()->GetLanguages()->GuiMessage(Languages::about_text_exe_packer) +#endif + ); } diff --git a/src/parsermanager.cpp b/src/parsermanager.cpp index 14a442c..fa91197 100644 --- a/src/parsermanager.cpp +++ b/src/parsermanager.cpp @@ -86,6 +86,8 @@ ttmath::ErrorCode ParserManager::Parse() { try { + #ifndef TTCALC_PORTABLE + switch( precision ) { case 0: @@ -103,6 +105,13 @@ ttmath::ErrorCode ParserManager::Parse() code = parser3.Parse(buffer); break; } + + #else + + parser1.SetBase(base_input); + code = parser1.Parse(buffer); + + #endif } catch(...) { @@ -151,6 +160,8 @@ void ParserManager::Init() parser1.SetVariables( &variables ); parser1.SetFunctions( &functions ); + #ifndef TTCALC_PORTABLE + parser2.SetStopObject( GetPrgRes()->GetThreadController()->GetStopObject() ); parser2.SetVariables( &variables ); parser2.SetFunctions( &functions ); @@ -158,6 +169,8 @@ void ParserManager::Init() parser3.SetStopObject( GetPrgRes()->GetThreadController()->GetStopObject() ); parser3.SetVariables( &variables ); parser3.SetFunctions( &functions ); + + #endif } @@ -165,6 +178,8 @@ void ParserManager::PrintResult() { if( code == ttmath::err_ok ) { + #ifndef TTCALC_PORTABLE + switch( precision ) { case 0: @@ -176,6 +191,12 @@ void ParserManager::PrintResult() default: return PrintResult(parser3); } + + #else + + return PrintResult(parser1); + + #endif } else { diff --git a/src/parsermanager.h b/src/parsermanager.h index fa6b3c3..2de065e 100644 --- a/src/parsermanager.h +++ b/src/parsermanager.h @@ -105,9 +105,13 @@ public: private: +#ifndef TTCALC_PORTABLE ttmath::Parser > parser1; ttmath::Parser > parser2; ttmath::Parser > parser3; +#else + ttmath::Parser > parser1; +#endif ttmath::Objects variables, functions; @@ -133,46 +137,17 @@ private: for(i=0 ; iGetLanguages()->GuiMessage(country, Languages::overflow_during_printing); - // will be working correctly on gcc with -O3 - - // this error doesn't appear always, it can be seen, for example, - // if we use Big<1,3> type and we give '2^32' for calculating - - // I didn't check this error on a new version of gcc - + // we shouldn't have had this error in the new version of ToStrign(...) + // (where we're using a bigger type for calculating) part = GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing); } } catch(...) { - part.erase(); part = GetPrgRes()->GetLanguages()->ErrorMessage(country, ttmath::err_internal_error); } diff --git a/src/programresources.cpp b/src/programresources.cpp index 7a0fde2..a85c850 100644 --- a/src/programresources.cpp +++ b/src/programresources.cpp @@ -491,12 +491,17 @@ return status; void ProgramResources::SetNameOfConfigurationFile() { -static const char simple_file_name[] = "ttcalc.ini"; +static const char simple_file_name[] = "ttcalc.ini"; + + // if there'll be an error we assume that the current directory will be used + // (in the portable version the configuration file is in a current directory) + configuration_file = std::string(".\\") + simple_file_name; + +#ifndef TTCALC_PORTABLE + static const char simple_directory_name[] = "TTCalc"; std::string application_data; - // if there'll be an error we assume that the current directory will be used - configuration_file = std::string(".\\") + simple_file_name; // we're trying to read the value "AppData" from registry // which can be, for instance, as: @@ -533,6 +538,8 @@ std::string application_data; delete [] buffer; } + +#endif } diff --git a/src/resource.rc b/src/resource.rc index 0cb9064..6203803 100644 --- a/src/resource.rc +++ b/src/resource.rc @@ -45,7 +45,11 @@ END 101 DIALOG 0, 0, 265, 150 STYLE DS_SETFONT |DS_CENTER |WS_POPUP |WS_SYSMENU |WS_THICKFRAME |WS_MAXIMIZEBOX |WS_MINIMIZEBOX |WS_CAPTION MENU 200 +#ifndef TTCALC_PORTABLE CAPTION "TTCalc" +#else +CAPTION "TTCalc portable" +#endif FONT 8, "Ms Shell Dlg" BEGIN CONTROL "",1000,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,0,6,260,14 @@ -151,6 +155,8 @@ BEGIN CONTROL "",1143,"SysListView32",LVS_REPORT |LVS_SHOWSELALWAYS |LVS_SORTASCENDING |LVS_ALIGNLEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,57,3,223,85 END +#ifndef TTCALC_PORTABLE + 113 DIALOG 0, 0, 287, 90 STYLE DS_3DLOOK |DS_FIXEDSYS |DS_SETFONT |WS_CHILD | WS_TABSTOP |WS_GROUP CAPTION "tab4" @@ -164,6 +170,8 @@ BEGIN CONTROL "info 3",1155,"STATIC",SS_LEFT |WS_CHILD |WS_VISIBLE ,28,74,245,8 END +#endif + 114 DIALOG DISCARDABLE 0, 0, 255, 90 STYLE DS_3DLOOK | DS_FIXEDSYS |DS_SETFONT |WS_CHILD | WS_TABSTOP |WS_GROUP CAPTION "tab5" @@ -182,6 +190,7 @@ BEGIN GROUPBOX "Print scientific value",1168,11,51,240,31 END +#ifndef TTCALC_PORTABLE 200 DIALOG DISCARDABLE 0, 0, 349, 202 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU @@ -193,6 +202,20 @@ BEGIN WS_BORDER | NOT WS_TABSTOP DEFPUSHBUTTON "Close",IDOK,175,172,86,14 END +#else +200 DIALOG DISCARDABLE 0, 0, 268, 239 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | + WS_SYSMENU +CAPTION "About" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT 1200,16,18,234,183,ES_MULTILINE | ES_READONLY | NOT + WS_BORDER | NOT WS_TABSTOP + DEFPUSHBUTTON "Close",IDOK,90,213,86,14 +END +#endif + +#ifndef TTCALC_PORTABLE 1201 BITMAP "..\\res\\abacus_01.bmp" - +#endif diff --git a/src/tabs.cpp b/src/tabs.cpp index e1f02d2..751fbab 100644 --- a/src/tabs.cpp +++ b/src/tabs.cpp @@ -391,6 +391,8 @@ void SetLanguageTabFunctions(HWND hWnd) void SetLanguageTabPrecision(HWND hWnd) { + #ifndef TTCALC_PORTABLE + SetDlgItemText(hWnd, IDC_RADIO_PRECISION_1, GetPrgRes()->GetLanguages()->GuiMessage(Languages::radio_precision_1) ); SetDlgItemText(hWnd, IDC_RADIO_PRECISION_2, GetPrgRes()->GetLanguages()->GuiMessage(Languages::radio_precision_2) ); SetDlgItemText(hWnd, IDC_RADIO_PRECISION_3, GetPrgRes()->GetLanguages()->GuiMessage(Languages::radio_precision_3) ); @@ -398,6 +400,8 @@ void SetLanguageTabPrecision(HWND hWnd) SetDlgItemText(hWnd, IDC_LABEL_PRECISION_1_INFO, GetPrgRes()->GetLanguages()->GuiMessage(Languages::precision_1_info) ); SetDlgItemText(hWnd, IDC_LABEL_PRECISION_2_INFO, GetPrgRes()->GetLanguages()->GuiMessage(Languages::precision_2_info) ); SetDlgItemText(hWnd, IDC_LABEL_PRECISION_3_INFO, GetPrgRes()->GetLanguages()->GuiMessage(Languages::precision_3_info) ); + + #endif } @@ -456,16 +460,24 @@ TCITEM tab; tab.pszText = const_cast( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_functions) ); TabCtrl_SetItem(hTab,tab_functions, &tab); + #ifndef TTCALC_PORTABLE + tab.pszText = const_cast( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_precision) ); TabCtrl_SetItem(hTab,tab_precision, &tab); + #endif + tab.pszText = const_cast( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_display) ); TabCtrl_SetItem(hTab,tab_display, &tab); SetLanguageTabStandard( GetPrgRes()->GetTabWindow(tab_standard) ); SetLanguageTabVariables( GetPrgRes()->GetTabWindow(tab_variables) ); SetLanguageTabFunctions( GetPrgRes()->GetTabWindow(tab_functions) ); + + #ifndef TTCALC_PORTABLE SetLanguageTabPrecision( GetPrgRes()->GetTabWindow(tab_precision) ); + #endif + SetLanguageTabDisplay( GetPrgRes()->GetTabWindow(tab_display) ); InvalidateRect(hTab, 0, false); @@ -474,6 +486,8 @@ TCITEM tab; BOOL WmTabCommand_SetPrecision1(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + #ifndef TTCALC_PORTABLE + // there are another messages besides that one // which is sent when a user clicks on the radio button if( IsDlgButtonChecked(hWnd, IDC_RADIO_PRECISION_1) != BST_CHECKED ) @@ -483,12 +497,16 @@ BOOL WmTabCommand_SetPrecision1(HWND hWnd, UINT message, WPARAM wParam, LPARAM l GetPrgRes()->SetPrecision(0); GetPrgRes()->GetThreadController()->StartCalculating(); + #endif + return true; } BOOL WmTabCommand_SetPrecision2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + #ifndef TTCALC_PORTABLE + // there are another messages besides that one // which is sent when a user clicks on the radio button if( IsDlgButtonChecked(hWnd, IDC_RADIO_PRECISION_2) != BST_CHECKED ) @@ -498,12 +516,16 @@ BOOL WmTabCommand_SetPrecision2(HWND hWnd, UINT message, WPARAM wParam, LPARAM l GetPrgRes()->SetPrecision(1); GetPrgRes()->GetThreadController()->StartCalculating(); + #endif + return true; } BOOL WmTabCommand_SetPrecision3(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + #ifndef TTCALC_PORTABLE + // there are another messages besides that one // which is sent when a user clicks on the radio button if( IsDlgButtonChecked(hWnd, IDC_RADIO_PRECISION_3) != BST_CHECKED ) @@ -513,6 +535,8 @@ BOOL WmTabCommand_SetPrecision3(HWND hWnd, UINT message, WPARAM wParam, LPARAM l GetPrgRes()->SetPrecision(2); GetPrgRes()->GetThreadController()->StartCalculating(); + #endif + return true; } @@ -701,10 +725,14 @@ void CreateTabCommandMessagesTable(Messages & cmessages) cmessages.Associate(IDC_BUTTON_EDIT_FUNCTION, Functions::WmTabCommand_EditFunction); cmessages.Associate(IDC_BUTTON_DELETE_FUNCTION, Functions::WmTabCommand_DeleteFunction); + #ifndef TTCALC_PORTABLE + cmessages.Associate(IDC_RADIO_PRECISION_1, WmTabCommand_SetPrecision1); cmessages.Associate(IDC_RADIO_PRECISION_2, WmTabCommand_SetPrecision2); cmessages.Associate(IDC_RADIO_PRECISION_3, WmTabCommand_SetPrecision3); + #endif + cmessages.Associate(IDC_COMBO_DISPLAY_INPUT, WmTabCommand_DisplayInputChanged); cmessages.Associate(IDC_COMBO_DISPLAY_OUTPUT, WmTabCommand_DisplayOutputChanged); cmessages.Associate(IDC_COMBO_DISPLAY_ROUNDING, WmTabCommand_DisplayRoundingChanged); @@ -904,7 +932,9 @@ return true; BOOL WmInitTabPrecision(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + #ifndef TTCALC_PORTABLE CheckDlgButton(hWnd, IDC_RADIO_PRECISION_1 + GetPrgRes()->GetPrecision(), BST_CHECKED); + #endif return true; } @@ -1034,7 +1064,11 @@ void CreateTabMessagesTable(Messages & messages) messages.Associate(WM_COMMAND, WmTabCommand); messages.Associate(WM_INIT_TAB_VARIABLES, WmInitTabVariables); messages.Associate(WM_INIT_TAB_FUNCTIONS, WmInitTabFunctions); + + #ifndef TTCALC_PORTABLE messages.Associate(WM_INIT_TAB_PRECISION, WmInitTabPrecision); + #endif + messages.Associate(WM_INIT_TAB_DISPLAY, WmInitTabDisplay); messages.Associate(WM_NOTIFY, WmNotify); } diff --git a/src/tabs.h b/src/tabs.h index f47e161..5637fab 100644 --- a/src/tabs.h +++ b/src/tabs.h @@ -49,10 +49,6 @@ #include "programresources.h" -//#define WM_INIT_TAB_VARIABLES WM_USER+2 -//#define WM_INIT_TAB_FUNCTIONS WM_USER+3 -//#define WM_INIT_TAB_PRECISION WM_USER+4 - #define WM_INIT_TAB_VARIABLES WM_APP #define WM_INIT_TAB_FUNCTIONS WM_APP+1 #define WM_INIT_TAB_PRECISION WM_APP+2 diff --git a/src/winmain.cpp b/src/winmain.cpp index 7c5db27..a23fc4b 100644 --- a/src/winmain.cpp +++ b/src/winmain.cpp @@ -40,7 +40,7 @@ /*! \file mainwin.cpp - \brief There's defined the entry point to the application + \brief There's defined the entry point to the application in this file */ #include