Compare commits
82 Commits
Author | SHA1 | Date |
---|---|---|
Tomasz Sowa | d54ebd1ae7 | |
Tomasz Sowa | af26634fb7 | |
Tomasz Sowa | 89741a880e | |
Tomasz Sowa | 14f987012d | |
Tomasz Sowa | c4f316d7d3 | |
Tomasz Sowa | 547f01bf34 | |
Tomasz Sowa | c4bcecc029 | |
Tomasz Sowa | af2f173a82 | |
Tomasz Sowa | 6c0a4b110e | |
Tomasz Sowa | 8e9a459c9c | |
Tomasz Sowa | 844f79b793 | |
Tomasz Sowa | 21372faa56 | |
Tomasz Sowa | ac8574e9da | |
Tomasz Sowa | 7c62d9eae0 | |
Tomasz Sowa | e87308c721 | |
Tomasz Sowa | eb7cec8ecc | |
Tomasz Sowa | f67657c026 | |
Tomasz Sowa | 300f1aaa5f | |
Tomasz Sowa | cfcb654e53 | |
Tomasz Sowa | 9e25a7bc7a | |
Tomasz Sowa | c3a35102a3 | |
Tomasz Sowa | 29f1aa1c8b | |
Tomasz Sowa | 56fea5a67c | |
Tomasz Sowa | 47e4d83eab | |
Tomasz Sowa | 48d182a05f | |
Tomasz Sowa | 6f6948087c | |
Tomasz Sowa | e6b64ccdad | |
Tomasz Sowa | 1f455925db | |
Tomasz Sowa | 6f48d6414f | |
Tomasz Sowa | 486c78d072 | |
Tomasz Sowa | eeb5930120 | |
Tomasz Sowa | 271db20fc5 | |
Tomasz Sowa | 3fd5347310 | |
Tomasz Sowa | 58069828e5 | |
Tomasz Sowa | c0a0660482 | |
Tomasz Sowa | ce272dcb1a | |
Tomasz Sowa | d3b0262244 | |
Tomasz Sowa | f3ee187413 | |
Tomasz Sowa | fbab1df13f | |
Tomasz Sowa | e7ec06ea9d | |
Tomasz Sowa | 4346383c57 | |
Tomasz Sowa | 19abe8ff12 | |
Tomasz Sowa | 2fd7432920 | |
Tomasz Sowa | 787557590a | |
Tomasz Sowa | fb04d22d14 | |
Tomasz Sowa | 8fa1a24350 | |
Tomasz Sowa | 59d24bf3ae | |
Tomasz Sowa | dbcfa526ec | |
Tomasz Sowa | ad3625deab | |
Tomasz Sowa | 637f82e5e2 | |
Tomasz Sowa | 85e16db946 | |
Tomasz Sowa | 8880e87af6 | |
Tomasz Sowa | 783bebc269 | |
Tomasz Sowa | 19f4177691 | |
Tomasz Sowa | b668b3765c | |
Tomasz Sowa | b3f25face3 | |
Tomasz Sowa | 34500e3a5e | |
Tomasz Sowa | e841dcfa70 | |
Tomasz Sowa | ebc5359953 | |
Tomasz Sowa | dd32ebd6cd | |
Tomasz Sowa | e89901bbab | |
Tomasz Sowa | 87abe4ce7e | |
Tomasz Sowa | e960c2adea | |
Tomasz Sowa | 6555140b9a | |
Tomasz Sowa | 04fbbaceca | |
Tomasz Sowa | ff62d833c9 | |
Tomasz Sowa | 2ff2aebbee | |
Tomasz Sowa | ec87cd8054 | |
Tomasz Sowa | b7b52c9ebe | |
Tomasz Sowa | 4e75bda5fc | |
Tomasz Sowa | ee05abc94d | |
Tomasz Sowa | 01ad539107 | |
Tomasz Sowa | ae0a8dc911 | |
Tomasz Sowa | d33a6925b1 | |
Tomasz Sowa | f59f1e1580 | |
Tomasz Sowa | 000d884d36 | |
Tomasz Sowa | 758d881510 | |
Tomasz Sowa | c232565953 | |
Tomasz Sowa | af284466d6 | |
Tomasz Sowa | 97ec3123d9 | |
Tomasz Sowa | aa10a71d13 | |
Tomasz Sowa | 8aae2470c5 |
319
CHANGELOG
319
CHANGELOG
|
@ -1,48 +1,271 @@
|
|||
Version 0.8.0 (2007.04.02):
|
||||
* added: the del key deletes a variable or a function now
|
||||
(if the focus is on the list)
|
||||
* 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)
|
||||
* 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
|
||||
* fixed: when a user started navigating from the keyboard the program showed
|
||||
a wrong variable or a funtion in the edit dialog
|
||||
|
||||
Version 0.7.3 (2007.03.08):
|
||||
* added: the program shows some kind of errors itself
|
||||
* added: checking whether an user has inserted a correct value of a variable
|
||||
or a function
|
||||
* fixed: navigation from the keyboard
|
||||
* changed: the esc key selects the entire input text now (in the input edit)
|
||||
* added: a test when the program is being starded which checks if the
|
||||
coordinates of the main window actually pointing at the valid area (for
|
||||
example when someone took his configuration file into a new computer and
|
||||
the new computer has a smaller screen)
|
||||
|
||||
Version 0.7.2 (2007.02.28):
|
||||
* added buttons Sgn and Mod
|
||||
* the button 'err' is active when there's actually an error now
|
||||
* added buttons: ASin, ACos, ATan, ACTan
|
||||
* fixed: the program didn't save the current language into the configuration file
|
||||
* fixed: the second thread didn't read the main window correctly and it caused
|
||||
small problems when an user was typing into the first edit control
|
||||
|
||||
Version 0.7.1 (2007.02.08):
|
||||
* added a button 'err' (error) on the first tab
|
||||
* the input edit can have 2048 characters now
|
||||
* added remembering the vertical size into the config file
|
||||
* fixed a problem with the 'tab' key
|
||||
* added a message 'Calculating...' when an user clicks on the 'err' button
|
||||
during calculating something
|
||||
Version 0.9.3 (2011.06.04):
|
||||
* added: German translation made by
|
||||
Moritz Beleites <morbel at gmx.net>
|
||||
* added: on display tab: an option how many digits should be grouped
|
||||
* changed: the way how buttons on display tab work
|
||||
suppose we have "123+34+56" in the first edit, then select
|
||||
(by mouse or a keyboard) "123+34" similar as you would like
|
||||
to copy them to the clipboard, then press a button let we say
|
||||
"sin" - the result is: "sin(123+34)+56"
|
||||
* updated: Chinese translation
|
||||
* fixed: ttcalc didn't correctly delete variables/functions from its config file
|
||||
so when you restarted the program you still had the deleted variables/functions
|
||||
* fixed: option: "parameters separated by" was not correctly read from the config file
|
||||
|
||||
|
||||
Version 0.9.2 (2010.09.24):
|
||||
* added: Italian translation made by
|
||||
Damiano Monaco <dmonax at gmail.com>
|
||||
* added: menu: edit->swap (ctrl+W)
|
||||
swapping the input for the output edit
|
||||
|
||||
Changes from TTMath 0.9.2 relating to TTCalc:
|
||||
* fixed: Big::Add() sometimes incorrectly rounded the last bit from its mantissa
|
||||
* fixed: Big::ToString method
|
||||
in some cases when in the output string the exponent should be equal zero
|
||||
the method changes the exponent to one so the last digit from the mantissa
|
||||
was lost
|
||||
|
||||
|
||||
Version 0.9.1 (2010.02.07):
|
||||
* fixed: the pad window didn't take into account following options (from display tab):
|
||||
grouping, input commas and parameter separators
|
||||
* updated: Chinese translation
|
||||
|
||||
Changes from TTMath 0.9.1 relating to TTCalc:
|
||||
* fixed: the parser didn't use characters for changing the base (# and &)
|
||||
those characters were skipped
|
||||
(this bug was introduced in 0.9.0)
|
||||
* fixed: added in the parser: operator's associativity
|
||||
operator ^ (powering) is right-associative:
|
||||
sample: 2^3^4 is equal 2^(3^4) and it is: 2.41e+24
|
||||
previously was: 2^3^4 = (2^3)^4 = 4096
|
||||
* changed: in Big::ToString() the base rounding is made only if the result value
|
||||
would not be an integer, e.g. if the value is 1.999999999999 then
|
||||
the base rounding will not be done - because as the result would be 2
|
||||
* added: IEEE 754 half-to-even rounding (bankers' rounding) to the following
|
||||
floating point algorithms: Big::Add, Big::Sub, Big::Mul, Big::Div
|
||||
|
||||
|
||||
Version 0.9.0 (2009.11.25):
|
||||
* fixed: when 'C' button was pressed, the cursor was not placed in the edit window
|
||||
* added: Pad window - a multiline edit window
|
||||
* added: Checking for update dialog box
|
||||
also the program can check automatically for an update at startup
|
||||
* added: there are some new buttons on the standard tab
|
||||
- (...) - the whole expression is surrounded by brackets (ctrl+0 short cut)
|
||||
- 1/(...)
|
||||
- ;
|
||||
- % - a new percentage operator
|
||||
- floor/ceil/min/max/sqrt/root/gamma
|
||||
* added: some new options on display tab:
|
||||
- grouping
|
||||
- input decimal point
|
||||
- parameters separated by
|
||||
* changed: precision:
|
||||
Medium - 512 bits mantissa, 64 bits exponent
|
||||
Big - 1024 bits mantissa, 128 bits exponent
|
||||
|
||||
Changes from TTMath 0.9.0 relating to TTCalc:
|
||||
* added: operator percentage
|
||||
e.g. 1000-50% = 1000-(1000*0,5) = 500
|
||||
* added: function frac(x) - returns a value without the integer part
|
||||
(only fraction remains)
|
||||
* changed: algorithms in sqrt(x) and root(x ; n)
|
||||
they were not too much accurate for some integers
|
||||
e.g. Root(16;4) returned a value very closed to 2 but not exactly 2
|
||||
* changed: added specializations to Big::ToString() when the base is equal 4, 8 or 16
|
||||
the previous version was not accurate on some last digits (after the comma operator)
|
||||
consider this binary value (32 bit mantissa):
|
||||
base 2: 1.1111 1111 1111 1111 1111 1111 1110 101
|
||||
previous ToString() gave:
|
||||
base 4: 1.33333333333332
|
||||
base 8: 1.777777777
|
||||
base 16: 1.FFFFFF
|
||||
now we have:
|
||||
base 4: 1.3333333333333222
|
||||
base 8: 1.77777777724
|
||||
base 16: 1.FFFFFFEA
|
||||
|
||||
|
||||
Version 0.8.7 prerelease (2009.09.16):
|
||||
* added: new language: Swedish
|
||||
translation made by: Lars 'Bafvert' Gafvert <lars.gafvert at gmail dot com>
|
||||
* changed: version of the TTMath library: 0.9.0 prerelease now
|
||||
|
||||
Changes from TTMath 0.9.0 prerelease relating to TTCalc:
|
||||
* added: gamma() function
|
||||
* changed: factorial() function is very fast now
|
||||
|
||||
|
||||
Version 0.8.6 (2009.06.30):
|
||||
* added: new language: Russian
|
||||
translation made by: Vladimir Gladilovich <vdgladilovich at gmail dot com>
|
||||
|
||||
|
||||
Version 0.8.5 (2009.06.18):
|
||||
* added: new language: Chinese
|
||||
translation made by: Juis <zsyfly at gmail dot com>
|
||||
* changed: version of the TTMath library: 0.8.5 now
|
||||
|
||||
Changes from TTMath 0.8.5 relating to TTCalc:
|
||||
* fixed: Big::Mod(x) didn't correctly return a carry
|
||||
and the result was sometimes very big (even greater than x)
|
||||
* changed: factorial() function is much faster now
|
||||
|
||||
|
||||
Version 0.8.4 (2009.05.08):
|
||||
* added: new language: Danish
|
||||
translation made by: Rune Bisgaard Vammen <runebisgaard at gmail dot com>
|
||||
|
||||
|
||||
Version 0.8.3 (2009.04.06):
|
||||
* fixed: calculating the size of the main window
|
||||
now it looks good on MS Vista and when a user changes size of some
|
||||
widgets such as a border, font size, etc.
|
||||
* changed: variables and functions are case-sensitive now, e.g.
|
||||
'x' is not the same as 'X'
|
||||
* changed: precision:
|
||||
small - the same as previous
|
||||
medium - 288 bits for the mantissa, 64 bits for the exponent
|
||||
big - 864 bits for the mantissa, 128 bits for the exponent
|
||||
previous were:
|
||||
medium - 192 bits for the mantissa, 64 bits for the exponent
|
||||
big - 288 bits for the mantissa, 96 bits for the exponent
|
||||
* changed: new version of TTMath bignum library: 0.8.3
|
||||
* added: when a user presses CTRL+C then the result will be
|
||||
copied into the clipboard (if the current control which
|
||||
has a focus is not an edit control, or if it is an edit
|
||||
but has no selection)
|
||||
* added: when a user presses CTRL+V then the text from the clipboard
|
||||
will be copied into the edit control
|
||||
(the focus can be anywhere but it cannot be on another edit control)
|
||||
* added: 'decimal point' option on the display tab
|
||||
* added: variables and functions can have underline characters
|
||||
in their names
|
||||
* added: 'remove trailing zeroes' option on 'display' tab
|
||||
* added: new language: Spanish
|
||||
translation made by Alejandro S. Valdezate
|
||||
alesanval at gmail dot com
|
||||
* added: on display tab: we can select 'deg' 'rad' or 'grad' for calculating
|
||||
in such functions: sin,cos,tan,cot,asin,acos,atan,acot
|
||||
* added: when the program exits new variables and functions are read from
|
||||
the configuration file and then the file is saved
|
||||
(if you have inserted some variables or functions in a different
|
||||
instance of TTCalc those variables or functions were previously
|
||||
skipped)
|
||||
* removed: 'cut off last non valid digits' on 'rounding' option
|
||||
on 'display' tab
|
||||
|
||||
Changes from TTMath 0.8.3 relating to TTCalc:
|
||||
* fixed: Big::Add incorrectly rounded 'this' when both exponents were equal
|
||||
it caused that sometimes when adding a zero the result has changed
|
||||
this had impact among other things on FromString() method
|
||||
"0,8" had different binary representation from "0,80"
|
||||
* fixed: Big::Pow(const Big<exp, man> & pow)
|
||||
it's using PowInt() only when pow.exponent is in range (-man*TTMATH_BITS_PER_UINT; 0]
|
||||
previously the powering 'hung' on an input like this: "(1+ 1e-10000) ^ 10e100000000"
|
||||
(there was 10e100000000 iterations in PowInt())
|
||||
* fixed: in function DegToRad(const ValueType & x, ErrorCode * err = 0) it is better
|
||||
to make division first and then mutliplication -- the result is more
|
||||
accurate especially when x is: 90,180,270 or 360
|
||||
* fixed: the parser didn't correctly treat operators for changing the base
|
||||
(radix) -- operators '#' and '&', e.g.:
|
||||
'#sin(1)' was equal '0' -- there was a zero from '#' and then
|
||||
it was multiplied by 'sin(1)'
|
||||
the parser didn't check whether Big::FromString() has actually
|
||||
read a proper value -- the method Big::FromString() didn't have
|
||||
something to report such a situation
|
||||
* fixed: Big::FromString() when the base is 10, the method reads the scientific
|
||||
part only if such a part it correctly supplied, e.g:
|
||||
'1234e10', '1234e+10', '1234e-5'
|
||||
previous '1234e' was treated as: '1234e0' (now parsing stops on 'e' and
|
||||
the 'e' can be parsed by other parsers, e.g. the mathematical
|
||||
parser -- now in the parser would be: '1234e' = '1234 * e' = '3354,3597...' )
|
||||
* changed: in the parser: the form with operators '#' and '&' is as follows:
|
||||
[-|+][#|&]numeric_value
|
||||
previous was: [-|+][#|&][-|+]numeric_value
|
||||
* changed: the parser is allowed to recognize values which
|
||||
begin with a dot, e.g '.5' is treated as '0.5'
|
||||
* added: functions to the parser: gradtorad(grad), radtograd(rad), degtograd(deg),
|
||||
degtograd(d,m,s), gradtodeg(grad)
|
||||
* added: a short form of multiplication
|
||||
(without the '*' character) e.g. '5y'
|
||||
(it's used only if the second parameter is a variable
|
||||
or function)
|
||||
|
||||
|
||||
Version 0.8.2 portable (2007.07.01):
|
||||
* added: the portable version of the program TTCalc
|
||||
it uses *.ini config file from the same folder where
|
||||
is the executable file, and it's much smaller in size
|
||||
(in the portable version there's only one kind
|
||||
of precision and the program is packed with UPX -
|
||||
the Ultimate Packer for eXecutables)
|
||||
there are no other differences between version 0.8.1 and this one
|
||||
|
||||
|
||||
Version 0.8.1 (2007.04.17):
|
||||
* changed: on win9x the configuration file is in a folder like:
|
||||
"c:\windows\data application\ttcalc\" now
|
||||
* changed: the program uses the TTMath 0.8.1 now
|
||||
* added: from TTMath 0.8.1:
|
||||
root(x, index), bitand(x,y), bitor(x,y), bitxor(x,y)
|
||||
/band(x,y), bor(x,y), bxor(x,y)/
|
||||
asinh(x), acosh(x), atanh(x), acoth(x) /atgh(x), actgh(x)/
|
||||
* changed: from TTMath 0.8.1: calculations are much faster now
|
||||
especially the factorial() function
|
||||
* changed: from TTMath 0.8.1: the way of parsing operators
|
||||
|
||||
|
||||
Version 0.8.0 (2007.04.02):
|
||||
* added: the del key deletes a variable or a function now
|
||||
(if the focus is on the list)
|
||||
* 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: 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)
|
||||
* 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
|
||||
* fixed: when a user started navigating from the keyboard the program showed
|
||||
a wrong variable or a funtion in the edit dialog
|
||||
|
||||
|
||||
Version 0.7.3 (2007.03.08):
|
||||
* added: the program shows some kind of errors itself
|
||||
* added: checking whether an user has inserted a correct value of a variable
|
||||
or a function
|
||||
* fixed: navigation from the keyboard
|
||||
* changed: the esc key selects the entire input text now (in the input edit)
|
||||
* added: a test when the program is being starded which checks if the
|
||||
coordinates of the main window actually pointing at the valid area (for
|
||||
example when someone took his configuration file into a new computer and
|
||||
the new computer has a smaller screen)
|
||||
|
||||
|
||||
Version 0.7.2 (2007.02.28):
|
||||
* added: buttons Sgn and Mod
|
||||
* changed: the button 'err' is active when there's actually an error now
|
||||
* added: buttons: ASin, ACos, ATan, ACTan
|
||||
* fixed: the program didn't save the current language into the configuration file
|
||||
* fixed: the second thread didn't read the main window correctly and it caused
|
||||
small problems when an user was typing into the first edit control
|
||||
|
||||
|
||||
Version 0.7.1 (2007.02.08):
|
||||
* added: button 'err' (error) on the first tab
|
||||
* changed: the input edit can have 2048 characters now
|
||||
* added: remembering the vertical size into the config file
|
||||
* fixed: a problem with the 'tab' key
|
||||
* added: a message 'Calculating...' when an user clicks on the 'err' button
|
||||
during calculating something
|
||||
|
|
56
COPYRIGHT
56
COPYRIGHT
|
@ -1,28 +1,28 @@
|
|||
Copyright (c) 2006-2007, Tomasz Sowa
|
||||
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.
|
||||
Copyright (c) 2006-2011, Tomasz Sowa
|
||||
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.
|
||||
|
|
37
README
37
README
|
@ -1,19 +1,24 @@
|
|||
TTCalc
|
||||
|
||||
TTCalc is a mathematical calculator. It has a nice user interface,
|
||||
formulas for calculating can be inserted by using a keyboard or a mouse.
|
||||
The result is automatically shown in a second window without using any
|
||||
additional keys such as 'equal'. The program possess trigonometric
|
||||
functions, inverse trigonometric functions, hyperbolic functions,
|
||||
logical operators, logarithms, functions for converting between degrees
|
||||
and radians and so on. Additionally the program allows the user to
|
||||
define his own variables and functions. Calculations are performed by
|
||||
using floating point numbers with three kind of precision, the biggest
|
||||
has 288 bits for its mantissa and 96 bits for its exponent that is
|
||||
about 2.551...e+11925026709067095507636213441 with 85 valid decimal
|
||||
digits. The program independently allows to insert and display values
|
||||
with the base (radix) from two to sixteen.
|
||||
TTCalc is an open source bignum mathematical calculator. It features
|
||||
arithmetical functions, trigonometric functions, inverse trigonometric
|
||||
functions, hyperbolic functions, inverse hyperbolic functions, logical
|
||||
operators, logarithms, functions for converting between degrees and radians
|
||||
and so on. Additionally the program allows a user to define his own
|
||||
variables and functions.
|
||||
|
||||
Author: Tomasz Sowa <t.sowa AnTispam slimaczek.pl>
|
||||
Project page: http://sourceforge.net/projects/ttcalc
|
||||
Licence: BSD (open source)
|
||||
The program possesses an easy to use interface. Calculations are performed
|
||||
by using binary floating point numbers with three kinds of precision,
|
||||
the biggest has 864 bits for its mantissa and 128 bits for its exponent
|
||||
that is about 6.70897699... * 10^51217599719369681875006054625051616609
|
||||
with 258 valid decimal digits. TTCalc independently allows to insert and
|
||||
display values with the base (radix) from two to sixteen.
|
||||
|
||||
Author: Tomasz Sowa
|
||||
Contact: t.sowa@ttmath.org
|
||||
Licence: BSD (open source)
|
||||
Interface: English, Polish, Spanish, Danish, Chinese, Russian,
|
||||
Swedish, Italian, German
|
||||
Project page: http://ttcalc.sourceforge.net/
|
||||
Bignum library: TTMath http://www.ttmath.org/
|
||||
Operating systems: Microsoft Windows 9x/Me/NT/2000/XP/Vista/7
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - accuracy</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="accuracy">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Accuracy</h1>
|
||||
|
||||
<p>
|
||||
TTCalc uses binary floating point numbers. It means that your input values are first
|
||||
converted to a binary representation and then the calculations are performed. After
|
||||
calculating the result is again converted from the binary to the decimal (you can
|
||||
select the input and output format on the display tab). You must remember that not
|
||||
all values can be converted from binary to decimal (and vice versa) without loosing
|
||||
accuracy. For example decimal '5' can be converted to binary '101' and the '101' is
|
||||
exactly equal decimal 5. But decimal '0.3' has not a good binary representation, it
|
||||
is '0.010011001100110011.....'. And when you put decimal '0.3' the calculations are
|
||||
performed on an approximate value and the result is only an approximation too.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For example try to calculate: 0.204 - 0.34*0.80 + 0.068, you would expect that the
|
||||
result was 0 but TTCalc gives you: 3.15544362088404722164691426e-30 which is
|
||||
a good approximation to the real zero (look at e-30 part which means 10^(-30)).
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,175 +1,115 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - arithmetic functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="ln">
|
||||
<param name="Keyword" value="log">
|
||||
<param name="Keyword" value="exp">
|
||||
<param name="Keyword" value="sin">
|
||||
<param name="Keyword" value="cos">
|
||||
<param name="Keyword" value="tan">
|
||||
<param name="Keyword" value="tg">
|
||||
<param name="Keyword" value="cot">
|
||||
<param name="Keyword" value="ctg">
|
||||
<param name="Keyword" value="asin">
|
||||
<param name="Keyword" value="acos">
|
||||
<param name="Keyword" value="atan">
|
||||
<param name="Keyword" value="atg">
|
||||
<param name="Keyword" value="acot">
|
||||
<param name="Keyword" value="actg">
|
||||
<param name="Keyword" value="sinh">
|
||||
<param name="Keyword" value="cosh">
|
||||
<param name="Keyword" value="tanh">
|
||||
<param name="Keyword" value="tgh">
|
||||
<param name="Keyword" value="coth">
|
||||
<param name="Keyword" value="ctgh">
|
||||
<param name="Keyword" value="degtodeg">
|
||||
<param name="Keyword" value="degtorad">
|
||||
<param name="Keyword" value="radtodeg">
|
||||
<param name="Keyword" value="sqrt">
|
||||
<param name="Keyword" value="factorial">
|
||||
<param name="Keyword" value="abs">
|
||||
<param name="Keyword" value="sgn">
|
||||
<param name="Keyword" value="mod">
|
||||
<param name="Keyword" value="int">
|
||||
<param name="Keyword" value="round">
|
||||
<param name="Keyword" value="ceil">
|
||||
<param name="Keyword" value="floar">
|
||||
<param name="Keyword" value="max">
|
||||
<param name="Keyword" value="min">
|
||||
<param name="Keyword" value="builtin functions">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Arithmetic functions</h1>
|
||||
|
||||
<p><strong>Note:</strong> If a function takes more than one argument, the arguments are separated with semicolon ';'.</p>
|
||||
|
||||
<dl>
|
||||
<dt>ln(x)</dt>
|
||||
<dd>This function calculates the natural logarithm of x,<br>e.g. ln(123)=4.812...</dd>
|
||||
|
||||
<dt>log(x; base)</dt>
|
||||
<dd>This function calculates the logarithm of x with a base equal 'base'<br>e.g. log(123; 4)=3.471...</dd>
|
||||
|
||||
<dt>exp(x)</dt>
|
||||
<dd>This function calculates the exponent of x<br>e.g. exp(20)=e^20=485165195.409...</dd>
|
||||
|
||||
<dt>sin(x)</dt>
|
||||
<dd>This function returns the sine of x.<br>For example sin(0.8)=0.717...<br>The argument x is in radians, if you want to calculate
|
||||
with degrees use the degtorad(x) function first e.g. sin(degtorad(30))=0.5 calculates the sine of 30 degrees.</dd>
|
||||
|
||||
<dt>cos(x)</dt>
|
||||
<dd>Cosine of x<br>e.g. cos(1.3)=0.267...<br>The argument x is in radians.</dd>
|
||||
|
||||
<dt>tan(x) or tg(x)</dt>
|
||||
<dd>Tangent of x<br>e.g. tan(3.6)=0.493...<br>The argument x is in radians.</dd>
|
||||
|
||||
<dt>cot(x) or ctg(x)</dt>
|
||||
<dd>Cotangent of x<br>e.g. cot(2.3)=-0.893...<br>The argument x is in radians.</dd>
|
||||
|
||||
<dt>asin(x)</dt>
|
||||
<dd>Arc sine of x<br>e.g. asin(0.7)=0.775...<br>The result is in radians. If you want the result to be in degrees use
|
||||
radtodeg function e.g. radtodeg(asin(0,5))=30</dd>
|
||||
|
||||
<dt>acos(x)</dt>
|
||||
<dd>Arc cosine of x<br>e.g. acos(0.9)=0.451...<br>The result is in radians.</dd>
|
||||
|
||||
<dt>atan(x) or atg(x)</dt>
|
||||
<dd>Arc tangent of x<br>e.g. atan(3.3)=1.276...<br>The result is in radians.</dd>
|
||||
|
||||
<dt>acot(x) or actg(x)</dt>
|
||||
<dd>Arc cotangent of x<br>e.g. acot(10)=0.099...<br>The result is in radians.</dd>
|
||||
|
||||
<dt>sinh(x)</dt>
|
||||
<dd>This function returns hyperbolic sine of x<br>e.g.sinh(12)=81377.395...</dd>
|
||||
|
||||
<dt>cosh(x)</dt>
|
||||
<dd>Hyperbolic cosine of x<br>e.g. cosh(8.5)=2457.384...</dd>
|
||||
|
||||
<dt>tanh(x) or tgh(x)</dt>
|
||||
<dd>Hyperbolic tangent of x<br>e.g. tanh(0.67)=0.584...</dd>
|
||||
|
||||
<dt>coth(x) or ctgh(x)</dt>
|
||||
<dd>Hyperbolic cotangent of x<br>e.g. coth(1.67)=1.073...</dd>
|
||||
|
||||
<dt>DegToDeg(deg; min; sec)</dt>
|
||||
<dd>This function converts degrees from the long format with degres, minutes and seconds into only degrees.<br>
|
||||
For example degtodeg(12; 30; 0)=12.5</dd>
|
||||
|
||||
<dt>DegToRad(deg)</dt>
|
||||
<dd>This function converts degrees into radians<br>e.g. degtorad(12.5)=0.218166...</dd>
|
||||
|
||||
<dt>DegToRad(deg; min; sec)</dt>
|
||||
<dd>This function converts degrees in the long format (degrees, minutes, seconds) to radians.<br>For example
|
||||
degtorad(12; 30; 0)=0.218166...</dd>
|
||||
|
||||
<dt>RadToDeg(rad)</dt>
|
||||
<dd>This function converts radians into degrees<br>e.g. radtodeg(pi)=180</dd>
|
||||
|
||||
<dt>sqrt(x)</dt>
|
||||
<dd>Sqrt returns the square root of x<br>e.g. sqrt(9)=3<br>
|
||||
If you want to calculate another kind of roots for example the cube root use the powering instead e.g.
|
||||
the cube root of 8 is 8^(1/3)=2</dd>
|
||||
|
||||
<dt>factorial(x)</dt>
|
||||
<dd>The factorial function<br>e.g. factorial(6)=1*2*3*4*5*6=720</dd>
|
||||
|
||||
<dt>abs(x)</dt>
|
||||
<dd>The absolute value of x<br>e.g. abs(-10)=10</dd>
|
||||
|
||||
<dt>sgn(x)</dt>
|
||||
<dd>This function returns the sign of x that means when the x is positive the result is 1, when the x is negative
|
||||
the result is -1 and when the x is zero the result is zero too, e.g.<br>
|
||||
sgn(-10)=-1<br>
|
||||
sgn(0)=0<br>
|
||||
sgn(5)=1</dd>
|
||||
|
||||
<dt>mod(x,y)</dt>
|
||||
<dd>Mod returns the remainder from the division x by y<br>e.g. mod(10; 2.2)=1.2 because 10=2.2*4 + 1.2</dd>
|
||||
|
||||
<dt>int(x)</dt>
|
||||
<dd>This method returns only the integer part of x.<br>e.g. int(2.7)=2</dd>
|
||||
|
||||
<dt>round(x)</dt>
|
||||
<dd>This method rounds the value of x to the nearest integer e.g.<br>
|
||||
round(2.8)=3<br>
|
||||
round(2.2)=2<br>
|
||||
round(2)=2<br>
|
||||
round(-4.8)=-5<br>
|
||||
round(-4.1)=-4</dd>
|
||||
|
||||
<dt>ceil(x)</dt>
|
||||
<dd>This function returns a value representing the smallest integer that is greater than or equal to x, e.g.<br>
|
||||
ceil(2.8)=3<br>
|
||||
ceil(2.2)=3<br>
|
||||
ceil(2)=2<br>
|
||||
ceil(-4.8)=-4<br>
|
||||
ceil(-4.1)=-4</dd>
|
||||
|
||||
<dt>floor(x)</dt>
|
||||
<dd>This function returns a value representing the largest integer that is less than or equal to x, e.g.<br>
|
||||
floor(2.8)=2<br>
|
||||
floor(2.2)=2<br>
|
||||
floor(2)=2<br>
|
||||
floor(-4.8)=-5<br>
|
||||
floor(-4.1)=-5</dd>
|
||||
|
||||
<dt>max(x1; x2; ...)</dt>
|
||||
<dd>This functions takes any number of arguments. It returns the max value of them. If there aren't arguments
|
||||
the function returns the max value which can be held in this precision.</dd>
|
||||
|
||||
<dt>min(x1; x2; ...)</dt>
|
||||
<dd>This functions takes any number of arguments. It returns the min value of them. If there aren't arguments
|
||||
the function returns the min value which can be held in this precision.</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - arithmetic functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="builtin functions">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Arithmetic functions</h1>
|
||||
|
||||
<p><strong>Note:</strong> If a function takes more than one argument, the arguments are separated with semicolon ';'.</p>
|
||||
|
||||
<h2>Logarithm and Exponential</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="logarithm_exponential.html">ln(x)</a></li>
|
||||
<li><a href="logarithm_exponential.html">log(x; base)</a></li>
|
||||
<li><a href="logarithm_exponential.html">exp(x)</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Trigonometric functions</h2>
|
||||
|
||||
<p><strong>Note:</strong> On the display tab you can select between degrees, radians and gradians. This affects the input value.</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="trigonometric_functions.html">sin(x)</a></li>
|
||||
<li><a href="trigonometric_functions.html">cos(x)</a></li>
|
||||
<li><a href="trigonometric_functions.html">tan(x) or tg(x)</a></li>
|
||||
<li><a href="trigonometric_functions.html">cot(x) or ctg(x)</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Inverse trigonometric functions</h2>
|
||||
|
||||
<p><strong>Note:</strong> On the display tab you can select between degrees, radians and gradians. This affects the output (result) value.</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="inverse_trigonometric_functions.html">asin(x)</a></li>
|
||||
<li><a href="inverse_trigonometric_functions.html">acos(x)</a></li>
|
||||
<li><a href="inverse_trigonometric_functions.html">atan(x) or atg(x)</a></li>
|
||||
<li><a href="inverse_trigonometric_functions.html">acot(x) or actg(x)</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Hyperbolic functions</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="hyperbolic_functions.html">sinh(x)</a></li>
|
||||
<li><a href="hyperbolic_functions.html">cosh(x)</a></li>
|
||||
<li><a href="hyperbolic_functions.html">tanh(x) or tgh(x)</a></li>
|
||||
<li><a href="hyperbolic_functions.html">coth(x) or ctgh(x)</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Inverse hyperbolic functions</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="inverse_hyperbolic_functions.html">asinh(x)</a></li>
|
||||
<li><a href="inverse_hyperbolic_functions.html">acosh(x)</a></li>
|
||||
<li><a href="inverse_hyperbolic_functions.html">atanh(x) or atgh(x)</a></li>
|
||||
<li><a href="inverse_hyperbolic_functions.html">acoth(x) or actgh(x)</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Conversions between radians, degrees and gradians</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="conversions_deg_rad_grad.html">degtodeg(deg; min; sec)</a></li>
|
||||
<li><a href="conversions_deg_rad_grad.html">degtorad(deg; min; sec)</a></li>
|
||||
<li><a href="conversions_deg_rad_grad.html">degtograd(deg; min; sec)</a></li>
|
||||
<li><a href="conversions_deg_rad_grad.html">degtorad(deg)</a></li>
|
||||
<li><a href="conversions_deg_rad_grad.html">degtograd(deg)</a></li>
|
||||
<li><a href="conversions_deg_rad_grad.html">radtodeg(rad)</a></li>
|
||||
<li><a href="conversions_deg_rad_grad.html">radtograd(rad)</a></li>
|
||||
<li><a href="conversions_deg_rad_grad.html">gradtorad(grad)</a></li>
|
||||
<li><a href="conversions_deg_rad_grad.html">gradtodeg(grad)</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Rounding functions</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="rounding_functions.html">int(x)</a></li>
|
||||
<li><a href="rounding_functions.html">round(x)</a></li>
|
||||
<li><a href="rounding_functions.html">ceil(x)</a></li>
|
||||
<li><a href="rounding_functions.html">floor(x)</a></li>
|
||||
<li><a href="rounding_functions.html">frac(x)</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Other functions</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="other_functions.html">sqrt(x)</a></li>
|
||||
<li><a href="other_functions.html">root(x ; n)</a></li>
|
||||
<li><a href="other_functions.html">factorial(n)</a></li>
|
||||
<li><a href="other_functions.html">gamma(x)</a></li>
|
||||
<li><a href="other_functions.html">abs(x)</a></li>
|
||||
<li><a href="other_functions.html">sgn(x)</a></li>
|
||||
<li><a href="other_functions.html">mod(x; y)</a></li>
|
||||
<li><a href="other_functions.html">max(x1; x2; ...)</a></li>
|
||||
<li><a href="other_functions.html">min(x1; x2; ...)</a></li>
|
||||
<li><a href="other_functions.html">sum(x1; x2; ...)</a></li>
|
||||
<li><a href="other_functions.html">avg(x1; x2; ...)</a></li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - bitwise functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="bitand">
|
||||
<param name="Keyword" value="bitor">
|
||||
<param name="Keyword" value="bitxor">
|
||||
<param name="Keyword" value="band">
|
||||
<param name="Keyword" value="bor">
|
||||
<param name="Keyword" value="bxor">
|
||||
<param name="Keyword" value="bitwise functions">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Bitwise functions</h1>
|
||||
|
||||
<p>
|
||||
There are bitwise functions in the program but they can operate only on non-negative values.
|
||||
We don't define the BitNot() function too.
|
||||
</p>
|
||||
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>bitand(x ; y) or band(x ; y)</dt>
|
||||
<dd>Bitwise AND. For example:<br>
|
||||
bitand(6; 2) = bitand(&110 ; &10) = &10 = 2<br>
|
||||
bitand(6.5; 2.5) = bitand(&110.1 ; &10.1) = &10.1 = 2.5</dd>
|
||||
|
||||
<dt>bitor(x ; y) or bor(x ; y)</dt>
|
||||
<dd>Bitwise OR. For example:<br>
|
||||
bitor(6; 1) = bitor(&110 ; &1) = &111 = 7<br>
|
||||
bitor(6.5; 1.5) = bitor(&110.1 ; &1.1) = &111.1 = 7.5</dd>
|
||||
|
||||
<dt>bitxor(x ; y) or bxor(x ; y)</dt>
|
||||
<dd>Bitwise XOR. For example:<br>
|
||||
bitxor(6; 3) = bitxor(&110 ; &11) = &101 = 5<br>
|
||||
bitxor(6.5; 3.5) = bitxor(&110.1 ; &11.1) = &101.0 = 5</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,64 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - Conversions between radians, degrees and gradians</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="degtodeg">
|
||||
<param name="Keyword" value="degtorad">
|
||||
<param name="Keyword" value="degtograd">
|
||||
<param name="Keyword" value="radtodeg">
|
||||
<param name="Keyword" value="radtograd">
|
||||
<param name="Keyword" value="gradtorad">
|
||||
<param name="Keyword" value="gradtodeg">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Arithmetic functions</h1>
|
||||
|
||||
<p><strong>Note:</strong> If a function takes more than one argument, the arguments are separated with semicolon ';'.</p>
|
||||
|
||||
|
||||
<h2>Conversions between radians, degrees and gradians</h2>
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>degtodeg(deg; min; sec)</dt>
|
||||
<dd>This function converts degrees from the long format with degrees, minutes and seconds to degrees.<br>
|
||||
For example: degtodeg(12; 30; 0)=12.5</dd>
|
||||
|
||||
<dt>degtorad(deg; min; sec)</dt>
|
||||
<dd>This function converts degrees in the long format (degrees, minutes, seconds) to radians.<br>
|
||||
degtorad(12; 30; 0)=0.218166...</dd>
|
||||
|
||||
<dt>degtograd(deg; min; sec)</dt>
|
||||
<dd>This function converts degrees in the long format (degrees, minutes, seconds) to gradians<br>degtograd(12; 30; 0)=13.888...</dd>
|
||||
|
||||
<dt>degtorad(deg)</dt>
|
||||
<dd>This function converts degrees to radians<br>degtorad(12.5)=0.218166...</dd>
|
||||
|
||||
<dt>degtograd(deg)</dt>
|
||||
<dd>This function converts degrees to gradians<br>degtograd(12.5)=13.8888...</dd>
|
||||
|
||||
|
||||
<dt>radtodeg(rad)</dt>
|
||||
<dd>This function converts radians to degrees<br>radtodeg(pi)=180</dd>
|
||||
|
||||
<dt>radtograd(rad)</dt>
|
||||
<dd>This function converts radians to gradians<br>radtograd(pi)=200</dd>
|
||||
|
||||
<dt>gradtorad(grad)</dt>
|
||||
<dd>This function converts gradians to radians<br>gradtorad(400)=6.2831....=2*pi</dd>
|
||||
|
||||
<dt>gradtodeg(grad)</dt>
|
||||
<dd>This function converts gradians to degrees<br>gradtodeg(100)=90</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,23 +1,33 @@
|
|||
[OPTIONS]
|
||||
Auto Index=Yes
|
||||
Compatibility=1.1 or later
|
||||
Compiled file=..\..\output\ttcalc.chm
|
||||
Contents file=toc.hhc
|
||||
Default topic=index.html
|
||||
Display compile progress=No
|
||||
Index file=index.hhk
|
||||
Language=0x809 Angielski (Wielka Brytania)
|
||||
Title=TTCalc
|
||||
|
||||
|
||||
[FILES]
|
||||
values_and_std_operators.html
|
||||
arithmetic_functions.html
|
||||
logical_functions.html
|
||||
operators_priority.html
|
||||
userfunctions.html
|
||||
index.html
|
||||
tips.html
|
||||
|
||||
[INFOTYPES]
|
||||
|
||||
[OPTIONS]
|
||||
Auto Index=Yes
|
||||
Compatibility=1.1 or later
|
||||
Compiled file=ttcalc.chm
|
||||
Contents file=toc.hhc
|
||||
Default topic=index.html
|
||||
Display compile progress=No
|
||||
Index file=index.hhk
|
||||
Language=0x809 Angielski (Wielka Brytania)
|
||||
Title=TTCalc
|
||||
|
||||
|
||||
[FILES]
|
||||
values_and_std_operators.html
|
||||
arithmetic_functions.html
|
||||
bitwise_functions.html
|
||||
conversions_deg_rad_grad.html
|
||||
hyperbolic_functions.html
|
||||
index.html
|
||||
inverse_hyperbolic_functions.html
|
||||
inverse_trigonometric_functions.html
|
||||
logarithm_exponential.html
|
||||
logical_functions.html
|
||||
operators_priority.html
|
||||
other_functions.html
|
||||
rounding_functions.html
|
||||
tips.html
|
||||
trigonometric_functions.html
|
||||
userfunctions.html
|
||||
accuracy.html
|
||||
|
||||
[INFOTYPES]
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - Hyperbolic functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="sinh">
|
||||
<param name="Keyword" value="cosh">
|
||||
<param name="Keyword" value="tanh">
|
||||
<param name="Keyword" value="tgh">
|
||||
<param name="Keyword" value="coth">
|
||||
<param name="Keyword" value="ctgh">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Arithmetic functions</h1>
|
||||
|
||||
<p><strong>Note:</strong> If a function takes more than one argument, the arguments are separated with semicolon ';'.</p>
|
||||
|
||||
|
||||
<h2>Hyperbolic functions</h2>
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>sinh(x)</dt>
|
||||
<dd>This function returns hyperbolic sine of x<br>sinh(12)=81377.395...</dd>
|
||||
|
||||
<dt>cosh(x)</dt>
|
||||
<dd>Hyperbolic cosine of x<br>cosh(8.5)=2457.384...</dd>
|
||||
|
||||
<dt>tanh(x) or tgh(x)</dt>
|
||||
<dd>Hyperbolic tangent of x<br>tanh(0.67)=0.584...</dd>
|
||||
|
||||
<dt>coth(x) or ctgh(x)</dt>
|
||||
<dd>Hyperbolic cotangent of x<br>coth(1.67)=1.073...</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,9 +1,9 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">
|
||||
<!-- Sitemap 1.0 -->
|
||||
</HEAD><BODY>
|
||||
<UL>
|
||||
</UL>
|
||||
</BODY></HTML>
|
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">
|
||||
<!-- Sitemap 1.0 -->
|
||||
</HEAD><BODY>
|
||||
<UL>
|
||||
</UL>
|
||||
</BODY></HTML>
|
||||
|
|
101
help/index.html
101
help/index.html
|
@ -1,47 +1,54 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="TTCalc">
|
||||
<param name="Keyword" value="author">
|
||||
<param name="Keyword" value="contact">
|
||||
<param name="Keyword" value="licence">
|
||||
<param name="Keyword" value="operating systems">
|
||||
<param name="Keyword" value="project page">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>TTCalc</h1>
|
||||
|
||||
<p>
|
||||
TTCalc is a mathematical calculator. It has a nice user interface, formulas for
|
||||
calculating can be inserted by using a keyboard or a mouse. The result is automatically
|
||||
shown in a second window without using any additional keys such as 'equal'. The
|
||||
program possess trigonometric functions, inverse trigonometric functions, hyperbolic
|
||||
functions, logical operators, logarithms, functions for converting between degrees and
|
||||
radians and so on. Additionally the program allows the user to define his own
|
||||
variables and functions. Calculations are performed by using floating point numbers
|
||||
with three kind of precision, the biggest has 288 bits for its mantissa and 96 bits
|
||||
for its exponent that is about 2.551...e+11925026709067095507636213441 with 85 valid
|
||||
decimal digits. The program independently allows to insert and display values with
|
||||
the base (radix) from two to sixteen.
|
||||
</p>
|
||||
|
||||
<table>
|
||||
<tr><td>Author:</td><td>Tomasz Sowa</td></tr>
|
||||
<tr><td>Contact:</td><td>t.sowa@slimaczek.pl</td></tr>
|
||||
<tr><td>Licence:</td><td>BSD (open source)</td></tr>
|
||||
<tr><td>Operating systems:</td><td>Microsoft Windows 9x/Me/NT/2000/XP (Vista was not tested)</td></tr>
|
||||
<tr><td>Interface:</td><td>English, Polish</td></tr>
|
||||
<tr><td>Project page:</td><td><a href="http://sourceforge.net/projects/ttcalc">http://sourceforge.net/projects/ttcalc</a></td></tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="TTCalc">
|
||||
<param name="Keyword" value="TTMath">
|
||||
<param name="Keyword" value="author">
|
||||
<param name="Keyword" value="contact">
|
||||
<param name="Keyword" value="licence">
|
||||
<param name="Keyword" value="interface language">
|
||||
<param name="Keyword" value="operating systems">
|
||||
<param name="Keyword" value="project page">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>TTCalc</h1>
|
||||
|
||||
<p>
|
||||
TTCalc is an open source bignum mathematical calculator. It features
|
||||
arithmetical functions, trigonometric functions, inverse trigonometric
|
||||
functions, hyperbolic functions, inverse hyperbolic functions, logical
|
||||
operators, logarithms, functions for converting between degrees and radians
|
||||
and so on. Additionally the program allows a user to define his own
|
||||
variables and functions.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The program possesses an easy to use interface. Calculations are performed
|
||||
by using binary floating point numbers with three kinds of precision,
|
||||
the biggest has 1024 bits for its mantissa and 128 bits for its exponent
|
||||
that is about 9.80518... * 10^51217599719369681875006054625051616657
|
||||
with 306 valid decimal digits. TTCalc independently allows to insert and
|
||||
display values with the base (radix) from two to sixteen.
|
||||
</p>
|
||||
|
||||
|
||||
<table>
|
||||
<tr><td>Author:</td><td>Tomasz Sowa</td></tr>
|
||||
<tr><td>Contact:</td><td>t.sowa@ttmath.org</td></tr>
|
||||
<tr><td>Licence:</td><td>BSD (open source)</td></tr>
|
||||
<tr><td>Interface:</td><td>English, Polish, Spanish, Danish, Chinese, Russian, Swedish, Italian, German</td></tr>
|
||||
<tr><td>Project page:</td><td><a href="http://ttcalc.sourceforge.net/">http://ttcalc.sourceforge.net/</a></td></tr>
|
||||
<tr><td>Bignum library:</td><td>TTMath <a href="http://ttmath.org/">http://www.ttmath.org/</a></td></tr>
|
||||
<tr><td>Operating systems:</td><td>Microsoft Windows 9x/Me/NT/2000/XP/Vista/7</td></tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - Inverse hyperbolic functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="asinh">
|
||||
<param name="Keyword" value="acosh">
|
||||
<param name="Keyword" value="atanh">
|
||||
<param name="Keyword" value="atgh">
|
||||
<param name="Keyword" value="acoth">
|
||||
<param name="Keyword" value="actgh">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Arithmetic functions</h1>
|
||||
|
||||
<p><strong>Note:</strong> If a function takes more than one argument, the arguments are separated with semicolon ';'.</p>
|
||||
|
||||
|
||||
|
||||
<h2>Inverse hyperbolic functions</h2>
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>asinh(x)</dt>
|
||||
<dd>This function returns inverse hyperbolic sine of x<br>asinh(3.6)=1.992...</dd>
|
||||
|
||||
<dt>acosh(x)</dt>
|
||||
<dd>This function returns inverse hyperbolic cosine of x<br>acosh(2.23)=1.440...</dd>
|
||||
|
||||
<dt>atanh(x) or atgh(x)</dt>
|
||||
<dd>This function returns inverse hyperbolic tangent of x<br>atanh(0.67)=0.810...</dd>
|
||||
|
||||
<dt>acoth(x) or actgh(x)</dt>
|
||||
<dd>This function returns inverse hyperbolic cotangent of x<br>acoth(1.23)=1.135...</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - Inverse trigonometric functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="asin">
|
||||
<param name="Keyword" value="acos">
|
||||
<param name="Keyword" value="atan">
|
||||
<param name="Keyword" value="atg">
|
||||
<param name="Keyword" value="acot">
|
||||
<param name="Keyword" value="actg">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Arithmetic functions</h1>
|
||||
|
||||
<p><strong>Note:</strong> If a function takes more than one argument, the arguments are separated with semicolon ';'.</p>
|
||||
|
||||
|
||||
<h2>Inverse trigonometric functions</h2>
|
||||
|
||||
<p><strong>Note:</strong> On the display tab you can select between degrees, radians and gradians. In these samples we assume that the 'rad' option is selected.
|
||||
This affects the output (result) value.</p>
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>asin(x)</dt>
|
||||
<dd>Inverse sine (arc sine) of x<br>e.g. asin(0.7)=0.775...</dd>
|
||||
|
||||
<dt>acos(x)</dt>
|
||||
<dd>Inverse cosine (arc cosine) of x<br>acos(0.9)=0.451...</dd>
|
||||
|
||||
<dt>atan(x) or atg(x)</dt>
|
||||
<dd>Inverse tangent (arc tangent) of x<br>atan(3.3)=1.276...</dd>
|
||||
|
||||
<dt>acot(x) or actg(x)</dt>
|
||||
<dd>Inverse cotangent (arc cotangent) of x<br>acot(10)=0.099...</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - Logarithm and Exponential</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="ln">
|
||||
<param name="Keyword" value="log">
|
||||
<param name="Keyword" value="exp">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Arithmetic functions</h1>
|
||||
|
||||
<p><strong>Note:</strong> If a function takes more than one argument, the arguments are separated with semicolon ';'.</p>
|
||||
|
||||
<h2>Logarithm and Exponential</h2>
|
||||
|
||||
<dl>
|
||||
<dt>ln(x)</dt>
|
||||
<dd>This function calculates the natural logarithm of x,<br>e.g. ln(123)=4.812...</dd>
|
||||
|
||||
<dt>log(x; base)</dt>
|
||||
<dd>This function calculates the logarithm of x with a base equal 'base'<br>
|
||||
It's using the formula: log(x; base) = ln(x) / ln(base)<br>
|
||||
log(123; 4)=3.471...</dd>
|
||||
|
||||
<dt>exp(x)</dt>
|
||||
<dd>This function calculates the exponential function of x<br>exp(20)=e^20=485165195.409...</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,103 +1,103 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - comparative and logical operators and functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="<">
|
||||
<param name="Keyword" value=">">
|
||||
<param name="Keyword" value="<=">
|
||||
<param name="Keyword" value=">=">
|
||||
<param name="Keyword" value="==">
|
||||
<param name="Keyword" value="!=">
|
||||
<param name="Keyword" value="&&">
|
||||
<param name="Keyword" value="||">
|
||||
<param name="Keyword" value="if">
|
||||
<param name="Keyword" value="and">
|
||||
<param name="Keyword" value="or">
|
||||
<param name="Keyword" value="not">
|
||||
<param name="Keyword" value="logical operators">
|
||||
<param name="Keyword" value="comparative operators">
|
||||
<param name="Keyword" value="logical functions">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Comparative and logical operators and functions</h1>
|
||||
|
||||
<p>
|
||||
We assume that the logical false is represented by zero and the logical true is represented by the
|
||||
value different from zero. <strong>Note:</strong> If a function takes more than one argument, the arguments are separated with semicolon ';'.
|
||||
</p>
|
||||
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>x < y</dt>
|
||||
<dd>This operator returns one if x is lower than y else it returns zero. For example:<br>
|
||||
4 < 10 = 1<br>
|
||||
6 < 2 = 0</dd>
|
||||
|
||||
<dt>x > y</dt>
|
||||
<dd>This operator returns one if x is greater than y else it returns zero. For example:<br>
|
||||
5 > 2 = 1<br>
|
||||
5 > 8 = 0</dd>
|
||||
|
||||
<dt>x <= y</dt>
|
||||
<dd>This operator returns one if x is lower than or equal to y else it returns zero. For example:<br>
|
||||
4 <= 4 = 1<br>
|
||||
7 <= 2 = 0</dd>
|
||||
|
||||
<dt>x >= y</dt>
|
||||
<dd>This operator returns one if x is greater than or equal to y else it returns zero. For example:<br>
|
||||
5 >= 5 = 1<br>
|
||||
3 >= 4 = 0</dd>
|
||||
|
||||
<dt>x == y</dt>
|
||||
<dd>This operator returns one if x is equal y else it returns zero. For example:<br>
|
||||
4 == 4 = 1<br>
|
||||
6 == 2 = 0</dd>
|
||||
|
||||
<dt>x != y</dt>
|
||||
<dd>This operator returns one if x is different from y else it returns zero. For example:<br>
|
||||
5 != 2 = 1<br>
|
||||
5 != 5 = 0</dd>
|
||||
|
||||
<dt>x && y (logical and)</dt>
|
||||
<dd>This operator returns one if both x and y are different from zero else it returns zero. For example:<br>
|
||||
4 && 10 = 1<br>
|
||||
6 && 0 = 0<br>
|
||||
0 && 0 = 0</dd>
|
||||
|
||||
<dt>x || y (logical or)</dt>
|
||||
<dd>This operator returns one either if x or y are different from zero else it returns zero. For example:<br>
|
||||
5 || 2 = 1<br>
|
||||
0 || 3 = 1<br>
|
||||
0 || 0 = 0</dd>
|
||||
|
||||
<dt>if(condition; if_true; if_false)</dt>
|
||||
<dd>If the 'condition' is true (different from zero) the function returns 'if_true' else it returns 'if_false', e.g.<br>
|
||||
if( 0 ; 20 ; 30) = 30<br>
|
||||
if( 1 ; 20 ; 30) = 20<br>
|
||||
if( 4<5 ; 10 ; 50) = 10<br>
|
||||
if( 6>10 ; 200 ; 100) = 100</dd>
|
||||
|
||||
<dt>and(x ; y)</dt>
|
||||
<dd>This function does the same thing as the logical operator 'and' (&&)</dd>
|
||||
|
||||
<dt>or(x ; y)</dt>
|
||||
<dd>This function does the same thing as the logical operator 'or' (||)</dd>
|
||||
|
||||
<dt>not(x)</dt>
|
||||
<dd>If the x is true (different from zero) this function returns zero, otherwise it returns one, e.g.<br>
|
||||
not(15)=0<br>
|
||||
not(0)=1</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - comparative and logical operators and functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="<">
|
||||
<param name="Keyword" value=">">
|
||||
<param name="Keyword" value="<=">
|
||||
<param name="Keyword" value=">=">
|
||||
<param name="Keyword" value="==">
|
||||
<param name="Keyword" value="!=">
|
||||
<param name="Keyword" value="&&">
|
||||
<param name="Keyword" value="||">
|
||||
<param name="Keyword" value="if">
|
||||
<param name="Keyword" value="and">
|
||||
<param name="Keyword" value="or">
|
||||
<param name="Keyword" value="not">
|
||||
<param name="Keyword" value="logical operators">
|
||||
<param name="Keyword" value="comparative operators">
|
||||
<param name="Keyword" value="logical functions">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Comparative and logical operators and functions</h1>
|
||||
|
||||
<p>
|
||||
We assume that the logical false is represented by zero and the logical true is represented by the
|
||||
value different from zero. <strong>Note:</strong> If a function takes more than one argument, the arguments are separated with semicolon ';'.
|
||||
</p>
|
||||
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>x < y</dt>
|
||||
<dd>This operator returns one if x is lower than y else it returns zero. For example:<br>
|
||||
4 < 10 = 1<br>
|
||||
6 < 2 = 0</dd>
|
||||
|
||||
<dt>x > y</dt>
|
||||
<dd>This operator returns one if x is greater than y else it returns zero. For example:<br>
|
||||
5 > 2 = 1<br>
|
||||
5 > 8 = 0</dd>
|
||||
|
||||
<dt>x <= y</dt>
|
||||
<dd>This operator returns one if x is lower than or equal to y else it returns zero. For example:<br>
|
||||
4 <= 4 = 1<br>
|
||||
7 <= 2 = 0</dd>
|
||||
|
||||
<dt>x >= y</dt>
|
||||
<dd>This operator returns one if x is greater than or equal to y else it returns zero. For example:<br>
|
||||
5 >= 5 = 1<br>
|
||||
3 >= 4 = 0</dd>
|
||||
|
||||
<dt>x == y</dt>
|
||||
<dd>This operator returns one if x is equal y else it returns zero. For example:<br>
|
||||
4 == 4 = 1<br>
|
||||
6 == 2 = 0</dd>
|
||||
|
||||
<dt>x != y</dt>
|
||||
<dd>This operator returns one if x is different from y else it returns zero. For example:<br>
|
||||
5 != 2 = 1<br>
|
||||
5 != 5 = 0</dd>
|
||||
|
||||
<dt>x && y (logical and)</dt>
|
||||
<dd>This operator returns one if both x and y are different from zero else it returns zero. For example:<br>
|
||||
4 && 10 = 1<br>
|
||||
6 && 0 = 0<br>
|
||||
0 && 0 = 0</dd>
|
||||
|
||||
<dt>x || y (logical or)</dt>
|
||||
<dd>This operator returns one either if x or y are different from zero else it returns zero. For example:<br>
|
||||
5 || 2 = 1<br>
|
||||
0 || 3 = 1<br>
|
||||
0 || 0 = 0</dd>
|
||||
|
||||
<dt>if(condition; if_true; if_false)</dt>
|
||||
<dd>If the 'condition' is true (different from zero) the function returns 'if_true' else it returns 'if_false', e.g.<br>
|
||||
if( 0 ; 20 ; 30) = 30<br>
|
||||
if( 1 ; 20 ; 30) = 20<br>
|
||||
if( 4<5 ; 10 ; 50) = 10<br>
|
||||
if( 6>10 ; 200 ; 100) = 100</dd>
|
||||
|
||||
<dt>and(x ; y)</dt>
|
||||
<dd>This function does the same thing as the logical operator 'and' (&&)</dd>
|
||||
|
||||
<dt>or(x ; y)</dt>
|
||||
<dd>This function does the same thing as the logical operator 'or' (||)</dd>
|
||||
|
||||
<dt>not(x)</dt>
|
||||
<dd>If the x is true (different from zero) this function returns zero, otherwise it returns one, e.g.<br>
|
||||
not(15)=0<br>
|
||||
not(0)=1</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,34 +1,36 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - operators priority</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="operators priority">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Operators Priority</h1>
|
||||
|
||||
<p>Below is a list of operators priority. At the top are operators with higher precedence.</p>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr><td>Operator</td><td>Description</td><td>Sample</td></tr>
|
||||
</thead>
|
||||
<tr><td>( )</td><td>parentheses for grouping an expression</td><td>(1+3)*4</td></tr>
|
||||
<tr><td>- + # &</td><td>unary minus and plus, and operators for changing the base (radix)</td><td>-10</td></tr>
|
||||
<tr><td>^</td><td>powering</td><td>3^2</td></tr>
|
||||
<tr><td>* /</td><td>multiplication and division</td><td>10*20</td></tr>
|
||||
<tr><td>+ -</td><td>addition and subtraction</td><td>10-30</td></tr>
|
||||
<tr><td>== != < > <= >=</td><td>comparative operators</td><td>4<5</td></tr>
|
||||
<tr><td>&&</td><td>logical and</td><td>3>2 && 3<10</td></tr>
|
||||
<tr><td>||</td><td>logical or</td><td>3>2 || 3<10</td></tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - operators priority</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="operators priority">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Operators Priority</h1>
|
||||
|
||||
<p>Below is a list of operators priority. At the top are operators with higher precedence.</p>
|
||||
|
||||
<table class="operatorspriority">
|
||||
<thead>
|
||||
<tr><td>Operator</td><td>Description</td><td>Sample</td></tr>
|
||||
</thead>
|
||||
<tr><td>( )</td><td>parentheses for grouping an expression</td><td>(1+3)*4</td></tr>
|
||||
<tr><td>- + # &</td><td>unary minus and plus, and operators for changing the base (radix)</td><td>-10<br>&1111 (bin)<br>#ff (hex)</td></tr>
|
||||
<tr><td>%</td><td>percentage from a previous value</td><td>100-30%</td></tr>
|
||||
<tr><td>^</td><td>powering</td><td>3^2</td></tr>
|
||||
<tr><td>* /</td><td>multiplication and division</td><td>10*20</td></tr>
|
||||
<tr><td>without an operator</td><td>short form of multiplication<br>(only if the second argument is a variable or function,<br>the same priority as a normal multiplication)</td><td>3y</td></tr>
|
||||
<tr><td>+ -</td><td>addition and subtraction</td><td>10-30</td></tr>
|
||||
<tr><td>== != < > <= >=</td><td>comparative operators</td><td>4<5</td></tr>
|
||||
<tr><td>&&</td><td>logical and</td><td>3>2 && 3<10</td></tr>
|
||||
<tr><td>||</td><td>logical or</td><td>3>2 || 3<10</td></tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - Other functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="sqrt">
|
||||
<param name="Keyword" value="root">
|
||||
<param name="Keyword" value="factorial">
|
||||
<param name="Keyword" value="gamma">
|
||||
<param name="Keyword" value="abs">
|
||||
<param name="Keyword" value="sgn">
|
||||
<param name="Keyword" value="mod">
|
||||
<param name="Keyword" value="max">
|
||||
<param name="Keyword" value="min">
|
||||
<param name="Keyword" value="sum">
|
||||
<param name="Keyword" value="avg">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Arithmetic functions</h1>
|
||||
|
||||
<p><strong>Note:</strong> If a function takes more than one argument, the arguments are separated with semicolon ';'.</p>
|
||||
|
||||
|
||||
<h2>Other functions</h2>
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>sqrt(x)</dt>
|
||||
<dd>Sqrt returns the square root of x<br>sqrt(9)=3</dd>
|
||||
|
||||
<dt>root(x ; n)</dt>
|
||||
<dd>The nth root of a 'x', 'n' must be integer and not negative, if 'n' is zero the result is one,
|
||||
if 'x' is zero the result is zero and we assume that the root(0;0) is not defined, e.g.<br>
|
||||
root(8;3)=2<br>
|
||||
root(-8;3)=-2
|
||||
</dd>
|
||||
|
||||
<dt>factorial(n)</dt>
|
||||
<dd>The factorial function<br>factorial(6)=1*2*3*4*5*6=720</dd>
|
||||
|
||||
<dt>gamma(x)</dt>
|
||||
<dd>The gamma function<br>gamma(45.89)=7,861174...e+55</dd>
|
||||
|
||||
<dt>abs(x)</dt>
|
||||
<dd>The absolute value of x<br>abs(-10)=10</dd>
|
||||
|
||||
<dt>sgn(x)</dt>
|
||||
<dd>This function returns the sign of x that means when the x is positive the result is 1, when the x is negative
|
||||
the result is -1 and when the x is zero the result is zero too<br>
|
||||
sgn(-10)=-1<br>
|
||||
sgn(0)=0<br>
|
||||
sgn(5)=1</dd>
|
||||
|
||||
<dt>mod(x ; y)</dt>
|
||||
<dd>Mod returns the remainder from the division x by y<br>mod(10; 2.2)=1.2 because 10=2.2*4 + 1.2</dd>
|
||||
|
||||
|
||||
<dt>max(x1; x2; ...)</dt>
|
||||
<dd>This functions takes any number of arguments. It returns the max value of them. If there are not any arguments
|
||||
the function returns the max value which can be held in this precision.<br>
|
||||
max(2;5;8;3)=8<br>
|
||||
max()=6.97846825730330952352039893e+646457021 (assuming the small precision is selected)</dd>
|
||||
|
||||
<dt>min(x1; x2; ...)</dt>
|
||||
<dd>This functions takes any number of arguments. It returns the min value of them. If there are not any arguments
|
||||
the function returns the min value which can be held in this precision.<br>
|
||||
min(45;-23;18;19)=-23<br>
|
||||
min()=-6.97846825730330952352039893e+646457021 (assuming the small precision is selected)
|
||||
</dd>
|
||||
|
||||
<dt>sum(x1; x2; ...)</dt>
|
||||
<dd>This functions takes one or more arguments. It returns the sum of them.<br>
|
||||
sum(4;2;9;3)=18
|
||||
</dd>
|
||||
|
||||
<dt>avg(x1; x2; ...)</dt>
|
||||
<dd>This functions takes one or more arguments. It returns the arithmetic mean. (The sum divided by
|
||||
the number of arguments)<br>
|
||||
avg(4;2;9;3)=4.5
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,73 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - Rounding functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="int">
|
||||
<param name="Keyword" value="round">
|
||||
<param name="Keyword" value="ceil">
|
||||
<param name="Keyword" value="floor">
|
||||
<param name="Keyword" value="frac">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Arithmetic functions</h1>
|
||||
|
||||
<p><strong>Note:</strong> If a function takes more than one argument, the arguments are separated with semicolon ';'.</p>
|
||||
|
||||
|
||||
<h2>Rounding functions</h2>
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>int(x)</dt>
|
||||
<dd>This method returns only the integer part of x.<br>
|
||||
int(2.8)=2<br>
|
||||
int(2.2)=2<br>
|
||||
int(2)=2<br>
|
||||
int(-4.1)=-4<br>
|
||||
int(-4.8)=-4<br>
|
||||
</dd>
|
||||
|
||||
<dt>round(x)</dt>
|
||||
<dd>This method rounds the value of x to the nearest integer<br>
|
||||
round(2.8)=3<br>
|
||||
round(2.2)=2<br>
|
||||
round(2)=2<br>
|
||||
round(-4.1)=-4<br>
|
||||
round(-4.8)=-5</dd>
|
||||
|
||||
<dt>ceil(x)</dt>
|
||||
<dd>This function returns a value representing the smallest integer that is greater than or equal to x<br>
|
||||
ceil(2.8)=3<br>
|
||||
ceil(2.2)=3<br>
|
||||
ceil(2)=2<br>
|
||||
ceil(-4.1)=-4<br>
|
||||
ceil(-4.8)=-4</dd>
|
||||
|
||||
<dt>floor(x)</dt>
|
||||
<dd>This function returns a value representing the largest integer that is less than or equal to x<br>
|
||||
floor(2.8)=2<br>
|
||||
floor(2.2)=2<br>
|
||||
floor(2)=2<br>
|
||||
floor(-4.1)=-5<br>
|
||||
floor(-4.8)=-5</dd>
|
||||
|
||||
<dt>frac(x)</dt>
|
||||
<dd>This function returns a value without the integer part - only fraction remains<br>
|
||||
frac(45.789)=0.789<br>
|
||||
frac(-2.267)=-0.267<br>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
126
help/styles.css
126
help/styles.css
|
@ -1,48 +1,78 @@
|
|||
html * {
|
||||
margin: 0;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
html, body {
|
||||
font-size: 14px;
|
||||
font-family: Tahoma, Arial, Sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0 0 20px 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
font-family: Arial, Tahoma, Sans-serif;
|
||||
margin: 1.4em 0 1em 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 1em 0 1em 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-size: 1.4em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
|
||||
dd {
|
||||
padding: 0.3em 0 0 2em;
|
||||
}
|
||||
|
||||
thead {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 0 2em 0 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
html * {
|
||||
margin: 0;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
html, body {
|
||||
font-size: 14px;
|
||||
font-family: Verdana, Tahoma, Arial, Sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0 20px 20px 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
font-family: Arial, Tahoma, Verdana, Sans-serif;
|
||||
margin: 1.4em 0 1em 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.5em;
|
||||
font-family: Arial, Tahoma, Verdana, Sans-serif;
|
||||
margin: 2em 0 1em 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 1em 0 1em 0;
|
||||
}
|
||||
|
||||
dl {
|
||||
margin: 3em 0 3em 0;
|
||||
}
|
||||
|
||||
dt {
|
||||
font-size: 1.4em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
|
||||
dd {
|
||||
padding: 0.3em 0 0 2em;
|
||||
}
|
||||
|
||||
thead {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 0 2em 0 0;
|
||||
}
|
||||
|
||||
table.operatorspriority {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
|
||||
table.operatorspriority td {
|
||||
border: 1px solid black;
|
||||
padding: 0.5em 0.5em 0.5em 0.5em;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
|
||||
ul.tips {
|
||||
list-style-type: disc;
|
||||
margin-left: 3em;
|
||||
}
|
||||
|
||||
ul.tips li {
|
||||
padding: 1em 0 1em 0;
|
||||
}
|
||||
|
|
|
@ -1,40 +1,43 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - tips</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="tips">
|
||||
<param name="Keyword" value="esc">
|
||||
<param name="Keyword" value="#">
|
||||
<param name="Keyword" value="&">
|
||||
<param name="Keyword" value="global semicolon">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Tips</h1>
|
||||
|
||||
<p>
|
||||
If you want to clear the input edit or if you want to put something in and the focus is
|
||||
somewhere on the tabs just type ESC, the entire edit will be selected and have a focus.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you want to insert a value with a base (radix) 2 or 16 use the unary operator & (for the base 2)
|
||||
or # (for the base 16).
|
||||
For example &10=2 (decimal), #10=16 (decimal). When you're using these operators
|
||||
then 'input' mode on the 'display' tab is ignored.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You can calculate more than one formula at the same time. To achive this use a semicolon
|
||||
in the global space, for example type '2+4 ; 5*10' and the result will be '6 50'.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - tips</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="tips">
|
||||
<param name="Keyword" value="esc">
|
||||
<param name="Keyword" value="#">
|
||||
<param name="Keyword" value="&">
|
||||
<param name="Keyword" value="global semicolon">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Tips</h1>
|
||||
|
||||
<ul class="tips">
|
||||
<li>
|
||||
If you want to clear the input edit or if you want to put something in and the focus is not on the first edit — just type ESC,
|
||||
the entire edit will be selected and have a focus.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
If you want to insert a value with a base (radix) 2 or 16 use the unary operator & (for the base 2)
|
||||
or # (for the base 16).
|
||||
For example &10=2 (decimal), #10=16 (decimal). When you're using these operators
|
||||
then 'input' mode on the 'display' tab is ignored.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
You can calculate more than one formula at the same time. To achive this use a semicolon
|
||||
in the global space, for example type '2+4 ; 5*10' and the result will be '6 ; 50'.
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
126
help/toc.hhc
126
help/toc.hhc
|
@ -1,42 +1,84 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">
|
||||
<!-- Sitemap 1.0 -->
|
||||
</HEAD><BODY>
|
||||
<OBJECT type="text/site properties">
|
||||
<param name="ImageType" value="Folder">
|
||||
</OBJECT>
|
||||
<UL>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="TTCalc">
|
||||
<param name="Local" value="index.html">
|
||||
</OBJECT>
|
||||
<UL>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Numbers, standard operators and built-in variables">
|
||||
<param name="Local" value="values_and_std_operators.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Arithmetic functions">
|
||||
<param name="Local" value="arithmetic_functions.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Logical operators and functions">
|
||||
<param name="Local" value="logical_functions.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="User defined variables and functions">
|
||||
<param name="Local" value="userfunctions.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Operators priority">
|
||||
<param name="Local" value="operators_priority.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Tips">
|
||||
<param name="Local" value="tips.html">
|
||||
</OBJECT>
|
||||
</UL>
|
||||
</UL>
|
||||
</BODY></HTML>
|
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">
|
||||
<!-- Sitemap 1.0 -->
|
||||
</HEAD><BODY>
|
||||
<OBJECT type="text/site properties">
|
||||
<param name="ImageType" value="Folder">
|
||||
</OBJECT>
|
||||
<UL>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="TTCalc">
|
||||
<param name="Local" value="index.html">
|
||||
</OBJECT>
|
||||
<UL>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Numbers, standard operators and built-in variables">
|
||||
<param name="Local" value="values_and_std_operators.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Arithmetic functions">
|
||||
<param name="Local" value="arithmetic_functions.html">
|
||||
</OBJECT>
|
||||
<UL>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Logarithm and Exponential">
|
||||
<param name="Local" value="logarithm_exponential.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Trigonometric functions">
|
||||
<param name="Local" value="trigonometric_functions.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Inverse trigonometric functions">
|
||||
<param name="Local" value="inverse_trigonometric_functions.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Hyperbolic functions">
|
||||
<param name="Local" value="hyperbolic_functions.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Inverse hyperbolic functions">
|
||||
<param name="Local" value="inverse_hyperbolic_functions.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Conversions between radians, degrees and gradians">
|
||||
<param name="Local" value="conversions_deg_rad_grad.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Rounding functions">
|
||||
<param name="Local" value="rounding_functions.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Other functions">
|
||||
<param name="Local" value="other_functions.html">
|
||||
</OBJECT>
|
||||
</UL>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Logical operators and functions">
|
||||
<param name="Local" value="logical_functions.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Bitwise functions">
|
||||
<param name="Local" value="bitwise_functions.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="User defined variables and functions">
|
||||
<param name="Local" value="userfunctions.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Operators priority">
|
||||
<param name="Local" value="operators_priority.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Accuracy">
|
||||
<param name="Local" value="accuracy.html">
|
||||
</OBJECT>
|
||||
<LI> <OBJECT type="text/sitemap">
|
||||
<param name="Name" value="Tips">
|
||||
<param name="Local" value="tips.html">
|
||||
</OBJECT>
|
||||
</UL>
|
||||
</UL>
|
||||
</BODY></HTML>
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - Trigonometric functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="sin">
|
||||
<param name="Keyword" value="cos">
|
||||
<param name="Keyword" value="tan">
|
||||
<param name="Keyword" value="tg">
|
||||
<param name="Keyword" value="cot">
|
||||
<param name="Keyword" value="ctg">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Arithmetic functions</h1>
|
||||
|
||||
<p><strong>Note:</strong> If a function takes more than one argument, the arguments are separated with semicolon ';'.</p>
|
||||
|
||||
|
||||
<h2>Trigonometric functions</h2>
|
||||
|
||||
<p><strong>Note:</strong> On the display tab you can select between degrees, radians and gradians. In these samples we assume that the 'rad' option is selected.
|
||||
This affects the input value.</p>
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>sin(x)</dt>
|
||||
<dd>This function returns the sine of x.<br>For example sin(0.8)=0.717...</dd>
|
||||
|
||||
<dt>cos(x)</dt>
|
||||
<dd>Cosine of x<br>cos(1.3)=0.267...</dd>
|
||||
|
||||
<dt>tan(x) or tg(x)</dt>
|
||||
<dd>Tangent of x<br>tan(3.6)=0.493...</dd>
|
||||
|
||||
<dt>cot(x) or ctg(x)</dt>
|
||||
<dd>Cotangent of x<br>cot(2.3)=-0.893...</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,36 +1,41 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - user defined variables and functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="user defined variables">
|
||||
<param name="Keyword" value="user defined functions">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>User defined variables and functions</h1>
|
||||
|
||||
<p>
|
||||
You are allowed to define your own variables and functions. As a name of a variable or a function
|
||||
can be a name consists of letters and digits but the first character must be a letter. Names are case-insensitive
|
||||
that means 'name' is the same as 'NaMe'. For example these
|
||||
are correct names: a, b, c3, myname, etc. During defining variables and functions you can call another
|
||||
variables and functions but you cannot call a variable or a function twice. Recurrence calling are not allowed.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Functions can get maximum 9 parameters. You have to specify how many parameters your function takes and
|
||||
you can refer to them by using the variable 'x' with a number from 1 to 9 ('x' without a number means 'x1').
|
||||
For example you can define a function 'xy' as 'x1*x2' (of course without apostrophes), set the 'parameters' on 2
|
||||
and then put into the edit box an expression 'xy(10;20)', the result will be 200. Note that we use a semicolon
|
||||
to separate arguments in a function.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - user defined variables and functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="user defined variables">
|
||||
<param name="Keyword" value="user defined functions">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>User defined variables and functions</h1>
|
||||
|
||||
<p>
|
||||
You are allowed to define your own variables and functions. As a name of a variable or function
|
||||
can be a name consists of letters, digits or an underline character (only the first character must be a letter).
|
||||
From version 0.8.3 names are case-sensitive that means 'name' is not the same as 'NaMe'. For example these
|
||||
are correct names: a, b, c3, MyName. During defining variables and functions you can call another
|
||||
variables and functions.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Functions can get maximum 9 parameters. You have to specify how many parameters your function takes and
|
||||
you can refer to them by using the variable 'x' with a number from 1 to 9 ('x' without a number means 'x1').
|
||||
For example you can define a function 'xy' as 'x1*x2' (of course without apostrophes), set the 'parameters' to '2'
|
||||
and then put into the edit box expression 'xy(10;20)', the result will be '200'. Note that we use a semicolon
|
||||
to separate arguments in the function.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
More complex example: myfunction(x) which returns sin(x) when the x is negative, 0 when the x is 0, and cos(x) when the x is greater than 0: <br>
|
||||
myfunction(x)='if(x==0; 0; if(x<0; sin(x); cos(x)))'
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,65 +1,71 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - numbers, standard operators and built-in variables</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="numbers">
|
||||
<param name="Keyword" value="comma">
|
||||
<param name="Keyword" value="dot">
|
||||
<param name="Keyword" value="standard operators">
|
||||
<param name="Keyword" value="builtin variables">
|
||||
<param name="Keyword" value="e">
|
||||
<param name="Keyword" value="^">
|
||||
<param name="Keyword" value="*">
|
||||
<param name="Keyword" value="/">
|
||||
<param name="Keyword" value="+">
|
||||
<param name="Keyword" value="-">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Numbers</h1>
|
||||
|
||||
You can type numbers directly using a keyboard or insert them by a mouse. This is a simple edit window,
|
||||
you can use arrow keys etc. and copy&paste a text by using standard shortcuts such as CTRL+C and CTRL+V.
|
||||
As the decimal point can be either a comma or a dot that means 1,234 is the same as 1.234.
|
||||
|
||||
<h1>Standard operators</h1>
|
||||
|
||||
<dl>
|
||||
<dt>^</dt>
|
||||
<dd>Powering</dd>
|
||||
|
||||
<dt>*</dt>
|
||||
<dd>Multiplication</dd>
|
||||
|
||||
<dt>/</dt>
|
||||
<dd>Division</dd>
|
||||
|
||||
<dt>+</dt>
|
||||
<dd>Addition</dd>
|
||||
|
||||
<dt>-</dt>
|
||||
<dd>Subtraction</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
<p>Of course you can use the parentheses ( and ). Look at the <a href="operators_priority.html">operators priority</a> as well.</p>
|
||||
|
||||
<h1>Built-in variables</h1>
|
||||
|
||||
<p>You can use following variables, just type its name into the edit window.</p>
|
||||
<dl>
|
||||
<dt>e</dt>
|
||||
<dd>The base of the natural logarithm.<br>e = 2.718...</dd>
|
||||
|
||||
<dt>pi</dt>
|
||||
<dd>The ratio of a circle's circumference to its diameter.<br>pi=3.141...</dd>
|
||||
</dl>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - standard operators and built-in variables</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="standard operators">
|
||||
<param name="Keyword" value="builtin variables">
|
||||
<param name="Keyword" value="e">
|
||||
<param name="Keyword" value="pi">
|
||||
<param name="Keyword" value="%">
|
||||
<param name="Keyword" value="^">
|
||||
<param name="Keyword" value="*">
|
||||
<param name="Keyword" value="/">
|
||||
<param name="Keyword" value="+">
|
||||
<param name="Keyword" value="-">
|
||||
<param name="Keyword" value="#">
|
||||
<param name="Keyword" value="&">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Standard operators</h1>
|
||||
|
||||
<dl>
|
||||
<dt>%</dt>
|
||||
<dd>Percentage from a previous value: 1000-30% = 700</dd>
|
||||
|
||||
<dt>^</dt>
|
||||
<dd>Powering: 2^3 = 8</dd>
|
||||
|
||||
<dt>*</dt>
|
||||
<dd>Multiplication: 2*3 = 6</dd>
|
||||
|
||||
<dt>/</dt>
|
||||
<dd>Division: 2/3 = 0.6666...</dd>
|
||||
|
||||
<dt>+</dt>
|
||||
<dd>Addition: 2+3 = 5<br>
|
||||
Unary plus: +2</dd>
|
||||
|
||||
<dt>-</dt>
|
||||
<dd>Subtraction: 2-3 = -1<br>
|
||||
Unary minus: -2</dd>
|
||||
|
||||
<dt>#</dt>
|
||||
<dd>Operator for changing the base (radix) to 16 (hex): #ff = 255</dd>
|
||||
|
||||
<dt>&</dt>
|
||||
<dd>Operator for changing the base (radix) to 2 (bin): -&110 = -6</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
<p>Of course you can use parentheses ( and ). Look at <a href="operators_priority.html">operators priority</a> as well.</p>
|
||||
|
||||
<h1>Built-in variables</h1>
|
||||
|
||||
<p>You can use following variables, just type its name into the edit window.</p>
|
||||
<dl>
|
||||
<dt>e</dt>
|
||||
<dd>The base of the natural logarithm.<br>e = 2.718...</dd>
|
||||
|
||||
<dt>pi</dt>
|
||||
<dd>The ratio of a circle's circumference to its diameter.<br>pi=3.141...</dd>
|
||||
</dl>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,268 @@
|
|||
#!/bin/sh
|
||||
|
||||
a=""
|
||||
b=""
|
||||
c=""
|
||||
p=""
|
||||
d=""
|
||||
|
||||
# reading until not empty
|
||||
|
||||
while [ -z $a ]
|
||||
do
|
||||
echo -n "Major: " ; read a
|
||||
done
|
||||
|
||||
|
||||
while [ -z $b ]
|
||||
do
|
||||
echo -n "Minor: " ; read b;
|
||||
done
|
||||
|
||||
|
||||
while [ -z $c ]
|
||||
do
|
||||
echo -n "Revision: " ; read c;
|
||||
done
|
||||
|
||||
|
||||
while [ -z $p ]
|
||||
do
|
||||
echo -n "Prerelease? (y/n): " ; read p;
|
||||
done
|
||||
|
||||
|
||||
while [ -z $d ]
|
||||
do
|
||||
echo -n "Add date? (y/n): " ; read d;
|
||||
done
|
||||
|
||||
|
||||
dir=$a.$b.$c
|
||||
datestr=""
|
||||
|
||||
|
||||
if [ $p = "y" -o $p = "Y" ]
|
||||
then
|
||||
dir=$dir.prerelease
|
||||
fi
|
||||
|
||||
|
||||
if [ $d = "y" -o $d = "Y" ]
|
||||
then
|
||||
datestr="("`/bin/date "+%G.%m.%d"`")";
|
||||
dir=$dir.$datestr
|
||||
fi
|
||||
|
||||
|
||||
if [ -d $dir ]
|
||||
then
|
||||
echo "Directory $dir exists! (exiting)";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
mkdir $dir
|
||||
|
||||
|
||||
echo "------------------------------------------------------"
|
||||
echo "compiling normal version"
|
||||
echo "------------------------------------------------------"
|
||||
|
||||
cd src
|
||||
make clean
|
||||
make
|
||||
|
||||
echo "------------------------------------------------------"
|
||||
echo "creating help"
|
||||
echo "------------------------------------------------------"
|
||||
|
||||
make help
|
||||
|
||||
|
||||
echo "------------------------------------------------------"
|
||||
echo "creating install program (setup)"
|
||||
echo "------------------------------------------------------"
|
||||
|
||||
make setup
|
||||
|
||||
|
||||
cd ../$dir
|
||||
|
||||
|
||||
|
||||
echo "------------------------------------------------------"
|
||||
echo "making binary package"
|
||||
echo "------------------------------------------------------"
|
||||
|
||||
n="ttcalc-$a.$b.$c";
|
||||
|
||||
if [ $p = "y" -o $p = "Y" ]
|
||||
then
|
||||
n="$n.prerelease"
|
||||
fi
|
||||
|
||||
if [ $d = "y" -o $d = "Y" ]
|
||||
then
|
||||
ntar="$n-bin.$datestr.zip";
|
||||
else
|
||||
ntar="$n-bin.zip";
|
||||
fi
|
||||
|
||||
mkdir $n
|
||||
cp ../help/ttcalc.chm $n
|
||||
cp ../src/ttcalc.exe $n
|
||||
cp ../COPYRIGHT $n
|
||||
cp ../README $n
|
||||
cp ../CHANGELOG $n
|
||||
#tar -zcf $ntar $n
|
||||
zip -r -9 $ntar $n
|
||||
rm -r $n
|
||||
|
||||
|
||||
|
||||
echo "------------------------------------------------------"
|
||||
echo "copying the setup program"
|
||||
echo "------------------------------------------------------"
|
||||
|
||||
n="ttcalc-$a.$b.$c"
|
||||
|
||||
if [ $p = "y" -o $p = "Y" ]
|
||||
then
|
||||
n="$n.prerelease"
|
||||
fi
|
||||
|
||||
if [ $d = "y" -o $d = "Y" ]
|
||||
then
|
||||
cp ../setup/ttcalc-setup.exe ./$n-setup.$datestr.exe
|
||||
else
|
||||
cp ../setup/ttcalc-setup.exe ./$n-setup.exe
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
echo "------------------------------------------------------"
|
||||
echo "compiling portable version"
|
||||
echo "------------------------------------------------------"
|
||||
|
||||
# preserve ttcalc.chm because would be erased by 'make clean'
|
||||
cp ../help/ttcalc.chm ./
|
||||
|
||||
cd ../src/
|
||||
make clean
|
||||
make -f Makefileportable
|
||||
|
||||
|
||||
cd ../$dir
|
||||
|
||||
|
||||
|
||||
echo "------------------------------------------------------"
|
||||
echo "making portable binary package"
|
||||
echo "------------------------------------------------------"
|
||||
|
||||
n="ttcalc-portable-$a.$b.$c";
|
||||
|
||||
if [ $p = "y" -o $p = "Y" ]
|
||||
then
|
||||
n="$n.prerelease"
|
||||
fi
|
||||
|
||||
if [ $d = "y" -o $d = "Y" ]
|
||||
then
|
||||
ntar="$n-bin.$datestr.zip";
|
||||
else
|
||||
ntar="$n-bin.zip";
|
||||
fi
|
||||
|
||||
mkdir $n
|
||||
cp ../src/ttcalcp.exe $n
|
||||
$n/ttcalcp.exe createconfig
|
||||
mv ttcalc.ini $n
|
||||
mv ttcalc.chm $n
|
||||
cp ../COPYRIGHT $n
|
||||
cp ../README $n
|
||||
cp ../CHANGELOG $n
|
||||
#tar -zcf $ntar $n
|
||||
zip -r -9 $ntar $n
|
||||
rm -r $n
|
||||
|
||||
|
||||
|
||||
echo "------------------------------------------------------"
|
||||
echo "creating source package"
|
||||
echo "------------------------------------------------------"
|
||||
|
||||
|
||||
n="ttcalc-$a.$b.$c";
|
||||
|
||||
|
||||
if [ $p = "y" -o $p = "Y" ]
|
||||
then
|
||||
n="$n.prerelease"
|
||||
fi
|
||||
|
||||
|
||||
if [ $d = "y" -o $d = "Y" ]
|
||||
then
|
||||
ntar="$n-src.$datestr.zip";
|
||||
else
|
||||
ntar="$n-src.zip";
|
||||
fi
|
||||
|
||||
|
||||
mkdir $n
|
||||
mkdir $n/ttmath
|
||||
mkdir $n/ttcalc
|
||||
|
||||
mkdir $n/ttmath/ttmath
|
||||
mkdir $n/ttmath/samples
|
||||
|
||||
mkdir $n/ttcalc/help
|
||||
mkdir $n/ttcalc/res
|
||||
mkdir $n/ttcalc/setup
|
||||
mkdir $n/ttcalc/src
|
||||
|
||||
cp ../../ttmath/ttmath/* $n/ttmath/ttmath
|
||||
cp ../../ttmath/samples/* $n/ttmath/samples
|
||||
cp ../../ttmath/COPYRIGHT $n/ttmath
|
||||
cp ../../ttmath/README $n/ttmath
|
||||
cp ../../ttmath/CHANGELOG $n/ttmath
|
||||
|
||||
cd ../src
|
||||
make clean
|
||||
cd ../$dir
|
||||
|
||||
cp ../help/* $n/ttcalc/help
|
||||
cp ../res/* $n/ttcalc/res
|
||||
cp ../setup/* $n/ttcalc/setup
|
||||
cp ../src/* $n/ttcalc/src
|
||||
cp ../COPYRIGHT $n/ttcalc
|
||||
cp ../README $n/ttcalc
|
||||
cp ../CHANGELOG $n/ttcalc
|
||||
|
||||
#tar -zcf $ntar $n
|
||||
zip -r -9 $ntar $n
|
||||
rm -r $n
|
||||
|
||||
|
||||
echo "------------------------------------------------------"
|
||||
echo "calculating md5 hashes"
|
||||
echo "------------------------------------------------------"
|
||||
|
||||
md5sum * > note.txt.md5
|
||||
echo "MD5 SUMS" > note.txt
|
||||
echo "--------" >> note.txt
|
||||
cat note.txt.md5 >> note.txt
|
||||
|
||||
echo "" >> note.txt
|
||||
echo "" >> note.txt
|
||||
echo "CHANGELOG" >> note.txt
|
||||
echo "---------" >> note.txt
|
||||
cat ../CHANGELOG >> note.txt
|
||||
|
||||
rm note.txt.md5
|
||||
unix2dos note.txt
|
||||
|
||||
echo "done"
|
||||
exit 0
|
Binary file not shown.
Before Width: | Height: | Size: 143 KiB |
Binary file not shown.
After Width: | Height: | Size: 227 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2006-2007, Tomasz Sowa
|
||||
Copyright (c) 2006-2011, Tomasz Sowa
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,45 +1,65 @@
|
|||
; Script generated by the Inno Setup Script Wizard.
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
[Setup]
|
||||
AppName=TTCalc
|
||||
AppVerName=TTCalc 0.8.0
|
||||
AppPublisher=Tomasz Sowa
|
||||
AppPublisherURL=http://sourceforge.net/projects/ttcalc
|
||||
AppSupportURL=http://sourceforge.net/projects/ttcalc
|
||||
AppUpdatesURL=http://sourceforge.net/projects/ttcalc
|
||||
DefaultDirName={pf}\TTCalc
|
||||
DefaultGroupName=TTCalc
|
||||
AllowNoIcons=yes
|
||||
LicenseFile=COPYRIGHT
|
||||
OutputDir=..\..\output_setup
|
||||
OutputBaseFilename=ttcalc-setup
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
|
||||
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
Source: "..\..\output\ttcalc.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\..\output\mingwm10.dll"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\..\output\ttcalc.chm"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\COPYRIGHT"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "ttcalc.ini"; DestDir: "{userappdata}\TTCalc"; Flags: onlyifdoesntexist
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\TTCalc"; Filename: "{app}\ttcalc.exe"; WorkingDir: "{app}"
|
||||
Name: "{group}\Help"; Filename: "{app}\ttcalc.chm"; WorkingDir: "{app}"
|
||||
Name: "{group}\{cm:UninstallProgram,TTCalc}"; Filename: "{uninstallexe}"
|
||||
Name: "{commondesktop}\TTCalc"; Filename: "{app}\ttcalc.exe"; WorkingDir: "{app}"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\ttcalc.exe"; Description: "{cm:LaunchProgram,TTCalc}"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
; innosetup script
|
||||
|
||||
[Setup]
|
||||
AppName=TTCalc
|
||||
AppVerName=TTCalc 0.9.3
|
||||
AppVersion=0.9.3
|
||||
AppPublisher=Tomasz Sowa
|
||||
AppPublisherURL=http://ttcalc.sourceforge.net
|
||||
AppSupportURL=http://ttcalc.sourceforge.net
|
||||
AppUpdatesURL=http://ttcalc.sourceforge.net
|
||||
DefaultDirName={pf}\TTCalc
|
||||
DefaultGroupName=TTCalc
|
||||
AllowNoIcons=yes
|
||||
; special COPYRIGHT version (without new line characters in the clause -- it is better displayed in the setup window)
|
||||
LicenseFile=COPYRIGHT
|
||||
OutputDir=..\setup
|
||||
OutputBaseFilename=ttcalc-setup
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
ShowUndisplayableLanguages=yes
|
||||
PrivilegesRequired=admin
|
||||
UsePreviousAppDir=yes
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
|
||||
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
|
||||
Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
|
||||
Name: "chinese"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
|
||||
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
|
||||
Name: "swedish"; MessagesFile: "compiler:Languages\Swedish.isl"
|
||||
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
|
||||
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
|
||||
|
||||
[InstallDelete]
|
||||
; prior to 0.8.3 we were using mingwm10.dll (now it is not needed and will be deleted if exists)
|
||||
Type: files; Name: "{app}\mingwm10.dll"
|
||||
|
||||
[Tasks]
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
Source: "..\src\ttcalc.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\help\ttcalc.chm"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\COPYRIGHT"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\CHANGELOG"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "..\README"; DestDir: "{app}"; Flags: ignoreversion
|
||||
; now we do not use *.ini file in the installer
|
||||
|
||||
[Dirs]
|
||||
Name: "{userappdata}/TTCalc" ; Flags: uninsneveruninstall
|
||||
|
||||
[INI]
|
||||
Filename: "{userappdata}/TTCalc/ttcalc.ini"; Section: "GLOBAL"; Key: "language.setup"; String: "{language}"
|
||||
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\TTCalc"; Filename: "{app}\ttcalc.exe"; WorkingDir: "{app}"
|
||||
Name: "{group}\Help"; Filename: "{app}\ttcalc.chm"; WorkingDir: "{app}"
|
||||
Name: "{group}\{cm:UninstallProgram,TTCalc}"; Filename: "{uninstallexe}"
|
||||
Name: "{commondesktop}\TTCalc"; Filename: "{app}\ttcalc.exe"; WorkingDir: "{app}"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\ttcalc.exe"; Description: "{cm:LaunchProgram,TTCalc}"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
# the configuration file of the program ttcalc
|
||||
|
||||
[GLOBAL]
|
||||
always.on.top = 0
|
||||
view = 0
|
||||
maximized = 0
|
||||
x = 0
|
||||
y = 0
|
||||
size.x = 402
|
||||
size.y = 288
|
||||
precision = 0
|
||||
disp.input = 10
|
||||
disp.output = 10
|
||||
language = 0
|
||||
disp.alw.scientific = 0
|
||||
disp.when.scientific = 15
|
||||
disp.rounding = -2
|
||||
|
||||
[variables]
|
||||
|
||||
[functions]
|
70
src/Makefile
70
src/Makefile
|
@ -1,40 +1,66 @@
|
|||
include Makefile.o.dep
|
||||
include Makefile.help.dep
|
||||
|
||||
CC = g++
|
||||
o = resource.o calculation.o functions.o iniparser.o languages.o mainwindow.o parsermanager.o programresources.o tabs.o variables.o winmain.o
|
||||
CFLAGS = -Wall -pedantic -s -O2 -mwindows -mthreads -I../../../ttmath
|
||||
#CFLAGS = -Wall -pedantic -s -O2 -mwindows -I../../ttmath -DTTCALC_CONVERT
|
||||
CFLAGS = -Wall -pedantic -s -O2 -mwindows -I../../ttmath -DTTMATH_DONT_USE_WCHAR
|
||||
name = ttcalc.exe
|
||||
dir_output = ../../output
|
||||
|
||||
# the name of the help is also set in the html help workshop project file
|
||||
helpname = ttcalc.chm
|
||||
|
||||
# the name of the setup is also set in the Inno Setup config file
|
||||
setupname = ttcalc-setup.exe
|
||||
|
||||
.SUFFIXES: .cpp .o
|
||||
|
||||
.cpp.o:
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
|
||||
all: ttcalc
|
||||
|
||||
|
||||
ttcalc: $(o)
|
||||
$(CC) -o $(dir_output)/$(name) $(CFLAGS) $(o) -lcomctl32
|
||||
%.o: %.cpp
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
|
||||
ttcalc: $(name)
|
||||
|
||||
|
||||
$(name): $(o)
|
||||
$(CC) -o $(name) $(CFLAGS) $(o) -lcomctl32 -lwininet
|
||||
|
||||
|
||||
|
||||
resource.o: resource.rc
|
||||
#windres -DTTCALC_CONVERT resource.rc resource.o
|
||||
windres resource.rc resource.o
|
||||
|
||||
calculation.o: calculation.cpp compileconfig.h parsermanager.h resource.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h tabs.h messages.h
|
||||
functions.o: functions.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
iniparser.o: iniparser.cpp compileconfig.h iniparser.h
|
||||
languages.o: languages.cpp compileconfig.h languages.h
|
||||
mainwindow.o: mainwindow.cpp compileconfig.h winmain.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h resource.h messages.h tabs.h
|
||||
parsermanager.o: parsermanager.cpp compileconfig.h parsermanager.h resource.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
programresources.o: programresources.cpp compileconfig.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
tabs.o: tabs.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
variables.o: variables.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
winmain.o: winmain.cpp compileconfig.h winmain.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h resource.h messages.h tabs.h
|
||||
|
||||
help: ../help/$(helpname)
|
||||
|
||||
|
||||
../help/$(helpname): $(helpsrc)
|
||||
Makefile.help.sh
|
||||
|
||||
|
||||
setup: ../setup/$(setupname)
|
||||
|
||||
|
||||
../setup/$(setupname): $(name) ../help/$(helpname) ../setup/innosetup.iss ../setup/COPYRIGHT ../COPYRIGHT ../CHANGELOG ../README
|
||||
iscc ../setup/innosetup.iss
|
||||
|
||||
|
||||
depend:
|
||||
makedepend -Y. -I../../ttmath -f- *.cpp | sed "s/[\\]/\//g" > Makefile.cpp.dep
|
||||
echo -n "o = resource.o " > Makefile.o.dep
|
||||
ls -1 *.cpp | xargs -I foo echo -n foo " " | sed -E "s/([^\.]*)\.cpp[ ]/\1\.o/g" >> Makefile.o.dep
|
||||
echo -n "helpsrc = " > Makefile.help.dep
|
||||
ls -1 ../help/*.html ../help/*.css ../help/*.hhp ../help/*.hhk ../help/*.hhc | xargs -I foo echo -n foo " " >> Makefile.help.dep
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f *.s
|
||||
rm -f $(dir_output)/$(name)
|
||||
rm -f $(name)
|
||||
rm -f ttcalcp.exe
|
||||
rm -f ../help/$(helpname)
|
||||
rm -f ../setup/$(setupname)
|
||||
|
||||
|
||||
include Makefile.cpp.dep
|
||||
|
|
|
@ -0,0 +1,176 @@
|
|||
# DO NOT DELETE
|
||||
|
||||
calculation.o: compileconfig.h parsermanager.h resource.h programresources.h
|
||||
calculation.o: iniparser.h languages.h bigtypes.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmath.h ../../ttmath/ttmath/ttmathbig.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmathint.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmathuint.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmathtypes.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmathmisc.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmathuint_x86.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmathuint_x86_64.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmathuint_noasm.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmaththreads.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmathobjects.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmathparser.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmath.h threadcontroller.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmathobjects.h stopcalculating.h
|
||||
calculation.o: ../../ttmath/ttmath/ttmathtypes.h convert.h tabs.h messages.h
|
||||
convert.o: convert.h compileconfig.h bigtypes.h ../../ttmath/ttmath/ttmath.h
|
||||
convert.o: ../../ttmath/ttmath/ttmathbig.h ../../ttmath/ttmath/ttmathint.h
|
||||
convert.o: ../../ttmath/ttmath/ttmathuint.h ../../ttmath/ttmath/ttmathtypes.h
|
||||
convert.o: ../../ttmath/ttmath/ttmathmisc.h
|
||||
convert.o: ../../ttmath/ttmath/ttmathuint_x86.h
|
||||
convert.o: ../../ttmath/ttmath/ttmathuint_x86_64.h
|
||||
convert.o: ../../ttmath/ttmath/ttmathuint_noasm.h
|
||||
convert.o: ../../ttmath/ttmath/ttmaththreads.h
|
||||
convert.o: ../../ttmath/ttmath/ttmathobjects.h
|
||||
convert.o: ../../ttmath/ttmath/ttmathparser.h ../../ttmath/ttmath/ttmath.h
|
||||
download.o: compileconfig.h download.h
|
||||
functions.o: compileconfig.h tabs.h resource.h messages.h
|
||||
functions.o: ../../ttmath/ttmath/ttmathtypes.h programresources.h iniparser.h
|
||||
functions.o: languages.h bigtypes.h ../../ttmath/ttmath/ttmath.h
|
||||
functions.o: ../../ttmath/ttmath/ttmathbig.h ../../ttmath/ttmath/ttmathint.h
|
||||
functions.o: ../../ttmath/ttmath/ttmathuint.h
|
||||
functions.o: ../../ttmath/ttmath/ttmathtypes.h
|
||||
functions.o: ../../ttmath/ttmath/ttmathmisc.h
|
||||
functions.o: ../../ttmath/ttmath/ttmathuint_x86.h
|
||||
functions.o: ../../ttmath/ttmath/ttmathuint_x86_64.h
|
||||
functions.o: ../../ttmath/ttmath/ttmathuint_noasm.h
|
||||
functions.o: ../../ttmath/ttmath/ttmaththreads.h
|
||||
functions.o: ../../ttmath/ttmath/ttmathobjects.h
|
||||
functions.o: ../../ttmath/ttmath/ttmathparser.h ../../ttmath/ttmath/ttmath.h
|
||||
functions.o: threadcontroller.h ../../ttmath/ttmath/ttmathobjects.h
|
||||
functions.o: stopcalculating.h convert.h
|
||||
iniparser.o: compileconfig.h iniparser.h
|
||||
languages.o: compileconfig.h languages.h bigtypes.h
|
||||
languages.o: ../../ttmath/ttmath/ttmath.h ../../ttmath/ttmath/ttmathbig.h
|
||||
languages.o: ../../ttmath/ttmath/ttmathint.h ../../ttmath/ttmath/ttmathuint.h
|
||||
languages.o: ../../ttmath/ttmath/ttmathtypes.h
|
||||
languages.o: ../../ttmath/ttmath/ttmathmisc.h
|
||||
languages.o: ../../ttmath/ttmath/ttmathuint_x86.h
|
||||
languages.o: ../../ttmath/ttmath/ttmathuint_x86_64.h
|
||||
languages.o: ../../ttmath/ttmath/ttmathuint_noasm.h
|
||||
languages.o: ../../ttmath/ttmath/ttmaththreads.h
|
||||
languages.o: ../../ttmath/ttmath/ttmathobjects.h
|
||||
languages.o: ../../ttmath/ttmath/ttmathparser.h ../../ttmath/ttmath/ttmath.h
|
||||
mainwindow.o: compileconfig.h winmain.h programresources.h iniparser.h
|
||||
mainwindow.o: languages.h bigtypes.h ../../ttmath/ttmath/ttmath.h
|
||||
mainwindow.o: ../../ttmath/ttmath/ttmathbig.h ../../ttmath/ttmath/ttmathint.h
|
||||
mainwindow.o: ../../ttmath/ttmath/ttmathuint.h
|
||||
mainwindow.o: ../../ttmath/ttmath/ttmathtypes.h
|
||||
mainwindow.o: ../../ttmath/ttmath/ttmathmisc.h
|
||||
mainwindow.o: ../../ttmath/ttmath/ttmathuint_x86.h
|
||||
mainwindow.o: ../../ttmath/ttmath/ttmathuint_x86_64.h
|
||||
mainwindow.o: ../../ttmath/ttmath/ttmathuint_noasm.h
|
||||
mainwindow.o: ../../ttmath/ttmath/ttmaththreads.h
|
||||
mainwindow.o: ../../ttmath/ttmath/ttmathobjects.h
|
||||
mainwindow.o: ../../ttmath/ttmath/ttmathparser.h ../../ttmath/ttmath/ttmath.h
|
||||
mainwindow.o: threadcontroller.h ../../ttmath/ttmath/ttmathobjects.h
|
||||
mainwindow.o: stopcalculating.h ../../ttmath/ttmath/ttmathtypes.h convert.h
|
||||
mainwindow.o: resource.h messages.h tabs.h pad.h update.h download.h misc.h
|
||||
pad.o: ../../ttmath/ttmath/ttmath.h ../../ttmath/ttmath/ttmathbig.h
|
||||
pad.o: ../../ttmath/ttmath/ttmathint.h ../../ttmath/ttmath/ttmathuint.h
|
||||
pad.o: ../../ttmath/ttmath/ttmathtypes.h ../../ttmath/ttmath/ttmathmisc.h
|
||||
pad.o: ../../ttmath/ttmath/ttmathuint_x86.h
|
||||
pad.o: ../../ttmath/ttmath/ttmathuint_x86_64.h
|
||||
pad.o: ../../ttmath/ttmath/ttmathuint_noasm.h
|
||||
pad.o: ../../ttmath/ttmath/ttmaththreads.h
|
||||
pad.o: ../../ttmath/ttmath/ttmathobjects.h ../../ttmath/ttmath/ttmathparser.h
|
||||
pad.o: ../../ttmath/ttmath/ttmath.h programresources.h compileconfig.h
|
||||
pad.o: iniparser.h languages.h bigtypes.h threadcontroller.h
|
||||
pad.o: ../../ttmath/ttmath/ttmathobjects.h stopcalculating.h
|
||||
pad.o: ../../ttmath/ttmath/ttmathtypes.h convert.h resource.h messages.h
|
||||
pad.o: pad.h
|
||||
parsermanager.o: compileconfig.h parsermanager.h resource.h
|
||||
parsermanager.o: programresources.h iniparser.h languages.h bigtypes.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmath.h ../../ttmath/ttmath/ttmathbig.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmathint.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmathuint.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmathtypes.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmathmisc.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmathuint_x86.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmathuint_x86_64.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmathuint_noasm.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmaththreads.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmathobjects.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmathparser.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmath.h threadcontroller.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmathobjects.h stopcalculating.h
|
||||
parsermanager.o: ../../ttmath/ttmath/ttmathtypes.h convert.h tabs.h
|
||||
parsermanager.o: messages.h
|
||||
programresources.o: compileconfig.h programresources.h iniparser.h
|
||||
programresources.o: languages.h bigtypes.h ../../ttmath/ttmath/ttmath.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmathbig.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmathint.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmathuint.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmathtypes.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmathmisc.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmathuint_x86.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmathuint_x86_64.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmathuint_noasm.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmaththreads.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmathobjects.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmathparser.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmath.h threadcontroller.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmathobjects.h stopcalculating.h
|
||||
programresources.o: ../../ttmath/ttmath/ttmathtypes.h convert.h
|
||||
tabs.o: compileconfig.h tabs.h resource.h messages.h
|
||||
tabs.o: ../../ttmath/ttmath/ttmathtypes.h programresources.h iniparser.h
|
||||
tabs.o: languages.h bigtypes.h ../../ttmath/ttmath/ttmath.h
|
||||
tabs.o: ../../ttmath/ttmath/ttmathbig.h ../../ttmath/ttmath/ttmathint.h
|
||||
tabs.o: ../../ttmath/ttmath/ttmathuint.h ../../ttmath/ttmath/ttmathtypes.h
|
||||
tabs.o: ../../ttmath/ttmath/ttmathmisc.h ../../ttmath/ttmath/ttmathuint_x86.h
|
||||
tabs.o: ../../ttmath/ttmath/ttmathuint_x86_64.h
|
||||
tabs.o: ../../ttmath/ttmath/ttmathuint_noasm.h
|
||||
tabs.o: ../../ttmath/ttmath/ttmaththreads.h
|
||||
tabs.o: ../../ttmath/ttmath/ttmathobjects.h
|
||||
tabs.o: ../../ttmath/ttmath/ttmathparser.h ../../ttmath/ttmath/ttmath.h
|
||||
tabs.o: threadcontroller.h ../../ttmath/ttmath/ttmathobjects.h
|
||||
tabs.o: stopcalculating.h convert.h
|
||||
threadcontroller.o: threadcontroller.h ../../ttmath/ttmath/ttmathobjects.h
|
||||
threadcontroller.o: stopcalculating.h compileconfig.h
|
||||
threadcontroller.o: ../../ttmath/ttmath/ttmathtypes.h
|
||||
update.o: compileconfig.h update.h download.h programresources.h iniparser.h
|
||||
update.o: languages.h bigtypes.h ../../ttmath/ttmath/ttmath.h
|
||||
update.o: ../../ttmath/ttmath/ttmathbig.h ../../ttmath/ttmath/ttmathint.h
|
||||
update.o: ../../ttmath/ttmath/ttmathuint.h ../../ttmath/ttmath/ttmathtypes.h
|
||||
update.o: ../../ttmath/ttmath/ttmathmisc.h
|
||||
update.o: ../../ttmath/ttmath/ttmathuint_x86.h
|
||||
update.o: ../../ttmath/ttmath/ttmathuint_x86_64.h
|
||||
update.o: ../../ttmath/ttmath/ttmathuint_noasm.h
|
||||
update.o: ../../ttmath/ttmath/ttmaththreads.h
|
||||
update.o: ../../ttmath/ttmath/ttmathobjects.h
|
||||
update.o: ../../ttmath/ttmath/ttmathparser.h ../../ttmath/ttmath/ttmath.h
|
||||
update.o: threadcontroller.h ../../ttmath/ttmath/ttmathobjects.h
|
||||
update.o: stopcalculating.h ../../ttmath/ttmath/ttmathtypes.h convert.h
|
||||
update.o: messages.h resource.h winmain.h tabs.h pad.h misc.h
|
||||
variables.o: compileconfig.h tabs.h resource.h messages.h
|
||||
variables.o: ../../ttmath/ttmath/ttmathtypes.h programresources.h iniparser.h
|
||||
variables.o: languages.h bigtypes.h ../../ttmath/ttmath/ttmath.h
|
||||
variables.o: ../../ttmath/ttmath/ttmathbig.h ../../ttmath/ttmath/ttmathint.h
|
||||
variables.o: ../../ttmath/ttmath/ttmathuint.h
|
||||
variables.o: ../../ttmath/ttmath/ttmathtypes.h
|
||||
variables.o: ../../ttmath/ttmath/ttmathmisc.h
|
||||
variables.o: ../../ttmath/ttmath/ttmathuint_x86.h
|
||||
variables.o: ../../ttmath/ttmath/ttmathuint_x86_64.h
|
||||
variables.o: ../../ttmath/ttmath/ttmathuint_noasm.h
|
||||
variables.o: ../../ttmath/ttmath/ttmaththreads.h
|
||||
variables.o: ../../ttmath/ttmath/ttmathobjects.h
|
||||
variables.o: ../../ttmath/ttmath/ttmathparser.h ../../ttmath/ttmath/ttmath.h
|
||||
variables.o: threadcontroller.h ../../ttmath/ttmath/ttmathobjects.h
|
||||
variables.o: stopcalculating.h convert.h
|
||||
winmain.o: compileconfig.h winmain.h programresources.h iniparser.h
|
||||
winmain.o: languages.h bigtypes.h ../../ttmath/ttmath/ttmath.h
|
||||
winmain.o: ../../ttmath/ttmath/ttmathbig.h ../../ttmath/ttmath/ttmathint.h
|
||||
winmain.o: ../../ttmath/ttmath/ttmathuint.h ../../ttmath/ttmath/ttmathtypes.h
|
||||
winmain.o: ../../ttmath/ttmath/ttmathmisc.h
|
||||
winmain.o: ../../ttmath/ttmath/ttmathuint_x86.h
|
||||
winmain.o: ../../ttmath/ttmath/ttmathuint_x86_64.h
|
||||
winmain.o: ../../ttmath/ttmath/ttmathuint_noasm.h
|
||||
winmain.o: ../../ttmath/ttmath/ttmaththreads.h
|
||||
winmain.o: ../../ttmath/ttmath/ttmathobjects.h
|
||||
winmain.o: ../../ttmath/ttmath/ttmathparser.h ../../ttmath/ttmath/ttmath.h
|
||||
winmain.o: threadcontroller.h ../../ttmath/ttmath/ttmathobjects.h
|
||||
winmain.o: stopcalculating.h ../../ttmath/ttmath/ttmathtypes.h convert.h
|
||||
winmain.o: resource.h messages.h tabs.h pad.h update.h download.h
|
|
@ -0,0 +1 @@
|
|||
helpsrc = ../help/accuracy.html ../help/arithmetic_functions.html ../help/bitwise_functions.html ../help/conversions_deg_rad_grad.html ../help/help.hhp ../help/hyperbolic_functions.html ../help/index.hhk ../help/index.html ../help/inverse_hyperbolic_functions.html ../help/inverse_trigonometric_functions.html ../help/logarithm_exponential.html ../help/logical_functions.html ../help/operators_priority.html ../help/other_functions.html ../help/rounding_functions.html ../help/styles.css ../help/tips.html ../help/toc.hhc ../help/trigonometric_functions.html ../help/userfunctions.html ../help/values_and_std_operators.html
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
# we provide a small wrapper for Html Help Workshop because the Html HW returns 1 when
|
||||
# it has compiled the help and the 'make' program then stops
|
||||
|
||||
hhc ../help/help.hhp
|
||||
|
||||
if [ $? == 0 ]
|
||||
then
|
||||
# there was an error
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# there was a success
|
||||
|
||||
exit 0
|
|
@ -0,0 +1 @@
|
|||
o = resource.o calculation.o convert.o download.o functions.o iniparser.o languages.o mainwindow.o misc.o pad.o parsermanager.o programresources.o tabs.o threadcontroller.o update.o variables.o winmain.o
|
|
@ -0,0 +1,31 @@
|
|||
include Makefile.o.dep
|
||||
include Makefile.help.dep
|
||||
|
||||
|
||||
CC = g++
|
||||
CFLAGS = -Wall -pedantic -s -Os -fno-default-inline -mwindows -I../../ttmath -DTTCALC_PORTABLE -DTTMATH_DONT_USE_WCHAR
|
||||
name = ttcalcp.exe
|
||||
compressor = upx
|
||||
|
||||
|
||||
|
||||
all: ttcalc
|
||||
|
||||
|
||||
%.o: %.cpp
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
|
||||
ttcalc: $(name)
|
||||
|
||||
|
||||
$(name): $(o)
|
||||
$(CC) -o $(name) $(CFLAGS) $(o) -lcomctl32 -lwininet
|
||||
$(compressor) -7 $(name)
|
||||
|
||||
|
||||
resource.o: resource.rc
|
||||
windres -DTTCALC_PORTABLE resource.rc resource.o
|
||||
|
||||
|
||||
include Makefile.cpp.dep
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2009, Tomasz Sowa
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef bigtypesheader
|
||||
#define bigtypesheader
|
||||
|
||||
#include "compileconfig.h"
|
||||
|
||||
|
||||
//#define TTMATH_RELEASE
|
||||
#include <ttmath/ttmath.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
//"warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)"
|
||||
// (ttmath set it to default)
|
||||
#pragma warning (disable : 4800)
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
/*
|
||||
// old ones
|
||||
ttmath::Big<1,3>
|
||||
ttmath::Big<2,6>
|
||||
ttmath::Big<3,9>
|
||||
*/
|
||||
|
||||
/*
|
||||
typedef ttmath::Big<1,3> TTMathBig1;
|
||||
typedef ttmath::Big<2,9> TTMathBig2;
|
||||
typedef ttmath::Big<4,27> TTMathBig3;
|
||||
typedef TTMathBig3 TTMathBigMax;
|
||||
*/
|
||||
|
||||
typedef ttmath::Big<TTMATH_BITS(32), TTMATH_BITS(96) > TTMathBig1;
|
||||
typedef ttmath::Big<TTMATH_BITS(64), TTMATH_BITS(512) > TTMathBig2;
|
||||
typedef ttmath::Big<TTMATH_BITS(128), TTMATH_BITS(1024)> TTMathBig3;
|
||||
typedef TTMathBig3 TTMathBigMax;
|
||||
|
||||
#else
|
||||
|
||||
/* portable */
|
||||
|
||||
typedef ttmath::Big<TTMATH_BITS(32), TTMATH_BITS(96)> TTMathBig1;
|
||||
typedef TTMathBig1 TTMathBigMax;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2008, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -65,6 +65,9 @@ unsigned __stdcall CalculationsProcedure(void *)
|
|||
SetDlgItemText(main_window, IDC_OUTPUT_EDIT, "");
|
||||
PostMessage(main_window, WM_SET_LAST_ERROR, (WPARAM)ttmath::err_still_calculating, 0);
|
||||
|
||||
// we're showing info about converting
|
||||
parser_manager.ShowConvertingInfo();
|
||||
|
||||
// and finally we're parsing the input string
|
||||
parser_manager.Parse();
|
||||
|
||||
|
@ -74,7 +77,10 @@ unsigned __stdcall CalculationsProcedure(void *)
|
|||
// at the end we're printing the result
|
||||
// if there was a stop signal we continue the main loop without printing any values
|
||||
if( ! GetPrgRes()->GetThreadController()->WasStopSignal() )
|
||||
parser_manager.PrintResult();
|
||||
if( parser_manager.PrintResult() )
|
||||
PostMessage(main_window, WM_SET_LAST_ERROR, (WPARAM)parser_manager.GetLastCode(), 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -49,21 +49,33 @@
|
|||
|
||||
/*!
|
||||
the version of the application
|
||||
|
||||
TTCALC_PRERELEASE_VER is either zero or one
|
||||
if zero that means this is the release version of the program
|
||||
*/
|
||||
#define TTCALC_MAJOR_VER 0
|
||||
#define TTCALC_MINOR_VER 8
|
||||
#define TTCALC_REVISION_VER 0
|
||||
#define TTCALC_MINOR_VER 9
|
||||
#define TTCALC_REVISION_VER 3
|
||||
#define TTCALC_PRERELEASE_VER 0
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
this disables a Visual C++ warning about converting int to bool
|
||||
"warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)"
|
||||
this disables a Visual C++ warning
|
||||
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
|
||||
//"warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)"
|
||||
#pragma warning (disable : 4800)
|
||||
|
||||
// warning C4996: 'sprintf': This function or variable may be unsafe.
|
||||
#pragma warning (disable : 4996)
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_IE
|
||||
#define _WIN32_IE 0x0501
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,444 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2009, Tomasz Sowa
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "convert.h"
|
||||
|
||||
|
||||
|
||||
Convert::Convert()
|
||||
{
|
||||
Init();
|
||||
current_conv_type = 0;
|
||||
CheckCurrentUnits();
|
||||
}
|
||||
|
||||
|
||||
void Convert::AddType(const char * name)
|
||||
{
|
||||
if( type_tab.empty() )
|
||||
return;
|
||||
|
||||
Type temp;
|
||||
temp.name = name;
|
||||
|
||||
type_tab.back().push_back(temp);
|
||||
}
|
||||
|
||||
|
||||
void Convert::AddUnit(const char * name, const char * abbr, int numerator, int denominator)
|
||||
{
|
||||
if( type_tab.empty() || type_tab.back().empty() || unit_tab.empty() )
|
||||
return;
|
||||
|
||||
Unit temp;
|
||||
temp.name = name;
|
||||
|
||||
if( abbr != 0 )
|
||||
temp.abbr = abbr;
|
||||
|
||||
|
||||
temp.type = int(type_tab.back().size()-1);
|
||||
|
||||
|
||||
temp.value_numerator.FromInt(numerator);
|
||||
|
||||
if( denominator != 1 )
|
||||
{
|
||||
// value_denominator is set into one (default)
|
||||
temp.value_denominator.FromInt(denominator);
|
||||
}
|
||||
|
||||
unit_tab.back().push_back(temp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Convert::AddUnit(const char * name, const char * abbr, const char * v)
|
||||
{
|
||||
if( type_tab.empty() || type_tab.back().empty() || unit_tab.empty() )
|
||||
return;
|
||||
|
||||
Unit temp;
|
||||
temp.name = name;
|
||||
temp.abbr = abbr;
|
||||
temp.type = int(type_tab.back().size()-1);
|
||||
temp.value_numerator.FromString(v, 16);
|
||||
|
||||
unit_tab.back().push_back(temp);
|
||||
}
|
||||
|
||||
|
||||
void Convert::Init()
|
||||
{
|
||||
// en
|
||||
type_tab.push_back( std::vector<Type>() );
|
||||
unit_tab.push_back( std::vector<Unit>() );
|
||||
|
||||
AddType("none");
|
||||
|
||||
/*
|
||||
yard = 0.9144 metre
|
||||
foot = 1/3 yard = 0.3048 metre
|
||||
inch = 1/36 yard = 1/12 foot = 0.0254 metre
|
||||
|
||||
In 1958 the United States and countries of the Commonwealth of Nations
|
||||
defined the length of the international yard to be precisely 0.9144 metres.
|
||||
|
||||
1 point (Didot's system) = 1 / 2660 m
|
||||
1 point (pica - USA and UK) = 1 / 72 inch
|
||||
*/
|
||||
AddType("length"); // base: 10000 metre
|
||||
AddUnit("inch", "in", 254);
|
||||
AddUnit("foot", "ft", 3048);
|
||||
AddUnit("yard", "yd", 9144);
|
||||
AddUnit("metre", "m", 10000);
|
||||
AddUnit("mile (land)", "mi", 16093440); // 1 land mile = 1609.344 metres
|
||||
AddUnit("mile (nautical)", "nmi", 18520000); // 1 nautical mile = 1852 metres
|
||||
AddUnit("point (Didot)", "p", 10000, 2660);
|
||||
AddUnit("point (pica)", "p", 18288, 5184);
|
||||
AddUnit("light year", "ly", "520F0AA65AAEBAC00"); // 1 ly = 9 460 730 472 580 800 metres
|
||||
// 520F0AA65AAEBAC00 (hex) = 94607304725808000000 (dec)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
yard^2 = 0.83612736 metre^2
|
||||
foot^2 = 1/9 yard^2 = 0.09290304 metre^2
|
||||
inch^2 = 1/1296 yard^2 = 1/144 foot^ = 0.00064516 metre^2
|
||||
|
||||
ar = 100 metre^2
|
||||
hectere = 10000 metre^2
|
||||
*/
|
||||
|
||||
// !!! give a smaller base here
|
||||
AddType("area"); // base: 100 000 000 metre^2
|
||||
AddUnit("inch^2", "in^2", 64516);
|
||||
AddUnit("foot^2", "ft^2", 9290304);
|
||||
AddUnit("yard^2", "yd^2", 83612736);
|
||||
AddUnit("metre^2", "m^2", 100000000);
|
||||
AddUnit("are", "a", "2540BE400"); // 10000000000 (dec)
|
||||
AddUnit("hectare", "ha", "E8D4A51000"); // 1000000000000 (dec)
|
||||
AddUnit("mile (land)^2", "mi^2", "EB8EDC210000" ); // 258998811033600 (dec), 1 land mile^2 = 2589988.110336 metres^2
|
||||
AddUnit("mile (nautical)^2", "nmi^2", "137F2ACF41000"); // 342990400000000 (dec), 1 nautical mile^2 = 3429904 metres^2
|
||||
AddUnit("light year^2", "ly^2", "1A4DA3B4D207FB4C43D08391653B900000"); // 1 ly = 89505421074818927300612528640000 metres^2
|
||||
// 1A4DA3B4D207FB4C43D08391653B900000 (hex) = 8950542107481892730061252864000000000000 (dec)
|
||||
|
||||
|
||||
AddType("time"); // base: second
|
||||
AddUnit("second", "s", 1);
|
||||
AddUnit("minute", "m", 60);
|
||||
AddUnit("hour", "h", 3600);
|
||||
AddUnit("day", "d", 86400);
|
||||
AddUnit("week", "w", 604800);
|
||||
AddUnit("fortnight", "fn", 1209600);
|
||||
AddUnit("month", "m", 2592000);
|
||||
AddUnit("year", "y", 31536000);
|
||||
AddUnit("year (mean)", "my", 31557600);
|
||||
AddUnit("year (leap)", "ly", 31622400);
|
||||
AddUnit("decade", "dc", 315360000);
|
||||
|
||||
|
||||
|
||||
// pl
|
||||
// the 'value' param we're using only from the english
|
||||
type_tab.push_back( std::vector<Type>() );
|
||||
unit_tab.push_back( std::vector<Unit>() );
|
||||
|
||||
AddType("brak");
|
||||
|
||||
AddType("d³ugoœæ");
|
||||
AddUnit("cal");
|
||||
AddUnit("stopa");
|
||||
AddUnit("jard");
|
||||
AddUnit("metr");
|
||||
AddUnit("mila (angielska)");
|
||||
AddUnit("mila (morska)");
|
||||
AddUnit("punkt (Didot)");
|
||||
AddUnit("punkt (pica)");
|
||||
AddUnit("rok œwietlny");
|
||||
|
||||
AddType("powierzchnia");
|
||||
AddUnit("cal^2");
|
||||
AddUnit("stopa^2");
|
||||
AddUnit("jard^2");
|
||||
AddUnit("metr^2");
|
||||
AddUnit("ar", "");
|
||||
AddUnit("hektar");
|
||||
AddUnit("mila (angielska)^2");
|
||||
AddUnit("mila (morska)^2");
|
||||
AddUnit("rok œwietlny^2");
|
||||
|
||||
|
||||
AddType("czas");
|
||||
AddUnit("sekunda");
|
||||
AddUnit("minuta");
|
||||
AddUnit("godzina");
|
||||
AddUnit("dzieñ");
|
||||
AddUnit("tydzieñ");
|
||||
AddUnit("dwa tygodnie");
|
||||
AddUnit("miesi¹c");
|
||||
AddUnit("rok");
|
||||
AddUnit("rok (œredni)");
|
||||
AddUnit("rok (przestêpny)");
|
||||
AddUnit("dekada");
|
||||
|
||||
CheckAfterInit();
|
||||
}
|
||||
|
||||
|
||||
void Convert::ErrorMessage()
|
||||
{
|
||||
MessageBox(0, "Internal error: tables for converting have incorrect values",
|
||||
"Internal error", MB_ICONERROR);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
void Convert::CheckAfterInit()
|
||||
{
|
||||
unsigned int i, len;
|
||||
|
||||
if( type_tab.size() != unit_tab.size() )
|
||||
return ErrorMessage();
|
||||
|
||||
if( type_tab.empty() )
|
||||
return;
|
||||
|
||||
len = (unsigned int)type_tab[0].size();
|
||||
for(i=1 ; i<type_tab.size() ; ++i)
|
||||
{
|
||||
if( len != type_tab[i].size() )
|
||||
return ErrorMessage();
|
||||
}
|
||||
|
||||
len = (unsigned int)unit_tab[0].size();
|
||||
for(i=1 ; i<unit_tab.size() ; ++i)
|
||||
{
|
||||
if( len != unit_tab[i].size() )
|
||||
return ErrorMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
cid - country id
|
||||
|
||||
*/
|
||||
const char * Convert::GetTypeName(int cid, int id)
|
||||
{
|
||||
const char * unk_err = "unknown";
|
||||
|
||||
if( type_tab.empty() )
|
||||
return unk_err;
|
||||
|
||||
if( cid >= (int)type_tab.size() )
|
||||
cid = 0;
|
||||
|
||||
if( id< 0 || id >= int(type_tab[cid].size()) )
|
||||
return unk_err;
|
||||
|
||||
return type_tab[cid][id].name.c_str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const char * Convert::GetUnitName(int cid, int id)
|
||||
{
|
||||
const char * unk_err = "unknown";
|
||||
|
||||
if( unit_tab.empty() )
|
||||
return unk_err;
|
||||
|
||||
if( cid >= (int)unit_tab.size() )
|
||||
cid = 0;
|
||||
|
||||
if( id < 0 || id >= int(unit_tab[cid].size()) )
|
||||
return unk_err;
|
||||
|
||||
return unit_tab[cid][id].name.c_str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const char * Convert::GetUnitAbbr(int cid, int id)
|
||||
{
|
||||
const char * unk_err = "unknown";
|
||||
|
||||
if( unit_tab.empty() )
|
||||
return unk_err;
|
||||
|
||||
if( cid >= (int)unit_tab.size() )
|
||||
cid = 0;
|
||||
|
||||
if( id < 0 || id >= int(unit_tab[cid].size()) )
|
||||
return unk_err;
|
||||
|
||||
if( !unit_tab[cid][id].abbr.empty() )
|
||||
return unit_tab[cid][id].abbr.c_str();
|
||||
|
||||
/*
|
||||
if there is no defined an abbreviation in the specific
|
||||
language, we return the abbreviation from english
|
||||
*/
|
||||
|
||||
return unit_tab[0][id].abbr.c_str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int Convert::GetTypeSize()
|
||||
{
|
||||
if( type_tab.empty() )
|
||||
return 0;
|
||||
|
||||
return int(type_tab[0].size());
|
||||
}
|
||||
|
||||
|
||||
int Convert::GetUnitSize()
|
||||
{
|
||||
if( unit_tab.empty() )
|
||||
return 0;
|
||||
|
||||
return int(unit_tab[0].size());
|
||||
}
|
||||
|
||||
|
||||
int Convert::GetUnitType(int id)
|
||||
{
|
||||
if( unit_tab.empty() )
|
||||
return -1;
|
||||
|
||||
if( id >= int(unit_tab[0].size()) )
|
||||
return -1;
|
||||
|
||||
return unit_tab[0][id].type;
|
||||
}
|
||||
|
||||
|
||||
// value is taken only from english
|
||||
bool Convert::GetUnitValue(int id, TTMathBigMax & numerator, TTMathBigMax & denominator)
|
||||
{
|
||||
if( unit_tab.empty() )
|
||||
return false;
|
||||
|
||||
if( id >= int(unit_tab[0].size()) )
|
||||
return false;
|
||||
|
||||
numerator = unit_tab[0][id].value_numerator;
|
||||
denominator = unit_tab[0][id].value_denominator;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// gui
|
||||
|
||||
void Convert::SetCurrentType(int c)
|
||||
{
|
||||
current_conv_type = c;
|
||||
}
|
||||
|
||||
|
||||
int Convert::GetCurrentType()
|
||||
{
|
||||
return current_conv_type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Convert::CheckUnitIndex(int type)
|
||||
{
|
||||
if( current_conv_unit[type].input < -1 || current_conv_unit[type].input >= GetUnitSize() )
|
||||
current_conv_unit[type].input = 0; // maybe better to -1 ?
|
||||
|
||||
if( current_conv_unit[type].output < -1 || current_conv_unit[type].output >= GetUnitSize() )
|
||||
current_conv_unit[type].output = 0; // the same
|
||||
}
|
||||
|
||||
|
||||
void Convert::CheckCurrentUnits()
|
||||
{
|
||||
int len = GetTypeSize();
|
||||
|
||||
if( static_cast<int>( current_conv_unit.size() ) != len )
|
||||
current_conv_unit.resize(len);
|
||||
|
||||
for(int i = 0 ; i<len ; ++i)
|
||||
CheckUnitIndex(i);
|
||||
}
|
||||
|
||||
|
||||
void Convert::SetCurrentUnit(int type, int input, int output)
|
||||
{
|
||||
int len = GetTypeSize();
|
||||
|
||||
if( type >= len )
|
||||
return;
|
||||
|
||||
current_conv_unit[type].input = input;
|
||||
current_conv_unit[type].output = output;
|
||||
CheckUnitIndex(type);
|
||||
}
|
||||
|
||||
|
||||
bool Convert::GetCurrentUnit(int type, int & input, int & output)
|
||||
{
|
||||
int len = GetTypeSize();
|
||||
|
||||
if( type >= len )
|
||||
{
|
||||
input = output = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
input = current_conv_unit[type].input;
|
||||
output = current_conv_unit[type].output;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2009, Tomasz Sowa
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef convertheader
|
||||
#define convertheader
|
||||
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
#include "compileconfig.h"
|
||||
#include "bigtypes.h"
|
||||
|
||||
|
||||
|
||||
class Convert
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
Convert();
|
||||
|
||||
|
||||
/*
|
||||
none, length, area, time,
|
||||
*/
|
||||
struct Type
|
||||
{
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct Unit
|
||||
{
|
||||
std::string name, abbr;
|
||||
int type;
|
||||
TTMathBigMax value_numerator, value_denominator;
|
||||
|
||||
Unit()
|
||||
{
|
||||
type = -1;
|
||||
value_numerator.SetZero();
|
||||
value_denominator.SetOne();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
std::vector<std::vector<Type> > type_tab;
|
||||
std::vector<std::vector<Unit> > unit_tab;
|
||||
|
||||
|
||||
|
||||
|
||||
void AddType(const char * name);
|
||||
void AddUnit(const char * name, const char * abbr = 0, int numerator = 0, int denominator = 1);
|
||||
void AddUnit(const char * name, const char * abbr, const char * v);
|
||||
|
||||
void Init();
|
||||
|
||||
|
||||
const char * GetTypeName(int cid, int id);
|
||||
|
||||
const char * GetUnitName(int cid, int id);
|
||||
const char * GetUnitAbbr(int cid, int id);
|
||||
int GetUnitType(int id);
|
||||
|
||||
int GetTypeSize();
|
||||
int GetUnitSize();
|
||||
|
||||
|
||||
/*
|
||||
the return value is the same for all languages
|
||||
(in fact we're taking it from english)
|
||||
*/
|
||||
bool GetUnitValue(int id, TTMathBigMax & numerator, TTMathBigMax & denominator);
|
||||
|
||||
void ErrorMessage();
|
||||
void CheckAfterInit();
|
||||
|
||||
|
||||
template<class ValueType>
|
||||
int Conversion(int conv_input_unit, int conv_output_unit, ValueType & result)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
ValueType v1_n, v1_d; // input
|
||||
ValueType v2_n, v2_d; // output
|
||||
|
||||
TTMathBigMax v1_n_, v1_d_; // input
|
||||
TTMathBigMax v2_n_, v2_d_; // output
|
||||
|
||||
if( !GetUnitValue(conv_input_unit, v1_n_, v1_d_) )
|
||||
return 1;
|
||||
|
||||
if( !GetUnitValue(conv_output_unit, v2_n_, v2_d_) )
|
||||
return 1;
|
||||
|
||||
v1_n.FromBig( v1_n_ );
|
||||
v1_d.FromBig( v1_d_ );
|
||||
v2_n.FromBig( v2_n_ );
|
||||
v2_d.FromBig( v2_d_ );
|
||||
|
||||
// result = result * (v1_n * v2_d) / (v1_d * v2_n)
|
||||
c += result.Mul(v1_n);
|
||||
c += result.Mul(v2_d);
|
||||
c += v1_d.Mul(v2_n);
|
||||
c += result.Div(v1_d);
|
||||
|
||||
return (c==0)? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
for the interface
|
||||
*/
|
||||
|
||||
int current_conv_type; // selected type of converting: none, length, area, ...
|
||||
|
||||
struct CurrentConvUnit
|
||||
{
|
||||
int input, output;
|
||||
CurrentConvUnit() { input = output = -1; }
|
||||
};
|
||||
|
||||
std::vector<CurrentConvUnit> current_conv_unit;
|
||||
|
||||
|
||||
|
||||
void SetCurrentType(int c);
|
||||
int GetCurrentType();
|
||||
void CheckUnitIndex(int type);
|
||||
void CheckCurrentUnits();
|
||||
void SetCurrentUnit(int type, int input, int output);
|
||||
bool GetCurrentUnit(int type, int & input, int & output);
|
||||
|
||||
// end part of gui
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,175 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2009, Tomasz Sowa
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include "compileconfig.h"
|
||||
#include "download.h"
|
||||
|
||||
|
||||
Download::Download()
|
||||
{
|
||||
buffer_len = 128;
|
||||
progress = 0;
|
||||
|
||||
buffer = new char[buffer_len];
|
||||
}
|
||||
|
||||
|
||||
Download::~Download()
|
||||
{
|
||||
if( buffer )
|
||||
delete [] buffer;
|
||||
}
|
||||
|
||||
|
||||
void Download::SetProgress()
|
||||
{
|
||||
if( !progress )
|
||||
return;
|
||||
|
||||
SendMessage(progress, PBM_SETRANGE32, 0, all_len);
|
||||
SendMessage(progress, PBM_SETPOS, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
void Download::ChangeProgress(size_t size)
|
||||
{
|
||||
if( !progress )
|
||||
return;
|
||||
|
||||
SendMessage(progress, PBM_SETPOS, size, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Download::ClearProgress()
|
||||
{
|
||||
if( !progress )
|
||||
return;
|
||||
|
||||
SendMessage(progress, PBM_SETPOS, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
bool Download::DownloadLoop(HINTERNET conn)
|
||||
{
|
||||
DWORD read;
|
||||
|
||||
|
||||
while( true )
|
||||
{
|
||||
bool res = InternetReadFile(conn, buffer, buffer_len, &read);
|
||||
|
||||
if( !res )
|
||||
// some problems with downloading
|
||||
return false;
|
||||
|
||||
|
||||
if( read > 0 )
|
||||
{
|
||||
down_size += read;
|
||||
ChangeProgress(down_size);
|
||||
|
||||
if( !Read(buffer, read) )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// end
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Download::DownloadUrl(const char * url)
|
||||
{
|
||||
bool res = true;
|
||||
char browser[100];
|
||||
|
||||
down_size = 0;
|
||||
sprintf(browser, "TTCalc updater %d.%d.%d%s",
|
||||
TTCALC_MAJOR_VER,
|
||||
TTCALC_MINOR_VER,
|
||||
TTCALC_REVISION_VER,
|
||||
(TTCALC_PRERELEASE_VER>0)? " prerelease" : "");
|
||||
|
||||
|
||||
HINTERNET hint = InternetOpen(browser,INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0);
|
||||
if( !hint )
|
||||
return false;
|
||||
|
||||
HINTERNET conn = InternetOpenUrl(hint, url, 0, 0,
|
||||
INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD | INTERNET_FLAG_NO_UI, 0);
|
||||
|
||||
if( conn )
|
||||
{
|
||||
GetLen(conn);
|
||||
SetProgress();
|
||||
|
||||
if( Init() )
|
||||
{
|
||||
res = DownloadLoop(conn);
|
||||
Close();
|
||||
ClearProgress();
|
||||
}
|
||||
|
||||
InternetCloseHandle(conn);
|
||||
}
|
||||
else
|
||||
{
|
||||
res = false;
|
||||
}
|
||||
|
||||
InternetCloseHandle(hint);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2009, Tomasz Sowa
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef headerfiledownload
|
||||
#define headerfiledownload
|
||||
|
||||
#include <windows.h>
|
||||
#include <wininet.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
class Download
|
||||
{
|
||||
public:
|
||||
|
||||
Download();
|
||||
~Download();
|
||||
|
||||
bool DownloadUrl(const char * url);
|
||||
void AttachProgress(HWND p) { progress = p; }
|
||||
|
||||
protected:
|
||||
virtual bool DownloadLoop(HINTERNET conn);
|
||||
virtual void GetLen(HINTERNET conn) { all_len = 0; }
|
||||
virtual bool Init() { return false; }
|
||||
virtual bool Read(char * buffer, size_t size) { return false; }
|
||||
virtual void Close() {}
|
||||
virtual void SetProgress();
|
||||
virtual void ChangeProgress(size_t size);
|
||||
virtual void ClearProgress();
|
||||
|
||||
char * buffer;
|
||||
size_t buffer_len;
|
||||
size_t all_len;
|
||||
HWND progress;
|
||||
size_t down_size;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -85,9 +85,14 @@ int i;
|
|||
SendDlgItemMessage(hWnd,IDC_COMBO_FUNCTION_PARAM,CB_SETCURSEL,parameters,0);
|
||||
|
||||
if( adding )
|
||||
{
|
||||
SetFocus(GetDlgItem(hWnd,IDC_EDIT_FUNCTION_NAME));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFocus(GetDlgItem(hWnd,IDC_EDIT_FUNCTION_VALUE));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_FUNCTION_VALUE, EM_SETSEL, value.size(), value.size());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
|
@ -97,10 +102,10 @@ int i;
|
|||
pchar = new char[temporary_buffer_size];
|
||||
|
||||
GetDlgItemText(hWnd, IDC_EDIT_FUNCTION_NAME, pchar, temporary_buffer_size);
|
||||
name = Variables::ChangeToSmallLetters( Variables::StripWhiteCharacters(pchar) );
|
||||
name = Variables::StripWhiteCharacters(pchar);
|
||||
|
||||
GetDlgItemText(hWnd, IDC_EDIT_FUNCTION_VALUE, pchar, temporary_buffer_size);
|
||||
value = Variables::ChangeToSmallLetters( Variables::StripWhiteCharacters(pchar) );
|
||||
value = Variables::StripWhiteCharacters(pchar);
|
||||
|
||||
parameters = (int)SendDlgItemMessage(hWnd,IDC_COMBO_FUNCTION_PARAM,CB_GETCURSEL,0,0);
|
||||
|
||||
|
@ -223,6 +228,7 @@ BOOL WmTabCommand_AddFunction(HWND, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
GetPrgRes()->GetThreadController()->StopCalculating();
|
||||
code = GetPrgRes()->GetFunctions()->Add(name, value, parameters);
|
||||
GetPrgRes()->FunctionsChanged();
|
||||
GetPrgRes()->GetThreadController()->StartCalculating();
|
||||
|
||||
if( code != ttmath::err_ok )
|
||||
|
@ -231,6 +237,8 @@ BOOL WmTabCommand_AddFunction(HWND, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
int id = AddNewItemToFunctionList(list, name, value, parameters);
|
||||
Variables::SelectOnlyOneItem(list,id);
|
||||
GetPrgRes()->ReadVariablesFunctionsFromFile();
|
||||
GetPrgRes()->SaveToFile();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -290,12 +298,17 @@ adding = false;
|
|||
// if we've changed the name then we're changing the value and parameters
|
||||
code = GetPrgRes()->GetFunctions()->EditValue(name, value, parameters);
|
||||
|
||||
GetPrgRes()->FunctionsChanged();
|
||||
GetPrgRes()->GetThreadController()->StartCalculating();
|
||||
|
||||
if( code != ttmath::err_ok )
|
||||
ShowError(list, code);
|
||||
else
|
||||
{
|
||||
ChangeItemInFunctionList(list, id, old_name, name, value, parameters);
|
||||
GetPrgRes()->ReadVariablesFunctionsFromFile();
|
||||
GetPrgRes()->SaveToFile();
|
||||
}
|
||||
}
|
||||
while( code != ttmath::err_ok );
|
||||
|
||||
|
@ -328,6 +341,7 @@ int items = ListView_GetSelectedCount(list);
|
|||
char * buffer = new char[buffer_size];
|
||||
bool all_deleted = true;
|
||||
|
||||
GetPrgRes()->ReadVariablesFunctionsFromFile();
|
||||
GetPrgRes()->GetThreadController()->StopCalculating();
|
||||
|
||||
for( id = ListView_GetItemCount(list)-1 ; id!=-1 ; --id )
|
||||
|
@ -339,10 +353,14 @@ int items = ListView_GetSelectedCount(list);
|
|||
all_deleted = false;
|
||||
else
|
||||
ListView_DeleteItem(list, id);
|
||||
|
||||
GetPrgRes()->FunctionsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GetPrgRes()->GetThreadController()->StartCalculating();
|
||||
GetPrgRes()->SaveToFile();
|
||||
|
||||
delete [] buffer;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2008, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -44,6 +44,26 @@ IniParser::IniParser()
|
|||
{
|
||||
strip_white_characters_from_value = true;
|
||||
convert_value_to_small_letters = true;
|
||||
section_case_sensitive = false;
|
||||
pattern_case_sensitive = false;
|
||||
}
|
||||
|
||||
|
||||
void IniParser::ConvertValueToSmallLetters(bool conv)
|
||||
{
|
||||
convert_value_to_small_letters = conv;
|
||||
}
|
||||
|
||||
|
||||
void IniParser::SectionCaseSensitive(bool sens)
|
||||
{
|
||||
section_case_sensitive = sens;
|
||||
}
|
||||
|
||||
|
||||
void IniParser::PatternCaseSensitive(bool sens)
|
||||
{
|
||||
pattern_case_sensitive = sens;
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,7 +168,10 @@ IniParser::Error IniParser::ReadSection(std::string & section)
|
|||
}
|
||||
|
||||
while( IsSectionCharacter( (c = ReadCharacter()) ) )
|
||||
section += LowerCase(c);
|
||||
if( section_case_sensitive )
|
||||
section += c;
|
||||
else
|
||||
section += LowerCase(c);
|
||||
|
||||
if( c != ']' )
|
||||
{
|
||||
|
@ -220,7 +243,11 @@ IniParser::Error IniParser::ReadExpression(std::string & pattern, std::string &
|
|||
|
||||
while( IsPatternCharacter(c) )
|
||||
{
|
||||
pattern += LowerCase(c);
|
||||
if( pattern_case_sensitive )
|
||||
pattern += c;
|
||||
else
|
||||
pattern += LowerCase(c);
|
||||
|
||||
c = ReadCharacter();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2008, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -40,7 +40,7 @@
|
|||
|
||||
/*!
|
||||
\file iniparser.h
|
||||
\brief A Parser witch we use for parsing 'ini' files
|
||||
\brief A Parser which we use for parsing 'ini' files
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
@ -133,6 +133,34 @@ public:
|
|||
Error ReadFromFile(const char * path);
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
when true the names of sections will be case-sensitive
|
||||
e.g.
|
||||
when true: '[foo]' is not equal '[Foo]'
|
||||
|
||||
default: false
|
||||
*/
|
||||
void SectionCaseSensitive(bool sens);
|
||||
|
||||
|
||||
/*!
|
||||
when true the names of patterns will be case-sensitive
|
||||
e.g.
|
||||
when true: 'foo = 4' is not equal 'Foo = 4'
|
||||
|
||||
default: false
|
||||
*/
|
||||
void PatternCaseSensitive(bool sens);
|
||||
|
||||
|
||||
/*!
|
||||
if conv=true (default) that the whole characters in a value
|
||||
will be changed into small letters
|
||||
*/
|
||||
void ConvertValueToSmallLetters(bool conv);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
typedef std::map<std::string, std::string *> Table;
|
||||
|
@ -144,6 +172,8 @@ private:
|
|||
int line;
|
||||
bool strip_white_characters_from_value;
|
||||
bool convert_value_to_small_letters;
|
||||
bool section_case_sensitive;
|
||||
bool pattern_case_sensitive;
|
||||
|
||||
Error Read();
|
||||
Error ReadSection(std::string & section);
|
||||
|
|
2067
src/languages.cpp
2067
src/languages.cpp
File diff suppressed because it is too large
Load Diff
140
src/languages.h
140
src/languages.h
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -42,7 +42,7 @@
|
|||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <ttmath/ttmathtypes.h>
|
||||
#include "bigtypes.h"
|
||||
|
||||
|
||||
class Languages
|
||||
|
@ -83,6 +83,7 @@ public:
|
|||
tab_functions,
|
||||
tab_precision,
|
||||
tab_display,
|
||||
tab_convert,
|
||||
radio_precision_1,
|
||||
radio_precision_2,
|
||||
radio_precision_3,
|
||||
|
@ -91,15 +92,30 @@ public:
|
|||
precision_3_info,
|
||||
overflow_during_printing,
|
||||
combo_rounding_none,
|
||||
combo_rounding_cut_last_digits,
|
||||
combo_rounding_integer,
|
||||
combo_rounding_to_number,
|
||||
combo_rounding_after_comma,
|
||||
check_remove_zeroes,
|
||||
display_input,
|
||||
display_output,
|
||||
display_rounding,
|
||||
display_always_scientific,
|
||||
display_not_always_scientific,
|
||||
display_deg_rad_grad,
|
||||
display_grouping,
|
||||
display_grouping_none,
|
||||
display_grouping_space,
|
||||
display_grouping_digits,
|
||||
display_input_decimal_point,
|
||||
display_input_decimal_point_item1,
|
||||
display_output_decimal_point,
|
||||
display_param_sep,
|
||||
display_param_sep_item2,
|
||||
display_param_sep_item3,
|
||||
convert_type,
|
||||
convert_input,
|
||||
convert_output,
|
||||
convert_dynamic_output,
|
||||
menu_view,
|
||||
menu_edit,
|
||||
menu_help,
|
||||
|
@ -108,37 +124,95 @@ public:
|
|||
menu_view_normal_view,
|
||||
menu_view_compact_view,
|
||||
menu_view_always_on_top,
|
||||
menu_view_pad,
|
||||
menu_view_lang_english,
|
||||
menu_view_lang_polish,
|
||||
menu_view_lang_spanish,
|
||||
menu_view_lang_danish,
|
||||
menu_view_lang_chinese,
|
||||
menu_view_lang_russian,
|
||||
menu_view_lang_swedish,
|
||||
menu_view_lang_italian,
|
||||
menu_view_lang_german,
|
||||
menu_view_close_program,
|
||||
menu_edit_undo,
|
||||
menu_edit_cut,
|
||||
menu_edit_copy,
|
||||
menu_edit_paste,
|
||||
menu_edit_del,
|
||||
menu_edit_paste_formula,
|
||||
menu_edit_copy_result,
|
||||
menu_edit_copy_both,
|
||||
menu_edit_select_all,
|
||||
menu_edit_bracket,
|
||||
menu_edit_swap,
|
||||
menu_help_help,
|
||||
menu_help_project_page,
|
||||
menu_help_check_update,
|
||||
menu_help_about,
|
||||
menu_update_available,
|
||||
cant_init_calculations,
|
||||
message_box_error_caption,
|
||||
cant_create_thread,
|
||||
cant_create_pad,
|
||||
cant_create_main_window,
|
||||
cant_init_common_controls,
|
||||
cant_find_help,
|
||||
cant_open_project_page,
|
||||
update_title,
|
||||
update_button_next,
|
||||
update_button_finish,
|
||||
update_button_cancel,
|
||||
update_check_at_startup,
|
||||
update_check_for_info,
|
||||
update_is_new_version,
|
||||
update_no_new_version1,
|
||||
update_no_new_version2,
|
||||
update_download_from,
|
||||
update_downloaded_info1,
|
||||
update_downloaded_info2,
|
||||
update_download_error,
|
||||
about_text,
|
||||
about_text_portable_version,
|
||||
about_text_exe_packer,
|
||||
about_box_title,
|
||||
about_box_button_close,
|
||||
display_group_scientific,
|
||||
display_as_scientific,
|
||||
pad_title,
|
||||
pad_menu_file,
|
||||
pad_menu_edit,
|
||||
pad_menu_file_new,
|
||||
pad_menu_file_open,
|
||||
pad_menu_file_saveas,
|
||||
pad_menu_file_close,
|
||||
pad_menu_edit_undo,
|
||||
pad_menu_edit_cut,
|
||||
pad_menu_edit_copy,
|
||||
pad_menu_edit_paste,
|
||||
pad_menu_edit_del,
|
||||
pad_menu_edit_select_all,
|
||||
cannot_open_file,
|
||||
cannot_save_file,
|
||||
file_too_long,
|
||||
other_error,
|
||||
unknown_error
|
||||
};
|
||||
|
||||
// the first item must be with zero index
|
||||
// and next items must be about one greater (0,1,2,3..)
|
||||
// (after conversion to 'int' we pass it into the std::vector)
|
||||
// lastnotexisting should be the last item
|
||||
// make sure SelectCurrentLanguage(const std::string & lang) is able to recognize a language
|
||||
enum Country
|
||||
{
|
||||
en = 0, pl
|
||||
en = 0, pl, sp, da, chn, ru, swe, it, ger, lastnotexisting
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// TTMathBigMax foo_return;
|
||||
|
||||
private:
|
||||
|
||||
Country current_country;
|
||||
|
@ -152,30 +226,78 @@ private:
|
|||
void InsertGuiPair(GuiMsg code, const char * message);
|
||||
void InitGuiMessagesTab();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
||||
Languages()
|
||||
{
|
||||
current_country = en;
|
||||
// foo_return = 0;
|
||||
}
|
||||
|
||||
void SetCurrentLanguage(Country c)
|
||||
{
|
||||
// we are reading a language from *.ini file
|
||||
// and it is stored as a number
|
||||
|
||||
if( int(c) < 0 || int(c) >= (int)Languages::lastnotexisting )
|
||||
c = en;
|
||||
|
||||
current_country = c;
|
||||
}
|
||||
|
||||
void SelectCurrentLanguage(const std::string & lang);
|
||||
|
||||
|
||||
Country GetCurrentLanguage()
|
||||
{
|
||||
return current_country;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
we're using some methods from this class simultaneously in two threads,
|
||||
this is to be sure that everything is initialized before the second thread is started
|
||||
|
||||
should be called before calling the second thread
|
||||
*/
|
||||
void InitAll()
|
||||
{
|
||||
InitErrorMessagesTab();
|
||||
InitGuiMessagesTab();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
long form of methods
|
||||
(with 'coutry')
|
||||
|
||||
these methods you can call from the second thread without having to
|
||||
calling StopCalculating() and StartCalculating() from the thread controller
|
||||
|
||||
the methods return only static value - remember to call InitAll() somewhere
|
||||
at the beginning e.g. in the first thread
|
||||
*/
|
||||
const char * ErrorMessage(Country country, ttmath::ErrorCode code);
|
||||
const char * ErrorMessage(ttmath::ErrorCode code);
|
||||
const char * GuiMessage(Country country, GuiMsg code);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
short form of methods
|
||||
(without 'country' - it's taken from a private variable 'current_country')
|
||||
|
||||
don't use these methods in the second thread - the parameter 'country' can be using
|
||||
by the first thread, although the 'country' is simply enum and should be atomic
|
||||
but in the future it may be changed
|
||||
*/
|
||||
const char * ErrorMessage(ttmath::ErrorCode code);
|
||||
const char * GuiMessage(GuiMsg code);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2008, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -42,10 +42,12 @@
|
|||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
template<typename ProcReturnType>
|
||||
class Messages
|
||||
{
|
||||
public:
|
||||
typedef BOOL (*MessageFunction)(HWND, UINT, WPARAM, LPARAM);
|
||||
typedef ProcReturnType (*MessageFunction)(HWND, UINT, WPARAM, LPARAM);
|
||||
typedef std::map<UINT, MessageFunction> MessageTable;
|
||||
|
||||
|
||||
|
@ -61,19 +63,28 @@ public:
|
|||
}
|
||||
|
||||
|
||||
bool Call(UINT key, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
ProcReturnType Call(UINT key, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool * method_exists = 0)
|
||||
{
|
||||
MessageTable::iterator i = message_table.find(key);
|
||||
typename MessageTable::iterator i = message_table.find(key);
|
||||
|
||||
if( i == message_table.end() )
|
||||
{
|
||||
if( method_exists )
|
||||
*method_exists = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if( method_exists )
|
||||
*method_exists = true;
|
||||
|
||||
return i->second(hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
bool IsMessage(UINT key)
|
||||
{
|
||||
MessageTable::iterator i = message_table.find(key);
|
||||
typename MessageTable::iterator i = message_table.find(key);
|
||||
|
||||
if( i == message_table.end() )
|
||||
return false;
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2010, Tomasz Sowa
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
int ToLower(int c)
|
||||
{
|
||||
if( c>='A' && c<='Z' )
|
||||
return c - 'A' + 'a';
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
this function compares two strings
|
||||
(case insensitive)
|
||||
*/
|
||||
bool EqualStrings(const char * str1, const char * str2)
|
||||
{
|
||||
for( ; ToLower(*str1) == ToLower(*str2) ; ++str1, ++str2 )
|
||||
if( *str1 == 0 )
|
||||
return true; // *str2 will be 0 too
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
returning true if short_str is a substring of long_str (no case-sensitive)
|
||||
*/
|
||||
bool IsSubStringNoCase(const char * short_str, const char * long_str)
|
||||
{
|
||||
while( *short_str && *long_str && ToLower(*short_str) == ToLower(*long_str) )
|
||||
{
|
||||
++short_str;
|
||||
++long_str;
|
||||
}
|
||||
|
||||
if( *short_str == 0 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2010, Tomasz Sowa
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef headerfilemisc
|
||||
#define headerfilemisc
|
||||
|
||||
int ToLower(int c);
|
||||
bool EqualStrings(const char * str1, const char * str2);
|
||||
bool IsSubStringNoCase(const char * short_str, const char * long_str);
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,943 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2010, Tomasz Sowa
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <ttmath/ttmath.h>
|
||||
#include <shlobj.h>
|
||||
#include <fstream>
|
||||
#include "programresources.h"
|
||||
#include "resource.h"
|
||||
#include "messages.h"
|
||||
#include "bigtypes.h"
|
||||
#include "pad.h"
|
||||
|
||||
|
||||
namespace Pad
|
||||
{
|
||||
HWND edit;
|
||||
WNDPROC old_edit_proc;
|
||||
std::string parse_string;
|
||||
int precision;
|
||||
HFONT font;
|
||||
|
||||
int base_input;
|
||||
int base_output;
|
||||
bool always_scientific;
|
||||
int when_scientific;
|
||||
int rounding;
|
||||
bool remove_zeroes;
|
||||
int angle_deg_rad_grad;
|
||||
|
||||
char decimal_point;
|
||||
char grouping;
|
||||
char input_comma1;
|
||||
char input_comma2;
|
||||
char param_sep;
|
||||
|
||||
int grouping_digits;
|
||||
|
||||
Languages::Country country;
|
||||
|
||||
int last_variables_id;
|
||||
int last_functions_id;
|
||||
ttmath::Objects * variables;
|
||||
ttmath::Objects * functions;
|
||||
|
||||
ttmath::ErrorCode code;
|
||||
bool calculated;
|
||||
|
||||
std::string res, res2;
|
||||
std::string file_name;
|
||||
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
ttmath::Parser<TTMathBig1> parser1;
|
||||
ttmath::Parser<TTMathBig2> parser2;
|
||||
ttmath::Parser<TTMathBig3> parser3;
|
||||
#else
|
||||
ttmath::Parser<TTMathBig1> parser1;
|
||||
#endif
|
||||
|
||||
|
||||
void PutChars(const char * str)
|
||||
{
|
||||
SendMessage(edit, EM_REPLACESEL, true, (LPARAM)str);
|
||||
}
|
||||
|
||||
|
||||
void PutChars(std::string & str)
|
||||
{
|
||||
PutChars(str.c_str());
|
||||
}
|
||||
|
||||
|
||||
void PutOverflowMsg()
|
||||
{
|
||||
PutChars(GetPrgRes()->GetLanguages()->ErrorMessage(country, ttmath::err_overflow));
|
||||
PutChars("\r\n");
|
||||
}
|
||||
|
||||
|
||||
template<typename ValueType>
|
||||
void PutResultFromParser(ttmath::Parser<ValueType> & matparser)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
|
||||
res.clear();
|
||||
res2.clear();
|
||||
|
||||
for(i=0 ; i<matparser.stack.size() ; ++i)
|
||||
{
|
||||
try
|
||||
{
|
||||
ValueType result = matparser.stack[i].value;
|
||||
|
||||
ttmath::Conv conv;
|
||||
|
||||
conv.base = base_output;
|
||||
conv.scient = always_scientific;
|
||||
conv.scient_from = when_scientific;
|
||||
conv.round = rounding;
|
||||
conv.trim_zeroes = remove_zeroes;
|
||||
conv.comma = decimal_point;
|
||||
conv.group = grouping;
|
||||
conv.group_digits = grouping_digits;
|
||||
|
||||
if( result.ToString(res2, conv) )
|
||||
res2 = GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
res2 = GetPrgRes()->GetLanguages()->ErrorMessage(country, ttmath::err_internal_error);
|
||||
}
|
||||
|
||||
res += res2;
|
||||
|
||||
if( i < matparser.stack.size()-1 )
|
||||
res += "\r\n";
|
||||
}
|
||||
|
||||
res += ' ';
|
||||
PutChars(res);
|
||||
}
|
||||
|
||||
|
||||
void PutResult()
|
||||
{
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
switch( precision )
|
||||
{
|
||||
case 0:
|
||||
PutResultFromParser(parser1);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
PutResultFromParser(parser2);
|
||||
break;
|
||||
|
||||
default:
|
||||
PutResultFromParser(parser3);
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
PutResultFromParser(parser1);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
// line - index of a line -- as you see it on the edit control
|
||||
// (if the text is wrapped then the line is larger)
|
||||
void GetParseString(const char * buf, int line)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = SendMessage(edit, EM_LINEINDEX, line, 0);
|
||||
// first_line_char takes into consideration \r\n characters
|
||||
|
||||
if( i < 0 )
|
||||
// something wrong
|
||||
return;
|
||||
|
||||
// looking for the beginning of the line (lines can be wrapped)
|
||||
for( ; i>0 && buf[i-1]!=10 ; --i);
|
||||
|
||||
// copying the whole line
|
||||
for( ; buf[i]!=0 && buf[i]!='\r' && buf[i]!='\n' ; ++i )
|
||||
parse_string += buf[i];
|
||||
}
|
||||
|
||||
|
||||
void GetParseString()
|
||||
{
|
||||
int line;
|
||||
|
||||
parse_string.clear();
|
||||
|
||||
// index of a last line to parse (-1 because the ENTER has been put)
|
||||
line = SendMessage(edit, EM_LINEFROMCHAR, -1, 0) - 1;
|
||||
|
||||
if( line < 0 )
|
||||
// something wrong
|
||||
return;
|
||||
|
||||
|
||||
HLOCAL handle = (HLOCAL)SendMessage(edit, EM_GETHANDLE, 0, 0);
|
||||
|
||||
if( handle == 0 )
|
||||
// something wrong
|
||||
return;
|
||||
|
||||
const char * buf = (const char*)LocalLock(handle);
|
||||
|
||||
if( buf )
|
||||
GetParseString(buf, line);
|
||||
|
||||
LocalUnlock(handle);
|
||||
}
|
||||
|
||||
|
||||
template<class ValueType>
|
||||
void ParseString(ttmath::Parser<ValueType> & matparser)
|
||||
{
|
||||
matparser.SetBase(base_input);
|
||||
matparser.SetDegRadGrad(angle_deg_rad_grad);
|
||||
matparser.SetComma(input_comma1, input_comma2);
|
||||
matparser.SetGroup(grouping);
|
||||
matparser.SetParamSep(param_sep);
|
||||
|
||||
matparser.SetVariables(variables);
|
||||
matparser.SetFunctions(functions);
|
||||
|
||||
code = matparser.Parse(parse_string.c_str());
|
||||
|
||||
calculated = matparser.Calculated();
|
||||
}
|
||||
|
||||
|
||||
void SetParameters()
|
||||
{
|
||||
base_input = GetPrgRes()->GetBaseInput();
|
||||
base_output = GetPrgRes()->GetBaseOutput();
|
||||
always_scientific = GetPrgRes()->GetDisplayAlwaysScientific();
|
||||
when_scientific = GetPrgRes()->GetDisplayWhenScientific();
|
||||
rounding = GetPrgRes()->GetDisplayRounding();
|
||||
precision = GetPrgRes()->GetPrecision();
|
||||
remove_zeroes = GetPrgRes()->GetRemovingZeroes();
|
||||
angle_deg_rad_grad = GetPrgRes()->GetDegRadGrad();
|
||||
country = GetPrgRes()->GetLanguages()->GetCurrentLanguage();
|
||||
decimal_point = GetPrgRes()->GetDecimalPointChar();
|
||||
grouping = GetPrgRes()->GetGroupingChar();
|
||||
grouping_digits = GetPrgRes()->GetGroupingDigits();
|
||||
param_sep = GetPrgRes()->GetParamSepChar();
|
||||
|
||||
GetPrgRes()->GetInputDecimalPointChar(&input_comma1, &input_comma2);
|
||||
|
||||
variables = GetPrgRes()->GetVariables();
|
||||
functions = GetPrgRes()->GetFunctions();
|
||||
}
|
||||
|
||||
|
||||
void ParseString()
|
||||
{
|
||||
if( parse_string.empty() )
|
||||
return;
|
||||
|
||||
SetParameters();
|
||||
|
||||
try
|
||||
{
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
switch( precision )
|
||||
{
|
||||
case 0:
|
||||
ParseString(parser1);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ParseString(parser2);
|
||||
break;
|
||||
|
||||
default:
|
||||
ParseString(parser3);
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
ParseString(parser1);
|
||||
#endif
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
code = ttmath::err_internal_error;
|
||||
}
|
||||
|
||||
|
||||
if( code==ttmath::err_ok && calculated )
|
||||
PutResult();
|
||||
else
|
||||
if( code==ttmath::err_overflow )
|
||||
PutOverflowMsg();
|
||||
}
|
||||
|
||||
|
||||
LRESULT EditReturnPressed(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
DWORD sel_start, sel_end;
|
||||
|
||||
SendMessage(edit, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
|
||||
|
||||
// putting the ENTER
|
||||
LRESULT res = CallWindowProc(old_edit_proc, hwnd, msg, wParam, lParam);
|
||||
|
||||
if( sel_start != sel_end )
|
||||
// something was selected
|
||||
return res;
|
||||
|
||||
GetParseString();
|
||||
ParseString();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LRESULT EditSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch( msg )
|
||||
{
|
||||
case WM_CHAR:
|
||||
if( wParam == VK_RETURN )
|
||||
{
|
||||
return EditReturnPressed(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return CallWindowProc(old_edit_proc, hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inline void SetMenuLanguageItem(HMENU menu, DWORD menu_id, Languages::GuiMsg msg)
|
||||
{
|
||||
Languages * pLang = GetPrgRes()->GetLanguages();
|
||||
|
||||
ModifyMenu(menu, menu_id, MF_BYCOMMAND|MF_STRING, menu_id, pLang->GuiMessage(msg) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SetPadMenuLanguage(HWND hWnd)
|
||||
{
|
||||
HMENU menu = GetMenu(hWnd);
|
||||
|
||||
if( !menu )
|
||||
return;
|
||||
|
||||
MENUITEMINFO mi;
|
||||
mi.cbSize = sizeof(mi);
|
||||
mi.fMask = MIIM_TYPE;
|
||||
mi.fType = MFT_STRING;
|
||||
|
||||
// on popup menus we're using indexes because they don't want to work correctly
|
||||
// with the identifiers
|
||||
mi.dwTypeData = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::pad_menu_file) );
|
||||
SetMenuItemInfo(menu, MENUPAD_FILE_INDEX, true, &mi);
|
||||
|
||||
mi.dwTypeData = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::pad_menu_edit) );
|
||||
SetMenuItemInfo(menu, MENUPAD_EDIT_INDEX, true, &mi);
|
||||
|
||||
SetMenuLanguageItem(menu, MENUPAD_FILE_OPEN, Languages::pad_menu_file_open);
|
||||
SetMenuLanguageItem(menu, MENUPAD_FILE_SAVE, Languages::pad_menu_file_saveas);
|
||||
SetMenuLanguageItem(menu, MENUPAD_FILE_CLOSE, Languages::pad_menu_file_close);
|
||||
SetMenuLanguageItem(menu, MENUPAD_EDIT_UNDO, Languages::pad_menu_edit_undo);
|
||||
SetMenuLanguageItem(menu, MENUPAD_EDIT_CUT, Languages::pad_menu_edit_cut);
|
||||
SetMenuLanguageItem(menu, MENUPAD_EDIT_COPY, Languages::pad_menu_edit_copy);
|
||||
SetMenuLanguageItem(menu, MENUPAD_EDIT_PASTE, Languages::pad_menu_edit_paste);
|
||||
SetMenuLanguageItem(menu, MENUPAD_EDIT_DEL, Languages::pad_menu_edit_del);
|
||||
SetMenuLanguageItem(menu, MENUPAD_EDIT_SELECTALL, Languages::pad_menu_edit_select_all);
|
||||
|
||||
DrawMenuBar(hWnd);
|
||||
}
|
||||
|
||||
|
||||
LRESULT PadCreate(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
edit = CreateWindow("edit", "",
|
||||
WS_VISIBLE | WS_CHILD | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL,
|
||||
0, 0, 100, 100, hwnd, 0, GetPrgRes()->GetInstance(), 0);
|
||||
|
||||
if( !edit )
|
||||
return 0;
|
||||
|
||||
GetPrgRes()->SetPadEdit(edit);
|
||||
|
||||
old_edit_proc = (WNDPROC)SetWindowLong(edit, GWL_WNDPROC, (LONG)EditSubclass);
|
||||
|
||||
// 65535 - 64KB
|
||||
// we're using some kind of messages which operates only on 64KB
|
||||
SendMessage(edit, EM_SETLIMITTEXT, 65535 - 5, 0);
|
||||
|
||||
if( font != 0 )
|
||||
SendMessage(edit, WM_SETFONT, (WPARAM)font, 0);
|
||||
|
||||
SetPadLanguage();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LRESULT PadMove(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
RECT r;
|
||||
|
||||
GetWindowRect(hwnd,&r);
|
||||
|
||||
GetPrgRes()->SetPadXPos( r.left );
|
||||
GetPrgRes()->SetPadYPos( r.top );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LRESULT PadSize(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// client coordinates
|
||||
int cx = LOWORD(lParam);
|
||||
int cy = HIWORD(lParam);
|
||||
int fwSizeType = int(wParam);
|
||||
RECT r;
|
||||
|
||||
|
||||
if( fwSizeType == SIZE_MAXIMIZED )
|
||||
GetPrgRes()->SetPadMaximized(true);
|
||||
else
|
||||
if( fwSizeType == SIZE_RESTORED )
|
||||
GetPrgRes()->SetPadMaximized(false);
|
||||
|
||||
MoveWindow(edit, 0, 0, cx, cy, true);
|
||||
|
||||
if( fwSizeType != SIZE_MINIMIZED && fwSizeType != SIZE_MAXIMIZED )
|
||||
{
|
||||
GetWindowRect(hwnd, &r);
|
||||
GetPrgRes()->SetPadXSize( r.right - r.left );
|
||||
GetPrgRes()->SetPadYSize( r.bottom - r.top );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LRESULT PadClose(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
GetPrgRes()->ShowPad( false );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LRESULT PadFocus(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
SetFocus(edit);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool OpenDialog(HWND hwnd)
|
||||
{
|
||||
OPENFILENAME o;
|
||||
char buf[MAX_PATH];
|
||||
|
||||
buf[0] = 0;
|
||||
|
||||
o.lStructSize = sizeof(o);
|
||||
o.hwndOwner = hwnd;
|
||||
o.hInstance = GetPrgRes()->GetInstance();
|
||||
o.lpstrFilter = "*.*\0*.*\0";
|
||||
o.lpstrCustomFilter = 0;
|
||||
o.nMaxCustFilter = 0;
|
||||
o.nFilterIndex = 1;
|
||||
o.lpstrFile = buf;
|
||||
o.nMaxFile = MAX_PATH;
|
||||
o.lpstrFileTitle = 0;
|
||||
o.nMaxFileTitle = 0;
|
||||
o.lpstrInitialDir = 0;
|
||||
o.lpstrTitle = 0;
|
||||
o.Flags = OFN_PATHMUSTEXIST;
|
||||
o.nFileOffset = 0;
|
||||
o.nFileExtension = 0;
|
||||
o.lpstrDefExt = 0;
|
||||
o.lCustData = 0;
|
||||
o.lpfnHook = 0;
|
||||
o.lpTemplateName = 0;
|
||||
|
||||
|
||||
if( GetOpenFileName(&o) )
|
||||
{
|
||||
file_name = buf;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// testing files which have only one 10 at the end of a line (unix mode)
|
||||
void CorrectUnixMode()
|
||||
{
|
||||
bool was_r = false;
|
||||
|
||||
for(size_t i=0 ; i<res.size() ; ++i)
|
||||
{
|
||||
if( res[i]==10 && !was_r )
|
||||
{
|
||||
res.insert(res.begin()+i, 13);
|
||||
++i;
|
||||
}
|
||||
else
|
||||
{
|
||||
was_r = res[i] == 13;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LoadFromFile(HWND hwnd, std::ifstream & file)
|
||||
{
|
||||
char buf[64];
|
||||
std::streamsize size;
|
||||
|
||||
res.clear();
|
||||
|
||||
do
|
||||
{
|
||||
file.read(buf, sizeof(buf)-1);
|
||||
|
||||
size = file.gcount();
|
||||
buf[size] = 0;
|
||||
res += buf;
|
||||
}
|
||||
while( !file.eof() );
|
||||
|
||||
CorrectUnixMode();
|
||||
SetWindowText(edit, res.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LRESULT PadOpen(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if( !OpenDialog(hwnd) )
|
||||
return 0;
|
||||
|
||||
|
||||
std::ifstream file(file_name.c_str(), std::ios_base::in | std::ios_base::binary);
|
||||
Languages * lang = GetPrgRes()->GetLanguages();
|
||||
|
||||
if( !file )
|
||||
{
|
||||
MessageBox(hwnd, lang->GuiMessage(Languages::cannot_open_file),
|
||||
lang->GuiMessage(Languages::message_box_error_caption), MB_ICONERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
file.seekg(0, std::ios::end);
|
||||
std::ifstream::pos_type pos = file.tellg();
|
||||
|
||||
if( pos > 65530 )
|
||||
{
|
||||
MessageBox(hwnd, lang->GuiMessage(Languages::file_too_long),
|
||||
lang->GuiMessage(Languages::message_box_error_caption), MB_ICONERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
file.seekg(0);
|
||||
LoadFromFile(hwnd, file);
|
||||
|
||||
file.close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool SaveDialog(HWND hwnd)
|
||||
{
|
||||
OPENFILENAME o;
|
||||
char buf[MAX_PATH];
|
||||
|
||||
sprintf(buf, "ttcalc.txt");
|
||||
|
||||
o.lStructSize = sizeof(o);
|
||||
o.hwndOwner = hwnd;
|
||||
o.hInstance = GetPrgRes()->GetInstance();
|
||||
o.lpstrFilter = "*.*\0*.*\0";
|
||||
o.lpstrCustomFilter = 0;
|
||||
o.nMaxCustFilter = 0;
|
||||
o.nFilterIndex = 1;
|
||||
o.lpstrFile = buf;
|
||||
o.nMaxFile = MAX_PATH;
|
||||
o.lpstrFileTitle = 0;
|
||||
o.nMaxFileTitle = 0;
|
||||
o.lpstrInitialDir = 0;
|
||||
o.lpstrTitle = 0;
|
||||
o.Flags = OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST;
|
||||
o.nFileOffset = 0;
|
||||
o.nFileExtension = 0;
|
||||
o.lpstrDefExt = 0;
|
||||
o.lCustData = 0;
|
||||
o.lpfnHook = 0;
|
||||
o.lpTemplateName = 0;
|
||||
|
||||
|
||||
if( GetSaveFileName(&o) )
|
||||
{
|
||||
file_name = buf;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void SaveBuffer(HWND hwnd, const char * buf)
|
||||
{
|
||||
std::ofstream file(file_name.c_str(), std::ios_base::out | std::ios_base::binary);
|
||||
|
||||
if( !file )
|
||||
{
|
||||
Languages * lang = GetPrgRes()->GetLanguages();
|
||||
MessageBox(hwnd, lang->GuiMessage(Languages::cannot_save_file),
|
||||
lang->GuiMessage(Languages::message_box_error_caption), MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
for( ; *buf ; ++buf )
|
||||
file.put(*buf);
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
LRESULT PadSave(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if( !SaveDialog(hwnd) )
|
||||
return 0;
|
||||
|
||||
Languages * lang = GetPrgRes()->GetLanguages();
|
||||
HLOCAL handle = (HLOCAL)SendMessage(edit, EM_GETHANDLE, 0, 0);
|
||||
|
||||
if( handle == 0 )
|
||||
{
|
||||
MessageBox(hwnd, lang->GuiMessage(Languages::other_error),
|
||||
lang->GuiMessage(Languages::message_box_error_caption), MB_ICONERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * buf = (const char*)LocalLock(handle);
|
||||
|
||||
if( buf )
|
||||
SaveBuffer(hwnd, buf);
|
||||
else
|
||||
MessageBox(hwnd, lang->GuiMessage(Languages::other_error),
|
||||
lang->GuiMessage(Languages::message_box_error_caption), MB_ICONERROR);
|
||||
|
||||
LocalUnlock(handle);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LRESULT PadNew(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
SetWindowText(edit, "");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LRESULT PadUndo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
SendMessage(edit, WM_UNDO, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT PadCut(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
SendMessage(edit, WM_CUT, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LRESULT PadCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
SendMessage(edit, WM_COPY, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LRESULT PadPaste(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
SendMessage(edit, WM_PASTE, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LRESULT PadDel(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
SendMessage(edit, EM_REPLACESEL, true, (LPARAM)"");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
LRESULT PadSelectAll(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
SendMessage(edit, EM_SETSEL, 0, -1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void PadInitMenuEdit(HMENU menu)
|
||||
{
|
||||
DWORD sel_start, sel_end;
|
||||
bool can_undo = SendMessage(edit, EM_CANUNDO, 0 ,0);
|
||||
|
||||
if( can_undo )
|
||||
EnableMenuItem(menu,MENUPAD_EDIT_UNDO,MF_BYCOMMAND | MF_ENABLED);
|
||||
else
|
||||
EnableMenuItem(menu,MENUPAD_EDIT_UNDO,MF_BYCOMMAND | MF_GRAYED);
|
||||
|
||||
|
||||
SendMessage(edit, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end);
|
||||
|
||||
if( sel_start == sel_end )
|
||||
{
|
||||
EnableMenuItem(menu,MENUPAD_EDIT_CUT, MF_BYCOMMAND | MF_GRAYED);
|
||||
EnableMenuItem(menu,MENUPAD_EDIT_COPY,MF_BYCOMMAND | MF_GRAYED);
|
||||
EnableMenuItem(menu,MENUPAD_EDIT_DEL, MF_BYCOMMAND | MF_GRAYED);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableMenuItem(menu,MENUPAD_EDIT_CUT, MF_BYCOMMAND | MF_ENABLED);
|
||||
EnableMenuItem(menu,MENUPAD_EDIT_COPY,MF_BYCOMMAND | MF_ENABLED);
|
||||
EnableMenuItem(menu,MENUPAD_EDIT_DEL, MF_BYCOMMAND | MF_ENABLED);
|
||||
}
|
||||
|
||||
if( IsClipboardFormatAvailable(CF_TEXT) )
|
||||
EnableMenuItem(menu,MENUPAD_EDIT_PASTE,MF_BYCOMMAND | MF_ENABLED);
|
||||
else
|
||||
EnableMenuItem(menu,MENUPAD_EDIT_PASTE,MF_BYCOMMAND | MF_GRAYED);
|
||||
}
|
||||
|
||||
|
||||
LRESULT PadInitMenuPopUp(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HMENU menu = (HMENU) wParam;
|
||||
int index = LOWORD(lParam);
|
||||
|
||||
if( index == MENUPAD_EDIT_INDEX )
|
||||
PadInitMenuEdit(menu);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreatePadCommandTable(Messages<LRESULT> & messages)
|
||||
{
|
||||
messages.Associate(MENUPAD_FILE_NEW, PadNew);
|
||||
messages.Associate(MENUPAD_FILE_OPEN, PadOpen);
|
||||
messages.Associate(MENUPAD_FILE_SAVE, PadSave);
|
||||
messages.Associate(MENUPAD_FILE_CLOSE, PadClose);
|
||||
messages.Associate(MENUPAD_EDIT_UNDO, PadUndo);
|
||||
messages.Associate(MENUPAD_EDIT_CUT, PadCut);
|
||||
messages.Associate(MENUPAD_EDIT_COPY, PadCopy);
|
||||
messages.Associate(MENUPAD_EDIT_PASTE, PadPaste);
|
||||
messages.Associate(MENUPAD_EDIT_DEL, PadDel);
|
||||
messages.Associate(MENUPAD_EDIT_SELECTALL, PadSelectAll);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LRESULT PadCommand(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static Messages<LRESULT> messages;
|
||||
bool method_exists;
|
||||
LRESULT res;
|
||||
|
||||
if( messages.Empty() )
|
||||
// initiation
|
||||
CreatePadCommandTable(messages);
|
||||
|
||||
res = messages.Call(LOWORD(wParam), hwnd, msg, wParam, lParam, &method_exists);
|
||||
|
||||
if( !method_exists )
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void CreatePadMessagesTable(Messages<LRESULT> & messages)
|
||||
{
|
||||
messages.Associate(WM_CREATE, PadCreate);
|
||||
messages.Associate(WM_MOVE, PadMove);
|
||||
messages.Associate(WM_SIZE, PadSize);
|
||||
messages.Associate(WM_CLOSE, PadClose);
|
||||
messages.Associate(WM_SETFOCUS, PadFocus);
|
||||
messages.Associate(WM_COMMAND, PadCommand);
|
||||
messages.Associate(WM_INITMENUPOPUP, PadInitMenuPopUp);
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK WindowPadProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static Messages<LRESULT> messages;
|
||||
bool method_exists;
|
||||
LRESULT res;
|
||||
|
||||
if( messages.Empty() )
|
||||
// initiation
|
||||
CreatePadMessagesTable(messages);
|
||||
|
||||
res = messages.Call(msg, hwnd, msg, wParam, lParam, &method_exists);
|
||||
|
||||
if( !method_exists )
|
||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ATOM RegisterPadClass(const char * ttcalc_pad_class_name)
|
||||
{
|
||||
WNDCLASS w;
|
||||
|
||||
w.style = 0;
|
||||
w.lpfnWndProc = WindowPadProc;
|
||||
w.cbClsExtra = 0;
|
||||
w.cbWndExtra = 0;
|
||||
w.hInstance = GetPrgRes()->GetInstance();
|
||||
w.hIcon = LoadIcon(GetPrgRes()->GetInstance(), MAKEINTRESOURCE(IDI_ICON2));
|
||||
w.hCursor = 0;
|
||||
w.hbrBackground = (HBRUSH)(COLOR_BACKGROUND+1);
|
||||
w.lpszMenuName = MAKEINTRESOURCE(IDR_MENU2);
|
||||
w.lpszClassName = ttcalc_pad_class_name;
|
||||
|
||||
return RegisterClass(&w);
|
||||
}
|
||||
|
||||
|
||||
} // namespace Pad
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool CreatePadWindow()
|
||||
{
|
||||
using namespace Pad;
|
||||
|
||||
static char ttcalc_pad_class_name[] = "TTCalcPadWindow";
|
||||
ATOM a = RegisterPadClass(ttcalc_pad_class_name);
|
||||
|
||||
if( a == 0 )
|
||||
return false;
|
||||
|
||||
bool pad_maximized_from_file = GetPrgRes()->GetPadMaximized();
|
||||
// CreateWindow() would change maximizing
|
||||
|
||||
Languages * pl = GetPrgRes()->GetLanguages();
|
||||
|
||||
font = CreateFont(0, 0, 0, 0, FW_NORMAL, false, false, false,
|
||||
ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, DEFAULT_PITCH, "Ms Shell Dlg");
|
||||
|
||||
|
||||
HWND pad = CreateWindowEx(WS_EX_CLIENTEDGE, ttcalc_pad_class_name,
|
||||
pl->GuiMessage(Languages::pad_title),
|
||||
WS_OVERLAPPEDWINDOW | WS_POPUPWINDOW ,
|
||||
GetPrgRes()->GetPadXPos(), GetPrgRes()->GetPadYPos(),
|
||||
GetPrgRes()->GetPadXSize(), GetPrgRes()->GetPadYSize(),
|
||||
0 /*GetPrgRes()->GetMainWindow()*/, 0, GetPrgRes()->GetInstance(), 0);
|
||||
|
||||
GetPrgRes()->SetPadWindow(pad);
|
||||
SetPadLanguage();
|
||||
GetPrgRes()->SetPadMaximized( pad_maximized_from_file );
|
||||
GetPrgRes()->ShowPad( GetPrgRes()->IsPadVisible() );
|
||||
|
||||
return pad!=0 && edit!=0;
|
||||
}
|
||||
|
||||
|
||||
void DestroyPadWindow()
|
||||
{
|
||||
using namespace Pad;
|
||||
|
||||
DeleteObject(font);
|
||||
}
|
||||
|
||||
|
||||
void SetPadLanguage()
|
||||
{
|
||||
using namespace Pad;
|
||||
|
||||
HWND pad = GetPrgRes()->GetPadWindow();
|
||||
Languages * pl = GetPrgRes()->GetLanguages();
|
||||
|
||||
SetPadMenuLanguage(pad);
|
||||
SetWindowText(pad, pl->GuiMessage(Languages::pad_title));
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2009, Tomasz Sowa
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef headerfilepad
|
||||
#define headerfilepad
|
||||
|
||||
|
||||
|
||||
bool CreatePadWindow();
|
||||
void DestroyPadWindow();
|
||||
void SetPadLanguage();
|
||||
|
||||
|
||||
#endif
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -37,32 +37,26 @@
|
|||
|
||||
#include "compileconfig.h"
|
||||
#include "parsermanager.h"
|
||||
#include "tabs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
ParserManager::ParserManager() : buffer_len(2048)
|
||||
ParserManager::ParserManager() : buffer_len(20480)
|
||||
{
|
||||
buffer = 0;
|
||||
base_input = base_output = 10;
|
||||
always_scientific = 0;
|
||||
when_scientific = 15;
|
||||
rounding = -2;
|
||||
last_variables_id = 0;
|
||||
last_functions_id = 0;
|
||||
}
|
||||
|
||||
|
||||
ParserManager::ParserManager(const ParserManager & p) : buffer_len(p.buffer_len)
|
||||
{
|
||||
buffer = 0;
|
||||
base_input = p.base_input;
|
||||
base_output = p.base_output;
|
||||
always_scientific = p.always_scientific;
|
||||
when_scientific = p.when_scientific;
|
||||
rounding = p.rounding;
|
||||
}
|
||||
|
||||
|
||||
ParserManager & ParserManager::operator=(const ParserManager & p)
|
||||
ParserManager & ParserManager::operator=(const ParserManager &)
|
||||
{
|
||||
buffer = 0;
|
||||
|
||||
|
@ -82,27 +76,34 @@ ttmath::ErrorCode ParserManager::GetLastCode()
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ttmath::ErrorCode ParserManager::Parse()
|
||||
{
|
||||
try
|
||||
{
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
switch( precision )
|
||||
{
|
||||
case 0:
|
||||
parser1.SetBase(base_input);
|
||||
code = parser1.Parse(buffer);
|
||||
Parse(parser1);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
parser2.SetBase(base_input);
|
||||
code = parser2.Parse(buffer);
|
||||
Parse(parser2);
|
||||
break;
|
||||
|
||||
default:
|
||||
parser3.SetBase(base_input);
|
||||
code = parser3.Parse(buffer);
|
||||
Parse(parser3);
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
Parse(parser1);
|
||||
|
||||
#endif
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
@ -126,19 +127,37 @@ unsigned int i;
|
|||
|
||||
//
|
||||
|
||||
variables = *GetPrgRes()->GetVariables();
|
||||
functions = *GetPrgRes()->GetFunctions();
|
||||
if( GetPrgRes()->GetVariablesId() != last_variables_id )
|
||||
{
|
||||
variables = *GetPrgRes()->GetVariables();
|
||||
last_variables_id = GetPrgRes()->GetVariablesId();
|
||||
}
|
||||
|
||||
//
|
||||
base_input = GetPrgRes()->GetBaseInput();
|
||||
base_output = GetPrgRes()->GetBaseOutput();
|
||||
if( GetPrgRes()->GetFunctionsId() != last_functions_id )
|
||||
{
|
||||
functions = *GetPrgRes()->GetFunctions();
|
||||
last_functions_id = GetPrgRes()->GetFunctionsId();
|
||||
}
|
||||
|
||||
always_scientific = GetPrgRes()->GetDisplayAlwaysScientific();
|
||||
when_scientific = GetPrgRes()->GetDisplayWhenScientific();
|
||||
rounding = GetPrgRes()->GetDisplayRounding();
|
||||
precision = GetPrgRes()->GetPrecision();
|
||||
|
||||
country = GetPrgRes()->GetLanguages()->GetCurrentLanguage();
|
||||
base_input = GetPrgRes()->GetBaseInput();
|
||||
base_output = GetPrgRes()->GetBaseOutput();
|
||||
always_scientific = GetPrgRes()->GetDisplayAlwaysScientific();
|
||||
when_scientific = GetPrgRes()->GetDisplayWhenScientific();
|
||||
rounding = GetPrgRes()->GetDisplayRounding();
|
||||
precision = GetPrgRes()->GetPrecision();
|
||||
remove_zeroes = GetPrgRes()->GetRemovingZeroes();
|
||||
angle_deg_rad_grad = GetPrgRes()->GetDegRadGrad();
|
||||
country = GetPrgRes()->GetLanguages()->GetCurrentLanguage();
|
||||
decimal_point = GetPrgRes()->GetDecimalPointChar();
|
||||
grouping = GetPrgRes()->GetGroupingChar();
|
||||
grouping_digits = GetPrgRes()->GetGroupingDigits();
|
||||
param_sep = GetPrgRes()->GetParamSepChar();
|
||||
|
||||
GetPrgRes()->GetInputDecimalPointChar(&input_comma1, &input_comma2);
|
||||
|
||||
conv_type = GetPrgRes()->GetConvert()->GetCurrentType();
|
||||
GetPrgRes()->GetConvert()->GetCurrentUnit(conv_type, conv_input_unit, conv_output_unit);
|
||||
}
|
||||
|
||||
|
||||
|
@ -151,6 +170,8 @@ void ParserManager::Init()
|
|||
parser1.SetVariables( &variables );
|
||||
parser1.SetFunctions( &functions );
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
parser2.SetStopObject( GetPrgRes()->GetThreadController()->GetStopObject() );
|
||||
parser2.SetVariables( &variables );
|
||||
parser2.SetFunctions( &functions );
|
||||
|
@ -158,13 +179,17 @@ void ParserManager::Init()
|
|||
parser3.SetStopObject( GetPrgRes()->GetThreadController()->GetStopObject() );
|
||||
parser3.SetVariables( &variables );
|
||||
parser3.SetFunctions( &functions );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void ParserManager::PrintResult()
|
||||
int ParserManager::PrintResult()
|
||||
{
|
||||
if( code == ttmath::err_ok )
|
||||
{
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
switch( precision )
|
||||
{
|
||||
case 0:
|
||||
|
@ -176,29 +201,69 @@ void ParserManager::PrintResult()
|
|||
default:
|
||||
return PrintResult(parser3);
|
||||
}
|
||||
|
||||
#else
|
||||
return PrintResult(parser1);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// we can call GetPrgRes() here because we're reading
|
||||
// static value like GetMainWindow() which are set only once
|
||||
// at the beginning of the program and will never be changed later
|
||||
// by the first thread
|
||||
|
||||
// note that we're using a long form of a method ErrorMessage i.g.
|
||||
// ErrorMessage(Country country, ttmath::ErrorCode code)
|
||||
// and not ErrorMessage(ttmath::ErrorCode code)
|
||||
// because someone can change the country when we're calling this method
|
||||
// (in the main thread) and the latter function would be using its own
|
||||
// 'current_country' value which could be inconsistent
|
||||
|
||||
// now, displying an error message is making in the main windows
|
||||
// (after pressing a special key)
|
||||
|
||||
/*
|
||||
SetDlgItemText(
|
||||
GetPrgRes()->GetMainWindow(),
|
||||
IDC_OUTPUT_EDIT,
|
||||
GetPrgRes()->GetLanguages()->ErrorMessage(country, code) );
|
||||
*/
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void ParserManager::ShowConvertingInfo()
|
||||
{
|
||||
HWND conv_tab = GetPrgRes()->GetTabWindow(TabWindowFunctions::tab_convert);
|
||||
|
||||
if( conv_type==0 || conv_input_unit==-1 || conv_output_unit==-1 ||
|
||||
conv_input_unit == conv_output_unit )
|
||||
{
|
||||
SetDlgItemText(conv_tab, IDC_EDIT_OUTPUT_INFO, "");
|
||||
return;
|
||||
}
|
||||
|
||||
Convert * pconv = GetPrgRes()->GetConvert();
|
||||
|
||||
// the first unit to the second
|
||||
|
||||
ttmath::Big<1,1> result;
|
||||
result.SetOne();
|
||||
std::string buffer1 = "1 ";
|
||||
buffer1 += pconv->GetUnitAbbr(country, conv_input_unit);
|
||||
buffer1 += " = ";
|
||||
|
||||
if( pconv->Conversion(conv_input_unit, conv_output_unit, result) )
|
||||
{
|
||||
SetDlgItemText(conv_tab, IDC_EDIT_OUTPUT_INFO, "overflow" );
|
||||
return;
|
||||
}
|
||||
|
||||
result.ToString(buffer2, 10, false, 3, -1, true);
|
||||
|
||||
buffer1 += buffer2;
|
||||
buffer1 += " ";
|
||||
buffer1 += pconv->GetUnitAbbr(country, conv_output_unit);
|
||||
|
||||
|
||||
// the second unit to the first
|
||||
|
||||
buffer1 += " 1 ";
|
||||
buffer1 += pconv->GetUnitAbbr(country, conv_output_unit);
|
||||
buffer1 += " = ";
|
||||
|
||||
result.SetOne();
|
||||
if( pconv->Conversion(conv_output_unit, conv_input_unit, result) )
|
||||
{
|
||||
SetDlgItemText(conv_tab, IDC_EDIT_OUTPUT_INFO, "overflow" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
result.ToString(buffer2, 10, false, 3, -1, true);
|
||||
|
||||
buffer1 += buffer2;
|
||||
buffer1 += " ";
|
||||
buffer1 += pconv->GetUnitAbbr(country, conv_input_unit);
|
||||
|
||||
SetDlgItemText(conv_tab, IDC_EDIT_OUTPUT_INFO, buffer1.c_str() );
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -44,9 +44,7 @@
|
|||
*/
|
||||
|
||||
#include "resource.h"
|
||||
#include <ttmath/ttmathparser.h>
|
||||
#include "programresources.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
@ -100,83 +98,154 @@ public:
|
|||
this method prints result
|
||||
(a correct value if was or an error instead)
|
||||
*/
|
||||
void PrintResult();
|
||||
int PrintResult();
|
||||
|
||||
|
||||
/*!
|
||||
this method prints the info about converting (on the converting tab)
|
||||
*/
|
||||
void ShowConvertingInfo();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
ttmath::Parser<ttmath::Big<1,3> > parser1;
|
||||
ttmath::Parser<ttmath::Big<2,6> > parser2;
|
||||
ttmath::Parser<ttmath::Big<3,9> > parser3;
|
||||
#ifndef TTCALC_PORTABLE
|
||||
ttmath::Parser<TTMathBig1> parser1;
|
||||
ttmath::Parser<TTMathBig2> parser2;
|
||||
ttmath::Parser<TTMathBig3> parser3;
|
||||
#else
|
||||
ttmath::Parser<TTMathBig1> parser1;
|
||||
#endif
|
||||
|
||||
ttmath::Objects variables, functions;
|
||||
int last_variables_id;
|
||||
int last_functions_id;
|
||||
|
||||
const unsigned int buffer_len;
|
||||
char * buffer;
|
||||
|
||||
int base_input, base_output;
|
||||
int conv_type, conv_input_unit, conv_output_unit;
|
||||
|
||||
bool always_scientific;
|
||||
int when_scientific;
|
||||
int rounding;
|
||||
bool remove_zeroes;
|
||||
int precision;
|
||||
Languages::Country country;
|
||||
ttmath::ErrorCode code;
|
||||
int angle_deg_rad_grad;
|
||||
|
||||
char decimal_point;
|
||||
char grouping;
|
||||
char input_comma1;
|
||||
char input_comma2;
|
||||
char param_sep;
|
||||
|
||||
template<class ValueType>
|
||||
void PrintResult(ttmath::Parser<ValueType> & matparser)
|
||||
int grouping_digits;
|
||||
|
||||
/*
|
||||
some buffers which we use in some method in the second thread,
|
||||
it's better to have those buffers outside those methods -
|
||||
if the buffers were in the methods there would be still allocating
|
||||
and deallocating memory
|
||||
*/
|
||||
std::string buffer1, buffer2;
|
||||
|
||||
|
||||
bool CanWeConvert() const
|
||||
{
|
||||
if( conv_type != 0 )
|
||||
if( conv_input_unit!=-1 && conv_output_unit!=-1 &&
|
||||
conv_input_unit!=conv_output_unit )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AddOutputSuffix(std::string & result)
|
||||
{
|
||||
if( CanWeConvert() )
|
||||
{
|
||||
result += " ";
|
||||
result += GetPrgRes()->GetConvert()->GetUnitAbbr(country, conv_output_unit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 1 if carry
|
||||
template<class ValueType>
|
||||
int PrintResult(ttmath::Parser<ValueType> & matparser)
|
||||
{
|
||||
std::string result, part;
|
||||
unsigned int i = 0;
|
||||
|
||||
buffer1.erase();
|
||||
buffer2.erase();
|
||||
|
||||
for(i=0 ; i<matparser.stack.size() ; ++i)
|
||||
{
|
||||
|
||||
if( matparser.stack[i].value.ToString(part,base_output, always_scientific, when_scientific, rounding) )
|
||||
try
|
||||
{
|
||||
// we shouldn't have this error in the new version of ToStrign(...)
|
||||
// (it could be if were using very big mantissa and exponent
|
||||
// in the Big type)
|
||||
|
||||
//
|
||||
// look at this: part.erase()
|
||||
//
|
||||
// we're using it because it's something wrong on gcc
|
||||
// when we're compiling with -O3 optimization flag
|
||||
//
|
||||
// gcc version 3.4.2 (mingw-special) with -O3
|
||||
// program tell us if there was an error here (from ToString())
|
||||
// but in fact it shouldn't have been here
|
||||
// I don't know where is the problem (I think in optimization,
|
||||
// with -O1 and -O2 program works well and visual express works perfectly
|
||||
// as well)
|
||||
ValueType result = matparser.stack[i].value;
|
||||
|
||||
part.erase();
|
||||
if( CanWeConvert() )
|
||||
{
|
||||
if( GetPrgRes()->GetConvert()->Conversion(conv_input_unit, conv_output_unit, result) )
|
||||
{
|
||||
code = ttmath::err_overflow;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// we can omit this part.erase() and use operator+= instead of
|
||||
// operator= below, for example:
|
||||
// part += GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing);
|
||||
// will be working correctly on gcc with -O3
|
||||
ttmath::Conv conv;
|
||||
|
||||
// this error doesn't appear always, it can be seen, for example,
|
||||
// if we use Big<1,3> type and we give '2^32' for calculating
|
||||
conv.base = base_output;
|
||||
conv.scient = always_scientific;
|
||||
conv.scient_from = when_scientific;
|
||||
conv.round = rounding;
|
||||
conv.trim_zeroes = remove_zeroes;
|
||||
conv.comma = decimal_point;
|
||||
conv.group = grouping;
|
||||
conv.group_digits = grouping_digits;
|
||||
|
||||
// I didn't check this error on a new version of gcc
|
||||
|
||||
part = GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing);
|
||||
if( result.ToString(buffer2, conv) )
|
||||
{
|
||||
// we shouldn't have had this error in the new version of ToStrign(...)
|
||||
// (where we're using a bigger type for calculating)
|
||||
buffer2 = GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing);
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
buffer2 = GetPrgRes()->GetLanguages()->ErrorMessage(country, ttmath::err_internal_error);
|
||||
}
|
||||
|
||||
result += part;
|
||||
buffer1 += buffer2;
|
||||
AddOutputSuffix(buffer1);
|
||||
|
||||
if( i < matparser.stack.size()-1 )
|
||||
result += " ";
|
||||
buffer1 += " ; ";
|
||||
}
|
||||
|
||||
SetDlgItemText(GetPrgRes()->GetMainWindow(),IDC_OUTPUT_EDIT,result.c_str());
|
||||
SetDlgItemText(GetPrgRes()->GetMainWindow(),IDC_OUTPUT_EDIT,buffer1.c_str());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<class ValueType>
|
||||
void Parse(ttmath::Parser<ValueType> & matparser)
|
||||
{
|
||||
matparser.SetBase(base_input);
|
||||
matparser.SetDegRadGrad(angle_deg_rad_grad);
|
||||
matparser.SetComma(input_comma1, input_comma2);
|
||||
matparser.SetGroup(grouping);
|
||||
matparser.SetParamSep(param_sep);
|
||||
code = matparser.Parse(buffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -43,14 +43,30 @@
|
|||
\brief various kinds of objects using by the application
|
||||
*/
|
||||
|
||||
#include <ttmath/ttmathobjects.h>
|
||||
#include "compileconfig.h"
|
||||
#include "iniparser.h"
|
||||
#include "languages.h"
|
||||
#include "threadcontroller.h"
|
||||
#include "convert.h"
|
||||
|
||||
#include <ttmath/ttmathobjects.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
#include <windows.h>
|
||||
#include <ctime>
|
||||
|
||||
|
||||
/*!
|
||||
some messages
|
||||
*/
|
||||
#define WM_INIT_TAB_VARIABLES WM_APP
|
||||
#define WM_INIT_TAB_FUNCTIONS WM_APP+1
|
||||
#define WM_INIT_TAB_PRECISION WM_APP+2
|
||||
#define WM_INIT_TAB_DISPLAY WM_APP+3
|
||||
#define WM_SET_LAST_ERROR WM_APP+4
|
||||
#define WM_INIT_TAB_CONVERT WM_APP+5
|
||||
#define WM_UPDATE_EXISTS WM_APP+6
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -67,10 +83,14 @@
|
|||
GetPrgRes()->SetPrecision( new_precision );
|
||||
GetPrgRes()->GetThreadController()->StartCalculating();
|
||||
|
||||
if you change some variables by using GetVariable() method
|
||||
you should call VariablesChanged() in order to inform the second thread that variables have changed
|
||||
(variables_id will be increment), the same is for functions (FunctionsChanged() method)
|
||||
|
||||
methods which are used by the second thread:
|
||||
GetBuffer(), GetVariables(), GetFunctions(), GetBaseInput(), GetBaseOutput()
|
||||
GetDisplayAlwaysScientific(), GetDisplayWhenScientific(), GetDisplayRounding()
|
||||
GetCurrentLanguage(), GetPrecision()
|
||||
GetCurrentLanguage(), GetPrecision() ...
|
||||
|
||||
and if you're using methods which begin with Set..... you must call it
|
||||
between StopCalculating() and StartCalculating()
|
||||
|
@ -104,6 +124,19 @@ public:
|
|||
int GetYSize();
|
||||
|
||||
|
||||
/*!
|
||||
position of the left top corner of the pad window and its size
|
||||
*/
|
||||
void SetPadXPos(int x);
|
||||
void SetPadYPos(int y);
|
||||
int GetPadXPos();
|
||||
int GetPadYPos();
|
||||
void SetPadXSize(int x);
|
||||
void SetPadYSize(int y);
|
||||
int GetPadXSize();
|
||||
int GetPadYSize();
|
||||
|
||||
|
||||
/*!
|
||||
size of the main window when 'normal view' is selected
|
||||
*/
|
||||
|
@ -139,6 +172,12 @@ public:
|
|||
bool GetMaximized();
|
||||
|
||||
|
||||
/*!
|
||||
maximizing of the pad window
|
||||
*/
|
||||
void SetPadMaximized(bool max);
|
||||
bool GetPadMaximized();
|
||||
|
||||
/*!
|
||||
the main window is always on top or not
|
||||
*/
|
||||
|
@ -192,6 +231,12 @@ public:
|
|||
HWND GetMainWindow();
|
||||
|
||||
|
||||
void SetPadWindow(HWND h);
|
||||
HWND GetPadWindow();
|
||||
|
||||
void SetPadEdit(HWND h);
|
||||
HWND GetPadEdit();
|
||||
|
||||
/*!
|
||||
handles to the dialogs which are placed on the tab control
|
||||
*/
|
||||
|
@ -217,13 +262,45 @@ public:
|
|||
|
||||
|
||||
/*!
|
||||
pointers to variables' table, functions' table, the language's object
|
||||
if you change some variables by using GetVariable() method
|
||||
you should call this method in order to inform the second thread that variables have changed
|
||||
(variables_id will be increment)
|
||||
*/
|
||||
void VariablesChanged();
|
||||
|
||||
|
||||
/*!
|
||||
if you change some functions by using GetFunction() method
|
||||
you should call this method in order to inform the second thread that functions have changed
|
||||
(functions_id will be increment)
|
||||
*/
|
||||
void FunctionsChanged();
|
||||
|
||||
|
||||
/*!
|
||||
returning the state of variables_id
|
||||
(used by the second thread)
|
||||
*/
|
||||
int GetVariablesId();
|
||||
|
||||
|
||||
/*!
|
||||
returning the state of functions_id
|
||||
(used by the second thread)
|
||||
*/
|
||||
int GetFunctionsId();
|
||||
|
||||
|
||||
/*!
|
||||
pointers to variables' table, functions' table, the languages' object, convert object
|
||||
and to the characters' buffer
|
||||
*/
|
||||
ttmath::Objects * GetVariables();
|
||||
ttmath::Objects * GetFunctions();
|
||||
Languages * GetLanguages();
|
||||
Convert * GetConvert();
|
||||
char * GetBuffer();
|
||||
char * GetBufferTemp(); // this buffer can be used for temporary tasks
|
||||
unsigned int GetBufferSize();
|
||||
|
||||
|
||||
|
@ -257,23 +334,168 @@ public:
|
|||
will be in a special directory for a particular user, for example:
|
||||
"C:\Documents and Settings\user\applitacion data"
|
||||
*/
|
||||
void SetNameOfConfigurationFile();
|
||||
void SetNameOfFiles();
|
||||
|
||||
|
||||
/*!
|
||||
reading and writing to a file
|
||||
it is used when 'createconfig' parameter has been passed to the ttcalc program
|
||||
*/
|
||||
void SetConfigName();
|
||||
|
||||
|
||||
/*!
|
||||
returning the name of the help file
|
||||
SetNameOfFiles() should be used first
|
||||
*/
|
||||
const std::string & GetHelpFile();
|
||||
|
||||
|
||||
/*!
|
||||
returning true if such a dir exists
|
||||
if not the method is trying to create it and returns true if it is created
|
||||
*/
|
||||
bool CreateDirIfNotExists(const std::string & app_dir);
|
||||
|
||||
/*!
|
||||
reading and writing to a file
|
||||
|
||||
ReadVariablesFunctionsFromFile() reads variables/functions only when they are not exist (in this instance of TTCalc)
|
||||
*/
|
||||
IniParser::Error ReadVariablesFunctionsFromFile();
|
||||
IniParser::Error ReadFromFile();
|
||||
void SaveToFile();
|
||||
|
||||
|
||||
/*!
|
||||
it returns a number of line where there was an error
|
||||
it returns a number of a line where there was an error
|
||||
during last parsing
|
||||
*/
|
||||
int GetBadLine();
|
||||
|
||||
|
||||
/*!
|
||||
setting and returning the state of removing trailing zeroes
|
||||
(used during printing values)
|
||||
*/
|
||||
void SetRemovingZeroes(bool r);
|
||||
bool GetRemovingZeroes();
|
||||
|
||||
|
||||
/*!
|
||||
setting and returning the unit of angle in which sin/cos/tan/ctg (arc sin...) operate
|
||||
0 - deg
|
||||
1 - red
|
||||
2 - grad
|
||||
*/
|
||||
void SetDegRadGrad(int angle);
|
||||
int GetDegRadGrad();
|
||||
|
||||
|
||||
/*!
|
||||
is the pad window is visible then the method hides it (and vice versa)
|
||||
*/
|
||||
void ShowPad(bool show);
|
||||
|
||||
|
||||
/*!
|
||||
returning true if the pad window is visible
|
||||
*/
|
||||
bool IsPadVisible();
|
||||
|
||||
|
||||
/*!
|
||||
setting/getting the group character
|
||||
0 - none
|
||||
1 - space
|
||||
2 - '`'
|
||||
3 - '\''
|
||||
4 - '.'
|
||||
5 - ','
|
||||
*/
|
||||
void SetGrouping(int g);
|
||||
int GetGrouping();
|
||||
|
||||
|
||||
/*!
|
||||
setting/getting how many digits should be groupped
|
||||
digits can be from 1 to 9
|
||||
*/
|
||||
void SetGroupingDigits(int digits);
|
||||
int GetGroupingDigits();
|
||||
|
||||
|
||||
/*!
|
||||
returning the grouping character
|
||||
*/
|
||||
char GetGroupingChar();
|
||||
|
||||
|
||||
/*!
|
||||
setting/getting the input decimal point
|
||||
0 - dot or comma, 1 - dot, 2 - comma
|
||||
*/
|
||||
void SetInputDecimalPoint(int p);
|
||||
int GetInputDecimalPoint();
|
||||
|
||||
|
||||
/*!
|
||||
returning the input decimal point characters
|
||||
*/
|
||||
void GetInputDecimalPointChar(char * comma1, char * comma2);
|
||||
|
||||
/*!
|
||||
setting and returning the decimal point used during printig values
|
||||
0 - '.'
|
||||
1 - ','
|
||||
*/
|
||||
void SetDecimalPoint(int decimal);
|
||||
int GetDecimalPoint();
|
||||
|
||||
|
||||
/*!
|
||||
returning the decimal point char (used during printig values)
|
||||
*/
|
||||
char GetDecimalPointChar();
|
||||
|
||||
|
||||
/*!
|
||||
setting/getting the separator of function arguments
|
||||
0 - semicolon, 1 - semicolon or dot, 2 - semicolon or comma
|
||||
*/
|
||||
void SetParamSep(int s);
|
||||
int GetParamSep();
|
||||
|
||||
|
||||
/*!
|
||||
returning the character of param separator
|
||||
either a semicolon, dot or comma
|
||||
*/
|
||||
char GetParamSepChar();
|
||||
|
||||
|
||||
/*!
|
||||
setting/getting the test which is made when the program starts
|
||||
(testing for an update)
|
||||
*/
|
||||
void SetCheckUpdateStartup(bool s);
|
||||
bool GetCheckUpdateStartup();
|
||||
|
||||
|
||||
/*!
|
||||
true if there is an update available
|
||||
(used only with the dynamic menu)
|
||||
*/
|
||||
void SetUpdateExists(bool e);
|
||||
bool GetUpdateExists();
|
||||
|
||||
|
||||
/*!
|
||||
setting/getting the time of the last update
|
||||
*/
|
||||
void SetLastUpdate(time_t t);
|
||||
time_t GetLastUpdate();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
bool IsWhiteCharacter(int c);
|
||||
|
@ -281,18 +503,30 @@ private:
|
|||
bool IsDecDigit(int c);
|
||||
bool SplitFunction(const std::string & input, const char * * name, int * param);
|
||||
void CheckCoordinates();
|
||||
void CheckPadCoordinates();
|
||||
void AddVariablesFunctions(IniParser::Section & temp_variables, IniParser::Section & temp_functions, bool if_not_exist);
|
||||
void ReadGlobalSection(std::string * ini_value);
|
||||
int Int(const std::string & text);
|
||||
bool IsGlobalSectionSet(std::string * ini_value, size_t len);
|
||||
|
||||
ttmath::Objects variables;
|
||||
ttmath::Objects functions;
|
||||
Languages languages;
|
||||
Convert convert;
|
||||
volatile ThreadController thread_controller;
|
||||
|
||||
int variables_id;
|
||||
int functions_id;
|
||||
|
||||
unsigned int buffer_size;
|
||||
char * buffer;
|
||||
char * buffer_temp;
|
||||
|
||||
HINSTANCE hInstance;
|
||||
HWND main_window;
|
||||
HWND tab_window[5];
|
||||
HWND pad_window;
|
||||
HWND pad_edit; // edit control on the pad window
|
||||
HWND tab_window[6];
|
||||
|
||||
int precision;
|
||||
bool always_on_top;
|
||||
|
@ -300,6 +534,7 @@ private:
|
|||
View view;
|
||||
|
||||
std::string configuration_file;
|
||||
std::string help_file;
|
||||
|
||||
int y_size_normal;
|
||||
int y_size_compact;
|
||||
|
@ -310,14 +545,34 @@ private:
|
|||
int x_size;
|
||||
int y_size;
|
||||
|
||||
int pad_x_pos;
|
||||
int pad_y_pos;
|
||||
int pad_x_size;
|
||||
int pad_y_size;
|
||||
bool pad_maximized;
|
||||
|
||||
int base_input;
|
||||
int base_output;
|
||||
|
||||
int decimal_point;
|
||||
|
||||
bool display_always_scientific;
|
||||
int display_when_scientific;
|
||||
int display_rounding;
|
||||
bool remove_zeroes;
|
||||
int angle_deg_rad_grad;
|
||||
int grouping; // 0 - none, 1 - space, 2 - '`', 3 - '\'', 4 - '.', 5 - ','
|
||||
int grouping_digits; // from 1 to 9
|
||||
int input_decimal_point; // 0 - dot or comma, 1 - dot, 2 - comma
|
||||
int param_sep; // parameters separator: 0 - semicolon, 1 - dot, 2 - comma
|
||||
|
||||
int bad_line;
|
||||
bool show_pad;
|
||||
|
||||
bool check_update_startup;
|
||||
bool update_exists;
|
||||
time_t last_update;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
128
src/resource.h
128
src/resource.h
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -50,6 +50,7 @@
|
|||
|
||||
#define IDD_MAIN_DIALOG 101
|
||||
#define IDD_ABOUT_DIALOG 200
|
||||
#define IDD_UPDATE_DIALOG 210
|
||||
#define IDD_DIALOG_ADD_VARIABLE 102
|
||||
#define IDD_DIALOG_ADD_FUNCTION 103
|
||||
|
||||
|
@ -58,10 +59,13 @@
|
|||
#define IDD_DIALOG_FUNCTIONS 112
|
||||
#define IDD_DIALOG_PRECISION 113
|
||||
#define IDD_DIALOG_DISPLAY 114
|
||||
#define IDD_DIALOG_CONVERT 115
|
||||
|
||||
#define IDR_MENU 200
|
||||
#define IDR_MENU2 201
|
||||
#define IDC_TAB 1010
|
||||
#define IDI_ICON1 104
|
||||
#define IDI_ICON2 104
|
||||
#define IDI_ICON1 105
|
||||
#define IDC_INPUT_EDIT 1000
|
||||
#define IDC_OUTPUT_EDIT 1001
|
||||
|
||||
|
@ -80,7 +84,6 @@
|
|||
#define IDC_BUTTON_SGN 1075
|
||||
#define IDC_BUTTON_MOD 1076
|
||||
|
||||
|
||||
// values from IDC_BUTTON_PRESS_0 to IDC_BUTTON_PRESS_9 should be with the step equal one
|
||||
#define IDC_BUTTON_PRESS_0 1100
|
||||
#define IDC_BUTTON_PRESS_1 1101
|
||||
|
@ -114,6 +117,19 @@
|
|||
#define IDC_BUTTON_INT 1129
|
||||
#define IDC_BUTTON_ROUND 1130
|
||||
#define IDC_BUTTON_EXP 1131
|
||||
#define IDC_BUTTON_SQRT 1400
|
||||
#define IDC_BUTTON_BRACKETS_ALL 1401
|
||||
#define IDC_BUTTON_1DIV_BRACKETS_ALL 1402
|
||||
#define IDC_BUTTON_SEMICOLON 1403
|
||||
#define IDC_BUTTON_PERCENTAGE 1404
|
||||
#define IDC_BUTTON_FLOOR 1405
|
||||
#define IDC_BUTTON_CEIL 1406
|
||||
#define IDC_BUTTON_MIN 1407
|
||||
#define IDC_BUTTON_MAX 1408
|
||||
#define IDC_BUTTON_AVG 1409
|
||||
#define IDC_BUTTON_SUM 1410
|
||||
#define IDC_BUTTON_ROOT 1411
|
||||
#define IDC_BUTTON_GAMMA 1412
|
||||
|
||||
|
||||
// variables tab
|
||||
|
@ -152,37 +168,109 @@
|
|||
// display tab
|
||||
#define IDC_COMBO_DISPLAY_INPUT 1156
|
||||
#define IDC_COMBO_DISPLAY_OUTPUT 1157
|
||||
#define IDC_COMBO_DISPLAY_ROUNDING 1159
|
||||
#define IDC_RADIO_DISPLAY_ALWAYS_SCIENTIFIC 1160
|
||||
#define IDC_RADIO_DISPLAY_NOT_ALWAYS_SCIENTIFIC 1161
|
||||
#define IDC_LABEL_DISPLAY_INPUT 1162
|
||||
#define IDC_LABEL_DISPLAY_OUTPUT 1163
|
||||
#define IDC_LABEL_DISPLAY_ROUNDING 1164
|
||||
#define IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC 1165
|
||||
#define IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC 1166
|
||||
#define IDC_LABEL_GROUP_SCIENTIFIC 1168
|
||||
#define IDC_COMBO_DISPLAY_ROUNDING 1158
|
||||
#define IDC_RADIO_DISPLAY_ALWAYS_SCIENTIFIC 1159
|
||||
#define IDC_RADIO_DISPLAY_NOT_ALWAYS_SCIENTIFIC 1160
|
||||
#define IDC_LABEL_DISPLAY_INPUT 1161
|
||||
#define IDC_LABEL_DISPLAY_OUTPUT 1162
|
||||
#define IDC_LABEL_DISPLAY_ROUNDING 1163
|
||||
#define IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC 1164
|
||||
#define IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC 1165
|
||||
#define IDC_LABEL_DISPLAY_SCIENTIFIC 1166
|
||||
#define IDC_LABEL_OUTPUT_DECIMAL_POINT 1167
|
||||
#define IDC_COMBO_OUTPUT_DECIMAL_POINT 1168
|
||||
#define IDC_CHECK_REMOVE_ZEROES 1169
|
||||
#define IDC_LABEL_DISPLAY_DEG_RAD_GRAD 1170
|
||||
#define IDC_COMBO_DEG_RAD_GRAD 1171
|
||||
#define IDC_COMBO_DISPLAY_GROUPING 1172
|
||||
#define IDC_COMBO_DISPLAY_GROUPING_DIGITS 1173
|
||||
#define IDC_LABEL_DISPLAY_GROUPING 1174
|
||||
#define IDC_COMBO_INPUT_DECIMAL_POINT 1175
|
||||
#define IDC_LABEL_INPUT_DECIMAL_POINT 1176
|
||||
#define IDC_LABEL_PARAM_SEPARATE 1177
|
||||
#define IDC_COMBO_PARAM_SEPARATE 1178
|
||||
|
||||
// convert tab
|
||||
#define IDC_LIST_UNIT_TYPE 1200
|
||||
#define IDC_LIST_UNIT_INPUT1 1201
|
||||
#define IDC_LIST_UNIT_INPUT2 1202
|
||||
#define IDC_LIST_UNIT_OUTPUT1 1203
|
||||
#define IDC_LIST_UNIT_OUTPUT2 1204
|
||||
#define IDC_STATIC_UNIT_INPUT 1205
|
||||
#define IDC_STATIC_UNIT_OUTPUT 1206
|
||||
#define IDC_COMBO_DYNAMIC_OUTPUT 1207
|
||||
#define IDC_EDIT_OUTPUT_INFO 1208
|
||||
#define IDC_STATIC_UNIT_CONVERSION 1209
|
||||
|
||||
|
||||
// menu
|
||||
#define IDM_VIEW_INDEX 0
|
||||
#define IDM_EDIT_INDEX 1
|
||||
#define IDM_HELP_INDEX 2
|
||||
#define IDM_LANGUAGE_INDEX 6
|
||||
#define IDM_UPDATE_AVAILABLE_INDEX 3
|
||||
|
||||
#define IDM_LANGUAGE_INDEX 8
|
||||
|
||||
#define IDM_NEW_WINDOW 40001
|
||||
#define IDM_NORMAL_VIEW 40002
|
||||
#define IDM_COMPACT_VIEW 40003
|
||||
#define IDM_ALWAYS_ON_TOP 40004
|
||||
#define IDM_PAD 40004
|
||||
#define IDM_ALWAYS_ON_TOP 40005
|
||||
#define IDM_LANGUAGE_ENGLISH 40010
|
||||
#define IDM_LANGUAGE_POLISH 40011
|
||||
#define IDM_LANGUAGE_SPANISH 40012
|
||||
#define IDM_LANGUAGE_DANISH 40013
|
||||
#define IDM_LANGUAGE_CHINESE 40014
|
||||
#define IDM_LANGUAGE_RUSSIAN 40015
|
||||
#define IDM_LANGUAGE_SWEDISH 40016
|
||||
#define IDM_LANGUAGE_ITALIAN 40017
|
||||
#define IDM_LANGUAGE_GERMAN 40018
|
||||
#define IDM_CLOSE_PROGRAM 40020
|
||||
|
||||
#define IDM_EDIT_UNDO 40030
|
||||
#define IDM_EDIT_PASTE 40031
|
||||
#define IDM_EDIT_COPY_RESULT 40032
|
||||
#define IDM_HELP_HELP 40040
|
||||
#define IDM_HELP_PROJECT_PAGE 40041
|
||||
#define IDM_HELP_ABOUT 40049
|
||||
#define IDM_EDIT_CUT 40031
|
||||
#define IDM_EDIT_COPY 40032
|
||||
#define IDM_EDIT_PASTE 40033
|
||||
#define IDM_EDIT_DEL 40034
|
||||
#define IDM_EDIT_COPY_RESULT 40035
|
||||
#define IDM_EDIT_COPY_BOTH 40036
|
||||
#define IDM_EDIT_PASTE_FORMULA 40037
|
||||
#define IDM_EDIT_SELECT_ALL 40038
|
||||
#define IDM_EDIT_BRACKET 40039
|
||||
#define IDM_EDIT_SWAP 40040
|
||||
|
||||
#define IDM_HELP_HELP 40050
|
||||
#define IDM_HELP_PROJECT_PAGE 40051
|
||||
#define IDM_HELP_CHECK_UPDATE 40052
|
||||
#define IDM_HELP_ABOUT 40053
|
||||
|
||||
#define IDM_UPDATE_AVAILABLE 40060
|
||||
|
||||
// pad menu
|
||||
#define MENUPAD_FILE_INDEX 0
|
||||
#define MENUPAD_EDIT_INDEX 1
|
||||
#define MENUPAD_FILE_NEW 40500
|
||||
#define MENUPAD_FILE_OPEN 40501
|
||||
#define MENUPAD_FILE_SAVE 40502
|
||||
#define MENUPAD_FILE_CLOSE 40503
|
||||
#define MENUPAD_EDIT_UNDO 40510
|
||||
#define MENUPAD_EDIT_CUT 40511
|
||||
#define MENUPAD_EDIT_COPY 40512
|
||||
#define MENUPAD_EDIT_PASTE 40513
|
||||
#define MENUPAD_EDIT_DEL 40514
|
||||
#define MENUPAD_EDIT_SELECTALL 40515
|
||||
|
||||
|
||||
// about dialog
|
||||
#define IDC_ABOUT_TEXT 1200
|
||||
#define IDB_BITMAP_ABOUT 1201
|
||||
|
||||
// update dialog
|
||||
#define IDC_UPDATE_INFO1 1300
|
||||
#define IDC_UPDATE_INFO2 1301
|
||||
#define IDC_PROGRESS 1302
|
||||
#define IDC_BUTTON_NEXT 1303
|
||||
#define IDC_BUTTON_CANCEL 1304
|
||||
#define IDC_CHECK_UPDATE_STURTUP 1305
|
||||
|
||||
#endif
|
||||
|
|
432
src/resource.rc
432
src/resource.rc
|
@ -1,198 +1,382 @@
|
|||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
#include "afxres.h"
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
//#define APSTUDIO_READONLY_SYMBOLS
|
||||
//#include "afxres.h"
|
||||
//#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
#include "windows.h"
|
||||
#include "resource.h"
|
||||
|
||||
LANGUAGE LANG_POLISH, 1
|
||||
104 ICON "..\\res\\icon01.ico"
|
||||
IDI_ICON2 ICON "..\\res\\icon02.ico"
|
||||
|
||||
LANGUAGE LANG_POLISH, 2
|
||||
IDI_ICON1 ICON "..\\res\\icon01.ico"
|
||||
|
||||
LANGUAGE LANG_NEUTRAL, 0
|
||||
200 MENU
|
||||
FIXED IMPURE LOADONCALL DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&View"
|
||||
POPUP "View"
|
||||
BEGIN
|
||||
MENUITEM "&New window", 40001
|
||||
MENUITEM "New window", IDM_NEW_WINDOW
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "No&rmal", 40002
|
||||
MENUITEM "&Compact", 40003
|
||||
MENUITEM "Normal", IDM_NORMAL_VIEW
|
||||
MENUITEM "Compact", IDM_COMPACT_VIEW
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Always on top", 40004
|
||||
POPUP "&Language"
|
||||
MENUITEM "Pad", IDM_PAD
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Always on top", IDM_ALWAYS_ON_TOP
|
||||
POPUP "Language"
|
||||
BEGIN
|
||||
MENUITEM "&English", 40010
|
||||
MENUITEM "&Polish", 40011
|
||||
MENUITEM "English", IDM_LANGUAGE_ENGLISH
|
||||
MENUITEM "Polish", IDM_LANGUAGE_POLISH
|
||||
MENUITEM "Spanish", IDM_LANGUAGE_SPANISH
|
||||
MENUITEM "Danish", IDM_LANGUAGE_DANISH
|
||||
MENUITEM "Chinese", IDM_LANGUAGE_CHINESE
|
||||
MENUITEM "Russian", IDM_LANGUAGE_RUSSIAN
|
||||
MENUITEM "Swedish", IDM_LANGUAGE_SWEDISH
|
||||
MENUITEM "Italian", IDM_LANGUAGE_ITALIAN
|
||||
MENUITEM "German", IDM_LANGUAGE_GERMAN
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Close", 40020
|
||||
MENUITEM "Close", IDM_CLOSE_PROGRAM
|
||||
END
|
||||
POPUP "&Edit"
|
||||
POPUP "Edit"
|
||||
BEGIN
|
||||
MENUITEM "&Undo", 40030
|
||||
MENUITEM "&Paste", 40031
|
||||
MENUITEM "&Copy the result", 40032
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&Help", 40040
|
||||
MENUITEM "&Project page", 40041
|
||||
MENUITEM "Undo", IDM_EDIT_UNDO
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&About", 40049
|
||||
MENUITEM "Cut", IDM_EDIT_CUT
|
||||
MENUITEM "Copy", IDM_EDIT_COPY
|
||||
MENUITEM "Paste", IDM_EDIT_PASTE
|
||||
MENUITEM "Delete", IDM_EDIT_DEL
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Copy result", IDM_EDIT_COPY_RESULT
|
||||
MENUITEM "Copy both", IDM_EDIT_COPY_BOTH
|
||||
MENUITEM "Paste formula", IDM_EDIT_PASTE_FORMULA
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Select all", IDM_EDIT_SELECT_ALL
|
||||
MENUITEM "Bracket", IDM_EDIT_BRACKET
|
||||
MENUITEM "Swap", IDM_EDIT_SWAP
|
||||
END
|
||||
POPUP "Help"
|
||||
BEGIN
|
||||
MENUITEM "Help", IDM_HELP_HELP
|
||||
MENUITEM "Project page", IDM_HELP_PROJECT_PAGE
|
||||
MENUITEM "Check update...", IDM_HELP_CHECK_UPDATE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "About", IDM_HELP_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
101 DIALOG 0, 0, 265, 150
|
||||
STYLE DS_SETFONT |DS_CENTER |WS_POPUP |WS_SYSMENU |WS_THICKFRAME |WS_MAXIMIZEBOX |WS_MINIMIZEBOX |WS_CAPTION
|
||||
MENU 200
|
||||
|
||||
IDR_MENU2 MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "File"
|
||||
BEGIN
|
||||
// MENUITEM "New", MENUPAD_FILE_NEW
|
||||
// temporarily this option is not available
|
||||
MENUITEM "Open...", MENUPAD_FILE_OPEN
|
||||
MENUITEM "Save as...", MENUPAD_FILE_SAVE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Close", MENUPAD_FILE_CLOSE
|
||||
END
|
||||
POPUP "Edit"
|
||||
BEGIN
|
||||
MENUITEM "Undo \tCtrl+Z", MENUPAD_EDIT_UNDO
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Cut \tCtrl+X", MENUPAD_EDIT_CUT
|
||||
MENUITEM "Copy \tCtrl+C", MENUPAD_EDIT_COPY
|
||||
MENUITEM "Paste \tCtrl+V", MENUPAD_EDIT_PASTE
|
||||
MENUITEM "Delete \tDel", MENUPAD_EDIT_DEL
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Select all \tCtrl+A", MENUPAD_EDIT_SELECTALL
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
IDD_MAIN_DIALOG DIALOGEX 0, 0, 295, 189
|
||||
STYLE DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION |
|
||||
WS_SYSMENU | WS_THICKFRAME
|
||||
CAPTION "TTCalc"
|
||||
MENU 200
|
||||
FONT 8, "Ms Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "",1000,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,0,6,260,14
|
||||
CONTROL "",1001,"EDIT",ES_READONLY |ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,0,21,260,14
|
||||
CONTROL "",1010,"SysTabControl32",WS_CHILD |WS_TABSTOP |WS_GROUP| WS_VISIBLE ,0,39,261,110, WS_EX_CONTROLPARENT
|
||||
EDITTEXT IDC_INPUT_EDIT,0,6,260,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_OUTPUT_EDIT,0,21,260,14,ES_AUTOHSCROLL | ES_READONLY
|
||||
CONTROL "",IDC_TAB,"SysTabControl32",WS_GROUP | WS_TABSTOP,0,39,
|
||||
292,123,WS_EX_CONTROLPARENT
|
||||
END
|
||||
|
||||
|
||||
102 DIALOG DISCARDABLE 0, 0, 358, 61
|
||||
IDD_DIALOG_ADD_VARIABLE DIALOG DISCARDABLE 0, 0, 358, 61
|
||||
STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE |
|
||||
WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Add a new variable"
|
||||
FONT 8, "Ms Shell Dlg"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Ok",1,291,10,50,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "Cancel",2,291,28,50,14,BS_CENTER | BS_VCENTER
|
||||
EDITTEXT 1134,38,10,67,14,ES_AUTOHSCROLL
|
||||
EDITTEXT 1135,38,28,230,14,ES_AUTOHSCROLL
|
||||
LTEXT "name:",1136,7,12,27,8
|
||||
LTEXT "value:",1137,7,30,27,8
|
||||
DEFPUSHBUTTON "Ok",IDOK,291,10,50,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "Cancel",IDCANCEL,291,28,50,14,BS_CENTER | BS_VCENTER
|
||||
EDITTEXT IDC_EDIT_VARIABLE_NAME,47,10,67,14,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_EDIT_VARIABLE_VALUE,47,28,226,14,ES_AUTOHSCROLL
|
||||
LTEXT "name:",IDC_STATIC_VARIABLE_NAME,7,12,38,8
|
||||
LTEXT "value:",IDC_STATIC_VARIABLE_VALUE,7,30,38,8
|
||||
END
|
||||
|
||||
103 DIALOG DISCARDABLE 0, 0, 370, 74
|
||||
IDD_DIALOG_ADD_FUNCTION DIALOG DISCARDABLE 0, 0, 370, 74
|
||||
STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE |
|
||||
WS_CAPTION | WS_SYSMENU
|
||||
FONT 8, "Ms Shell Dlg"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Ok",1,303,10,50,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "Cancel",2,303,27,50,14,BS_CENTER | BS_VCENTER
|
||||
EDITTEXT 1144,46,10,67,14,ES_AUTOHSCROLL
|
||||
COMBOBOX 1146,46,29,67,130,CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
EDITTEXT 1145,46,47,308,14,ES_AUTOHSCROLL
|
||||
LTEXT "name:",1147,7,12,31,8
|
||||
LTEXT "value:",1149,7,49,33,8
|
||||
LTEXT "param:",1148,7,30,33,8
|
||||
DEFPUSHBUTTON "Ok",IDOK,304,10,50,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "Cancel",IDCANCEL,304,27,50,14,BS_CENTER | BS_VCENTER
|
||||
EDITTEXT IDC_EDIT_FUNCTION_NAME,55,10,67,14,ES_AUTOHSCROLL
|
||||
COMBOBOX IDC_COMBO_FUNCTION_PARAM,55,29,67,130,CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
EDITTEXT IDC_EDIT_FUNCTION_VALUE,55,47,299,14,ES_AUTOHSCROLL
|
||||
LTEXT "name:",IDC_STATIC_FUNCTION_NAME,7,12,46,8
|
||||
LTEXT "value:",IDC_STATIC_FUNCTION_VALUE,7,49,46,8
|
||||
LTEXT "param:",IDC_STATIC_FUNCTION_PARAM,7,30,46,8
|
||||
END
|
||||
|
||||
110 DIALOGEX 0, 0, 287, 90
|
||||
STYLE DS_3DLOOK | DS_FIXEDSYS |DS_SETFONT | WS_CHILD| WS_TABSTOP |WS_GROUP
|
||||
|
||||
IDD_DIALOG_STANDARD DIALOG DISCARDABLE 0, 0, 288, 107
|
||||
STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_GROUP | WS_TABSTOP
|
||||
FONT 8, "Ms Shell Dlg"
|
||||
BEGIN
|
||||
PUSHBUTTON "Clear",1110,3,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "(",1111,33,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON ")",1112,62,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "^",1128,91,3,26,14,BS_CENTER | BS_BOTTOM
|
||||
PUSHBUTTON "7",1107,3,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "8",1108,33,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "9",1109,62,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "/",1113,91,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "4",1104,3,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "5",1105,33,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "6",1106,62,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "*",1114,91,37,26,14,BS_CENTER | BS_BOTTOM
|
||||
PUSHBUTTON "1",1101,3,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "2",1102,33,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "3",1103,62,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "-",1115,91,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "0",1100,3,71,56,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON ",",1117,62,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "+",1116,91,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "sin",1120,131,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "asin",1071,160,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "ln",1124,189,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "cos",1121,131,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "acos",1072,160,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "log",1125,189,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "tan",1122,131,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "atan",1073,160,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "exp",1131,189,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "cot",1123,131,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "acot",1074,160,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "abs",1126,189,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "int",1129,131,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "round",1130,160,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "!",1127,189,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "sgn",1075,229,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "mod",1076,229,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "e",1118,229,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "pi",1119,229,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "err",1070,229,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "Clear",IDC_BUTTON_CLEAR,4,3,55,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "(",IDC_BUTTON_FIRST_BRACKET,62,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON ")",IDC_BUTTON_LAST_BRACKET,91,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "(...)",IDC_BUTTON_BRACKETS_ALL,4,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON ";",IDC_BUTTON_SEMICOLON,33,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "%",IDC_BUTTON_PERCENTAGE,62,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "^",IDC_BUTTON_POWER,91,20,26,14,BS_CENTER | BS_BOTTOM
|
||||
PUSHBUTTON "7",IDC_BUTTON_PRESS_7,4,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "8",IDC_BUTTON_PRESS_8,33,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "9",IDC_BUTTON_PRESS_9,62,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "/",IDC_BUTTON_DIV,91,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "4",IDC_BUTTON_PRESS_4,4,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "5",IDC_BUTTON_PRESS_5,33,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "6",IDC_BUTTON_PRESS_6,62,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "*",IDC_BUTTON_MUL,91,54,26,14,BS_CENTER | BS_BOTTOM
|
||||
PUSHBUTTON "1",IDC_BUTTON_PRESS_1,4,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "2",IDC_BUTTON_PRESS_2,33,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "3",IDC_BUTTON_PRESS_3,62,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "-",IDC_BUTTON_SUB,91,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "0",IDC_BUTTON_PRESS_0,4,88,55,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON ",",IDC_BUTTON_COMMA,62,88,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "+",IDC_BUTTON_ADD,91,88,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "sin",IDC_BUTTON_SIN,131,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "asin",IDC_BUTTON_ASIN,160,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "ln",IDC_BUTTON_LN,189,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "cos",IDC_BUTTON_COS,131,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "acos",IDC_BUTTON_ACOS,160,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "log",IDC_BUTTON_LOG,189,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "tan",IDC_BUTTON_TAN,131,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "atan",IDC_BUTTON_ATAN,160,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "exp",IDC_BUTTON_EXP,189,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "cot",IDC_BUTTON_COT,131,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "acot",IDC_BUTTON_ACOT,160,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "abs",IDC_BUTTON_ABS,189,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "int",IDC_BUTTON_INT,131,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "round",IDC_BUTTON_ROUND,160,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "mod",IDC_BUTTON_MOD,189,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "floor",IDC_BUTTON_FLOOR,131,88,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "ceil",IDC_BUTTON_CEIL,160,88,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "sgn",IDC_BUTTON_SGN,189,88,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "min",IDC_BUTTON_MIN,229,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "max",IDC_BUTTON_MAX,258,3,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "avg",IDC_BUTTON_AVG,229,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "sum",IDC_BUTTON_SUM,258,20,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "sqrt",IDC_BUTTON_SQRT,229,37,26,14, BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "root",IDC_BUTTON_ROOT,258,37,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "!",IDC_BUTTON_FACTORIAL,229,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "gamma",IDC_BUTTON_GAMMA,258,54,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "e",IDC_BUTTON_E,229,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "pi",IDC_BUTTON_PI,258,71,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "1/(...)",IDC_BUTTON_1DIV_BRACKETS_ALL,229,88,26,14,BS_CENTER | BS_VCENTER
|
||||
PUSHBUTTON "err",IDC_BUTTON_ERROR,258,88,26,14,BS_CENTER | BS_VCENTER
|
||||
END
|
||||
|
||||
|
||||
111 DIALOG 0, 0, 287, 90
|
||||
IDD_DIALOG_VARIABLES DIALOG 0, 0, 288, 107
|
||||
STYLE DS_3DLOOK |DS_FIXEDSYS |DS_SETFONT |WS_CHILD | WS_TABSTOP |WS_GROUP
|
||||
CAPTION "tab2"
|
||||
FONT 8, "Ms Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "Add",1133,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,3,50,14
|
||||
CONTROL "Edit",1138,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,21,50,14
|
||||
CONTROL "Delete",1139,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,39,50,14
|
||||
CONTROL "",1132,"SysListView32",LVS_REPORT |LVS_SHOWSELALWAYS |LVS_SORTASCENDING |LVS_ALIGNLEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,57,3,223,85
|
||||
CONTROL "Add",IDC_BUTTON_ADD_VARIABLE,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,3,50,14
|
||||
CONTROL "Edit",IDC_BUTTON_EDIT_VARIABLE,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,21,50,14
|
||||
CONTROL "Delete",IDC_BUTTON_DELETE_VARIABLE,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,39,50,14
|
||||
CONTROL "",IDC_VARIABLES_LIST,"SysListView32",LVS_REPORT |LVS_SHOWSELALWAYS |LVS_SORTASCENDING |LVS_ALIGNLEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,57,3,223,85
|
||||
END
|
||||
|
||||
112 DIALOG 0, 0, 287, 90
|
||||
IDD_DIALOG_FUNCTIONS DIALOG 0, 0, 288, 107
|
||||
STYLE DS_3DLOOK |DS_FIXEDSYS |DS_SETFONT |WS_CHILD | WS_TABSTOP |WS_GROUP
|
||||
CAPTION "tab3"
|
||||
FONT 8, "Ms Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "Add",1140,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,3,50,14
|
||||
CONTROL "Edit",1141,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,21,50,14
|
||||
CONTROL "Delete",1142,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,39,50,14
|
||||
CONTROL "",1143,"SysListView32",LVS_REPORT |LVS_SHOWSELALWAYS |LVS_SORTASCENDING |LVS_ALIGNLEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,57,3,223,85
|
||||
CONTROL "Add",IDC_BUTTON_ADD_FUNCTION,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,3,50,14
|
||||
CONTROL "Edit",IDC_BUTTON_EDIT_FUNCTION,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,21,50,14
|
||||
CONTROL "Delete",IDC_BUTTON_DELETE_FUNCTION,"BUTTON",BS_PUSHBUTTON |BS_VCENTER |BS_CENTER |WS_CHILD |WS_TABSTOP |WS_VISIBLE ,3,39,50,14
|
||||
CONTROL "",IDC_FUNCTIONS_LIST,"SysListView32",LVS_REPORT |LVS_SHOWSELALWAYS |LVS_SORTASCENDING |LVS_ALIGNLEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,57,3,223,85
|
||||
END
|
||||
|
||||
113 DIALOG 0, 0, 287, 90
|
||||
STYLE DS_3DLOOK |DS_FIXEDSYS |DS_SETFONT |WS_CHILD | WS_TABSTOP |WS_GROUP
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
IDD_DIALOG_PRECISION DIALOG DISCARDABLE 0, 0, 288, 107
|
||||
STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_CAPTION | WS_GROUP |
|
||||
WS_TABSTOP
|
||||
CAPTION "tab4"
|
||||
FONT 8, "Ms Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "precision 1",1150,"BUTTON",BS_AUTORADIOBUTTON |BS_LEFT |WS_CHILD |WS_GROUP|WS_TABSTOP | WS_VISIBLE ,15,4,252,10
|
||||
CONTROL "precision 2",1151,"BUTTON",BS_AUTORADIOBUTTON |BS_LEFT |WS_CHILD |WS_TABSTOP | WS_VISIBLE ,15,33,252,10
|
||||
CONTROL "precision 3",1152,"BUTTON",BS_AUTORADIOBUTTON |BS_LEFT |WS_CHILD |WS_TABSTOP | WS_VISIBLE ,15,62,252,10
|
||||
CONTROL "info 1",1153,"STATIC",SS_LEFT |WS_CHILD |WS_VISIBLE ,28,17,245,8
|
||||
CONTROL "info 2",1154,"STATIC",SS_LEFT |WS_CHILD |WS_VISIBLE ,28,46,245,8
|
||||
CONTROL "info 3",1155,"STATIC",SS_LEFT |WS_CHILD |WS_VISIBLE ,28,74,245,8
|
||||
CONTROL "precision 1",IDC_RADIO_PRECISION_1,"Button",
|
||||
BS_AUTORADIOBUTTON | BS_LEFT | WS_GROUP | WS_TABSTOP,21,
|
||||
11,256,10
|
||||
CONTROL "precision 2",IDC_RADIO_PRECISION_2,"Button",
|
||||
BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,21,42,256,10
|
||||
CONTROL "precision 3",IDC_RADIO_PRECISION_3,"Button",
|
||||
BS_AUTORADIOBUTTON | BS_LEFT | WS_TABSTOP,21,73,256,10
|
||||
LTEXT "info 1",IDC_LABEL_PRECISION_1_INFO,34,24,243,8,NOT
|
||||
WS_GROUP
|
||||
LTEXT "info 2",IDC_LABEL_PRECISION_2_INFO,34,55,243,8,NOT
|
||||
WS_GROUP
|
||||
LTEXT "info 3",IDC_LABEL_PRECISION_3_INFO,34,85,243,8,NOT
|
||||
WS_GROUP
|
||||
END
|
||||
|
||||
114 DIALOG DISCARDABLE 0, 0, 255, 90
|
||||
STYLE DS_3DLOOK | DS_FIXEDSYS |DS_SETFONT |WS_CHILD | WS_TABSTOP |WS_GROUP
|
||||
#endif
|
||||
|
||||
|
||||
IDD_DIALOG_DISPLAY DIALOG DISCARDABLE 0, 0, 288, 107
|
||||
STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_CAPTION | WS_GROUP |
|
||||
WS_TABSTOP
|
||||
CAPTION "tab5"
|
||||
FONT 8, "Ms Shell Dlg"
|
||||
BEGIN
|
||||
COMBOBOX 1156,58,5,63,200,CBS_DROPDOWNLIST | WS_TABSTOP | WS_GROUP
|
||||
COMBOBOX 1157,58,19,63,200,CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
LTEXT "Input",1162,11,7,27,8
|
||||
LTEXT "Output",1163,11,22,29,8
|
||||
LTEXT "Rounding",1164,11,36,43,8
|
||||
COMBOBOX 1159,58,33,121,200,CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
CONTROL "Always",1160,"Button",BS_AUTORADIOBUTTON | BS_LEFT | WS_GROUP | WS_TABSTOP,19,65,44,10
|
||||
CONTROL "When the exponent is greater than:",1161,"Button", BS_AUTORADIOBUTTON | BS_LEFT ,77,65,130,10
|
||||
EDITTEXT 1166,211,63,29,14,WS_GROUP | WS_TABSTOP | ES_NUMBER
|
||||
CONTROL "",1165,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS ,213,37,11,14
|
||||
GROUPBOX "Print scientific value",1168,11,51,240,31
|
||||
CONTROL "Input base",IDC_LABEL_DISPLAY_INPUT,"Static",
|
||||
SS_LEFTNOWORDWRAP | WS_GROUP,8,4,43,8
|
||||
CONTROL "Output base",IDC_LABEL_DISPLAY_OUTPUT,"Static",
|
||||
SS_LEFTNOWORDWRAP | WS_GROUP,8,18,43,8
|
||||
CONTROL "Rounding",IDC_LABEL_DISPLAY_ROUNDING,"Static",
|
||||
SS_LEFTNOWORDWRAP | WS_GROUP,8,32,43,8
|
||||
CONTROL "Grouping",IDC_LABEL_DISPLAY_GROUPING,"Static",SS_LEFTNOWORDWRAP |
|
||||
WS_GROUP,8,46,43,8
|
||||
CONTROL "Input decimal point",IDC_LABEL_INPUT_DECIMAL_POINT,
|
||||
"Static",SS_LEFTNOWORDWRAP | WS_GROUP,143,4,87,8
|
||||
CONTROL "Output decimal point",IDC_LABEL_OUTPUT_DECIMAL_POINT,"Static",
|
||||
SS_LEFTNOWORDWRAP | WS_GROUP,143,18,87,8
|
||||
CONTROL "Parameters separated by",IDC_LABEL_PARAM_SEPARATE,
|
||||
"Static",SS_LEFTNOWORDWRAP | WS_GROUP,143,32,87,8
|
||||
CONTROL "trigonometric functions",IDC_LABEL_DISPLAY_DEG_RAD_GRAD,
|
||||
"Static",SS_LEFTNOWORDWRAP | WS_GROUP,143,46,87,8
|
||||
COMBOBOX IDC_COMBO_DISPLAY_INPUT,61,2,59,200,CBS_DROPDOWNLIST |
|
||||
WS_GROUP | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DISPLAY_OUTPUT,61,16,59,200,CBS_DROPDOWNLIST |
|
||||
WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DISPLAY_ROUNDING,61,30,59,200,CBS_DROPDOWNLIST |
|
||||
WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DISPLAY_GROUPING,61,44,59,100,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DISPLAY_GROUPING_DIGITS,61,58,59,100,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_INPUT_DECIMAL_POINT,234,2,49,56,
|
||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_OUTPUT_DECIMAL_POINT,234,16,49,62,CBS_DROPDOWNLIST |
|
||||
WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_PARAM_SEPARATE,234,30,49,54,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEG_RAD_GRAD,234,44,49,53,CBS_DROPDOWNLIST |
|
||||
WS_TABSTOP
|
||||
CONTROL "remove trailing zeroes",IDC_CHECK_REMOVE_ZEROES,"Button",
|
||||
BS_AUTOCHECKBOX | BS_LEFTTEXT | BS_LEFT | WS_TABSTOP,142,
|
||||
60,140,10
|
||||
CONTROL "Always",IDC_RADIO_DISPLAY_ALWAYS_SCIENTIFIC,"Button",
|
||||
BS_AUTORADIOBUTTON | BS_LEFT | WS_GROUP | WS_TABSTOP,14,
|
||||
87,54,10
|
||||
CONTROL "When the exponent is greater than:",
|
||||
IDC_RADIO_DISPLAY_NOT_ALWAYS_SCIENTIFIC,"Button",
|
||||
BS_AUTORADIOBUTTON | BS_LEFT,90,87,151,10
|
||||
EDITTEXT IDC_EDIT_DISPLAY_WHEN_SCIENTIFIC,245,84,29,14,ES_NUMBER |
|
||||
WS_GROUP
|
||||
CONTROL "",IDC_UPDOWN_DISPLAY_WHEN_SCIENTIFIC,"msctls_updown32",
|
||||
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS,276,84,
|
||||
11,14
|
||||
GROUPBOX "Print scientific value",IDC_LABEL_DISPLAY_SCIENTIFIC,8,76,275,26
|
||||
END
|
||||
|
||||
200 DIALOG DISCARDABLE 0, 0, 349, 202
|
||||
|
||||
#ifdef TTCALC_CONVERT
|
||||
|
||||
IDD_DIALOG_CONVERT DIALOG DISCARDABLE 0, 0, 288, 107
|
||||
STYLE DS_3DLOOK | DS_FIXEDSYS | WS_CHILD | WS_CAPTION | WS_GROUP |
|
||||
WS_TABSTOP
|
||||
CAPTION "tab6"
|
||||
FONT 8, "Ms Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "Conversion type",IDC_STATIC_UNIT_CONVERSION,3,2,55,8
|
||||
LTEXT "Input",IDC_STATIC_UNIT_INPUT,60,2,73,8
|
||||
LTEXT "Output",IDC_STATIC_UNIT_OUTPUT,162,2,80,8
|
||||
CONTROL "List1",IDC_LIST_UNIT_TYPE,"SysListView32",LVS_REPORT |
|
||||
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER |
|
||||
WS_BORDER | WS_TABSTOP,3,12,50,56
|
||||
CONTROL "List2a",IDC_LIST_UNIT_INPUT1,"SysListView32",LVS_REPORT |
|
||||
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER |
|
||||
WS_BORDER | WS_TABSTOP,60,12,26,56
|
||||
CONTROL "List2b",IDC_LIST_UNIT_INPUT2,"SysListView32",LVS_REPORT |
|
||||
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER |
|
||||
WS_BORDER | WS_TABSTOP,90,12,65,56
|
||||
CONTROL "List3a",IDC_LIST_UNIT_OUTPUT1,"SysListView32",
|
||||
LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS |
|
||||
LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,161,12,26,56
|
||||
CONTROL "List3b",IDC_LIST_UNIT_OUTPUT2,"SysListView32",
|
||||
LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS |
|
||||
LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,190,12,65,56
|
||||
EDITTEXT IDC_EDIT_OUTPUT_INFO,3,72,152,14,ES_AUTOHSCROLL |
|
||||
ES_READONLY
|
||||
CONTROL "dynamically output",IDC_COMBO_DYNAMIC_OUTPUT,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,162,74,88,10
|
||||
END
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
IDD_ABOUT_DIALOG DIALOG DISCARDABLE 0, 0, 349, 284
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "About"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL 1201,0,"Static",SS_BITMAP,3,3,101,197
|
||||
EDITTEXT 1200,112,3,231,158,ES_MULTILINE | ES_READONLY | NOT
|
||||
WS_BORDER | NOT WS_TABSTOP
|
||||
DEFPUSHBUTTON "Close",IDOK,175,172,86,14
|
||||
CONTROL 1201,0,"Static",SS_BITMAP | SS_REALSIZEIMAGE,3,3,115,277
|
||||
EDITTEXT IDC_ABOUT_TEXT,128,11,215,243,ES_MULTILINE | ES_READONLY |
|
||||
NOT WS_BORDER | NOT WS_TABSTOP
|
||||
DEFPUSHBUTTON "Close",IDOK,191,259,86,14
|
||||
END
|
||||
#else
|
||||
IDD_ABOUT_DIALOG DIALOG DISCARDABLE 0, 0, 268, 362
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "About"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_ABOUT_TEXT,16,18,234,315,ES_MULTILINE | ES_READONLY |
|
||||
NOT WS_BORDER | NOT WS_TABSTOP
|
||||
DEFPUSHBUTTON "Close",IDOK,90,339,86,14
|
||||
END
|
||||
#endif
|
||||
|
||||
IDD_UPDATE_DIALOG DIALOG DISCARDABLE 0, 0, 409, 87
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Check for update"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CTEXT "Checking for update",IDC_UPDATE_INFO1,7,15,394,10
|
||||
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,
|
||||
38,395,14
|
||||
DEFPUSHBUTTON "Next",IDC_BUTTON_NEXT,279,65,60,14
|
||||
PUSHBUTTON "Cancel",IDC_BUTTON_CANCEL,342,65,60,14
|
||||
CTEXT "url",IDC_UPDATE_INFO2,7,26,394,8
|
||||
CONTROL "Always check for the update on sturtup",
|
||||
IDC_CHECK_UPDATE_STURTUP,"Button",BS_AUTOCHECKBOX |
|
||||
WS_TABSTOP,7,67,269,10
|
||||
END
|
||||
|
||||
1201 BITMAP "..\\res\\abacus_01.bmp"
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
IDB_BITMAP_ABOUT BITMAP "..\\res\\aboutbox.bmp"
|
||||
#endif
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2008, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -43,8 +43,10 @@
|
|||
\brief it tells us whether there was a stop signal or not
|
||||
*/
|
||||
|
||||
#include "compileconfig.h"
|
||||
#include <ttmath/ttmathtypes.h>
|
||||
#include <windows.h>
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
/*!
|
||||
|
|
1068
src/tabs.cpp
1068
src/tabs.cpp
File diff suppressed because it is too large
Load Diff
21
src/tabs.h
21
src/tabs.h
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2008, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -49,15 +49,6 @@
|
|||
#include "programresources.h"
|
||||
|
||||
|
||||
//#define WM_INIT_TAB_VARIABLES WM_USER+2
|
||||
//#define WM_INIT_TAB_FUNCTIONS WM_USER+3
|
||||
//#define WM_INIT_TAB_PRECISION WM_USER+4
|
||||
|
||||
#define WM_INIT_TAB_VARIABLES WM_APP
|
||||
#define WM_INIT_TAB_FUNCTIONS WM_APP+1
|
||||
#define WM_INIT_TAB_PRECISION WM_APP+2
|
||||
#define WM_INIT_TAB_DISPLAY WM_APP+3
|
||||
#define WM_SET_LAST_ERROR WM_APP+4
|
||||
|
||||
namespace TabWindowFunctions
|
||||
{
|
||||
|
@ -66,13 +57,15 @@ extern int tab_variables;
|
|||
extern int tab_functions;
|
||||
extern int tab_precision;
|
||||
extern int tab_display;
|
||||
extern int tab_convert;
|
||||
extern ttmath::ErrorCode last_code;
|
||||
|
||||
void PrintErrorCode();
|
||||
BOOL CALLBACK TabWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
void SetLanguage(HWND hTab);
|
||||
void SetSizeOfVariablesList();
|
||||
void SetSizeOfFunctionsList();
|
||||
void SetSizeOfVariablesList(HWND tab, int tabx, int taby, int borderx, int bordery);
|
||||
void SetSizeOfFunctionsList(HWND tab, int tabx, int taby, int borderx, int bordery);
|
||||
void SetSizeOfConvertingLists(HWND tab, int tabx, int taby, int borderx, int bordery);
|
||||
BOOL WmTabCommand(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
void SetSizeOfDialogs();
|
||||
|
||||
|
@ -101,4 +94,6 @@ extern ttmath::ErrorCode last_code;
|
|||
}
|
||||
|
||||
|
||||
using TabWindowFunctions::Variables::GetSelectedItem;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2008, Tomasz Sowa
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "threadcontroller.h"
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
|
||||
ThreadController::ThreadController()
|
||||
{
|
||||
calculations = 0;
|
||||
ready_for_stop = 0;
|
||||
exit_thread = false;
|
||||
}
|
||||
|
||||
|
||||
ThreadController::~ThreadController()
|
||||
{
|
||||
if(calculations) CloseHandle(calculations);
|
||||
if(ready_for_stop) CloseHandle(ready_for_stop);
|
||||
}
|
||||
|
||||
|
||||
bool ThreadController::Init() volatile
|
||||
{
|
||||
char * buffer = new char[300];
|
||||
|
||||
// with 'GetTickCount()' we're generating an unique identifier of our event
|
||||
// (there can be another window of ttcalc)
|
||||
sprintf((char*)buffer,"TTCalcEventForManagingThreads9928%u",
|
||||
(unsigned int)GetTickCount());
|
||||
|
||||
// 'calculations' will be for auto-reseting and initialized as non-signaled
|
||||
if( (calculations = CreateEvent(0,false,false,(char*)buffer))==NULL)
|
||||
{
|
||||
delete [] buffer;
|
||||
return false;
|
||||
}
|
||||
|
||||
sprintf((char*)buffer,"TTCalcEventReadyForStop5567%u",
|
||||
(unsigned int)GetTickCount());
|
||||
|
||||
// 'ready_for_stop' will be for manual-reseting and initialized as signaled
|
||||
// 'manual-reset' means that we must call ResetEvent() function (from WinAPI)
|
||||
// to manually reset the state to nonsignaled
|
||||
if( (ready_for_stop = CreateEvent(0,true,true,(char*)buffer))==NULL)
|
||||
{
|
||||
delete [] buffer;
|
||||
return false;
|
||||
}
|
||||
|
||||
delete [] buffer;
|
||||
|
||||
return stop_calculating.Init();
|
||||
}
|
||||
|
||||
|
||||
void ThreadController::ReadyForStop() volatile
|
||||
{
|
||||
SetEvent( ready_for_stop );
|
||||
}
|
||||
|
||||
|
||||
void ThreadController::StopCalculatingAndExitThread() volatile
|
||||
{
|
||||
WaitForSingleObject(ready_for_stop,INFINITE);
|
||||
|
||||
stop_calculating.Stop();
|
||||
exit_thread = true;
|
||||
SetEvent(calculations);
|
||||
}
|
||||
|
||||
|
||||
void ThreadController::StopCalculating() volatile
|
||||
{
|
||||
WaitForSingleObject(ready_for_stop, INFINITE);
|
||||
|
||||
stop_calculating.Stop();
|
||||
}
|
||||
|
||||
|
||||
void ThreadController::StartCalculating() volatile
|
||||
{
|
||||
SetEvent(calculations);
|
||||
}
|
||||
|
||||
|
||||
volatile bool ThreadController::WaitForCalculatingAndBlockForStop() volatile
|
||||
{
|
||||
WaitForSingleObject(calculations,INFINITE);
|
||||
ResetEvent(ready_for_stop);
|
||||
|
||||
stop_calculating.Start();
|
||||
|
||||
return !exit_thread;
|
||||
}
|
||||
|
||||
|
||||
const volatile ttmath::StopCalculating * ThreadController::GetStopObject() volatile const
|
||||
{
|
||||
return &stop_calculating;
|
||||
}
|
||||
|
||||
|
||||
bool ThreadController::WasStopSignal() volatile const
|
||||
{
|
||||
return stop_calculating.WasStopSignal();
|
||||
}
|
||||
|
||||
|
||||
// private
|
||||
ThreadController::ThreadController(const ThreadController &)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2008, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -80,22 +80,13 @@ public:
|
|||
the default constructor
|
||||
(notice that there'll be only one object of this class)
|
||||
*/
|
||||
ThreadController()
|
||||
{
|
||||
calculations = 0;
|
||||
ready_for_stop = 0;
|
||||
exit_thread = false;
|
||||
}
|
||||
ThreadController();
|
||||
|
||||
|
||||
/*!
|
||||
the destructor
|
||||
*/
|
||||
~ThreadController()
|
||||
{
|
||||
if(calculations) CloseHandle(calculations);
|
||||
if(ready_for_stop) CloseHandle(ready_for_stop);
|
||||
}
|
||||
~ThreadController();
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -103,38 +94,7 @@ public:
|
|||
|
||||
we create two system event and initialize the 'stop_calculating' object
|
||||
*/
|
||||
bool Init() volatile
|
||||
{
|
||||
char * buffer = new char[300];
|
||||
|
||||
// with 'GetTickCount()' we're generating an unique identifier of our event
|
||||
// (there can be another window of ttcalc)
|
||||
sprintf((char*)buffer,"TTCalcEventForManagingThreads9928%u",
|
||||
(unsigned int)GetTickCount());
|
||||
|
||||
// 'calculations' will be for auto-reseting and initialized as non-signaled
|
||||
if( (calculations = CreateEvent(0,false,false,(char*)buffer))==NULL)
|
||||
{
|
||||
delete [] buffer;
|
||||
return false;
|
||||
}
|
||||
|
||||
sprintf((char*)buffer,"TTCalcEventReadyForStop5567%u",
|
||||
(unsigned int)GetTickCount());
|
||||
|
||||
// 'ready_for_stop' will be for manual-reseting and initialized as signaled
|
||||
// 'manual-reset' means that we must call ResetEvent() function (from WinAPI)
|
||||
// to manually reset the state to nonsignaled
|
||||
if( (ready_for_stop = CreateEvent(0,true,true,(char*)buffer))==NULL)
|
||||
{
|
||||
delete [] buffer;
|
||||
return false;
|
||||
}
|
||||
|
||||
delete [] buffer;
|
||||
|
||||
return stop_calculating.Init();
|
||||
}
|
||||
bool Init() volatile;
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -143,10 +103,7 @@ public:
|
|||
string, user-defined variables, functions etc.) and when the second thread
|
||||
will have finished that then it call ReadyForStop() method
|
||||
*/
|
||||
void ReadyForStop() volatile
|
||||
{
|
||||
SetEvent( ready_for_stop );
|
||||
}
|
||||
void ReadyForStop() volatile;
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -154,14 +111,7 @@ public:
|
|||
close button we call StopCalculatingAndExitThread() from the first main thread (gui),
|
||||
it means that the second thread (calculations) will finish itself
|
||||
*/
|
||||
void StopCalculatingAndExitThread() volatile
|
||||
{
|
||||
WaitForSingleObject(ready_for_stop,INFINITE);
|
||||
|
||||
stop_calculating.Stop();
|
||||
exit_thread = true;
|
||||
SetEvent(calculations);
|
||||
}
|
||||
void StopCalculatingAndExitThread() volatile;
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -172,12 +122,7 @@ public:
|
|||
of copying variables) then sets the 'stop object' for signaled and returns to
|
||||
the caller
|
||||
*/
|
||||
void StopCalculating() volatile
|
||||
{
|
||||
WaitForSingleObject(ready_for_stop, INFINITE);
|
||||
|
||||
stop_calculating.Stop();
|
||||
}
|
||||
void StopCalculating() volatile;
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -185,67 +130,49 @@ public:
|
|||
in other words it means that the calculations will start
|
||||
(maybe now, maybe at once if the second thread is still working)
|
||||
*/
|
||||
void StartCalculating() volatile
|
||||
{
|
||||
SetEvent(calculations);
|
||||
}
|
||||
void StartCalculating() volatile;
|
||||
|
||||
|
||||
/*!
|
||||
this is the main method which is used by the second thread,
|
||||
if there's nothing to do this method (and the second thread as well) waits
|
||||
*/
|
||||
volatile bool WaitForCalculatingAndBlockForStop() volatile
|
||||
{
|
||||
WaitForSingleObject(calculations,INFINITE);
|
||||
ResetEvent(ready_for_stop);
|
||||
|
||||
stop_calculating.Start();
|
||||
|
||||
return !exit_thread;
|
||||
}
|
||||
volatile bool WaitForCalculatingAndBlockForStop() volatile;
|
||||
|
||||
|
||||
/*!
|
||||
this method returns the pointer to the 'stop object'
|
||||
it's used by the second thread during calculating
|
||||
*/
|
||||
const volatile ttmath::StopCalculating * GetStopObject() volatile const
|
||||
{
|
||||
return &stop_calculating;
|
||||
}
|
||||
const volatile ttmath::StopCalculating * GetStopObject() volatile const;
|
||||
|
||||
|
||||
/*!
|
||||
it returns 'true' if there was a stop signal during calculating
|
||||
the stop signal can be caused by the first thread (gui thread)
|
||||
*/
|
||||
bool WasStopSignal() volatile const
|
||||
{
|
||||
return stop_calculating.WasStopSignal();
|
||||
}
|
||||
bool WasStopSignal() volatile const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// auto-reset, initialized as non-signaled
|
||||
HANDLE calculations;
|
||||
// auto-reset, initialized as non-signaled
|
||||
HANDLE calculations;
|
||||
|
||||
// manual-reset, initialized as signaled
|
||||
HANDLE ready_for_stop;
|
||||
// manual-reset, initialized as signaled
|
||||
HANDLE ready_for_stop;
|
||||
|
||||
bool exit_thread;
|
||||
bool exit_thread;
|
||||
|
||||
NewStopCalculating stop_calculating;
|
||||
NewStopCalculating stop_calculating;
|
||||
|
||||
|
||||
/*!
|
||||
we make the copy-constructor private so that nobody will be able
|
||||
to make a copy of the one object of this class
|
||||
*/
|
||||
ThreadController(const ThreadController & c)
|
||||
{
|
||||
}
|
||||
ThreadController(const ThreadController &);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,672 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2011, Tomasz Sowa
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
#include "compileconfig.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <shlobj.h>
|
||||
#include <process.h>
|
||||
|
||||
#include "update.h"
|
||||
#include "programresources.h"
|
||||
#include "messages.h"
|
||||
#include "resource.h"
|
||||
#include "languages.h"
|
||||
#include "winmain.h"
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
|
||||
namespace Update
|
||||
{
|
||||
bool continue_down;
|
||||
int level;
|
||||
std::string url;
|
||||
std::string remote_file_name;
|
||||
std::string local_file_name;
|
||||
int major;
|
||||
int minor;
|
||||
int revision;
|
||||
int prerelease;
|
||||
|
||||
// this is set by another thread at the beginning
|
||||
namespace Background
|
||||
{
|
||||
std::string url_;
|
||||
std::string remote_file_name_;
|
||||
int major_;
|
||||
int minor_;
|
||||
int revision_;
|
||||
int prerelease_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
*/
|
||||
DownloadIni::DownloadIni()
|
||||
{
|
||||
file = 0;
|
||||
file_name = new char[MAX_PATH];
|
||||
file_name[0] = 0;
|
||||
continue_download = 0;
|
||||
}
|
||||
|
||||
|
||||
DownloadIni::~DownloadIni()
|
||||
{
|
||||
if( file )
|
||||
fclose(file);
|
||||
|
||||
DeleteTmpFile();
|
||||
|
||||
delete [] file_name;
|
||||
}
|
||||
|
||||
|
||||
void DownloadIni::DeleteTmpFile()
|
||||
{
|
||||
if( file_name[0] != 0 )
|
||||
DeleteFile(file_name);
|
||||
}
|
||||
|
||||
const char * DownloadIni::GetFileName()
|
||||
{
|
||||
return file_name;
|
||||
}
|
||||
|
||||
|
||||
FILE * DownloadIni::CreateTmpFile()
|
||||
{
|
||||
char buf[MAX_PATH];
|
||||
|
||||
file = 0;
|
||||
file_name[0] = 0;
|
||||
|
||||
if( !GetTempPath(MAX_PATH, buf) )
|
||||
return 0;
|
||||
|
||||
|
||||
if( !GetTempFileName(buf, "ttcalc_", 0, file_name) )
|
||||
{
|
||||
file_name[0] = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
file = fopen(file_name, "wb");
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
void DownloadIni::GetLen(HINTERNET conn)
|
||||
{
|
||||
char buf[100];
|
||||
DWORD buf_len = sizeof(buf);
|
||||
DWORD index = 0;
|
||||
|
||||
if( HttpQueryInfo(conn, HTTP_QUERY_CONTENT_LENGTH, buf, &buf_len, &index) )
|
||||
all_len = atoi(buf);
|
||||
else
|
||||
all_len = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool DownloadIni::Init()
|
||||
{
|
||||
if( !CreateTmpFile() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool DownloadIni::Read(char * buffer, size_t size)
|
||||
{
|
||||
if( !file )
|
||||
return false;
|
||||
|
||||
fwrite(buffer, size, 1, file);
|
||||
CheckMessages();
|
||||
|
||||
if( continue_download && !(*continue_download) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DownloadIni::DownloadUrl(const char * url, bool * c)
|
||||
{
|
||||
continue_download = c;
|
||||
|
||||
return Download::DownloadUrl(url);
|
||||
}
|
||||
|
||||
|
||||
void DownloadIni::Close()
|
||||
{
|
||||
if( file )
|
||||
fclose(file);
|
||||
|
||||
file = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
DownloadProgram::DownloadProgram()
|
||||
{
|
||||
continue_download = 0;
|
||||
}
|
||||
|
||||
|
||||
void DownloadProgram::GetLen(HINTERNET conn)
|
||||
{
|
||||
char buf[100];
|
||||
DWORD buf_len = sizeof(buf);
|
||||
DWORD index = 0;
|
||||
|
||||
if( HttpQueryInfo(conn, HTTP_QUERY_CONTENT_LENGTH, buf, &buf_len, &index) )
|
||||
all_len = atoi(buf);
|
||||
else
|
||||
all_len = 0;
|
||||
}
|
||||
|
||||
|
||||
bool DownloadProgram::Init()
|
||||
{
|
||||
file.open(Update::local_file_name.c_str(), std::ios_base::out | std::ios_base::binary);
|
||||
|
||||
if( !file )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool DownloadProgram::Read(char * buffer, size_t size)
|
||||
{
|
||||
file.write(buffer, size);
|
||||
CheckMessages();
|
||||
|
||||
if( continue_download && !(*continue_download) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DownloadProgram::DownloadUrl(const char * url, bool * c)
|
||||
{
|
||||
continue_download = c;
|
||||
|
||||
return Download::DownloadUrl(url);
|
||||
}
|
||||
|
||||
|
||||
void DownloadProgram::Close()
|
||||
{
|
||||
file.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
we check whether the download url is correct
|
||||
this is in the case of someone hacked the server with *.ini file
|
||||
*/
|
||||
bool IsServerCorrect(const std::string & url)
|
||||
{
|
||||
if( IsSubStringNoCase("http://downloads.sourceforge.net/", url.c_str()) ||
|
||||
IsSubStringNoCase("ftp://ttmath.org/", url.c_str()) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
this method is called from the other thread too
|
||||
make sure you don't write directly to any global variables (from Update namespace etc)
|
||||
*/
|
||||
bool CheckUpdateFromIni(HWND hwnd, std::string & url_, std::string & remote_file_name_,
|
||||
int & major_, int & minor_, int & revision_, int & prerelease_,
|
||||
bool * continue_download_)
|
||||
{
|
||||
DownloadIni down_ini;
|
||||
|
||||
if( hwnd )
|
||||
down_ini.AttachProgress(GetDlgItem(hwnd, IDC_PROGRESS));
|
||||
|
||||
if( down_ini.DownloadUrl("http://update.ttmath.org/ttcalc_update.ini", continue_download_) )
|
||||
{
|
||||
IniParser iparser;
|
||||
std::string ini_value[4];
|
||||
|
||||
iparser.SectionCaseSensitive(false);
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
iparser.Associate("normal|url", &url_ );
|
||||
iparser.Associate("normal|filename", &remote_file_name_ );
|
||||
iparser.Associate("normal|version.major", &ini_value[0] );
|
||||
iparser.Associate("normal|version.minor", &ini_value[1] );
|
||||
iparser.Associate("normal|version.revision", &ini_value[2] );
|
||||
iparser.Associate("normal|version.prerelease", &ini_value[3] );
|
||||
|
||||
#else
|
||||
iparser.Associate("portable|url", &url_ );
|
||||
iparser.Associate("portable|filename", &remote_file_name_ );
|
||||
iparser.Associate("portable|version.major", &ini_value[0] );
|
||||
iparser.Associate("portable|version.minor", &ini_value[1] );
|
||||
iparser.Associate("portable|version.revision", &ini_value[2] );
|
||||
iparser.Associate("portable|version.prerelease",&ini_value[3] );
|
||||
#endif
|
||||
|
||||
IniParser::Error err = iparser.ReadFromFile( down_ini.GetFileName() );
|
||||
|
||||
if( err == IniParser::err_ok && IsServerCorrect(url_) )
|
||||
{
|
||||
major_ = atoi(ini_value[0].c_str());
|
||||
minor_ = atoi(ini_value[1].c_str());
|
||||
revision_ = atoi(ini_value[2].c_str());
|
||||
prerelease_ = atoi(ini_value[3].c_str());
|
||||
|
||||
if( major_ > TTCALC_MAJOR_VER )
|
||||
return true;
|
||||
else
|
||||
if( major_ == TTCALC_MAJOR_VER && minor_ > TTCALC_MINOR_VER )
|
||||
return true;
|
||||
else
|
||||
if( major_ == TTCALC_MAJOR_VER && minor_ == TTCALC_MINOR_VER && revision_ > TTCALC_REVISION_VER )
|
||||
return true;
|
||||
else
|
||||
if( major_ == TTCALC_MAJOR_VER && minor_ == TTCALC_MINOR_VER && revision_ == TTCALC_REVISION_VER &&
|
||||
prerelease_ < TTCALC_PRERELEASE_VER )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Update
|
||||
{
|
||||
|
||||
|
||||
|
||||
void CheckUpdate(HWND hwnd)
|
||||
{
|
||||
char buffer[200];
|
||||
|
||||
level = -1; // nothing to do when Next is pressed
|
||||
continue_down = true;
|
||||
Languages * pl = GetPrgRes()->GetLanguages();
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BUTTON_NEXT), false);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_UPDATE_INFO1), false);
|
||||
ShowWindow(GetDlgItem(hwnd, IDC_PROGRESS), SW_SHOW);
|
||||
CheckMessages();
|
||||
|
||||
if( CheckUpdateFromIni(hwnd, url, remote_file_name, major, minor, revision, prerelease, &continue_down) )
|
||||
{
|
||||
level = 1;
|
||||
sprintf(buffer, pl->GuiMessage(Languages::update_is_new_version), major, minor, revision);
|
||||
SetDlgItemText(hwnd, IDC_UPDATE_INFO1, buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
level = 100;
|
||||
SetDlgItemText(hwnd, IDC_UPDATE_INFO1, pl->GuiMessage(Languages::update_no_new_version1));
|
||||
SetDlgItemText(hwnd, IDC_UPDATE_INFO2, pl->GuiMessage(Languages::update_no_new_version2));
|
||||
SetDlgItemText(hwnd, IDC_BUTTON_NEXT, pl->GuiMessage(Languages::update_button_finish));
|
||||
ShowWindow(GetDlgItem(hwnd, IDC_PROGRESS), SW_HIDE);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BUTTON_CANCEL), false);
|
||||
}
|
||||
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BUTTON_NEXT), true);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_UPDATE_INFO1), true);
|
||||
ShowWindow(GetDlgItem(hwnd, IDC_PROGRESS), SW_HIDE);
|
||||
SetFocus(GetDlgItem(hwnd, IDC_BUTTON_NEXT));
|
||||
}
|
||||
|
||||
|
||||
bool SaveDialog(HWND hwnd)
|
||||
{
|
||||
OPENFILENAME o;
|
||||
char buf[MAX_PATH], desktop[MAX_PATH];
|
||||
|
||||
if( !remote_file_name.empty() )
|
||||
sprintf(buf, remote_file_name.c_str());
|
||||
else
|
||||
{
|
||||
#ifndef TTCALC_PORTABLE
|
||||
sprintf(buf, "ttcalc-%d.%d.%d-setup.exe", major, minor, revision);
|
||||
#else
|
||||
sprintf(buf, "ttcalc-portable-%d.%d.%d-bin.tar.gz", major, minor, revision);
|
||||
#endif
|
||||
}
|
||||
|
||||
if( !SHGetSpecialFolderPath(hwnd, desktop, CSIDL_DESKTOPDIRECTORY, 0) )
|
||||
desktop[0] = 0;
|
||||
|
||||
o.lStructSize = sizeof(o);
|
||||
o.hwndOwner = hwnd;
|
||||
o.hInstance = GetPrgRes()->GetInstance();
|
||||
o.lpstrFilter = "*.*\0*.*\0";
|
||||
o.lpstrCustomFilter = 0;
|
||||
o.nMaxCustFilter = 0;
|
||||
o.nFilterIndex = 1;
|
||||
o.lpstrFile = buf;
|
||||
o.nMaxFile = MAX_PATH;
|
||||
o.lpstrFileTitle = 0;
|
||||
o.nMaxFileTitle = 0;
|
||||
o.lpstrInitialDir = (desktop[0]) ? desktop : 0;
|
||||
o.lpstrTitle = 0;
|
||||
o.Flags = OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST;
|
||||
o.nFileOffset = 0;
|
||||
o.nFileExtension = 0;
|
||||
o.lpstrDefExt = 0;
|
||||
o.lCustData = 0;
|
||||
o.lpfnHook = 0;
|
||||
o.lpTemplateName = 0;
|
||||
|
||||
|
||||
if( GetSaveFileName(&o) )
|
||||
{
|
||||
local_file_name = buf;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool DownloadUpdate(HWND hwnd)
|
||||
{
|
||||
DownloadProgram down;
|
||||
|
||||
level = -1; // nothing to do when Next is pressed
|
||||
continue_down = true;
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BUTTON_NEXT), false);
|
||||
Languages * pl = GetPrgRes()->GetLanguages();
|
||||
|
||||
if( SaveDialog(hwnd) )
|
||||
{
|
||||
SetDlgItemText(hwnd, IDC_UPDATE_INFO1, pl->GuiMessage(Languages::update_download_from));
|
||||
SetDlgItemText(hwnd, IDC_UPDATE_INFO2, url.c_str());
|
||||
ShowWindow(GetDlgItem(hwnd, IDC_PROGRESS), SW_SHOW);
|
||||
|
||||
down.AttachProgress(GetDlgItem(hwnd, IDC_PROGRESS));
|
||||
CheckMessages();
|
||||
|
||||
if( down.DownloadUrl(url.c_str(), &continue_down) )
|
||||
{
|
||||
SetDlgItemText(hwnd, IDC_UPDATE_INFO1, pl->GuiMessage(Languages::update_downloaded_info1));
|
||||
SetDlgItemText(hwnd, IDC_UPDATE_INFO2, pl->GuiMessage(Languages::update_downloaded_info2));
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
level = 2;
|
||||
#else
|
||||
level = 100;
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BUTTON_CANCEL), false);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
level = 100;
|
||||
DeleteFile(local_file_name.c_str());
|
||||
SetDlgItemText(hwnd, IDC_UPDATE_INFO1, pl->GuiMessage(Languages::update_download_error));
|
||||
SetDlgItemText(hwnd, IDC_UPDATE_INFO2, "");
|
||||
}
|
||||
|
||||
ShowWindow(GetDlgItem(hwnd, IDC_PROGRESS), SW_HIDE);
|
||||
SetDlgItemText(hwnd, IDC_BUTTON_NEXT, pl->GuiMessage(Languages::update_button_finish));
|
||||
}
|
||||
else
|
||||
{
|
||||
level = 100;
|
||||
EndDialog(hwnd, 0);
|
||||
}
|
||||
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_BUTTON_NEXT), true);
|
||||
SetFocus(GetDlgItem(hwnd, IDC_BUTTON_NEXT));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOL UpdateInit(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
Languages * pl = GetPrgRes()->GetLanguages();
|
||||
|
||||
if( level == 0 )
|
||||
{
|
||||
SetDlgItemText(hwnd, IDC_UPDATE_INFO1, pl->GuiMessage(Languages::update_check_for_info));
|
||||
}
|
||||
else
|
||||
if( level == 1 )
|
||||
{
|
||||
char buffer[200];
|
||||
|
||||
sprintf(buffer, pl->GuiMessage(Languages::update_is_new_version), major, minor, revision);
|
||||
SetDlgItemText(hwnd, IDC_UPDATE_INFO1, buffer);
|
||||
}
|
||||
|
||||
SetDlgItemText(hwnd, IDC_UPDATE_INFO2, "");
|
||||
SetDlgItemText(hwnd, IDC_BUTTON_NEXT, pl->GuiMessage(Languages::update_button_next));
|
||||
SetDlgItemText(hwnd, IDC_BUTTON_CANCEL, pl->GuiMessage(Languages::update_button_cancel));
|
||||
SetWindowText(hwnd, pl->GuiMessage(Languages::update_title));
|
||||
SetDlgItemText(hwnd, IDC_CHECK_UPDATE_STURTUP, pl->GuiMessage(Languages::update_check_at_startup));
|
||||
|
||||
if( GetPrgRes()->GetCheckUpdateStartup() )
|
||||
CheckDlgButton(hwnd, IDC_CHECK_UPDATE_STURTUP, BST_CHECKED);
|
||||
|
||||
ShowWindow(GetDlgItem(hwnd, IDC_PROGRESS), SW_HIDE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
BOOL UpdateCommand(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if( LOWORD(wParam)==IDCANCEL || LOWORD(wParam)==IDC_BUTTON_CANCEL )
|
||||
{
|
||||
continue_down = false;
|
||||
EndDialog(hwnd, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( LOWORD(wParam) == IDC_CHECK_UPDATE_STURTUP )
|
||||
{
|
||||
GetPrgRes()->SetCheckUpdateStartup( IsDlgButtonChecked(hwnd, IDC_CHECK_UPDATE_STURTUP)==BST_CHECKED );
|
||||
}
|
||||
else
|
||||
if( LOWORD(wParam) == IDC_BUTTON_NEXT )
|
||||
{
|
||||
switch(level)
|
||||
{
|
||||
case 0:
|
||||
CheckUpdate(hwnd);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
DownloadUpdate(hwnd);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ShellExecute(0, "open", local_file_name.c_str(), "", "", SW_SHOWNORMAL);
|
||||
EndDialog(hwnd, 0);
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case 100:
|
||||
EndDialog(hwnd, 0);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void CreateUpdateMessagesTable(Messages<BOOL> & messages)
|
||||
{
|
||||
messages.Associate(WM_INITDIALOG, UpdateInit);
|
||||
messages.Associate(WM_COMMAND, UpdateCommand);
|
||||
}
|
||||
|
||||
|
||||
BOOL CALLBACK UpdateProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static Messages<BOOL> messages;
|
||||
|
||||
if( messages.Empty() )
|
||||
// initiation
|
||||
CreateUpdateMessagesTable(messages);
|
||||
|
||||
return messages.Call(msg, hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned __stdcall UpdateBackgroundProc(void *)
|
||||
{
|
||||
using namespace Background;
|
||||
|
||||
try
|
||||
{
|
||||
if( CheckUpdateFromIni(0, url_, remote_file_name_, major_, minor_, revision_, prerelease_, 0) )
|
||||
{
|
||||
HWND main = GetPrgRes()->GetMainWindow();
|
||||
PostMessage(main, WM_UPDATE_EXISTS, 0, 0);
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
|
||||
_endthreadex(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ShowUpdateDialog(HWND hwnd)
|
||||
{
|
||||
using namespace Update;
|
||||
|
||||
level = 0;
|
||||
local_file_name.clear();
|
||||
remote_file_name.clear();
|
||||
url.clear();
|
||||
|
||||
DialogBox(GetPrgRes()->GetInstance(), MAKEINTRESOURCE(IDD_UPDATE_DIALOG), hwnd, UpdateProc);
|
||||
}
|
||||
|
||||
|
||||
void ShowUpdateDialogAfterCheck(HWND hwnd)
|
||||
{
|
||||
using namespace Update;
|
||||
|
||||
level = 1;
|
||||
local_file_name.clear();
|
||||
|
||||
// make sure that there is a memory barrier before reading next objects (those from Background::)
|
||||
// objects from Background:: are set by an another thread at the beginning
|
||||
// when we are here then the thread is not writing (it exited)
|
||||
remote_file_name = Background::remote_file_name_;
|
||||
url = Background::url_;
|
||||
major = Background::major_;
|
||||
minor = Background::minor_;
|
||||
revision = Background::revision_;
|
||||
|
||||
DialogBox(GetPrgRes()->GetInstance(), MAKEINTRESOURCE(IDD_UPDATE_DIALOG), hwnd, UpdateProc);
|
||||
}
|
||||
|
||||
|
||||
void CheckUpdateInBackground()
|
||||
{
|
||||
time_t last = GetPrgRes()->GetLastUpdate();
|
||||
time_t now = time(0);
|
||||
|
||||
// testing only once a three days (259200 = 60*60*24 * 3)
|
||||
if( GetPrgRes()->GetCheckUpdateStartup() && last+259200 < now )
|
||||
{
|
||||
// this setting can be added also when a user selects manually the test for an update
|
||||
GetPrgRes()->SetLastUpdate(now);
|
||||
|
||||
unsigned int thread_id;
|
||||
_beginthreadex(0, 0, Update::UpdateBackgroundProc, 0, 0, &thread_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2009, Tomasz Sowa
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef headerfileupdate
|
||||
#define headerfileupdate
|
||||
|
||||
#include <windows.h>
|
||||
#include <fstream>
|
||||
#include <cstdio>
|
||||
#include "download.h"
|
||||
|
||||
|
||||
void ShowUpdateDialog(HWND hwnd);
|
||||
void ShowUpdateDialogAfterCheck(HWND hwnd);
|
||||
void CheckUpdateInBackground();
|
||||
|
||||
|
||||
|
||||
class DownloadIni : public Download
|
||||
{
|
||||
public:
|
||||
DownloadIni();
|
||||
~DownloadIni();
|
||||
void DeleteTmpFile();
|
||||
const char * GetFileName();
|
||||
bool DownloadUrl(const char * url, bool * continue_download = 0);
|
||||
|
||||
private:
|
||||
|
||||
FILE * CreateTmpFile();
|
||||
virtual void GetLen(HINTERNET conn);
|
||||
virtual bool Init();
|
||||
virtual bool Read(char * buffer, size_t size);
|
||||
virtual void Close();
|
||||
|
||||
char * file_name;
|
||||
FILE * file;
|
||||
bool * continue_download;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class DownloadProgram : public Download
|
||||
{
|
||||
public:
|
||||
DownloadProgram();
|
||||
bool DownloadUrl(const char * url, bool * continue_download = 0);
|
||||
|
||||
private:
|
||||
virtual void GetLen(HINTERNET conn);
|
||||
virtual bool Init();
|
||||
virtual bool Read(char * buffer, size_t size);
|
||||
virtual void Close();
|
||||
|
||||
std::ofstream file;
|
||||
bool * continue_download;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -97,9 +97,14 @@ char * pchar;
|
|||
SetDlgItemText(hWnd,IDC_EDIT_VARIABLE_VALUE, value.c_str());
|
||||
|
||||
if( adding)
|
||||
{
|
||||
SetFocus(GetDlgItem(hWnd,IDC_EDIT_VARIABLE_NAME));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFocus(GetDlgItem(hWnd,IDC_EDIT_VARIABLE_VALUE));
|
||||
SendDlgItemMessage(hWnd, IDC_EDIT_VARIABLE_VALUE, EM_SETSEL, value.size(), value.size());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
|
@ -109,10 +114,10 @@ char * pchar;
|
|||
pchar = new char[temporary_buffer_size];
|
||||
|
||||
GetDlgItemText(hWnd, IDC_EDIT_VARIABLE_NAME, pchar, temporary_buffer_size);
|
||||
name = ChangeToSmallLetters( StripWhiteCharacters(pchar) );
|
||||
name = StripWhiteCharacters(pchar);
|
||||
|
||||
GetDlgItemText(hWnd, IDC_EDIT_VARIABLE_VALUE, pchar, temporary_buffer_size);
|
||||
value = ChangeToSmallLetters( StripWhiteCharacters(pchar) );
|
||||
value = StripWhiteCharacters(pchar);
|
||||
|
||||
delete [] pchar;
|
||||
|
||||
|
@ -254,6 +259,7 @@ BOOL WmTabCommand_AddVariable(HWND, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
GetPrgRes()->GetThreadController()->StopCalculating();
|
||||
code = GetPrgRes()->GetVariables()->Add(name, value);
|
||||
GetPrgRes()->VariablesChanged();
|
||||
GetPrgRes()->GetThreadController()->StartCalculating();
|
||||
|
||||
if( code != ttmath::err_ok )
|
||||
|
@ -262,6 +268,8 @@ BOOL WmTabCommand_AddVariable(HWND, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
int id = AddNewItemToVariableList(list, name, value);
|
||||
SelectOnlyOneItem(list,id);
|
||||
GetPrgRes()->ReadVariablesFunctionsFromFile();
|
||||
GetPrgRes()->SaveToFile();
|
||||
}
|
||||
}
|
||||
while( code != ttmath::err_ok );
|
||||
|
@ -317,12 +325,17 @@ adding = false;
|
|||
code = GetPrgRes()->GetVariables()->EditValue(name, value);
|
||||
// the code should be err_ok here
|
||||
|
||||
GetPrgRes()->VariablesChanged();
|
||||
GetPrgRes()->GetThreadController()->StartCalculating();
|
||||
|
||||
if( code != ttmath::err_ok )
|
||||
ShowError(list, code);
|
||||
else
|
||||
{
|
||||
ChangeItemInVariableList(list, id, old_name, name, value);
|
||||
GetPrgRes()->ReadVariablesFunctionsFromFile();
|
||||
GetPrgRes()->SaveToFile();
|
||||
}
|
||||
}
|
||||
while( code != ttmath::err_ok );
|
||||
|
||||
|
@ -355,6 +368,7 @@ int items = ListView_GetSelectedCount(list);
|
|||
char * buffer = new char[buffer_size];
|
||||
bool all_deleted = true;
|
||||
|
||||
GetPrgRes()->ReadVariablesFunctionsFromFile();
|
||||
GetPrgRes()->GetThreadController()->StopCalculating();
|
||||
|
||||
for( id = ListView_GetItemCount(list)-1 ; id!=-1 ; --id )
|
||||
|
@ -366,10 +380,14 @@ int items = ListView_GetSelectedCount(list);
|
|||
all_deleted = false;
|
||||
else
|
||||
ListView_DeleteItem(list, id);
|
||||
|
||||
GetPrgRes()->VariablesChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GetPrgRes()->GetThreadController()->StartCalculating();
|
||||
GetPrgRes()->SaveToFile();
|
||||
|
||||
delete [] buffer;
|
||||
|
||||
|
|
226
src/winmain.cpp
226
src/winmain.cpp
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -37,25 +37,41 @@
|
|||
|
||||
#include "compileconfig.h"
|
||||
#include "winmain.h"
|
||||
#include "update.h"
|
||||
|
||||
/*!
|
||||
\file mainwin.cpp
|
||||
\brief There's defined the entry point to the application
|
||||
\brief There's defined the entry point to the application in this file
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <ttmath/ttmath.h>
|
||||
|
||||
|
||||
/*!
|
||||
here our application starts
|
||||
the application starts here
|
||||
*/
|
||||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
||||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR par, int)
|
||||
{
|
||||
if( strcmp(par, "createconfig") == 0 )
|
||||
{
|
||||
GetPrgRes()->SetConfigName();
|
||||
GetPrgRes()->SaveToFile();
|
||||
return 0;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
GetPrgRes()->SetInstance(hInstance);
|
||||
|
||||
// we're using GetLanguages() simultaneously in two threads, this is to be sure
|
||||
// that everything is initialized before the second thread is started
|
||||
GetPrgRes()->GetLanguages()->InitAll();
|
||||
GetPrgRes()->GetLanguages()->SetCurrentLanguage(Languages::en);
|
||||
GetPrgRes()->SetNameOfConfigurationFile();
|
||||
//GetPrgRes()->GetConvert()->Init();
|
||||
GetPrgRes()->SetNameOfFiles();
|
||||
GetPrgRes()->ReadFromFile();
|
||||
|
||||
|
||||
INITCOMMONCONTROLSEX common_ctrl;
|
||||
common_ctrl.dwSize = sizeof(common_ctrl);
|
||||
common_ctrl.dwICC = ICC_WIN95_CLASSES;
|
||||
|
@ -66,23 +82,51 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||
if( !GetPrgRes()->GetThreadController()->Init() )
|
||||
return ShowError( Languages::cant_init_calculations );
|
||||
|
||||
unsigned int thread_id;
|
||||
unsigned int thread_id;
|
||||
uintptr_t thread_handle;
|
||||
if( (thread_handle = _beginthreadex(0,0,CalculationsProcedure, 0, 0, &thread_id)) == 0 )
|
||||
return ShowError( Languages::cant_create_thread );
|
||||
|
||||
bool maximized_from_file = GetPrgRes()->GetMaximized();
|
||||
CreateDialog( hInstance, MAKEINTRESOURCE(IDD_MAIN_DIALOG), 0, MainWindowProc);
|
||||
|
||||
if( !GetPrgRes()->GetMainWindow() )
|
||||
return ShowError( Languages::cant_create_main_window );
|
||||
|
||||
if( maximized_from_file )
|
||||
{
|
||||
GetPrgRes()->SetMaximized(true);
|
||||
ShowWindow(GetPrgRes()->GetMainWindow(), SW_SHOWMAXIMIZED);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetPrgRes()->SetMaximized(false);
|
||||
ShowWindow(GetPrgRes()->GetMainWindow(), SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
// there's the main loop of messages here
|
||||
if( !CreatePadWindow() )
|
||||
return ShowError( Languages::cant_create_pad );
|
||||
|
||||
// checking for an update (in an another thread)
|
||||
CheckUpdateInBackground();
|
||||
|
||||
// the main loop of messages
|
||||
MainMessagesLoop();
|
||||
|
||||
// there can be another variables/functions saved by other instantion of TTCalc
|
||||
// we're reading them now
|
||||
GetPrgRes()->ReadVariablesFunctionsFromFile();
|
||||
GetPrgRes()->SaveToFile();
|
||||
|
||||
DestroyPadWindow();
|
||||
CloseHandle( (HANDLE)thread_handle );
|
||||
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
ShowError( Languages::unknown_error );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -101,6 +145,112 @@ return static_cast<int>( error_code );
|
|||
}
|
||||
|
||||
|
||||
bool AcceleratorForMainWindow(MSG & msg)
|
||||
{
|
||||
bool sent = true;
|
||||
|
||||
switch( msg.wParam )
|
||||
{
|
||||
case 'C':
|
||||
sent = MainWindowFunctions::CopySpecial();
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
sent = MainWindowFunctions::CopyResult();
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
sent = MainWindowFunctions::PasteFormula();
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
sent = SendMessage(GetPrgRes()->GetMainWindow(), WM_COMMAND, IDM_EDIT_COPY_BOTH, 0);
|
||||
break;
|
||||
|
||||
case 'W':
|
||||
sent = SendMessage(GetPrgRes()->GetMainWindow(), WM_COMMAND, IDM_EDIT_SWAP, 0);
|
||||
break;
|
||||
|
||||
case '0':
|
||||
SendMessage(GetPrgRes()->GetMainWindow(), WM_COMMAND, IDC_BUTTON_BRACKETS_ALL, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
sent = false;
|
||||
}
|
||||
|
||||
return sent;
|
||||
}
|
||||
|
||||
|
||||
bool AcceleratorForPadEdit(MSG & msg)
|
||||
{
|
||||
if( msg.wParam == 'A' )
|
||||
{
|
||||
SendMessage(GetPrgRes()->GetPadWindow(), WM_COMMAND, MENUPAD_EDIT_SELECTALL, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool CheckAcceleratorKeys(MSG & msg)
|
||||
{
|
||||
if( msg.message != WM_KEYDOWN )
|
||||
return false;
|
||||
|
||||
if( (GetKeyState(VK_CONTROL) & 0xff00) == 0 )
|
||||
return false;
|
||||
|
||||
if( msg.hwnd == GetPrgRes()->GetPadEdit() )
|
||||
return AcceleratorForPadEdit(msg);
|
||||
|
||||
return AcceleratorForMainWindow(msg);
|
||||
}
|
||||
|
||||
|
||||
void SendMessage(MSG & msg)
|
||||
{
|
||||
bool sent = CheckAcceleratorKeys(msg);
|
||||
|
||||
// we give our own special function for navigating from the keyboard
|
||||
// if our function returns false then we use a standard navigation
|
||||
// from the system
|
||||
if( !sent && msg.message == WM_KEYDOWN &&
|
||||
( msg.wParam == VK_TAB ||
|
||||
msg.wParam == VK_DOWN || msg.wParam == VK_UP ||
|
||||
msg.wParam == VK_LEFT || msg.wParam == VK_DOWN ) )
|
||||
|
||||
{
|
||||
if( MainWindowFunctions::SetNextFocus(msg.wParam) )
|
||||
sent = true;
|
||||
}
|
||||
|
||||
|
||||
// firt we try to send our message to dialogs
|
||||
// (the dialogs on the tab control)
|
||||
if( !sent )
|
||||
{
|
||||
for(unsigned int i=0 ; i<GetPrgRes()->HowManyTabWindows() && !sent ; ++i)
|
||||
{
|
||||
if( IsDialogMessage(GetPrgRes()->GetTabWindow(i), &msg) )
|
||||
sent = true;
|
||||
}
|
||||
}
|
||||
|
||||
// if it's not a message to any of our dialogs we send it
|
||||
// to the main window (it's a dialog as well)
|
||||
if( !sent )
|
||||
{
|
||||
if( !IsDialogMessage(GetPrgRes()->GetMainWindow(), &msg) )
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
the main loop of messages
|
||||
|
@ -110,54 +260,30 @@ void MainMessagesLoop()
|
|||
MSG msg;
|
||||
|
||||
while( GetMessage(&msg,0,0,0) )
|
||||
{
|
||||
bool sended = false;
|
||||
|
||||
// we give our own special function for navigating from the keyboard
|
||||
// if our function returns false then we use a standard navigation
|
||||
// from the system
|
||||
if( msg.message == WM_KEYDOWN &&
|
||||
( msg.wParam == VK_TAB ||
|
||||
msg.wParam == VK_DOWN || msg.wParam == VK_UP ||
|
||||
msg.wParam == VK_LEFT || msg.wParam == VK_DOWN ) )
|
||||
|
||||
{
|
||||
if( MainWindowFunctions::SetNextFocus(msg.wParam) )
|
||||
sended = true;
|
||||
}
|
||||
|
||||
|
||||
// firt we try to send our message to dialogs
|
||||
// (the dialogs on the tab control)
|
||||
if( !sended )
|
||||
{
|
||||
for(unsigned int i=0 ; i<GetPrgRes()->HowManyTabWindows() && !sended ; ++i)
|
||||
{
|
||||
if( IsDialogMessage(GetPrgRes()->GetTabWindow(i), &msg) )
|
||||
sended = true;
|
||||
}
|
||||
}
|
||||
|
||||
// if it's not a message to any of our dialogs we send it
|
||||
// to the main window (it's a dialog as well)
|
||||
if( !sended )
|
||||
{
|
||||
if( !IsDialogMessage(GetPrgRes()->GetMainWindow(), &msg) )
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
SendMessage(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
if there are some messages then they will be sent
|
||||
*/
|
||||
void CheckMessages()
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
while( PeekMessage(&msg, 0, 0, 0, PM_REMOVE) )
|
||||
SendMessage(msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
the window-procedure for the main window
|
||||
*/
|
||||
BOOL CALLBACK MainWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static Messages messages;
|
||||
static Messages<BOOL> messages;
|
||||
|
||||
if( messages.Empty() )
|
||||
// initiation
|
||||
|
@ -167,3 +293,5 @@ static Messages messages;
|
|||
// so that we have the logarythmic time to find the special function to call
|
||||
return messages.Call(message, hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* This file is a part of TTCalc - a mathematical calculator
|
||||
* and is distributed under the (new) BSD licence.
|
||||
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2007, Tomasz Sowa
|
||||
* Copyright (c) 2006-2008, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -47,11 +47,11 @@
|
|||
#include "resource.h"
|
||||
#include "messages.h"
|
||||
#include "tabs.h"
|
||||
#include "pad.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <process.h>
|
||||
|
||||
#include <map>
|
||||
|
||||
|
||||
|
@ -59,12 +59,16 @@ BOOL CALLBACK MainWindowProc(HWND hWnd, UINT messge, WPARAM wParam, LPARAM lPara
|
|||
unsigned __stdcall CalculationsProcedure(void *);
|
||||
int ShowError( Languages::GuiMsg error_code );
|
||||
void MainMessagesLoop();
|
||||
|
||||
void CheckMessages();
|
||||
|
||||
namespace MainWindowFunctions
|
||||
{
|
||||
bool SetNextFocus(WPARAM wParam);
|
||||
void CreateMainMessagesTable(Messages & messages);
|
||||
bool CopyResult();
|
||||
bool CopySpecial();
|
||||
bool PasteFormula();
|
||||
BOOL WmCommand_EditCopyBoth(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
void CreateMainMessagesTable(Messages<BOOL> & messages);
|
||||
BOOL CALLBACK AboutProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# this file is downloaded from a webserver during checking for an update
|
||||
|
||||
[normal]
|
||||
url = http://downloads.sourceforge.net/project/ttcalc/ttcalc/ttcalc-0.9.3/ttcalc-0.9.3-setup.exe
|
||||
filename = ttcalc-0.9.3-setup.exe
|
||||
version.major = 0
|
||||
version.minor = 9
|
||||
version.revision = 3
|
||||
version.prerelease = 0
|
||||
|
||||
[portable]
|
||||
url = http://downloads.sourceforge.net/project/ttcalc/ttcalc/ttcalc-0.9.3/ttcalc-portable-0.9.3-bin.zip
|
||||
filename = ttcalc-portable-0.9.3-bin.zip
|
||||
version.major = 0
|
||||
version.minor = 9
|
||||
version.revision = 3
|
||||
version.prerelease = 0
|
||||
|
Loading…
Reference in New Issue