Beispiel #1
0
/*****************************************************
**
**   DcPainter   ---   drawRectangle
**
******************************************************/
void DcPainter::drawRectangle( const double &x, const double &y, const double &w, const double &h, const double rnd )
{
	//printf( "DcPainter::drawRectangle x %f y %f w %f h %f rnd %f\n", x, y, w, h, rnd );
	if ( rnd == 0 )
		dc->DrawRectangle( a_rund( x ), a_rund( y ), a_rund( w ), a_rund( h ));
	else
		dc->DrawRoundedRectangle( a_rund( x ), a_rund( y ), a_rund( w ), a_rund( h ), rnd );
}
Beispiel #2
0
/*****************************************************
**
**   DcPainter   ---   drawTextFormatted
**
******************************************************/
void DcPainter::drawTextFormatted( const MRect &r, const wxString &t, const int& align )
{
	if ( t.IsEmpty() ) return;

	//printf( "DcPainter::drawTextFormatted x %f y %f w %f h %f s %s\n", r.x, r.y, r.width, r.height, str2char( t ));
	wxCoord w, h;
	dc->GetTextExtent( t, &w, &h );
	int xmitte, ymitte, x, y;

	ymitte = 2 * (int)r.y + (int)r.height;
	ymitte /= 2;
	if ( align & Align::VCenter ) y = ymitte - h /2;
	else if ( align & Align::Top ) y = r.y;
	else y = r.y + r.height - h;

	xmitte = 2 * r.x + r.width;
	xmitte /= 2;
	if ( align & Align::HCenter ) x = xmitte - w /2;
	else if ( align & Align::Left ) x = r.x;
	else x = r.x + r.width - w;

	dc->DrawText( t, a_rund( x ), a_rund( y ));
}
Beispiel #3
0
/*****************************************************
**
**   Formatter   ---   getDegMinSecFormatted
**
******************************************************/
const wxString Formatter::getDegMinSecFormatted( double t, const int &format, const double &minvalue, const double &maxvalue )
{
	double sec = 0;
	int deg = 0;
	int min = 0;

	if ( t < minvalue || t > maxvalue )
	{
		printf( "Formatter::getDegMinSecFormatted WARN invalid value %f, minvalue was %f maxvalue %f\n", t, minvalue, maxvalue );
		t = a_red( t, maxvalue );
	}

	getDegMinSecInts2( t, deg, min, sec );

	if ( format == DEG_PRECISION_MORE )
	{
		return wxString::Format( wxT( "%02d:%02d:%02d.%02d" ), deg, min, (int)sec, (int)(.5 + 100 * ( sec - (int)sec )));
	}
	else
	{
		sec = a_rund( sec );
		if ( sec == 60 )
		{
			sec = 0;
			min++;
			if ( min == 60 )
			{
				min = 0;
				deg++;
			}
		}
	}
	if ( format == DEG_PRECISION_SECOND || ( DEG_PRECISION_FLEXIBLE && sec != 0 ))
	{
		return wxString::Format( wxT( "%02d:%02d:%02d" ), deg, min, (int)sec );
	}
	else
	{
		if ( sec >= 30 ) min++;
		if ( min == 60 )
		{
			min = 0;
			deg++;
		}
		return wxString::Format( wxT( "%02d:%02d" ), deg, min );
	}
}
Beispiel #4
0
/*****************************************************
**
**   DcPainter   ---   drawBitmap
**
******************************************************/
void DcPainter::drawBitmap( const wxBitmap &bitmap, const double &x0, const double &y0, const bool &transparent )
{
	dc->DrawBitmap( bitmap, a_rund( x0 ), a_rund( y0 ), transparent );
}
Beispiel #5
0
/*****************************************************
**
**   DcPainter   ---   drawPoint
**
******************************************************/
void DcPainter::drawPoint( const double &x, const double &y )
{
	dc->DrawPoint( a_rund(x), a_rund(y) );
}
Beispiel #6
0
/*****************************************************
**
**   DcPainter   ---   drawArc
**
******************************************************/
void DcPainter::drawArc( const double &x0, const double &y0, const double &xmax, const double &ymax,
	const double &w1, const double &w2 )
{
	dc->DrawEllipticArc( a_rund(x0), a_rund(y0), a_rund(xmax), a_rund(ymax), a_rund(w1), a_rund( w2) );
}
Beispiel #7
0
/*****************************************************
**
**   DcPainter   ---   drawEllipse
**
******************************************************/
void DcPainter::drawEllipse( const double &x0, const double &y0, const double &xmax, const double &ymax )
{
	dc->DrawEllipse( a_rund(x0), a_rund(y0), a_rund(xmax), a_rund(ymax) );
}
Beispiel #8
0
/*****************************************************
**
**   DcPainter   ---   drawLine
**
******************************************************/
void DcPainter::drawLine( const double &x1, const double &y1, const double &x2, const double &y2 )
{
	dc->DrawLine( a_rund( x1 ), a_rund( y1 ), a_rund( x2 ), a_rund( y2 ));
}