Formatting. (No functional changes.)

This commit is contained in:
Jeff Young 2023-03-19 22:01:47 +00:00
parent 5d55fc41ae
commit 6f44b85c13
1 changed files with 42 additions and 33 deletions

View File

@ -61,7 +61,8 @@ double mpWindow::zoomIncrementalFactor = 1.1;
IMPLEMENT_ABSTRACT_CLASS( mpLayer, wxObject ) IMPLEMENT_ABSTRACT_CLASS( mpLayer, wxObject )
mpLayer::mpLayer() : m_type( mpLAYER_UNDEF ) mpLayer::mpLayer() :
m_type( mpLAYER_UNDEF )
{ {
SetPen( (wxPen&) *wxBLACK_PEN ); SetPen( (wxPen&) *wxBLACK_PEN );
SetFont( (wxFont&) *wxNORMAL_FONT ); SetFont( (wxFont&) *wxNORMAL_FONT );
@ -198,12 +199,14 @@ wxSize mpInfoLayer::GetSize() const
} }
mpInfoCoords::mpInfoCoords() : mpInfoLayer() mpInfoCoords::mpInfoCoords() :
mpInfoLayer()
{ {
} }
mpInfoCoords::mpInfoCoords( wxRect rect, const wxBrush* brush ) : mpInfoLayer( rect, brush ) mpInfoCoords::mpInfoCoords( wxRect rect, const wxBrush* brush ) :
mpInfoLayer( rect, brush )
{ {
} }
@ -274,12 +277,14 @@ void mpInfoCoords::Plot( wxDC& dc, mpWindow& w )
} }
mpInfoLegend::mpInfoLegend() : mpInfoLayer() mpInfoLegend::mpInfoLegend() :
mpInfoLayer()
{ {
} }
mpInfoLegend::mpInfoLegend( wxRect rect, const wxBrush* brush ) : mpInfoLayer( rect, brush ) mpInfoLegend::mpInfoLegend( wxRect rect, const wxBrush* brush ) :
mpInfoLayer( rect, brush )
{ {
} }
@ -302,7 +307,7 @@ void mpInfoLegend::Plot( wxDC& dc, mpWindow& w )
int scrx = w.GetScrX(); int scrx = w.GetScrX();
int scry = w.GetScrY(); int scry = w.GetScrY();
if( (m_winX != scrx) || (m_winY != scry) ) if( m_winX != scrx || m_winY != scry )
{ {
if( m_winX > 1 ) if( m_winX > 1 )
m_dim.x = (int) floor( (double) (m_dim.x * scrx / m_winX) ); m_dim.x = (int) floor( (double) (m_dim.x * scrx / m_winX) );
@ -323,26 +328,27 @@ void mpInfoLegend::Plot( wxDC& dc, mpWindow& w )
// wxBrush semiWhite(image1); // wxBrush semiWhite(image1);
dc.SetBrush( m_brush ); dc.SetBrush( m_brush );
dc.SetFont( m_font ); dc.SetFont( m_font );
const int baseWidth = (mpLEGEND_MARGIN * 2 + mpLEGEND_LINEWIDTH);
const int baseWidth = mpLEGEND_MARGIN * 2 + mpLEGEND_LINEWIDTH;
int textX = baseWidth, textY = mpLEGEND_MARGIN; int textX = baseWidth, textY = mpLEGEND_MARGIN;
int plotCount = 0; int plotCount = 0;
int posY = 0; int posY = 0;
int tmpX = 0, tmpY = 0; int tmpX = 0;
mpLayer* ly = nullptr; int tmpY = 0;
mpLayer* layer = nullptr;
wxPen lpen; wxPen lpen;
wxString label; wxString label;
for( unsigned int p = 0; p < w.CountAllLayers(); p++ ) for( unsigned int p = 0; p < w.CountAllLayers(); p++ )
{ {
ly = w.GetLayer( p ); layer = w.GetLayer( p );
if( (ly->GetLayerType() == mpLAYER_PLOT) && ( ly->IsVisible() ) ) if( layer->GetLayerType() == mpLAYER_PLOT && layer->IsVisible() )
{ {
label = ly->GetName(); label = layer->GetName();
dc.GetTextExtent( label, &tmpX, &tmpY ); dc.GetTextExtent( label, &tmpX, &tmpY );
textX = textX = ( textX > tmpX + baseWidth ) ? textX : tmpX + baseWidth + mpLEGEND_MARGIN;
( textX > (tmpX + baseWidth) ) ? textX : (tmpX + baseWidth + mpLEGEND_MARGIN); textY += tmpY;
textY += (tmpY);
} }
} }
@ -358,12 +364,12 @@ void mpInfoLegend::Plot( wxDC& dc, mpWindow& w )
for( unsigned int p2 = 0; p2 < w.CountAllLayers(); p2++ ) for( unsigned int p2 = 0; p2 < w.CountAllLayers(); p2++ )
{ {
ly = w.GetLayer( p2 ); layer = w.GetLayer( p2 );
if( (ly->GetLayerType() == mpLAYER_PLOT) && ( ly->IsVisible() ) ) if( layer->GetLayerType() == mpLAYER_PLOT && layer->IsVisible() )
{ {
label = ly->GetName(); label = layer->GetName();
lpen = ly->GetPen(); lpen = layer->GetPen();
dc.GetTextExtent( label, &tmpX, &tmpY ); dc.GetTextExtent( label, &tmpX, &tmpY );
dc.SetPen( lpen ); dc.SetPen( lpen );
// textX = (textX > (tmpX + baseWidth)) ? textX : (tmpX + baseWidth); // textX = (textX > (tmpX + baseWidth)) ? textX : (tmpX + baseWidth);
@ -1622,7 +1628,8 @@ EVT_MENU( mpID_ZOOM_OUT, mpWindow::OnZoomOut )
EVT_MENU( mpID_LOCKASPECT, mpWindow::OnLockAspect ) EVT_MENU( mpID_LOCKASPECT, mpWindow::OnLockAspect )
END_EVENT_TABLE() END_EVENT_TABLE()
mpWindow::mpWindow() : wxWindow(), mpWindow::mpWindow() :
wxWindow(),
m_lockaspect( false ), m_lockaspect( false ),
m_minX( 0.0 ), m_minX( 0.0 ),
m_maxX( 0.0 ), m_maxX( 0.0 ),
@ -2831,7 +2838,8 @@ void mpWindow::SetColourTheme( const wxColour& bgColour, const wxColour& drawCol
IMPLEMENT_DYNAMIC_CLASS( mpFXYVector, mpFXY ) IMPLEMENT_DYNAMIC_CLASS( mpFXYVector, mpFXY )
// Constructor // Constructor
mpFXYVector::mpFXYVector( const wxString& name, int flags ) : mpFXY( name, flags ) mpFXYVector::mpFXYVector( const wxString& name, int flags ) :
mpFXY( name, flags )
{ {
m_index = 0; m_index = 0;
m_minX = -1; m_minX = -1;
@ -3035,7 +3043,8 @@ void mpText::Plot( wxDC& dc, mpWindow& w )
// mpPrintout - provided by Davide Rondini // mpPrintout - provided by Davide Rondini
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
mpPrintout::mpPrintout( mpWindow* drawWindow, const wxChar* title ) : wxPrintout( title ) mpPrintout::mpPrintout( mpWindow* drawWindow, const wxChar* title ) :
wxPrintout( title )
{ {
drawn = false; drawn = false;
plotWindow = drawWindow; plotWindow = drawWindow;