Browse Source

changed: the main window has been enlarged

added:   there are some new buttons on the standard tab
         - (...) - the whole expression is surrounded by brackets
         - 1/(...)
         - ;
         - %
         - floor/ceil
         - min/max
         - root
         - gamma
added:   some options on display tab:
         - grouping
         - input decimal point
         - parameters separated by



git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@227 e52654a7-88a9-db11-a3e9-0013d4bc506e
master
Tomasz Sowa 13 years ago
parent
commit
fbab1df13f
  1. 3
      help/arithmetic_functions.html
  2. 3
      help/operators_priority.html
  3. 6
      src/languages.cpp
  4. 4
      src/mainwindow.cpp
  5. 53
      src/parsermanager.cpp
  6. 18
      src/parsermanager.h
  7. 68
      src/programresources.cpp
  8. 32
      src/programresources.h
  9. 21
      src/resource.h
  10. 275
      src/resource.rc
  11. 321
      src/tabs.cpp

3
help/arithmetic_functions.html

@ -99,7 +99,8 @@
<ul>
<li><a href="other_functions.html">sqrt(x)</a></li>
<li><a href="other_functions.html">root(x ; n)</a></li>
<li><a href="other_functions.html">factorial(x)</a></li>
<li><a href="other_functions.html">factorial(n)</a></li>
<li><a href="other_functions.html">gamma(x)</a></li>
<li><a href="other_functions.html">abs(x)</a></li>
<li><a href="other_functions.html">sgn(x)</a></li>
<li><a href="other_functions.html">mod(x; y)</a></li>

3
help/operators_priority.html

@ -21,7 +21,8 @@
<tr><td>Operator</td><td>Description</td><td>Sample</td></tr>
</thead>
<tr><td>( )</td><td>parentheses for grouping an expression</td><td>(1+3)*4</td></tr>
<tr><td>- + # &amp;</td><td>unary minus and plus, and operators for changing the base (radix)</td><td>-10</td></tr>
<tr><td>- + # &amp;</td><td>unary minus and plus, and operators for changing the base (radix)</td><td>-10<br>&1111 (bin)<br>#ff (hex)</td></tr>
<tr><td>%</td><td>percentage from a previous value</td><td>100-30%</td></tr>
<tr><td>^</td><td>powering</td><td>3^2</td></tr>
<tr><td>* /</td><td>multiplication and division</td><td>10*20</td></tr>
<tr><td>without an operator</td><td>short form of multiplication<br>(only if the second argument is a variable or function,<br>the same priority as a normal multiplication)</td><td>3y</td></tr>

6
src/languages.cpp

@ -419,13 +419,13 @@ void Languages::InitGuiMessagesTab()
InsertGuiPair(combo_rounding_after_comma,"digit(s)");
InsertGuiPair(check_remove_zeroes,"Remove last trailing zeroes");
InsertGuiPair(display_input, "Input");
InsertGuiPair(display_output, "Output");
InsertGuiPair(display_input, "Input base");
InsertGuiPair(display_output, "Output base");
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_decimal_point, "Decimal point");
InsertGuiPair(display_decimal_point, "Output decimal point");
InsertGuiPair(display_deg_rad_grad, "sin/cos asin/acos");
InsertGuiPair(convert_type, "Type");
InsertGuiPair(convert_input, "Input");

4
src/mainwindow.cpp

@ -595,6 +595,10 @@ HWND hTab = GetDlgItem(hWnd,IDC_TAB);
SendDlgItemMessage(hWnd,IDC_INPUT_EDIT,EM_SETLIMITTEXT,GetPrgRes()->GetBufferSize()-1,0);
SetMenuLanguage(hWnd);
#ifdef TTCALC_PORTABLE
SetWindowText(hWnd, "TTCalc portable");
#endif
return true;
}

53
src/parsermanager.cpp

@ -100,18 +100,27 @@ ttmath::ErrorCode ParserManager::Parse()
case 0:
parser1.SetBase(base_input);
parser1.SetDegRadGrad(angle_deg_rad_grad);
parser1.SetComma(input_comma1, input_comma2);
parser1.SetGroup(grouping);
parser1.SetParamSep(param_sep);
code = parser1.Parse(buffer);
break;
case 1:
parser2.SetBase(base_input);
parser2.SetDegRadGrad(angle_deg_rad_grad);
parser2.SetComma(input_comma1, input_comma2);
parser2.SetGroup(grouping);
parser2.SetParamSep(param_sep);
code = parser2.Parse(buffer);
break;
default:
parser3.SetBase(base_input);
parser3.SetDegRadGrad(angle_deg_rad_grad);
parser3.SetComma(input_comma1, input_comma2);
parser3.SetGroup(grouping);
parser3.SetParamSep(param_sep);
code = parser3.Parse(buffer);
break;
}
@ -120,6 +129,9 @@ ttmath::ErrorCode ParserManager::Parse()
parser1.SetBase(base_input);
parser1.SetDegRadGrad(angle_deg_rad_grad);
parser1.SetComma(input_comma1, input_comma2);
parser1.SetGroup(grouping);
parser1.SetParamSeparator(param_sep);
code = parser1.Parse(buffer);
#endif
@ -177,6 +189,47 @@ unsigned int i;
decimal_point = '.';
else
decimal_point = ',';
// grouping
static char group_table[] = "\0 `'.,"; // 5 items
int g = GetPrgRes()->GetGrouping();
if( g>=0 && g<=5 )
grouping = group_table[g];
else
grouping = 0;
// input decimal point
switch( GetPrgRes()->GetInputDecimalPoint() )
{
case 0:
input_comma1 = '.';
input_comma2 = ',';
break;
case 1:
input_comma1 = '.';
input_comma2 = 0;
break;
case 2:
default:
input_comma1 = ',';
input_comma2 = 0;
break;
}
// additional param separator
static char param_table[] = ";.,"; // 3 items
g = GetPrgRes()->GetParamSep();
if( g>=0 && g<=3 )
param_sep = param_table[g];
else
param_sep = ';';
}

18
src/parsermanager.h

@ -136,6 +136,10 @@ private:
ttmath::ErrorCode code;
char decimal_point;
int angle_deg_rad_grad;
int grouping;
int input_comma1;
int input_comma2;
int param_sep;
/*
some buffers which we use in some method in the second thread,
@ -192,7 +196,17 @@ private:
}
}
if( result.ToString(buffer2,base_output, always_scientific, when_scientific, rounding, remove_zeroes, decimal_point) )
ttmath::Conv conv;
conv.base = base_output;
conv.scient = always_scientific;
conv.scient_from = when_scientific;
conv.comma_digits = rounding;
conv.trim_zeroes = remove_zeroes;
conv.comma = decimal_point;
conv.group = grouping;
if( result.ToString(buffer2, conv) )
{
// we shouldn't have had this error in the new version of ToStrign(...)
// (where we're using a bigger type for calculating)
@ -208,7 +222,7 @@ private:
AddOutputSuffix(buffer1);
if( i < matparser.stack.size()-1 )
buffer1 += " ";
buffer1 += " ; ";
}
SetDlgItemText(GetPrgRes()->GetMainWindow(),IDC_OUTPUT_EDIT,buffer1.c_str());

68
src/programresources.cpp

@ -514,6 +514,51 @@ int ProgramResources::GetPrecision()
}
void ProgramResources::SetGrouping(int g)
{
grouping = g;
if( grouping<0 || grouping>5 )
g = 0;
}
int ProgramResources::GetGrouping()
{
return grouping;
}
void ProgramResources::SetInputDecimalPoint(int p)
{
input_decimal_point = p;
if( input_decimal_point<0 || input_decimal_point>2 )
decimal_point = 0;
}
int ProgramResources::GetInputDecimalPoint()
{
return input_decimal_point;
}
void ProgramResources::SetParamSep(int s)
{
param_sep = s;
if( param_sep<0 || param_sep>2 )
param_sep = 0;
}
int ProgramResources::GetParamSep()
{
return param_sep;
}
ProgramResources::ProgramResources()
{
@ -569,6 +614,9 @@ ProgramResources::ProgramResources()
decimal_point = 0;
angle_deg_rad_grad = 1; // rad is default
grouping = 0;
input_decimal_point = 2; // dot or comma
param_sep = 0;
variables_id = 0;
functions_id = 0;
@ -916,7 +964,7 @@ std::string ini_value[30];
iparser.Associate( "global|disp.rounding", &ini_value[11] );
iparser.Associate( "global|size.y", &ini_value[12] );
iparser.Associate( "global|language", &ini_value[13] );
iparser.Associate( "global|disp.dec.point", &ini_value[14] );
iparser.Associate( "global|disp.output_comma", &ini_value[14] );
iparser.Associate( "global|disp.remove.zeroes", &ini_value[15] );
iparser.Associate( "global|disp.deg_rad_grad", &ini_value[16] );
iparser.Associate( "global|pad.x", &ini_value[17] );
@ -925,6 +973,9 @@ std::string ini_value[30];
iparser.Associate( "global|pad.size.y", &ini_value[20] );
iparser.Associate( "global|pad.maximized", &ini_value[21] );
iparser.Associate( "global|pad", &ini_value[22] );
iparser.Associate( "global|disp.grouping", &ini_value[23] );
iparser.Associate( "global|disp.input_comma", &ini_value[24] );
iparser.Associate( "global|disp.param_sep", &ini_value[25] );
iparser.Associate( "variables", &temp_variables );
iparser.Associate( "functions", &temp_functions );
@ -988,6 +1039,10 @@ std::string ini_value[30];
show_pad = bool( atoi(ini_value[22].c_str()) );
CheckPadCoordinates();
SetGrouping( atoi(ini_value[23].c_str()) );
SetInputDecimalPoint( atoi(ini_value[24].c_str()) );
SetParamSep( atoi(ini_value[24].c_str()) );
if( err != IniParser::err_ok )
bad_line = iparser.GetBadLine();
@ -1008,6 +1063,8 @@ std::ofstream file( configuration_file.c_str() );
file << "always.on.top = " << (int)always_on_top << std::endl;
file << "view = " << (int)view << std::endl;
file << "language = " << (int)languages.GetCurrentLanguage()
<< std::endl;
file << "x = " << x_pos << std::endl;
file << "y = " << y_pos << std::endl;
file << "size.x = " << x_size << std::endl;
@ -1022,16 +1079,17 @@ std::ofstream file( configuration_file.c_str() );
file << "precision = " << precision << std::endl;
file << "disp.input = " << base_input << std::endl;
file << "disp.output = " << base_output << std::endl;
file << "language = " << static_cast<int>(languages.GetCurrentLanguage())
<< std::endl;
file << "disp.alw.scientific = " << (int)display_always_scientific << std::endl;
file << "disp.when.scientific = " << display_when_scientific << std::endl;
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.input_comma = " << input_decimal_point << std::endl;
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.param_sep = " << param_sep << std::endl;
file << "\n[variables]\n";

32
src/programresources.h

@ -388,6 +388,34 @@ public:
bool IsPadVisible();
/*!
setting/getting the group character
0 - none
1 - space
2 - '`'
3 - '\''
4 - '.'
5 - ','
*/
void SetGrouping(int g);
int GetGrouping();
/*!
setting/getting the input decimal point
0 - dot or comma, 1 - dot, 2 - comma
*/
void SetInputDecimalPoint(int p);
int GetInputDecimalPoint();
/*!
setting/getting the separator of function arguments
0 - semicolon, 1 - dot, 2 - comma
*/
void SetParamSep(int s);
int GetParamSep();
private:
@ -450,9 +478,13 @@ private:
int display_rounding;
bool remove_zeroes;
int angle_deg_rad_grad;
int grouping; // 0 - none, 1 - space, 2 - '`', 3 - '\'', 4 - '.', 5 - ','
int input_decimal_point; // 0 - dot or comma, 1 - dot, 2 - comma
int param_sep; // parameters separator: 0 - semicolon, 1 - dot, 2 - comma
int bad_line;
bool show_pad;
};

21
src/resource.h

@ -84,7 +84,6 @@
#define IDC_BUTTON_SGN 1075
#define IDC_BUTTON_MOD 1076
// values from IDC_BUTTON_PRESS_0 to IDC_BUTTON_PRESS_9 should be with the step equal one
#define IDC_BUTTON_PRESS_0 1100
#define IDC_BUTTON_PRESS_1 1101
@ -118,6 +117,19 @@
#define IDC_BUTTON_INT 1129
#define IDC_BUTTON_ROUND 1130
#define IDC_BUTTON_EXP 1131
#define IDC_BUTTON_SQRT 1400
#define IDC_BUTTON_BRACKETS_ALL 1401
#define IDC_BUTTON_1DIV_BRACKETS_ALL 1402
#define IDC_BUTTON_SEMICOLON 1403
#define IDC_BUTTON_PERCENTAGE 1404
#define IDC_BUTTON_FLOOR 1405
#define IDC_BUTTON_CEIL 1406
#define IDC_BUTTON_MIN 1407
#define IDC_BUTTON_MAX 1408
#define IDC_BUTTON_AVG 1409
#define IDC_BUTTON_SUM 1410
#define IDC_BUTTON_ROOT 1411
#define IDC_BUTTON_GAMMA 1412
// variables tab
@ -170,7 +182,12 @@
#define IDC_CHECK_REMOVE_ZEROES 1171
#define IDC_LABEL_DISPLAY_DEG_RAD_GRAD 1172
#define IDC_COMBO_DEG_RAD_GRAD 1173
#define IDC_COMBO_DISPLAY_GROUPING 1174
#define IDC_LABEL_GROUPING 1175
#define IDC_COMBO_INPUT_DECIMAL_POINT 1176
#define IDC_LABEL_INPUT_DECIMAL_POINT 1177
#define IDC_LABEL_PARAM_SEPARATE 1178
#define IDC_COMBO_PARAM_SEPARATE 1179
// convert tab
#define IDC_LIST_UNIT_TYPE 1200

275
src/resource.rc

@ -1,16 +1,15 @@
#define APSTUDIO_READONLY_SYMBOLS
//#define APSTUDIO_READONLY_SYMBOLS
//#include "afxres.h"
#undef APSTUDIO_READONLY_SYMBOLS
//#undef APSTUDIO_READONLY_SYMBOLS
#include "windows.h"
#include "resource.h"
LANGUAGE LANG_POLISH, 1
104 ICON "..\\res\\icon02.ico"
IDI_ICON2 ICON "..\\res\\icon02.ico"
LANGUAGE LANG_POLISH, 2
105 ICON "..\\res\\icon01.ico"
#include "resource.h"
IDI_ICON1 ICON "..\\res\\icon01.ico"
LANGUAGE LANG_NEUTRAL, 0
200 MENU
@ -80,19 +79,18 @@ BEGIN
END
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
101 DIALOGEX 0, 0, 295, 189
STYLE DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION |
WS_SYSMENU | WS_THICKFRAME
CAPTION "TTCalc"
#else
CAPTION "TTCalc portable"
#endif
MENU 200
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,106, WS_EX_CONTROLPARENT
EDITTEXT IDC_INPUT_EDIT,0,6,260,14,ES_AUTOHSCROLL
EDITTEXT IDC_OUTPUT_EDIT,0,21,260,14,ES_AUTOHSCROLL | ES_READONLY
CONTROL "",IDC_TAB,"SysTabControl32",WS_GROUP | WS_TABSTOP,0,39,
292,123,WS_EX_CONTROLPARENT
END
@ -102,12 +100,12 @@ STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE |
CAPTION "Add a new variable"
FONT 8, "Ms Shell Dlg"
BEGIN
DEFPUSHBUTTON "Ok",1,291,10,50,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "Cancel",2,291,28,50,14,BS_CENTER | BS_VCENTER
EDITTEXT 1134,47,10,67,14,ES_AUTOHSCROLL
EDITTEXT 1135,47,28,226,14,ES_AUTOHSCROLL
LTEXT "name:",1136,7,12,38,8
LTEXT "value:",1137,7,30,38,8
DEFPUSHBUTTON "Ok",IDOK,291,10,50,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "Cancel",IDCANCEL,291,28,50,14,BS_CENTER | BS_VCENTER
EDITTEXT IDC_EDIT_VARIABLE_NAME,47,10,67,14,ES_AUTOHSCROLL
EDITTEXT IDC_EDIT_VARIABLE_VALUE,47,28,226,14,ES_AUTOHSCROLL
LTEXT "name:",IDC_STATIC_VARIABLE_NAME,7,12,38,8
LTEXT "value:",IDC_STATIC_VARIABLE_VALUE,7,30,38,8
END
103 DIALOG DISCARDABLE 0, 0, 370, 74
@ -115,143 +113,184 @@ STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE |
WS_CAPTION | WS_SYSMENU
FONT 8, "Ms Shell Dlg"
BEGIN
DEFPUSHBUTTON "Ok",1,304,10,50,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "Cancel",2,304,27,50,14,BS_CENTER | BS_VCENTER
EDITTEXT 1144,55,10,67,14,ES_AUTOHSCROLL
COMBOBOX 1146,55,29,67,130,CBS_DROPDOWNLIST | WS_TABSTOP
EDITTEXT 1145,55,47,299,14,ES_AUTOHSCROLL
LTEXT "name:",1147,7,12,46,8
LTEXT "value:",1149,7,49,46,8
LTEXT "param:",1148,7,30,46,8
DEFPUSHBUTTON "Ok",IDOK,304,10,50,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "Cancel",IDCANCEL,304,27,50,14,BS_CENTER | BS_VCENTER
EDITTEXT IDC_EDIT_FUNCTION_NAME,55,10,67,14,ES_AUTOHSCROLL
COMBOBOX IDC_COMBO_FUNCTION_PARAM,55,29,67,130,CBS_DROPDOWNLIST | WS_TABSTOP
EDITTEXT IDC_EDIT_FUNCTION_VALUE,55,47,299,14,ES_AUTOHSCROLL
LTEXT "name:",IDC_STATIC_FUNCTION_NAME,7,12,46,8
LTEXT "value:",IDC_STATIC_FUNCTION_VALUE,7,49,46,8
LTEXT "param:",IDC_STATIC_FUNCTION_PARAM,7,30,46,8
END
110 DIALOGEX 0, 0, 287, 90
STYLE DS_3DLOOK | DS_FIXEDSYS |DS_SETFONT | WS_CHILD| WS_TABSTOP |WS_GROUP
110 DIALOG DISCARDABLE 0, 0, 288, 107
STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_GROUP | WS_TABSTOP
FONT 8, "Ms Shell Dlg"
BEGIN
PUSHBUTTON "Clear",1110,3,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "(",1111,33,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON ")",1112,62,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "^",1128,91,3,26,14,BS_CENTER | BS_BOTTOM
PUSHBUTTON "7",1107,3,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "8",1108,33,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "9",1109,62,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "/",1113,91,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "4",1104,3,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "5",1105,33,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "6",1106,62,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "*",1114,91,37,26,14,BS_CENTER | BS_BOTTOM
PUSHBUTTON "1",1101,3,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "2",1102,33,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "3",1103,62,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "-",1115,91,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "0",1100,3,71,56,14,BS_CENTER | BS_VCENTER
PUSHBUTTON ",",1117,62,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "+",1116,91,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "sin",1120,131,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "asin",1071,160,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "ln",1124,189,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "cos",1121,131,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "acos",1072,160,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "log",1125,189,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "tan",1122,131,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "atan",1073,160,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "exp",1131,189,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "cot",1123,131,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "acot",1074,160,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "abs",1126,189,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "int",1129,131,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "round",1130,160,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "!",1127,189,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "sgn",1075,229,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "mod",1076,229,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "e",1118,229,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "pi",1119,229,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "err",1070,229,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "Clear",IDC_BUTTON_CLEAR,4,3,55,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "(",IDC_BUTTON_FIRST_BRACKET,62,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON ")",IDC_BUTTON_LAST_BRACKET,91,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "(...)",IDC_BUTTON_BRACKETS_ALL,4,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON ";",IDC_BUTTON_SEMICOLON,33,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "%",IDC_BUTTON_PERCENTAGE,62,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "^",IDC_BUTTON_POWER,91,20,26,14,BS_CENTER | BS_BOTTOM
PUSHBUTTON "7",IDC_BUTTON_PRESS_7,4,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "8",IDC_BUTTON_PRESS_8,33,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "9",IDC_BUTTON_PRESS_9,62,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "/",IDC_BUTTON_DIV,91,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "4",IDC_BUTTON_PRESS_4,4,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "5",IDC_BUTTON_PRESS_5,33,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "6",IDC_BUTTON_PRESS_6,62,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "*",IDC_BUTTON_MUL,91,54,26,14,BS_CENTER | BS_BOTTOM
PUSHBUTTON "1",IDC_BUTTON_PRESS_1,4,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "2",IDC_BUTTON_PRESS_2,33,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "3",IDC_BUTTON_PRESS_3,62,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "-",IDC_BUTTON_SUB,91,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "0",IDC_BUTTON_PRESS_0,4,88,55,14,BS_CENTER | BS_VCENTER
PUSHBUTTON ",",IDC_BUTTON_COMMA,62,88,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "+",IDC_BUTTON_ADD,91,88,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "sin",IDC_BUTTON_SIN,131,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "asin",IDC_BUTTON_ASIN,160,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "ln",IDC_BUTTON_LN,189,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "cos",IDC_BUTTON_COS,131,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "acos",IDC_BUTTON_ACOS,160,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "log",IDC_BUTTON_LOG,189,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "tan",IDC_BUTTON_TAN,131,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "atan",IDC_BUTTON_ATAN,160,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "exp",IDC_BUTTON_EXP,189,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "cot",IDC_BUTTON_COT,131,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "acot",IDC_BUTTON_ACOT,160,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "abs",IDC_BUTTON_ABS,189,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "int",IDC_BUTTON_INT,131,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "round",IDC_BUTTON_ROUND,160,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "mod",IDC_BUTTON_MOD,189,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "floor",IDC_BUTTON_FLOOR,131,88,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "ceil",IDC_BUTTON_CEIL,160,88,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "sgn",IDC_BUTTON_SGN,189,88,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "min",IDC_BUTTON_MIN,229,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "max",IDC_BUTTON_MAX,258,3,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "avg",IDC_BUTTON_AVG,229,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "sum",IDC_BUTTON_SUM,258,20,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "sqrt",IDC_BUTTON_SQRT,229,37,26,14, BS_CENTER | BS_VCENTER
PUSHBUTTON "root",IDC_BUTTON_ROOT,258,37,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "!",IDC_BUTTON_FACTORIAL,229,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "gamma",IDC_BUTTON_GAMMA,258,54,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "e",IDC_BUTTON_E,229,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "pi",IDC_BUTTON_PI,258,71,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "1/(...)",IDC_BUTTON_1DIV_BRACKETS_ALL,229,88,26,14,BS_CENTER | BS_VCENTER
PUSHBUTTON "err",IDC_BUTTON_ERROR,258,88,26,14,BS_CENTER | BS_VCENTER
END
111 DIALOG 0, 0, 287, 90
111 DIALOG 0, 0, 288, 107
STYLE DS_3DLOOK |DS_FIXEDSYS |DS_SETFONT |WS_CHILD | WS_TABSTOP |WS_GROUP
CAPTION "tab2"
FONT 8, "Ms Shell Dlg"
BEGIN
CONTROL "Add",1133,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,3,50,14
CONTROL "Edit",1138,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,21,50,14
CONTROL "Delete",1139,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,39,50,14
CONTROL "",1132,"SysListView32",LVS_REPORT |LVS_SHOWSELALWAYS |LVS_SORTASCENDING |LVS_ALIGNLEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,57,3,223,85
CONTROL "Add",IDC_BUTTON_ADD_VARIABLE,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,3,50,14
CONTROL "Edit",IDC_BUTTON_EDIT_VARIABLE,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,21,50,14
CONTROL "Delete",IDC_BUTTON_DELETE_VARIABLE,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,39,50,14
CONTROL "",IDC_VARIABLES_LIST,"SysListView32",LVS_REPORT |LVS_SHOWSELALWAYS |LVS_SORTASCENDING |LVS_ALIGNLEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,57,3,223,85
END
112 DIALOG 0, 0, 287, 90
112 DIALOG 0, 0, 288, 107
STYLE DS_3DLOOK |DS_FIXEDSYS |DS_SETFONT |WS_CHILD | WS_TABSTOP |WS_GROUP
CAPTION "tab3"
FONT 8, "Ms Shell Dlg"
BEGIN
CONTROL "Add",1140,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,3,50,14
CONTROL "Edit",1141,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,21,50,14
CONTROL "Delete",1142,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,39,50,14
CONTROL "",1143,"SysListView32",LVS_REPORT |LVS_SHOWSELALWAYS |LVS_SORTASCENDING |LVS_ALIGNLEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,57,3,223,85
CONTROL "Add",IDC_BUTTON_ADD_FUNCTION,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,3,50,14
CONTROL "Edit",IDC_BUTTON_EDIT_FUNCTION,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,21,50,14
CONTROL "Delete",IDC_BUTTON_DELETE_FUNCTION,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,39,50,14
CONTROL "",IDC_FUNCTIONS_LIST,"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
113 DIALOG DISCARDABLE 0, 0, 288, 107
STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_CAPTION | WS_GROUP |
WS_TABSTOP
CAPTION "tab4"
FONT 8, "Ms Shell Dlg"
BEGIN
CONTROL "precision 1",1150,"BUTTON",BS_AUTORADIOBUTTON |BS_LEFT |WS_CHILD |WS_GROUP|WS_TABSTOP | WS_VISIBLE ,15,4,252,10
CONTROL "precision 2",1151,"BUTTON",BS_AUTORADIOBUTTON |BS_LEFT |WS_CHILD |WS_TABSTOP | WS_VISIBLE ,15,33,252,10
CONTROL "precision 3",1152,"BUTTON",BS_AUTORADIOBUTTON |BS_LEFT |WS_CHILD |WS_TABSTOP | WS_VISIBLE ,15,62,252,10
CONTROL "info 1",1153,"STATIC",SS_LEFT |WS_CHILD |WS_VISIBLE ,28,17,245,8
CONTROL "info 2",1154,"STATIC",SS_LEFT |WS_CHILD |WS_VISIBLE ,28,46,245,8
CONTROL "info 3",1155,"STATIC",SS_LEFT |WS_CHILD |WS_VISIBLE ,28,74,245,8
CONTROL "precision 1",IDC_RADIO_PRECISION_1,"Button",
BS_AUTORADIOBUTTON | BS_LEFT | WS_GROUP | WS_TABSTOP,21,
11,256,10
CONTROL "precision 2",IDC_RADIO_PRECISION_2,"Button",
BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,21,42,256,10
CONTROL "precision 3",IDC_RADIO_PRECISION_3,"Button",
BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,21,73,256,10
LTEXT "info 1",IDC_LABEL_PRECISION_1_INFO,38,24,239,8,NOT
WS_GROUP
LTEXT "info 2",IDC_LABEL_PRECISION_2_INFO,38,55,239,8,NOT
WS_GROUP
LTEXT "info 3",IDC_LABEL_PRECISION_3_INFO,38,85,239,8,NOT
WS_GROUP
END
#endif
114 DIALOG DISCARDABLE 0, 0, 255, 90
114 DIALOG DISCARDABLE 0, 0, 288, 107
STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_CAPTION | WS_GROUP |
WS_TABSTOP
CAPTION "tab5"
FONT 8, "Ms Shell Dlg"
BEGIN
COMBOBOX 1156,58,5,58,200,CBS_DROPDOWNLIST | WS_GROUP |
CONTROL "Input base",IDC_LABEL_DISPLAY_INPUT,"Static",
SS_LEFTNOWORDWRAP | WS_GROUP,8,4,43,8
CONTROL "Output base",IDC_LABEL_DISPLAY_OUTPUT,"Static",
SS_LEFTNOWORDWRAP | WS_GROUP,8,18,43,8
CONTROL "Rounding",IDC_LABEL_DISPLAY_ROUNDING,"Static",
SS_LEFTNOWORDWRAP | WS_GROUP,8,32,43,8
CONTROL "Grouping",IDC_LABEL_GROUPING,"Static",SS_LEFTNOWORDWRAP |
WS_GROUP,8,46,43,8
COMBOBOX IDC_COMBO_DISPLAY_INPUT,61,2,49,200,CBS_DROPDOWNLIST |
WS_GROUP | WS_TABSTOP
COMBOBOX IDC_COMBO_DISPLAY_OUTPUT,61,16,49,200,CBS_DROPDOWNLIST |
WS_TABSTOP
COMBOBOX IDC_COMBO_DISPLAY_ROUNDING,61,30,49,200,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 |
BS_LEFTTEXT | BS_LEFT | WS_TABSTOP,136,36,115,10
CONTROL "Always",1160,"Button",BS_AUTORADIOBUTTON | BS_LEFT |
WS_GROUP | WS_TABSTOP,19,65,54,10
CONTROL "When the exponent is greater than:",1161,"Button",
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
COMBOBOX IDC_COMBO_DISPLAY_GROUPING,61,44,49,112,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_COMBO_DEG_RAD_GRAD,234,44,49,53,CBS_DROPDOWNLIST |
WS_TABSTOP
CONTROL "sin/cos asin/acos",IDC_LABEL_DISPLAY_DEG_RAD_GRAD,
"Static",SS_LEFTNOWORDWRAP | WS_GROUP,143,46,87,8
COMBOBOX IDC_COMBO_DECIMAL_POINT,234,16,49,62,CBS_DROPDOWNLIST |
WS_TABSTOP
CONTROL "Output decimal point",IDC_LABEL_DECIMAL_POINT,"Static",
SS_LEFTNOWORDWRAP | WS_GROUP,143,18,87,8
CONTROL "remove trailing zeroes",IDC_CHECK_REMOVE_ZEROES,"Button",
BS_AUTOCHECKBOX | BS_LEFTTEXT | BS_LEFT | WS_TABSTOP,142,
60,139,10
CONTROL "Always",IDC_RADIO_DISPLAY_ALWAYS_SCIENTIFIC,"Button",
BS_AUTORADIOBUTTON | BS_LEFT | WS_GROUP | WS_TABSTOP,14,
87,54,10
CONTROL "When the exponent is greater than:",
IDC_RADIO_DISPLAY_NOT_ALWAYS_SCIENTIFIC,"Button",
BS_AUTORADIOBUTTON | BS_LEFT,90,87,151,10
EDITTEXT IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC,245,84,29,14,ES_NUMBER |
WS_GROUP
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
COMBOBOX IDC_COMBO_INPUT_DECIMAL_POINT,234,2,49,56,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Input decimal point",IDC_LABEL_INPUT_DECIMAL_POINT,
"Static",SS_LEFTNOWORDWRAP | WS_GROUP,143,4,87,8
COMBOBOX IDC_COMBO_PARAM_SEPARATE,234,30,49,54,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
CONTROL "Parameters separated by",IDC_LABEL_PARAM_SEPARATE,
"Static",SS_LEFTNOWORDWRAP | WS_GROUP,143,32,87,8
END
#ifdef TTCALC_CONVERT
115 DIALOG DISCARDABLE 0, 0, 260, 90
115 DIALOG DISCARDABLE 0, 0, 288, 107
STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_CAPTION | WS_GROUP |
WS_TABSTOP
CAPTION "tab6"

321
src/tabs.cpp

@ -157,7 +157,7 @@ return true;
BOOL WmTabCommand_Press_log(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
InsertText("log( ; )",-4);
InsertText("log( ; 2)",-5);
return true;
}
@ -240,8 +240,11 @@ BOOL WmTabCommand_Press_error(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
if( last_code != ttmath::err_ok )
{
PrintErrorCode();
HWND input_edit = GetDlgItem( GetPrgRes()->GetMainWindow(), IDC_INPUT_EDIT );
SetFocus(input_edit);
}
return true;
}
@ -825,6 +828,7 @@ 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 )
@ -838,6 +842,46 @@ return true;
}
BOOL WmTabCommand_DisplayGrouping(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if( HIWORD(wParam) != CBN_SELCHANGE )
return false;
GetPrgRes()->GetThreadController()->StopCalculating();
GetPrgRes()->SetGrouping( (int)SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_GETCURSEL, 0, 0) );
GetPrgRes()->GetThreadController()->StartCalculating();
return true;
}
BOOL WmTabCommand_DisplayInputDecimalPoint(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if( HIWORD(wParam) != CBN_SELCHANGE )
return false;
GetPrgRes()->GetThreadController()->StopCalculating();
GetPrgRes()->SetInputDecimalPoint( (int)SendDlgItemMessage(hWnd, IDC_COMBO_INPUT_DECIMAL_POINT, CB_GETCURSEL, 0, 0) );
GetPrgRes()->GetThreadController()->StartCalculating();
return true;
}
BOOL WmTabCommand_DisplayParamSep(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if( HIWORD(wParam) != CBN_SELCHANGE )
return false;
GetPrgRes()->GetThreadController()->StopCalculating();
GetPrgRes()->SetParamSep( (int)SendDlgItemMessage(hWnd, IDC_COMBO_PARAM_SEPARATE, CB_GETCURSEL, 0, 0) );
GetPrgRes()->GetThreadController()->StartCalculating();
return true;
}
void SetDisablingDisplayWhenScientific(HWND hWnd)
{
if( IsDlgButtonChecked(hWnd, IDC_RADIO_DISPLAY_ALWAYS_SCIENTIFIC) == BST_CHECKED )
@ -922,6 +966,243 @@ return true;
int CalcBracketsPrev(const char * buf, int start)
{
int last;
int brackets;
last = start;
--start;
while( true )
{
for( ; start>=0 && buf[start]!=';' ; --start )
if( buf[start] != ' ' )
last = start;
if( start <= 0 )
return last;
--start; // skipping a semicolon
brackets = 0;
for( ; start>=0 ; --start )
{
if( buf[start] == '(' )
++brackets;
else
if( buf[start] == ')' )
--brackets;
if( brackets > 0 )
{
last = start;
break;
}
}
}
}
int CalcBracketsNext(const char * buf, int size, int start)
{
int last;
int brackets;
if( start >= size )
return size;
last = start;
while( true )
{
for( ; start<size && buf[start]!=';' ; ++start )
if( buf[start] != ' ' )
last = start;
if( start >= size )
{
if( buf[last] == ';' || buf[last] == ' ' )
return last;
else
return last+1;
}
++start; // skipping a semicolon
brackets = 0;
for( ; start<size ; ++start )
{
if( buf[start] == '(' )
++brackets;
else
if( buf[start] == ')' )
--brackets;
if( brackets < 0 )
{
last = start;
break;
}
}
}
}
void CalcBracketsPos(HWND input, int & start, int & end)
{
DWORD sel_start, sel_end;
SendMessage(input, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
if( sel_start != sel_end )
{
start = sel_start;
end = sel_end;
return;
}
start = 0;
end = SendMessage(input, EM_LINELENGTH, 0, 0);
if( end > 0 )
{
const char * buf = new char[end+sizeof(WORD)];
*(WORD*)(buf) = end;
SendMessage(input, EM_GETLINE, 0, (LPARAM)buf);
start = CalcBracketsPrev(buf, sel_start);
end = CalcBracketsNext(buf, end, sel_start);
delete [] buf;
}
}
BOOL WmTabCommand_Press_bracketsall(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND main = GetPrgRes()->GetMainWindow();
HWND input = GetDlgItem(main, IDC_INPUT_EDIT);
int start, end;
CalcBracketsPos(input, start, end);
SendMessage(input, EM_SETSEL, start, start);
SendMessage(input, EM_REPLACESEL, 1, LPARAM("("));
SendMessage(input, EM_SETSEL, end+1, end+1);
SendMessage(input, EM_REPLACESEL, 1, LPARAM(")"));
SetFocus(input);
return true;
}
BOOL WmTabCommand_Press_1div_bracketsall(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND main = GetPrgRes()->GetMainWindow();
HWND input = GetDlgItem(main, IDC_INPUT_EDIT);
int start, end;
CalcBracketsPos(input, start, end);
SendMessage(input, EM_SETSEL, start, start);
SendMessage(input, EM_REPLACESEL, 1, LPARAM("1/("));
SendMessage(input, EM_SETSEL, end+3, end+3);
SendMessage(input, EM_REPLACESEL, 1, LPARAM(")"));
SetFocus(input);
return true;
}
BOOL WmTabCommand_Press_semicolon(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
InsertText(" ; ", 0);
return true;
}
BOOL WmTabCommand_Press_percentage(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
InsertText("%", 0);
return true;
}
BOOL WmTabCommand_Press_floor(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
InsertText("floor()", -1);
return true;
}
BOOL WmTabCommand_Press_ceil(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
InsertText("ceil()", -1);
return true;
}
BOOL WmTabCommand_Press_min(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
InsertText("min()", -1);
return true;
}
BOOL WmTabCommand_Press_max(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
InsertText("max()", -1);
return true;
}
BOOL WmTabCommand_Press_avg(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
InsertText("avg()", -1);
return true;
}
BOOL WmTabCommand_Press_sum(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
InsertText("sum()", -1);
return true;
}
BOOL WmTabCommand_Press_root(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
InsertText("root( ; 2)", -5);
return true;
}
BOOL WmTabCommand_Press_gamma(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
InsertText("gamma()", -1);
return true;
}
void CreateTabCommandMessagesTable(Messages<BOOL> & cmessages)
{
cmessages.Associate(IDC_BUTTON_PRESS_0, WmTabCommand_Press_0_9);
@ -946,6 +1227,16 @@ void CreateTabCommandMessagesTable(Messages<BOOL> & cmessages)
cmessages.Associate(IDC_BUTTON_LOG, WmTabCommand_Press_log);
cmessages.Associate(IDC_BUTTON_ABS, WmTabCommand_Press_abs);
cmessages.Associate(IDC_BUTTON_FACTORIAL, WmTabCommand_Press_factorial);
cmessages.Associate(IDC_BUTTON_SEMICOLON, WmTabCommand_Press_semicolon);
cmessages.Associate(IDC_BUTTON_PERCENTAGE, WmTabCommand_Press_percentage);
cmessages.Associate(IDC_BUTTON_FLOOR, WmTabCommand_Press_floor);
cmessages.Associate(IDC_BUTTON_CEIL, WmTabCommand_Press_ceil);
cmessages.Associate(IDC_BUTTON_MIN, WmTabCommand_Press_min);
cmessages.Associate(IDC_BUTTON_MAX, WmTabCommand_Press_max);
cmessages.Associate(IDC_BUTTON_AVG, WmTabCommand_Press_avg);
cmessages.Associate(IDC_BUTTON_SUM, WmTabCommand_Press_sum);
cmessages.Associate(IDC_BUTTON_ROOT, WmTabCommand_Press_root);
cmessages.Associate(IDC_BUTTON_GAMMA, WmTabCommand_Press_gamma);
@ -966,11 +1257,12 @@ void CreateTabCommandMessagesTable(Messages<BOOL> & cmessages)
cmessages.Associate(IDC_BUTTON_SGN, WmTabCommand_Press_sgn);
cmessages.Associate(IDC_BUTTON_MOD, WmTabCommand_Press_mod);
cmessages.Associate(IDC_BUTTON_POWER, WmTabCommand_Press_power);
cmessages.Associate(IDC_BUTTON_INT, WmTabCommand_Press_int);
cmessages.Associate(IDC_BUTTON_ROUND, WmTabCommand_Press_round);
cmessages.Associate(IDC_BUTTON_EXP, WmTabCommand_Press_exp);
cmessages.Associate(IDC_BUTTON_BRACKETS_ALL, WmTabCommand_Press_bracketsall);
cmessages.Associate(IDC_BUTTON_1DIV_BRACKETS_ALL, WmTabCommand_Press_1div_bracketsall);
cmessages.Associate(IDC_BUTTON_ADD_VARIABLE, Variables::WmTabCommand_AddVariable);
cmessages.Associate(IDC_BUTTON_EDIT_VARIABLE, Variables::WmTabCommand_EditVariable);
@ -995,13 +1287,14 @@ void CreateTabCommandMessagesTable(Messages<BOOL> & cmessages)
cmessages.Associate(IDC_COMBO_DISPLAY_OUTPUT, WmTabCommand_DisplayOutputChanged);
cmessages.Associate(IDC_COMBO_DISPLAY_ROUNDING, WmTabCommand_DisplayRoundingChanged);
cmessages.Associate(IDC_CHECK_REMOVE_ZEROES, WmTabCommand_RemoveZeroesChanged);
cmessages.Associate(IDC_RADIO_DISPLAY_ALWAYS_SCIENTIFIC, WmTabCommand_SetDisplayAlwaysScientific);
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);
cmessages.Associate(IDC_COMBO_DISPLAY_GROUPING, WmTabCommand_DisplayGrouping);
cmessages.Associate(IDC_COMBO_INPUT_DECIMAL_POINT, WmTabCommand_DisplayInputDecimalPoint);
cmessages.Associate(IDC_COMBO_PARAM_SEPARATE, WmTabCommand_DisplayParamSep);
}
/*
@ -1268,9 +1561,25 @@ char buffer[20];
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);
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)"none");
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING, CB_ADDSTRING, 0, (LPARAM)"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_ADDSTRING, 0, (LPARAM)" . or ,");
SendDlgItemMessage(hWnd, IDC_COMBO_INPUT_DECIMAL_POINT, CB_ADDSTRING, 0, (LPARAM)" .");
SendDlgItemMessage(hWnd, IDC_COMBO_INPUT_DECIMAL_POINT, CB_ADDSTRING, 0, (LPARAM)" ,");
SendDlgItemMessage(hWnd, IDC_COMBO_INPUT_DECIMAL_POINT, CB_SETCURSEL, GetPrgRes()->GetInputDecimalPoint(), 0);
SendDlgItemMessage(hWnd, IDC_COMBO_PARAM_SEPARATE, CB_ADDSTRING, 0, (LPARAM)" ;");
SendDlgItemMessage(hWnd, IDC_COMBO_PARAM_SEPARATE, CB_ADDSTRING, 0, (LPARAM)" ; or .");
SendDlgItemMessage(hWnd, IDC_COMBO_PARAM_SEPARATE, CB_ADDSTRING, 0, (LPARAM)" ; or ,");
SendDlgItemMessage(hWnd, IDC_COMBO_PARAM_SEPARATE, CB_SETCURSEL, GetPrgRes()->GetParamSep(), 0);
return true;
}

Loading…
Cancel
Save