updated: help
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@118 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
+11
-3
@@ -1,6 +1,5 @@
|
||||
o = resource.o calculation.o convert.o functions.o iniparser.o languages.o mainwindow.o parsermanager.o programresources.o tabs.o variables.o winmain.o
|
||||
|
||||
|
||||
calculation.o: calculation.cpp compileconfig.h parsermanager.h resource.h programresources.h iniparser.h languages.h bigtypes.h threadcontroller.h stopcalculating.h convert.h tabs.h messages.h
|
||||
convert.o: convert.cpp convert.h compileconfig.h bigtypes.h
|
||||
functions.o: functions.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h bigtypes.h threadcontroller.h stopcalculating.h convert.h
|
||||
@@ -20,12 +19,21 @@ winmain.o: winmain.cpp compileconfig.h winmain.h programresources.h iniparser.
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
|
||||
helpdep = ../help/arithmetic_functions.html \
|
||||
helpdep = ../help/arithmetic_functions.html \
|
||||
../help/logarithm_exponential.html \
|
||||
../help/trigonometric_functions.html \
|
||||
../help/inverse_trigonometric_functions.html \
|
||||
../help/hyperbolic_functions.html \
|
||||
../help/inverse_hyperbolic_functions.html \
|
||||
../help/conversions_deg_rad_grad.html \
|
||||
../help/rounding_functions.html \
|
||||
../help/other_functions.html \
|
||||
../help/operators_priority.html \
|
||||
../help/bitwise_functions.html \
|
||||
../help/index.html \
|
||||
../help/userfunctions.html \
|
||||
../help/logical_functions.html \
|
||||
../help/accuracy.html \
|
||||
../help/tips.html \
|
||||
../help/values_and_std_operators.html \
|
||||
../help/styles.css \
|
||||
@@ -33,4 +41,4 @@ helpdep = ../help/arithmetic_functions.html \
|
||||
../help/toc.hhc \
|
||||
../help/help.hhp
|
||||
|
||||
setupdep = ttcalc help ../setup/innosetup.iss ../setup/COPYRIGHT
|
||||
setupdep = ttcalc help ../setup/innosetup.iss ../setup/COPYRIGHT ../COPYRIGHT ../CHANGELOG ../README
|
||||
|
||||
@@ -454,7 +454,7 @@ ProgramResources::ProgramResources()
|
||||
base_output = 10;
|
||||
|
||||
display_always_scientific = false;
|
||||
display_when_scientific = 15;
|
||||
display_when_scientific = 8;
|
||||
display_rounding = -1;
|
||||
remove_zeroes = true;
|
||||
|
||||
|
||||
@@ -69,10 +69,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()
|
||||
|
||||
+159
-159
@@ -1,159 +1,159 @@
|
||||
/*
|
||||
* 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>
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef headerfilestopcalculating
|
||||
#define headerfilestopcalculating
|
||||
|
||||
/*!
|
||||
\file stopcalculating.h
|
||||
\brief it tells us whether there was a stop signal or not
|
||||
*/
|
||||
|
||||
#include <ttmath/ttmathtypes.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
/*!
|
||||
\brief it tells us whether there was a stop signal or not
|
||||
|
||||
we can pass a pointer to the object of this class to the certain
|
||||
calculating methods especially for the method which calculates the
|
||||
Factorial (1*2*3*4....), such methods as the Factorial takes a lot of time
|
||||
and sometimes we want to break the calculations for example when we've got
|
||||
a new input string
|
||||
|
||||
those methods which take a lot of time check the object of type NewStopCalculating
|
||||
and if there was a stop signal they stop and return immediately without returning
|
||||
a correct result
|
||||
|
||||
the stop signal can be caused by another thread in our case by the first (gui) thread
|
||||
|
||||
there'll be only one object of this class
|
||||
(it'll be as an variable of ThreadController class)
|
||||
*/
|
||||
class NewStopCalculating : public ttmath::StopCalculating
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
/*!
|
||||
the constructor
|
||||
*/
|
||||
NewStopCalculating()
|
||||
{
|
||||
stop = 0;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
the destructor
|
||||
*/
|
||||
~NewStopCalculating()
|
||||
{
|
||||
if(stop) CloseHandle(stop);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
it initializes an object of this class
|
||||
|
||||
this method will be called from Init() of the ThreadController object
|
||||
*/
|
||||
bool Init() volatile
|
||||
{
|
||||
char buffer[80];
|
||||
|
||||
// with 'GetTickCount()' we're generating an unique identifier of our event
|
||||
// (there can be another window of ttcalc)
|
||||
sprintf(buffer,"TTCalcStopEventForStoppingCalculations7756%u",
|
||||
(unsigned int)GetTickCount());
|
||||
|
||||
// 'stop' will be manual-reseted and initialized as non-signaled
|
||||
if( (stop = CreateEvent(0,true,false,buffer))==NULL)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
when we want to stop the calculations for example when the user changed somewhat
|
||||
we call the Stop() method from the first (gui) thread
|
||||
*/
|
||||
void Stop() volatile
|
||||
{
|
||||
SetEvent(stop);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
when we start the calculations we call this method
|
||||
|
||||
(we call it from WaitForCalculatingAndBlockForStop() method of
|
||||
ThreadController class)
|
||||
*/
|
||||
void Start() volatile
|
||||
{
|
||||
ResetEvent(stop);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
it returns 'true' if there was a stop signal
|
||||
|
||||
it's useful for the second thread and functions which take plenty of time
|
||||
for calculating, when this method returns 'true' those methods break the
|
||||
calculations and return without returning a correct value
|
||||
*/
|
||||
virtual bool WasStopSignal() const volatile
|
||||
{
|
||||
if( WaitForSingleObject(stop,0) == WAIT_OBJECT_0 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// manual-reset, initialized as non-signaled
|
||||
HANDLE stop;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
/*
|
||||
* 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>
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef headerfilestopcalculating
|
||||
#define headerfilestopcalculating
|
||||
|
||||
/*!
|
||||
\file stopcalculating.h
|
||||
\brief it tells us whether there was a stop signal or not
|
||||
*/
|
||||
|
||||
#include <ttmath/ttmathtypes.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
/*!
|
||||
\brief it tells us whether there was a stop signal or not
|
||||
|
||||
we can pass a pointer to the object of this class to the certain
|
||||
calculating methods especially for the method which calculates the
|
||||
Factorial (1*2*3*4....), such methods as the Factorial takes a lot of time
|
||||
and sometimes we want to break the calculations for example when we've got
|
||||
a new input string
|
||||
|
||||
those methods which take a lot of time check the object of type NewStopCalculating
|
||||
and if there was a stop signal they stop and return immediately without returning
|
||||
a correct result
|
||||
|
||||
the stop signal can be caused by another thread in our case by the first (gui) thread
|
||||
|
||||
there'll be only one object of this class
|
||||
(it'll be as an variable of ThreadController class)
|
||||
*/
|
||||
class NewStopCalculating : public ttmath::StopCalculating
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
/*!
|
||||
the constructor
|
||||
*/
|
||||
NewStopCalculating()
|
||||
{
|
||||
stop = 0;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
the destructor
|
||||
*/
|
||||
~NewStopCalculating()
|
||||
{
|
||||
if(stop) CloseHandle(stop);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
it initializes an object of this class
|
||||
|
||||
this method will be called from Init() of the ThreadController object
|
||||
*/
|
||||
bool Init() volatile
|
||||
{
|
||||
char buffer[80];
|
||||
|
||||
// with 'GetTickCount()' we're generating an unique identifier of our event
|
||||
// (there can be another window of ttcalc)
|
||||
sprintf(buffer,"TTCalcStopEventForStoppingCalculations7756%u",
|
||||
(unsigned int)GetTickCount());
|
||||
|
||||
// 'stop' will be manual-reseted and initialized as non-signaled
|
||||
if( (stop = CreateEvent(0,true,false,buffer))==NULL)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
when we want to stop the calculations for example when the user changed somewhat
|
||||
we call the Stop() method from the first (gui) thread
|
||||
*/
|
||||
void Stop() volatile
|
||||
{
|
||||
SetEvent(stop);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
when we start the calculations we call this method
|
||||
|
||||
(we call it from WaitForCalculatingAndBlockForStop() method of
|
||||
ThreadController class)
|
||||
*/
|
||||
void Start() volatile
|
||||
{
|
||||
ResetEvent(stop);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
it returns 'true' if there was a stop signal
|
||||
|
||||
it's useful for the second thread and functions which take plenty of time
|
||||
for calculating, when this method returns 'true' those methods break the
|
||||
calculations and return without returning a correct value
|
||||
*/
|
||||
virtual bool WasStopSignal() const volatile
|
||||
{
|
||||
if( WaitForSingleObject(stop,0) == WAIT_OBJECT_0 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// manual-reset, initialized as non-signaled
|
||||
HANDLE stop;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user