Browse Source

added: on display tab: an option how many digits should be grouped

git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@337 e52654a7-88a9-db11-a3e9-0013d4bc506e
master
Tomasz Sowa 11 years ago
parent
commit
844f79b793
  1. 2
      CHANGELOG
  2. 28
      src/languages.cpp
  3. 3
      src/languages.h
  4. 4
      src/pad.cpp
  5. 18
      src/parsermanager.cpp
  6. 5
      src/parsermanager.h
  7. 22
      src/programresources.cpp
  8. 9
      src/programresources.h
  9. 13
      src/resource.h
  10. 7
      src/resource.rc
  11. 117
      src/tabs.cpp

2
CHANGELOG

@ -1,6 +1,8 @@
Version 0.9.3 prerelease (2011.01.30):
* added: German translation made by
Moritz Beleites <morbel at gmx.net>
* added: on display tab: an option how many digits should be grouped
Version 0.9.2 (2010.09.24):
* added: Italian translation made by

28
src/languages.cpp

@ -494,11 +494,13 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_rounding, "Rounding");
InsertGuiPair(display_always_scientific,"Always");
InsertGuiPair(display_not_always_scientific,"When the exponent is greater than:");
InsertGuiPair(display_group_scientific, "Print the result as the scientific value");
InsertGuiPair(display_as_scientific, "Print the result as the scientific value");
InsertGuiPair(display_deg_rad_grad, "Trigonometric functions");
InsertGuiPair(display_grouping, "Grouping"); // e.g. 1`000`000
InsertGuiPair(display_grouping_none, "none");
InsertGuiPair(display_grouping_space, "space");
InsertGuiPair(display_grouping_digits, "digit(s)");
InsertGuiPair(display_input_decimal_point, "Input decimal point"); // Decimal point in formula
InsertGuiPair(display_input_decimal_point_item1, " . or ,");
InsertGuiPair(display_output_decimal_point, "Output decimal point"); // Decimal point in result
@ -701,11 +703,12 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_rounding,"Zaokr¹glenie");
InsertGuiPair(display_always_scientific,"Zawsze");
InsertGuiPair(display_not_always_scientific,"Jeœli eksponent jest wiêkszy ni¿:");
InsertGuiPair(display_group_scientific, "Wyœwietl wynik w postaci naukowej");
InsertGuiPair(display_as_scientific, "Wyœwietl wynik w postaci naukowej");
InsertGuiPair(display_deg_rad_grad, "Funkcje trygonometryczne");
InsertGuiPair(display_grouping, "Grupowanie");
InsertGuiPair(display_grouping_none, "brak");
InsertGuiPair(display_grouping_space, "spacja");
InsertGuiPair(display_grouping_digits, "cyfr(y)");
InsertGuiPair(display_input_decimal_point, "Przecinek w formule");
InsertGuiPair(display_input_decimal_point_item1, " . lub ,");
InsertGuiPair(display_output_decimal_point, "Przecinek w wyniku");
@ -910,11 +913,12 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_rounding, "Redondeo");
InsertGuiPair(display_always_scientific,"Siempre");
InsertGuiPair(display_not_always_scientific,"Cuando el exponente es mas grande que:");
InsertGuiPair(display_group_scientific, "Imprimir el resultado como valor científico");
InsertGuiPair(display_as_scientific, "Imprimir el resultado como valor científico");
InsertGuiPair(display_deg_rad_grad, "Funciones trigonométricas");
InsertGuiPair(display_grouping, "Agrupar"); // e.g. 1`000`000
InsertGuiPair(display_grouping_none, "Ninguno");
InsertGuiPair(display_grouping_space, "Espacio");
InsertGuiPair(display_grouping_digits, "digito(s)");
InsertGuiPair(display_input_decimal_point, "Símbolo decimal en fórmula"); // Decimal point in formula
InsertGuiPair(display_input_decimal_point_item1, " . o ,");
InsertGuiPair(display_output_decimal_point, "Símbolo decimal en resultado"); // Decimal point in result
@ -1121,11 +1125,12 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_rounding, "Afrunding");
InsertGuiPair(display_always_scientific,"Altid");
InsertGuiPair(display_not_always_scientific,"Når exponenten er større end:");
InsertGuiPair(display_group_scientific, "Print resultatet som den videnskablige værdi");
InsertGuiPair(display_as_scientific, "Print resultatet som den videnskablige værdi");
InsertGuiPair(display_deg_rad_grad, "Trigonometriske funktioner");
InsertGuiPair(display_grouping, "Gruppering"); // e.g. 1`000`000
InsertGuiPair(display_grouping_none, "Ingen");
InsertGuiPair(display_grouping_space, "Mellemrum");
InsertGuiPair(display_grouping_digits, "ciffer(cifre)");
InsertGuiPair(display_input_decimal_point, "Input decimal tegn"); // Decimal point in formula
InsertGuiPair(display_input_decimal_point_item1, " . eller ,");
InsertGuiPair(display_output_decimal_point, "Output decimal tegn"); // Decimal point in result
@ -1329,11 +1334,12 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_rounding, "ËÄÉáÎåÈë");
InsertGuiPair(display_always_scientific,"Ò»Ö±");
InsertGuiPair(display_not_always_scientific,"µ±Ö¸Êý´óÓÚ:");
InsertGuiPair(display_group_scientific, "°´¿Æѧ¼ÆÊý·¨Êä³ö½á¹û");
InsertGuiPair(display_as_scientific, "°´¿Æѧ¼ÆÊý·¨Êä³ö½á¹û");
InsertGuiPair(display_deg_rad_grad, "Èý½Çº¯Êý");
InsertGuiPair(display_grouping, "·Ö×é·û"); // e.g. 1`000`000
InsertGuiPair(display_grouping_none, "ÎÞ");
InsertGuiPair(display_grouping_space, "¿Õ¸ñ");
InsertGuiPair(display_grouping_digits, "λÊý");
InsertGuiPair(display_input_decimal_point, "СÊýµãÊäÈë¸ñʽ"); // Decimal point in formula
InsertGuiPair(display_input_decimal_point_item1, " . or ,");
InsertGuiPair(display_output_decimal_point, "СÊýµãÊä³ö¸ñʽ"); // Decimal point in result
@ -1539,12 +1545,13 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_rounding, "Îêðóãëåíèå");
InsertGuiPair(display_always_scientific,"Âñåãäà");
InsertGuiPair(display_not_always_scientific,"Êîãäà ïîêàçàòåëü ñòåïåíè áîëüøå");
InsertGuiPair(display_group_scientific, "Âûâîäèòü ðåçóëüòàò â ýêñïîíåíöèàëüíîì âèäå");
InsertGuiPair(display_as_scientific, "Âûâîäèòü ðåçóëüòàò â ýêñïîíåíöèàëüíîì âèäå");
InsertGuiPair(display_deg_rad_grad, "Òðèãîíîìåòðèÿ");
InsertGuiPair(display_grouping, "Ðàçä. ãðóïï"); // e.g. 1`000`000
InsertGuiPair(display_grouping_none, "Íè÷åãî");
InsertGuiPair(display_grouping_space, "Ïðîáåë");
InsertGuiPair(display_grouping_digits, "çíàêà");
InsertGuiPair(display_input_decimal_point, "Äåñÿòè÷íàÿ òî÷êà (ââîä)"); // Decimal point in formula
InsertGuiPair(display_input_decimal_point_item1, " . èëè ,");
InsertGuiPair(display_output_decimal_point, "Äåñÿòè÷íàÿ òî÷êà (âûâîä)"); // Decimal point in result
@ -1755,7 +1762,7 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_rounding, "Avrundning");
InsertGuiPair(display_always_scientific,"Alltid");
InsertGuiPair(display_not_always_scientific,"När exponenten är större än:");
InsertGuiPair(display_group_scientific, "Visa resultatet som vetenskapligt värde");
InsertGuiPair(display_as_scientific, "Visa resultatet som vetenskapligt värde");
InsertGuiPair(display_deg_rad_grad, "Trigonometric functions");
InsertGuiPair(convert_type, "Type");
InsertGuiPair(convert_input, "Input");
@ -1764,6 +1771,7 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_grouping, "Grouping");
InsertGuiPair(display_grouping_none, "None");
InsertGuiPair(display_grouping_space, "Space");
InsertGuiPair(display_grouping_digits, "siffror(cifre)");
InsertGuiPair(display_input_decimal_point, "Input decimal point");
InsertGuiPair(display_input_decimal_point_item1, " . or ,");
InsertGuiPair(display_output_decimal_point, "Output decimal point");
@ -1961,11 +1969,12 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_rounding, "Arrotonda");
InsertGuiPair(display_always_scientific,"Sempre");
InsertGuiPair(display_not_always_scientific,"Quando l'esponente e maggiore di:");
InsertGuiPair(display_group_scientific, "Stampa il risultato in notazione scientifica");
InsertGuiPair(display_as_scientific, "Stampa il risultato in notazione scientifica");
InsertGuiPair(display_deg_rad_grad, "Funzioni trigonometriche");
InsertGuiPair(display_grouping, "Raggruppo");
InsertGuiPair(display_grouping_none, "nessuno");
InsertGuiPair(display_grouping_space, "spazio");
InsertGuiPair(display_grouping_digits, "cifra/e");
InsertGuiPair(display_input_decimal_point, "Punto decimale in input"); // Decimal point in formula
InsertGuiPair(display_input_decimal_point_item1, " . oppure ,");
InsertGuiPair(display_output_decimal_point, "Punto decimale in output"); // Decimal point in result
@ -2169,11 +2178,12 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(display_rounding, "Rundung");
InsertGuiPair(display_always_scientific,"Immer");
InsertGuiPair(display_not_always_scientific,"Wenn der Exponent größer ist als:");
InsertGuiPair(display_group_scientific, "Ergebnis in wissenschaftlicher Schreibweise");
InsertGuiPair(display_as_scientific, "Ergebnis in wissenschaftlicher Schreibweise");
InsertGuiPair(display_deg_rad_grad, "Winkelmaß");
InsertGuiPair(display_grouping, "Gruppierung"); // e.g. 1`000`000
InsertGuiPair(display_grouping_none, "keine");
InsertGuiPair(display_grouping_space, "Leerzeichen");
InsertGuiPair(display_grouping_digits, "Stelle(n)");
InsertGuiPair(display_input_decimal_point, "Dezimaltrennz. Eingabe"); // Decimal point in formula
InsertGuiPair(display_input_decimal_point_item1, " . oder ,");
InsertGuiPair(display_output_decimal_point, "Dezimaltrennz. Ergebnis"); // Decimal point in result

3
src/languages.h

@ -105,6 +105,7 @@ public:
display_grouping,
display_grouping_none,
display_grouping_space,
display_grouping_digits,
display_input_decimal_point,
display_input_decimal_point_item1,
display_output_decimal_point,
@ -176,7 +177,7 @@ public:
about_text_exe_packer,
about_box_title,
about_box_button_close,
display_group_scientific,
display_as_scientific,
pad_title,
pad_menu_file,
pad_menu_edit,

4
src/pad.cpp

@ -68,6 +68,8 @@ char input_comma1;
char input_comma2;
char param_sep;
int grouping_digits;
Languages::Country country;
int last_variables_id;
@ -133,6 +135,7 @@ unsigned int i = 0;
conv.trim_zeroes = remove_zeroes;
conv.comma = decimal_point;
conv.group = grouping;
conv.group_digits = grouping_digits;
if( result.ToString(res2, conv) )
res2 = GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing);
@ -263,6 +266,7 @@ void SetParameters()
country = GetPrgRes()->GetLanguages()->GetCurrentLanguage();
decimal_point = GetPrgRes()->GetDecimalPointChar();
grouping = GetPrgRes()->GetGroupingChar();
grouping_digits = GetPrgRes()->GetGroupingDigits();
param_sep = GetPrgRes()->GetParamSepChar();
GetPrgRes()->GetInputDecimalPointChar(&input_comma1, &input_comma2);

18
src/parsermanager.cpp

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2009, Tomasz Sowa
* Copyright (c) 2006-2011, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -45,11 +45,6 @@
ParserManager::ParserManager() : buffer_len(20480)
{
buffer = 0;
base_input = base_output = 10;
always_scientific = 0;
when_scientific = 15;
rounding = -1;
remove_zeroes = true;
last_variables_id = 0;
last_functions_id = 0;
}
@ -57,15 +52,7 @@ ParserManager::ParserManager() : buffer_len(20480)
ParserManager::ParserManager(const ParserManager & p) : buffer_len(p.buffer_len)
{
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;
last_variables_id = p.last_variables_id;
last_functions_id = p.last_functions_id;
buffer = 0;
}
@ -164,6 +151,7 @@ unsigned int i;
country = GetPrgRes()->GetLanguages()->GetCurrentLanguage();
decimal_point = GetPrgRes()->GetDecimalPointChar();
grouping = GetPrgRes()->GetGroupingChar();
grouping_digits = GetPrgRes()->GetGroupingDigits();
param_sep = GetPrgRes()->GetParamSepChar();
GetPrgRes()->GetInputDecimalPointChar(&input_comma1, &input_comma2);

5
src/parsermanager.h

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2010, Tomasz Sowa
* Copyright (c) 2006-2011, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -142,6 +142,8 @@ private:
char input_comma2;
char param_sep;
int grouping_digits;
/*
some buffers which we use in some method in the second thread,
it's better to have those buffers outside those methods -
@ -206,6 +208,7 @@ private:
conv.trim_zeroes = remove_zeroes;
conv.comma = decimal_point;
conv.group = grouping;
conv.group_digits = grouping_digits;
if( result.ToString(buffer2, conv) )
{

22
src/programresources.cpp

@ -614,6 +614,22 @@ int ProgramResources::GetGrouping()
}
void ProgramResources::SetGroupingDigits(int digits)
{
grouping_digits = digits;
if( grouping_digits < 1 || grouping_digits > 9 )
grouping_digits = 1;
}
int ProgramResources::GetGroupingDigits()
{
return grouping_digits;
}
void ProgramResources::SetInputDecimalPoint(int p)
{
input_decimal_point = p;
@ -740,6 +756,7 @@ ProgramResources::ProgramResources()
decimal_point = 0; // output decimal point
angle_deg_rad_grad = 1; // rad is default
grouping = 0;
grouping_digits = 3;
input_decimal_point = 0; // dot or comma
param_sep = 0;
@ -1113,6 +1130,7 @@ std::string ini_value[30];
iparser.Associate( "global|disp.param_sep", &ini_value[25] );
iparser.Associate( "global|update.onstartup", &ini_value[26] );
iparser.Associate( "global|update.last", &ini_value[27] );
iparser.Associate( "global|disp.grouping.digits", &ini_value[28] );
iparser.Associate( "variables", &temp_variables );
iparser.Associate( "functions", &temp_functions );
@ -1182,6 +1200,9 @@ std::string ini_value[30];
last_update = (time_t)atol(ini_value[27].c_str());
if( !ini_value[28].empty() )
SetGroupingDigits( atoi(ini_value[28].c_str()) );
return err;
}
@ -1226,6 +1247,7 @@ std::ofstream file( configuration_file.c_str() );
file << "disp.output_comma = " << decimal_point << std::endl;
file << "disp.deg_rad_grad = " << angle_deg_rad_grad << std::endl;
file << "disp.grouping = " << grouping << std::endl;
file << "disp.grouping.digits = " << grouping_digits << std::endl;
file << "disp.param_sep = " << param_sep << std::endl;

9
src/programresources.h

@ -410,6 +410,14 @@ public:
int GetGrouping();
/*!
setting/getting how many digits should be groupped
digits can be from 1 to 9
*/
void SetGroupingDigits(int digits);
int GetGroupingDigits();
/*!
returning the grouping character
*/
@ -546,6 +554,7 @@ private:
bool remove_zeroes;
int angle_deg_rad_grad;
int grouping; // 0 - none, 1 - space, 2 - '`', 3 - '\'', 4 - '.', 5 - ','
int grouping_digits; // from 1 to 9
int input_decimal_point; // 0 - dot or comma, 1 - dot, 2 - comma
int param_sep; // parameters separator: 0 - semicolon, 1 - dot, 2 - comma

13
src/resource.h

@ -176,18 +176,19 @@
#define IDC_LABEL_DISPLAY_ROUNDING 1163
#define IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC 1164
#define IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC 1165
#define IDC_LABEL_GROUP_SCIENTIFIC 1166
#define IDC_LABEL_DISPLAY_SCIENTIFIC 1166
#define IDC_LABEL_OUTPUT_DECIMAL_POINT 1167
#define IDC_COMBO_OUTPUT_DECIMAL_POINT 1168
#define IDC_CHECK_REMOVE_ZEROES 1169
#define IDC_LABEL_DISPLAY_DEG_RAD_GRAD 1170
#define IDC_COMBO_DEG_RAD_GRAD 1171
#define IDC_COMBO_DISPLAY_GROUPING 1172
#define IDC_LABEL_DISPLAY_GROUPING 1173
#define IDC_COMBO_INPUT_DECIMAL_POINT 1174
#define IDC_LABEL_INPUT_DECIMAL_POINT 1175
#define IDC_LABEL_PARAM_SEPARATE 1176
#define IDC_COMBO_PARAM_SEPARATE 1177
#define IDC_COMBO_DISPLAY_GROUPING_DIGITS 1173
#define IDC_LABEL_DISPLAY_GROUPING 1174
#define IDC_COMBO_INPUT_DECIMAL_POINT 1175
#define IDC_LABEL_INPUT_DECIMAL_POINT 1176
#define IDC_LABEL_PARAM_SEPARATE 1177
#define IDC_COMBO_PARAM_SEPARATE 1178
// convert tab
#define IDC_LIST_UNIT_TYPE 1200

7
src/resource.rc

@ -272,7 +272,9 @@ BEGIN
WS_TABSTOP
COMBOBOX IDC_COMBO_DISPLAY_ROUNDING,61,30,59,200,CBS_DROPDOWNLIST |
WS_TABSTOP
COMBOBOX IDC_COMBO_DISPLAY_GROUPING,61,44,59,112,CBS_DROPDOWNLIST |
COMBOBOX IDC_COMBO_DISPLAY_GROUPING,61,44,59,100,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_DISPLAY_GROUPING_DIGITS,61,58,59,100,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_INPUT_DECIMAL_POINT,234,2,49,56,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@ -296,8 +298,7 @@ BEGIN
CONTROL "",IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC,"msctls_updown32",
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS,276,84,
11,14
GROUPBOX "Print scientific value",IDC_LABEL_GROUP_SCIENTIFIC,8,75,
275,27
GROUPBOX "Print scientific value",IDC_LABEL_DISPLAY_SCIENTIFIC,8,76,275,26
END

117
src/tabs.cpp

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2009, Tomasz Sowa
* Copyright (c) 2006-2011, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -349,6 +349,24 @@ BOOL WmTabCommand_IDCANCEL(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam
return true;
}
// pos is the 'grouping' position (0 means none)
void SetDisablingGroupingDigits(HWND hWnd, int pos = -1)
{
if( pos < 0 )
pos = SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_GETCURSEL, 0, 0);
if( pos <= 0 )
{
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISPLAY_GROUPING_DIGITS), false);
}
else
{
EnableWindow(GetDlgItem(hWnd, IDC_COMBO_DISPLAY_GROUPING_DIGITS), true);
}
}
void SetLanguageTabStandard(HWND hWnd)
{
SetDlgItemText( hWnd,IDC_BUTTON_CLEAR, GetPrgRes()->GetLanguages()->GuiMessage(Languages::button_clear) );
@ -412,19 +430,18 @@ void SetLanguageTabPrecision(HWND hWnd)
}
void SetLanguageTabDisplay(HWND hWnd)
void SetLanguageTabDisplayComboRounding(HWND hWnd)
{
char buffer[50];
int i;
const int max_r = 9;
Languages * pl = GetPrgRes()->GetLanguages();
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_ROUNDING, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_ROUNDING, CB_ADDSTRING, 0, (LPARAM)pl->GuiMessage(Languages::combo_rounding_none) );
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_ROUNDING, CB_ADDSTRING, 0, (LPARAM)pl->GuiMessage(Languages::combo_rounding_integer) );
const int max_r = 9;
for(i=1 ; i<=max_r ; ++i)
{
sprintf(buffer,"%s %d %s",
@ -436,11 +453,57 @@ int i;
}
int r = GetPrgRes()->GetDisplayRounding();
if( r > max_r )
r = max_r;
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_ROUNDING, CB_SETCURSEL, r+1, 0);
}
void SetLanguageTabDisplayComboGrouping(HWND hWnd)
{
char buffer[50];
int i;
const int max_r = 9;
Languages * pl = GetPrgRes()->GetLanguages();
// grouping
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)pl->GuiMessage(Languages::display_grouping_none));
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)pl->GuiMessage(Languages::display_grouping_space));
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)" `");
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)" '");
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)" .");
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)" ,");
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_SETCURSEL, GetPrgRes()->GetGrouping(), 0);
// grouping digits
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING_DIGITS, CB_RESETCONTENT, 0, 0);
for(i=1 ; i<=max_r ; ++i)
{
sprintf(buffer,"%d %s", i, pl->GuiMessage(Languages::display_grouping_digits) );
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING_DIGITS, CB_ADDSTRING, 0, (LPARAM)buffer);
}
int r = GetPrgRes()->GetGroupingDigits();
if( r > max_r )
r = max_r;
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING_DIGITS, CB_SETCURSEL, r-1, 0);
}
void SetLanguageTabDisplay(HWND hWnd)
{
Languages * pl = GetPrgRes()->GetLanguages();
SetLanguageTabDisplayComboRounding(hWnd);
SetLanguageTabDisplayComboGrouping(hWnd);
SetDisablingGroupingDigits(hWnd, GetPrgRes()->GetGrouping());
SetDlgItemText(hWnd, IDC_LABEL_DISPLAY_INPUT, pl->GuiMessage(Languages::display_input));
SetDlgItemText(hWnd, IDC_LABEL_DISPLAY_OUTPUT, pl->GuiMessage(Languages::display_output));
@ -453,19 +516,10 @@ int i;
SetDlgItemText(hWnd, IDC_RADIO_DISPLAY_ALWAYS_SCIENTIFIC, pl->GuiMessage(Languages::display_always_scientific));
SetDlgItemText(hWnd, IDC_RADIO_DISPLAY_NOT_ALWAYS_SCIENTIFIC, pl->GuiMessage(Languages::display_not_always_scientific));
SetDlgItemText(hWnd, IDC_LABEL_GROUP_SCIENTIFIC, pl->GuiMessage(Languages::display_group_scientific));
SetDlgItemText(hWnd, IDC_LABEL_DISPLAY_SCIENTIFIC, pl->GuiMessage(Languages::display_as_scientific));
SetDlgItemText(hWnd, IDC_CHECK_REMOVE_ZEROES, pl->GuiMessage(Languages::check_remove_zeroes));
SetDlgItemText(hWnd, IDC_LABEL_DISPLAY_DEG_RAD_GRAD, pl->GuiMessage(Languages::display_deg_rad_grad));
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)pl->GuiMessage(Languages::display_grouping_none));
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)pl->GuiMessage(Languages::display_grouping_space));
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)" `");
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)" '");
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)" .");
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)" ,");
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_SETCURSEL, GetPrgRes()->GetGrouping(), 0);
SendDlgItemMessage(hWnd, IDC_COMBO_INPUT_DECIMAL_POINT, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hWnd, IDC_COMBO_INPUT_DECIMAL_POINT, CB_ADDSTRING, 0, (LPARAM)pl->GuiMessage(Languages::display_input_decimal_point_item1));
SendDlgItemMessage(hWnd, IDC_COMBO_INPUT_DECIMAL_POINT, CB_ADDSTRING, 0, (LPARAM)" .");
@ -866,6 +920,23 @@ return true;
}
void SetDisablingDisplayWhenScientific(HWND hWnd)
{
if( IsDlgButtonChecked(hWnd, IDC_RADIO_DISPLAY_ALWAYS_SCIENTIFIC) == BST_CHECKED )
{
EnableWindow(GetDlgItem(hWnd, IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC), false);
EnableWindow(GetDlgItem(hWnd, IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC), false);
}
else
{
EnableWindow(GetDlgItem(hWnd, IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC), true);
EnableWindow(GetDlgItem(hWnd, IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC), true);
}
}
BOOL WmTabCommand_DisplayGrouping(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if( HIWORD(wParam) != CBN_SELCHANGE )
@ -873,8 +944,11 @@ BOOL WmTabCommand_DisplayGrouping(HWND hWnd, UINT message, WPARAM wParam, LPARAM
GetPrgRes()->GetThreadController()->StopCalculating();
GetPrgRes()->SetGrouping( (int)SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_GETCURSEL, 0, 0) );
GetPrgRes()->SetGroupingDigits( (int)SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING_DIGITS, CB_GETCURSEL, 0, 0) + 1 );
GetPrgRes()->GetThreadController()->StartCalculating();
SetDisablingGroupingDigits(hWnd, GetPrgRes()->GetGrouping());
return true;
}
@ -906,19 +980,6 @@ return true;
}
void SetDisablingDisplayWhenScientific(HWND hWnd)
{
if( IsDlgButtonChecked(hWnd, IDC_RADIO_DISPLAY_ALWAYS_SCIENTIFIC) == BST_CHECKED )
{
EnableWindow(GetDlgItem(hWnd, IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC), false);
EnableWindow(GetDlgItem(hWnd, IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC), false);
}
else
{
EnableWindow(GetDlgItem(hWnd, IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC), true);
EnableWindow(GetDlgItem(hWnd, IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC), true);
}
}
BOOL WmTabCommand_SetDisplayAlwaysScientific(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
@ -1333,6 +1394,7 @@ void CreateTabCommandMessagesTable(Messages<BOOL> & cmessages)
cmessages.Associate(IDC_COMBO_OUTPUT_DECIMAL_POINT, WmTabCommand_DisplayDecimalPointChanged);
cmessages.Associate(IDC_COMBO_DEG_RAD_GRAD, WmTabCommand_DisplayDegRadGradChanged);
cmessages.Associate(IDC_COMBO_DISPLAY_GROUPING, WmTabCommand_DisplayGrouping);
cmessages.Associate(IDC_COMBO_DISPLAY_GROUPING_DIGITS, WmTabCommand_DisplayGrouping);
cmessages.Associate(IDC_COMBO_INPUT_DECIMAL_POINT, WmTabCommand_DisplayInputDecimalPoint);
cmessages.Associate(IDC_COMBO_PARAM_SEPARATE, WmTabCommand_DisplayParamSep);
}
@ -1579,6 +1641,7 @@ char buffer[20];
CheckDlgButton(hWnd, IDC_RADIO_DISPLAY_NOT_ALWAYS_SCIENTIFIC, BST_CHECKED);
SetDisablingDisplayWhenScientific(hWnd);
SetDisablingGroupingDigits(hWnd);
SendDlgItemMessage(hWnd, IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC, UDM_SETBASE, 10,0);
SendDlgItemMessage(hWnd, IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC, UDM_SETRANGE, 0, MAKELONG(99,1));

Loading…
Cancel
Save