Browse Source

Fix some contrast and update issues with sim cursors.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18390
jobs
Jeff Young 1 year ago
parent
commit
e3d4137521
  1. 1
      eeschema/sim/legacy_workbook.cpp
  2. 11
      eeschema/sim/sim_plot_tab.cpp
  3. 3
      eeschema/sim/simulator_frame_ui.cpp

1
eeschema/sim/legacy_workbook.cpp

@ -44,7 +44,6 @@ void SIMULATOR_FRAME_UI::parseTraceParams( SIM_PLOT_TAB* aPlotTab, TRACE* aTrace
CURSOR* cursor = new CURSOR( aTrace, aPlotTab );
cursor->SetName( aSignalName );
cursor->SetPen( wxPen( aTrace->GetTraceColour() ) );
cursor->SetCoordX( x );
aTrace->SetCursor( aCursorId, cursor );

11
eeschema/sim/sim_plot_tab.cpp

@ -365,9 +365,14 @@ void CURSOR::Plot( wxDC& aDC, mpWindow& aWindow )
wxCoord bottomPx = aWindow.GetScrY() - aWindow.GetMarginBottom();
wxPen pen = GetPen();
wxColour fg = GetPen().GetColour();
wxColour fg = aWindow.GetForegroundColour();
COLOR4D cursorColor = COLOR4D( m_trace->GetTraceColour() ).Mix( fg, 0.6 );
COLOR4D textColor = fg;
pen.SetColour( COLOR4D( m_trace->GetTraceColour() ).Mix( fg, 0.6 ).ToColour() );
if( cursorColor.Distance( textColor ) < 0.66 )
textColor.Invert();
pen.SetColour( cursorColor.ToColour() );
pen.SetStyle( m_continuous ? wxPENSTYLE_SOLID : wxPENSTYLE_LONG_DASH );
aDC.SetPen( pen );
@ -401,7 +406,7 @@ void CURSOR::Plot( wxDC& aDC, mpWindow& aWindow )
aDC.SetBrush( brush );
aDC.DrawPolygon( 3, poly );
aDC.SetTextForeground( fg );
aDC.SetTextForeground( textColor.ToColour() );
aDC.DrawLabel( id, textRect, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL );
}
}

3
eeschema/sim/simulator_frame_ui.cpp

@ -834,12 +834,14 @@ void SIMULATOR_FRAME_UI::rebuildSignalsGrid( wxString aFilter )
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_signalsGrid->SetAttr( row, COL_CURSOR_1, attr );
m_signalsGrid->SetCellValue( row, COL_CURSOR_1, trace->GetCursor( 1 ) ? "1" : "0" );
attr = new wxGridCellAttr;
attr->SetRenderer( new wxGridCellBoolRenderer() );
attr->SetReadOnly(); // not really; we delegate interactivity to GRID_TRICKS
attr->SetAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
m_signalsGrid->SetAttr( row, COL_CURSOR_2, attr );
m_signalsGrid->SetCellValue( row, COL_CURSOR_2, trace->GetCursor( 2 ) ? "1" : "0" );
}
row++;
@ -2051,7 +2053,6 @@ bool SIMULATOR_FRAME_UI::loadJsonWorkbook( const wxString& aPath )
CURSOR* cursor = new CURSOR( aTrace, aPlotTab );
cursor->SetName( aSignalName );
cursor->SetPen( wxPen( aTrace->GetTraceColour() ) );
cursor->SetCoordX( aCursor_js[ "position" ] );
aTrace->SetCursor( aCursorId, cursor );

Loading…
Cancel
Save