2007-02-08 18:54:37 +01:00
|
|
|
/*
|
|
|
|
* This file is a part of TTCalc - a mathematical calculator
|
|
|
|
* and is distributed under the (new) BSD licence.
|
2009-11-04 18:59:42 +01:00
|
|
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
2007-02-08 18:54:37 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2011-01-30 18:30:10 +01:00
|
|
|
* Copyright (c) 2006-2011, Tomasz Sowa
|
2007-02-08 18:54:37 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* * Neither the name Tomasz Sowa nor the names of contributors to this
|
|
|
|
* project may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
#include "compileconfig.h"
|
|
|
|
#include "tabs.h"
|
|
|
|
|
|
|
|
namespace TabWindowFunctions
|
|
|
|
{
|
|
|
|
int tab_standard;
|
|
|
|
int tab_variables;
|
|
|
|
int tab_functions;
|
|
|
|
int tab_precision;
|
|
|
|
int tab_display;
|
2007-08-20 12:44:37 +02:00
|
|
|
int tab_convert;
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
ttmath::ErrorCode last_code = ttmath::err_ok;
|
|
|
|
|
|
|
|
|
|
|
|
void PrintErrorCode()
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
2007-02-08 18:54:37 +01:00
|
|
|
SetDlgItemText(GetPrgRes()->GetMainWindow(),IDC_OUTPUT_EDIT,
|
|
|
|
GetPrgRes()->GetLanguages()->ErrorMessage(last_code) );
|
|
|
|
}
|
|
|
|
|
2011-03-07 21:36:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
char * buf = GetPrgRes()->GetBufferTemp();
|
|
|
|
start = 0;
|
|
|
|
end = SendMessage(input, WM_GETTEXT, GetPrgRes()->GetBufferSize(), (LPARAM)buf);
|
|
|
|
|
|
|
|
if( end > 0 )
|
|
|
|
{
|
|
|
|
start = CalcBracketsPrev(buf, sel_start);
|
|
|
|
end = CalcBracketsNext(buf, end, sel_start);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsertText(const char * first, const char * last, int cursor_back = 0)
|
|
|
|
{
|
|
|
|
HWND input = GetDlgItem(GetPrgRes()->GetMainWindow(), IDC_INPUT_EDIT);
|
|
|
|
|
|
|
|
int start, end;
|
|
|
|
CalcBracketsPos(input, start, end);
|
|
|
|
|
|
|
|
size_t len_first = strlen(first);
|
|
|
|
|
|
|
|
SendMessage(input, EM_SETSEL, start, start);
|
|
|
|
SendMessage(input, EM_REPLACESEL, 1, LPARAM(first));
|
|
|
|
|
|
|
|
SendMessage(input, EM_SETSEL, end+len_first, end+len_first);
|
|
|
|
SendMessage(input, EM_REPLACESEL, 1, LPARAM(last));
|
|
|
|
|
|
|
|
if( start == end )
|
|
|
|
{
|
|
|
|
// was empty string - we're setting the cursor inside the texts
|
|
|
|
SendMessage(input, EM_SETSEL, end+len_first, end+len_first);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
size_t len_last = strlen(last);
|
|
|
|
SendMessage(input, EM_SETSEL, end+len_first+len_last-cursor_back, end+len_first+len_last-cursor_back);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetFocus(input);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
/*
|
|
|
|
this functions inserts a given string into the first edit control
|
|
|
|
and then moves the caret
|
|
|
|
*/
|
|
|
|
void InsertText(const char * text, int move = 0)
|
|
|
|
{
|
|
|
|
HWND input_edit = GetDlgItem( GetPrgRes()->GetMainWindow(), IDC_INPUT_EDIT );
|
|
|
|
|
|
|
|
SetFocus(input_edit);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
SendMessage(input_edit, EM_REPLACESEL, true, (LPARAM)text);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
if( move != 0 )
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
|
|
|
DWORD l1,l2;
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
SendMessage(input_edit, EM_GETSEL, (WPARAM)&l1, (LPARAM)&l2 );
|
|
|
|
SendMessage(input_edit, EM_SETSEL, l1+move, l2+move );
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
/*
|
|
|
|
a function for WM_COMMAND and LOWORD(wParam)
|
|
|
|
from IDC_BUTTON_PRESS_0 to IDC_BUTTON_PRESS_9
|
|
|
|
*/
|
|
|
|
BOOL WmTabCommand_Press_0_9(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
SetFocus(GetDlgItem(GetPrgRes()->GetMainWindow(),IDC_INPUT_EDIT));
|
|
|
|
SendDlgItemMessage(GetPrgRes()->GetMainWindow(),IDC_INPUT_EDIT,WM_CHAR,LOWORD(wParam)-IDC_BUTTON_PRESS_0+'0',0x20001);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_e(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-02-08 18:54:37 +01:00
|
|
|
InsertText("e",0);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_comma(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-02-08 18:54:37 +01:00
|
|
|
InsertText(".",0);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_pi(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-02-08 18:54:37 +01:00
|
|
|
InsertText("pi",0);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_sin(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("sin(", ")");
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_cos(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("cos(", ")");
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_tan(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("tan(", ")");
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
added: a user can change the names of variables or functions now
changed: the program uses TTMath 0.8.0 now
added: functions: from TTMath 0.8.0:
DegToDeg(deg, min, sec), DegToRad(deg), DegToRad(deg, min, sec),
RadToDeg(rad), Ceil(x), Floor(x), Sqrt(x), Sinh(x), Cosh(x),
Tanh(x) /Tgh(x)/, Coth(x) /Ctgh(x)/
added: a help
changed: from TTMath 0.8.0:
renamed: CTan() into Cot() or Ctg()
renamed: ACTan() into ACot() or ACtg()
Factorial() has a history log now (it can remember last
10 calculated values)
added: a directory 'help' with files of the help
added: a directory 'setup' with files needed to make an installer
(we're using InnoSetup Compiler to make it)
fixed: the vertical size of the main window when a user uses a different size
of the window caption (especially under the Windows XP Luna)
fixed: on Windows 9x: the program hung when a user clicks on a control
on the first tab (the procedure SetNextFocus(...) has been completely
rewritten and the flag WS_EX_CONTROLPARENT on the tab dialogs has
gone away)
fixed: when started navigating from the keyboard the program showed a wrong
variable or a funtion in the edit dialog
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@28 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-04-02 02:17:26 +02:00
|
|
|
BOOL WmTabCommand_Press_cot(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("cot(", ")");
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_ln(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("ln(", ")");
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_log(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("log(", " ; )", 1);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_abs(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("abs(", ")");
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_factorial(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("factorial(", ")");
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmTabCommand_Press_div(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-02-08 18:54:37 +01:00
|
|
|
InsertText("/", 0);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_mul(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-02-08 18:54:37 +01:00
|
|
|
InsertText("*",0);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_sub(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-02-08 18:54:37 +01:00
|
|
|
InsertText("-",0);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_add(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-02-08 18:54:37 +01:00
|
|
|
InsertText("+",0);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2007-02-08 18:54:37 +01:00
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmTabCommand_Press_first_bracket(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-02-08 18:54:37 +01:00
|
|
|
InsertText("(",0);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2007-02-08 18:54:37 +01:00
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmTabCommand_Press_last_bracket(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-02-08 18:54:37 +01:00
|
|
|
InsertText(")",0);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmTabCommand_Press_clear(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
SetDlgItemText(GetPrgRes()->GetMainWindow(), IDC_INPUT_EDIT, "");
|
fixed: when 'C' button was pressed, the cursor was not put in the edit window
added: menu to the pad window
options: open/save as,close,undo,cut,copy,paste,delete,select all
--This line, and those below, will be ignored--
M src/winmain.cpp
M src/pad.cpp
M src/programresources.h
M src/resource.rc
M src/tabs.cpp
M src/resource.h
M CHANGELOG
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@221 e52654a7-88a9-db11-a3e9-0013d4bc506e
2009-10-20 00:08:23 +02:00
|
|
|
|
|
|
|
HWND input_edit = GetDlgItem( GetPrgRes()->GetMainWindow(), IDC_INPUT_EDIT );
|
|
|
|
SetFocus(input_edit);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_error(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
if( last_code != ttmath::err_ok )
|
|
|
|
{
|
|
|
|
PrintErrorCode();
|
2009-11-01 02:52:13 +01:00
|
|
|
HWND input_edit = GetDlgItem( GetPrgRes()->GetMainWindow(), IDC_INPUT_EDIT );
|
|
|
|
SetFocus(input_edit);
|
2007-02-08 18:54:37 +01:00
|
|
|
}
|
|
|
|
|
2009-11-01 02:52:13 +01:00
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-28 18:52:09 +01:00
|
|
|
BOOL WmTabCommand_Press_asin(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("asin(", ")");
|
2007-02-28 18:52:09 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_acos(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("acos(", ")");
|
2007-02-28 18:52:09 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2011-03-07 21:36:25 +01:00
|
|
|
|
2007-02-28 18:52:09 +01:00
|
|
|
BOOL WmTabCommand_Press_atan(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("atan(", ")");
|
2007-02-28 18:52:09 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2011-03-07 21:36:25 +01:00
|
|
|
|
added: a user can change the names of variables or functions now
changed: the program uses TTMath 0.8.0 now
added: functions: from TTMath 0.8.0:
DegToDeg(deg, min, sec), DegToRad(deg), DegToRad(deg, min, sec),
RadToDeg(rad), Ceil(x), Floor(x), Sqrt(x), Sinh(x), Cosh(x),
Tanh(x) /Tgh(x)/, Coth(x) /Ctgh(x)/
added: a help
changed: from TTMath 0.8.0:
renamed: CTan() into Cot() or Ctg()
renamed: ACTan() into ACot() or ACtg()
Factorial() has a history log now (it can remember last
10 calculated values)
added: a directory 'help' with files of the help
added: a directory 'setup' with files needed to make an installer
(we're using InnoSetup Compiler to make it)
fixed: the vertical size of the main window when a user uses a different size
of the window caption (especially under the Windows XP Luna)
fixed: on Windows 9x: the program hung when a user clicks on a control
on the first tab (the procedure SetNextFocus(...) has been completely
rewritten and the flag WS_EX_CONTROLPARENT on the tab dialogs has
gone away)
fixed: when started navigating from the keyboard the program showed a wrong
variable or a funtion in the edit dialog
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@28 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-04-02 02:17:26 +02:00
|
|
|
BOOL WmTabCommand_Press_acot(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
2007-02-28 18:52:09 +01:00
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("acot(", ")");
|
2007-02-28 18:52:09 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2011-03-07 21:36:25 +01:00
|
|
|
|
2007-02-28 18:52:09 +01:00
|
|
|
BOOL WmTabCommand_Press_sgn(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("sgn(", ")");
|
2007-02-28 18:52:09 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2011-03-07 21:36:25 +01:00
|
|
|
|
2007-02-28 18:52:09 +01:00
|
|
|
BOOL WmTabCommand_Press_mod(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("mod(", " ; )", 1);
|
2007-02-28 18:52:09 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmTabCommand_Press_power(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-02-08 18:54:37 +01:00
|
|
|
InsertText("^",0);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2007-02-08 18:54:37 +01:00
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmTabCommand_Press_int(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("int(", ")");
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2007-02-08 18:54:37 +01:00
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmTabCommand_Press_round(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("round(", ")");
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmTabCommand_Press_exp(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("exp(", ")");
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
added: a user can change the names of variables or functions now
changed: the program uses TTMath 0.8.0 now
added: functions: from TTMath 0.8.0:
DegToDeg(deg, min, sec), DegToRad(deg), DegToRad(deg, min, sec),
RadToDeg(rad), Ceil(x), Floor(x), Sqrt(x), Sinh(x), Cosh(x),
Tanh(x) /Tgh(x)/, Coth(x) /Ctgh(x)/
added: a help
changed: from TTMath 0.8.0:
renamed: CTan() into Cot() or Ctg()
renamed: ACTan() into ACot() or ACtg()
Factorial() has a history log now (it can remember last
10 calculated values)
added: a directory 'help' with files of the help
added: a directory 'setup' with files needed to make an installer
(we're using InnoSetup Compiler to make it)
fixed: the vertical size of the main window when a user uses a different size
of the window caption (especially under the Windows XP Luna)
fixed: on Windows 9x: the program hung when a user clicks on a control
on the first tab (the procedure SetNextFocus(...) has been completely
rewritten and the flag WS_EX_CONTROLPARENT on the tab dialogs has
gone away)
fixed: when started navigating from the keyboard the program showed a wrong
variable or a funtion in the edit dialog
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@28 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-04-02 02:17:26 +02:00
|
|
|
BOOL WmTabCommand_IDOK(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
2007-03-08 20:15:55 +01:00
|
|
|
HWND main = GetPrgRes()->GetMainWindow();
|
|
|
|
HWND tab = GetDlgItem(main, IDC_TAB);
|
|
|
|
int sel = TabCtrl_GetCurSel(tab);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2007-03-08 20:15:55 +01:00
|
|
|
|
|
|
|
if( sel == tab_variables )
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
2007-03-08 20:15:55 +01:00
|
|
|
if( GetFocus() == GetDlgItem(GetPrgRes()->GetTabWindow(tab_variables), IDC_VARIABLES_LIST ) )
|
|
|
|
Variables::WmTabCommand_EditVariable(hWnd, WM_COMMAND, IDC_BUTTON_EDIT_VARIABLE, 0);
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
else
|
2007-03-08 20:15:55 +01:00
|
|
|
if( sel == tab_functions )
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
2007-03-08 20:15:55 +01:00
|
|
|
if( GetFocus() == GetDlgItem(GetPrgRes()->GetTabWindow(tab_functions), IDC_FUNCTIONS_LIST ) )
|
|
|
|
Functions::WmTabCommand_EditFunction(hWnd, WM_COMMAND, IDC_BUTTON_EDIT_FUNCTION, 0);
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
added: a user can change the names of variables or functions now
changed: the program uses TTMath 0.8.0 now
added: functions: from TTMath 0.8.0:
DegToDeg(deg, min, sec), DegToRad(deg), DegToRad(deg, min, sec),
RadToDeg(rad), Ceil(x), Floor(x), Sqrt(x), Sinh(x), Cosh(x),
Tanh(x) /Tgh(x)/, Coth(x) /Ctgh(x)/
added: a help
changed: from TTMath 0.8.0:
renamed: CTan() into Cot() or Ctg()
renamed: ACTan() into ACot() or ACtg()
Factorial() has a history log now (it can remember last
10 calculated values)
added: a directory 'help' with files of the help
added: a directory 'setup' with files needed to make an installer
(we're using InnoSetup Compiler to make it)
fixed: the vertical size of the main window when a user uses a different size
of the window caption (especially under the Windows XP Luna)
fixed: on Windows 9x: the program hung when a user clicks on a control
on the first tab (the procedure SetNextFocus(...) has been completely
rewritten and the flag WS_EX_CONTROLPARENT on the tab dialogs has
gone away)
fixed: when started navigating from the keyboard the program showed a wrong
variable or a funtion in the edit dialog
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@28 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-04-02 02:17:26 +02:00
|
|
|
BOOL WmTabCommand_IDCANCEL(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
SendMessage(GetPrgRes()->GetMainWindow(), WM_COMMAND, IDCANCEL, 0);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2011-01-30 18:30:10 +01:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
void SetLanguageTabStandard(HWND hWnd)
|
|
|
|
{
|
|
|
|
SetDlgItemText( hWnd,IDC_BUTTON_CLEAR, GetPrgRes()->GetLanguages()->GuiMessage(Languages::button_clear) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetLanguageTabVariables(HWND hWnd)
|
|
|
|
{
|
|
|
|
SetDlgItemText( hWnd,IDC_BUTTON_ADD_VARIABLE, GetPrgRes()->GetLanguages()->GuiMessage(Languages::button_add) );
|
|
|
|
SetDlgItemText( hWnd,IDC_BUTTON_EDIT_VARIABLE, GetPrgRes()->GetLanguages()->GuiMessage(Languages::button_edit) );
|
|
|
|
SetDlgItemText( hWnd,IDC_BUTTON_DELETE_VARIABLE, GetPrgRes()->GetLanguages()->GuiMessage(Languages::button_delete) );
|
|
|
|
|
|
|
|
HWND list = GetDlgItem(hWnd, IDC_VARIABLES_LIST);
|
|
|
|
LVCOLUMN column;
|
|
|
|
|
|
|
|
column.mask = LVCF_TEXT;
|
|
|
|
column.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::list_variables_header_1) );
|
|
|
|
ListView_SetColumn(list,0,&column);
|
|
|
|
|
|
|
|
column.mask = LVCF_TEXT;
|
|
|
|
column.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::list_variables_header_2) );
|
|
|
|
ListView_SetColumn(list,1,&column);
|
|
|
|
}
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
void SetLanguageTabFunctions(HWND hWnd)
|
|
|
|
{
|
|
|
|
SetDlgItemText( hWnd,IDC_BUTTON_ADD_FUNCTION, GetPrgRes()->GetLanguages()->GuiMessage(Languages::button_add) );
|
|
|
|
SetDlgItemText( hWnd,IDC_BUTTON_EDIT_FUNCTION, GetPrgRes()->GetLanguages()->GuiMessage(Languages::button_edit) );
|
|
|
|
SetDlgItemText( hWnd,IDC_BUTTON_DELETE_FUNCTION, GetPrgRes()->GetLanguages()->GuiMessage(Languages::button_delete) );
|
|
|
|
|
|
|
|
HWND list = GetDlgItem(hWnd, IDC_FUNCTIONS_LIST);
|
|
|
|
LVCOLUMN column;
|
|
|
|
|
|
|
|
column.mask = LVCF_TEXT;
|
|
|
|
column.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::list_functions_header_1) );
|
|
|
|
ListView_SetColumn(list,0,&column);
|
|
|
|
|
|
|
|
column.mask = LVCF_TEXT;
|
|
|
|
column.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::list_functions_header_2) );
|
|
|
|
ListView_SetColumn(list,1,&column);
|
|
|
|
|
|
|
|
column.mask = LVCF_TEXT;
|
|
|
|
column.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::list_functions_header_3) );
|
|
|
|
ListView_SetColumn(list,2,&column);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SetLanguageTabPrecision(HWND hWnd)
|
|
|
|
{
|
2007-06-24 22:11:14 +02:00
|
|
|
#ifndef TTCALC_PORTABLE
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
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) );
|
|
|
|
|
|
|
|
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) );
|
2007-06-24 22:11:14 +02:00
|
|
|
|
|
|
|
#endif
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2011-01-30 18:30:10 +01:00
|
|
|
void SetLanguageTabDisplayComboRounding(HWND hWnd)
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
|
|
|
char buffer[50];
|
|
|
|
int i;
|
2011-01-30 18:30:10 +01:00
|
|
|
const int max_r = 9;
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2009-11-03 22:00:05 +01:00
|
|
|
Languages * pl = GetPrgRes()->GetLanguages();
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_ROUNDING, CB_RESETCONTENT, 0, 0);
|
2009-11-03 22:00:05 +01:00
|
|
|
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) );
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
for(i=1 ; i<=max_r ; ++i)
|
|
|
|
{
|
|
|
|
sprintf(buffer,"%s %d %s",
|
2009-11-03 22:00:05 +01:00
|
|
|
pl->GuiMessage(Languages::combo_rounding_to_number),
|
2007-01-22 12:12:01 +01:00
|
|
|
i,
|
2009-11-03 22:00:05 +01:00
|
|
|
pl->GuiMessage(Languages::combo_rounding_after_comma) );
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_ROUNDING, CB_ADDSTRING, 0, (LPARAM)buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
int r = GetPrgRes()->GetDisplayRounding();
|
2011-01-30 18:30:10 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
if( r > max_r )
|
|
|
|
r = max_r;
|
|
|
|
|
2008-04-12 10:52:21 +02:00
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_ROUNDING, CB_SETCURSEL, r+1, 0);
|
2011-01-30 18:30:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SetLanguageTabDisplayComboGrouping(HWND hWnd)
|
|
|
|
{
|
|
|
|
char buffer[50];
|
|
|
|
int i;
|
|
|
|
const int max_r = 9;
|
|
|
|
|
|
|
|
Languages * pl = GetPrgRes()->GetLanguages();
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2011-01-30 18:30:10 +01:00
|
|
|
// 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());
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2009-11-03 22:00:05 +01:00
|
|
|
SetDlgItemText(hWnd, IDC_LABEL_DISPLAY_INPUT, pl->GuiMessage(Languages::display_input));
|
|
|
|
SetDlgItemText(hWnd, IDC_LABEL_DISPLAY_OUTPUT, pl->GuiMessage(Languages::display_output));
|
|
|
|
SetDlgItemText(hWnd, IDC_LABEL_DISPLAY_ROUNDING, pl->GuiMessage(Languages::display_rounding));
|
|
|
|
SetDlgItemText(hWnd, IDC_LABEL_DISPLAY_GROUPING, pl->GuiMessage(Languages::display_grouping));
|
|
|
|
SetDlgItemText(hWnd, IDC_LABEL_INPUT_DECIMAL_POINT, pl->GuiMessage(Languages::display_input_decimal_point));
|
|
|
|
SetDlgItemText(hWnd, IDC_LABEL_OUTPUT_DECIMAL_POINT, pl->GuiMessage(Languages::display_output_decimal_point));
|
|
|
|
SetDlgItemText(hWnd, IDC_LABEL_PARAM_SEPARATE, pl->GuiMessage(Languages::display_param_sep));
|
|
|
|
|
|
|
|
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));
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2011-01-30 18:30:10 +01:00
|
|
|
SetDlgItemText(hWnd, IDC_LABEL_DISPLAY_SCIENTIFIC, pl->GuiMessage(Languages::display_as_scientific));
|
2009-11-03 22:00:05 +01:00
|
|
|
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));
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2009-11-03 22:00:05 +01:00
|
|
|
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)" .");
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_INPUT_DECIMAL_POINT, CB_ADDSTRING, 0, (LPARAM)" ,");
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_INPUT_DECIMAL_POINT, CB_SETCURSEL, GetPrgRes()->GetInputDecimalPoint(), 0);
|
2007-12-09 21:05:15 +01:00
|
|
|
|
2009-11-03 22:00:05 +01:00
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_PARAM_SEPARATE, CB_RESETCONTENT, 0, 0);
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_PARAM_SEPARATE, CB_ADDSTRING, 0, (LPARAM)" ;");
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_PARAM_SEPARATE, CB_ADDSTRING, 0, (LPARAM)pl->GuiMessage(Languages::display_param_sep_item2));
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_PARAM_SEPARATE, CB_ADDSTRING, 0, (LPARAM)pl->GuiMessage(Languages::display_param_sep_item3));
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_PARAM_SEPARATE, CB_SETCURSEL, GetPrgRes()->GetParamSep(), 0);
|
2009-03-28 19:26:20 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-22 23:16:19 +02:00
|
|
|
/*!
|
|
|
|
|
|
|
|
-1 if there's no such item
|
|
|
|
*/
|
|
|
|
int FindItem(HWND list, int i)
|
|
|
|
{
|
|
|
|
LVFINDINFO info;
|
|
|
|
|
|
|
|
info.flags = LVFI_PARAM;
|
|
|
|
info.lParam = i;
|
|
|
|
|
|
|
|
return ListView_FindItem(list, -1, &info);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-18 22:08:47 +02:00
|
|
|
void TabConvertFillUpUnitList(HWND list, int conv_type)
|
|
|
|
{
|
2008-10-13 06:17:57 +02:00
|
|
|
Convert * pconv = GetPrgRes()->GetConvert();
|
|
|
|
unsigned int len = pconv->GetUnitSize();
|
2007-09-18 22:08:47 +02:00
|
|
|
unsigned int i, index;
|
|
|
|
|
|
|
|
ListView_DeleteAllItems(list);
|
|
|
|
|
|
|
|
LVITEM item;
|
|
|
|
item.mask = LVIF_PARAM | LVIF_TEXT;
|
|
|
|
item.iSubItem = 0;
|
|
|
|
|
|
|
|
for( i=index=0 ; i<len ; ++i )
|
|
|
|
{
|
2008-10-13 06:17:57 +02:00
|
|
|
if( pconv->GetUnitType(i) == conv_type )
|
2007-09-18 22:08:47 +02:00
|
|
|
{
|
|
|
|
item.lParam = i;
|
|
|
|
item.iItem = index++;
|
2008-10-13 06:17:57 +02:00
|
|
|
int country = static_cast<unsigned int>(GetPrgRes()->GetLanguages()->GetCurrentLanguage());
|
|
|
|
item.pszText = const_cast<char*>(pconv->GetUnitName(country, i));
|
2007-09-18 22:08:47 +02:00
|
|
|
|
|
|
|
ListView_InsertItem(list, &item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TabConvertFillUpUnitLists(HWND hWnd)
|
|
|
|
{
|
|
|
|
HWND list2b = GetDlgItem(hWnd, IDC_LIST_UNIT_INPUT2);
|
|
|
|
HWND list3b = GetDlgItem(hWnd, IDC_LIST_UNIT_OUTPUT2);
|
|
|
|
int input, output;
|
|
|
|
|
2008-10-13 06:17:57 +02:00
|
|
|
int convtype = GetPrgRes()->GetConvert()->GetCurrentType();
|
2007-09-18 22:08:47 +02:00
|
|
|
|
|
|
|
TabConvertFillUpUnitList(list2b, convtype);
|
|
|
|
TabConvertFillUpUnitList(list3b, convtype);
|
2008-10-13 06:17:57 +02:00
|
|
|
GetPrgRes()->GetConvert()->GetCurrentUnit( convtype, input, output);
|
2007-09-18 22:08:47 +02:00
|
|
|
|
|
|
|
if( input >= 0 )
|
|
|
|
{
|
|
|
|
int i = FindItem(list2b, input);
|
|
|
|
|
|
|
|
if( i >= 0 )
|
|
|
|
ListView_SetItemState(list2b, i, LVIS_SELECTED, LVIS_SELECTED); //LVIS_FOCUSED
|
|
|
|
}
|
|
|
|
|
|
|
|
if( output >= 0 )
|
|
|
|
{
|
|
|
|
int i = FindItem(list3b, output);
|
|
|
|
|
|
|
|
if( i>=0 )
|
|
|
|
ListView_SetItemState(list3b, i, LVIS_SELECTED, LVIS_SELECTED); //LVIS_FOCUSED
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
we must check whether the item id is really selected
|
|
|
|
(this method is called from WM_NOTIFY and can be another states on the item)
|
|
|
|
*/
|
|
|
|
void TabConvertTypeChanged(HWND hWnd, int id)
|
|
|
|
{
|
|
|
|
HWND list1 = GetDlgItem(hWnd, IDC_LIST_UNIT_TYPE);
|
|
|
|
|
|
|
|
if( ListView_GetItemState(list1, id, LVIS_SELECTED | LVIS_FOCUSED) != (LVIS_SELECTED | LVIS_FOCUSED) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// the item is selected now
|
|
|
|
LVITEM item;
|
|
|
|
item.iItem = id;
|
|
|
|
item.iSubItem = 0;
|
|
|
|
item.mask = LVIF_PARAM;
|
|
|
|
if( !ListView_GetItem(list1, &item) )
|
|
|
|
return;
|
|
|
|
|
2007-10-29 22:42:34 +01:00
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
2008-10-13 06:17:57 +02:00
|
|
|
GetPrgRes()->GetConvert()->SetCurrentType( (int)item.lParam );
|
2007-10-29 22:42:34 +01:00
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
2007-09-18 22:08:47 +02:00
|
|
|
TabConvertFillUpUnitLists(hWnd);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-04 22:56:55 +01:00
|
|
|
|
2007-09-18 22:08:47 +02:00
|
|
|
/*!
|
|
|
|
we must check whether the item id is really selected
|
|
|
|
(this method is called from WM_NOTIFY and can be another states on the item)
|
|
|
|
*/
|
|
|
|
void TabConvertUnitInputChanged(HWND hWnd, int id)
|
|
|
|
{
|
|
|
|
HWND list2b = GetDlgItem(hWnd, IDC_LIST_UNIT_INPUT2);
|
|
|
|
|
|
|
|
if( ListView_GetItemState(list2b, id, LVIS_SELECTED | LVIS_FOCUSED) != (LVIS_SELECTED | LVIS_FOCUSED) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// the item is selected
|
|
|
|
LVITEM item;
|
|
|
|
item.iItem = id;
|
|
|
|
item.iSubItem = 0;
|
|
|
|
item.mask = LVIF_PARAM;
|
|
|
|
if( !ListView_GetItem(list2b, &item) )
|
|
|
|
return;
|
|
|
|
|
2008-10-13 06:17:57 +02:00
|
|
|
int convtype = GetPrgRes()->GetConvert()->GetCurrentType();
|
2007-09-18 22:08:47 +02:00
|
|
|
int input, output;
|
2007-10-29 22:42:34 +01:00
|
|
|
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
2008-10-13 06:17:57 +02:00
|
|
|
GetPrgRes()->GetConvert()->GetCurrentUnit(convtype, input, output);
|
|
|
|
GetPrgRes()->GetConvert()->SetCurrentUnit(convtype, (int)item.lParam, output );
|
2007-10-29 22:42:34 +01:00
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
2007-09-18 22:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
we must check whether the item id is really selected
|
|
|
|
(this method is called from WM_NOTIFY and can be another states on the item)
|
|
|
|
*/
|
|
|
|
void TabConvertUnitOutputChanged(HWND hWnd, int id)
|
|
|
|
{
|
|
|
|
HWND list3b = GetDlgItem(hWnd, IDC_LIST_UNIT_OUTPUT2);
|
|
|
|
|
|
|
|
if( ListView_GetItemState(list3b, id, LVIS_SELECTED | LVIS_FOCUSED) != (LVIS_SELECTED | LVIS_FOCUSED) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
// the item is selected
|
|
|
|
LVITEM item;
|
|
|
|
item.iItem = id;
|
|
|
|
item.iSubItem = 0;
|
|
|
|
item.mask = LVIF_PARAM;
|
|
|
|
if( !ListView_GetItem(list3b, &item) )
|
|
|
|
return;
|
|
|
|
|
2008-10-13 06:17:57 +02:00
|
|
|
int convtype = GetPrgRes()->GetConvert()->GetCurrentType();
|
2007-09-18 22:08:47 +02:00
|
|
|
int input, output;
|
2007-10-29 22:42:34 +01:00
|
|
|
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
2008-10-13 06:17:57 +02:00
|
|
|
GetPrgRes()->GetConvert()->GetCurrentUnit(convtype, input, output);
|
|
|
|
GetPrgRes()->GetConvert()->SetCurrentUnit(convtype, input, (int)item.lParam );
|
2007-10-29 22:42:34 +01:00
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
2007-09-18 22:08:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-08-20 12:44:37 +02:00
|
|
|
void SetLanguageTabConvert(HWND hWnd)
|
|
|
|
{
|
|
|
|
Languages * plang = GetPrgRes()->GetLanguages();
|
2008-10-13 06:17:57 +02:00
|
|
|
Convert * pconv = GetPrgRes()->GetConvert();
|
2007-08-20 12:44:37 +02:00
|
|
|
|
|
|
|
SetDlgItemText(hWnd, IDC_STATIC_UNIT_CONVERSION, plang->GuiMessage(Languages::convert_type) );
|
|
|
|
SetDlgItemText(hWnd, IDC_STATIC_UNIT_INPUT, plang->GuiMessage(Languages::convert_input) );
|
|
|
|
SetDlgItemText(hWnd, IDC_STATIC_UNIT_OUTPUT, plang->GuiMessage(Languages::convert_output) );
|
|
|
|
SetDlgItemText(hWnd, IDC_COMBO_DYNAMIC_OUTPUT, plang->GuiMessage(Languages::convert_dynamic_output) );
|
2007-08-22 23:16:19 +02:00
|
|
|
|
|
|
|
HWND list1 = GetDlgItem(hWnd, IDC_LIST_UNIT_TYPE);
|
|
|
|
|
|
|
|
ListView_DeleteAllItems(list1);
|
|
|
|
|
|
|
|
LVITEM item;
|
2007-09-18 22:08:47 +02:00
|
|
|
item.mask = LVIF_PARAM | LVIF_TEXT;
|
|
|
|
item.iSubItem = 0;
|
|
|
|
|
2008-10-13 06:17:57 +02:00
|
|
|
unsigned int conv_type_size = pconv->GetTypeSize();
|
2007-09-18 22:08:47 +02:00
|
|
|
|
|
|
|
for(unsigned int i = 0 ; i<conv_type_size ; ++i)
|
|
|
|
{
|
|
|
|
item.lParam = i;
|
|
|
|
item.iItem = i;
|
2008-10-13 06:17:57 +02:00
|
|
|
int country = static_cast<unsigned int>(plang->GetCurrentLanguage());
|
|
|
|
item.pszText = const_cast<char*>(pconv->GetTypeName(country, i));
|
2007-08-22 23:16:19 +02:00
|
|
|
|
|
|
|
ListView_InsertItem(list1, &item);
|
|
|
|
}
|
|
|
|
|
2008-10-13 06:17:57 +02:00
|
|
|
int type = FindItem(list1, GetPrgRes()->GetConvert()->GetCurrentType() );
|
2007-08-22 23:16:19 +02:00
|
|
|
if( type != -1 )
|
|
|
|
ListView_SetItemState(list1, type, LVIS_FOCUSED|LVIS_SELECTED, LVIS_FOCUSED|LVIS_SELECTED);
|
2007-09-18 22:08:47 +02:00
|
|
|
// there'll be generated wm_notify message and the next lists will be changed then
|
2007-08-20 12:44:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-08-22 23:16:19 +02:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
void SetLanguage(HWND hTab)
|
|
|
|
{
|
|
|
|
TCITEM tab;
|
|
|
|
|
|
|
|
tab.mask = TCIF_TEXT;
|
|
|
|
|
|
|
|
tab.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_standard) );
|
|
|
|
TabCtrl_SetItem(hTab,tab_standard, &tab);
|
|
|
|
|
|
|
|
tab.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_variables) );
|
|
|
|
TabCtrl_SetItem(hTab,tab_variables, &tab);
|
|
|
|
|
|
|
|
tab.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_functions) );
|
|
|
|
TabCtrl_SetItem(hTab,tab_functions, &tab);
|
|
|
|
|
2007-06-24 22:11:14 +02:00
|
|
|
#ifndef TTCALC_PORTABLE
|
2007-01-22 12:12:01 +01:00
|
|
|
tab.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_precision) );
|
|
|
|
TabCtrl_SetItem(hTab,tab_precision, &tab);
|
2007-06-24 22:11:14 +02:00
|
|
|
#endif
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
tab.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_display) );
|
|
|
|
TabCtrl_SetItem(hTab,tab_display, &tab);
|
|
|
|
|
2009-03-28 19:26:20 +01:00
|
|
|
#ifdef TTCALC_CONVERT
|
2007-08-20 12:44:37 +02:00
|
|
|
tab.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_convert) );
|
|
|
|
TabCtrl_SetItem(hTab,tab_convert, &tab);
|
2009-03-28 19:26:20 +01:00
|
|
|
#endif
|
2007-08-20 12:44:37 +02:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
SetLanguageTabStandard( GetPrgRes()->GetTabWindow(tab_standard) );
|
|
|
|
SetLanguageTabVariables( GetPrgRes()->GetTabWindow(tab_variables) );
|
|
|
|
SetLanguageTabFunctions( GetPrgRes()->GetTabWindow(tab_functions) );
|
2007-06-24 22:11:14 +02:00
|
|
|
|
|
|
|
#ifndef TTCALC_PORTABLE
|
2007-01-22 12:12:01 +01:00
|
|
|
SetLanguageTabPrecision( GetPrgRes()->GetTabWindow(tab_precision) );
|
2007-06-24 22:11:14 +02:00
|
|
|
#endif
|
|
|
|
|
2007-08-20 12:44:37 +02:00
|
|
|
SetLanguageTabDisplay( GetPrgRes()->GetTabWindow(tab_display) );
|
2009-03-28 19:26:20 +01:00
|
|
|
|
|
|
|
#ifdef TTCALC_CONVERT
|
2007-08-20 12:44:37 +02:00
|
|
|
SetLanguageTabConvert( GetPrgRes()->GetTabWindow(tab_convert) );
|
2009-03-28 19:26:20 +01:00
|
|
|
#endif
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
InvalidateRect(hTab, 0, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_SetPrecision1(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-06-24 22:11:14 +02:00
|
|
|
#ifndef TTCALC_PORTABLE
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
// 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 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
|
|
|
GetPrgRes()->SetPrecision(0);
|
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
2007-06-24 22:11:14 +02:00
|
|
|
#endif
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmTabCommand_SetPrecision2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-06-24 22:11:14 +02:00
|
|
|
#ifndef TTCALC_PORTABLE
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
// 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 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
|
|
|
GetPrgRes()->SetPrecision(1);
|
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
2007-06-24 22:11:14 +02:00
|
|
|
#endif
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmTabCommand_SetPrecision3(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-06-24 22:11:14 +02:00
|
|
|
#ifndef TTCALC_PORTABLE
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
// 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 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
|
|
|
GetPrgRes()->SetPrecision(2);
|
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
2007-06-24 22:11:14 +02:00
|
|
|
#endif
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmTabCommand_DisplayInputChanged(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
if( HIWORD(wParam) != CBN_SELCHANGE )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
|
|
|
GetPrgRes()->SetBaseInput( (int)SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_INPUT, CB_GETCURSEL, 0, 0) + 2 );
|
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_DisplayOutputChanged(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
if( HIWORD(wParam) != CBN_SELCHANGE )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
|
|
|
GetPrgRes()->SetBaseOutput( (int)SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_OUTPUT, CB_GETCURSEL, 0, 0) + 2);
|
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-09 21:05:15 +01:00
|
|
|
BOOL WmTabCommand_DisplayDecimalPointChanged(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
if( HIWORD(wParam) != CBN_SELCHANGE )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
2009-11-03 22:00:05 +01:00
|
|
|
GetPrgRes()->SetDecimalPoint( (int)SendDlgItemMessage(hWnd, IDC_COMBO_OUTPUT_DECIMAL_POINT, CB_GETCURSEL, 0, 0) );
|
2007-12-09 21:05:15 +01:00
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmTabCommand_DisplayRoundingChanged(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
if( HIWORD(wParam) != CBN_SELCHANGE )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
2008-04-12 10:52:21 +02:00
|
|
|
GetPrgRes()->SetDisplayRounding( (int)SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_ROUNDING, CB_GETCURSEL, 0, 0) - 1);
|
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WmTabCommand_RemoveZeroesChanged(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
|
|
|
|
|
|
|
if( IsDlgButtonChecked(hWnd, IDC_CHECK_REMOVE_ZEROES) == BST_CHECKED )
|
|
|
|
GetPrgRes()->SetRemovingZeroes(true);
|
|
|
|
else
|
|
|
|
GetPrgRes()->SetRemovingZeroes(false);
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-11-01 02:52:13 +01:00
|
|
|
|
2009-03-28 19:26:20 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2011-01-30 18:30:10 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-11-01 02:52:13 +01:00
|
|
|
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) );
|
2011-01-30 18:30:10 +01:00
|
|
|
GetPrgRes()->SetGroupingDigits( (int)SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_GROUPING_DIGITS, CB_GETCURSEL, 0, 0) + 1 );
|
2009-11-01 02:52:13 +01:00
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
2011-01-30 18:30:10 +01:00
|
|
|
SetDisablingGroupingDigits(hWnd, GetPrgRes()->GetGrouping());
|
|
|
|
|
2009-11-01 02:52:13 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_SetDisplayAlwaysScientific(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
// there are another messages besides that one
|
|
|
|
// which is sent when a user clicks on the radio button
|
|
|
|
if( IsDlgButtonChecked(hWnd, IDC_RADIO_DISPLAY_ALWAYS_SCIENTIFIC) != BST_CHECKED )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
|
|
|
GetPrgRes()->SetDisplayAlwaysScientific(true);
|
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
|
|
|
SetDisablingDisplayWhenScientific(hWnd);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_SetDisplayNotAlwaysScientific(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
// there are another messages besides that one
|
|
|
|
// which is sent when a user clicks on the radio button
|
|
|
|
if( IsDlgButtonChecked(hWnd, IDC_RADIO_DISPLAY_NOT_ALWAYS_SCIENTIFIC) != BST_CHECKED )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
|
|
|
GetPrgRes()->SetDisplayAlwaysScientific(false);
|
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
|
|
|
SetDisablingDisplayWhenScientific(hWnd);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_SetDisplayWhenScientific(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
static bool correct_insertion = false;
|
|
|
|
|
|
|
|
if( HIWORD(wParam)==EN_CHANGE && !correct_insertion )
|
|
|
|
{
|
|
|
|
char buffer[20];
|
|
|
|
|
|
|
|
GetDlgItemText(hWnd, IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC, buffer, sizeof(buffer)/sizeof(char));
|
|
|
|
int w2,w1 = atoi(buffer);
|
|
|
|
|
|
|
|
GetPrgRes()->GetThreadController()->StopCalculating();
|
|
|
|
GetPrgRes()->SetDisplayWhenScientific(w1);
|
|
|
|
w2 = GetPrgRes()->GetDisplayWhenScientific();
|
|
|
|
GetPrgRes()->GetThreadController()->StartCalculating();
|
|
|
|
|
|
|
|
if( w1 != w2 )
|
|
|
|
{
|
|
|
|
sprintf(buffer,"%d", w2);
|
|
|
|
|
|
|
|
//
|
|
|
|
correct_insertion = true;
|
|
|
|
SetDlgItemText(hWnd, IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC, buffer);
|
|
|
|
correct_insertion = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-11-01 02:52:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_bracketsall(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("(", ")");
|
2009-11-01 02:52:13 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_1div_bracketsall(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("1/(", ")");
|
2009-11-01 02:52:13 +01:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("floor(", ")");
|
2009-11-01 02:52:13 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_ceil(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("ceil(", ")");
|
2009-11-01 02:52:13 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_min(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("min(", ")");
|
2009-11-01 02:52:13 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_max(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("max(", ")");
|
2009-11-01 02:52:13 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_avg(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("avg(", ")");
|
2009-11-01 02:52:13 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_sum(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("sum(", ")");
|
2009-11-01 02:52:13 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_root(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("root(", " ; )", 1);
|
2009-11-01 02:52:13 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmTabCommand_Press_gamma(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("gamma(", ")");
|
2009-11-01 02:52:13 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-11-01 21:34:10 +01:00
|
|
|
BOOL WmTabCommand_Press_sqrt(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2011-03-07 21:36:25 +01:00
|
|
|
InsertText("sqrt(", ")");
|
2009-11-01 21:34:10 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2009-11-01 02:52:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2009-10-14 00:41:00 +02:00
|
|
|
void CreateTabCommandMessagesTable(Messages<BOOL> & cmessages)
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
|
|
|
cmessages.Associate(IDC_BUTTON_PRESS_0, WmTabCommand_Press_0_9);
|
|
|
|
cmessages.Associate(IDC_BUTTON_PRESS_1, WmTabCommand_Press_0_9);
|
|
|
|
cmessages.Associate(IDC_BUTTON_PRESS_2, WmTabCommand_Press_0_9);
|
|
|
|
cmessages.Associate(IDC_BUTTON_PRESS_3, WmTabCommand_Press_0_9);
|
|
|
|
cmessages.Associate(IDC_BUTTON_PRESS_4, WmTabCommand_Press_0_9);
|
|
|
|
cmessages.Associate(IDC_BUTTON_PRESS_5, WmTabCommand_Press_0_9);
|
|
|
|
cmessages.Associate(IDC_BUTTON_PRESS_6, WmTabCommand_Press_0_9);
|
|
|
|
cmessages.Associate(IDC_BUTTON_PRESS_7, WmTabCommand_Press_0_9);
|
|
|
|
cmessages.Associate(IDC_BUTTON_PRESS_8, WmTabCommand_Press_0_9);
|
|
|
|
cmessages.Associate(IDC_BUTTON_PRESS_9, WmTabCommand_Press_0_9);
|
|
|
|
cmessages.Associate(IDC_BUTTON_COMMA, WmTabCommand_Press_comma);
|
|
|
|
|
|
|
|
cmessages.Associate(IDC_BUTTON_E, WmTabCommand_Press_e);
|
|
|
|
cmessages.Associate(IDC_BUTTON_PI, WmTabCommand_Press_pi);
|
|
|
|
cmessages.Associate(IDC_BUTTON_SIN, WmTabCommand_Press_sin);
|
|
|
|
cmessages.Associate(IDC_BUTTON_COS, WmTabCommand_Press_cos);
|
|
|
|
cmessages.Associate(IDC_BUTTON_TAN, WmTabCommand_Press_tan);
|
added: a user can change the names of variables or functions now
changed: the program uses TTMath 0.8.0 now
added: functions: from TTMath 0.8.0:
DegToDeg(deg, min, sec), DegToRad(deg), DegToRad(deg, min, sec),
RadToDeg(rad), Ceil(x), Floor(x), Sqrt(x), Sinh(x), Cosh(x),
Tanh(x) /Tgh(x)/, Coth(x) /Ctgh(x)/
added: a help
changed: from TTMath 0.8.0:
renamed: CTan() into Cot() or Ctg()
renamed: ACTan() into ACot() or ACtg()
Factorial() has a history log now (it can remember last
10 calculated values)
added: a directory 'help' with files of the help
added: a directory 'setup' with files needed to make an installer
(we're using InnoSetup Compiler to make it)
fixed: the vertical size of the main window when a user uses a different size
of the window caption (especially under the Windows XP Luna)
fixed: on Windows 9x: the program hung when a user clicks on a control
on the first tab (the procedure SetNextFocus(...) has been completely
rewritten and the flag WS_EX_CONTROLPARENT on the tab dialogs has
gone away)
fixed: when started navigating from the keyboard the program showed a wrong
variable or a funtion in the edit dialog
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@28 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-04-02 02:17:26 +02:00
|
|
|
cmessages.Associate(IDC_BUTTON_COT, WmTabCommand_Press_cot);
|
2007-01-22 12:12:01 +01:00
|
|
|
cmessages.Associate(IDC_BUTTON_LN, WmTabCommand_Press_ln);
|
|
|
|
cmessages.Associate(IDC_BUTTON_LOG, WmTabCommand_Press_log);
|
|
|
|
cmessages.Associate(IDC_BUTTON_ABS, WmTabCommand_Press_abs);
|
|
|
|
cmessages.Associate(IDC_BUTTON_FACTORIAL, WmTabCommand_Press_factorial);
|
2009-11-01 02:52:13 +01:00
|
|
|
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);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
cmessages.Associate(IDC_BUTTON_DIV, WmTabCommand_Press_div);
|
|
|
|
cmessages.Associate(IDC_BUTTON_MUL, WmTabCommand_Press_mul);
|
|
|
|
cmessages.Associate(IDC_BUTTON_SUB, WmTabCommand_Press_sub);
|
|
|
|
cmessages.Associate(IDC_BUTTON_ADD, WmTabCommand_Press_add);
|
|
|
|
cmessages.Associate(IDC_BUTTON_FIRST_BRACKET, WmTabCommand_Press_first_bracket);
|
|
|
|
cmessages.Associate(IDC_BUTTON_LAST_BRACKET, WmTabCommand_Press_last_bracket);
|
|
|
|
|
|
|
|
cmessages.Associate(IDC_BUTTON_CLEAR, WmTabCommand_Press_clear);
|
2007-02-08 18:54:37 +01:00
|
|
|
cmessages.Associate(IDC_BUTTON_ERROR, WmTabCommand_Press_error);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2007-02-28 18:52:09 +01:00
|
|
|
cmessages.Associate(IDC_BUTTON_ASIN, WmTabCommand_Press_asin);
|
|
|
|
cmessages.Associate(IDC_BUTTON_ACOS, WmTabCommand_Press_acos);
|
|
|
|
cmessages.Associate(IDC_BUTTON_ATAN, WmTabCommand_Press_atan);
|
added: a user can change the names of variables or functions now
changed: the program uses TTMath 0.8.0 now
added: functions: from TTMath 0.8.0:
DegToDeg(deg, min, sec), DegToRad(deg), DegToRad(deg, min, sec),
RadToDeg(rad), Ceil(x), Floor(x), Sqrt(x), Sinh(x), Cosh(x),
Tanh(x) /Tgh(x)/, Coth(x) /Ctgh(x)/
added: a help
changed: from TTMath 0.8.0:
renamed: CTan() into Cot() or Ctg()
renamed: ACTan() into ACot() or ACtg()
Factorial() has a history log now (it can remember last
10 calculated values)
added: a directory 'help' with files of the help
added: a directory 'setup' with files needed to make an installer
(we're using InnoSetup Compiler to make it)
fixed: the vertical size of the main window when a user uses a different size
of the window caption (especially under the Windows XP Luna)
fixed: on Windows 9x: the program hung when a user clicks on a control
on the first tab (the procedure SetNextFocus(...) has been completely
rewritten and the flag WS_EX_CONTROLPARENT on the tab dialogs has
gone away)
fixed: when started navigating from the keyboard the program showed a wrong
variable or a funtion in the edit dialog
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@28 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-04-02 02:17:26 +02:00
|
|
|
cmessages.Associate(IDC_BUTTON_ACOT, WmTabCommand_Press_acot);
|
2007-02-28 18:52:09 +01:00
|
|
|
cmessages.Associate(IDC_BUTTON_SGN, WmTabCommand_Press_sgn);
|
|
|
|
cmessages.Associate(IDC_BUTTON_MOD, WmTabCommand_Press_mod);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
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);
|
2009-11-01 02:52:13 +01:00
|
|
|
cmessages.Associate(IDC_BUTTON_BRACKETS_ALL, WmTabCommand_Press_bracketsall);
|
|
|
|
cmessages.Associate(IDC_BUTTON_1DIV_BRACKETS_ALL, WmTabCommand_Press_1div_bracketsall);
|
2009-11-01 21:34:10 +01:00
|
|
|
cmessages.Associate(IDC_BUTTON_SQRT, WmTabCommand_Press_sqrt);
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
cmessages.Associate(IDC_BUTTON_ADD_VARIABLE, Variables::WmTabCommand_AddVariable);
|
|
|
|
cmessages.Associate(IDC_BUTTON_EDIT_VARIABLE, Variables::WmTabCommand_EditVariable);
|
|
|
|
cmessages.Associate(IDC_BUTTON_DELETE_VARIABLE, Variables::WmTabCommand_DeleteVariable);
|
|
|
|
|
added: a user can change the names of variables or functions now
changed: the program uses TTMath 0.8.0 now
added: functions: from TTMath 0.8.0:
DegToDeg(deg, min, sec), DegToRad(deg), DegToRad(deg, min, sec),
RadToDeg(rad), Ceil(x), Floor(x), Sqrt(x), Sinh(x), Cosh(x),
Tanh(x) /Tgh(x)/, Coth(x) /Ctgh(x)/
added: a help
changed: from TTMath 0.8.0:
renamed: CTan() into Cot() or Ctg()
renamed: ACTan() into ACot() or ACtg()
Factorial() has a history log now (it can remember last
10 calculated values)
added: a directory 'help' with files of the help
added: a directory 'setup' with files needed to make an installer
(we're using InnoSetup Compiler to make it)
fixed: the vertical size of the main window when a user uses a different size
of the window caption (especially under the Windows XP Luna)
fixed: on Windows 9x: the program hung when a user clicks on a control
on the first tab (the procedure SetNextFocus(...) has been completely
rewritten and the flag WS_EX_CONTROLPARENT on the tab dialogs has
gone away)
fixed: when started navigating from the keyboard the program showed a wrong
variable or a funtion in the edit dialog
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@28 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-04-02 02:17:26 +02:00
|
|
|
cmessages.Associate(IDOK, WmTabCommand_IDOK);
|
|
|
|
cmessages.Associate(IDCANCEL, WmTabCommand_IDCANCEL);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
cmessages.Associate(IDC_BUTTON_ADD_FUNCTION, Functions::WmTabCommand_AddFunction);
|
|
|
|
cmessages.Associate(IDC_BUTTON_EDIT_FUNCTION, Functions::WmTabCommand_EditFunction);
|
|
|
|
cmessages.Associate(IDC_BUTTON_DELETE_FUNCTION, Functions::WmTabCommand_DeleteFunction);
|
|
|
|
|
2007-06-24 22:11:14 +02:00
|
|
|
#ifndef TTCALC_PORTABLE
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
cmessages.Associate(IDC_RADIO_PRECISION_1, WmTabCommand_SetPrecision1);
|
|
|
|
cmessages.Associate(IDC_RADIO_PRECISION_2, WmTabCommand_SetPrecision2);
|
|
|
|
cmessages.Associate(IDC_RADIO_PRECISION_3, WmTabCommand_SetPrecision3);
|
|
|
|
|
2007-06-24 22:11:14 +02:00
|
|
|
#endif
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
cmessages.Associate(IDC_COMBO_DISPLAY_INPUT, WmTabCommand_DisplayInputChanged);
|
|
|
|
cmessages.Associate(IDC_COMBO_DISPLAY_OUTPUT, WmTabCommand_DisplayOutputChanged);
|
|
|
|
cmessages.Associate(IDC_COMBO_DISPLAY_ROUNDING, WmTabCommand_DisplayRoundingChanged);
|
2008-04-12 10:52:21 +02:00
|
|
|
cmessages.Associate(IDC_CHECK_REMOVE_ZEROES, WmTabCommand_RemoveZeroesChanged);
|
2007-01-22 12:12:01 +01:00
|
|
|
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);
|
2009-11-03 22:00:05 +01:00
|
|
|
cmessages.Associate(IDC_COMBO_OUTPUT_DECIMAL_POINT, WmTabCommand_DisplayDecimalPointChanged);
|
2009-03-28 19:26:20 +01:00
|
|
|
cmessages.Associate(IDC_COMBO_DEG_RAD_GRAD, WmTabCommand_DisplayDegRadGradChanged);
|
2009-11-01 02:52:13 +01:00
|
|
|
cmessages.Associate(IDC_COMBO_DISPLAY_GROUPING, WmTabCommand_DisplayGrouping);
|
2011-01-30 18:30:10 +01:00
|
|
|
cmessages.Associate(IDC_COMBO_DISPLAY_GROUPING_DIGITS, WmTabCommand_DisplayGrouping);
|
2009-11-01 02:52:13 +01:00
|
|
|
cmessages.Associate(IDC_COMBO_INPUT_DECIMAL_POINT, WmTabCommand_DisplayInputDecimalPoint);
|
|
|
|
cmessages.Associate(IDC_COMBO_PARAM_SEPARATE, WmTabCommand_DisplayParamSep);
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
a function for WM_COMMAND for dialogs which are on the tab
|
|
|
|
*/
|
|
|
|
BOOL WmTabCommand(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2009-10-14 00:41:00 +02:00
|
|
|
static Messages<BOOL> command_messages;
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
if( command_messages.Empty() )
|
|
|
|
// initiation
|
|
|
|
CreateTabCommandMessagesTable(command_messages);
|
|
|
|
|
|
|
|
return command_messages.Call(LOWORD(wParam), hWnd, message, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WmTabInitDialog(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2007-02-08 18:54:37 +01:00
|
|
|
this function enables or disables the 'edit' and 'delete' buttons
|
2007-03-08 20:15:55 +01:00
|
|
|
on the variables' or functions' tab depending on how many variables
|
|
|
|
are selected in the list
|
2007-01-22 12:12:01 +01:00
|
|
|
*/
|
2007-03-08 20:15:55 +01:00
|
|
|
void SetDisablingEditDeleteVariableOrFunctionButtons(int count, HWND add,
|
|
|
|
HWND edit, HWND del, HWND focus)
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
|
|
|
if( count == 1 )
|
2007-03-08 20:15:55 +01:00
|
|
|
// if there is one selected item we're enabling the edit button
|
|
|
|
EnableWindow(edit, true);
|
2007-01-22 12:12:01 +01:00
|
|
|
else
|
2007-03-08 20:15:55 +01:00
|
|
|
{
|
|
|
|
// if there is not one selected item (or none) we're disabling the edit
|
|
|
|
EnableWindow(edit, false);
|
|
|
|
|
|
|
|
// if the focus is on the edit button we must change it
|
|
|
|
// for example into the add button
|
|
|
|
// (we must change the BS_DEFPUSHBUTTON style as well)
|
|
|
|
if( focus == edit )
|
|
|
|
{
|
|
|
|
SetFocus(add);
|
|
|
|
SendMessage(add, BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, true);
|
|
|
|
SendMessage(edit, BM_SETSTYLE, (WPARAM)BS_PUSHBUTTON, true);
|
|
|
|
}
|
|
|
|
}
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
if( count != 0 )
|
2007-03-08 20:15:55 +01:00
|
|
|
// if there is one or more items selected we're enabling the del button
|
|
|
|
EnableWindow(del, true);
|
2007-01-22 12:12:01 +01:00
|
|
|
else
|
2007-03-08 20:15:55 +01:00
|
|
|
{
|
|
|
|
// if there are not selected items we're disabling the del
|
|
|
|
EnableWindow(del, false);
|
|
|
|
|
|
|
|
if( focus == del )
|
|
|
|
{
|
|
|
|
SetFocus(add);
|
|
|
|
SendMessage(add, BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, true);
|
|
|
|
SendMessage(del, BM_SETSTYLE, (WPARAM)BS_PUSHBUTTON, true);
|
|
|
|
}
|
|
|
|
}
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
2007-02-08 18:54:37 +01:00
|
|
|
this function enables or disables the 'edit' and 'delete' buttons
|
2007-03-08 20:15:55 +01:00
|
|
|
on the variable's tab depending on how many variables are selected in the list
|
2007-01-22 12:12:01 +01:00
|
|
|
*/
|
2007-03-08 20:15:55 +01:00
|
|
|
void SetDisablingEditDeleteVariableButtons(HWND hWnd)
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
2007-03-08 20:15:55 +01:00
|
|
|
HWND focus = GetFocus();
|
|
|
|
HWND list = GetDlgItem(hWnd, IDC_VARIABLES_LIST);
|
|
|
|
HWND add = GetDlgItem(hWnd, IDC_BUTTON_ADD_VARIABLE);
|
|
|
|
HWND edit = GetDlgItem(hWnd, IDC_BUTTON_EDIT_VARIABLE);
|
|
|
|
HWND del = GetDlgItem(hWnd, IDC_BUTTON_DELETE_VARIABLE);
|
|
|
|
int count = ListView_GetSelectedCount(list);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2007-03-08 20:15:55 +01:00
|
|
|
SetDisablingEditDeleteVariableOrFunctionButtons(count, add, edit, del, focus);
|
|
|
|
}
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
|
2007-03-08 20:15:55 +01:00
|
|
|
/*!
|
|
|
|
this function enables or disables the 'edit' and 'delete' buttons
|
|
|
|
on the function's tab depending on how many variables are selected in the list
|
|
|
|
*/
|
|
|
|
void SetDisablingEditDeleteFunctionButtons(HWND hWnd)
|
|
|
|
{
|
|
|
|
HWND focus = GetFocus();
|
|
|
|
HWND list = GetDlgItem(hWnd, IDC_FUNCTIONS_LIST);
|
|
|
|
HWND add = GetDlgItem(hWnd, IDC_BUTTON_ADD_FUNCTION);
|
|
|
|
HWND edit = GetDlgItem(hWnd, IDC_BUTTON_EDIT_FUNCTION);
|
|
|
|
HWND del = GetDlgItem(hWnd, IDC_BUTTON_DELETE_FUNCTION);
|
|
|
|
int count = ListView_GetSelectedCount(list);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2007-03-08 20:15:55 +01:00
|
|
|
SetDisablingEditDeleteVariableOrFunctionButtons(count, add, edit, del, focus);
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2007-03-08 20:15:55 +01:00
|
|
|
int FillUpVariableList(HWND list)
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
|
|
|
// we don't have to block the second thread here
|
|
|
|
// because it can only read from variables' table
|
|
|
|
// (we can read and the second thread can read in the same time as well)
|
|
|
|
ttmath::Objects::CIterator iv = GetPrgRes()->GetVariables()->Begin();
|
|
|
|
|
2007-03-08 20:15:55 +01:00
|
|
|
int size;
|
|
|
|
for( size=0 ; iv != GetPrgRes()->GetVariables()->End() ; ++iv, ++size )
|
2007-01-22 12:12:01 +01:00
|
|
|
Variables::AddNewItemToVariableList(list, iv->first, iv->second.value);
|
2007-03-08 20:15:55 +01:00
|
|
|
|
|
|
|
return size;
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2007-03-08 20:15:55 +01:00
|
|
|
int FillUpFunctionList(HWND list)
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
|
|
|
// we don't have to block the second thread here
|
|
|
|
// because it can only read from functions' table
|
|
|
|
// (we can read and the second thread can read in the same time as well)
|
|
|
|
ttmath::Objects::CIterator iv = GetPrgRes()->GetFunctions()->Begin();
|
|
|
|
|
2007-03-08 20:15:55 +01:00
|
|
|
int size;
|
|
|
|
for( size=0 ; iv != GetPrgRes()->GetFunctions()->End() ; ++iv, ++size )
|
2007-01-22 12:12:01 +01:00
|
|
|
Functions::AddNewItemToFunctionList(list, iv->first, iv->second.value, iv->second.param);
|
2007-03-08 20:15:55 +01:00
|
|
|
|
|
|
|
return size;
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmInitTabVariables(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
HWND list = GetDlgItem(hWnd, IDC_VARIABLES_LIST);
|
|
|
|
LVCOLUMN column;
|
2011-02-08 17:15:35 +01:00
|
|
|
RECT r;
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2011-02-08 17:15:35 +01:00
|
|
|
GetWindowRect(list, &r);
|
|
|
|
|
|
|
|
int list_cx = r.right - r.left;
|
|
|
|
int header1_cx = 70;
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
column.mask = LVCF_TEXT | LVCF_WIDTH;
|
2011-02-08 17:15:35 +01:00
|
|
|
column.cx = header1_cx;
|
2007-01-22 12:12:01 +01:00
|
|
|
column.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::list_variables_header_1) );
|
|
|
|
ListView_InsertColumn(list, 0, &column);
|
|
|
|
|
2011-02-08 17:15:35 +01:00
|
|
|
column.cx = list_cx - header1_cx;
|
2007-01-22 12:12:01 +01:00
|
|
|
column.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::list_variables_header_2) );
|
|
|
|
ListView_InsertColumn(list, 1, &column);
|
|
|
|
|
|
|
|
ListView_SetExtendedListViewStyle(list,LVS_EX_FULLROWSELECT);
|
|
|
|
SetDisablingEditDeleteVariableButtons(hWnd);
|
2007-03-08 20:15:55 +01:00
|
|
|
|
|
|
|
if( FillUpVariableList(list) > 0 )
|
added: a user can change the names of variables or functions now
changed: the program uses TTMath 0.8.0 now
added: functions: from TTMath 0.8.0:
DegToDeg(deg, min, sec), DegToRad(deg), DegToRad(deg, min, sec),
RadToDeg(rad), Ceil(x), Floor(x), Sqrt(x), Sinh(x), Cosh(x),
Tanh(x) /Tgh(x)/, Coth(x) /Ctgh(x)/
added: a help
changed: from TTMath 0.8.0:
renamed: CTan() into Cot() or Ctg()
renamed: ACTan() into ACot() or ACtg()
Factorial() has a history log now (it can remember last
10 calculated values)
added: a directory 'help' with files of the help
added: a directory 'setup' with files needed to make an installer
(we're using InnoSetup Compiler to make it)
fixed: the vertical size of the main window when a user uses a different size
of the window caption (especially under the Windows XP Luna)
fixed: on Windows 9x: the program hung when a user clicks on a control
on the first tab (the procedure SetNextFocus(...) has been completely
rewritten and the flag WS_EX_CONTROLPARENT on the tab dialogs has
gone away)
fixed: when started navigating from the keyboard the program showed a wrong
variable or a funtion in the edit dialog
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@28 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-04-02 02:17:26 +02:00
|
|
|
ListView_SetItemState(list, 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL WmInitTabFunctions(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
HWND list = GetDlgItem(hWnd, IDC_FUNCTIONS_LIST);
|
|
|
|
LVCOLUMN column;
|
2011-02-08 17:15:35 +01:00
|
|
|
RECT r;
|
|
|
|
|
|
|
|
GetWindowRect(list, &r);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2011-02-08 17:15:35 +01:00
|
|
|
int list_cx = r.right - r.left;
|
|
|
|
int header1_cx = 70;
|
|
|
|
int header2_cx = 70;
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
column.mask = LVCF_TEXT | LVCF_WIDTH;
|
2011-02-08 17:15:35 +01:00
|
|
|
column.cx = header1_cx;
|
2007-01-22 12:12:01 +01:00
|
|
|
column.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::list_functions_header_1) );
|
|
|
|
ListView_InsertColumn(list, 0, &column);
|
|
|
|
|
2011-02-08 17:15:35 +01:00
|
|
|
column.cx = header2_cx;
|
2007-01-22 12:12:01 +01:00
|
|
|
column.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::list_functions_header_2) );
|
|
|
|
ListView_InsertColumn(list, 1, &column);
|
|
|
|
|
2011-02-08 17:15:35 +01:00
|
|
|
column.cx = list_cx - header1_cx - header2_cx;
|
2007-01-22 12:12:01 +01:00
|
|
|
column.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::list_functions_header_3) );
|
|
|
|
ListView_InsertColumn(list, 2, &column);
|
|
|
|
|
|
|
|
ListView_SetExtendedListViewStyle(list,LVS_EX_FULLROWSELECT);
|
|
|
|
|
|
|
|
SetDisablingEditDeleteFunctionButtons(hWnd);
|
2007-03-08 20:15:55 +01:00
|
|
|
|
|
|
|
if( FillUpFunctionList(list) > 0 )
|
added: a user can change the names of variables or functions now
changed: the program uses TTMath 0.8.0 now
added: functions: from TTMath 0.8.0:
DegToDeg(deg, min, sec), DegToRad(deg), DegToRad(deg, min, sec),
RadToDeg(rad), Ceil(x), Floor(x), Sqrt(x), Sinh(x), Cosh(x),
Tanh(x) /Tgh(x)/, Coth(x) /Ctgh(x)/
added: a help
changed: from TTMath 0.8.0:
renamed: CTan() into Cot() or Ctg()
renamed: ACTan() into ACot() or ACtg()
Factorial() has a history log now (it can remember last
10 calculated values)
added: a directory 'help' with files of the help
added: a directory 'setup' with files needed to make an installer
(we're using InnoSetup Compiler to make it)
fixed: the vertical size of the main window when a user uses a different size
of the window caption (especially under the Windows XP Luna)
fixed: on Windows 9x: the program hung when a user clicks on a control
on the first tab (the procedure SetNextFocus(...) has been completely
rewritten and the flag WS_EX_CONTROLPARENT on the tab dialogs has
gone away)
fixed: when started navigating from the keyboard the program showed a wrong
variable or a funtion in the edit dialog
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@28 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-04-02 02:17:26 +02:00
|
|
|
ListView_SetItemState(list, 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmInitTabPrecision(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-06-24 22:11:14 +02:00
|
|
|
#ifndef TTCALC_PORTABLE
|
2007-01-22 12:12:01 +01:00
|
|
|
CheckDlgButton(hWnd, IDC_RADIO_PRECISION_1 + GetPrgRes()->GetPrecision(), BST_CHECKED);
|
2007-06-24 22:11:14 +02:00
|
|
|
#endif
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WmInitTabDisplay(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char buffer[20];
|
|
|
|
|
|
|
|
for(i=2 ; i<=16 ; ++i)
|
|
|
|
{
|
|
|
|
sprintf(buffer,"%d",i);
|
|
|
|
|
|
|
|
switch( i )
|
|
|
|
{
|
|
|
|
case 2:
|
|
|
|
strcat(buffer, " (bin)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
strcat(buffer, " (oct)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 10:
|
|
|
|
strcat(buffer, " (dec)");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16:
|
|
|
|
strcat(buffer, " (hex)");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_INPUT, CB_ADDSTRING, 0, (LPARAM)buffer);
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_OUTPUT, CB_ADDSTRING, 0, (LPARAM)buffer);
|
|
|
|
} // for
|
|
|
|
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_INPUT, CB_SETCURSEL, GetPrgRes()->GetBaseInput()-2, 0);
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_DISPLAY_OUTPUT, CB_SETCURSEL, GetPrgRes()->GetBaseOutput()-2, 0);
|
|
|
|
|
|
|
|
|
|
|
|
if( GetPrgRes()->GetDisplayAlwaysScientific() )
|
|
|
|
CheckDlgButton(hWnd, IDC_RADIO_DISPLAY_ALWAYS_SCIENTIFIC, BST_CHECKED);
|
|
|
|
else
|
|
|
|
CheckDlgButton(hWnd, IDC_RADIO_DISPLAY_NOT_ALWAYS_SCIENTIFIC, BST_CHECKED);
|
|
|
|
|
|
|
|
SetDisablingDisplayWhenScientific(hWnd);
|
2011-01-30 18:30:10 +01:00
|
|
|
SetDisablingGroupingDigits(hWnd);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
SendDlgItemMessage(hWnd, IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC, UDM_SETBASE, 10,0);
|
|
|
|
SendDlgItemMessage(hWnd, IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC, UDM_SETRANGE, 0, MAKELONG(99,1));
|
|
|
|
SendDlgItemMessage(hWnd, IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC, UDM_SETPOS, 0, 5);
|
|
|
|
SendDlgItemMessage(hWnd, IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC, UDM_SETBUDDY, (WPARAM)GetDlgItem(hWnd, IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC), 0);
|
|
|
|
SendDlgItemMessage(hWnd, IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC, EM_SETLIMITTEXT, 2, 0);
|
|
|
|
|
|
|
|
sprintf(buffer,"%d", GetPrgRes()->GetDisplayWhenScientific());
|
|
|
|
SetDlgItemText(hWnd, IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC, buffer);
|
|
|
|
|
2009-11-03 22:00:05 +01:00
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_OUTPUT_DECIMAL_POINT, CB_ADDSTRING, 0, (LPARAM)" .");
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_OUTPUT_DECIMAL_POINT, CB_ADDSTRING, 0, (LPARAM)" ,");
|
|
|
|
SendDlgItemMessage(hWnd, IDC_COMBO_OUTPUT_DECIMAL_POINT, CB_SETCURSEL, GetPrgRes()->GetDecimalPoint(), 0);
|
2007-12-09 21:05:15 +01:00
|
|
|
|
2008-04-12 10:52:21 +02:00
|
|
|
if( GetPrgRes()->GetRemovingZeroes() )
|
|
|
|
CheckDlgButton(hWnd, IDC_CHECK_REMOVE_ZEROES, BST_CHECKED);
|
|
|
|
|
2009-03-28 19:26:20 +01:00
|
|
|
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);
|
2009-11-01 02:52:13 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-08-22 23:16:19 +02:00
|
|
|
|
|
|
|
|
2007-08-20 12:44:37 +02:00
|
|
|
BOOL WmInitTabConvert(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-08-22 23:16:19 +02:00
|
|
|
HWND list1 = GetDlgItem(hWnd, IDC_LIST_UNIT_TYPE);
|
2007-09-18 22:08:47 +02:00
|
|
|
HWND list2b = GetDlgItem(hWnd, IDC_LIST_UNIT_INPUT2);
|
|
|
|
HWND list3b = GetDlgItem(hWnd, IDC_LIST_UNIT_OUTPUT2);
|
2007-08-20 12:44:37 +02:00
|
|
|
|
2007-08-22 23:16:19 +02:00
|
|
|
ListView_SetExtendedListViewStyle(list1, LVS_EX_FULLROWSELECT);
|
2007-09-18 22:08:47 +02:00
|
|
|
ListView_SetExtendedListViewStyle(list2b, LVS_EX_FULLROWSELECT);
|
|
|
|
ListView_SetExtendedListViewStyle(list3b, LVS_EX_FULLROWSELECT);
|
2007-08-20 12:44:37 +02:00
|
|
|
|
2007-08-22 23:16:19 +02:00
|
|
|
LVCOLUMN col;
|
2007-08-20 12:44:37 +02:00
|
|
|
|
2007-08-22 23:16:19 +02:00
|
|
|
col.mask = LVCF_FMT | LVCF_WIDTH;
|
|
|
|
col.fmt = LVCFMT_LEFT;
|
2007-08-20 12:44:37 +02:00
|
|
|
|
2007-11-03 23:56:43 +01:00
|
|
|
col.cx = 70;
|
2007-08-22 23:16:19 +02:00
|
|
|
ListView_InsertColumn(list1, 0, &col);
|
2007-08-20 12:44:37 +02:00
|
|
|
|
2007-11-03 23:56:43 +01:00
|
|
|
col.cx = 90;
|
2007-09-18 22:08:47 +02:00
|
|
|
ListView_InsertColumn(list2b, 0, &col);
|
|
|
|
|
2007-11-03 23:56:43 +01:00
|
|
|
col.cx = 90;
|
2007-09-18 22:08:47 +02:00
|
|
|
ListView_InsertColumn(list3b, 0, &col);
|
2007-08-20 12:44:37 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2007-02-08 18:54:37 +01:00
|
|
|
|
2007-03-09 20:04:14 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
BOOL WmNotify(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-09-18 22:08:47 +02:00
|
|
|
NMHDR * pnmh = (LPNMHDR) lParam;
|
|
|
|
HWND var_list = GetDlgItem(hWnd,IDC_VARIABLES_LIST);
|
|
|
|
HWND fun_list = GetDlgItem(hWnd,IDC_FUNCTIONS_LIST);
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
if( pnmh->hwndFrom == var_list )
|
|
|
|
{
|
|
|
|
if( pnmh->code == LVN_ITEMCHANGED )
|
|
|
|
{
|
|
|
|
SetDisablingEditDeleteVariableButtons( hWnd );
|
|
|
|
return true;
|
|
|
|
}
|
2007-03-09 20:04:14 +01:00
|
|
|
else
|
2007-01-22 12:12:01 +01:00
|
|
|
if( pnmh->code == UINT(NM_DBLCLK) )
|
|
|
|
{
|
|
|
|
Variables::WmTabCommand_EditVariable(hWnd, WM_COMMAND, IDC_BUTTON_EDIT_VARIABLE, 0);
|
|
|
|
return true;
|
|
|
|
}
|
2007-03-09 20:04:14 +01:00
|
|
|
else
|
|
|
|
if( pnmh->code == LVN_KEYDOWN )
|
|
|
|
{
|
|
|
|
NMLVKEYDOWN * pnkd = (NMLVKEYDOWN*) lParam;
|
|
|
|
|
|
|
|
if( pnkd->wVKey == VK_DELETE )
|
|
|
|
Variables::WmTabCommand_DeleteVariable(0,0,0,0);
|
|
|
|
}
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if( pnmh->hwndFrom == fun_list )
|
|
|
|
{
|
|
|
|
if( pnmh->code == LVN_ITEMCHANGED )
|
|
|
|
{
|
|
|
|
SetDisablingEditDeleteFunctionButtons( hWnd );
|
|
|
|
return true;
|
|
|
|
}
|
2007-03-09 20:04:14 +01:00
|
|
|
else
|
2007-01-22 12:12:01 +01:00
|
|
|
if( pnmh->code == UINT(NM_DBLCLK) )
|
|
|
|
{
|
|
|
|
Functions::WmTabCommand_EditFunction(hWnd, WM_COMMAND, IDC_BUTTON_EDIT_FUNCTION, 0);
|
|
|
|
return true;
|
|
|
|
}
|
2007-03-09 20:04:14 +01:00
|
|
|
else
|
|
|
|
if( pnmh->code == LVN_KEYDOWN )
|
|
|
|
{
|
|
|
|
NMLVKEYDOWN * pnkd = (NMLVKEYDOWN*) lParam;
|
|
|
|
|
|
|
|
if( pnkd->wVKey == VK_DELETE )
|
|
|
|
Functions::WmTabCommand_DeleteFunction(0,0,0,0);
|
|
|
|
}
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
2007-09-18 22:08:47 +02:00
|
|
|
|
2009-03-28 19:26:20 +01:00
|
|
|
#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);
|
|
|
|
|
2007-09-18 22:08:47 +02:00
|
|
|
if( pnmh->hwndFrom==conv_list1 || pnmh->hwndFrom==conv_list2b || pnmh->hwndFrom==conv_list3b )
|
|
|
|
{
|
|
|
|
if( pnmh->code == LVN_ITEMCHANGED )
|
|
|
|
{
|
|
|
|
NMLISTVIEW * pnmv = (NMLISTVIEW*) lParam;
|
|
|
|
|
|
|
|
if( pnmv->iItem != -1 )
|
|
|
|
{
|
|
|
|
if( pnmh->hwndFrom == conv_list1 )
|
|
|
|
TabConvertTypeChanged(hWnd, pnmv->iItem);
|
|
|
|
if( pnmh->hwndFrom == conv_list2b )
|
|
|
|
TabConvertUnitInputChanged(hWnd, pnmv->iItem);
|
|
|
|
else
|
|
|
|
if( pnmh->hwndFrom == conv_list3b )
|
|
|
|
TabConvertUnitOutputChanged(hWnd, pnmv->iItem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-03-28 19:26:20 +01:00
|
|
|
#endif
|
2007-09-18 22:08:47 +02:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-08 20:15:55 +01:00
|
|
|
|
|
|
|
|
2009-10-14 00:41:00 +02:00
|
|
|
void CreateTabMessagesTable(Messages<BOOL> & messages)
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
|
|
|
messages.Associate(WM_INITDIALOG, WmTabInitDialog);
|
|
|
|
messages.Associate(WM_COMMAND, WmTabCommand);
|
|
|
|
messages.Associate(WM_INIT_TAB_VARIABLES, WmInitTabVariables);
|
|
|
|
messages.Associate(WM_INIT_TAB_FUNCTIONS, WmInitTabFunctions);
|
2007-06-24 22:11:14 +02:00
|
|
|
|
|
|
|
#ifndef TTCALC_PORTABLE
|
2007-01-22 12:12:01 +01:00
|
|
|
messages.Associate(WM_INIT_TAB_PRECISION, WmInitTabPrecision);
|
2007-06-24 22:11:14 +02:00
|
|
|
#endif
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
messages.Associate(WM_INIT_TAB_DISPLAY, WmInitTabDisplay);
|
2009-03-28 19:26:20 +01:00
|
|
|
|
|
|
|
#ifdef TTCALC_CONVERT
|
2007-08-20 12:44:37 +02:00
|
|
|
messages.Associate(WM_INIT_TAB_CONVERT, WmInitTabConvert);
|
2009-03-28 19:26:20 +01:00
|
|
|
#endif
|
2007-08-20 12:44:37 +02:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
messages.Associate(WM_NOTIFY, WmNotify);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BOOL CALLBACK TabWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2009-10-14 00:41:00 +02:00
|
|
|
static Messages<BOOL> messages;
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
if( messages.Empty() )
|
|
|
|
// initiation
|
|
|
|
CreateTabMessagesTable(messages);
|
|
|
|
|
|
|
|
return messages.Call(message, hWnd, message, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-03 23:56:43 +01:00
|
|
|
POINT ResizeTabDialog(HWND tab, HWND dialog, int tabx, int taby, int borderx, int bordery)
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
2007-11-03 23:56:43 +01:00
|
|
|
RECT r_dialog;
|
|
|
|
POINT p, new_dialog_size;
|
|
|
|
|
|
|
|
GetWindowRect(dialog, &r_dialog);
|
|
|
|
p.x = r_dialog.left;
|
|
|
|
p.y = r_dialog.top;
|
|
|
|
ScreenToClient(tab,&p);
|
|
|
|
new_dialog_size.x = tabx-borderx-p.x;
|
|
|
|
new_dialog_size.y = taby-bordery-p.y;
|
|
|
|
int resize_flags = SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER;
|
|
|
|
SetWindowPos(dialog, 0, 0, 0, new_dialog_size.x, new_dialog_size.y, resize_flags);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2007-11-03 23:56:43 +01:00
|
|
|
return new_dialog_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetSizeOfFunctionVariableList(HWND tab, int tabx, int taby, int borderx, int bordery, int tab_id, int list_id, int last_column)
|
|
|
|
{
|
|
|
|
RECT r;
|
|
|
|
POINT p;
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
HWND dialog = GetPrgRes()->GetTabWindow(tab_id);
|
|
|
|
HWND list = GetDlgItem(dialog, list_id);
|
2007-11-03 23:56:43 +01:00
|
|
|
int resize_flags = SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER;
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2007-11-03 23:56:43 +01:00
|
|
|
ResizeTabDialog(tab, dialog, tabx, taby, borderx, bordery);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
GetWindowRect(list, &r);
|
|
|
|
p.x = r.left;
|
|
|
|
p.y = r.top;
|
2007-11-03 23:56:43 +01:00
|
|
|
ScreenToClient(tab,&p);
|
|
|
|
int newx = tabx - borderx - p.x;
|
|
|
|
int newy = taby - bordery - p.y;
|
|
|
|
SetWindowPos(list, 0, 0, 0, newx, newy, resize_flags);
|
2007-03-02 21:29:27 +01:00
|
|
|
|
|
|
|
int sum = 0;
|
|
|
|
for(int i=0 ; i<last_column ; ++i)
|
|
|
|
sum += ListView_GetColumnWidth(list, i);
|
|
|
|
|
2007-11-03 23:56:43 +01:00
|
|
|
if( sum < newx - 30 )
|
|
|
|
ListView_SetColumnWidth(list, last_column, newx-sum-25);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SetSizeOfVariablesList(HWND tab, int tabx, int taby, int borderx, int bordery)
|
|
|
|
{
|
|
|
|
SetSizeOfFunctionVariableList(tab, tabx, taby, borderx, bordery, TabWindowFunctions::tab_variables, IDC_VARIABLES_LIST, 1);
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
2007-11-03 23:56:43 +01:00
|
|
|
void SetSizeOfFunctionsList(HWND tab, int tabx, int taby, int borderx, int bordery)
|
|
|
|
{
|
|
|
|
SetSizeOfFunctionVariableList(tab, tabx, taby, borderx, bordery, TabWindowFunctions::tab_functions, IDC_FUNCTIONS_LIST, 2);
|
|
|
|
}
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
|
2007-11-03 23:56:43 +01:00
|
|
|
void SetSizeOfConvertingLists(HWND tab, int tabx, int taby, int borderx, int bordery)
|
2007-01-22 12:12:01 +01:00
|
|
|
{
|
2007-11-03 23:56:43 +01:00
|
|
|
RECT r_edit, r;
|
|
|
|
POINT p;
|
|
|
|
|
|
|
|
HWND dialog = GetPrgRes()->GetTabWindow(tab_convert);
|
|
|
|
HWND list1 = GetDlgItem(dialog, IDC_LIST_UNIT_TYPE);
|
|
|
|
HWND info_edit = GetDlgItem(dialog, IDC_EDIT_OUTPUT_INFO);
|
|
|
|
HWND check_dynamic_output = GetDlgItem(dialog, IDC_COMBO_DYNAMIC_OUTPUT);
|
2007-11-04 22:56:55 +01:00
|
|
|
int move_flags = SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER;
|
|
|
|
int move_resize_flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER;
|
2007-11-03 23:56:43 +01:00
|
|
|
|
|
|
|
POINT dialog_new_size = ResizeTabDialog(tab, dialog, tabx, taby, borderx, bordery);
|
|
|
|
|
|
|
|
GetWindowRect(info_edit, &r_edit);
|
|
|
|
|
|
|
|
GetWindowRect(list1, &r);
|
|
|
|
p.x = r.left;
|
|
|
|
p.y = r.top;
|
2007-11-04 22:56:55 +01:00
|
|
|
ScreenToClient(dialog,&p);
|
|
|
|
|
|
|
|
GetWindowRect(dialog, &r);
|
|
|
|
int newy = (r.bottom-r.top) - bordery - (r_edit.bottom-r_edit.top) - p.y;
|
|
|
|
int list1_x = p.x;
|
|
|
|
|
|
|
|
int list2a_cx = tabx/7;
|
|
|
|
int list2b_cx = tabx/5;
|
|
|
|
int list3a_cx = tabx/7;
|
|
|
|
int list3b_cx = tabx/5;
|
|
|
|
|
|
|
|
int marginx = 4;
|
|
|
|
int list1_cx = tabx - list2a_cx - list2b_cx - list3a_cx - list3b_cx - marginx*4 - borderx - 8;
|
|
|
|
|
|
|
|
SetWindowPos(list1, 0, list1_x, p.y, list1_cx, newy, move_resize_flags);
|
2007-11-03 23:56:43 +01:00
|
|
|
|
|
|
|
HWND list2a = GetDlgItem(dialog, IDC_LIST_UNIT_INPUT1);
|
|
|
|
HWND list2b = GetDlgItem(dialog, IDC_LIST_UNIT_INPUT2);
|
|
|
|
HWND list3a = GetDlgItem(dialog, IDC_LIST_UNIT_OUTPUT1);
|
|
|
|
HWND list3b = GetDlgItem(dialog, IDC_LIST_UNIT_OUTPUT2);
|
|
|
|
|
2007-11-04 22:56:55 +01:00
|
|
|
int list2a_x = list1_x + list1_cx + marginx;
|
|
|
|
int list2b_x = list2a_x + list2a_cx + marginx;
|
|
|
|
int list3a_x = list2b_x + list2b_cx + marginx;
|
|
|
|
int list3b_x = list3a_x + list3a_cx + marginx;
|
2007-11-03 23:56:43 +01:00
|
|
|
|
2007-11-04 22:56:55 +01:00
|
|
|
SetWindowPos(list2a, 0, list2a_x, p.y, list2a_cx, newy, move_resize_flags);
|
|
|
|
SetWindowPos(list2b, 0, list2b_x, p.y, list2b_cx, newy, move_resize_flags);
|
|
|
|
SetWindowPos(list3a, 0, list3a_x, p.y, list3a_cx, newy, move_resize_flags);
|
|
|
|
SetWindowPos(list3b, 0, list3b_x, p.y, list3b_cx, newy, move_resize_flags);
|
2007-11-03 23:56:43 +01:00
|
|
|
|
|
|
|
newy = dialog_new_size.y -(r_edit.bottom-r_edit.top);
|
2007-11-04 22:56:55 +01:00
|
|
|
int info_edit_cx = list1_cx + list2a_cx + list2b_cx + marginx*2;
|
|
|
|
SetWindowPos(info_edit, 0, list1_x, newy, info_edit_cx, (r_edit.bottom-r_edit.top), move_resize_flags);
|
2007-11-03 23:56:43 +01:00
|
|
|
|
2007-11-04 22:56:55 +01:00
|
|
|
SetWindowPos(check_dynamic_output, 0, list1_x + info_edit_cx + marginx, newy, 0, 0, move_flags);
|
|
|
|
|
|
|
|
HWND static_type = GetDlgItem(dialog, IDC_STATIC_UNIT_CONVERSION);
|
|
|
|
GetWindowRect(static_type, &r);
|
2007-11-03 23:56:43 +01:00
|
|
|
p.x = r.left;
|
|
|
|
p.y = r.top;
|
2007-11-04 22:56:55 +01:00
|
|
|
ScreenToClient(dialog, &p);
|
|
|
|
SetWindowPos(static_type, 0, list1_x, p.y, 0, 0, move_flags);
|
|
|
|
|
|
|
|
HWND static_input = GetDlgItem(dialog, IDC_STATIC_UNIT_INPUT);
|
|
|
|
SetWindowPos(static_input, 0, list2a_x, p.y, 0, 0, move_flags);
|
|
|
|
|
|
|
|
HWND static_output = GetDlgItem(dialog, IDC_STATIC_UNIT_OUTPUT);
|
|
|
|
SetWindowPos(static_output, 0, list3a_x, p.y, 0, 0, move_flags);
|
|
|
|
|
|
|
|
// setting width of colums inside the lists
|
|
|
|
int vscroll_cx = GetSystemMetrics(SM_CXVSCROLL) + borderx;
|
|
|
|
ListView_SetColumnWidth(list1, 0, list1_cx - vscroll_cx);
|
|
|
|
ListView_SetColumnWidth(list2a, 0, list2a_cx - vscroll_cx);
|
|
|
|
ListView_SetColumnWidth(list2b, 0, list2b_cx - vscroll_cx);
|
|
|
|
ListView_SetColumnWidth(list3a, 0, list3a_cx - vscroll_cx);
|
|
|
|
ListView_SetColumnWidth(list3b, 0, list3b_cx - vscroll_cx);
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
added: a user can change the names of variables or functions now
changed: the program uses TTMath 0.8.0 now
added: functions: from TTMath 0.8.0:
DegToDeg(deg, min, sec), DegToRad(deg), DegToRad(deg, min, sec),
RadToDeg(rad), Ceil(x), Floor(x), Sqrt(x), Sinh(x), Cosh(x),
Tanh(x) /Tgh(x)/, Coth(x) /Ctgh(x)/
added: a help
changed: from TTMath 0.8.0:
renamed: CTan() into Cot() or Ctg()
renamed: ACTan() into ACot() or ACtg()
Factorial() has a history log now (it can remember last
10 calculated values)
added: a directory 'help' with files of the help
added: a directory 'setup' with files needed to make an installer
(we're using InnoSetup Compiler to make it)
fixed: the vertical size of the main window when a user uses a different size
of the window caption (especially under the Windows XP Luna)
fixed: on Windows 9x: the program hung when a user clicks on a control
on the first tab (the procedure SetNextFocus(...) has been completely
rewritten and the flag WS_EX_CONTROLPARENT on the tab dialogs has
gone away)
fixed: when started navigating from the keyboard the program showed a wrong
variable or a funtion in the edit dialog
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@28 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-04-02 02:17:26 +02:00
|
|
|
void SetSizeOfDialogs()
|
|
|
|
{
|
|
|
|
const int cy_std = 19;
|
|
|
|
int cy_caption = GetSystemMetrics(SM_CYCAPTION);
|
|
|
|
|
|
|
|
if( cy_caption <= cy_std )
|
|
|
|
return;
|
|
|
|
|
|
|
|
int len = GetPrgRes()->HowManyTabWindows();
|
|
|
|
RECT r;
|
|
|
|
|
|
|
|
for(int i = 0 ; i<len ; ++i )
|
|
|
|
{
|
|
|
|
HWND dialog = GetPrgRes()->GetTabWindow(i);
|
|
|
|
GetWindowRect( dialog, &r);
|
|
|
|
SetWindowPos( dialog,0, 0,0, r.right-r.left, r.bottom-r.top+(cy_caption-cy_std),
|
|
|
|
SWP_NOZORDER |SWP_NOMOVE);
|
|
|
|
|
|
|
|
GetWindowRect( dialog, &r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
} // namespace TabWindowFunctions
|
|
|
|
|
|
|
|
|
|
|
|
|