Make sure legend reflects gain/phase for AC small signal analyses.
Fixes https://gitlab.com/kicad/code/kicad/issues/14301
This commit is contained in:
parent
6f44b85c13
commit
ec6d709929
|
@ -345,7 +345,7 @@ void mpInfoLegend::Plot( wxDC& dc, mpWindow& w )
|
||||||
|
|
||||||
if( layer->GetLayerType() == mpLAYER_PLOT && layer->IsVisible() )
|
if( layer->GetLayerType() == mpLAYER_PLOT && layer->IsVisible() )
|
||||||
{
|
{
|
||||||
label = layer->GetName();
|
label = layer->GetDisplayName();
|
||||||
dc.GetTextExtent( label, &tmpX, &tmpY );
|
dc.GetTextExtent( label, &tmpX, &tmpY );
|
||||||
textX = ( textX > tmpX + baseWidth ) ? textX : tmpX + baseWidth + mpLEGEND_MARGIN;
|
textX = ( textX > tmpX + baseWidth ) ? textX : tmpX + baseWidth + mpLEGEND_MARGIN;
|
||||||
textY += tmpY;
|
textY += tmpY;
|
||||||
|
@ -368,7 +368,7 @@ void mpInfoLegend::Plot( wxDC& dc, mpWindow& w )
|
||||||
|
|
||||||
if( layer->GetLayerType() == mpLAYER_PLOT && layer->IsVisible() )
|
if( layer->GetLayerType() == mpLAYER_PLOT && layer->IsVisible() )
|
||||||
{
|
{
|
||||||
label = layer->GetName();
|
label = layer->GetDisplayName();
|
||||||
lpen = layer->GetPen();
|
lpen = layer->GetPen();
|
||||||
dc.GetTextExtent( label, &tmpX, &tmpY );
|
dc.GetTextExtent( label, &tmpX, &tmpY );
|
||||||
dc.SetPen( lpen );
|
dc.SetPen( lpen );
|
||||||
|
|
|
@ -131,9 +131,11 @@ public:
|
||||||
SetContinuity( true );
|
SetContinuity( true );
|
||||||
SetDrawOutsideMargins( false );
|
SetDrawOutsideMargins( false );
|
||||||
ShowName( false );
|
ShowName( false );
|
||||||
|
|
||||||
|
SetName( aName );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetName( wxString aName ) override
|
void SetName( const wxString& aName ) override
|
||||||
{
|
{
|
||||||
for( auto& [ idx, cursor ] : m_cursors )
|
for( auto& [ idx, cursor ] : m_cursors )
|
||||||
{
|
{
|
||||||
|
@ -142,6 +144,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
mpFXYVector::SetName( aName );
|
mpFXYVector::SetName( aName );
|
||||||
|
|
||||||
|
if( m_type & SPT_AC_MAG )
|
||||||
|
m_displayName = aName + _( " (gain)" );
|
||||||
|
else if( m_type & SPT_AC_PHASE )
|
||||||
|
m_displayName = aName + _( " (phase)" );
|
||||||
|
else
|
||||||
|
m_displayName = aName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -237,6 +237,11 @@ public:
|
||||||
*/
|
*/
|
||||||
const wxString& GetName() const { return m_name; }
|
const wxString& GetName() const { return m_name; }
|
||||||
|
|
||||||
|
const wxString& GetDisplayName() const
|
||||||
|
{
|
||||||
|
return m_displayName.IsEmpty() ? m_name : m_displayName;
|
||||||
|
}
|
||||||
|
|
||||||
/** Get font set for this layer.
|
/** Get font set for this layer.
|
||||||
* @return Font
|
* @return Font
|
||||||
*/
|
*/
|
||||||
|
@ -264,7 +269,7 @@ public:
|
||||||
/** Set layer name
|
/** Set layer name
|
||||||
* @param name Name, will be copied to internal class member
|
* @param name Name, will be copied to internal class member
|
||||||
*/
|
*/
|
||||||
virtual void SetName( wxString name ) { m_name = name; }
|
virtual void SetName( const wxString& name ) { m_name = name; }
|
||||||
|
|
||||||
/** Set layer font
|
/** Set layer font
|
||||||
* @param font Font, will be copied to internal class member
|
* @param font Font, will be copied to internal class member
|
||||||
|
@ -315,11 +320,13 @@ protected:
|
||||||
wxPen m_pen; // !< Layer's pen
|
wxPen m_pen; // !< Layer's pen
|
||||||
wxBrush m_brush; // !< Layer's brush
|
wxBrush m_brush; // !< Layer's brush
|
||||||
wxString m_name; // !< Layer's name
|
wxString m_name; // !< Layer's name
|
||||||
|
wxString m_displayName;
|
||||||
bool m_continuous; // !< Specify if the layer will be plotted as a continuous line or a set of points.
|
bool m_continuous; // !< Specify if the layer will be plotted as a continuous line or a set of points.
|
||||||
bool m_showName; // !< States whether the name of the layer must be shown (default is true).
|
bool m_showName; // !< States whether the name of the layer must be shown (default is true).
|
||||||
bool m_drawOutsideMargins; // !< select if the layer should draw only inside margins or over all DC
|
bool m_drawOutsideMargins; // !< select if the layer should draw only inside margins or over all DC
|
||||||
mpLayerType m_type; // !< Define layer type, which is assigned by constructor
|
mpLayerType m_type; // !< Define layer type, which is assigned by constructor
|
||||||
bool m_visible; // !< Toggles layer visibility
|
bool m_visible; // !< Toggles layer visibility
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS( mpLayer )
|
DECLARE_DYNAMIC_CLASS( mpLayer )
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue