Fixes for drawing color labels in simulator's signal list
This commit is contained in:
parent
f954abae4e
commit
81e015036e
|
@ -478,36 +478,40 @@ void SIM_PLOT_FRAME::updateSignalList()
|
||||||
// Build an image list, to show the color of the corresponding trace
|
// Build an image list, to show the color of the corresponding trace
|
||||||
// in the plot panel
|
// in the plot panel
|
||||||
// This image list is used for trace and cursor lists
|
// This image list is used for trace and cursor lists
|
||||||
#define ICON_SIZEX 10
|
wxMemoryDC bmDC;
|
||||||
#define ICON_SIZEY 10
|
const int isize = bmDC.GetCharHeight();
|
||||||
|
|
||||||
if( m_signalsIconColorList == NULL )
|
if( m_signalsIconColorList == NULL )
|
||||||
m_signalsIconColorList = new wxImageList( ICON_SIZEX, ICON_SIZEY, false );
|
m_signalsIconColorList = new wxImageList( isize, isize, false );
|
||||||
else
|
else
|
||||||
m_signalsIconColorList->RemoveAll();
|
m_signalsIconColorList->RemoveAll();
|
||||||
|
|
||||||
wxMemoryDC bmDC;
|
|
||||||
const int isize = bmDC.GetCharHeight();
|
|
||||||
wxBitmap bitmap( isize, isize );
|
|
||||||
|
|
||||||
for( const auto& trace : CurrentPlot()->GetTraces() )
|
for( const auto& trace : CurrentPlot()->GetTraces() )
|
||||||
{
|
{
|
||||||
|
wxBitmap bitmap( isize, isize );
|
||||||
bmDC.SelectObject( bitmap );
|
bmDC.SelectObject( bitmap );
|
||||||
wxColor tcolor = trace.second->GetTraceColour();
|
wxColor tcolor = trace.second->GetTraceColour();
|
||||||
|
|
||||||
|
wxColour bgColor = m_signals->wxWindow::GetBackgroundColour();
|
||||||
|
bmDC.SetPen( wxPen( bgColor ) );
|
||||||
|
bmDC.SetBrush( wxBrush( bgColor ) );
|
||||||
|
bmDC.DrawRectangle( 0, 0, isize, isize ); // because bmDC.Clear() does not work in wxGTK
|
||||||
|
|
||||||
bmDC.SetPen( wxPen( tcolor ) );
|
bmDC.SetPen( wxPen( tcolor ) );
|
||||||
bmDC.SetBrush( wxBrush( m_signals->GetBackgroundColour() ) );
|
|
||||||
bmDC.Clear();
|
|
||||||
bmDC.SetBrush( wxBrush( tcolor ) );
|
bmDC.SetBrush( wxBrush( tcolor ) );
|
||||||
bmDC.DrawRectangle( 0, isize/4, isize, isize - (isize/4) );
|
bmDC.DrawRectangle( 0, isize / 4 + 1, isize, isize / 2 );
|
||||||
|
|
||||||
bmDC.SelectObject( wxNullBitmap ); // Needed to initialize bitmap
|
bmDC.SelectObject( wxNullBitmap ); // Needed to initialize bitmap
|
||||||
|
|
||||||
|
bitmap.SetMask( new wxMask( bitmap, *wxBLACK ) );
|
||||||
m_signalsIconColorList->Add( bitmap );
|
m_signalsIconColorList->Add( bitmap );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( bmDC.IsOk() )
|
||||||
|
{
|
||||||
bmDC.SetBrush( wxNullBrush );
|
bmDC.SetBrush( wxNullBrush );
|
||||||
bmDC.SetPen( wxNullPen );
|
bmDC.SetPen( wxNullPen );
|
||||||
|
}
|
||||||
|
|
||||||
m_signals->SetImageList( m_signalsIconColorList, wxIMAGE_LIST_SMALL );
|
m_signals->SetImageList( m_signalsIconColorList, wxIMAGE_LIST_SMALL );
|
||||||
|
|
||||||
|
|
|
@ -428,6 +428,7 @@ SIM_PLOT_PANEL::SIM_PLOT_PANEL( SIM_TYPE aType, wxWindow* parent, wxWindowID id,
|
||||||
}
|
}
|
||||||
|
|
||||||
m_legend = new mpInfoLegend( wxRect( 0, 40, 200, 40 ), wxTRANSPARENT_BRUSH );
|
m_legend = new mpInfoLegend( wxRect( 0, 40, 200, 40 ), wxTRANSPARENT_BRUSH );
|
||||||
|
m_legend->SetVisible( false );
|
||||||
AddLayer( m_legend );
|
AddLayer( m_legend );
|
||||||
m_topLevel.push_back( m_legend );
|
m_topLevel.push_back( m_legend );
|
||||||
SetColourTheme( *wxBLACK, *wxWHITE, grey );
|
SetColourTheme( *wxBLACK, *wxWHITE, grey );
|
||||||
|
|
Loading…
Reference in New Issue