mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 02:33:15 +02:00
Add complementary color for the alternative polarity in Corrosion table
This commit is contained in:
parent
3f3a43ee5a
commit
d3e513a366
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2022 Kicad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2023 Kicad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
@ -28,9 +28,9 @@ extern double DoubleFromString( const wxString& TextValue );
|
|||||||
CORROSION_TABLE_ENTRY::CORROSION_TABLE_ENTRY( const wxString& aName, const wxString& aSymbol,
|
CORROSION_TABLE_ENTRY::CORROSION_TABLE_ENTRY( const wxString& aName, const wxString& aSymbol,
|
||||||
double aPotential )
|
double aPotential )
|
||||||
{
|
{
|
||||||
m_potential = aPotential;
|
|
||||||
m_name = aName;
|
m_name = aName;
|
||||||
m_symbol = aSymbol;
|
m_symbol = aSymbol;
|
||||||
|
m_potential = aPotential;
|
||||||
}
|
}
|
||||||
|
|
||||||
PANEL_GALVANIC_CORROSION::PANEL_GALVANIC_CORROSION( wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
PANEL_GALVANIC_CORROSION::PANEL_GALVANIC_CORROSION( wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
||||||
@ -136,13 +136,16 @@ void PANEL_GALVANIC_CORROSION::fillTable()
|
|||||||
if( entryA.m_symbol.size() > 0 )
|
if( entryA.m_symbol.size() > 0 )
|
||||||
label += " (" + entryA.m_symbol + ")";
|
label += " (" + entryA.m_symbol + ")";
|
||||||
|
|
||||||
|
m_table->SetRowLabelAlignment( wxALIGN_RIGHT, wxALIGN_CENTER );
|
||||||
m_table->SetRowLabelValue( i, label );
|
m_table->SetRowLabelValue( i, label );
|
||||||
|
m_table->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER );
|
||||||
m_table->SetColLabelValue( i, label );
|
m_table->SetColLabelValue( i, label );
|
||||||
|
m_table->SetCellAlignment( i, j, wxALIGN_CENTER, wxALIGN_CENTER );
|
||||||
|
|
||||||
for( const CORROSION_TABLE_ENTRY& entryB : m_entries )
|
for( const CORROSION_TABLE_ENTRY& entryB : m_entries )
|
||||||
{
|
{
|
||||||
double diff = entryA.m_potential - entryB.m_potential;
|
double diff = entryA.m_potential - entryB.m_potential;
|
||||||
int diff_temp = KiROUND( abs( diff * 100 ) );
|
int diff_temp = KiROUND( abs( diff * 84 ) );
|
||||||
value = "";
|
value = "";
|
||||||
value << diff * 1000; // Let's display it in mV instead of V.
|
value << diff * 1000; // Let's display it in mV instead of V.
|
||||||
m_table->SetCellValue( i, j, value );
|
m_table->SetCellValue( i, j, value );
|
||||||
@ -155,11 +158,21 @@ void PANEL_GALVANIC_CORROSION::fillTable()
|
|||||||
m_table->SetCellBackgroundColour( i, j, wxColor( 193, 231, 255 ) );
|
m_table->SetCellBackgroundColour( i, j, wxColor( 193, 231, 255 ) );
|
||||||
}
|
}
|
||||||
else if( ( KiROUND( abs( diff * 1000 ) ) ) > m_corFilterValue )
|
else if( ( KiROUND( abs( diff * 1000 ) ) ) > m_corFilterValue )
|
||||||
|
{
|
||||||
|
|
||||||
|
if( diff > 0 )
|
||||||
{
|
{
|
||||||
m_table->SetCellBackgroundColour( i, j, wxColour( 202 - diff_temp,
|
m_table->SetCellBackgroundColour( i, j, wxColour( 202 - diff_temp,
|
||||||
206 - diff_temp,
|
206 - diff_temp,
|
||||||
225 - diff_temp ) );
|
225 - diff_temp ) );
|
||||||
}
|
}
|
||||||
|
else if( diff < 0 )
|
||||||
|
{
|
||||||
|
m_table->SetCellBackgroundColour( i, j, wxColour( 255 - diff_temp,
|
||||||
|
217 - diff_temp,
|
||||||
|
194 - diff_temp ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_table->SetCellBackgroundColour( i, j, color_ok );
|
m_table->SetCellBackgroundColour( i, j, color_ok );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user