fixed: calculating the size of the main window

now it looks good on MS Vista and when a user changes size of some
         widgets such as a border, font size, etc.
added:   spanish language to the setup (installer)
added:   the setup will remove mingwm10.dll if it exists in the program directory
added:   on display tab: we can select 'deg' 'rad' or 'grad' for calculating
         in such functions: sin,cos,tan,cot,asin,acos,atan,acot
added:   macro TTCALC_CONVERT if not defined there will not be a convert tab
         (the convert tab is not finished)
added:   a new icon with following dimensions: '48x48' '32x32' '16x16'
removed: parameter for gcc: -mthreads
         with -mthreads it is possible (on windows) to release some kind of
         'destructors' belonging to a thread when the specific thread exists
         (it prevents some kind of memory leaks)
         in the TTCalc when the second thread exists then there is the end
         of the program and we can not use '-mthreads'
removed: file TODO (I didn't use the file)


git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@114 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2009-03-28 18:26:20 +00:00
parent 2ff2aebbee
commit ff62d833c9
35 changed files with 1077 additions and 942 deletions

View File

@@ -1,5 +1,6 @@
CC = g++
CFLAGS = -Wall -pedantic -s -O2 -mwindows -mthreads -I../../../ttmath
#CFLAGS = -Wall -pedantic -s -O2 -mwindows -I../../../ttmath -DTTCALC_CONVERT
CFLAGS = -Wall -pedantic -s -O2 -mwindows -I../../../ttmath
name = ttcalc.exe
# the name of the help is also set in the html help workshop project file
@@ -21,6 +22,7 @@ $(dir_output)/$(name): $(o)
ttcalc: $(dir_output)/$(name)
resource.o: resource.rc
#windres -DTTCALC_CONVERT resource.rc resource.o
windres resource.rc resource.o
$(dir_output)/$(helpname): $(helpdep)

View File

@@ -1,5 +1,6 @@
o = resource.o calculation.o convert.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 bigtypes.h threadcontroller.h stopcalculating.h convert.h tabs.h messages.h
convert.o: convert.cpp convert.h compileconfig.h bigtypes.h
functions.o: functions.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h bigtypes.h threadcontroller.h stopcalculating.h convert.h
@@ -11,7 +12,7 @@ programresources.o: programresources.cpp compileconfig.h programresources.h inip
tabs.o: tabs.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h bigtypes.h threadcontroller.h stopcalculating.h convert.h
variables.o: variables.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h bigtypes.h threadcontroller.h stopcalculating.h convert.h
winmain.o: winmain.cpp compileconfig.h winmain.h programresources.h iniparser.h languages.h bigtypes.h threadcontroller.h stopcalculating.h convert.h resource.h messages.h tabs.h
.SUFFIXES: .cpp .o
@@ -32,4 +33,4 @@ helpdep = ../help/arithmetic_functions.html \
../help/toc.hhc \
../help/help.hhp
setupdep = ttcalc help ../setup/innosetup.iss ../setup/COPYRIGHT ../setup/ttcalc.ini
setupdep = ttcalc help ../setup/innosetup.iss ../setup/COPYRIGHT

View File

@@ -1,5 +1,5 @@
CC = g++
CFLAGS = -Wall -pedantic -s -Os -fno-default-inline -mwindows -mthreads -I../../../ttmath -DTTCALC_PORTABLE
CFLAGS = -Wall -pedantic -s -Os -fno-default-inline -mwindows -I../../../ttmath -DTTCALC_PORTABLE
name = ttcalcp.exe
dir_output = ../../output
compressor = upx

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@@ -274,7 +274,7 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(combo_rounding_integer,"to integer");
InsertGuiPair(combo_rounding_to_number,"to");
InsertGuiPair(combo_rounding_after_comma,"digit(s)");
InsertGuiPair(check_remove_zeroes,"Remove trailing zeroes");
InsertGuiPair(check_remove_zeroes,"Remove last trailing zeroes");
InsertGuiPair(display_input, "Input");
InsertGuiPair(display_output, "Output");
@@ -283,6 +283,7 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_not_always_scientific,"When the exponent is greater than:");
InsertGuiPair(display_group_scientific, "Print the result as the scientific value");
InsertGuiPair(display_decimal_point, "Decimal point");
InsertGuiPair(display_deg_red_grad, "sin/cos asin/acos");
InsertGuiPair(convert_type, "Type");
InsertGuiPair(convert_input, "Input");
InsertGuiPair(convert_output, "Output");
@@ -407,6 +408,7 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_not_always_scientific,"Je<EFBFBD>li eksponent jest wi<77>kszy ni<6E>:");
InsertGuiPair(display_group_scientific, "Wy<EFBFBD>wietl wynik w postaci naukowej");
InsertGuiPair(display_decimal_point, "Przecinek dziesi<73>tny");
InsertGuiPair(display_deg_red_grad, "sin/cos asin/acos");
InsertGuiPair(convert_type, "Typ");
InsertGuiPair(convert_input, "Wej<EFBFBD>cie");
InsertGuiPair(convert_output, "Wyj<EFBFBD>cie");
@@ -522,7 +524,9 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(combo_rounding_none,"Ninguno");
InsertGuiPair(combo_rounding_integer,"a entero");
InsertGuiPair(combo_rounding_to_number,"a numero");
//InsertGuiPair(combo_rounding_to_number,"a numero");
// this text was too long (the combobox is shorter now) -- I'm not sure whether this is correct now... (I don't know spanish at all)
InsertGuiPair(combo_rounding_to_number,"a");
InsertGuiPair(combo_rounding_after_comma,"digito(s)");
InsertGuiPair(check_remove_zeroes,"Eliminar ceros no-significativos");
@@ -533,6 +537,7 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_not_always_scientific,"Cuando el exponente es mas grande que:");
InsertGuiPair(display_group_scientific, "Imprimir el resultado como valor cientifico");
InsertGuiPair(display_decimal_point, "Decimal point");
InsertGuiPair(display_deg_red_grad, "sin/cos asin/acos");
InsertGuiPair(convert_type, "Tipo");
InsertGuiPair(convert_input, "Entrada");
InsertGuiPair(convert_output, "Salida");

View File

@@ -102,6 +102,7 @@ public:
display_always_scientific,
display_not_always_scientific,
display_decimal_point,
display_deg_red_grad,
convert_type,
convert_input,
convert_output,

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -419,21 +419,23 @@ HMENU menu = GetMenu(hWnd);
void WmInitDialogCalculateMainWindowSize(HWND hTab)
{
RECT r;
RECT r_tab, r_main, r_edit2;
GetWindowRect(hTab, &r);
int cy_caption = GetSystemMetrics(SM_CYCAPTION);
int cy_add = 2 * GetSystemMetrics(SM_CYDLGFRAME) +
GetSystemMetrics(SM_CYMENU);
GetWindowRect(hTab, &r_tab);
int cx_add = 2 * GetSystemMetrics(SM_CXDLGFRAME) +
r.right - r.left;
HWND main = GetPrgRes()->GetMainWindow();
GetWindowRect(main, &r_main);
GetPrgRes()->SetYSizeNormal ( 225 + cy_add + cy_caption * 2);
GetPrgRes()->SetYSizeCompact( 59 + cy_add + cy_caption );
GetPrgRes()->SetXSizeMin ( 4 + cx_add );
HWND output_edit = GetDlgItem(main, IDC_OUTPUT_EDIT);
GetWindowRect(output_edit, &r_edit2);
int cy_compact = (r_edit2.bottom - r_main.top) + GetSystemMetrics(SM_CYSIZEFRAME);
int cy_normal = (r_tab.bottom - r_tab.top) + (r_tab.top - r_main.top) + GetSystemMetrics(SM_CYSIZEFRAME) + 8;
int cx = r_tab.right - r_tab.left + 2 * GetSystemMetrics(SM_CXSIZEFRAME);
GetPrgRes()->SetYSizeNormal ( cy_normal );
GetPrgRes()->SetYSizeCompact( cy_compact );
GetPrgRes()->SetXSizeMin ( cx );
}
@@ -456,14 +458,18 @@ DLGTEMPLATE * tab1template = (DLGTEMPLATE*)LockResource(tab1global);
int frame_cx = GetSystemMetrics(SM_CXEDGE);
int frame_cy = GetSystemMetrics(SM_CYEDGE);
int caption_cy = GetSystemMetrics(SM_CYCAPTION)+10; // the caption plus some white space
int space = 10; // some more space between the tab items and child tabs
RECT tab_item_r;
TabCtrl_GetItemRect(hTab, 0, &tab_item_r);
int tab_item = tab_item_r.bottom;
RECT r;
GetWindowRect(hTab, &r);
SetWindowPos(hDialog, HWND_TOP, frame_cx, frame_cy + caption_cy,
SetWindowPos(hDialog, HWND_TOP, frame_cx, frame_cy + tab_item + space,
r.right-r.left- 2*frame_cx,
r.bottom-r.top- 2*frame_cy - caption_cy, 0);
r.bottom-r.top- 2*frame_cy - tab_item - space, 0);
return hDialog;
}
@@ -492,18 +498,24 @@ TCITEM tab_item;
// the name of a tab we'll set when we call the 'SetLanguage()' function
tab_item.mask = 0;
tab_standard = 0;
tab_variables = 1;
tab_functions = 2;
int tab_inc = 0;
tab_standard = tab_inc++;
tab_variables = tab_inc++;
tab_functions = tab_inc++;
#ifndef TTCALC_PORTABLE
tab_precision = 3;
tab_display = 4;
tab_convert = 5;
tab_precision = tab_inc++;
#else
tab_precision = -1; // this one will not be used
tab_display = 3;
tab_convert = 4;
#endif
tab_display = tab_inc++;
#ifdef TTCALC_CONVERT
tab_convert = tab_inc++;
#else
tab_convert = -1;
#endif
// this insertion must be in the ascending order
@@ -517,7 +529,10 @@ TCITEM tab_item;
#endif
TabCtrl_InsertItem(hTab, tab_display, &tab_item);
#ifdef TTCALC_CONVERT
TabCtrl_InsertItem(hTab, tab_convert, &tab_item);
#endif
WmInitDialogCreateTab(hTab, tab_standard, IDD_DIALOG_STANDARD, TabWindowProc);
WmInitDialogCreateTab(hTab, tab_variables, IDD_DIALOG_VARIABLES, TabWindowProc);
@@ -528,7 +543,10 @@ TCITEM tab_item;
#endif
WmInitDialogCreateTab(hTab, tab_display, IDD_DIALOG_DISPLAY, TabWindowProc);
#ifdef TTCALC_CONVERT
WmInitDialogCreateTab(hTab, tab_convert, IDD_DIALOG_CONVERT, TabWindowProc);
#endif
SetSizeOfDialogs();
@@ -540,7 +558,10 @@ TCITEM tab_item;
#endif
SendMessage(GetPrgRes()->GetTabWindow(tab_display), WM_INIT_TAB_DISPLAY, 0,0);
#ifdef TTCALC_CONVERT
SendMessage(GetPrgRes()->GetTabWindow(tab_convert), WM_INIT_TAB_CONVERT, 0,0);
#endif
TabWindowFunctions::SetLanguage(hTab);
@@ -559,7 +580,7 @@ HWND hTab = GetDlgItem(hWnd,IDC_TAB);
WmInitDialogCalculateMainWindowSize(hTab);
WmInitDialogCreateAndInitTabs(hTab);
HICON program_icon = LoadIcon(GetPrgRes()->GetInstance(),MAKEINTRESOURCE(IDI_ICON1));
HICON program_icon = LoadIcon(GetPrgRes()->GetInstance(),MAKEINTRESOURCE(IDI_ICON2));
if( program_icon )
SendMessage(hWnd,WM_SETICON,ICON_BIG,(LPARAM)program_icon);
@@ -616,7 +637,6 @@ MINMAXINFO * lpmmi = (LPMINMAXINFO) lParam;
if( GetPrgRes()->GetView() == ProgramResources::view_normal )
{
lpmmi->ptMinTrackSize.y = GetPrgRes()->GetYSizeNormal();
//lpmmi->ptMaxTrackSize.y = cy_normalny;
}
else
{// kompaktowy

View File

@@ -95,16 +95,19 @@ ttmath::ErrorCode ParserManager::Parse()
{
case 0:
parser1.SetBase(base_input);
parser1.SetDegRadGrad(angle_deg_rad_grad);
code = parser1.Parse(buffer);
break;
case 1:
parser2.SetBase(base_input);
parser2.SetDegRadGrad(angle_deg_rad_grad);
code = parser2.Parse(buffer);
break;
default:
parser3.SetBase(base_input);
parser3.SetDegRadGrad(angle_deg_rad_grad);
code = parser3.Parse(buffer);
break;
}
@@ -112,6 +115,7 @@ ttmath::ErrorCode ParserManager::Parse()
#else
parser1.SetBase(base_input);
parser1.SetDegRadGrad(angle_deg_rad_grad);
code = parser1.Parse(buffer);
#endif
@@ -145,12 +149,13 @@ unsigned int i;
base_input = GetPrgRes()->GetBaseInput();
base_output = GetPrgRes()->GetBaseOutput();
always_scientific = GetPrgRes()->GetDisplayAlwaysScientific();
when_scientific = GetPrgRes()->GetDisplayWhenScientific();
rounding = GetPrgRes()->GetDisplayRounding();
precision = GetPrgRes()->GetPrecision();
remove_zeroes = GetPrgRes()->GetRemovingZeroes();
country = GetPrgRes()->GetLanguages()->GetCurrentLanguage();
always_scientific = GetPrgRes()->GetDisplayAlwaysScientific();
when_scientific = GetPrgRes()->GetDisplayWhenScientific();
rounding = GetPrgRes()->GetDisplayRounding();
precision = GetPrgRes()->GetPrecision();
remove_zeroes = GetPrgRes()->GetRemovingZeroes();
angle_deg_rad_grad = GetPrgRes()->GetDegRadGrad();
country = GetPrgRes()->GetLanguages()->GetCurrentLanguage();
conv_type = GetPrgRes()->GetConvert()->GetCurrentType();
GetPrgRes()->GetConvert()->GetCurrentUnit(conv_type, conv_input_unit, conv_output_unit);

View File

@@ -136,7 +136,7 @@ private:
Languages::Country country;
ttmath::ErrorCode code;
char decimal_point;
int angle_deg_rad_grad;
/*
some buffers which we use in some method in the second thread,

View File

@@ -208,6 +208,25 @@ bool ProgramResources::GetRemovingZeroes()
return remove_zeroes;
}
void ProgramResources::SetDegRadGrad(int angle)
{
if( angle < 0 || angle > 2 )
angle = 1;
angle_deg_rad_grad = angle;
}
int ProgramResources::GetDegRadGrad()
{
return angle_deg_rad_grad;
}
void ProgramResources::SetDisplayAlwaysScientific(bool a)
{
display_always_scientific = a;
@@ -426,13 +445,14 @@ ProgramResources::ProgramResources()
y_size_compact = 0;
x_size_min = 0;
// !!! wrzucic do kontruktora Convert
// !!! put into Convert constructor
#ifdef TTCALC_CONVERT
convert.Init();
#endif
decimal_point = 0;
angle_deg_rad_grad = 1; // rad is default
}
@@ -649,6 +669,7 @@ std::string ini_value[20];
iparser.Associate( "global|language", &ini_value[13] );
iparser.Associate( "global|disp.dec.point", &ini_value[14] );
iparser.Associate( "global|disp.remove.zeroes", &ini_value[15] );
iparser.Associate( "global|disp.deg_rad_grad", &ini_value[16] );
iparser.Associate( "variables", &temp_variables );
iparser.Associate( "functions", &temp_functions );
@@ -704,7 +725,7 @@ std::string ini_value[20];
languages.SetCurrentLanguage(Languages::en);
SetDecimalPoint( atoi(ini_value[14].c_str()) );
SetDegRadGrad( atoi(ini_value[16].c_str()) );
if( err != IniParser::err_ok )
bad_line = iparser.GetBadLine();
@@ -742,6 +763,8 @@ std::ofstream file( configuration_file.c_str() );
file << "disp.rounding = " << display_rounding << std::endl;
file << "disp.remove.zeroes = " << (int)remove_zeroes << std::endl;
file << "disp.dec.point = " << decimal_point << std::endl;
file << "disp.deg_rad_grad = " << angle_deg_rad_grad << std::endl;
file << "\n[variables]\n";

View File

@@ -293,6 +293,14 @@ public:
bool GetRemovingZeroes();
/*!
setting and returning the unit of angle in which sin/cos/tan/ctg (arc sin...) operate
0 - deg
1 - red
2 - grad
*/
void SetDegRadGrad(int angle);
int GetDegRadGrad();
private:
@@ -340,6 +348,7 @@ private:
int display_when_scientific;
int display_rounding;
bool remove_zeroes;
int angle_deg_rad_grad;
int bad_line;

View File

@@ -62,7 +62,8 @@
#define IDR_MENU 200
#define IDC_TAB 1010
#define IDI_ICON1 104
#define IDI_ICON2 104
#define IDI_ICON1 105
#define IDC_INPUT_EDIT 1000
#define IDC_OUTPUT_EDIT 1001
@@ -165,6 +166,8 @@
#define IDC_LABEL_DECIMAL_POINT 1169
#define IDC_COMBO_DECIMAL_POINT 1170
#define IDC_CHECK_REMOVE_ZEROES 1171
#define IDC_LABEL_DISPLAY_DEG_RAD_GRAD 1172
#define IDC_COMBO_DEG_RAD_GRAD 1173
// convert tab

View File

@@ -4,7 +4,10 @@
LANGUAGE LANG_POLISH, 1
104 ICON "..\\res\\icon01.ico"
104 ICON "..\\res\\icon02.ico"
LANGUAGE LANG_POLISH, 2
105 ICON "..\\res\\icon01.ico"
#include "resource.h"
@@ -56,10 +59,11 @@ 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
CONTROL "",1001,"EDIT",ES_READONLY |ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,0,21,260,14
CONTROL "",1010,"SysTabControl32",WS_CHILD |WS_TABSTOP |WS_GROUP| WS_VISIBLE ,0,39,261,110, WS_EX_CONTROLPARENT
CONTROL "",1010,"SysTabControl32",WS_CHILD |WS_TABSTOP |WS_GROUP| WS_VISIBLE ,0,39,261,106, WS_EX_CONTROLPARENT
END
102 DIALOG DISCARDABLE 0, 0, 358, 61
STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
@@ -181,22 +185,29 @@ STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_CAPTION | WS_GROUP |
CAPTION "tab5"
FONT 8, "Ms Shell Dlg"
BEGIN
COMBOBOX 1156,58,5,69,200,CBS_DROPDOWNLIST | WS_GROUP |
COMBOBOX 1156,58,5,58,200,CBS_DROPDOWNLIST | WS_GROUP |
WS_TABSTOP
COMBOBOX 1157,58,19,69,200,CBS_DROPDOWNLIST | WS_TABSTOP
LTEXT "Input",1162,11,7,27,8
LTEXT "Output",1163,11,22,29,8
LTEXT "Rounding",1164,11,36,43,8
LTEXT "Decimal point",1169,178,21,68,8
COMBOBOX 1170,143,19,29,62,CBS_DROPDOWNLIST | WS_TABSTOP
COMBOBOX 1157,58,19,58,200,CBS_DROPDOWNLIST | WS_TABSTOP
CONTROL "Input",1162,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,11,7,
43,8
CONTROL "Output",1163,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,11,
22,43,8
COMBOBOX 1159,58,33,58,200,CBS_DROPDOWNLIST | WS_TABSTOP
CONTROL "Rounding",1164,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,11,
36,43,8
COMBOBOX 1173,213,5,38,54,CBS_DROPDOWNLIST | WS_TABSTOP
CONTROL "sin/cos asin/acos",1172,"Static",SS_LEFTNOWORDWRAP |
WS_GROUP,137,7,73,8
COMBOBOX 1170,213,19,38,62,CBS_DROPDOWNLIST | WS_TABSTOP
CONTROL "Decimal point",1169,"Static",SS_LEFTNOWORDWRAP |
WS_GROUP,137,22,73,8
CONTROL "remove trailing zeroes",1171,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,143,35,111,10
COMBOBOX 1159,58,33,69,200,CBS_DROPDOWNLIST | WS_TABSTOP
BS_LEFTTEXT | BS_LEFT | WS_TABSTOP,136,36,115,10
CONTROL "Always",1160,"Button",BS_AUTORADIOBUTTON | BS_LEFT |
WS_GROUP | WS_TABSTOP,19,65,44,10
WS_GROUP | WS_TABSTOP,19,65,54,10
CONTROL "When the exponent is greater than:",1161,"Button",
BS_AUTORADIOBUTTON | BS_LEFT,77,65,130,10
EDITTEXT 1166,211,63,29,14,ES_NUMBER | WS_GROUP
BS_AUTORADIOBUTTON | BS_LEFT,77,65,138,10
EDITTEXT 1166,217,63,29,14,ES_NUMBER | WS_GROUP
CONTROL "",1165,"msctls_updown32",UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_ARROWKEYS,201,73,11,14
GROUPBOX "Print scientific value",1168,11,51,240,31
@@ -204,6 +215,9 @@ END
#ifdef TTCALC_CONVERT
115 DIALOG DISCARDABLE 0, 0, 260, 90
STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_CAPTION | WS_GROUP |
WS_TABSTOP
@@ -234,6 +248,8 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,162,74,88,10
END
#endif
#ifndef TTCALC_PORTABLE
200 DIALOG DISCARDABLE 0, 0, 349, 202
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION |

View File

@@ -413,7 +413,6 @@ int i;
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_ROUNDING, CB_RESETCONTENT, 0, 0);
// SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_ROUNDING, CB_ADDSTRING, 0, (LPARAM)GetPrgRes()->GetLanguages()->GuiMessage(Languages::combo_rounding_cut_last_digits) );
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_ROUNDING, CB_ADDSTRING, 0, (LPARAM)GetPrgRes()->GetLanguages()->GuiMessage(Languages::combo_rounding_none) );
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_ROUNDING, CB_ADDSTRING, 0, (LPARAM)GetPrgRes()->GetLanguages()->GuiMessage(Languages::combo_rounding_integer) );
@@ -447,6 +446,8 @@ int i;
SetDlgItemText(hWnd, IDC_LABEL_DECIMAL_POINT, GetPrgRes()->GetLanguages()->GuiMessage(Languages::display_decimal_point));
SetDlgItemText(hWnd, IDC_CHECK_REMOVE_ZEROES, GetPrgRes()->GetLanguages()->GuiMessage(Languages::check_remove_zeroes));
SetDlgItemText(hWnd, IDC_LABEL_DISPLAY_DEG_RAD_GRAD, GetPrgRes()->GetLanguages()->GuiMessage(Languages::display_deg_red_grad));
}
@@ -669,17 +670,17 @@ TCITEM tab;
TabCtrl_SetItem(hTab,tab_functions, &tab);
#ifndef TTCALC_PORTABLE
tab.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_precision) );
TabCtrl_SetItem(hTab,tab_precision, &tab);
#endif
tab.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_display) );
TabCtrl_SetItem(hTab,tab_display, &tab);
#ifdef TTCALC_CONVERT
tab.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_convert) );
TabCtrl_SetItem(hTab,tab_convert, &tab);
#endif
SetLanguageTabStandard( GetPrgRes()->GetTabWindow(tab_standard) );
SetLanguageTabVariables( GetPrgRes()->GetTabWindow(tab_variables) );
@@ -690,7 +691,10 @@ TCITEM tab;
#endif
SetLanguageTabDisplay( GetPrgRes()->GetTabWindow(tab_display) );
#ifdef TTCALC_CONVERT
SetLanguageTabConvert( GetPrgRes()->GetTabWindow(tab_convert) );
#endif
InvalidateRect(hTab, 0, false);
}
@@ -818,6 +822,18 @@ BOOL WmTabCommand_RemoveZeroesChanged(HWND hWnd, UINT message, WPARAM wParam, LP
return true;
}
BOOL WmTabCommand_DisplayDegRadGradChanged(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if( HIWORD(wParam) != CBN_SELCHANGE )
return false;
GetPrgRes()->GetThreadController()->StopCalculating();
GetPrgRes()->SetDegRadGrad( (int)SendDlgItemMessage(hWnd, IDC_COMBO_DEG_RAD_GRAD, CB_GETCURSEL, 0, 0) );
GetPrgRes()->GetThreadController()->StartCalculating();
return true;
}
void SetDisablingDisplayWhenScientific(HWND hWnd)
{
@@ -981,8 +997,7 @@ void CreateTabCommandMessagesTable(Messages & cmessages)
cmessages.Associate(IDC_RADIO_DISPLAY_NOT_ALWAYS_SCIENTIFIC, WmTabCommand_SetDisplayNotAlwaysScientific);
cmessages.Associate(IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC, WmTabCommand_SetDisplayWhenScientific);
cmessages.Associate(IDC_COMBO_DECIMAL_POINT, WmTabCommand_DisplayDecimalPointChanged);
cmessages.Associate(IDC_COMBO_DEG_RAD_GRAD, WmTabCommand_DisplayDegRadGradChanged);
}
@@ -1245,6 +1260,15 @@ char buffer[20];
if( GetPrgRes()->GetRemovingZeroes() )
CheckDlgButton(hWnd, IDC_CHECK_REMOVE_ZEROES, BST_CHECKED);
SendDlgItemMessage(hWnd, IDC_COMBO_DEG_RAD_GRAD, CB_ADDSTRING, 0, (LPARAM)"deg");
SendDlgItemMessage(hWnd, IDC_COMBO_DEG_RAD_GRAD, CB_ADDSTRING, 0, (LPARAM)"rad");
SendDlgItemMessage(hWnd, IDC_COMBO_DEG_RAD_GRAD, CB_ADDSTRING, 0, (LPARAM)"grad");
SendDlgItemMessage(hWnd, IDC_COMBO_DEG_RAD_GRAD, CB_SETCURSEL, GetPrgRes()->GetDegRadGrad(), 0);
return true;
}
@@ -1283,10 +1307,6 @@ BOOL WmNotify(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
NMHDR * pnmh = (LPNMHDR) lParam;
HWND var_list = GetDlgItem(hWnd,IDC_VARIABLES_LIST);
HWND fun_list = GetDlgItem(hWnd,IDC_FUNCTIONS_LIST);
HWND conv_list1 = GetDlgItem(hWnd,IDC_LIST_UNIT_TYPE);
HWND conv_list2b = GetDlgItem(hWnd,IDC_LIST_UNIT_INPUT2);
HWND conv_list3b = GetDlgItem(hWnd,IDC_LIST_UNIT_OUTPUT2);
if( pnmh->hwndFrom == var_list )
@@ -1337,6 +1357,11 @@ HWND conv_list3b = GetDlgItem(hWnd,IDC_LIST_UNIT_OUTPUT2);
}
#ifdef TTCALC_CONVERT
HWND conv_list1 = GetDlgItem(hWnd,IDC_LIST_UNIT_TYPE);
HWND conv_list2b = GetDlgItem(hWnd,IDC_LIST_UNIT_INPUT2);
HWND conv_list3b = GetDlgItem(hWnd,IDC_LIST_UNIT_OUTPUT2);
if( pnmh->hwndFrom==conv_list1 || pnmh->hwndFrom==conv_list2b || pnmh->hwndFrom==conv_list3b )
{
if( pnmh->code == LVN_ITEMCHANGED )
@@ -1355,7 +1380,7 @@ HWND conv_list3b = GetDlgItem(hWnd,IDC_LIST_UNIT_OUTPUT2);
}
}
}
#endif
return false;
}
@@ -1375,7 +1400,10 @@ void CreateTabMessagesTable(Messages & messages)
#endif
messages.Associate(WM_INIT_TAB_DISPLAY, WmInitTabDisplay);
#ifdef TTCALC_CONVERT
messages.Associate(WM_INIT_TAB_CONVERT, WmInitTabConvert);
#endif
messages.Associate(WM_NOTIFY, WmNotify);
}

View File

@@ -46,7 +46,6 @@
#include <string>
/*!
the application starts here
*/
@@ -72,7 +71,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
if( !GetPrgRes()->GetThreadController()->Init() )
return ShowError( Languages::cant_init_calculations );
unsigned int thread_id;
unsigned int thread_id;
uintptr_t thread_handle;
if( (thread_handle = _beginthreadex(0,0,CalculationsProcedure, 0, 0, &thread_id)) == 0 )
return ShowError( Languages::cant_create_thread );