KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pns_tune_status_popup.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2014-2015 CERN
5 * Copyright (C) 2016-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 * Author: Tomasz Wlostowski <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include "eda_draw_frame.h"
24#include "pns_router.h"
25#include "pns_meander_placer.h"
26#include <wx/settings.h>
27
29{
30 PNS::MEANDER_PLACER_BASE* placer = dynamic_cast<PNS::MEANDER_PLACER_BASE*>( aRouter->Placer() );
31
32 if( !placer )
33 return;
34
35 EDA_DRAW_FRAME* frame = static_cast<EDA_DRAW_FRAME*>( GetParent() );
36
37 SetText( placer->TuningInfo( frame->GetUserUnits() ) );
38
39 // Determine the background color first and choose a contrasting value
40 COLOR4D bg( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
41 double h, s, l;
42 bg.ToHSL( h, s, l );
43
44 switch( placer->TuningStatus() )
45 {
47 if( l < 0.5 )
48 SetTextColor( wxColor( 127, 200, 127 ) );
49 else
50 SetTextColor( wxColor( 0, 92, 0 ) );
51
52 break;
53
55 if( l < 0.5 )
56 SetTextColor( wxColor( 242, 100, 126 ) );
57 else
58 SetTextColor( wxColor( 122, 0, 0 ) );
59
60 break;
61
63 if( l < 0.5 )
64 SetTextColor( wxColor( 66, 184, 235 ) );
65 else
66 SetTextColor( wxColor( 19, 19, 195 ) );
67
68 break;
69 }
70}
71
The base class for create windows for drawing purpose.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
void ToHSL(double &aOutHue, double &aOutSaturation, double &aOutValue) const
Converts current color (stored in RGB) to HSL format.
Definition: color4d.cpp:295
Base class for Single trace & Differential pair meandering tools, as both of them share a lot of code...
virtual const wxString TuningInfo(EDA_UNITS aUnits) const =0
Return a string describing the status and length of the tuned traces.
virtual TUNING_STATUS TuningStatus() const =0
Return the tuning status (too short, too long, etc.) of the trace(s) being tuned.
PLACEMENT_ALGO * Placer()
Definition: pns_router.h:213
void UpdateStatus(PNS::ROUTER *aRouter)
void SetTextColor(const wxColour &aColor)
Change text color.
void SetText(const wxString &aText)
Display a text.
EDA_UNITS GetUserUnits() const