Hotglue wxLogDebug into math/util.h without the global include
This commit is contained in:
parent
5f581aa6ad
commit
0b4a680dbb
|
@ -31,6 +31,11 @@
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to avoid directly including wx/log.h for the templated functions in kimath
|
||||||
|
*/
|
||||||
|
void kimathLogDebug( const char* aFormatString, ... );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Clamp
|
* Function Clamp
|
||||||
* limits @a value within the range @a lower <= @a value <= @a upper. It will work
|
* limits @a value within the range @a lower <= @a value <= @a upper. It will work
|
||||||
|
@ -70,6 +75,8 @@ constexpr ret_type KiROUND( fp_type v )
|
||||||
if( std::numeric_limits<ret_type>::max() < ret ||
|
if( std::numeric_limits<ret_type>::max() < ret ||
|
||||||
std::numeric_limits<ret_type>::lowest() > ret )
|
std::numeric_limits<ret_type>::lowest() > ret )
|
||||||
{
|
{
|
||||||
|
kimathLogDebug( "Overflow KiROUND converting value %f to %s", double( v ),
|
||||||
|
typeid( ret_type ).name() );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,21 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <math/util.h>
|
#include <math/util.h>
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
|
void kimathLogDebug( const char* aFormatString, ... )
|
||||||
|
{
|
||||||
|
if( wxLog::IsLevelEnabled( wxLOG_Debug, wxASCII_STR( wxLOG_COMPONENT ) ) )
|
||||||
|
{
|
||||||
|
va_list argList;
|
||||||
|
va_start( argList, aFormatString );
|
||||||
|
|
||||||
|
wxVLogWarning( aFormatString, argList );
|
||||||
|
|
||||||
|
va_end( argList );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
int rescale( int aNumerator, int aValue, int aDenominator )
|
int rescale( int aNumerator, int aValue, int aDenominator )
|
||||||
|
|
Loading…
Reference in New Issue