KiCad PCB EDA Suite
sim_plot_colors.h
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) 2021 Sylwester Kocjan <[email protected]>
5 * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * https://www.gnu.org/licenses/gpl-3.0.html
20 * or you may search the http://www.gnu.org website for the version 3 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef __SIM_PLOT_COLORS__
26#define __SIM_PLOT_COLORS__
27
28
29#include <map>
30#include <vector>
31#include <wx/colour.h>
32#include <wx/string.h>
33
34
35class TRACE;
36
43{
44public:
47
48 // Identifiers (indexes) for color choice in color table
49 enum class COLOR_SET
50 {
52 FOREGROUND,
53 AXIS,
54 CURSOR,
55 TRACE // First index for trace colors list
56 };
57
62 wxColour GetPlotColor( enum COLOR_SET aColorId );
63
68 wxColour GenerateColor( std::map<wxString, TRACE*> aTraces );
69
75 static void FillDefaultColorList( bool aWhiteBg );
76
77private:
79 static std::vector<wxColour> m_colorList;
80
84 enum COLOR_SET getPlotColorCount() { return static_cast<enum COLOR_SET>( m_colorList.size() ); }
85};
86
89inline bool operator<( SIM_PLOT_COLORS::COLOR_SET& x, int y );
90inline bool operator>=( SIM_PLOT_COLORS::COLOR_SET& x, int y );
97
98
99#endif // __SIM_PLOT_COLORS__
Cursor attached to a trace to follow its values:
wxColour GenerateColor(std::map< wxString, TRACE * > aTraces)
wxColour GetPlotColor(enum COLOR_SET aColorId)
enum COLOR_SET getPlotColorCount()
static std::vector< wxColour > m_colorList
‍The color list to draw traces, bg, fg, axis...
static void FillDefaultColorList(bool aWhiteBg)
Fills m_colorList by a default set of colors.
bool operator<(SIM_PLOT_COLORS::COLOR_SET &x, SIM_PLOT_COLORS::COLOR_SET &y)
bool operator>=(SIM_PLOT_COLORS::COLOR_SET &x, SIM_PLOT_COLORS::COLOR_SET &y)
SIM_PLOT_COLORS::COLOR_SET & operator++(SIM_PLOT_COLORS::COLOR_SET &x)
SIM_PLOT_COLORS::COLOR_SET operator+(SIM_PLOT_COLORS::COLOR_SET x, SIM_PLOT_COLORS::COLOR_SET y)
SIM_PLOT_COLORS::COLOR_SET operator%(int x, SIM_PLOT_COLORS::COLOR_SET y)
SIM_PLOT_COLORS::COLOR_SET operator-(SIM_PLOT_COLORS::COLOR_SET x, SIM_PLOT_COLORS::COLOR_SET y)